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

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

002390 1 жил өмнө
parent
commit
e93a5ea5e2

+ 28 - 0
src/api/business/spd/goal_management/aDemo.js → src/api/business/spd/goal_management/commonWays.js

@@ -27,3 +27,31 @@ function mergeArray() {
   const mergedArray = mergeAndSumTotalGoal(arr);
   console.log(mergedArray);
 }
+
+// 计算子表小计
+export function getSummary(param) {
+  const { columns, data } = param;
+  const sums = [];
+  columns.forEach((column, index) => {
+    if (index === 0) {
+      sums[index] = '小计';
+      return;
+    }
+    const values = data.map(item => Number(item[column.property]));
+    if (!values.every(value => isNaN(value))) {
+      sums[index] = values.reduce((prev, curr) => {
+        const value = Number(curr);
+        if (!isNaN(value)) {
+          return ((prev * 10000000 + curr * 10000000) / 10000000).toFixed(2);
+        } else {
+          return prev;
+        }
+      }, 0);
+      sums[index] += '';
+    } else {
+      sums[index] = '*';
+    }
+  });
+
+  return sums;
+}

+ 3 - 3
src/api/business/spd/task_management/visitingPlan/visitingPlan.js

@@ -19,7 +19,7 @@ export function addPlan(data) {
 //拜访计划编辑
 export function editPlan(data) {
     return request({
-        url: '/mk/bo/plan/',
+        url: '/mk/bo/plan/edit',
         method: 'put',
         data: data
     })
@@ -60,7 +60,7 @@ export function delPlanItem(id) {
         method: 'delete'
     })
 }
-// 采购需求单导出
+//拜访计划导出
 export function exportPlan(data) {
     return request({
       url: `/mk/bo/plan/export`,
@@ -68,4 +68,4 @@ export function exportPlan(data) {
       data: data,
       responseType: 'blob'
     })
-}
+}

+ 46 - 38
src/views/business/spd/fillin/dailysale_quantity_assess/detail.vue

@@ -27,7 +27,7 @@
             <el-form-item label="月份" prop="month">
               <el-date-picker
                 v-model="form.month"
-                value-format="yyyy-MM-dd"
+                value-format="yyyy-MM"
                 type="month"
                 clearable
               >
@@ -52,14 +52,12 @@
           </el-col>
           <el-col :span="1.5">
             <el-form-item label="创建日期" prop="createTime">
-              <el-date-picker
+              <el-input
                 v-model="form.createTime"
+                style="width: 200px"
                 clearable
-                type="date"
-                value-format="yyyy-MM-dd"
                 readonly
