guoyuji
2024-01-23 a8513206048eed68f2908a4d01ee9c2d9bd331e2
产品界面展示数据完整
7个文件已修改
2个文件已删除
280 ■■■■ 已修改文件
north-glass-erp/.idea/dataSources.local.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/.idea/dataSources.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/FinishedGoodsInventory.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/FinishedOperateLog.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/Product.xml 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/Product.xml 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/.idea/dataSources.local.xml
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="dataSourceStorageLocal" created-in="IU-232.9559.62">
    <data-source name="@localhost" uuid="521b6701-da00-48a8-bf4f-cf6bbb7d685d">
    <data-source name="@localhost [2]" uuid="165c5447-d19a-4aaf-af5f-cee92ae696c2">
      <database-info product="MySQL" version="8.0.22" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0)" dbms="MYSQL" exact-version="8.0.22" exact-driver-version="8.0">
        <extra-name-characters>#@</extra-name-characters>
        <identifier-quote-string>`</identifier-quote-string>
        <jdbc-catalog-is-schema>true</jdbc-catalog-is-schema>
      </database-info>
      <case-sensitivity plain-identifiers="lower" quoted-identifiers="lower" />
      <secret-storage>master_key</secret-storage>
@@ -14,19 +13,16 @@
        <introspection-scope>
          <node kind="schema">
            <name qname="@" />
            <name qname="erp_sd" />
            <name qname="erp_user_info" />
            <name qname="mm" />
            <name qname="pp" />
            <name qname="sd" />
          </node>
        </introspection-scope>
      </schema-mapping>
    </data-source>
    <data-source name="@10.153.19.150" uuid="2f24a638-142d-4401-9e71-359f1be8d502">
    <data-source name="@10.153.19.150" uuid="1becdbe6-0c8e-40b3-a9c0-8b2c968172ca">
      <database-info product="MySQL" version="8.0.19" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0)" dbms="MYSQL" exact-version="8.0.19" exact-driver-version="8.0">
        <extra-name-characters>#@</extra-name-characters>
        <identifier-quote-string>`</identifier-quote-string>
        <jdbc-catalog-is-schema>true</jdbc-catalog-is-schema>
      </database-info>
      <case-sensitivity plain-identifiers="lower" quoted-identifiers="lower" />
      <secret-storage>master_key</secret-storage>
@@ -34,7 +30,6 @@
      <schema-mapping>
        <introspection-scope>
          <node kind="schema">
            <name qname="@" />
            <name qname="erp_user_info" />
            <name qname="mm" />
            <name qname="pp" />
north-glass-erp/.idea/dataSources.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
    <data-source source="LOCAL" name="@localhost" uuid="521b6701-da00-48a8-bf4f-cf6bbb7d685d">
    <data-source source="LOCAL" name="@localhost [2]" uuid="165c5447-d19a-4aaf-af5f-cee92ae696c2">
      <driver-ref>mysql.8</driver-ref>
      <synchronize>true</synchronize>
      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
      <jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
      <working-dir>$ProjectFileDir$</working-dir>
    </data-source>
    <data-source source="LOCAL" name="@10.153.19.150" uuid="2f24a638-142d-4401-9e71-359f1be8d502">
    <data-source source="LOCAL" name="@10.153.19.150" uuid="1becdbe6-0c8e-40b3-a9c0-8b2c968172ca">
      <driver-ref>mysql.8</driver-ref>
      <synchronize>true</synchronize>
      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
@@ -19,7 +19,8 @@
watch(productGlassTypeStore,(newVal,oldVal) => {
  request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => {
    if(res.code==200){
      xGrid.value.loadData(res.data)
      pageTotal.value=res.data.total
      xGrid.value.loadData(res.data.data)
      gridOptions.loading=false
    }else{
      ElMessage.warning(res.msg)
@@ -42,8 +43,11 @@
    typeName:''
  }
})
//定义页面总页数
let pageTotal=ref('')
//定义数据返回结果
let produceList = ref([])
//定义当前页数
let pageNum=$ref(1)
let pageState = null
//监听产品滚动条状态,滚动到底部向后端请求数据
@@ -63,7 +67,13 @@
      if(produceList.length===500 && pageNum<(produceList.length/100)){
        pageNum=pageNum+5
      }else{
        //判断是否是最大页面
        if (pageNum>=pageTotal.value){
          //ElMessage.warning("没有更多数据了")
          return
        }
        pageNum=pageNum+1
      }
      pageState=true
    }
