瀏覽代碼

Merge branch 'historical_route' into 'dev'

小优化。

See merge request new-business/drp-web!371
黄梓星 1 年之前
父節點
當前提交
0b7640e3f0

+ 56 - 47
src/views/business/spd/task_management/visitingPlan/add.vue

@@ -16,11 +16,11 @@
           </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">
               <el-input
                 v-model.trim="basicForm.planName"
                 size="mini"
-                :readonly="sonDisable"
+                disabled
                 clearable
                 style="width: 200px"
               />
@@ -64,7 +64,7 @@
                 :disabled="sonDisable"
                 clearable
                 type="date"
-                value-format="yyyy-MM-dd HH:mm:ss"
+                value-format="yyyy-MM-dd"
                 :picker-options="pickerOptionsStart"
                 size="mini"
                 style="width: 200px"
@@ -81,7 +81,7 @@
                 :disabled="sonDisable"
                 clearable
                 type="date"
-                value-format="yyyy-MM-dd HH:mm:ss"
+                value-format="yyyy-MM-dd"
                 :picker-options="pickerOptionsEnd"
                 size="mini"
                 style="width: 200px"
@@ -145,7 +145,7 @@
                   clearable
                   type="date"
                   size="mini"
-                  value-format="yyyy-MM-dd HH:mm:ss"
+                  value-format="yyyy-MM-dd"
                   :picker-options="pickerOptions"
 
                   placeholder="选择日期"
