Преглед изворни кода

Merge branch 'historical_route' into 'dev'

Historical route

See merge request new-business/drp-web!349
黄梓星 пре 1 година
родитељ
комит
9cc3ccd950

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

@@ -28,7 +28,7 @@ export function editPlan(data) {
 export function submitPlan(data) {
     return request({
       url: `/mk/bo/plan/submit`,
-      method: 'POST',
+      method: 'post',
       data: data
     })
 }

+ 97 - 42
src/views/business/spd/task_management/visitingPlan/add.vue

@@ -29,7 +29,7 @@
 
          <el-col :span="1.5">
             <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-select clearable size="mini" :disabled="sonDisable" v-model="basicForm.type" 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>
               </el-select>
@@ -38,15 +38,15 @@
 
           <el-col :span="1.5">
             <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>
+              <el-select clearable size="mini" v-model="basicForm.chargerName" :disabled="sonDisable" @focus="choose('CONTACTS_PARAM', true, '请选择执行人')" @clear="clearHang({}, '请选择执行人')" style="width: 200px">
+                <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code"/>
+              </el-select>
             </el-form-item>
           </el-col>
 
           <el-col :span="1.5">
             <el-form-item label="确认状态" prop="state">
-              <el-select disabled v-model="basicForm.state" size="mini" style="width: 200px">
+              <el-select disabled size="mini" v-model="basicForm.state" style="width: 200px">
                 <el-option v-for="dict in dict.type.mk_plan_state" :key="dict.value" :label="dict.label" :value="dict.value">
                 </el-option>
               </el-select>
@@ -64,9 +64,11 @@
                 :disabled="sonDisable"
                 clearable
                 type="date"
-                value-format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                :picker-options="pickerOptionsStart"
                 size="mini"
                 style="width: 200px"
+                placeholder="选择开始时间"
               >
               </el-date-picker>
             </el-form-item>
@@ -79,9 +81,11 @@
                 :disabled="sonDisable"
                 clearable
                 type="date"
-                value-format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                :picker-options="pickerOptionsEnd"
                 size="mini"
                 style="width: 200px"
+                placeholder="选择截止时间"
               >
               </el-date-picker>
             </el-form-item>
@@ -89,7 +93,7 @@
 
          <el-col :span="1.5">
             <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-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"
                   :key="item.id"
@@ -104,10 +108,7 @@
             <el-form-item label="部门" prop="deptName">
               <el-select clearable v-model="basicForm.deptName" size="mini" :disabled="sonDisable" @focus="choose('DEPT_PARAM', true, '部门')" style="width: 200px">
                 <el-option
-                  v-for="item in deptOptions"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.code">
+                  v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.code">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -144,7 +145,9 @@
                   clearable
                   type="date"
                   size="mini"
-                  value-format="yyyy-MM-dd"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                  :picker-options="pickerOptions"
+
                   placeholder="选择日期"
                 >
                 </el-date-picker>
@@ -155,7 +158,7 @@
           <el-table-column show-overflow-tooltip label="客户" prop="customerName" min-width="230" :render-header="addRedStar">
             <template slot-scope="scope">
               <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, '客户', {charger: basicForm.charger})" style="width: 200px">
+                <el-select clearable size="mini" v-model="scope.row.customerName" :disabled="sonDisable" @focus="chooseCustomer(scope.$index, 'CUSTOMER_PARAM_ZT', true, '请选择客户', {charger: basicForm.charger})" @clear="clearHang(scope.$index, '请选择客户')" style="width: 200px">
                   <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
               </el-form-item>
@@ -165,7 +168,7 @@
           <el-table-column show-overflow-tooltip label="联系人" prop="contactName" min-width="230" :render-header="addRedStar">
             <template slot-scope="scope">
               <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, charger: basicForm.charger})" style="width: 200px">
