Эх сурвалжийг харах

计划管理 列表展开

landydb 2 сар өмнө
parent
commit
a98342f44a

+ 37 - 6
src/views/modules/production/plan-submit.vue

@@ -20,12 +20,12 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="技术协议:" prop="attachList1">
-            <span class="attch-file" @click="attachDetail(dataForm.attachList1)">{{dataForm.attachList1 == null ? '' : dataForm.attachList1[0].fileName}}</span>
+            <span class="attch-file" @click="attachDetail(dataForm.attachList1)">{{dataForm.attachList1 == null || dataForm.attachList1.length == 0 ? '' : dataForm.attachList1[0].fileName}}</span>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="资料:" prop="attachList2">
-            <span class="attch-file" @click="attachDetail(dataForm.attachList2)">{{dataForm.attachList2 == null ? '' : dataForm.attachList2[0].fileName}}</span>
+            <span class="attch-file" @click="attachDetail(dataForm.attachList2)">{{dataForm.attachList2 == null || dataForm.attachList2.length == 0 ? '' : dataForm.attachList2[0].fileName}}</span>
           </el-form-item>
         </el-col>
       </el-row>
@@ -34,6 +34,11 @@
         :data="dataForm.proProductList"
         border
         v-loading="dataListLoading"
+        @expand-change="handleExpandChange" 
+        :expand-row-keys="expandedRowKeys" 
+        :load="loadingData" 
+        row-key="productId"
+        lazy
         style="width: 100%;">
         <el-table-column
           label="序号"
@@ -158,9 +163,9 @@
           :show-tooltip-when-overflow="true"
           label="计划数量">
           <template slot-scope="scope">
-            <el-form-item :prop="'proProductList.' + scope.$index + '.planCnt'" :rules="dataRule.planCnt" label-width="0">
+            <!-- <el-form-item :prop="'proProductList.' + scope.$index + '.planCnt'" :rules="dataRule.planCnt" label-width="0">
               <el-input v-model="scope.row.planCnt" style="width:80px" :disabled="disabled" @input="scope.row.planCnt = scope.row.planCnt.replace(/[^\d]/g, '')"/>
-            </el-form-item>
+            </el-form-item> -->
           </template>
         </el-table-column>
         <el-table-column
@@ -236,7 +241,9 @@ export default {
         isTechnology: [{required: true, message: '请选择', trigger: 'change'}]
       },
       dataList: [],
-      dataListLoading: false
+      dataListLoading: false,
+      expandedRowKeys: [],
+      treeMap: new Map()
     }
   },
   created () {},
@@ -256,7 +263,11 @@ export default {
         method: 'get'
       }).then(({data}) => {
         if (data && data.code === '200') {
+          data.data.proProductList.map(item => {
+            item.hasChildren = item.proProductList != null && item.proProductList.length > 0
+          })
           this.dataForm = data.data
+          console.log(this.dataForm)
         } else {
           this.$message.error(data.msg)
         }
@@ -302,7 +313,27 @@ export default {
           })
         }
       })
-    }
+    },
+    handleExpandChange(row, expanded) {
+      console.log(row, expanded)
+      if (expanded) {
+        this.expandedRowKeys.push(row.productId)
+      } else {
+        const index = this.expandedRowKeys.indexOf(row.productId)
+        if (index !== -1) {
+          this.expandedRowKeys.splice(index, 1)
+        }
+      }
+    },
+    loadingData(row, treeNode, resolve) {
+      console.log('loadingData')
+      // if (!this.treeMap.has(row.productId)) {
+      //   this.treeMap.set(row.productId, { row, treeNode, resolve })
+      // }
+
+      // row.children = row.proProductList
+      resolve(row.proProductList)
+    },
   }
 }
 </script>

+ 1 - 2
src/views/modules/tech/project-product-assign.vue

@@ -22,7 +22,6 @@
     <span slot="footer" class="dialog-footer">
       <el-button @click="onChose">取消</el-button>
       <el-button
-        v-if="!display"
         type="primary"
         @click="dataFormSubmit()"
         v-reClick
@@ -60,7 +59,7 @@ export default {
     onChose () {
       this.$emit('onChose')
     },
-    async init (item, display) {
+    async init (item) {
       this.dataForm = item
 
       this.visible = true

+ 4 - 2
src/views/modules/tech/project-product-detail.vue

@@ -123,7 +123,8 @@ export default {
       },
       dataRule: {},
       dataList: [],
-      dataListLoading: false
+      dataListLoading: false,
+
     }
   },
   created() { },
@@ -191,7 +192,8 @@ export default {
     },
     selectChange(val) {
       this.dataForm.responsibilityPerson = val
-    }
+    },
+    
   }
 }
 </script>

+ 1 - 2
src/views/modules/tech/project-tech-assign.vue

@@ -22,7 +22,6 @@
     <span slot="footer" class="dialog-footer">
       <el-button @click="onChose">取消</el-button>
       <el-button
-        v-if="!display"
         type="primary"
         @click="dataFormSubmit()"
         v-reClick
@@ -60,7 +59,7 @@ export default {
     onChose () {
       this.$emit('onChose')
     },
-    async init (item, display) {
+    async init (item) {
       this.dataForm = item
 
       this.visible = true

+ 2 - 2
src/views/modules/tech/project-tech-submit.vue

@@ -20,12 +20,12 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="技术协议:" prop="attachList1">
-            <span class="attch-file" @click="attachDetail(dataForm.attachList1)">{{dataForm.attachList1 == null ? '' : dataForm.attachList1[0].fileName}}</span>
+            <span class="attch-file" @click="attachDetail(dataForm.attachList1)">{{dataForm.attachList1 == null || dataForm.attachList1.length == 0 ? '' : dataForm.attachList1[0].fileName}}</span>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="资料:" prop="attachList2">
-            <span class="attch-file" @click="attachDetail(dataForm.attachList2)">{{dataForm.attachList2 == null ? '' : dataForm.attachList2[0].fileName}}</span>
+            <span class="attch-file" @click="attachDetail(dataForm.attachList2)">{{dataForm.attachList2 == null  || dataForm.attachList2.length == 0 ? '' : dataForm.attachList2[0].fileName}}</span>
           </el-form-item>
         </el-col>
       </el-row>