Browse Source

Merge branch 'dev' into 'purchaseDev'

Dev

See merge request new-business/drp-web!393
黄梓星 1 year ago
parent
commit
e2ed64001d
1 changed files with 31 additions and 19 deletions
  1. 31 19
      src/views/business/spd/task_management/visitingPlan/add.vue

+ 31 - 19
src/views/business/spd/task_management/visitingPlan/add.vue

@@ -64,7 +64,7 @@
                 :disabled="sonDisable"
                 clearable
                 type="date"
-                value-format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd 00:00:00"
                 :picker-options="pickerOptionsStart"
                 size="mini"
                 style="width: 200px"
@@ -81,7 +81,7 @@
                 :disabled="sonDisable"
                 clearable
                 type="date"
-                value-format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd 00:00:00"
                 :picker-options="pickerOptionsEnd"
                 size="mini"
                 style="width: 200px"
@@ -145,7 +145,7 @@
                   clearable
                   type="date"
                   size="mini"
-                  value-format="yyyy-MM-dd"
+                  value-format="yyyy-MM-dd 00:00:00"
                   :picker-options="pickerOptions"
 
                   placeholder="选择日期"
@@ -329,8 +329,13 @@ export default {
     } else if (this.pageStu == 'edit') {
       this.getDetails(this.row)
     } else if (this.pageStu == 'add') {
-    //新增时默认带出7条明细行
-    this.defaultDetailLine(7)
+      //新增时默认带出7条明细行
+      this.defaultDetailLine(7)
+      this.basicForm.startDate = this.basicForm.startDate + ' 00:00:00'
+      this.basicForm.deadlineTime = this.basicForm.deadlineTime + ' 00:00:00'
+      this.basicForm.mkBoPlanItemList.forEach(item => {
+        item.date = item.date + ' 00:00:00'
+      })
     }
   },
   methods:{
@@ -342,6 +347,8 @@ export default {
       // this.getDetails(this.row)
       this.basicForm.id = ''
       this.basicForm.planCode = ''
+      this.basicForm.createBy = null
+      this.basicForm.createByName = null
       this.basicForm.state = 0
       //复制之后执行人和部门变为当前账号所有者
       this.basicForm.charger = this.$store.state.user.id,
@@ -377,7 +384,16 @@ export default {
         if (res.code === 200) {
           // console.log('res', res)
           this.basicForm = res.data
+          this.basicForm.startDate = this.basicForm.startDate + ' 00:00:00'
+          this.basicForm.deadlineTime = this.basicForm.deadlineTime + ' 00:00:00'
+          this.basicForm.mkBoPlanItemList.forEach(item => {
+            item.date = item.date + ' 00:00:00'
+          })
         }
+      }).then(() => {
+        this.loading = false
+      }).catch(err => {
+        this.loading = false
       })
     },
     async save() {
@@ -433,7 +449,8 @@ export default {
     },
     //拜访计划名称赋值
     planNameAssignment() {
-      this.basicForm.planName = this.basicForm.chargerName + '-' + '周计划拜访' + '(' + this.basicForm.startDate.substr(5) + '至' + this.basicForm.deadlineTime.substr(5) + ')'
+      console.log(this.basicForm.startDate.substr(5, 5))
+      this.basicForm.planName = this.basicForm.chargerName + '-' + '周计划拜访' + '(' + this.basicForm.startDate.substr(5, 5) + '至' + this.basicForm.deadlineTime.substr(5, 5) + ')'
     },
     // 增行
     addLine(date) {
@@ -494,10 +511,12 @@ export default {
       this.isFlag = true;
       this.sonPageStu = 'edit'
       this.sonDisable = false
+      this.basicForm.startDate = this.basicForm.startDate + ' 00:00:00'
+      this.basicForm.deadlineTime = this.basicForm.deadlineTime + ' 00:00:00'
       this.basicForm.mkBoPlanItemList.forEach(item => {
         item.planCode = this.basicForm.planCode
+        item.date = item.date + ' 00:00:00'
       })
-      console.log(this.basicForm.startDate)
     },
     back() {
       this.$emit('jugislist', true)
@@ -507,17 +526,6 @@ export default {
       // }
       this.$emit('refresh')
     },
-    // 如果需要回显则调用详情接口
-    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) {
       console.log('选中', selection)
       this.ids = selection.map(item => item.id)
@@ -668,7 +676,11 @@ 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();
+        let Mmonth = Stamp.getMonth() + 1;
+        let MMmonth = Mmonth < 10 ? '0' + Mmonth : Mmonth;
+        let ddate = Stamp.getDate();
+        let dddate = ddate < 10 ? '0' + ddate : ddate;
+        week[i] = Stamp.getFullYear() + '-' + MMmonth + '-' + dddate;
       }
       return week[day - 1];
     },