فهرست منبع

BOM:懒加载下级数据

chris 1 سال پیش
والد
کامیت
1e049ddc4a

+ 3 - 1
src/views/modules/product/template-chose.vue

@@ -20,12 +20,14 @@
       </el-form>
       <el-table
         :data="dataList"
+        :row-key="(row)=>{return row.productId}"
         border
         v-loading="dataListLoading"
         @selection-change="selectionChangeHandle"
         style="width: 100%;">
         <el-table-column
-          type="selection">
+          type="selection"
+        reserve-selection>
         </el-table-column>
         <el-table-column
           label="序号"

+ 10 - 7
src/views/modules/tech/product-add-or-update.vue

@@ -359,15 +359,21 @@ export default {
       })
     },
     addProductItems (items) {
-      this.productDetails = []
+      // this.productDetails = []
       items.forEach((item) => {
         this.addProductItem(item)
       })
     },
     addProductItem (item) {
-      this.productDetails.push({
-        ...item
-      })
+      let productId = item.productId
+      if (!this.productDetails.some(item => item.productId === productId)) {
+        this.productDetails.push({
+          ...item
+        })
+      }
+    },
+    deleteProductHandle (productId) {
+      this.productDetails.splice(this.productDetails.findIndex((item) => item.productId === productId), 1)
     },
     addMaterial () {
       this.materialListVisible = true
@@ -455,9 +461,6 @@ export default {
     },
     removeDrawingItem (index) {
       this.drawingList.splice(index, 1)
-    },
-    deleteProductHandle (productId) {
-      this.productDetails.splice(this.productDetails.findIndex((item) => item.productId === productId), 1)
     }
   }
 }

+ 12 - 9
src/views/modules/tech/product-detail.vue

@@ -156,29 +156,32 @@
           </el-table-column>
           <el-table-column
             prop="productName"
-            header-align="center"
-            align="center"
-            min-width="140"
+            header-align="left"
+            align="left"
+            width="200"
+            :show-tooltip-when-overflow="true"
             label="物品名称">
           </el-table-column>
           <el-table-column
             prop="productSpec"
-            header-align="center"
-            align="center"
+            header-align="left"
+            align="left"
             min-width="120"
+            :show-tooltip-when-overflow="true"
             label="规格">
           </el-table-column>
           <el-table-column
             prop="cnt"
-            header-align="center"
-            align="center"
+            header-align="left"
+            align="left"
             min-width="80"
+            :show-tooltip-when-overflow="true"
             label="数量">
           </el-table-column>
           <el-table-column
             prop="notes"
-            header-align="center"
-            align="center"
+            header-align="left"
+            align="left"
             min-width="220"
             :show-tooltip-when-overflow="true"
             label="备注">

+ 8 - 1
src/views/modules/tech/product-management.vue

@@ -61,7 +61,7 @@
           prop="productCode"
           header-align="center"
           align="center"
-          width="140"
+          width="200"
           :show-tooltip-when-overflow="true"
           label="物料编码">
         </el-table-column>
@@ -739,6 +739,13 @@ export default {
       loadingData (row, treeNode, resolve) {
         getChildren(row.productId).then(({data}) => {
           if (data && data.code === '200') {
+            data.data.forEach(item => {
+              if (item.attachList2 && item.attachList2.length > 0) {
+                item.simplePic = downloadUrl + item.attachList2[0].url
+              } else {
+                item.simplePic = ''
+              }
+            })
             resolve(data.data)
           } else {
             this.$message.error(data.msg)