@@ -84,12 +94,12 @@
      try{
        if(res.code==200){
          if(pageState){
            produceList = produceList.concat(res.data)
            produceList = produceList.concat(res.data.data)
            if(produceList.length>500){
              produceList=produceList.slice(100,600)
            }
          }else{
            produceList = res.data.concat(produceList)
            produceList = res.data.data.concat(produceList)
            if(produceList.length>500){
              produceList=produceList.slice(0,500)
            }
@@ -109,9 +119,13 @@
})
//第一次加载数据
request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => {
  if(res.code==200){
    produceList = produceList.value.concat(deepClone(res.data))
    pageTotal.value=res.data.total
    produceList = produceList.value.concat(deepClone(res.data.data))
    xGrid.value.reloadData(produceList)
    gridOptions.loading=false
  }else{
@@ -123,7 +137,7 @@
const getTableRow = (row,type) =>{
/*const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' : {
      router.push({path: '/main/product/createProduct', query: { id: row.id }})
@@ -134,7 +148,7 @@
      break
    }
  }
}
}*/
// const getCheckList = (row) =>{
//   alert('我接收到子组件传送的确认复选框信息可在控制台查看')
@@ -197,8 +211,9 @@
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '页数:'
          return `页数:${pageNum}/${pageTotal.value}`
        }
        return ''
      })
    ]
@@ -206,7 +221,50 @@
})
//表格拖拽
/*使用筛选,后端获取数据*/
const changeFilterEvent = (event, option, $panel,) => {
  // 手动触发筛选
  $panel.changeOption(event, !!option.data, option)
}
function filterChanged(column){
  gridOptions.loading=true
  //筛选条件发生变化条件发生变化
  let value = column.datas[0]!=undefined?column.datas[0]:''
  value = value.trim()
  //判断是否存在外键
  if (column.property.indexOf('.')>-1){
    const  columnArr = column.property.split('.')
    filterData.value[columnArr[0]] = {
      [columnArr[1]]:value
    }
  }else{
    filterData.value[column.property] = value
  }
  request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => {
    if(res.code==200){
      pageTotal.value=res.data.total
      pageNum=1
      produceList = deepClone(res.data.data)
      xGrid.value.loadData(produceList)
      gridOptions.loading=false
    }else{
      ElMessage.warning(res.msg)
    }
  })
}
/*后端返回结果多层嵌套展示*/
const hasDecimal = (value) => {
  const regex = /\./; // 定义正则表达式,查找小数点
  return regex.test(value); // 返回true/false
}
/*表格拖拽*/
let sortable2: any
const columnDrop2 = () => {
@@ -256,39 +314,6 @@
    sortable2.destroy()
  }
})
const changeFilterEvent = (event, option, $panel,) => {
  // 手动触发筛选
  $panel.changeOption(event, !!option.data, option)
}
function filterChanged(column){
  gridOptions.loading=true
  //筛选条件发生变化条件发生变化
  let value = column.datas[0]!=undefined?column.datas[0]:''
  value = value.trim()
  //判断是否存在外键
  if (column.property.indexOf('.')>-1){
    const  columnArr = column.property.split('.')
    filterData.value[columnArr[0]] = {
      [columnArr[1]]:value
    }
  }else{
    filterData.value[column.property] = value
  }
  request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => {
    if(res.code==200){
      produceList = deepClone(res.data)
      xGrid.value.loadData(produceList)
      gridOptions.loading=false
    }else{
      ElMessage.warning(res.msg)
    }
  })
}
const hasDecimal = (value) => {
  const regex = /\./; // 定义正则表达式,查找小数点
  return regex.test(value); // 返回true/false
  }
</script>
north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductMapper.java
@@ -12,4 +12,6 @@
                                 @Param("pageSize") Integer pageSiz,
                                 @Param("glassTypeId") String glassTypeId,
                                 @Param("product") Product product);
    Integer getPageTotal(Integer offset, Integer pageSize, String glassTypeId, Product product);
}
north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java
@@ -22,9 +22,8 @@
            glassTypeId = glassType.get(1);
        }
        Map<String,Object> map = new HashMap<>();
        map.put("list",productMapper.defaultProduct(offset,pageSize,glassTypeId,product));
        map.put("pageNum",pageNum);
        map.put("data",productMapper.defaultProduct(offset,pageSize,glassTypeId,product));
        map.put("total",productMapper.getPageTotal(offset,pageSize,glassTypeId,product));
        return map;
    }
}
north-glass-erp/src/main/resources/mapper/mm/FinishedGoodsInventory.xml
File was deleted
north-glass-erp/src/main/resources/mapper/mm/FinishedOperateLog.xml
File was deleted
north-glass-erp/src/main/resources/mapper/sd/Product.xml
@@ -3,13 +3,10 @@
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.erp.mapper.sd.ProductMapper">
    <resultMap id="productmap" type="com.example.erp.entity.sd.Product" >
    <resultMap id="productMap" type="com.example.erp.entity.sd.Product" >
        <id column="id" property="id"/>
