From 34349505ff9432fca1cb4197a27017cd1ffc45a2 Mon Sep 17 00:00:00 2001
From: caoyizhong <1270296080@qq.com>
Date: Thu, 3 Nov 2022 16:41:39 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E6=9F=A5?=
 =?UTF-8?q?=E8=AF=A2=E6=B5=81=E7=A8=8B=E6=98=BE=E7=A4=BA=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../form/ProcessMaterialsAllotForm.vue        |   9 +-
 .../activiti/form/ProcessUdgetPlanForm.vue    | 216 ++++++++++++------
 .../ProcessSuppliesStrongerList.vue           |   2 +-
 .../ProcessSuppliesStrongerLists.vue          |   4 +-
 4 files changed, 160 insertions(+), 71 deletions(-)

diff --git a/src/views/activiti/form/ProcessMaterialsAllotForm.vue b/src/views/activiti/form/ProcessMaterialsAllotForm.vue
index 7f34026..62b2f73 100644
--- a/src/views/activiti/form/ProcessMaterialsAllotForm.vue
+++ b/src/views/activiti/form/ProcessMaterialsAllotForm.vue
@@ -365,10 +365,10 @@
             if (item.merchandiseNewsId === record.row.equipment) {
               materialName = {
                 name: item.merchandiseName,
-                unit: item.unit,
+                unit: item.materialsUnit,
                 supplierName: item.supplierName,
-                price: item.price,
-                number : item.number === undefined ? 0 : item.number,
+                price: item.materialPrice,
+                number : item.residueNumber === undefined ? 0 : item.residueNumber,
               }
             }
           })
@@ -398,7 +398,7 @@
           this.bigIdMerchandiseNewsList.forEach(item => {
             if (item.merchandiseNewsId === record.row.equipment) {
               materialName = {
-                number : item.number === undefined ? 0 : item.number,
+                number : item.residueNumber === undefined ? 0 : item.residueNumber,
               }
             }
           })