@@ -158,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="chooseCustomer(scope.$index, 'CUSTOMER_PARAM_ZT', true, '请选择客户', {charger: basicForm.charger})" @clear="clearHang(scope.$index, '请选择客户')" style="width: 200px">
+                <el-select clearable size="mini" v-model="scope.row.customerName" :disabled="sonDisable" @focus="chooseSon(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>
@@ -168,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="chooseLinkMan(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="chooseSon(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>
@@ -229,9 +229,6 @@
       <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-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" style="margin: 0 10px;">
         <el-button size="mini" plain @click="back">返回</el-button>
       </el-col>
@@ -302,7 +299,7 @@ export default {
       //定义主表开始时间的范围不能早于今天
       pickerOptionsStart: {
         disabledDate: (time) => {
-          return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000
+          return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000 || time.getTime() > (new Date(this.basicForm.deadlineTime)).getTime()
         }
       },
       //定义主表截止时间的范围不能早于开始时间
@@ -325,7 +322,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)
@@ -345,8 +342,7 @@ export default {
       // this.getDetails(this.row)
       this.basicForm.id = ''
       this.basicForm.planCode = ''
-      this.basicForm.createBy = ''
-      this.basicForm.createTime = ''
+      this.basicForm.state = 0
       //复制之后执行人和部门变为当前账号所有者
       this.basicForm.charger = this.$store.state.user.id,
       this.basicForm.chargerName = this.$store.state.user.nickName
@@ -364,7 +360,6 @@ export default {
       // 复制新增把id,编码,创建人置为空,子表去掉id
       this.basicForm.id = ''
       this.basicForm.planCode = ''
-      this.basicForm.createBy = ''
       if (this.basicForm.mkBoPlanItemList.length !== 0) {
         this.basicForm.mkBoPlanItemList.forEach(item => {
           if (item.id) {
@@ -391,6 +386,7 @@ export default {
           if(valid) {
             this.$modal.loading("保存中...");
             if(this.sonPageStu == 'add') {
+              this.planNameAssignment();
               this.handleData()
               addPlan(this.basicForm).then(res => {
                 console.log(333)
@@ -403,6 +399,7 @@ export default {
                 this.$modal.closeLoading();
               })
             } else if (this.sonPageStu == 'edit') {
+              this.planNameAssignment();
               let list = []
               list.push(...this.basicForm.mkBoPlanItemList, ...this.delPlanItemList)
               // 深拷贝一下参数对象
@@ -434,15 +431,19 @@ export default {
         this.$modal.msgWarning("明细信息不能为空!");
       }
     },
+    //拜访计划名称赋值
+    planNameAssignment() {
+      this.basicForm.planName = this.basicForm.chargerName + '-' + '周计划拜访' + '(' + this.basicForm.startDate.substr(5) + '至' + this.basicForm.deadlineTime.substr(5) + ')'
+    },
     // 增行
     addLine(date) {
-      if (this.isFlag) {
-        date = this.getCurrentTime();
+      if ((this.sonPageStu == 'edit') || (this.isFlag && this.sonPageStu == 'add')) {
+        date = this.basicForm.startDate;
       }
       const newLine = {
         id: null,
-        planId: null,
-        planCode: null,
+        planId: this.basicForm.id,
+        planCode: this.basicForm.planCode,
         date: date,
         customer: null,
         customerName: null,
@@ -496,6 +497,7 @@ export default {
       this.basicForm.mkBoPlanItemList.forEach(item => {
         item.planCode = this.basicForm.planCode
       })
+      console.log(this.basicForm.startDate)
     },
     back() {
       this.$emit('jugislist', true)
@@ -557,33 +559,27 @@ export default {
       this.referCondition.type = type
       this.referCondition.isPage = isPage
       this.referCondition.title = title
-      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("请先确认客户");
+      if (title == "请选择客户") {
+        if(parame.charger) {
+          this.referCondition.parame = parame
+          this.$refs.refer.init(this.referCondition)
+        } else {
+          this.$modal.notifyWarning("请先确认执行人");
+        }
+      } else if (title == "请选择联系人") {
+        if(parame.customer) {
+          this.referCondition.parame = parame
+          this.$refs.refer.init(this.referCondition)
+        } else {
+          this.$modal.notifyWarning("请先确认客户");
+        }
+      } else if (title == "请选择商机") {
+        if(parame.customer) {
+          this.referCondition.parame = parame
+          this.$refs.refer.init(this.referCondition)
+        } else {
+          this.$modal.notifyWarning("请先确认客户");
+        }
       }
     },
     //联动清除明细行里其它的字段
@@ -591,7 +587,20 @@ export default {
       if (title == '请选择执行人') {
         this.basicForm.dept = null
         this.basicForm.deptName = null
+        this.basicForm.mkBoPlanItemList.forEach(item => {
+        item.customer = null
+        item.customerName = null
+        item.contact = null
+        item.contactName = null
+        item.bo = null
+        item.boName = null
+      })
       }
+      // if (title == '请选择开始时间' || title == '请选择截止时间') {
+      //   this.basicForm.mkBoPlanItemList.forEach(item => {
+      //     item.date = null
+      //   })
+      // }
       if (title == '请选择客户') {
         this.basicForm.mkBoPlanItemList[index].contact = null
         this.basicForm.mkBoPlanItemList[index].contactName = null
@@ -659,7 +668,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() + ' ' + '00:00:00';
+        week[i] = Stamp.getFullYear() + '-' + (Stamp.getMonth() + 1) + '-' + Stamp.getDate();
       }
       return week[day - 1];
     },

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

@@ -178,7 +178,7 @@
           <el-table-column type="selection" align="center" min-width="55" />
           <el-table-column type="index" label="序号" min-width="50" align="center"/>
           <el-table-column show-overflow-tooltip label="计划编码" align="center" min-width="200" prop="planCode"/>
-          <el-table-column show-overflow-tooltip label="计划名称" align="center" min-width="150" prop="planName"/>
+          <el-table-column show-overflow-tooltip label="计划名称" align="center" min-width="200" prop="planName"/>
           <el-table-column show-overflow-tooltip label="执行人" align="center" min-width="150" prop="chargerName"/>
           <el-table-column show-overflow-tooltip label="部门" align="center" min-width="150" prop="deptName"/>
           <el-table-column show-overflow-tooltip label="开始时间" align="center" min-width="120" prop="startDate" />
@@ -204,8 +204,8 @@
         @size-change="handleSizeChange"
         @current-change="handleCurrentChange"
         :current-page="queryParams.pageNum"
-        :page-sizes="[100, 150, 200]"
-        :page-size="100"
+        :page-sizes="[10, 20, 50, 100]"
+        :page-size="10"
         layout="total, sizes, prev, pager, next, jumper"
         :total=total>
         </el-pagination>