+                <el-select clearable size="mini" v-model="scope.row.contactName" :disabled="sonDisable" @focus="chooseLinkMan(scope.$index, 'LINKMAN_PARAM', true, '请选择联系人', {customer: scope.row.customer, charger: basicForm.charger})" style="width: 200px">
                   <el-option v-for="item in linkOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
               </el-form-item>
@@ -194,7 +197,7 @@
           <el-table-column show-overflow-tooltip label="商机" prop="boName" min-width="330">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'boName'">
-                <el-select clearable size="mini" v-model="scope.row.boName" :disabled="sonDisable" @focus="chooseSon(scope.$index, 'BO_PARAM', true, '商机', {charger: basicForm.charger, customer: scope.row.customer})" style="width: 300px">
+                <el-select clearable size="mini" v-model="scope.row.boName" :disabled="sonDisable" @focus="chooseSon(scope.$index, 'BO_PARAM', true, '请选择商机', {charger: basicForm.charger, customer: scope.row.customer})" @clear="clearHang(scope.$index, '请选择商机')" style="width: 300px">
                   <el-option v-for="item in boOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
               </el-form-item>
@@ -285,7 +288,7 @@ export default {
       referCondition: {
         type: '',
         isPage: true,
-        title: '',
+        title: ''
       },
       tableIndex: null,
       ids: [],
@@ -296,7 +299,25 @@ export default {
       deptOptions: [],
       customerOptions: [],
       salesAreaOptions: [],
-      //判断默认明细行带出完毕后日期等于当前日期的标识
+      //定义主表开始时间的范围不能早于今天
+      pickerOptionsStart: {
+        disabledDate: (time) => {
+          return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000
+        }
+      },
+      //定义主表截止时间的范围不能早于开始时间
+      pickerOptionsEnd: {
+        disabledDate: (time) => {
+          return time.getTime() < (new Date(this.basicForm.startDate)).getTime()
+        }
+      },
+      //定义子表日期的范围不能早于开始时间且不能晚于截止时间
+      pickerOptions: {
+        disabledDate: (time) => {
+          return time.getTime() < (new Date(this.basicForm.startDate)).getTime() || time.getTime() > (new Date(this.basicForm.deadlineTime)).getTime()
+        }
+      },
+      //判断默认明细行带出完毕后,增行日期等于当前日期的标识
       isFlag: false
     }
   },
@@ -304,7 +325,7 @@ export default {
   mounted() {},
   created() {
     //查看系统数据
-    console.log(this.$store.state.user, 'this.$store.state.user')
+    // console.log(this.$store.state.user, 'this.$store.state.user')
     if(this.pageStu == 'check') {
       console.log('数据', this.row)
       this.getDetails(this.row)
@@ -413,18 +434,6 @@ export default {
         this.$modal.msgWarning("明细信息不能为空!");
       }
     },
-    // 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(date) {
       if (this.isFlag) {
@@ -535,14 +544,14 @@ export default {
         }
       })
     },
-    // 基本信息选择参照带出数据
+    //公共基本信息选择参照带出数据
     choose(type, isPage, title) {
       this.referCondition.type = type
       this.referCondition.isPage = isPage
       this.referCondition.title = title
       this.$refs.refer.init(this.referCondition)
     },