-              >
-              </el-date-picker>
+              />
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
@@ -709,6 +707,7 @@ export default {
   data() {
     return {
       form: {
+        month: null,
         customer: null,
         customerName: null,
         items: [],
@@ -726,20 +725,15 @@ export default {
     };
   },
   watch: {
-	'form.month': {
-        handler(newVal) {
-            var curDate = new Date(newVal);
-            console.log('curDate',curDate);
-            /* 获取当前月份 */
-            var curMonth = curDate.getMonth();
-            /*  生成实际的月份: 由于curMonth会比实际月份小1, 故需加1 */
-            curDate.setMonth(curMonth + 1);
-            /* 将日期设置为0, 这里为什么要这样设置, 我不知道原因, 这是从网上学来的 */
-            curDate.setDate(0);
-            /* 返回当月的天数 */
-            this.numDay = curDate.getDate();
-        },
-        immediate:true,
+    'form.month': {
+      handler(newVal) {
+          console.log('newVal',newVal);
+          let arr = newVal.split('-');
+          console.log('arr.[1]',arr[1]);
+          this.numDay = this.getDays(arr[0],arr[1]);
+          console.log('this.numDay',this.numDay);
+      },
+      immediate:true,
     }
   },
   computed: {
@@ -750,11 +744,8 @@ export default {
   async created() {
     switch (this.openMode) {
       case "add":
-        var now = new Date(); // 当前日期
-        var nowYear = now.getFullYear(); //当前年
-        var nowMonth = now.getMonth() ;
-        this.form.month = new Date(nowYear,nowMonth,1,"00","00");
-        // this.form.createTime = new Date();
+        this.form.createTime = this.getCurrentTime();
+        this.form.month = this.getCurrentMonth();
         this.form.createByName = this.$store.state.user.nickName;
         this.form.dept = this.$store.state.user.deptId;
         this.form.deptName = this.$store.state.user.deptName;
@@ -855,19 +846,36 @@ export default {
       this.$parent.useOpenDetail();
       this.$parent.useSearch();
     },
-    //获取当月天数
-    getCountDays(val) {
-        console.log('val',val);
-        var curDate = new Date(val);
-        console.log('curDate',curDate);
-        /* 获取当前月份 */
-        var curMonth = curDate.getMonth();
-        /*  生成实际的月份: 由于curMonth会比实际月份小1, 故需加1 */
-        curDate.setMonth(curMonth + 1);
-        /* 将日期设置为0, 这里为什么要这样设置, 我不知道原因, 这是从网上学来的 */
-        curDate.setDate(0);
-        /* 返回当月的天数 */
-        return curDate.getDate();
+    //获取当月
+    getCurrentMonth () {
+      const date = new Date()
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      month = month > 9 ? month : '0' + month
+      return `${year}-${month}`
+    },
+    getDays(year, month){
+      return new Date(year, month, 0).getDate()
+    },
+    getCurrentTime() {
+      var date = new Date();//当前时间
+      var year = date.getFullYear() //年
+      var month = this.repair(date.getMonth() + 1);//月
+      var day = this.repair(date.getDate());//日
+      var hour = this.repair(date.getHours());//时
+      var minute = this.repair(date.getMinutes());//分
+      var second = this.repair(date.getSeconds());//秒
+      //当前时间 
+      var curTime = year + "-" + month + "-" + day
+              + " " + hour + ":" + minute + ":" + second;
+      return curTime;
+    },
+    repair(i){
+      if (i >= 0 && i <= 9) {
+          return "0" + i;
+      } else {
+          return i;
+      }
     }
   },
 };

+ 2 - 5
src/views/business/spd/fillin/dailysale_quantity_assess/index.vue

@@ -61,11 +61,7 @@
           <el-table-column label="序号" type="index" width="50" align="center" fixed/>
           <el-table-column show-overflow-tooltip label="编码" align="center" width="200" prop="code"/>
           <el-table-column show-overflow-tooltip label="客户名称" align="center" width="200" prop="customerName"/>
-          <el-table-column show-overflow-tooltip label="月度" align="center" width="200" prop="month">
-            <template slot-scope="scope">
-              {{scope.row.month.substring(0,7)}}
-            </template>
-          </el-table-column>
+          <el-table-column show-overflow-tooltip label="月度" align="center" width="200" prop="month"/>
           <el-table-column show-overflow-tooltip label="部门" align="center" width="200" prop="deptName"/>
           <el-table-column show-overflow-tooltip label="创建人" align="center" width="200" prop="createByName" />
           <el-table-column show-overflow-tooltip label="创建时间" align="center" width="200" prop="createTime" />
@@ -157,6 +153,7 @@ export default {
     },
     //查询列表
     getList(params){
+      console.log('params',params);
       listAssess(params).then(res => {
         if (res.code === 200) {
           this.tableList = res.rows

+ 38 - 17
src/views/business/spd/goal_management/AnnualSaleGoal.vue

@@ -317,9 +317,9 @@
         </el-row>
         <el-tabs v-model="activeName">
           <el-tab-pane label="年销售目标填报明细" name="annualSaleGoalDetails">
-            <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="annualSaleGoalDetailsList" @selection-change="handleSelectionChange">
+            <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="annualSaleGoalDetailsList" @selection-change="handleSelectionChange">
               <el-table-column label="序号" type="index" width="70" align="center" fixed />
-              <el-table-column label="销售组织" align="center" width="180" :render-header="addRedStar">
+              <el-table-column label="销售组织" align="center" width="180" :render-header="(h, obj) => addRedStar(h, obj, '0')">
                 <template slot-scope="scope">
                   <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleOrg" title="销售组织" valueKey="name"
                                         referName="ORG_PARAM"
@@ -328,7 +328,7 @@
                   </el-popover-select-v2>
                 </template>
               </el-table-column>
-              <el-table-column label="销售区域" align="center" width="180" :render-header="addRedStar">
+              <el-table-column label="销售区域" align="center" width="180" :render-header="(h, obj) => addRedStar(h, obj, '0')">
                 <template slot-scope="scope">
                   <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleZone" title="销售区域" valueKey="name"
                                         referName="MK_SALESAREA_PARAM"
@@ -337,7 +337,7 @@
                   </el-popover-select-v2>
                 </template>
               </el-table-column>
-              <el-table-column label="客户" align="center" width="180" :render-header="addRedStar">
+              <el-table-column label="客户" align="center" width="180" :render-header="(h, obj) => addRedStar(h, obj, '0')">
                 <template slot-scope="scope">
                   <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].custom" title="客户" valueKey="name"
                                         referName="CUSTOMER_PARAM"
@@ -346,7 +346,7 @@
                   </el-popover-select-v2>
                 </template>
               </el-table-column>
-              <el-table-column label="负责人" align="center" width="180" :render-header="addRedStar">
+              <el-table-column label="负责人" align="center" width="180" :render-header="(h, obj) => addRedStar(h, obj, '0')">
                 <template slot-scope="scope">
                   <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].creator" title="负责人" valueKey="name"
                                         referName="CONTACTS_PARAM"
@@ -355,17 +355,17 @@
                   </el-popover-select-v2>
                 </template>
               </el-table-column>
-              <el-table-column label="一级分类" align="center" width="180" :render-header="addRedStar">
+              <el-table-column label="一级分类" align="center" width="180" :render-header="(h, obj) => addRedStar(h, obj, '0')">
                 <template slot-scope="scope">
                   <el-input v-model="annualSaleGoalDetailsList[scope.$index].oneLevelClassify" placeholder="请输入一级分类" disabled></el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="二级分类" align="center" width="180" :render-header="addRedStar">
+              <el-table-column label="二级分类" align="center" width="180" :render-header="(h, obj) => addRedStar(h, obj, '0')">
                 <template slot-scope="scope">
                   <el-input v-model="annualSaleGoalDetailsList[scope.$index].twoLevelClassify" placeholder="请输入二级分类" disabled></el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="物料" align="center" width="220" :render-header="addRedStar">
+              <el-table-column label="物料" align="center" width="220" :render-header="(h, obj) => addRedStar(h, obj, '0')">
                 <template slot-scope="scope">
                   <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].material" title="物料" valueKey="name"
                                         referName="MATERIAL_PARAM"
@@ -546,12 +546,12 @@ import {
   addAnnualSaleGoal,
   updateAnnualSaleGoal
 } from "@/api/business/spd/goal_management/annualSaleGoal";
-
 import {
   delAnnualSaleGoalDetails,
   getAnnualSaleGoalDetails
 } from "@/api/business/spd/goal_management/annualSaleGoalDetails"
 import { getToken } from "@/utils/auth";
+import { getSummary } from "@/api/business/spd/goal_management/commonWays";
 
 // 树形参照
 import TreeRefers from '@/components/Refers/treeRefer.vue'
@@ -828,7 +828,7 @@ export default {
         twoLevelClassify: null,
         materialCode: null,
         material: null,
-        totalGoal: 0,
+        totalGoal: '0.00',
         januaryGoal: null,
         februaryGoal: null,
         marchGoal: null,
@@ -851,6 +851,7 @@ export default {
       const id = row.id || this.ids
       getAnnualSaleGoal(id).then(response => {
         this.form = response.data;
+        this.saveFormTwoPoint(this.form)
         this.annualSaleGoalDetailsList = this.form.annualGoalMergeDetails
         this.open = true;
         this.title = "修改--年度销售目标";
@@ -860,11 +861,13 @@ export default {
     handleCopy(id) {
       this.reset();
       getAnnualSaleGoal(id).then(response => {
+        console.log(response);
         this.form = response.data;
         this.form.id = null
         this.form.code = null
         this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
         this.form.annual = new Date().getFullYear().toString()
+        this.saveFormTwoPoint(this.form)
         this.annualSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.annualGoalMergeDetails))
         for (const element of this.annualSaleGoalDetailsList) {
           element.id = null
@@ -875,6 +878,13 @@ export default {
         console.log(this.form);
       })
     },
+    // 进入修改复制界面保留两位小数
+    saveFormTwoPoint(form) {
+      form.goalTotal = form.goalTotal.toFixed(2)
+      for (const element of form.annualGoalMergeDetails) {
+        element.totalGoal = element.totalGoal.toFixed(2)
+      }
+    },
     /** 提交按钮 */
     submitForm() {
       if (!this.justiceDetailsList()) {
@@ -892,6 +902,7 @@ export default {
           } else {
             this.form.documentStatus = '未提交'
             this.form.annualGoalMergeDetails = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
+            console.log(this.form);
             addAnnualSaleGoal(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
@@ -990,7 +1001,7 @@ export default {
       for (const element of array) {
         sum = (sum * 1000000 + element * 1000000) / 1000000
       }
-      this.annualSaleGoalDetailsList[index].totalGoal = sum
+      this.annualSaleGoalDetailsList[index].totalGoal = sum.toFixed(2)
       this.computeTotal()
     },
     // 计算主表合计
@@ -1000,14 +1011,24 @@ export default {
       for (const listElement of list) {
         sum = (sum * 1000000 + listElement.totalGoal * 1000000) / 1000000
       }
-      this.form.goalTotal = sum
+      this.form.goalTotal = sum.toFixed(2)
+    },
+    getSummaries(param) {
+      return getSummary(param)
     },
     // 给table添加必填项
-    addRedStar(h, { column }) {
-      return [
-        h('span', { style: 'color: #F56C6C' }, '*'),
-        h('span', '' + column.label)
-      ]
+    addRedStar(h, { column }, required) {
+      if (required === '0') {
+        return [
+          h('span', { style: 'color: #F56C6C' }, '*'),
+          h('span', '' + column.label)
+        ]
+      } else {
+        return [
+          // h('span', { style: 'color: #F56C6C' }, '*'),
+          h('span', '' + column.label)
+        ]
+      }
     },
     // 判断子表的字段是否都填了
     justiceDetailsList() {

+ 17 - 6
src/views/business/spd/goal_management/AnnualSaleGoalMerge.vue

@@ -344,7 +344,7 @@
         </el-row>
         <el-tabs v-model="activeName" @tab-click="getNewTwoArray">
           <el-tab-pane label="年销售目标合并明细" name="annualSaleGoalMergeDetails">
-            <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="annualSaleGoalMergeDetailsList">
+            <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="annualSaleGoalMergeDetailsList">
               <el-table-column label="序号" type="index" width="70" align="center" fixed />
               <el-table-column label="销售组织" align="center" width="180">
                 <template slot-scope="scope">
@@ -468,7 +468,7 @@
             </el-table>
           </el-tab-pane>
           <el-tab-pane label="区域目标汇总(年)" name="zoneGoalSum(year)">
-            <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="areaDetailList">
+            <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="areaDetailList">
               <el-table-column label="序号" type="index" width="70" align="center" fixed />
               <el-table-column label="销售组织" align="center" width="180">
                 <template slot-scope="scope">
@@ -565,7 +565,7 @@
             </el-table>
           </el-tab-pane>
           <el-tab-pane label="客户目标汇总(年)" name="customerGoalSum(year)">
-            <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="customerDetailList">
+            <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="customerDetailList">
               <el-table-column label="序号" type="index" width="70" align="center" fixed />
               <el-table-column label="销售组织" align="center" width="180">
                 <template slot-scope="scope">
@@ -719,6 +719,7 @@ import {
   getAnnualSaleMergeDetails
 } from "@/api/business/spd/goal_management/annualSaleMergeDetails"
 import { getToken } from "@/utils/auth";
+import { getSummary } from "@/api/business/spd/goal_management/commonWays";
 
 // 树形参照
 import TreeRefers from '@/components/Refers/treeRefer.vue'
@@ -1054,7 +1055,11 @@ export default {
       getAnnualSaleGoalMerge(id).then(response => {
         console.log(response);
         this.form = response.data;
-        this.annualSaleGoalMergeDetailsList = response.data.annualGoalMergeDetailsList
+        this.form.goalTotal = this.form.goalTotal.toFixed(2)
+        for (const element of this.form.annualGoalMergeDetailsList) {
+          element.totalGoal = element.totalGoal.toFixed(2)
+        }
+        this.annualSaleGoalMergeDetailsList = JSON.parse(JSON.stringify(this.form.annualGoalMergeDetailsList))
         this.open = true;
         this.title = "修改--年度销售目标合并明细";
       });
@@ -1074,6 +1079,7 @@ export default {
         this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
         this.form.annual = new Date().getFullYear().toString()
         this.form.goalTotal = 0
+        this.form.goalTotal = this.form.goalTotal.toFixed(2)
         this.open = true
       })
     },
@@ -1327,7 +1333,10 @@ export default {
         }
         sum = (sum * 1000000 + listElement.totalGoal * 1000000) / 1000000
       }
-      this.form.goalTotal = sum
+      this.form.goalTotal = sum.toFixed(2)
+    },
+    getSummaries(param) {
+      return getSummary(param)
     },
     // 合并数据
     clickMerge() {
@@ -1358,12 +1367,14 @@ export default {
       mergeAnnualSaleMergeDetails(query).then(response => {
         console.log(response);
         if (response.data.consolidatedDetail.length > 0) {
+          for (const consolidatedDetail of response.data.consolidatedDetail) {
+            consolidatedDetail.totalGoal = consolidatedDetail.totalGoal.toFixed(2)
+          }
           this.annualSaleGoalMergeDetailsList = response.data.consolidatedDetail
           this.computeTotal()
         } else {
           return this.$message.warning('未查到相关数据')
         }
-
       })
     },
     // 获得区域目标汇总or客户目标汇总

+ 8 - 2
src/views/business/spd/goal_management/MonthGoalMerge.vue

@@ -377,7 +377,7 @@
         </el-row>
         <el-tabs v-model="activeName" @tab-click="getNewTwoArray">
           <el-tab-pane label="月销售目标合并明细" name="monthGoalMergeDetails">
-            <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="monthGoalMergeDetailsList" @selection-change="handleSelectionChange">
+            <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="monthGoalMergeDetailsList" @selection-change="handleSelectionChange">
               <el-table-column label="序号" type="index" width="70" align="center" fixed />
               <el-table-column label="销售组织" align="center" prop="saleOrg" width="180">
                 <template slot-scope="scope">
@@ -604,6 +604,7 @@ import {
   mergeMonthSaleMergeDetails
 } from "@/api/business/spd/goal_management/monthGoalMergeDetails"
 import { getToken } from "@/utils/auth";
+import { getSummary } from "../../../../api/business/spd/goal_management/commonWays";
 
 // 树形参照
 import TreeRefers from '@/components/Refers/treeRefer.vue'
@@ -921,6 +922,7 @@ export default {
       const id = row.id || this.ids
       getMonthGoalMerge(id).then(response => {
         this.form = response.data;
+        this.form.goalSum = this.form.goalSum.toFixed(2)
         this.monthGoalMergeDetailsList = this.form.monthMergeDetailsList
         this.open = true;
         this.title = "修改--月销售目标合并";
@@ -942,6 +944,7 @@ export default {
         this.form.annual = new Date().getFullYear().toString()
         this.form.monthly = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0')
         this.form.goalSum = 0
+        this.form.goalSum = this.form.goalSum.toFixed(2)
         this.open = true
         this.changeGoalCategoryForm()
       })
@@ -1229,7 +1232,10 @@ export default {
       for (const listElement of list) {
         sum = (sum * 1000000 + listElement.goalValue * 1000000) / 1000000
       }
-      this.form.goalSum = sum
+      this.form.goalSum = sum.toFixed(2)
+    },
+    getSummaries(param) {
+      return getSummary(param)
     },
     // 合并数据
     clickMerge() {

+ 8 - 3
src/views/business/spd/goal_management/MonthReturnGoal.vue

@@ -322,7 +322,7 @@
         </el-row>
         <el-tabs v-model="activeName">
           <el-tab-pane label="月回款目标明细" name="monthReturnGoalDetails">
-            <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="monthReturnGoalDetailsList" @selection-change="handleSelectionChange">
+            <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="monthReturnGoalDetailsList" @selection-change="handleSelectionChange">
               <el-table-column label="序号" type="index" width="70" align="center" fixed />
               <el-table-column label="销售组织" align="center" width="180" :render-header="addRedStar">
                 <template slot-scope="scope">
@@ -505,6 +505,7 @@ import {
   delMonthReturnGoalDetails
 } from "@/api/business/spd/goal_management/monthReturnGoalDetails"
 import { getToken } from "@/utils/auth";
+import { getSummary } from "../../../../api/business/spd/goal_management/commonWays";
 
 // 树形参照
 import TreeRefers from '@/components/Refers/treeRefer.vue'
@@ -771,7 +772,7 @@ export default {
       const id = row.id || this.ids
       getMonthReturnGoal(id).then(response => {
         this.form = response.data;
-        console.log(this.form);
+        this.form.goalSum = this.form.goalSum.toFixed(2)
         this.monthReturnGoalDetailsList = JSON.parse(JSON.stringify(this.form.monthReturnGoalDetailsList))
         this.open = true;
         this.title = "修改--月回款目标填报";
@@ -784,6 +785,7 @@ export default {
         this.form = response.data;
         this.form.id = null
         this.form.code = null
+        this.form.goalSum = this.form.goalSum.toFixed(2)
         this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
         this.form.annual = new Date().getFullYear().toString()
         this.monthReturnGoalDetailsList = JSON.parse(JSON.stringify(this.form.monthReturnGoalDetailsList))
@@ -879,7 +881,10 @@ export default {
       for (const listElement of list) {
         sum = (sum * 1000000 + listElement.goalSum * 1000000) / 1000000
       }
-      this.form.goalSum = sum
+      this.form.goalSum = sum.toFixed(2)
+    },
+    getSummaries(param) {
+      return getSummary(param)
     },
     // 复制明细
     handleCopyDetails(row) {

+ 7 - 3
src/views/business/spd/goal_management/MonthReturnMerge.vue

@@ -334,7 +334,7 @@
       </el-row>
       <el-tabs v-model="activeName" @tab-click="getNewTwoArray">
         <el-tab-pane label="月回款目标合并明细" name="monthReturnMergeDetails">
-          <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="monthReturnMergeDetailsList">
+          <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="monthReturnMergeDetailsList">
             <el-table-column label="序号" type="index" width="55" align="center" fixed />
             <el-table-column label="销售组织" align="center" width="180">
               <template slot-scope="scope">
@@ -395,7 +395,7 @@
           </el-table>
         </el-tab-pane>
         <el-tab-pane label="区域目标汇总(月回款)" name="zoneGoalSum(monthReturn)">
-          <el-table max-height="300" show-summary sum-text="小计" :data="zoneGoalSumList">
+          <el-table max-height="300" show-summary :summary-method="getSummaries" :data="zoneGoalSumList">
             <el-table-column label="序号" type="index" width="55" align="center" fixed />
             <el-table-column label="销售组织" align="center" width="180">
               <template slot-scope="scope">
@@ -500,6 +500,7 @@ import {
   mergeMonthReturnMergeDetails
 } from "@/api/business/spd/goal_management/monthReturnMergeDetails"
 import { getToken } from "@/utils/auth";
+import { getSummary } from "../../../../api/business/spd/goal_management/commonWays";
 
 // 参照
 import TreeRefers from '@/components/Refers/treeRefer.vue'
@@ -771,6 +772,7 @@ export default {
       const id = row.id || this.ids
       getMonthReturnMerge(id).then(response => {
         this.form = response.data;
+        this.form.goalSum = this.form.goalSum.toFixed(2)
         this.monthReturnMergeDetailsList = this.form.monthReturnMergeDetailsList
         this.open = true;
         this.title = "修改--月回款目标合并";
@@ -788,6 +790,7 @@ export default {
         this.form.id = null
         this.form.code = null
         this.form.goalSum = 0
+        this.form.goalSum = this.form.goalSum.toFixed(2)
         this.title = "添加--月销售目标合并";
         this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
         this.form.annual = new Date().getFullYear().toString()
@@ -903,8 +906,9 @@ export default {
       for (const listElement of list) {
         sum = (sum * 1000000 + listElement.goalSum * 1000000) / 1000000
       }
-      this.form.goalSum = sum
+      this.form.goalSum = sum.toFixed(2)
     },
+    getSummaries(param) { return getSummary(param) },
     // 复制明细
     handleCopyDetails(row) {
       let list = {

+ 9 - 5
src/views/business/spd/goal_management/MonthSaleGoal.vue

@@ -324,7 +324,7 @@
         </el-row>
         <el-tabs v-model="activeName">
           <el-tab-pane label="月销售目标明细" name="monthSaleGoalDetails">
-            <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="monthSaleGoalDetailsList" @selection-change="handleSelectionChange">
+            <el-table max-height="300" show-summary :summary-method="getSummaries" v-loading="loading" :data="monthSaleGoalDetailsList" @selection-change="handleSelectionChange">
               <el-table-column label="序号" type="index" width="70" align="center" fixed />
               <el-table-column label="销售组织" align="center" width="180" :render-header="addRedStar">
                 <template slot-scope="scope">
@@ -537,6 +537,7 @@ import {
   delMonthSaleGoalDetails
 } from "@/api/business/spd/goal_management/monthSaleGoalDetails"
 import { getToken } from "@/utils/auth";
+import { getSummary } from "../../../../api/business/spd/goal_management/commonWays";
 
 // 树形参照
 import TreeRefers from '@/components/Refers/treeRefer.vue'
@@ -784,7 +785,7 @@ export default {
       this.reset();
       this.monthSaleGoalDetailsList = []
       this.open = true;
-      this.title = "添加月销售目标填报";
+      this.title = "添加--月销售目标填报";
       this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
       this.form.annual = new Date().getFullYear().toString()
       this.form.creator = this.$store.state.user.nickName
@@ -819,9 +820,10 @@ export default {
       const id = row.id || this.ids
       getMonthSaleGoal(id).then(response => {
         this.form = response.data;
-        this.monthSaleGoalDetailsList = this.form.monthDetailsList
+        this.form.goalSum = this.form.goalSum.toFixed(2)
+        this.monthSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.monthDetailsList))
         this.open = true;
-        this.title = "修改月销售目标填报";
+        this.title = "修改--月销售目标填报";
       });
     },
     // 复制按钮
@@ -831,6 +833,7 @@ export default {
         this.form = response.data;
         this.form.id = null
         this.form.code = null
+        this.form.goalSum = this.form.goalSum.toFixed(2)
         this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
         this.form.annual = new Date().getFullYear().toString()
         this.monthSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.monthDetailsList))
@@ -950,8 +953,9 @@ export default {
       for (const listElement of list) {
         sum = (sum * 1000000 + listElement.goalValue * 1000000) / 1000000
       }
-      this.form.goalSum = sum
+      this.form.goalSum = sum.toFixed(2)
     },
+    getSummaries(param) { return getSummary(param) },
     // 子表table加必填标志
     addRedStar(h, { column }) {
       return [

+ 152 - 119
src/views/business/spd/task_management/visitingPlan/add.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="addPlanList">
-    <el-card>
+    <el-card style="position: relative;">
       <span>基本信息</span>
       <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto">
         <el-row :gutter="10">
@@ -16,7 +16,7 @@
           </el-col>
 
           <el-col :span="1.5">
-            <el-form-item label="计划名称" prop="planName" :rules="{ required: true, message: '请填写名称', trigger: 'blur' }">
+            <el-form-item label="计划名称" prop="planName" :rules="{ required: true, message: '请填写计划名称', trigger: 'blur' }">
               <el-input
                 v-model.trim="basicForm.planName"
                 size="mini"
@@ -28,7 +28,7 @@
          </el-col>
 
          <el-col :span="1.5">
-            <el-form-item label="线路类型" prop="type">
+            <el-form-item label="线路类型" prop="type" :rules="{ required: true, message: '请选择线路类型', trigger: 'blur' }">
               <el-select :disabled="sonDisable" v-model="basicForm.type" size="mini" style="width: 200px">
                 <el-option v-for="dict in dict.type.mk_plan_route_type" :key="dict.value" :label="dict.label" :value="dict.value">
                 </el-option>
@@ -37,7 +37,7 @@
           </el-col>
 
           <el-col :span="1.5">
-            <el-form-item label="执行人" prop="chargerName">
+            <el-form-item label="执行人" prop="chargerName" :rules="{ required: true, message: '请选择执行人', trigger: 'blur' }">
                 <el-select clearable size="mini" v-model="basicForm.chargerName" :disabled="sonDisable" @focus="choose('CONTACTS_PARAM', true, '执行人')" style="width: 200px">
                   <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
@@ -70,9 +70,9 @@
               >
               </el-date-picker>
             </el-form-item>
-         </el-col>
+          </el-col>
 
-         <el-col :span="1.5">
+          <el-col :span="1.5">
             <el-form-item label="截止时间" prop="deadlineTime" :rules="{ required: true, message: '请选择截止时间', trigger: 'blur' }">
               <el-date-picker
                 v-model="basicForm.deadlineTime"
@@ -85,10 +85,10 @@
               >
               </el-date-picker>
             </el-form-item>
-         </el-col>
+          </el-col>
 
          <el-col :span="1.5">
-            <el-form-item label="销售区域" prop="marketingAreaName">
+            <el-form-item label="销售区域" prop="marketingAreaName" :rules="{ required: true, message: '请选择销售区域', trigger: 'blur' }">
               <el-select clearable v-model="basicForm.marketingAreaName" size="mini" :disabled="sonDisable" @focus="choose('MK_SALESAREA_PARAM', true, '销售区域')" style="width: 200px">
                 <el-option
                   v-for="item in deptOptions"
@@ -115,30 +115,32 @@
 
         </el-row>
 
-        <span>明细信息</span>
         <div class="btn_grooup">
-          <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
-          <el-button type="primary" size="mini" @click="delItems" v-if="sonPageStu == 'edit'">批量删除</el-button>
-          <el-button type="primary" size="mini" @click="edit" v-if="sonPageStu == 'check'">编辑</el-button>
+          <span>明细信息</span>
+          <div>
+            <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
+            <el-button type="primary" size="mini"  @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
+            <el-button type="primary" size="mini" @click="delItems" v-if="sonPageStu == 'edit'">批量删除</el-button>
+            <el-button type="primary" size="mini" @click="edit" v-if="sonPageStu == 'check'">编辑</el-button>
+          </div>
         </div>
 
-        <el-table 
+        <el-table
           :data="basicForm.mkBoPlanItemList" 
           fit
-          max-height="300"
+          max-height="600"
           style="font-size: 12px;"
           @selection-change="handleSelectionChange"
-          :cell-class-name="cellClassName"
         >
           <el-table-column type="selection" align="center"/>
           <el-table-column label="序号" type="index" align="center"/>
           <el-table-column show-overflow-tooltip label="计划编号" prop="planCode" width="150"/>
-          <el-table-column show-overflow-tooltip label="日期"  prop="date" width="230px">
+          <el-table-column show-overflow-tooltip label="日期"  prop="date" width="230px" :render-header="addRedStar">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'date'" :rules="{ required: true, message: '请填写日期', trigger: 'blur' }">
                 <el-date-picker
                   v-model="scope.row.date"
-                  readonly
+                  :readonly="sonDisable"
                   clearable
                   type="date"
                   size="mini"
@@ -149,9 +151,9 @@
             </template>
           </el-table-column>
 
-          <el-table-column show-overflow-tooltip label="客户名称" prop="customerName" min-width="230">
+          <el-table-column show-overflow-tooltip label="客户" prop="customerName" min-width="230" :render-header="addRedStar">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'customerName'" :rules="{ required: true, message: '请选择客户', trigger: 'blur' }">
                 <el-select clearable size="mini" v-model="scope.row.customerName" :disabled="sonDisable" @focus="chooseSon(scope.$index, 'CUSTOMER_PARAM_ZT', true, '客户')" style="width: 200px">
                   <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
@@ -159,10 +161,10 @@
             </template>
           </el-table-column>
 
-          <el-table-column show-overflow-tooltip label="联系人" prop="contactName" min-width="230">
+          <el-table-column show-overflow-tooltip label="联系人" prop="contactName" min-width="230" :render-header="addRedStar">
             <template slot-scope="scope">
-              <el-form-item class="hang">
-                <el-select clearable size="mini" v-model="scope.row.contactName" :disabled="sonDisable" @focus="chooseSon(scope.$index, 'LINKMAN_PARAM', true, '联系人', {})" style="width: 200px">
+              <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'contactName'" :rules="{ required: true, message: '请选择联系人', trigger: 'blur' }">
+                <el-select clearable size="mini" v-model="scope.row.contactName" :disabled="sonDisable" @focus="chooseSon(scope.$index, 'LINKMAN_PARAM', true, '联系人', {customer:scope.row.customer})" style="width: 200px">
                   <el-option v-for="item in linkOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
               </el-form-item>
@@ -171,15 +173,15 @@
 
           <el-table-column show-overflow-tooltip label="详细地址" prop="address" min-width="200">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'address'">
                 <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.address"/>
               </el-form-item>
             </template>
           </el-table-column>
 
-          <el-table-column show-overflow-tooltip label="拜访目的" prop="purpose" min-width="200">
+          <el-table-column show-overflow-tooltip label="拜访目的" prop="purpose" min-width="200" :render-header="addRedStar">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'purpose'" :rules="{ required: true, message: '请选择拜访目的', trigger: 'blur' }">
                 <el-select clearable :disabled="sonDisable" v-model="scope.row.purpose" size="mini">
                   <el-option v-for=" dict in dict.type.mk_bo_behavior_goal" :key="dict.value" :label="dict.label" :value="dict.value">
                   </el-option>
@@ -188,10 +190,17 @@
             </template>
           </el-table-column>
 
-          <el-table-column :readonly="sonDisable" show-overflow-tooltip label="商机" prop="boName" min-width="200"/>
+          <el-table-column :readonly="sonDisable" show-overflow-tooltip label="商机" prop="boName" min-width="200">
+            <template slot-scope="scope">
+              <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'boName'">
+                <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.boName"/>
+              </el-form-item>
+            </template>
+          </el-table-column>
+
           <el-table-column :readonly="sonDisable" show-overflow-tooltip label="营销活动" prop="marketingCampaign" min-width="200">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'marketingCampaign'">
                 <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.marketingCampaign"/>
               </el-form-item>
             </template>
@@ -214,10 +223,10 @@
       <el-col :span="1.5">
         <el-button type="primary" size="mini" plain @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
       </el-col>
-      <el-col :span="1.5" style="margin: 0 10px;">
+      <!-- <el-col :span="1.5" style="margin: 0 10px;">
         <el-button type="primary" size="mini" plain @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
-      </el-col>
-      <el-col :span="1.5">
+      </el-col> -->
+      <el-col :span="1.5" style="margin: 0 10px;">
         <el-button size="mini" plain @click="back">返回</el-button>
       </el-col>
 
@@ -253,32 +262,21 @@ export default {
       // },
       basicForm: {
         id: '',
-        planId: '',
         planCode: '',
-        planName :'',
-        charger: '',
-        chargerName: '',
+        planName : '',
+        charger: this.$store.state.user.id,
+        chargerName: this.$store.state.user.nickName,
+        dept: this.$store.state.user.deptId,
+        deptName: this.$store.state.user.deptName,
+        startDate: this.getNextWeek(1),
+        deadlineTime: this.getNextWeek(7),
         type: '0',
-        dept: '',
-        deptName: '',
-        startDate: this.getWeek(1),
-        deadlineTime: this.getWeek(7),
-        date: '',
+        state: '0',
         marketingArea: '',
         marketingAreaName: '',
-        state: '0',
-        customer: '',
-        customerName: '',
-        contact: '',
-        contactName: '',
-        address: '',
-        purpose: '',
-        bo: '',
-        boName: '',
-        marketingCampaign: '',
         mkBoPlanItemList: []
       },
-      delDemandItemList: [],
+      delPlanItemList: [],
       basicRules: {},
       tableList: [],
       referCondition: {
@@ -298,43 +296,59 @@ export default {
       personOptions: [],
       deptOptions: [],
       customerOptions: [],
-      pickerOptionsEnd: {
-        disabledDate: (time) => {
-          return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000
-        }
-      },
-      isBDXQ: false,
-      isYl: false,
+      salesAreaOptions: [],
+      //判断默认明细行带出完毕后日期等于当前日期的标识
+      isFlag: false
     }
   },
   updated() {},
   mounted() {},
   created() {
+    //查看系统数据
+    console.log(this.$store.state.user, 'this.$store.state.user')
     if(this.pageStu == 'check') {
       console.log('数据', this.row)
       this.getDetails(this.row)
-    } else if(this.pageStu == 'edit') {
+    } else if (this.pageStu == 'edit') {
       this.getDetails(this.row)
+    } else if (this.pageStu == 'add') {
+    //新增时默认带出7条明细行
+    this.defaultDetailLine(7)
     }
   },
   methods:{
+    copy() {
+      this.isFlag = true;
+      this.$modal.notifySuccess("复制成功");
+      this.sonPageStu = 'add'
+      this.sonDisable = false
+      // this.getDetails(this.row)
+      this.basicForm.id = ''
+      this.basicForm.planCode = ''
+      this.basicForm.createBy = ''
+      this.basicForm.createTime = ''
+      this.basicForm.chargerName = this.$store.state.user.nickName
+      this.basicForm.dept = this.$store.state.user.deptId
+      if (this.basicForm.chargerName) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.chargerName) }
+      if (this.basicForm.marketingAreaName) { this.reBackRefer('MK_SALESAREA_PARAM', this.basicForm.marketingAreaName) }
+      if (this.basicForm.deptName) { this.reBackRefer('DEPT_PARAM', this.basicForm.deptName) }
+      this.basicForm.mkBoPlanItemList.forEach(item => {
+        item.planCode = ''
+      })
+    },
     handleData() {
       console.log('222')
       // 复制新增把id,编码,创建人置为空,子表去掉id
       this.basicForm.id = ''
-      this.basicForm.code = ''
+      this.basicForm.planCode = ''
       this.basicForm.createBy = ''
-      this.basicForm.source = '4'
       if (this.basicForm.mkBoPlanItemList.length !== 0) {
         this.basicForm.mkBoPlanItemList.forEach(item => {
           if (item.id) {
             delete item.id
           }
-          if (item.demandId) {
-            delete item.demandId
-          }
-          if (item.allotCode) {
-            delete item.allotCode
+          if (item.planId) {
+            delete item.planId
           }
         })
       }
@@ -350,7 +364,7 @@ export default {
     },
     async save() {
       if(this.basicForm.mkBoPlanItemList.length !== 0) {
-        this.$refs['basic'].validate((valid) => {
+        this.$refs['basic'].validate((valid, obj) => {
           if(valid) {
             this.$modal.loading("保存中...");
             if(this.sonPageStu == 'add') {
@@ -358,7 +372,7 @@ export default {
               addPlan(this.basicForm).then(res => {
                 console.log(333)
                 if (res.code === 200) {
-                  this.$modal.msgSuccess("保存成功");
+                  this.$modal.notifySuccess("保存成功");
                   this.$modal.closeLoading();
                   this.back()
                 }
@@ -367,15 +381,15 @@ export default {
               })
             } else if (this.sonPageStu == 'edit') {
               let list = []
-              list.push(...this.basicForm.mkBoPlanItemList, ...this.delDemandItemList)
+              list.push(...this.basicForm.mkBoPlanItemList, ...this.delPlanItemList)
               // 深拷贝一下参数对象
               let param = JSON.parse(JSON.stringify(this.basicForm))
               console.log('深拷贝对象',param);
               param.mkBoPlanItemList = list
-              // this.basicForm.mkBoPlanItemList.push(...this.delDemandItemList)
+              // this.basicForm.mkBoPlanItemList.push(...this.delPlanItemList)
               editPlan(param).then(res => {
                 if (res.code === 200) {
-                  this.$modal.msgSuccess("编辑成功");
+                  this.$modal.notifySuccess("编辑成功");
                   this.$modal.closeLoading();
                   this.back()
                 }
@@ -383,32 +397,42 @@ export default {
                 this.$modal.closeLoading();
               })
             }
+          } else {
+            // 校验加弹窗
+            const jiaoyan = []
+            for(let key in obj) {
+              jiaoyan.push(obj[key][0].message);
+            }
+            this.$modal.notifyWarning(jiaoyan[0]);
+            return false
           }
         })
       } else {
         this.$modal.msgWarning("明细信息不能为空!");
       }
     },
-    submit() {
-      this.$modal.loading("提交中...");
-      submitDemand(this.basicForm).then(res => {
-        if (res.code === 200) {
-          this.$modal.msgSuccess("提交成功");
-          this.$modal.closeLoading();
-          this.back()
-        }
-      }).catch(err => {
-        this.$modal.closeLoading();
-      })
-    },
+    // submit() {
+    //   this.$modal.loading("提交中...");
+    //   submitDemand(this.basicForm).then(res => {
+    //     if (res.code === 200) {
+    //       this.$modal.notifySuccess("提交成功");
+    //       this.$modal.closeLoading();
+    //       this.back()
+    //     }
+    //   }).catch(err => {
+    //     this.$modal.closeLoading();
+    //   })
+    // },
     // 增行
-    addLine() {
+    addLine(date) {
+      if (this.isFlag) {
+        date = this.getCurrentTime();
+      }
       const newLine = {
-        contacts: null,
         id: null,
         planId: null,
         planCode: null,
-        date: this.getCurrentTime(),
+        date: date,
         customer: null,
         customerName: null,
         contact: null,
@@ -421,8 +445,6 @@ export default {
         delFlag: 0,
         // 新增字段
         model: null,
-        storageCondition: null,
-        transportationCondition: null,
       }
       this.basicForm.mkBoPlanItemList.push(newLine)
     },
@@ -435,7 +457,7 @@ export default {
         this.$modal.confirm('确认信息').then(() => {
         delPlanItem(param).then(res => {
           if (res.code === 200) {
-            this.$modal.msgSuccess("删除成功");
+            this.$modal.notifySuccess("删除成功");
             this.getDetails(this.row)
           }
         })
@@ -445,11 +467,7 @@ export default {
     delLine(index, row) {
       console.log('删除行:', index)
       console.log('改变行:', row)
-      // this.basicForm.mkBoPlanItemList = this.basicForm.mkBoPlanItemList.filter(item => {
-      //   return item.id !== row.id
-      // })
       row.delFlag = '2'
-      // this.basicForm.mkBoPlanItemList.splice(index,1)
       let delList = []
       delList = this.basicForm.mkBoPlanItemList.filter(item => {
         return item.delFlag == '2'
@@ -457,14 +475,16 @@ export default {
       this.basicForm.mkBoPlanItemList = this.basicForm.mkBoPlanItemList.filter(item => {
         return item.delFlag == '0'
       })
-      this.delDemandItemList.push(...delList)
-      console.log('删除的数组',this.delDemandItemList)
+      this.delPlanItemList.push(...delList)
+      console.log('删除的数组',this.delPlanItemList)
     },
     edit() {
-      // this.isList = false
-      // this.page = 'edit'
-      // this.rowDetail = row
-      // this.disable = false
+      this.isFlag = true;
+      this.sonPageStu = 'edit'
+      this.sonDisable = false
+      this.basicForm.mkBoPlanItemList.forEach(item => {
+        item.planCode = this.basicForm.planCode
+      })
     },
     back() {
       this.$emit('jugislist', true)
@@ -474,18 +494,17 @@ export default {
       // }
       this.$emit('refresh')
     },
-    // 单元格标红
-    cellClassName({row, column, rowIndex, columnIndex}) {
-      if(this.basicForm.isSpeical == 'N' && column.label == '需求可用周期' && Number(row.demandPeriod) > 1.5 && Number(row.demandPeriod) > Number(row.minOrderQty)) {
-        return 'success-row';
-      }
+    // 如果需要回显则调用详情接口
+    getDetails(row) {
+      getPlanDetail(row.id).then(res => {
+        if (res.code === 200) {
+          this.basicForm = res.data
+          for (let i = 0; i < this.basicForm.mkBoPlanItemList.length; i++) {
+            this.basicForm.mkBoPlanItemList[i].planCode = res.data.planCode
+          }
+        }
+      })
     },
-    // handleSelectionChange(selection) {
-    //   this.ids = selection.map(item =>{
-    //     return item.id
-    //   })
-    //   console.log('选中数组', this.ids)
-    // },
     handleSelectionChange(selection) {
       console.log('选中', selection)
       this.ids = selection.map(item => item.id)
@@ -494,8 +513,8 @@ export default {
     // 回显参照框
     reBackRefer(type, id, title) {
       getRefer({type: type, id: id}).then(res => {
-        if(type == 'LINKMAN_PARAM') {
-          this.linkOptions = res.rows
+        if(type == 'MK_SALESAREA_PARAM') {
+          this.salesAreaOptions = res.rows
         }
         if (type == 'CUSTOMER_PARAM_ZT') {
           this.customerOptions = res.rows
@@ -503,10 +522,10 @@ export default {
         if (type == 'CONTACTS_PARAM') {
           this.personOptions = res.rows
         }
-        if (type == 'DEPT_PARAM') {
-          this.deptOptions = res.rows
+        if (type == 'LINKMAN_PARAM') {
+          this.linkOptions = res.rows
         }
-        if (type == 'MK_SALESAREA_PARAM') {
+        if (type == 'DEPT_PARAM') {
           this.deptOptions = res.rows
         }
       })
@@ -539,7 +558,7 @@ export default {
         this.basicForm.chargerName = selection[0].name
       }
       if(this.referCondition.type == 'MK_SALESAREA_PARAM') {
-        this.personOptions = selection
+        this.salesAreaOptions = selection
         this.basicForm.marketingArea = selection[0].id
         this.basicForm.marketingAreaName = selection[0].name
       }
@@ -560,16 +579,30 @@ export default {
       return date;
     },
     //获取下周七天日期,day表示想要星期几
-    getWeek(day) {
+    getNextWeek(day) {
       const week = [];
       for (let i = 0; i < 7; i++) {
         let Stamp = new Date();
-        let num = 7-Stamp.getDay() + 1 + i;
+        let num = 7 - Stamp.getDay() + 1 + i;
         Stamp.setDate(Stamp.getDate() + num);
         week[i] = Stamp.getFullYear() + '-' + (Stamp.getMonth() + 1) + '-' + Stamp.getDate();
       }
       return week[day - 1];
-    }
+    },
+    //新增时默认带出num条明细行
+    defaultDetailLine(num) {
+      for (let i = 0; i < num; i++) {
+        this.addLine(this.getNextWeek(i + 1));
+      }
+      this.isFlag = true;
+    },
+    //必选标识
+    addRedStar(h, { column }) {
+      return [
+        h('span', { style: 'color: #F56C6C' }, '*'),
+        h('span', ' ' + column.label)
+      ];
+    },
   }
 }
 
@@ -585,7 +618,7 @@ export default {
 .btn_grooup {
   margin-bottom: 10px;
   display: flex;
-  justify-content: flex-end;
+  justify-content: space-between;
 }
 .hang {
   margin: auto;

+ 45 - 34
src/views/business/spd/task_management/visitingPlan/index.vue

@@ -172,6 +172,8 @@
         max-height="550"
         style="font-size: 12px;"
         @selection-change="handleSelectionChange"
+        :row-class-name="tableRowClassName"
+        @row-dblclick="getEmpDetail"
         >
           <el-table-column type="selection" align="center" min-width="55" />
           <el-table-column type="index" label="序号" min-width="50" align="center"/>
@@ -192,7 +194,7 @@
               <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
               <el-button type="text" size="mini" v-if="scope.row.state == '0'" @click="edit(scope.row)">编辑</el-button>
               <el-button type="text" size="mini" v-if="scope.row.state == '0'" @click="commit(scope.row)">提交</el-button>
-              <el-button type="text" size="mini" @click="deleteids(scope.row)">删除</el-button>
+              <el-button type="text" size="mini" v-if="scope.row.state == '0'" @click="deleteids(scope.row)">删除</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -202,7 +204,7 @@
         @size-change="handleSizeChange"
         @current-change="handleCurrentChange"
         :current-page="queryParams.pageNum"
-        :page-sizes="[10, 15, 20]"
+        :page-sizes="[100, 150, 200]"
         :page-size="100"
         layout="total, sizes, prev, pager, next, jumper"
         :total=total>
@@ -356,38 +358,38 @@ export default {
       this.ids = selection.map(item => item.id)
       console.log('选中数组', this.ids.join())
     },
-    mbDownload() {
-      downLoadDemand(this.download).then(res => {
-        console.log('下载的文件流', res)
-        const blob = new Blob([res], {
-          type: "application/vnd.ms-excel;charset=UTF-8",
-        });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
-        const downloadElement = document.createElement("a"); //创建a标签
-        const href = window.URL.createObjectURL(blob); // 创建下载的链接
-        // var temp = res.headers["content-disposition"]; 
-        // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
-        // var name = fileName.split(";")[0]; //切割成文件名
-        downloadElement.href = href;  //下载地址
-        downloadElement.download = '模板'; // 下载后文件名
-        document.body.appendChild(downloadElement);
-        downloadElement.click(); // 点击下载
-        document.body.removeChild(downloadElement); // 下载完成移除元素
-        window.URL.revokeObjectURL(href); // 释放blob对象
-        this.download.open = false
-      })
-    },
-    // 关闭模板下载弹窗清空参数
-    clearDownload() {
-      // 模板下载参数
-      this.download =  {
-        open: false,
-        customer: '',
-        warehouse: '',
-        warehouseId: '',
-        cargoSpace: '',
-        category: ''
-      }
-    },
+    // mbDownload() {
+    //   downLoadDemand(this.download).then(res => {
+    //     console.log('下载的文件流', res)
+    //     const blob = new Blob([res], {
+    //       type: "application/vnd.ms-excel;charset=UTF-8",
+    //     });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
+    //     const downloadElement = document.createElement("a"); //创建a标签
+    //     const href = window.URL.createObjectURL(blob); // 创建下载的链接
+    //     // var temp = res.headers["content-disposition"]; 
+    //     // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
+    //     // var name = fileName.split(";")[0]; //切割成文件名
+    //     downloadElement.href = href;  //下载地址
+    //     downloadElement.download = '模板'; // 下载后文件名
+    //     document.body.appendChild(downloadElement);
+    //     downloadElement.click(); // 点击下载
+    //     document.body.removeChild(downloadElement); // 下载完成移除元素
+    //     window.URL.revokeObjectURL(href); // 释放blob对象
+    //     this.download.open = false
+    //   })
+    // },
+    // // 关闭模板下载弹窗清空参数
+    // clearDownload() {
+    //   // 模板下载参数
+    //   this.download =  {
+    //     open: false,
+    //     customer: '',
+    //     warehouse: '',
+    //     warehouseId: '',
+    //     cargoSpace: '',
+    //     category: ''
+    //   }
+    // },
     handleCommand(command) {
       // alert(command)
       if(command == '模板下载') {
@@ -580,6 +582,15 @@ export default {
       this.classOptions.push(selection)
       this.download.category = selection.code
     },
+    tableRowClassName({ row, rowIndex }) {
+      row.index = rowIndex;
+    },
+    getEmpDetail(row, event, column) {
+      let index = row.index;
+      console.log(index) //此时的index就是单选行的下标
+      this.check(row)
+      //this.index = row.index;  也可以直接在data()定义一个值来存放下标
+    },
   }
 }
 </script>

+ 8 - 7
src/views/purchase/DemandSummary/index.vue

@@ -22,7 +22,7 @@
             <el-col :span="1.5">
               <el-form-item label="品类">
                 <el-select
-                v-model="queryParams.materialClassifyFourName"
+                v-model="queryParams.materialClassifyFour"
                 size="mini"
                 clearable
                 @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
@@ -45,8 +45,8 @@
             <!-- <el-col :span="1.5"> -->
               <!-- <el-form-item label="" label-width="20px"> -->
                 <div style="position: absolute;top: 3px;right: 10px;">
-                  <el-button type="primary" size="mini" icon="el-icon-search" @click="search">搜索</el-button>
-                  <el-button size="mini" icon="el-icon-refresh" plain @click="reset">重置</el-button>
+                  <el-button type="primary" size="mini" @click="search">搜索</el-button>
+                  <el-button size="mini" plain @click="reset">重置</el-button>
                 </div>
               <!-- </el-form-item> -->
             <!-- </el-col> -->
@@ -343,7 +343,7 @@
 
     <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
 
-    <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="true" />
+    <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="false" />
   </div>
 </template>
 
@@ -430,7 +430,7 @@ export default {
         rowStatus: ['1'],
         buyer: '',
         buyerName: '',
-        materialClassifyFourName: '',
+        materialClassifyFour: '',
         manufacturer: '',
         forecastClassification: '',
         periodUnit: '',
@@ -528,7 +528,7 @@ export default {
         rowStatus: ['1'],
         buyer: '',
         buyerName: '',
-        materialClassifyFourName: '',
+        materialClassifyFour: '',
         manufacturer: '',
         forecastClassification: '',
         periodUnit: '',
@@ -774,13 +774,14 @@ export default {
     },
     selectionsToInput2(selection) {
       this.classOptions.push(selection)
-      this.queryParams.materialClassifyFourName = selection.name
+      this.queryParams.materialClassifyFour = selection.name
     },
     // 搜索区物料编码
     chooseMaterial() {
       this.$refs.materialRefer.init()
     },
     selectMaterial(selection) {
+      console.log('选择的物料', selection)
       this.queryParams.materialCode = selection[0].code
       this.queryParams.names = selection[0].name
     },

+ 2 - 2
src/views/purchase/MaterialClassDivision/index.vue

@@ -47,8 +47,8 @@
           <!-- <el-col :span="1.5"> -->
             <!-- <el-form-item label="" label-width="20px"> -->
             <div style="position: absolute;top: 3px;right: 10px;">
-              <el-button type="primary" size="mini" icon="el-icon-search" @click="searchList">搜索</el-button>
-              <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
+              <el-button type="primary" size="mini" @click="searchList">搜索</el-button>
+              <el-button size="mini" plain @click="resetList">重置</el-button>
             </div>
             <!-- </el-form-item> -->
           <!-- </el-col> -->

+ 112 - 25
src/views/purchase/PurchaseDemandList/add.vue

@@ -71,7 +71,7 @@
           <el-form-item label="制单日期" prop="createTime">
             <el-date-picker
               v-model="basicForm.createTime"
-              :disabled="sonDisable"
+              disabled
               clearable
               type="date"
               value-format="yyyy-MM-dd"
@@ -103,14 +103,14 @@
           </el-form-item>
         </el-col>
 
-        <el-col :span="1.5">
+        <!-- <el-col :span="1.5">
           <el-form-item label="需求客户名称">
             <el-input disabled v-model="basicForm.customerName" size="mini" style="width: 200px"></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
 
         <el-col :span="1.5">
-          <el-form-item label="编码">
+          <el-form-item label="需求单号">
             <el-input
               v-model="basicForm.code"
               size="mini"
@@ -188,7 +188,7 @@
         >
           <el-table-column show-overflow-tooltip type="selection" :reserve-selection="true" fixed="left"/>
           <el-table-column show-overflow-tooltip label="序号" type="index" align="center" width="50px" fixed="left"/>
-          <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo">
+          <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo" fixed="left">
             <template slot-scope="scope">
               {{ scope.row.rowNo = scope.$index + 1 + "0" }}
             </template>
@@ -196,7 +196,7 @@
           <el-table-column show-overflow-tooltip label="默认采购组织" align="center"  prop="purOrgName" width="200px"/>
           <el-table-column show-overflow-tooltip label="需求客户" align="center"  prop="demandCustomerName" width="180px"/>
           <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" :formatter="hangStatus" width="100px"/>
-          <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="220px" :render-header="addRedStar">
+          <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="220px" :render-header="addRedStar" fixed="left">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'materialCode'" :show-message="false" :rules="{ required: true, message: '请选择物料编码', trigger: 'blur' }">
                 <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope, scope.$index)">
@@ -205,7 +205,7 @@
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column show-overflow-tooltip label="物料名称" align="center"  prop="materialName" width="200px" />
+          <el-table-column show-overflow-tooltip label="物料名称" align="center"  prop="materialName" width="200px" fixed="left"/>
           <el-table-column show-overflow-tooltip label="规格" align="center"  prop="specification" />
           <el-table-column show-overflow-tooltip label="型号" align="center"  prop="model"/>
           <el-table-column show-overflow-tooltip label="单位" align="center"  prop="unitName"/>
@@ -235,8 +235,8 @@
           <el-table-column show-overflow-tooltip label="收货仓库" align="center"  prop="deliveryWarehouseName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.$index, '选择收货仓库')" @focus="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')">
-                  <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')"></el-button>
+                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.$index, '选择收货仓库')">
+                  <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseCangKu(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库', scope.row.puOrg)"></el-button>
                 </el-input>
               </el-form-item>
             </template>
@@ -244,7 +244,7 @@
           <el-table-column show-overflow-tooltip label="收货货位" align="center"  prop="deliveryAllocationName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clearHang(scope.$index, '选择收货货位')" @focus="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)">
+                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clearHang(scope.$index, '选择收货货位')">
                   <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
                 </el-input>
               </el-form-item>
@@ -327,7 +327,7 @@
           <el-table-column show-overflow-tooltip label="补单供应商" align="center"  prop="additionalSupplierName" width="200px" :render-header="anotherRedStar">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplierName'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
-                <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
+                <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.$index, '选择补单供应商')" @paste.native="pasteMe($event, scope, scope.$index)">
                   <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
                 </el-input>
               </el-form-item>
@@ -362,7 +362,7 @@
           <el-table-column show-overflow-tooltip label="收货地址" align="center"  prop="deliveryAddressName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.$index, '选择收货地址')" @focus="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')">
+                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.$index, '选择收货地址')" @paste.native="pasteMe($event, scope, scope.$index)">
                   <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
                 </el-input>
               </el-form-item>
@@ -426,7 +426,7 @@
       <div class="btn_group">
         <el-button type="primary" size="mini"  @click="jumpOA" v-if="sonPageStu == 'check' && (row.status == '1' || row.status == '2') && basicForm.flowId">审批</el-button>
         <el-button type="primary" size="mini"  @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
-        <el-button type="primary" size="mini"  @click="editPage" v-if="sonPageStu == 'check'">编辑</el-button>
+        <el-button type="primary" size="mini"  @click="editPage" v-if="sonPageStu == 'check' && row.status == '0'">编辑</el-button>
         <el-button type="primary" size="mini"  @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
         <el-button type="primary" size="mini"  @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
         <el-button size="mini" plain @click="back">返回</el-button>
@@ -484,7 +484,7 @@
       <el-row style="margin-bottom: 10px;">
         <el-col :span="6" class="pltzTxt">收货地址</el-col>
         <el-col :span="14">
-          <el-input class="pltzIpt" clearable size="mini" v-model="adjust.deliveryAddressName" @focus="chooseOrg('ADDRESS_PARAM', true, '收货地址')">
+          <el-input class="pltzIpt" clearable size="mini" v-model="adjust.deliveryAddressName">
             <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"></el-button>
           </el-input>
         </el-col>
@@ -899,7 +899,7 @@ export default {
     },
     handleData() {
       console.log('222')
-      // 复制新增把id,编码,创建人置为空,子表去掉id
+      // 复制新增把id,需求单号,创建人置为空,子表去掉id
       this.basicForm.id = ''
       this.basicForm.code = ''
       this.basicForm.createBy = ''
@@ -1213,7 +1213,7 @@ export default {
       })
 
       if (rows.length < 100) {
-
+        // 粘贴物料编码
         if(scope.column.property == 'materialCode') {
           await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
             this.$modal.closeLoading();
@@ -1265,7 +1265,7 @@ export default {
           }).catch(err => {
             this.$modal.closeLoading();
           })
-
+        // 粘贴实际业务需求量
         }else if(scope.column.property == 'qty') {
           console.log('复制内容:', rows)
           let newLine = []
@@ -1285,17 +1285,91 @@ export default {
             this.$refs.table.doLayout()
             this.$modal.closeLoading();
           } else {
-            this.basicForm.puDemandItemList.forEach(item => {
-              for (let i = 0; i<rows.length; i++) {
-                item.qty = rows[i]
-              }
-            })
+            for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
+              this.basicForm.puDemandItemList[i].qty = rows[j]
+            }
             this.$refs.table.doLayout()
             this.$modal.closeLoading();
           }
+        // 粘贴补单供应商
+        }else if(scope.column.property == 'additionalSupplierName') {
+          await getRefer({ type: 'SUPPLIER_PARAM', searchList: rows }).then(res => {
+            this.$modal.closeLoading();
+            if (res.code === 200) {
+              let rowList = res.rows
+              let newLine = []
+              for (let i = 0; i<rowList.length; i++) {
+                let line = {...this.sonModel}
+                line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
+                line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
+                line.demandCustomer = this.basicForm.customer
+                line.demandCustomerName = this.basicForm.customerName
+                line.additionalSupplier = rowList[i].id
+                line.additionalSupplierName = rowList[i].name
+                newLine.push(line)
+                console.log('临时数组', newLine)
+              }
+              if(this.basicForm.puDemandItemList.length <= 1) {
+                // 删除指定下标
+                this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
+                this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
+              } else {
+                for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
+                  this.basicForm.puDemandItemList[i].additionalSupplier = newLine[j].additionalSupplier
+                  this.basicForm.puDemandItemList[i].additionalSupplierName = newLine[j].additionalSupplierName
+                }
+                this.$refs.table.doLayout()
+                this.$modal.closeLoading();
+              }
+            }
+          }).then(() => {
+            this.$refs.table.doLayout()
+          }).catch(err => {
+            this.$modal.closeLoading();
+          })
+        }else if(scope.column.property == 'deliveryAddressName') {
+          await getRefer({ type: 'ADDRESS_PARAM', searchList: rows }).then(res => {
+           this.$modal.closeLoading();
+            if (res.code === 200) {
+              let rowList = res.rows
+              let newLine = []
+              for (let i = 0; i<rowList.length; i++) {
+                let line = {...this.sonModel}
+                line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
+                line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
+                line.demandCustomer = this.basicForm.customer
+                line.demandCustomerName = this.basicForm.customerName
+                line.deliveryAddressName = rowList[i].name
+                line.deliveryAddress = rowList[i].code
+                line.contacts = rowList[i].contactsName
+                line.contactsPhone = rowList[i].contactsPhone
+                line.address = rowList[i].address
+                newLine.push(line)
+                console.log('临时数组', newLine)
+              }
+              if(this.basicForm.puDemandItemList.length <= 1) {
+                // 删除指定下标
+                this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
+                this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
+              } else {
+                for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
+                  this.basicForm.puDemandItemList[i].deliveryAddressName = newLine[j].deliveryAddressName
+                  this.basicForm.puDemandItemList[i].deliveryAddress = newLine[j].deliveryAddress
+                  this.basicForm.puDemandItemList[i].contacts = newLine[j].contacts
+                  this.basicForm.puDemandItemList[i].contactsPhone = newLine[j].contactsPhone
+                  this.basicForm.puDemandItemList[i].address = newLine[j].address
+                }
+                this.$refs.table.doLayout()
+                this.$modal.closeLoading();
+              }
+            }
+          }).then(() => {
+            this.$refs.table.doLayout()
+          }).catch(err => {
+            this.$modal.closeLoading();
+          })
         }
 
-
       } else {
         this.$modal.notifyWarning("复制长度不能超过100!");
         this.$modal.closeLoading();
@@ -1430,7 +1504,7 @@ export default {
         // this.basicForm.puDemandItemList.splice(this.tableIndex,1)
       }
     },
-    // 明细行选择业务部门参照带出业务部门数据
+    // 明细行选择参照
     chooseDept(index, type, isPage, title) {
       this.tableIndex = index
       this.referCondition.type = type
@@ -1438,7 +1512,20 @@ export default {
       this.referCondition.title = title
       this.$refs.refer.init(this.referCondition)
     },
-    // 明细行选择业务部门参照带出业务部门数据
+    // 明细行选择仓库需要先确认采购组织
+    chooseCangKu(index, type, isPage, title, pkOrg) {
+      this.tableIndex = index
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      if(pkOrg) {
+        this.referCondition.pkOrg = pkOrg
+        this.$refs.refer.init(this.referCondition)
+      } else {
+        this.$modal.notifyWarning("请先确认默认采购组织");
+      }
+    },
+    // 明细行选择货位先确认仓库
     choosehuoWei(index, type, isPage, title, stordocId) {
       this.tableIndex = index
       this.referCondition.type = type

+ 4 - 4
src/views/purchase/PurchaseDemandList/index.vue

@@ -5,7 +5,7 @@
         <el-form class="search_area" label-width="100px">
           <el-row :gutter="10">
             <el-col :span="1.5">
-              <el-form-item label="单据编码">
+              <el-form-item label="需求单号">
                 <el-input
                   v-model.trim="queryParams.code"
                   size="mini"
@@ -43,8 +43,8 @@
             <!-- <el-col :span="1.5"> -->
               <!-- <el-form-item label="" label-width="20px"> -->
                 <div style="position: absolute;top: 3px;right: 10px;">
-                  <el-button type="primary" size="mini" icon="el-icon-search" @click="searchList">搜索</el-button>
-                  <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
+                  <el-button type="primary" size="mini" @click="searchList">搜索</el-button>
+                  <el-button size="mini" plain @click="resetList">重置</el-button>
                 </div>
               <!-- </el-form-item> -->
             <!-- </el-col> -->
@@ -177,7 +177,7 @@
         >
           <el-table-column show-overflow-tooltip type="selection" width="55" fixed="left"/>
           <el-table-column show-overflow-tooltip label="序号" type="index" align="center" width="50px" fixed="left"/>
-          <el-table-column show-overflow-tooltip label="编码" align="center" width="170" prop="code"/>
+          <el-table-column show-overflow-tooltip label="需求单号" align="center" width="170" prop="code"/>
           <el-table-column show-overflow-tooltip label="需求日期" align="center" width="120" prop="demandDate"/>
           <el-table-column show-overflow-tooltip label="审批结束日期" align="center" width="120" prop="approverFinishTime"/>
           <el-table-column show-overflow-tooltip label="单据状态" align="center" prop="satus" :formatter="formatterStatus"/>

+ 1 - 2
src/views/purchase/apply/index.vue

@@ -103,8 +103,7 @@ export default {
     ></el-super-search>
     <el-row class="my-4" style="text-align: right">
       <el-button-group>
-        <add-button :size="size" :dict="dict" @success="useQuery(params, page)">
-        </add-button>
+        <add-button :size="size" :dict="dict" @success="useQuery(params, page)"></add-button>
         <copy-button
           :size="size"
           :dict="dict"

+ 2 - 2
src/views/purchase/deliveryAddress/index.vue

@@ -42,8 +42,8 @@
           <!-- <el-col :span="1.5"> -->
             <!-- <el-form-item label="" label-width="20px"> -->
             <div style="position: absolute;top: 3px;right: 10px;">
-              <el-button type="primary" size="mini" icon="el-icon-search" @click="searchList">搜索</el-button>
-              <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
+              <el-button type="primary" size="mini" @click="searchList">搜索</el-button>
+              <el-button size="mini" plain @click="resetList">重置</el-button>
             </div>
             <!-- </el-form-item> -->
           <!-- </el-col> -->

+ 6 - 6
src/views/purchase/transferOrder/add.vue

@@ -1353,7 +1353,7 @@
           size="mini"
           plain
           @click="editPage"
-          v-if="sonPageStu == 'check'"
+          v-if="sonPageStu == 'check' && row.status == '0'"
           >编辑</el-button
         >
         <el-button
@@ -1902,11 +1902,11 @@ export default {
       }
     },
 
-    chooseRefer(type, isPage, title, drpOrg, isDirectStore, gubFlag) {
+    chooseRefer(type, isPage, title, pkOrg, isDirectStore, gubFlag) {
       this.referCondition.type = type;
       this.referCondition.isPage = isPage;
       this.referCondition.title = title;
-      this.referCondition.drpOrg = drpOrg;
+      this.referCondition.pkOrg = pkOrg;
       this.referCondition.isDirectStore = isDirectStore;
       this.referCondition.gubFlag = gubFlag;
       this.$refs.refer.init(this.referCondition);
@@ -2105,17 +2105,17 @@ export default {
       this.referCondition.type = type;
       this.referCondition.isPage = isPage;
       this.referCondition.title = title;
-      this.referCondition.drpOrg = "";
+      this.referCondition.pkOrg = "";
       this.referCondition.stordocId = stordocId;
       this.$refs.refer.init(this.referCondition);
     },
     // 明细行选择调入部门
-    chooseMxBM(index, type, isPage, title, drpOrg) {
+    chooseMxBM(index, type, isPage, title, pkOrg) {
       this.tableIndex = index;
       this.referCondition.type = type;
       this.referCondition.isPage = isPage;
       this.referCondition.title = title;
-      this.referCondition.drpOrg = drpOrg;
+      this.referCondition.pkOrg = pkOrg;
       this.$refs.refer.init(this.referCondition);
     },
     // 选择框彻底清空

+ 2 - 2
src/views/purchase/transferOrder/index.vue

@@ -39,8 +39,8 @@
               </el-form-item>
             </el-col>
             <div style="position: absolute;top: 3px;right: 10px;">
-              <el-button type="primary" size="mini" icon="el-icon-search" @click="searchList">搜索</el-button>
-              <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
+              <el-button type="primary" size="mini" @click="searchList">搜索</el-button>
+              <el-button size="mini" plain @click="resetList">重置</el-button>
             </div>
           </el-row>
 

+ 2 - 1
vue.config.js

@@ -47,7 +47,8 @@ module.exports = {
         // target: `http://172.16.13.113:8000/drp-admin`, //DWT本地
         // target: `http://172.16.13.21:8000/drp-admin`, //CKF本地
         // target: `http://172.16.13.43:8000/drp-admin`, //lz's localhost
-        //  target: `http://127.0.0.1:8000/drp-admin`,
+        // target: `http://172.16.63.52:8000/drp-admin`, //董卓
+         // target: `http://127.0.0.1:8000/drp-admin`,
         changeOrigin: true,
         pathRewrite: {
           ["^" + process.env.VUE_APP_BASE_API]: "",