Jelajahi Sumber

Merge branch 'purchaseDev' of http://172.16.100.139/new-business/drp-web into purchaseDev

002201 2 tahun lalu
induk
melakukan
430484beb7

+ 8 - 8
src/components/popover-select/components/PSNLICENSE_PARAM.js

@@ -1,18 +1,18 @@
 // 人员证照参照
 export default [
-  {
-    key: "id",
-    title: "ID",
-    type: "Input",
-    search: true,
-  },
   // {
-  //   key: "code",
-  //   title: "编码",
+  //   key: "id",
+  //   title: "ID",
   //   type: "Input",
   //   search: true,
   // },
   {
+    key: "code",
+    title: "编码",
+    type: "Input",
+    search: true,
+  },
+  {
     key: "name",
     title: "名称",
     type: "Input",

+ 30 - 4
src/views/purchase/purchase-order/add/column.js

@@ -83,6 +83,7 @@ export const Columns = [
     },
     queryParams: () => ({}),
     isShow:true,
+    disabled:true,
   },
   {
     key: "buyerName",
@@ -190,7 +191,13 @@ export const Columns = [
     width: 200,
   },
   // { key: "isSendSrm", title: "是否同步SRM", inputType: "Checkbox",isShow:true, },
-  { key: "isInvoice", title: "发票标识", inputType: "Checkbox", isShow:true,},
+  { 
+    key: "isInvoice", 
+    title: "发票标识", 
+    inputType: "Checkbox", 
+    isShow:true,
+    disabled:true,
+  },
   { key: "supplierOrderNo", title: "供应商订单号", inputType: "Input",isShow:true, },
   { 
     key: "rebateMoney", 
@@ -276,8 +283,20 @@ export const Columns = [
     }),
     width: 200,
   },
-  { key: "isUrgency", title: "紧急程度", inputType: "Checkbox",isShow:true, },
-  { key: "isSendWms", title: "已同步WMS", inputType: "Checkbox",isShow:true, },
+  { 
+    key: "isUrgency", 
+    title: "紧急程度", 
+    inputType: "Checkbox",
+    isShow:true,
+    disabled:true,
+   },
+  { 
+    key: "isSendWms", 
+    title: "已同步WMS", 
+    inputType: "Checkbox",
+    isShow:true,
+    disabled:true,
+   },
   // { key: "agent", title: "代理人", inputType: "Input", }, // 建议删除
   {
     key: "agentName",
@@ -293,13 +312,20 @@ export const Columns = [
     queryParams: () => ({}),
     width: 200,
   },
-  { key: "isClose", title: "最终关闭", inputType: "Checkbox", isShow:true, },
+  { 
+    key: "isClose", 
+    title: "最终关闭", 
+    inputType: "Checkbox", 
+    isShow:true,
+    disabled:true,
+   },
   {
     key: "closeTime",
     title: "最终关闭日期",
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
     isShow:true,
+    disabled:true,
   },
   { 
     key: "applyPaymentMoney", 

+ 4 - 3
src/views/purchase/purchase-order/add/index.vue

@@ -293,8 +293,7 @@ export default {
       })
     },
     // 主表参照改变之后
-   async handleReferChange(val, source, type){
-     console.log(val,'val-------------------');
+   async handleReferChange(val, type, source){
       // 供应商选择  
       if( type === 'SUPPLIER_PARAM' ){
 
@@ -359,7 +358,7 @@ export default {
 
 
     // 子表参照改变之后
-   async handleTabReferChange(val, source, type) {
+   async handleTabReferChange(val,  type, source) {
 
       // 触发物料参照询价   && source.qty && source.qty != ""
       if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
@@ -524,6 +523,7 @@ export default {
                 :source.sync="params"
                 :title="column.title"
                 :type="column.referName"
+                :disabled="column.disabled"
                 :multiple="column.multiple"
                 :placeholder="column.placeholder"
                 :data-mapping="column.dataMapping"
@@ -671,6 +671,7 @@ export default {
                       :title="cColumn.title"
                       :value-key="cColumn.valueKey"
                       :type="cColumn.referName"
+                      :disabled="cColumn.disabled"
                       :multiple="cColumn.multiple"
                       :placeholder="cColumn.placeholder"
                       :data-mapping="cColumn.dataMapping"

+ 56 - 2
src/views/purchase/purchase-order/edit/index.vue

@@ -230,9 +230,62 @@ export default {
     },
     beforeOpen() {
     },
+
+     // 主表参照改变之后
+   async handleReferChange(val, type, source){
+      // 供应商选择  
+      if( type === 'SUPPLIER_PARAM' ){
+
+        let page = { pageNum: 1 , pageSize: 10 };
+
+        let relevanceRefer = [
+          {
+            // 供应商联系人
+            key:'supplierContacts',
+            params:{
+              type:'SUPPLIERCONTACTS_PARAM',
+              supplierId:val.id,
+            }
+          },
+          {
+            // 供应商业务员
+            key:'supplierPersonal',
+            params:{
+              type:'PSNLICENSE_PARAM',
+              supplierId:val.id,
+              pkOrg: source.puOrg,
+            }
+          }
+        ]
+
+      await  relevanceRefer.forEach(async (refer) =>{
+
+          try {
+
+            const { code, rows} = await orderApi.REFER(
+              {
+                ...refer.params,
+                search: "",
+                isPage: true,
+              }, page );
+
+            if (code === 200) {
+
+              source[refer.key] = rows[0]? rows[0].id :'';
+
+              source[`${refer.key}Name`] = rows[0] ? rows[0].name :'';
+
+            }
+            
+          } catch (error) {}
+          
+        })
+        
+      }
+    },
     // 子表参照改变之后
-    async handleTabReferChange(val, source, type) {
-      
+    async handleTabReferChange(val, type, source) {
+
       // 触发物料参照
       if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
 
@@ -399,6 +452,7 @@ export default {
                 :data-mapping="column.dataMapping"
                 :disabled="column.disabled" 
                 :query-params="column.queryParams"
+                @change="handleReferChange"
                 ></dr-popover-select>
               <el-input v-if="column.inputType === 'Textarea'" 
                 v-model="params[column.key]" 

+ 140 - 70
src/views/purchase/purchase-order/index.vue

@@ -38,6 +38,10 @@ export default {
         puOrderExecuteList: [],
       },
       checkedList: [],
+      // 子表Select
+      checkedTabList: [],
+      // 主表点击信息
+      primaryResource:{},
     };
   },
   computed: {
@@ -134,6 +138,8 @@ export default {
     // 获取子表信息
     async handleDetailsData(row) {
       try {
+        this.primaryResource = row;
+        this.checkedTabList = [];
         const { code, msg, data } = await orderApi.details(row.id);
         if (code === 200) {
           // 物料信息:puOrderItemList   执行结果:puOrderExecuteList
@@ -186,30 +192,6 @@ export default {
           }
         })
 
-        // this.$confirm('此操作将删除该订单, 是否继续?', '提示', {
-        //   confirmButtonText: '确定',
-        //   cancelButtonText: '取消',
-        //   type: 'warning'
-        // }).then( async() => {
-
-        //   const { id } = row;
-
-        //   const { code } = await orderApi.remove(id);
-          
-        //   if (code === 200) {
-
-        //     this.fetchList(this.params, this.page);
-
-        //   }
-
-        // }).catch(() => {
-
-        //   this.$message({
-        //     type: 'info',
-        //     message: '已取消删除'
-        //   });          
-        // });
-        
       } catch (err) {
         //
       } finally {
@@ -236,11 +218,11 @@ export default {
       } finally {
       }
     },
-    // 判断“退回”按钮
-    judgeIsAllSendBack() {
+    // 判断“整单退回”按钮
+    judgeIsAllReturn() {
       if (this.checkedList.length == 1) {
 
-        // 非手工、状态非审批通过  
+        // 非手工、状态:自由/驳回
         if (this.checkedList[0].source != 3 && (this.checkedList[0].status == 0 || this.checkedList[0].status == 3)) {
 
           return false
@@ -249,8 +231,62 @@ export default {
       return true;
     },
     //  整单退回
-    handleAllSendBack() {
+    handleAllReturn() {
+
+      this.handleReturn(this.checkedList[0].id,[]);
+      // this.$prompt('请输入退回原因', '提示', {
+      //     confirmButtonText: '确定',
+      //     cancelButtonText: '取消',
+      //     inputPattern: /\s*\S+?/,
+      //     inputErrorMessage: '退回原因不能为空'
+      //   }).then(async ({ value }) => {
+
+      //     let data = {
+      //       id: this.checkedList[0].id,
+      //       documentIds: [],
+      //       baskCause: value,
+      //     };
+
+      //     console.log(data);
+
+      //     try {
+
+      //       let { code, msg } = await orderApi.documentsReturn(data);
+
+      //       if (code === 200) {
+
+      //         this.fetchList(this.params, this.page);
+
+      //       }
+      //     } catch (error) {
+      //       console.log(error,'error------------');
+      //     }
+      //   }).catch(() => {   });
+      
+    },
+     // 判断“行退回”按钮
+     judgeIsLineReturn() {
+
+      if (this.checkedTabList.length == 1) {
+
+        // 主信息:非手工、状态:自由/驳回
+        if(this.primaryResource.source != 3 && 
+          (this.primaryResource.status == 0 || this.primaryResource.status == 3) ){
+
+          return false
+        }
 
+      }
+      return true;
+    },
+    // 行退回
+    handleLineReturn(){
+      let ids = this.checkedTabList.map(checked => checked.id);
+      console.log(ids,'行退回ids');
+      this.handleReturn(this.primaryResource.id,ids);
+    },
+    // 退回接口
+    handleReturn(id,documentIds){
       this.$prompt('请输入退回原因', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
@@ -259,8 +295,8 @@ export default {
         }).then(async ({ value }) => {
 
           let data = {
-            id: this.checkedList[0].id,
-            documentIds: [],
+            id,
+            documentIds,
             baskCause: value,
           };
 
@@ -274,12 +310,17 @@ export default {
 
               this.fetchList(this.params, this.page);
 
+              this.checkedList = [];
+              
+              this.checkedTabList = [];
+
+              this.primaryResource = {};
+
             }
           } catch (error) {
             console.log(error,'error------------');
           }
         }).catch(() => {   });
-      
     },
     // 判断是否满足整单关闭
     judgeIsAllClose() {
@@ -341,6 +382,7 @@ export default {
       }
       
     },
+    // 主表Select框
     handleSelect(selection, row) {
 
       this.checkedList = selection;
@@ -348,6 +390,13 @@ export default {
       console.log(this.checkedList, 'this.checkedList');
 
     },
+    // 子表Select框
+    handleTabSelect(selection, row){
+
+      this.checkedTabList = selection;
+
+      console.log(this.checkedTabList, 'this.checkedTabList');
+    },
   }
 };
 </script>
@@ -477,7 +526,7 @@ export default {
         </el-button-group>
 
         <el-button-group style="margin-left: 10px" :key="checkedList.length + 1">
-          <el-button size="mini" @click="handleAllSendBack" :disabled="judgeIsAllSendBack()">整单退回</el-button>
+          <el-button size="mini" @click="handleAllReturn" :disabled="judgeIsAllReturn()">整单退回</el-button>
           <el-button size="mini" @click="handleAllClose" :disabled="judgeIsAllClose()">整单关闭</el-button>
         </el-button-group>
 
@@ -501,7 +550,7 @@ export default {
       height="450"
       style="width: 100%; margin: 20px 0 0 0"
     >
-      <el-table-column type="selection" width="45"></el-table-column>
+      <el-table-column type="selection" width="45" ></el-table-column>
       <el-table-column type="index" width="50" label="序号"></el-table-column>
       <el-table-column 
         v-for="(column, index) in tableColumns" 
@@ -574,43 +623,64 @@ export default {
       :limit.sync="page.pageSize"
       @pagination="fetchList(params, page)"
     />
-
-    <el-tabs v-model="tabName" @tab-click="handleTabClick" style="width: 100%;padding: 20px 10px">
-      <el-tab-pane 
-        v-for="(column, index) in tabColumns" 
-        :key="index" 
-        :label="column.title" 
-        :name="column.key"
-      >
-        <el-table :data="tabTableDatas[column.key]" style="width: 100%" highlight-current-row
-          :height="tabTableDatas[column.key].length ? 300 : 100">
-          <el-table-column type="index" width="50" label="序号"></el-table-column>
-          <el-table-column 
-            v-for="(cColumn, cIndex)  in column.tableColumns" 
-            :key="cIndex" 
-            :prop="cColumn.key"
-            :label="cColumn.title" 
-            :width="cColumn.width || 180"
-            :show-overflow-tooltip="cColumn.showOverflowTooltip || true"
+   
+    <div style="position: relative; padding-top: 10px;">
+      <el-row style="position: absolute; top: 30px; right: 20px;z-index: 10;">
+        <el-button 
+          size="mini" 
+          @click="handleLineReturn"
+          :disabled="judgeIsLineReturn()"
+        >行退回</el-button>
+      </el-row>
+      <el-tabs v-model="tabName" @tab-click="handleTabClick" style="width: 100%;padding: 20px 10px">
+       
+        <el-tab-pane 
+          v-for="(column, index) in tabColumns" 
+          :key="index" 
+          :label="column.title" 
+          :name="column.key"
+        >
+          <el-table 
+            :data="tabTableDatas[column.key]" 
+            style="width: 100%" 
+            highlight-current-row
+            :height="tabTableDatas[column.key].length ? 300 : 100"
+            @select="handleTabSelect"
           >
-            <template slot-scope="scope">
-              <dict-tag v-if="cColumn.referName" 
-                size="small" 
-                :value="scope.row[cColumn.key]"
-                :options="dict.type[cColumn.referName]"
-               />
-              <el-checkbox v-else-if="cColumn.inputType === 'Checkbox'" 
-                v-model="scope.row[cColumn.key]"
-                disabled
-                true-label="Y" 
-                false-label="N"
-              ></el-checkbox>
-              <span v-else>{{ scope.row[cColumn.key] }}</span>
-            </template>
-          </el-table-column>
-        </el-table>
-      </el-tab-pane>
-    </el-tabs>
-
+            <el-table-column
+              v-if=" tabName === 'puOrderItemList'" 
+              type="selection" 
+              width="45"
+            ></el-table-column>
+            <el-table-column type="index" width="50" label="序号"></el-table-column>
+            <el-table-column 
+              v-for="(cColumn, cIndex)  in column.tableColumns" 
+              :key="cIndex" 
+              :prop="cColumn.key"
+              :label="cColumn.title" 
+              :width="cColumn.width || 180"
+              :show-overflow-tooltip="cColumn.showOverflowTooltip || true"
+            >
+              <template slot-scope="scope">
+                <dict-tag v-if="cColumn.referName" 
+                  size="small" 
+                  :value="scope.row[cColumn.key]"
+                  :options="dict.type[cColumn.referName]"
+                 />
+                <el-checkbox v-else-if="cColumn.inputType === 'Checkbox'" 
+                  v-model="scope.row[cColumn.key]"
+                  disabled
+                  true-label="Y" 
+                  false-label="N"
+                ></el-checkbox>
+                <span v-else>{{ scope.row[cColumn.key] }}</span>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
+        
+      </el-tabs>
+      
+    </div>
   </el-card>
 </template>