-    // 明细行选择参照带出数据
+    //公共明细行选择参照带出数据
     chooseSon(index, type, isPage, title, parame) {
       this.tableIndex = index
       this.referCondition.type = type
@@ -551,34 +560,87 @@ export default {
       this.referCondition.parame = parame
       this.$refs.refer.init(this.referCondition)
     },
+    //客户明细行选择参照带出数据
+    chooseCustomer(index, type, isPage, title, parame) {
+      this.tableIndex = index
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      if(parame.charger) {
+        this.referCondition.parame = parame
+        this.$refs.refer.init(this.referCondition)
+      } else {
+        this.$modal.notifyWarning("请先确认执行人");
+      }
+    },
+    //联系人明细行选择参照带出数据
+    chooseLinkMan(index, type, isPage, title, parame) {
+      this.tableIndex = index
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      if(parame.customer) {
+        this.referCondition.parame = parame
+        this.$refs.refer.init(this.referCondition)
+      } else {
+        this.$modal.notifyWarning("请先确认客户");
+      }
+    },
+    //联动清除明细行里其它的字段
+    clearHang(index, title) {
+      if (title == '请选择执行人') {
+        this.basicForm.dept = null
+        this.basicForm.deptName = null
+      }
+      if (title == '请选择客户') {
+        this.basicForm.mkBoPlanItemList[index].contact = null
+        this.basicForm.mkBoPlanItemList[index].contactName = null
+        this.basicForm.mkBoPlanItemList[index].bo = null
+        this.basicForm.mkBoPlanItemList[index].boName = null
+      }
+      if (title == '请选择商机') {
+        this.basicForm.mkBoPlanItemList[index].customer = null
+        this.basicForm.mkBoPlanItemList[index].customerName = null
+        this.basicForm.mkBoPlanItemList[index].bo = null
+        this.basicForm.mkBoPlanItemList[index].boName = null
+      }
+    },
     selectionsToInput(selection) {
+      //执行人参照
       if(this.referCondition.type == 'CONTACTS_PARAM') {
         this.personOptions = selection
         this.basicForm.charger = selection[0].id
         this.basicForm.chargerName = selection[0].name
+        this.basicForm.dept = selection[0].deptId
+        this.basicForm.deptName = selection[0].deptName
       }
+      //销售区域参照
       if(this.referCondition.type == 'MK_SALESAREA_PARAM') {
         this.salesAreaOptions = selection
         this.basicForm.marketingArea = selection[0].id
         this.basicForm.marketingAreaName = selection[0].name
       }
+      //部门参照
       if(this.referCondition.type == 'DEPT_PARAM') {
         this.deptOptions = selection
         this.basicForm.dept = selection[0].id
         this.basicForm.deptName = selection[0].name
       }
+      //客户参照
       if(this.referCondition.type == 'CUSTOMER_PARAM_ZT') {
         this.customerOptions = selection
         this.basicForm.mkBoPlanItemList[this.tableIndex].customer = selection[0].id
         this.basicForm.mkBoPlanItemList[this.tableIndex].customerName = selection[0].name
       }
+      //联系人参照
       if(this.referCondition.type == 'LINKMAN_PARAM') {
         this.linkOptions = selection
         this.basicForm.mkBoPlanItemList[this.tableIndex].contact = selection[0].id
         this.basicForm.mkBoPlanItemList[this.tableIndex].contactName = selection[0].name
       }
+      //商机参照
       if(this.referCondition.type == 'BO_PARAM') {
-        this.linkOptions = selection
+        this.boOptions = selection
         this.basicForm.mkBoPlanItemList[this.tableIndex].bo = selection[0].id
         this.basicForm.mkBoPlanItemList[this.tableIndex].boName = selection[0].name
         this.basicForm.mkBoPlanItemList[this.tableIndex].customer = selection[0].customer
@@ -597,7 +659,7 @@ export default {
         let Stamp = new Date();
         let num = 7 - Stamp.getDay() + 1 + i;
         Stamp.setDate(Stamp.getDate() + num);
-        week[i] = Stamp.getFullYear() + '-' + (Stamp.getMonth() + 1) + '-' + Stamp.getDate();
+        week[i] = Stamp.getFullYear() + '-' + (Stamp.getMonth() + 1) + '-' + Stamp.getDate() + ' ' + '00:00:00';
       }
       return week[day - 1];
     },
@@ -638,11 +700,4 @@ export default {
 .hang ::v-deep .el-form-item__content{
   margin-left: 0px !important;
 }
-.el-table ::v-deep .el-form-item__error{
-  padding-top: 0;
-  top: 70%
-}
-.el-table ::v-deep .success-row {
-  background: #f11616;
-}
 </style>