Browse Source

采购订单生成-订单生成页面供应商筛选

002390 1 year ago
parent
commit
57e2160a43
1 changed files with 135 additions and 9 deletions
  1. 135 9
      src/views/purchase/task/xie-yi-zhi-cai/index.vue

+ 135 - 9
src/views/purchase/task/xie-yi-zhi-cai/index.vue

@@ -57,11 +57,13 @@ export default {
       set(){},
     }
   },
-  watch: {},
+  watch: {
+  },
   methods: {
     //
     async open(prop) {
       this.visible = await this.fetchItem(prop);
+      this.supplier = '';
     },
     //
     hide() {
@@ -85,9 +87,8 @@ export default {
             })),
           }));
 
-          this.showData = _.cloneDeep(this.data);
-
           console.log(this.data,'this.data');
+          this.showData =  _.cloneDeep(this.data);
           return true;
         } else {
           return false;
@@ -111,7 +112,7 @@ export default {
         }))
         .filter((item) => item.orderPriceVos.length);
         console.log(params,'params');
-      try {
+        try {
         // try
         const { msg, code } = await ADD(params);
         if (code === 200) {
@@ -153,7 +154,39 @@ export default {
     },
     
     handleSelect(prop){
-      console.log(prop,'prop');
+      console.log(this.data,'handleSelect');
+
+      // this.tableColumns = this.tableColumns.map(({ item, attr }) =>{
+
+      //   if(item['key'] === 'supplierName'){
+      //     item.filter = [prop.value];
+      //   }
+
+      //   return {
+      //     item: {...item},
+      //     attr: {...attr},
+      //   }
+        
+      // })
+
+      // this.$refs.superTable.forEach(item =>{
+
+      //   let { onFilter, onFilters } = item;
+
+      //   let supplierFilter = {
+      //     item:{
+      //       key: 'supplierName',
+      //       title: '供应商',
+      //       filterabled:true,
+
+      //     },
+      //     attr: {}
+      //   }
+
+      //   onFilters(supplierFilter);
+      //   onFilter();
+      // })
+
       this.showData = this.data.map(item => {
         return {
           ...item,
@@ -162,13 +195,86 @@ export default {
       })
     },
     handleClear(){
-      this.showData = _.cloneDeep(this.data);
+      this.showData =  _.cloneDeep(this.data);
     },
     // 对象数组去重
     uniqueFunc(arr, uniId){
       const res = new Map();
       return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1));
     },
+    changeQuantity(prop,value){
+
+      this.data = this.data.map(item =>{
+
+        if(item.id === prop.id){
+
+          item.orderPriceVos = item.orderPriceVos.map(order =>{
+
+            if(order.id === value.id){
+
+              return value;
+            }
+
+            return order;
+          })
+
+          // item.orderPriceVos.forEach(order =>{
+
+          //   if(order.id === value.id){
+
+          //     let change = prop.orderPriceVos.filter(order => order.id === value.id);
+
+          //     order = {...change};
+
+          //   }
+
+          // })
+        }
+        return item;
+      })
+
+    },
+    changeDatePlan(prop,value){
+
+      this.data = this.data.map(item =>{
+
+        if(item.id === prop.id){
+
+          item.orderPriceVos = item.orderPriceVos.map(order =>{
+
+            if(order.id === value.id){
+
+              return value;
+            }
+
+            return order;
+          })
+
+        }
+        return item;
+      })
+    },
+    changeNote(prop,value){
+
+      this.data = this.data.map(item =>{
+
+        if(item.id === prop.id){
+
+          item.orderPriceVos = item.orderPriceVos.map(order =>{
+
+            if(order.id === value.id){
+
+              return value;
+            }
+
+            return order;
+          })
+
+        }
+        return item;
+      })
+    },
+
   },
   created() {},
   mounted() {},
@@ -210,7 +316,7 @@ export default {
         
       </template>
 
-      <!-- <el-row style="padding: 0 16px;">
+      <el-row style="padding: 0 16px;">
         <el-col>
           <el-autocomplete
             class="inline-input"
@@ -223,10 +329,10 @@ export default {
             @clear="handleClear"
           ></el-autocomplete>
         </el-col>
-      </el-row> -->
+      </el-row>
 
 
-      <div v-for="(item, index) in data" :key="index" class="m-4">
+      <div v-for="(item, index) in showData" :key="index" class="m-4">
 
         <template v-if="item.orderPriceVos.length">
           <el-descriptions>
@@ -255,6 +361,7 @@ export default {
           </el-descriptions>
   
           <el-super-table
+            ref="superTable"
             v-model="item.orderPriceVos"
             :columns="tableColumns"
             :size="$attrs.size"
@@ -267,6 +374,25 @@ export default {
                 v-model="scope.row[scope.item.key]"
                 :size="$attrs.size"
                 :max="scope.attr.max(scope.row)"
+                @change="changeQuantity(item,scope.row)"
+              >
+              </component>
+            </template>
+            <template slot="arrivalDatePlan" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                @change="changeDatePlan"
+              >
+              </component>
+            </template>
+            <template slot="note" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                @change="changeNote"
               >
               </component>
             </template>