@@ -501,6 +501,7 @@
         let par = {
           delFlag: 0,
           accountingAttributes: value,
+          sysOrgCode: this.data.sysOrgCode
         }
         getAction(this.url.descriptionRake,par).then((res)=>{
           if(res.success){
diff --git a/src/views/activiti/form/ProcessUdgetPlanForm.vue b/src/views/activiti/form/ProcessUdgetPlanForm.vue
index fa36c57..9564e96 100644
--- a/src/views/activiti/form/ProcessUdgetPlanForm.vue
+++ b/src/views/activiti/form/ProcessUdgetPlanForm.vue
@@ -34,7 +34,7 @@
           <a-col :span="8">
             <a-form-item label="物资类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
               <j-dict-select-tag type="list" v-decorator="['materialType',validatorRules.materialType]" :trigger-change="true" dictCode="material_type"
-                                 placeholder="请选择物资类型"/>
+                                 placeholder="请选择物资类型" @change="elect" />
             </a-form-item>
           </a-col>
           <a-col :span="8">
@@ -73,12 +73,23 @@
           :maxHeight="300"
           :action-button="true"
           :rowNumber="true"
+          :disabled="hieg"
           :rowSelection="true"
           :actionButton="true">
+          <template v-slot:group="props">
+            <a-auto-complete
+              v-model=materialGroups
+              :data-source="bigIdRake"
+              placeholder="请选择"
+              @search="onSearchRake"
+              @select="onSelectRake(props,materialGroups)"
+            />
+          </template>
+
         <template v-slot:action="props">
           <a-tooltip placement="top">
             <template v-slot:title="props" >
-              <p v-for="(item,index) in historyBigId" :key="index">历史价格:{{ item }}</p>
+              <p v-for="(item,index) in historyBigId" :key="index" >历史价格:{{ item }}</p>
             </template>
             <a-button @mouseenter="chaKan(props)">查看</a-button>
           </a-tooltip>
@@ -134,7 +145,13 @@
     data() {
       return {
         bigId:[],
+        bigIdRake:[],
+        materialGroups:'',
+        materialId :'',
+        bigIdRakeList:[],
+        hieg:true,
         historyBigId:[],
+        isHistoryBigId:false,
         bigIdMerchandiseNews:[],
         bigIdMerchandiseNewsList:[],
         labelCol: {
@@ -168,12 +185,13 @@
               key: 'materialGroup',
               // type: FormTypes.slot, //  <-------------改为 slot 格式
               // slotName: 'actions',   //  <-------------slot 的名称,对应 v-slot 冒号后面和等号前面的内容
-              type: FormTypes.sel_search,
-              dictCode: '',
+              type: FormTypes.slot,
+              // type: FormTypes.sel_search,
+              slotName: 'group',
+
               width: '200px',
-              placeholder: '请输入${title}',
+
               options: [],
-              props:{title: 'show title'}
               // scopedSlots: { customRender: 'edit' },//引入的插槽
               // customRender:function (t,r,index) {
               //     console.log(t,r);
@@ -191,14 +209,6 @@
               options: [],
             },
             // {
-            //   title: '物料描述',
-            //   key: 'materialDescription',
-            //   type: FormTypes.input,
-            //   width: '200px',
-            //   placeholder: '请输入${title}',
-            //   defaultValue: ''
-            // },
-            // {
             //   title: '仓储地点_id',
             //   key: 'unitWasteWarehouseCodeId',
             //   type: FormTypes.input,
@@ -295,7 +305,7 @@
               title: '对比单价',
               key: 'action',
               type: FormTypes.slot,
-              width: '70px',
+              width: '80px',
               // placeholder: '请输入${title}',
               // defaultValue: '',
               slotName: 'action'
@@ -317,6 +327,14 @@
               placeholder: '请输入${title}',
               defaultValue: ''
             },
+            {
+              title: '供应商',
+              key: 'supplierId',
+              type: FormTypes.input,
+              width: '200px',
+              placeholder: '请输入${title}',
+              defaultValue: ''
+            },
             {
               title: '执行标准',
               key: 'materialStandard',
@@ -348,6 +366,7 @@
           edit: '/hy/processUdgetPlan/edit',
           queryById: '/hy/processUdgetPlan/queryById',
           selectdeparment:'/sys/selectByUser',
+          descriptionRakeUrl: "/description/processDescription/list",
           descriptionRake: "/description/processDescription/descriptionName",
           merchandiseNewsList: "/merchandisenews/processMerchandiseNews/merchandiseNewsList",
           historyUrl: '/suppliesstronger/processSuppliesStronger/list',
@@ -426,81 +445,149 @@
       let userInfo=sessionStorage.getItem("USER_INFORMATION");
       // userInfo.company=company;
       this.popupCallback(company,userInfo);
-      this.fetchData();
+
     },
     methods: {
+      elect(val){
+        if(val != undefined){
+          this.hieg = false;
+          // this.fetchData();
+          this.fetchDataRake();
+        }
+      },
+      //物料组选择触发
+      onSelectRake(props,value) {
+        // console.log('onSelect', value,props);
+        this.searchRake(value,props);
+      },
+      //物料组输入触发
+      onSearchRake(searchText) {
+        // console.log(searchText)
+        this.fetchDataRake(searchText);
+      },
+      fetchDataRake(value){
+        //查询大品类数据
+        let par = {
+          delFlag: 0,
+          descriptionName: value,
+
+          pageSize: 100
+        }
+        this.bigIdRake = [];
+        this.bigIdRakeList = [];
+        getAction(this.url.descriptionRakeUrl,par).then((res)=>{
+          if(res.success){
+            // console.log(res.result);
+            res.result.records.forEach( item => {
+              this.bigIdRake.push(item.descriptionName);
+            })
+            this.bigIdRakeList = res.result.records;
+          }
+        });
+      },
+      //物料组触发集合
+      searchRake(val,pro){
+        this.bigIdRakeList.forEach(item =>{
+          // console.log(item);
+          if(item.descriptionName === val){
+            this.fetchMerchandiseNews(item.id);
+              this.materialId=item.id
+          }
+        })
+        // console.log(this.materialId);
+      },
+
+
       //查看历史价格
       async chaKan(log){
-        this.historyBigId = [];
+
         let pas = await log.target.getValuesPromise(log.rowIds);
+        // console.log(pas);
         if(pas[0].materialNumber !== '' && pas[0].materialNumber !== null ){
+          this.historyBigId = [];
           //查询大品类数据
           let par = {
             delFlag: 0,
-            merchandisenewsId: pas[0].materialNumber,
+            merchandiseNewsId: pas[0].materialNumber,
             pageSize:5
           }
-
+          this.isHistoryBigId = false;
           getAction(this.url.historyUrl,par).then((res)=>{
+            // console.log(res);
             if(res.success) {
               res.result.records.forEach( item => {
-                this.historyBigId.push(item.price);
+                if(parseInt(res.result.total) > 0){
+                  this.isHistoryBigId = true;
+                  this.historyBigId.push(item.materialPrice);
+                }
+
               })
 
             }
           });
         }
 
-
       },
       //table 值改变触发
       onSelect(record) {
-        if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.materialNumber === ''){
-          this.fetchMerchandiseNews(record.row.materialGroup);
-        }
-        if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.materialNumber !== ''){
+        // if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.materialNumber === ''){
+        //   console.log("1出发了",record.row);
+        //   this.fetchMerchandiseNews(record.row.materialGroup);
+        // }
+        //    console.log("5555出发了",record.row);
+        if(record.row.materialGroup === '' || record.row.materialGroup === undefined && record.row.materialNumber !== ''){
+          // console.log("2出发了",record.row);
           let materialName = {  }
           this.bigIdMerchandiseNewsList.forEach( item => {
             if( item.id === record.row.materialNumber ){
               materialName ={
                 name: item.merchandiseName,
                 unit: item.materialsUnit,
+                supplierId: item.supplierId,
               }
 
             }
           })
-          let values = [
-            {
-              rowKey: record.row.id,
-              values: {
-                'materialNumber': record.row.materialNumber,
-                'materialGroup': record.row.materialGroup,
-                'materialSeries': "SM-JD36-BA",
-                'materialName': materialName.name,
-                'materialUnit': materialName.unit,
+          if(record.row.id !== undefined){
+            let values = [
+              {
+                rowKey: record.row.id,
+                values: {
+                  'materialNumber': record.row.materialNumber,
+                  'materialGroup': this.materialId,
+                  'materialSeries': "SM-JD36-BA",
+                  'materialName': materialName.name,
+                  'materialUnit': materialName.unit,
+                  'supplierId': materialName.supplierId
+                },
               },
-            },
-          ]
-          this.$refs.processUdgetPlanMaterial.setValues(values);
+            ]
+            // console.log(values);
+            this.$refs.processUdgetPlanMaterial.setValues(values);
+          }
         }
 
         if(record.row.materialQuantity !== '' && record.row.materialPrice !== '' && record.row.materialQuantity !== undefined && record.row.materialPrice !== undefined){
           // record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice;
-          let values = [
-            {
-              rowKey: record.row.id,
-              values: {
-                'materialNumber': record.row.materialNumber,
-                'materialGroup': record.row.materialGroup,
-                'materialSeries': record.row.materialSeries,
-                'materialName': record.row.materialName,
-                'materialUnit': record.row.materialUnit,
-                'materialAmount': record.row.materialQuantity * record.row.materialPrice,
-                'materialType': this.data.materialType
+          // console.log("3出发了",record.row);
+          if(record.row.id !== undefined){
+            let values = [
+              {
+                rowKey: record.row.id,
+                values: {
+                  'materialNumber': record.row.materialNumber,
+                  'materialGroup': record.row.materialGroup,
+                  'materialSeries': record.row.materialSeries,
+                  'materialName': record.row.materialName,
+                  'materialUnit': record.row.materialUnit,
+                  'materialAmount': record.row.materialQuantity * record.row.materialPrice,
+                  'materialType': this.data.materialType
+                },
               },
-            },
-          ]
-          this.$refs.processUdgetPlanMaterial.setValues(values);
+            ]
+            this.$refs.processUdgetPlanMaterial.setValues(values);
+          }
+
         }
 
       },
@@ -525,6 +612,7 @@
           });
         });
         getAction(this.url.merchandiseNewsList,par).then((res)=>{
+          console.log(res.result);
           if(res.success){
             let newList = res.result;
               if(numberList.length > 0){
@@ -563,19 +651,19 @@
           delFlag: 0,
         }
         this.bigId = [];
-        getAction(this.url.descriptionRake,par).then((res)=>{
-          if(res.success){
-            if(this.processUdgetPlanMaterialTable.columns[0].options.length > 0){
-              this.processUdgetPlanMaterialTable.columns[0].options = [];
-            }
-            res.result.forEach( item => {
-              this.processUdgetPlanMaterialTable.columns[0].options.push({
-                title : item.descriptionName,
-                value :  item.id,
-              })
-            })
-          }
-        });
+        // getAction(this.url.descriptionRake,par).then((res)=>{
+        //   if(res.success){
+        //     if(this.processUdgetPlanMaterialTable.columns[0].options.length > 0){
+        //       this.processUdgetPlanMaterialTable.columns[0].options = [];
+        //     }
+        //     res.result.forEach( item => {
+        //       this.processUdgetPlanMaterialTable.columns[0].options.push({
+        //         title : item.descriptionName,
+        //         value :  item.id,
+        //       })
+        //     })
+        //   }
+        // });
       },
       /*回显数据*/
       init(){
diff --git a/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue b/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue
index 50830dc..50dd3e8 100644
--- a/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue
+++ b/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue
@@ -203,7 +203,7 @@
     methods: {
       handleDetaills(record){
         console.log(record);
-        this.$router.push({name:'src-views-suppliesstronger-ProcessSuppliesStrongerLists',params:{item: record.materialsNumber}})
+        this.$router.push({name:'src-views-suppliesstronger-ProcessSuppliesStrongerLists',params:{item: record.merchandiseNewsId}})
       },
       initDictConfig(){
       },
diff --git a/src/views/suppliesstronger/ProcessSuppliesStrongerLists.vue b/src/views/suppliesstronger/ProcessSuppliesStrongerLists.vue
index 10ef51e..771f6d2 100644
--- a/src/views/suppliesstronger/ProcessSuppliesStrongerLists.vue
+++ b/src/views/suppliesstronger/ProcessSuppliesStrongerLists.vue
@@ -163,7 +163,7 @@
         queryParam: {
           supplier: null,
           itemGroup: null,
-          materialsNumber: this.$route.params.item,
+          merchandiseNewsId: this.$route.params.item,
           itemDescription: null,
           unitWasteWarehouseCodeId: null,
           freightSpace: null,
@@ -314,7 +314,7 @@
     },
     watch: {
       $route() {
-        this.queryParam.materialsNumber = this.$route.params.item
+        this.queryParam.merchandiseNewsId = this.$route.params.item
         this.loadData()
       }
     },