Procházet zdrojové kódy

1.采购订单生成明细-是否有价格无值
2.采购订单生成-订单生成,通过供应商筛选

002390 před 1 rokem
rodič
revize
75f8258212

+ 1 - 1
src/views/purchase/task/see/columns.js

@@ -10,7 +10,7 @@ export default function useColumns() {
     },
     { item: { key: "existPrice", title: "是否有价格",width :150 ,}, attr: {
       is: "el-dict-tag",
-      dictName: "is_effective",
+      dictName: "sys_true_false",
 
     } },
     { item: { key: "demandCode", title: "需求单号" }, attr: {} },

+ 122 - 49
src/views/purchase/task/xie-yi-zhi-cai/index.vue

@@ -26,6 +26,9 @@ export default {
       tableColumns: TableColumns,
       basicColumns:BasicColumns,
       data: [],
+      showData:[],
+      supplier:'',
+      size:'mini',
     };
   },
   computed: {
@@ -35,14 +38,23 @@ export default {
       },
       set() {},
     },
-    supplierNameSelect:{
+    restaurants:{
       get(){
-        return 
-      },
-      set(value){
+        let allSupplier = [];
+        this.data.forEach(item =>{
 
+          let orderPriceVos = item.orderPriceVos.map(order => ({
+            value:order.supplierName,
+            id:order.supplier
+          }))
+          allSupplier.push(...orderPriceVos);
 
-      }
+        })
+        allSupplier = this.uniqueFunc(allSupplier,'id');
+        console.log(allSupplier,'allSupplier');
+        return allSupplier;
+      },
+      set(){},
     }
   },
   watch: {},
@@ -73,6 +85,8 @@ export default {
             })),
           }));
 
+          this.showData = _.cloneDeep(this.data);
+
           console.log(this.data,'this.data');
           return true;
         } else {
@@ -110,9 +124,50 @@ export default {
         // finally
       }
     },
+    hide(){
+      this.visible = false;
+    },
     supplierChange(value){
       console.log(value,'value');
     },
+    // 建议值
+    querySearch(queryString, cb){
+
+      let results = this.restaurants;
+
+      results = queryString
+        ? results.filter(this.createFilter(queryString))
+        : results;
+
+    //cb是回调函数,返回筛选出的结果数据到输入框下面的输入列表
+      cb(results);
+
+    },
+    createFilter(queryString) {
+
+      return (item) => {
+        return item.value.toUpperCase().match(queryString.toUpperCase());
+      };
+
+    },
+    
+    handleSelect(prop){
+      console.log(prop,'prop');
+      this.showData = this.data.map(item => {
+        return {
+          ...item,
+          orderPriceVos:item.orderPriceVos.filter(order => order.supplier === prop.id),
+        }
+      })
+    },
+    handleClear(){
+      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));
+    },
   },
   created() {},
   mounted() {},
@@ -148,57 +203,75 @@ export default {
         <el-button
           :size="$attrs.size"
           :loading="loading"
-          @click="visible = false"
+          @click="hide"
           >取 消</el-button
         >
         
       </template>
 
-      
-      <div v-for="(item, index) in data" :key="index" class="m-4">
-        
-        <el-descriptions>
-          <template slot="title" >
-            <template>
-              <span style="margin-right: 10px">{{ item.materialName }}</span>
-              <span style="color: tomato">{{ item.puQty }}</span>
-              (<span style="color: tomato">{{
-                item.puQty - (item.executeQty || 0)
-              }}</span
-              >) <span> {{ item.puUnitName }}</span>
+      <el-row style="padding: 0 16px;">
+        <el-col>
+          <el-autocomplete
+            class="inline-input"
+            :size="size"
+            v-model="supplier"
+            clearable
+            :fetch-suggestions="querySearch"
+            placeholder="请输入供应商"
+            @select="handleSelect"
+            @clear="handleClear"
+          ></el-autocomplete>
+        </el-col>
+      </el-row>
+
+
+      <div v-for="(item, index) in showData" :key="index" class="m-4">
+
+        <template v-if="item.orderPriceVos.length">
+          <el-descriptions>
+            <template slot="title" >
+              <template>
+                <span style="margin-right: 10px">{{ item.materialName }}</span>
+                <span style="color: tomato">{{ item.puQty }}</span>
+                (<span style="color: tomato">{{
+                  item.puQty - (item.executeQty || 0)
+                }}</span
+                >) <span> {{ item.puUnitName }}</span>
+              </template>
             </template>
-          </template>
-
-          <el-descriptions-item 
-            v-for="(basic,bIndex) in basicColumns"
-            :key="bIndex"
-            :label="basic.item.title"
-          >{{ item[basic.item.key] }}
-          </el-descriptions-item>
-          <el-descriptions-item 
-            label="需求数量"
-          >{{ item.puQty - (item.executeQty || 0) }}
-          </el-descriptions-item>
-          
-        </el-descriptions>
-
-        <el-super-table
-          v-model="item.orderPriceVos"
-          :columns="tableColumns"
-          :size="$attrs.size"
-          :dict="dict"
+  
+            <el-descriptions-item 
+              v-for="(basic,bIndex) in basicColumns"
+              :key="bIndex"
+              :label="basic.item.title"
+            >{{ item[basic.item.key] }}
+            </el-descriptions-item>
+            <el-descriptions-item 
+              label="需求数量"
+            >{{ item.puQty - (item.executeQty || 0) }}
+            </el-descriptions-item>
+            
+          </el-descriptions>
+  
+          <el-super-table
+            v-model="item.orderPriceVos"
+            :columns="tableColumns"
+            :size="$attrs.size"
+            :dict="dict"
           >
-          <!-- showSummary -->
-          <template slot="purchaseQuantity" slot-scope="scope">
-            <component
-              v-bind="scope.attr"
-              v-model="scope.row[scope.item.key]"
-              :size="$attrs.size"
-              :max="scope.attr.max(scope.row)"
-            >
-            </component>
-          </template>
-        </el-super-table>
+            <!-- showSummary -->
+            <template slot="purchaseQuantity" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :max="scope.attr.max(scope.row)"
+              >
+              </component>
+            </template>
+          </el-super-table>
+        </template>
+        
       </div>
     </el-drawer>
   </el-button>