<<<<<<< HEAD
        <result column="product_name" property="productName"/>
=======
        <result column="product" property="product"/>
>>>>>>> 2bf272a9d41a2b6c67910b23371af9537a9153a5
        <result column="product" property="productName"/>
        <result column="total_thickness" property="totalThickness"/>
        <result column="thickness" property="thickness"/>
        <result column="query" property="query"/>
@@ -18,13 +15,8 @@
        <result column="creator" property="creator"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
<<<<<<< HEAD
        <association property="basicGlassType" javaType="com.example.erp.entity.sd.BasicGlassType">
            <result column="type_id" property="typeID"/>
=======
        <association property="glassType" javaType="com.example.erp.entity.sd.GlassType">
            <result column="type_id" property="typeId"/>
>>>>>>> 2bf272a9d41a2b6c67910b23371af9537a9153a5
            <result column="type_name" property="typeName"/>
        </association>
        <!--<result column="g_typeId" property="glassTypes.typeId"/>
@@ -32,8 +24,8 @@
    </resultMap>
    <select id="defaultProduct" resultMap="productmap">
        select a.id as id,
    <select id="defaultProduct" resultMap="productMap">
        select a.id ,
        a.product_name,
        a.total_thickness,
        a.thickness,
@@ -75,4 +67,38 @@
        limit #{offset},#{pageSize}
        ;
    </select>
    <select id="getPageTotal" >
        select
            CEILING(count(a.id)/#{pageSize})
        from product as a
        left join basic_glass_type bgt on bgt.type_id = a.type_id
        <where>
            <if test="glassTypeId != null and glassTypeId != ''">
                and a.type_id regexp #{glassTypeId}
            </if>
            <if test="product.id != null and product.id != ''">
                and a.id regexp #{product.id}
            </if>
            <if test="product.productName != null and product.productName != ''">
                and a.product_name regexp #{product.productName}
            </if>
            <if test="product.basicGlassType.typeName != null and product.basicGlassType.typeName!= ''">
                and bgt.type_name regexp #{product.basicGlassType.typeName}
            </if>
            <if test="product.query != null and product.query != ''">
                and a.query regexp #{product.query}
            </if>
            <if test="product.creator != null and product.creator != ''">
                and a.creator regexp #{product.creator}
            </if>
            <if test="product.createTime != null and product.createTime != ''">
                and date(a.create_time) regexp #{product.createTime}
            </if>
        </where>
        order by a.id desc
        limit #{offset},#{pageSize}
        ;
    </select>
</mapper>
north-glass-erp/target/classes/mapper/sd/Product.xml
@@ -3,9 +3,10 @@
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.erp.mapper.sd.ProductMapper">
    <resultMap id="productmap" type="com.example.erp.entity.sd.Product" >
    <resultMap id="productMap" type="com.example.erp.entity.sd.Product" >
        <id column="id" property="id"/>
        <result column="product_name" property="productName"/>
        <result column="product" property="productName"/>
        <result column="total_thickness" property="totalThickness"/>
        <result column="thickness" property="thickness"/>
        <result column="query" property="query"/>
@@ -23,8 +24,8 @@
    </resultMap>
    <select id="defaultProduct" resultMap="productmap">
        select a.id as id,
    <select id="defaultProduct" resultMap="productMap">
        select a.id ,
        a.product_name,
        a.total_thickness,
        a.thickness,
@@ -66,4 +67,38 @@
        limit #{offset},#{pageSize}
        ;
    </select>
    <select id="getPageTotal" >
        select
            CEILING(count(a.id)/#{pageSize})
        from product as a
        left join basic_glass_type bgt on bgt.type_id = a.type_id
        <where>
            <if test="glassTypeId != null and glassTypeId != ''">
                and a.type_id regexp #{glassTypeId}
            </if>
            <if test="product.id != null and product.id != ''">
                and a.id regexp #{product.id}
            </if>
            <if test="product.productName != null and product.productName != ''">
                and a.product_name regexp #{product.productName}
            </if>
            <if test="product.basicGlassType.typeName != null and product.basicGlassType.typeName!= ''">
                and bgt.type_name regexp #{product.basicGlassType.typeName}
            </if>
            <if test="product.query != null and product.query != ''">
                and a.query regexp #{product.query}
            </if>
            <if test="product.creator != null and product.creator != ''">
                and a.creator regexp #{product.creator}
            </if>
            <if test="product.createTime != null and product.createTime != ''">
                and date(a.create_time) regexp #{product.createTime}
            </if>
        </where>
        order by a.id desc
        limit #{offset},#{pageSize}
        ;
    </select>
</mapper>