DongZ 1 rok pred
rodič
commit
723b01d3e7

+ 562 - 559
src/views/business/spd/bo/plan/add.vue

@@ -5,41 +5,33 @@
       <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto">
         <el-row :gutter="10">
           <el-col :span="1.5">
-              <el-form-item label="计划编码">
-                <el-input
-                  v-model="basicForm.planCode"
-                  size="mini"
-                  disabled
-                  style="width: 200px"
-                />
-              </el-form-item>
+            <el-form-item label="计划编码">
+              <el-input v-model="basicForm.planCode" size="mini" disabled style="width: 200px" />
+            </el-form-item>
           </el-col>
 
           <el-col :span="1.5">
             <el-form-item label="计划名称" prop="planName">
-              <el-input
-                v-model.trim="basicForm.planName"
-                size="mini"
-                disabled
-                clearable
-                style="width: 200px"
-              />
+              <el-input v-model.trim="basicForm.planName" size="mini" disabled clearable style="width: 200px" />
             </el-form-item>
-         </el-col>
+          </el-col>
 
-         <el-col :span="1.5">
+          <el-col :span="1.5">
             <el-form-item label="线路类型" prop="type" :rules="{ required: true, message: '请选择线路类型', trigger: 'blur' }">
               <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 v-for="dict in dict.type.mk_plan_route_type" :key="dict.value" :label="dict.label"
+                  :value="dict.value">
                 </el-option>
               </el-select>
             </el-form-item>
           </el-col>
 
           <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, '请选择执行人')" @clear="clearHang({}, '请选择执行人')" style="width: 200px">
-                <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code"/>
+            <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, '请选择执行人')" @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>
@@ -47,7 +39,8 @@
           <el-col :span="1.5">
             <el-form-item label="确认状态" prop="state">
               <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 v-for="dict in dict.type.mk_plan_state" :key="dict.value" :label="dict.label"
+                  :value="dict.value">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -58,47 +51,31 @@
         <el-row :gutter="10">
 
           <el-col :span="1.5">
-            <el-form-item label="开始时间" prop="startDate" :rules="{ required: true, message: '请选择开始时间', trigger: 'blur' }">
-              <el-date-picker
-                v-model="basicForm.startDate"
-                :disabled="sonDisable"
-                clearable
-                type="date"
-                value-format="yyyy-MM-dd 00:00:00"
-                :picker-options="pickerOptionsStart"
-                size="mini"
-                style="width: 200px"
-                placeholder="选择开始时间"
-              >
+            <el-form-item label="开始时间" prop="startDate"
+              :rules="{ required: true, message: '请选择开始时间', trigger: 'blur' }">
+              <el-date-picker v-model="basicForm.startDate" :disabled="sonDisable" clearable type="date"
+                value-format="yyyy-MM-dd 00:00:00" :picker-options="pickerOptionsStart" size="mini" style="width: 200px"
+                placeholder="选择开始时间">
               </el-date-picker>
             </el-form-item>
           </el-col>
 
           <el-col :span="1.5">
-            <el-form-item label="截止时间" prop="deadlineTime" :rules="{ required: true, message: '请选择截止时间', trigger: 'blur' }">
-              <el-date-picker
-                v-model="basicForm.deadlineTime"
-                :disabled="sonDisable"
-                clearable
-                type="date"
-                value-format="yyyy-MM-dd 00:00:00"
-                :picker-options="pickerOptionsEnd"
-                size="mini"
-                style="width: 200px"
-                placeholder="选择截止时间"
-              >
+            <el-form-item label="截止时间" prop="deadlineTime"
+              :rules="{ required: true, message: '请选择截止时间', trigger: 'blur' }">
+              <el-date-picker v-model="basicForm.deadlineTime" :disabled="sonDisable" clearable type="date"
+                value-format="yyyy-MM-dd 00:00:00" :picker-options="pickerOptionsEnd" size="mini" style="width: 200px"
+                placeholder="选择截止时间">
               </el-date-picker>
             </el-form-item>
           </el-col>
 
-         <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-option
-                  v-for="item in deptOptions"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.code">
+          <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-option v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.code">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -106,9 +83,9 @@
 
           <el-col :span="1.5">
             <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">
+              <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">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -120,56 +97,51 @@
           <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="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' && basicForm.state == '0'">编辑</el-button>
+            <el-button type="primary" size="mini" @click="edit" v-if="sonPageStu == 'check' && basicForm.state == '0'">
+              编辑</el-button>
           </div>
         </div>
 
-        <el-table
-          :data="basicForm.mkBoPlanItemList" 
-          fit
-          height="460"
-          style="font-size: 12px;"
-          v-horizontal-scroll
-          @selection-change="handleSelectionChange"
-        >
-          <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" :render-header="addRedStar">
+        <el-table :data="basicForm.mkBoPlanItemList" fit height="460" style="font-size: 12px;" v-horizontal-scroll
+          @selection-change="handleSelectionChange">
+          <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" :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="sonDisable"
-                  clearable
-                  type="date"
-                  size="mini"
-                  value-format="yyyy-MM-dd 00:00:00"
-                  :picker-options="pickerOptions"
-
-                  placeholder="选择日期"
-                >
+              <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="sonDisable" clearable type="date" size="mini"
+                  value-format="yyyy-MM-dd 00:00:00" :picker-options="pickerOptions" placeholder="选择日期">
                 </el-date-picker>
               </el-form-item>
             </template>
           </el-table-column>
 
-          <el-table-column show-overflow-tooltip label="客户" prop="customerName" min-width="230" :render-header="addRedStar">
+          <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})" @clear="clearHang(scope.$index, '请选择客户')" style="width: 200px">
+              <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})"
+                  @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>
             </template>
           </el-table-column>
 
-          <el-table-column show-overflow-tooltip label="联系人" prop="contactName" min-width="230" :render-header="addRedStar">
+          <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})" 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>
@@ -179,16 +151,19 @@
           <el-table-column show-overflow-tooltip label="详细地址" prop="address" min-width="200">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'address'">
-                <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.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" :render-header="addRedStar">
+          <el-table-column show-overflow-tooltip label="拜访目的" prop="purpose" min-width="200"
+            :render-header="addRedStar">
             <template slot-scope="scope">
-              <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'purpose'" :rules="{ required: true, message: '请选择拜访目的', trigger: 'blur' }">
+              <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 v-for=" dict in dict.type.mk_bo_behavior_goal" :key="dict.value" :label="dict.label"
+                    :value="dict.value">
                   </el-option>
                 </el-select>
               </el-form-item>
@@ -198,28 +173,28 @@
           <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})" @clear="clearHang(scope.$index, '请选择商机')" 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>
             </template>
           </el-table-column>
 
-          <el-table-column :readonly="sonDisable" show-overflow-tooltip label="营销活动" prop="marketingCampaign" min-width="200">
+          <el-table-column :readonly="sonDisable" show-overflow-tooltip label="营销活动" prop="marketingCampaign"
+            min-width="200">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'mkBoPlanItemList.' + scope.$index + '.' + 'marketingCampaign'">
-                <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.marketingCampaign"/>
+                <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.marketingCampaign" />
               </el-form-item>
             </template>
           </el-table-column>
 
-          <el-table-column
-            fixed="right"
-            label="操作"
-            align="center"
-          >
+          <el-table-column fixed="right" label="操作" align="center">
             <template slot-scope="scope">
-              <el-button type="text" size="mini" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除</el-button>
+              <el-button type="text" size="mini" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除
+              </el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -232,496 +207,524 @@
       </el-col>
 
       <el-col :span="1.5" style="margin: 0 10px;">
-        <el-button type="primary" size="mini" plain @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
+        <el-button type="primary" size="mini" plain @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存
+        </el-button>
       </el-col>
 
-      <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
+      <Refers ref="refer" @doSubmit="selectionsToInput" :single="true" />
     </div>
   </div>
 </template>
 
 <script>
-import {addPlan, getPlanDetail, editPlan, delPlanItem} from '@/api/business/spd/task_management/visitingPlan/visitingPlan.js'
-import Refers from '@/components/Refers/refers.vue'
-// 用于回显参照框数据
-import {getRefer} from '@/api/purchase/basic.js'
-export default {
-  name: 'addPlanList',
-  props: ['pageStu', 'row', 'disable'],
-  dicts: ['mk_plan_state', 'mk_plan_route_type', 'mk_bo_behavior_goal'],
-  components: {
-    Refers
-  },
-  model: {
-    prop: 'isList',
-    event: 'jugislist'
-  },
-  data() {
-    return {
-      // 不能直接改变props传来的值
-      sonPageStu: this.pageStu,
-      sonDisable: this.disable,
-      // dialog: {
-      //   config: false
-      // },
-      basicForm: {
-        id: '',
-        planCode: '',
-        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',
-        state: '0',
-        marketingArea: '',
-        marketingAreaName: '',
-        mkBoPlanItemList: []
-      },
-      delPlanItemList: [],
-      basicRules: {},
-      tableList: [],
-      referCondition: {
-        type: '',
-        isPage: true,
-        title: ''
-      },
-      tableIndex: null,
-      ids: [],
-      boOptions: [],
-      linkOptions: [],
-      manOptions: [],
-      personOptions: [],
-      deptOptions: [],
-      customerOptions: [],
-      salesAreaOptions: [],
-      //定义主表开始时间的范围不能早于今天
-      pickerOptionsStart: {
-        disabledDate: (time) => {
-          return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000 || time.getTime() > (new Date(this.basicForm.deadlineTime)).getTime()
-        }
-      },
-      //定义主表截止时间的范围不能早于开始时间
-      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
-    }
-  },
-  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') {
-      this.getDetails(this.row)
-    } else if (this.pageStu == 'add') {
-      //新增时默认带出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:{
-    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 = null
-      this.basicForm.createByName = null
-      this.basicForm.state = 0
-      //复制之后执行人和部门变为当前账号所有者
-      this.basicForm.charger = this.$store.state.user.id,
-      this.basicForm.chargerName = this.$store.state.user.nickName
-      this.basicForm.dept = this.$store.state.user.deptId
-      this.basicForm.deptName = this.$store.state.user.deptName
-      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 = ''
-      })
+  import {
+    addPlan,
+    getPlanDetail,
+    editPlan,
+    delPlanItem
+  } from '@/api/business/spd/task_management/visitingPlan/visitingPlan.js'
+  import Refers from '@/components/Refers/refers.vue'
+  // 用于回显参照框数据
+  import {
+    getRefer
+  } from '@/api/purchase/basic.js'
+  export default {
+    name: 'addPlanList',
+    props: ['pageStu', 'row', 'disable'],
+    dicts: ['mk_plan_state', 'mk_plan_route_type', 'mk_bo_behavior_goal'],
+    components: {
+      Refers
     },
-    handleData() {
-      console.log('222')
-      // 复制新增把id,编码,创建人置为空,子表去掉id
-      this.basicForm.id = ''
-      this.basicForm.planCode = ''
-      if (this.basicForm.mkBoPlanItemList.length !== 0) {
-        this.basicForm.mkBoPlanItemList.forEach(item => {
-          if (item.id) {
-            delete item.id
+    model: {
+      prop: 'isList',
+      event: 'jugislist'
+    },
+    data() {
+      return {
+        // 不能直接改变props传来的值
+        sonPageStu: this.pageStu,
+        sonDisable: this.disable,
+        // dialog: {
+        //   config: false
+        // },
+        basicForm: {
+          id: '',
+          planCode: '',
+          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',
+          state: '0',
+          marketingArea: '',
+          marketingAreaName: '',
+          mkBoPlanItemList: []
+        },
+        delPlanItemList: [],
+        basicRules: {},
+        tableList: [],
+        referCondition: {
+          type: '',
+          isPage: true,
+          title: ''
+        },
+        tableIndex: null,
+        ids: [],
+        boOptions: [],
+        linkOptions: [],
+        manOptions: [],
+        personOptions: [],
+        deptOptions: [],
+        customerOptions: [],
+        salesAreaOptions: [],
+        //定义主表开始时间的范围不能早于今天
+        pickerOptionsStart: {
+          disabledDate: (time) => {
+            return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000 || time.getTime() > (new Date(this.basicForm
+              .deadlineTime)).getTime()
+          }
+        },
+        //定义主表截止时间的范围不能早于开始时间
+        pickerOptionsEnd: {
+          disabledDate: (time) => {
+            return time.getTime() < (new Date(this.basicForm.startDate)).getTime()
           }
-          if (item.planId) {
-            delete item.planId
+        },
+        //定义子表日期的范围不能早于开始时间且不能晚于截止时间
+        pickerOptions: {
+          disabledDate: (time) => {
+            return time.getTime() < (new Date(this.basicForm.startDate)).getTime() || time.getTime() > (new Date(this
+              .basicForm.deadlineTime)).getTime()
           }
+        },
+        //判断默认明细行带出完毕后,增行日期等于当前日期的标识
+        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') {
+        this.getDetails(this.row)
+      } else if (this.pageStu == 'add') {
+        //新增时默认带出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'
         })
       }
     },
-    // 如果需要回显则调用详情接口
-    getDetails(row) {
-      getPlanDetail(row.id).then(res => {
-        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'
+    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 = null
+        this.basicForm.createByName = null
+        this.basicForm.state = 0
+        //复制之后执行人和部门变为当前账号所有者
+        this.basicForm.charger = this.$store.state.user.id,
+          this.basicForm.chargerName = this.$store.state.user.nickName
+        this.basicForm.dept = this.$store.state.user.deptId
+        this.basicForm.deptName = this.$store.state.user.deptName
+        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.planCode = ''
+        if (this.basicForm.mkBoPlanItemList.length !== 0) {
           this.basicForm.mkBoPlanItemList.forEach(item => {
-            item.date = item.date + ' 00:00:00'
+            if (item.id) {
+              delete item.id
+            }
+            if (item.planId) {
+              delete item.planId
+            }
           })
         }
-      }).then(() => {
-        this.loading = false
-      }).catch(err => {
-        this.loading = false
-      })
-    },
-    async save() {
-      if(this.basicForm.mkBoPlanItemList.length !== 0) {
-        this.$refs['basic'].validate((valid, obj) => {
-          if(valid) {
-            this.$modal.loading("保存中...");
-            if(this.sonPageStu == 'add') {
-              this.planNameAssignment();
-              this.handleData()
-              addPlan(this.basicForm).then(res => {
-                console.log(333)
-                if (res.code === 200) {
-                  this.$modal.notifySuccess("保存成功");
+      },
+      // 如果需要回显则调用详情接口
+      getDetails(row) {
+        getPlanDetail(row.id).then(res => {
+          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() {
+        if (this.basicForm.mkBoPlanItemList.length !== 0) {
+          this.$refs['basic'].validate((valid, obj) => {
+            if (valid) {
+              this.$modal.loading("保存中...");
+              if (this.sonPageStu == 'add') {
+                this.planNameAssignment();
+                this.handleData()
+                addPlan(this.basicForm).then(res => {
+                  console.log(333)
+                  if (res.code === 200) {
+                    this.$modal.notifySuccess("保存成功");
+                    this.$modal.closeLoading();
+                    this.back()
+                  }
+                }).catch(err => {
                   this.$modal.closeLoading();
-                  this.back()
-                }
-              }).catch(err => {
-                this.$modal.closeLoading();
-              })
-            } else if (this.sonPageStu == 'edit') {
-              this.planNameAssignment();
-              let list = []
-              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.delPlanItemList)
-              editPlan(param).then(res => {
-                if (res.code === 200) {
-                  this.$modal.notifySuccess("编辑成功");
+                })
+              } else if (this.sonPageStu == 'edit') {
+                this.planNameAssignment();
+                let list = []
+                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.delPlanItemList)
+                editPlan(param).then(res => {
+                  if (res.code === 200) {
+                    this.$modal.notifySuccess("编辑成功");
+                    this.$modal.closeLoading();
+                    this.back()
+                  }
+                }).catch(err => {
                   this.$modal.closeLoading();
-                  this.back()
-                }
-              }).catch(err => {
-                this.$modal.closeLoading();
-              })
-            }
-          } else {
-            // 校验加弹窗
-            const jiaoyan = []
-            for(let key in obj) {
-              jiaoyan.push(obj[key][0].message);
+                })
+              }
+            } else {
+              // 校验加弹窗
+              const jiaoyan = []
+              for (let key in obj) {
+                jiaoyan.push(obj[key][0].message);
+              }
+              this.$modal.notifyWarning(jiaoyan[0]);
+              return false
             }
-            this.$modal.notifyWarning(jiaoyan[0]);
-            return false
-          }
+          })
+        } else {
+          this.$modal.msgWarning("明细信息不能为空!");
+        }
+      },
+      //拜访计划名称赋值
+      planNameAssignment() {
+        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) {
+        if ((this.sonPageStu == 'edit') || (this.isFlag && this.sonPageStu == 'add')) {
+          date = this.basicForm.startDate;
+        }
+        const newLine = {
+          id: null,
+          planId: this.basicForm.id,
+          planCode: this.basicForm.planCode,
+          date: date,
+          customer: null,
+          customerName: null,
+          contact: null,
+          contactName: null,
+          address: null,
+          purpose: null,
+          bo: null,
+          boName: null,
+          marketingCampaign: null,
+          delFlag: 0,
+          // 新增字段
+          model: null,
+        }
+        this.basicForm.mkBoPlanItemList.push(newLine)
+      },
+      // 批量删除按钮
+      delItems() {
+        if (this.ids.length == 0) {
+          this.$modal.msgWarning("请选中至少一条数据");
+        } else {
+          let param = this.ids.join()
+          this.$modal.confirm('确认信息').then(() => {
+            delPlanItem(param).then(res => {
+              if (res.code === 200) {
+                this.$modal.notifySuccess("删除成功");
+                this.getDetails(this.row)
+              }
+            })
+          }).catch(() => {})
+        }
+      },
+      delLine(index, row) {
+        console.log('删除行:', index)
+        console.log('改变行:', row)
+        row.delFlag = '2'
+        let delList = []
+        delList = this.basicForm.mkBoPlanItemList.filter(item => {
+          return item.delFlag == '2'
         })
-      } else {
-        this.$modal.msgWarning("明细信息不能为空!");
-      }
-    },
-    //拜访计划名称赋值
-    planNameAssignment() {
-      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) {
-      if ((this.sonPageStu == 'edit') || (this.isFlag && this.sonPageStu == 'add')) {
-        date = this.basicForm.startDate;
-      }
-      const newLine = {
-        id: null,
-        planId: this.basicForm.id,
-        planCode: this.basicForm.planCode,
-        date: date,
-        customer: null,
-        customerName: null,
-        contact: null,
-        contactName: null,
-        address: null,
-        purpose: null,
-        bo: null,
-        boName: null,
-        marketingCampaign: null,
-        delFlag: 0,
-        // 新增字段
-        model: null,
-      }
-      this.basicForm.mkBoPlanItemList.push(newLine)
-    },
-    // 批量删除按钮
-    delItems() {
-      if(this.ids.length == 0) {
-        this.$modal.msgWarning("请选中至少一条数据");
-      } else {
-        let param = this.ids.join()
-        this.$modal.confirm('确认信息').then(() => {
-        delPlanItem(param).then(res => {
-          if (res.code === 200) {
-            this.$modal.notifySuccess("删除成功");
-            this.getDetails(this.row)
+        this.basicForm.mkBoPlanItemList = this.basicForm.mkBoPlanItemList.filter(item => {
+          return item.delFlag == '0'
+        })
+        this.delPlanItemList.push(...delList)
+        console.log('删除的数组', this.delPlanItemList)
+      },
+      edit() {
+        this.getDetails(this.row)
+        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'
+        })
+      },
+      back() {
+        this.$emit('jugislist', true)
+        // let queryParams = {
+        //   pageNum: 1,
+        //   pageSize: 10
+        // }
+        this.$emit('refresh')
+      },
+      handleSelectionChange(selection) {
+        console.log('选中', selection)
+        this.ids = selection.map(item => item.id)
+        console.log('选中数组', this.ids.join())
+      },
+      // 回显参照框
+      reBackRefer(type, id, title) {
+        getRefer({
+          type: type,
+          id: id
+        }).then(res => {
+          if (type == 'CONTACTS_PARAM') {
+            this.personOptions = res.rows
+          }
+          if (type == 'MK_SALESAREA_PARAM') {
+            this.salesAreaOptions = res.rows
+          }
+          if (type == 'DEPT_PARAM') {
+            this.deptOptions = res.rows
+          }
+          if (type == 'CUSTOMER_PARAM_ZT') {
+            this.customerOptions = res.rows
+          }
+          if (type == 'LINKMAN_PARAM') {
+            this.linkOptions = res.rows
+          }
+          if (type == 'BO_PARAM') {
+            this.boOptions = res.rows
           }
         })
-        }).catch(() => {})
-      }
-    },
-    delLine(index, row) {
-      console.log('删除行:', index)
-      console.log('改变行:', row)
-      row.delFlag = '2'
-      let delList = []
-      delList = this.basicForm.mkBoPlanItemList.filter(item => {
-        return item.delFlag == '2'
-      })
-      this.basicForm.mkBoPlanItemList = this.basicForm.mkBoPlanItemList.filter(item => {
-        return item.delFlag == '0'
-      })
-      this.delPlanItemList.push(...delList)
-      console.log('删除的数组',this.delPlanItemList)
-    },
-    edit() {
-      this.getDetails(this.row)
-      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'
-      })
-    },
-    back() {
-      this.$emit('jugislist', true)
-      // let queryParams = {
-      //   pageNum: 1,
-      //   pageSize: 10
-      // }
-      this.$emit('refresh')
-    },
-    handleSelectionChange(selection) {
-      console.log('选中', selection)
-      this.ids = selection.map(item => item.id)
-      console.log('选中数组', this.ids.join())
-    },
-    // 回显参照框
-    reBackRefer(type, id, title) {
-      getRefer({type: type, id: id}).then(res => {
-        if (type == 'CONTACTS_PARAM') {
-          this.personOptions = res.rows
+      },
+      //公共基本信息选择参照带出数据
+      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
+        this.referCondition.isPage = isPage
+        this.referCondition.title = title
+        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("请先确认客户");
+          }
         }
-        if(type == 'MK_SALESAREA_PARAM') {
-          this.salesAreaOptions = res.rows
+      },
+      //联动清除明细行里其它的字段
+      clearHang(index, title) {
+        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 (type == 'DEPT_PARAM') {
-          this.deptOptions = res.rows
+        // 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
+          this.basicForm.mkBoPlanItemList[index].bo = null
+          this.basicForm.mkBoPlanItemList[index].boName = null
         }
-        if (type == 'CUSTOMER_PARAM_ZT') {
-          this.customerOptions = res.rows
+        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
         }
-        if (type == 'LINKMAN_PARAM') {
-          this.linkOptions = res.rows
+      },
+      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(type == 'BO_PARAM') {
-          this.boOptions = res.rows
+        //销售区域参照
+        if (this.referCondition.type == 'MK_SALESAREA_PARAM') {
+          this.salesAreaOptions = selection
+          this.basicForm.marketingArea = selection[0].id
+          this.basicForm.marketingAreaName = selection[0].name
         }
-      })
-    },
-    //公共基本信息选择参照带出数据
-    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
-      this.referCondition.isPage = isPage
-      this.referCondition.title = title
-      if (title == "请选择客户") {
-        if(parame.charger) {
-          this.referCondition.parame = parame
-          this.$refs.refer.init(this.referCondition)
-        } else {
-          this.$modal.notifyWarning("请先确认执行人");
+        //部门参照
+        if (this.referCondition.type == 'DEPT_PARAM') {
+          this.deptOptions = selection
+          this.basicForm.dept = selection[0].id
+          this.basicForm.deptName = selection[0].name
         }
-      } else if (title == "请选择联系人") {
-        if(parame.customer) {
-          this.referCondition.parame = parame
-          this.$refs.refer.init(this.referCondition)
-        } else {
-          this.$modal.notifyWarning("请先确认客户");
+        //客户参照
+        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
         }
-      } else if (title == "请选择商机") {
-        if(parame.customer) {
-          this.referCondition.parame = parame
-          this.$refs.refer.init(this.referCondition)
-        } else {
-          this.$modal.notifyWarning("请先确认客户");
+        //联系人参照
+        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
         }
-      }
-    },
-    //联动清除明细行里其它的字段
-    clearHang(index, title) {
-      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
-        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.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
-        this.basicForm.mkBoPlanItemList[this.tableIndex].customerName = selection[0].customerName
-      }
-    },
-    //获取当前时间
-    getCurrentTime() {
-      let date = new Date();
-      return date;
-    },
-    //获取下周七天日期,day表示想要星期几
-    getNextWeek(day) {
-      const week = [];
-      for (let i = 0; i < 7; i++) {
-        let Stamp = new Date();
-        let num = 7 - Stamp.getDay() + 1 + i;
-        Stamp.setDate(Stamp.getDate() + num);
-        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];
-    },
-    //新增时默认带出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)
-      ];
-    },
+        //商机参照
+        if (this.referCondition.type == 'BO_PARAM') {
+          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
+          this.basicForm.mkBoPlanItemList[this.tableIndex].customerName = selection[0].customerName
+        }
+      },
+      //获取当前时间
+      getCurrentTime() {
+        let date = new Date();
+        return date;
+      },
+      //获取下周七天日期,day表示想要星期几
+      getNextWeek(day) {
+        const week = [];
+        for (let i = 0; i < 7; i++) {
+          let Stamp = new Date();
+          let num = 7 - Stamp.getDay() + 1 + i;
+          Stamp.setDate(Stamp.getDate() + num);
+          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];
+      },
+      //新增时默认带出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)
+        ];
+      },
+    }
   }
-}
 
 </script>
 
 <style lang="scss" scoped>
-.btn_group {
-  width: 100%;
-  margin: 20px -10px;
-  display: flex;
-  justify-content: right;
-} 
-.btn_grooup {
-  margin-bottom: 10px;
-  display: flex;
-  justify-content: space-between;
-}
-.hang {
-  margin: auto;
-}
-.hang ::v-deep .el-form-item__content{
-  margin-left: 0px !important;
-}
-</style>
+  .btn_group {
+    width: 100%;
+    margin: 20px -10px;
+    display: flex;
+    justify-content: right;
+  }
+
+  .btn_grooup {
+    margin-bottom: 10px;
+    display: flex;
+    justify-content: space-between;
+  }
+
+  .hang {
+    margin: auto;
+  }
+
+  .hang ::v-deep .el-form-item__content {
+    margin-left: 0px !important;
+  }
+
+</style>

+ 429 - 442
src/views/business/spd/bo/plan/index.vue

@@ -4,32 +4,23 @@
       <el-card>
         <el-form class="search_area" label-width="100px">
           <el-row :gutter="10">
-            
+
             <el-col :span="1.5">
               <el-form-item label="计划编码">
-                <el-input
-                  v-model.trim="queryParams.planCode"
-                  size="mini"
-                  clearable
-                  style="width: 200px"
-                />
+                <el-input v-model.trim="queryParams.planCode" size="mini" clearable style="width: 200px" />
               </el-form-item>
             </el-col>
             <el-col :span="1.5">
               <el-form-item label="计划名称">
-                <el-input
-                  v-model.trim="queryParams.planName"
-                  size="mini"
-                  clearable
-                  style="width: 200px"
-                />
+                <el-input v-model.trim="queryParams.planName" size="mini" clearable style="width: 200px" />
               </el-form-item>
             </el-col>
-            
+
             <el-col :span="1.5">
               <el-form-item label="线路类型">
                 <el-select clearable v-model="queryParams.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 v-for=" dict in dict.type.mk_plan_route_type" :key="dict.value" :label="dict.label"
+                    :value="dict.value">
                   </el-option>
                 </el-select>
               </el-form-item>
@@ -37,16 +28,17 @@
 
             <el-col :span="1.5">
               <el-form-item label="执行人">
-              <el-select clearable size="mini" v-model="queryParams.chargerName" @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="queryParams.chargerName"
+                  @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-form-item>
             </el-col>
-                            
+
             <el-col :span="1.5">
               <el-form-item label="" label-width="20px">
-              <el-button type="primary" size="mini" icon="el-icon-search" plain @click="searchList">搜索</el-button>
-              <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
+                <el-button type="primary" size="mini" icon="el-icon-search" plain @click="searchList">搜索</el-button>
+                <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
               </el-form-item>
             </el-col>
           </el-row>
@@ -83,26 +75,17 @@
                 </el-col> -->
 
                 <el-col :span="1.5">
-                  <el-form-item label="销售区域">
-                    <el-select clearable v-model="queryParams.marketingAreaName" size="mini" @focus="choose('MK_SALESAREA_PARAM', true, '销售区域')" style="width: 200px">
-                      <el-option
-                        v-for="item in deptOptions"
-                        :key="item.id"
-                        :label="item.name"
-                        :value="item.id">
-                      </el-option>
-                    </el-select>
+                  <el-form-item label="时间范围">
+                    <el-date-picker size="mini" v-model="dateRange" style="width: 200px" value-format="yyyy-MM-dd"
+                      type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
                   </el-form-item>
                 </el-col>
 
                 <el-col :span="1.5">
-                  <el-form-item label="部门">
-                    <el-select clearable v-model="queryParams.deptName" size="mini" @focus="choose('DEPT_PARAM', true, '部门')" style="width: 200px">
-                      <el-option
-                        v-for="item in deptOptions"
-                        :key="item.id"
-                        :label="item.name"
-                        :value="item.id">
+                  <el-form-item label="销售区域">
+                    <el-select clearable v-model="queryParams.marketingAreaName" size="mini"
+                      @focus="choose('MK_SALESAREA_PARAM', true, '销售区域')" style="width: 200px">
+                      <el-option v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.id">
                       </el-option>
                     </el-select>
                   </el-form-item>
@@ -111,24 +94,20 @@
                 <el-col :span="1.5">
                   <el-form-item label="确认状态">
                     <el-select clearable v-model="queryParams.state" size="mini" 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 v-for=" dict in dict.type.mk_plan_state" :key="dict.value" :label="dict.label"
+                        :value="dict.value">
                       </el-option>
                     </el-select>
                   </el-form-item>
                 </el-col>
-                
+
                 <el-col :span="1.5">
-                  <el-form-item label="时间范围">
-                    <el-date-picker
-                      size="mini"
-                      v-model="dateRange"
-                      style="width: 200px"
-                      value-format="yyyy-MM-dd"
-                      type="daterange"
-                      range-separator="-"
-                      start-placeholder="开始日期"
-                      end-placeholder="结束日期"
-                      />
+                  <el-form-item label="部门">
+                    <el-select clearable v-model="queryParams.deptName" size="mini"
+                      @focus="choose('DEPT_PARAM', true, '部门')" style="width: 200px">
+                      <el-option v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.id">
+                      </el-option>
+                    </el-select>
                   </el-form-item>
                 </el-col>
 
@@ -137,8 +116,9 @@
           </CollapseTransition>
         </el-form>
 
-        <el-divider class="lines"><i style="cursor: pointer;" :class="expanded?'el-icon-arrow-up':'el-icon-arrow-down'" @click="drop"></i></el-divider>
-  
+        <el-divider class="lines"><i style="cursor: pointer;" :class="expanded?'el-icon-arrow-up':'el-icon-arrow-down'"
+            @click="drop"></i></el-divider>
+
         <div class="btn_grooup">
           <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
 
@@ -154,11 +134,11 @@
 
           <el-dropdown size="mini" @command="handleExport">
             <el-button size="mini" type="primary" style="margin: 0 10px;">
-            导出<i class="el-icon-arrow-down el-icon--right"></i>
+              导出<i class="el-icon-arrow-down el-icon--right"></i>
             </el-button>
             <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item command="选中导出">选中导出</el-dropdown-item>
-            <el-dropdown-item command="全部导出">全部导出</el-dropdown-item>
+              <el-dropdown-item command="选中导出">选中导出</el-dropdown-item>
+              <el-dropdown-item command="全部导出">全部导出</el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
 
@@ -166,439 +146,446 @@
           <!-- <el-button type="primary" size="mini">打印</el-button> -->
         </div>
 
-        <el-table 
-        :data="tableList" 
-        fit
-        max-height="560"
-        style="font-size: 12px;"
-        v-horizontal-scroll
-        @selection-change="handleSelectionChange"
-        :row-class-name="tableRowClassName"
-        @row-dblclick="getEmpDetail"
-        >
+        <el-table :data="tableList" fit max-height="560" style="font-size: 12px;" v-horizontal-scroll
+          @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"/>
-          <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="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 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="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" />
           <el-table-column show-overflow-tooltip label="截止时间" align="center" min-width="120" prop="deadlineTime" />
-          <el-table-column show-overflow-tooltip label="单据状态" align="center" min-width="120" prop="state" :formatter="formatterStatus"/>
-          <el-table-column
-          fixed="right"
-          label="操作"
-          align="center"
-          width="180"
-          >
+          <el-table-column show-overflow-tooltip label="单据状态" align="center" min-width="120" prop="state"
+            :formatter="formatterStatus" />
+          <el-table-column fixed="right" label="操作" align="center" width="180">
             <template slot-scope="scope">
               <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" v-if="scope.row.state == '0'" @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>
 
-        <el-pagination
-        background
-        @size-change="handleSizeChange"
-        @current-change="handleCurrentChange"
-        :current-page="queryParams.pageNum"
-        :page-sizes="[10, 20, 50, 100]"
-        :page-size="10"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total=total>
+        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
+          :current-page="queryParams.pageNum" :page-sizes="[10, 20, 50, 100]" :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper" :total=total>
         </el-pagination>
       </el-card>
     </div>
 
-    <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="searchList"/>
+    <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="searchList" />
 
-    <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
+    <Refers ref="refer" @doSubmit="selectionsToInput" :single="true" />
 
-    <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
+    <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true" />
   </div>
 </template>
 
 <script>
-// 导入的token
-import { getToken } from "@/utils/auth";
-import Add from './add.vue'
-import Refers from '@/components/Refers/refers.vue'
-import TreeRefers from '@/components/Refers/treeRefer.vue'
-import CollapseTransition from '@/components/MyCollapse/collapse.vue'
-import {getPlanList, delPlan, exportPlan, submitPlan } from '@/api/business/spd/task_management/visitingPlan/visitingPlan.js'
-export default {
-  name: 'PlanLise',
-  components: {
-    Add,
-    CollapseTransition,
-    Refers,
-    TreeRefers
-  },
-  dicts: ['mk_plan_state', 'mk_plan_route_type'],
-  data() {
-    return {
-      // 导入参数
-      upload: {
-        // 是否显示弹出层(导入)
-        open: false,
-        // 弹出层标题(导入)
-        title: "数据导入",
-        // 是否禁用上传
-        isUploading: false,
-        // 是否更新已经存在的用户数据
-        updateSupport: 1,
-        // 设置上传的请求头部
-        headers: { Authorization: "Bearer " + getToken() },
-        // 上传的地址
-        url: process.env.VUE_APP_BASE_API + "/pu/demand/import"
-      },
-      // 模板下载参数
-      download: {
-        open: false,
-        customer: '',
-        warehouse: '',
-        warehouseId: '',
-        cargoSpace: '',
-        category: ''
-      },
-      mBcustomer: [],
-      mBwarehouse: [],
-      mBcargoSpace: [],
-      classOptions: [],
-      // 下拉收起配置
-      expanded: false,
-      // 页面配置
-      isList: true,
-      // 页面状态
-      page: '',
-      queryParams: {
-        planCode: '',
-        planName: '',
-        charger: '',
-        chargerName: '',
-        dept: '',
-        deptName: '',
-        startDate: '',
-        deadlineTime: '',
-        type: '',
-        state: '',
-        marketingArea: '',
-        marketingAreaName: '',
-        pageNum: 1,
-        pageSize: 10
-      },
-      referCondition: {
-        type: '',
-        isPage: true,
-        title: ''
-      },
-      personOptions: [],
-      deptOptions: [],
-      tableList: [],
-      total: 0,
-      rowDetail: {},
-      disable: false,
-      ids: [],
-      // 查询日期范围
-      dateRange: [],
-    }
-  },
-  created() {
-    this.getList(this.queryParams)
-  },
-  methods: {
-    // 格式化表格内容
-    formatterStatus(row) {
-      switch(row.state){
-        case '0':
-          return '未确认'
-        case '1':
-          return '已确认'
-        case '2':
-          return '作废'
-      }
+  // 导入的token
+  import {
+    getToken
+  } from "@/utils/auth";
+  import Add from './add.vue'
+  import Refers from '@/components/Refers/refers.vue'
+  import TreeRefers from '@/components/Refers/treeRefer.vue'
+  import CollapseTransition from '@/components/MyCollapse/collapse.vue'
+  import {
+    getPlanList,
+    delPlan,
+    exportPlan,
+    submitPlan
+  } from '@/api/business/spd/task_management/visitingPlan/visitingPlan.js'
+  export default {
+    name: 'PlanLise',
+    components: {
+      Add,
+      CollapseTransition,
+      Refers,
+      TreeRefers
     },
-    searchList() {
-      this.getList(this.queryParams)
-    },
-    resetList() {
-      this.dateRange = [];
-      this.queryParams = {
-        planCode: '',
-        planName: '',
-        charger: '',
-        chargerName: '',
-        dept: '',
-        deptName: '',
-        startDate: '',
-        deadlineTime: '',
-        type: '',
-        state: '',
-        marketingArea: '',
-        marketingAreaName: '',
-        pageNum: 1,
-        pageSize: 10
+    dicts: ['mk_plan_state', 'mk_plan_route_type'],
+    data() {
+      return {
+        // 导入参数
+        upload: {
+          // 是否显示弹出层(导入)
+          open: false,
+          // 弹出层标题(导入)
+          title: "数据导入",
+          // 是否禁用上传
+          isUploading: false,
+          // 是否更新已经存在的用户数据
+          updateSupport: 1,
+          // 设置上传的请求头部
+          headers: {
+            Authorization: "Bearer " + getToken()
+          },
+          // 上传的地址
+          url: process.env.VUE_APP_BASE_API + "/pu/demand/import"
+        },
+        // 模板下载参数
+        download: {
+          open: false,
+          customer: '',
+          warehouse: '',
+          warehouseId: '',
+          cargoSpace: '',
+          category: ''
+        },
+        mBcustomer: [],
+        mBwarehouse: [],
+        mBcargoSpace: [],
+        classOptions: [],
+        // 下拉收起配置
+        expanded: false,
+        // 页面配置
+        isList: true,
+        // 页面状态
+        page: '',
+        queryParams: {
+          planCode: '',
+          planName: '',
+          charger: '',
+          chargerName: '',
+          dept: '',
+          deptName: '',
+          startDate: '',
+          deadlineTime: '',
+          type: '',
+          state: '',
+          marketingArea: '',
+          marketingAreaName: '',
+          pageNum: 1,
+          pageSize: 10
+        },
+        referCondition: {
+          type: '',
+          isPage: true,
+          title: ''
+        },
+        personOptions: [],
+        deptOptions: [],
+        tableList: [],
+        total: 0,
+        rowDetail: {},
+        disable: false,
+        ids: [],
+        // 查询日期范围
+        dateRange: [],
       }
+    },
+    created() {
       this.getList(this.queryParams)
     },
-    getList(params){
-      getPlanList(this.addDateRange(params, this.dateRange)).then(res => {
-        if (res.code === 200) {
-          this.tableList = res.rows
-          this.total = res.total
-          console.log(res, 'res-------')
+    methods: {
+      // 格式化表格内容
+      formatterStatus(row) {
+        switch (row.state) {
+          case '0':
+            return '未确认'
+          case '1':
+            return '已确认'
+          case '2':
+            return '作废'
         }
-      })
-    },
-    handleSelectionChange(selection) {
-      console.log('选中', selection)
-      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: ''
-    //   }
-    // },
-    handleCommand(command) {
-      // alert(command)
-      if(command == '模板下载') {
-        this.download.open = true
-      }
-      if (command == '数据导入') {
-        this.upload.title = "用户导入"
-        this.upload.open = true
-      }
-    },
-    // 文件上传中处理
-    handleFileUploadProgress(event, file, fileList) {
-      this.upload.isUploading = true;
-    },
-    // 文件上传成功处理
-    handleFileSuccess(response, file, fileList) {
-      this.upload.open = false;
-      this.upload.isUploading = false;
-      this.$refs.upload.clearFiles();
-      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
-      this.getList(this.queryParams);
-    },
-    errorFile(err) {
-      this.$modal.notifyError("文件已变动,请重新上传");
-    },
-    // 提交上传文件
-    submitFileForm() {
-      this.$refs.upload.submit();
-    },
-    handleExport(command) {
-      if(command == '选中导出') {
-        if (this.ids.length == 0) {
-          this.$modal.msgWarning("请选中至少一条数据");
+      },
+      searchList() {
+        this.getList(this.queryParams)
+      },
+      resetList() {
+        this.dateRange = [];
+        this.queryParams = {
+          planCode: '',
+          planName: '',
+          charger: '',
+          chargerName: '',
+          dept: '',
+          deptName: '',
+          startDate: '',
+          deadlineTime: '',
+          type: '',
+          state: '',
+          marketingArea: '',
+          marketingAreaName: '',
+          pageNum: 1,
+          pageSize: 10
+        }
+        this.getList(this.queryParams)
+      },
+      getList(params) {
+        getPlanList(this.addDateRange(params, this.dateRange)).then(res => {
+          if (res.code === 200) {
+            this.tableList = res.rows
+            this.total = res.total
+            console.log(res, 'res-------')
+          }
+        })
+      },
+      handleSelectionChange(selection) {
+        console.log('选中', selection)
+        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: ''
+      //   }
+      // },
+      handleCommand(command) {
+        // alert(command)
+        if (command == '模板下载') {
+          this.download.open = true
+        }
+        if (command == '数据导入') {
+          this.upload.title = "用户导入"
+          this.upload.open = true
+        }
+      },
+      // 文件上传中处理
+      handleFileUploadProgress(event, file, fileList) {
+        this.upload.isUploading = true;
+      },
+      // 文件上传成功处理
+      handleFileSuccess(response, file, fileList) {
+        this.upload.open = false;
+        this.upload.isUploading = false;
+        this.$refs.upload.clearFiles();
+        this.$alert(response.msg, "导入结果", {
+          dangerouslyUseHTMLString: true
+        });
+        this.getList(this.queryParams);
+      },
+      errorFile(err) {
+        this.$modal.notifyError("文件已变动,请重新上传");
+      },
+      // 提交上传文件
+      submitFileForm() {
+        this.$refs.upload.submit();
+      },
+      handleExport(command) {
+        if (command == '选中导出') {
+          if (this.ids.length == 0) {
+            this.$modal.msgWarning("请选中至少一条数据");
+          } else {
+            let param = {
+              all: false,
+              ids: this.ids
+            }
+            exportPlan(param).then(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对象
+            })
+          }
         } else {
-          let param = {all: false, ids: this.ids}
-          exportPlan(param).then(res => {
+          let param2 = {
+            all: true
+          }
+          exportPlan(param2).then(res => {
             const blob = new Blob([res], {
               type: "application/vnd.ms-excel;charset=UTF-8",
-            });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
+            }); // 创建一个类文件对象: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 = '选中导出'; // 下载后文件名
+            downloadElement.href = href; //下载地址
+            downloadElement.download = '全部导出'; // 下载后文件名
             document.body.appendChild(downloadElement);
             downloadElement.click(); // 点击下载
             document.body.removeChild(downloadElement); // 下载完成移除元素
             window.URL.revokeObjectURL(href); // 释放blob对象
           })
         }
-      } else {
-        let param2 = {all: true}
-        exportPlan(param2).then(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对象
-        })
-      }
-    },
-    addDivision() {
-      this.isList = false
-      this.page = 'add'
-      this.disable = false
-    },
-    check(row) {
-      this.isList = false
-      this.page = 'check'
-      this.rowDetail = row
-      this.disable = true
-    },
-    edit(row) {
-      this.isList = false
-      this.page = 'edit'
-      this.rowDetail = row
-      this.disable = false
-    },
-    commit(row) {
-      console.log('row', row)
-      this.$modal.loading("提交中...");
-      submitPlan(row).then(res => {
-        if (res.code === 200) {
-          this.$modal.msgSuccess("提交成功");
-          this.$modal.closeLoading();
-          this.getList(this.queryParams)
-        }
-      }).catch(err => {
-        this.$modal.closeLoading();
-      })
-    },
-    // 行内删除
-    deleteids(row) {
-      console.log('row', row)
-      this.$modal.confirm('确定删除选择数据?').then(() => {
-        delPlan(row.id).then(res => {
-          if (res.code === 200) {
-            this.$modal.msgSuccess("删除成功");
-            this.getList(this.queryParams)
-          }
-        })
-      }).catch(() => {})
-    },
-    // 批量删除按钮
-    delItems() {
-      if(this.ids.length == 0) {
-        this.$modal.msgWarning("请选中至少一条数据");
-      } else {
-        let param = this.ids.join()
-        this.$modal.confirm('确认信息').then(() => {
-        delPlan(param).then(res => {
+      },
+      addDivision() {
+        this.isList = false
+        this.page = 'add'
+        this.disable = false
+      },
+      check(row) {
+        this.isList = false
+        this.page = 'check'
+        this.rowDetail = row
+        this.disable = true
+      },
+      edit(row) {
+        this.isList = false
+        this.page = 'edit'
+        this.rowDetail = row
+        this.disable = false
+      },
+      commit(row) {
+        console.log('row', row)
+        this.$modal.loading("提交中...");
+        submitPlan(row).then(res => {
           if (res.code === 200) {
-            this.$modal.msgSuccess("删除成功");
+            this.$modal.msgSuccess("提交成功");
+            this.$modal.closeLoading();
             this.getList(this.queryParams)
           }
+        }).catch(err => {
+          this.$modal.closeLoading();
         })
+      },
+      // 行内删除
+      deleteids(row) {
+        console.log('row', row)
+        this.$modal.confirm('确定删除选择数据?').then(() => {
+          delPlan(row.id).then(res => {
+            if (res.code === 200) {
+              this.$modal.msgSuccess("删除成功");
+              this.getList(this.queryParams)
+            }
+          })
         }).catch(() => {})
-      }
-    },
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
-      this.queryParams.pageSize = val
-      this.getList(this.queryParams)
-    },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
-      this.queryParams.pageNum = val
-      this.getList(this.queryParams)
-    },
-    drop() {
-      this.expanded = !this.expanded
-    },
-    // // 搜索区参照选择
-    // chooseOrg(type, isPage, title, stordocId) {
-    //   this.referCondition.type = type
-    //   this.referCondition.isPage = isPage
-    //   this.referCondition.title = title
-    //   this.referCondition.stordocId = stordocId
-    //   this.$refs.refer.init(this.referCondition)
-    // },
-    // 基本信息选择参照带出数据
-    choose(type, isPage, title) {
-      this.referCondition.type = type
-      this.referCondition.isPage = isPage
-      this.referCondition.title = title
-      this.$refs.refer.init(this.referCondition)
-    },
-    selectionsToInput(selection) {
-      if (this.referCondition.type == 'CONTACTS_PARAM') {
-        this.personOptions = selection
-        this.queryParams.charger = selection[0].id
-        this.queryParams.chargerName = selection[0].name
-      }
-      if (this.referCondition.type == 'DEPT_PARAM') {
-        this.deptOptions = selection
-        this.queryParams.dept = selection[0].id
-        this.queryParams.deptName = selection[0].name
-      }
-      if(this.referCondition.type == 'MK_SALESAREA_PARAM') {
-        this.personOptions = selection
-        this.queryParams.marketingArea = selection[0].id
-        this.queryParams.marketingAreaName = selection[0].name
-      }
-    },
-    selectionsToInput2(selection) {
-      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()定义一个值来存放下标
-    },
+      },
+      // 批量删除按钮
+      delItems() {
+        if (this.ids.length == 0) {
+          this.$modal.msgWarning("请选中至少一条数据");
+        } else {
+          let param = this.ids.join()
+          this.$modal.confirm('确认信息').then(() => {
+            delPlan(param).then(res => {
+              if (res.code === 200) {
+                this.$modal.msgSuccess("删除成功");
+                this.getList(this.queryParams)
+              }
+            })
+          }).catch(() => {})
+        }
+      },
+      handleSizeChange(val) {
+        console.log(`每页 ${val} 条`);
+        this.queryParams.pageSize = val
+        this.getList(this.queryParams)
+      },
+      handleCurrentChange(val) {
+        console.log(`当前页: ${val}`);
+        this.queryParams.pageNum = val
+        this.getList(this.queryParams)
+      },
+      drop() {
+        this.expanded = !this.expanded
+      },
+      // // 搜索区参照选择
+      // chooseOrg(type, isPage, title, stordocId) {
+      //   this.referCondition.type = type
+      //   this.referCondition.isPage = isPage
+      //   this.referCondition.title = title
+      //   this.referCondition.stordocId = stordocId
+      //   this.$refs.refer.init(this.referCondition)
+      // },
+      // 基本信息选择参照带出数据
+      choose(type, isPage, title) {
+        this.referCondition.type = type
+        this.referCondition.isPage = isPage
+        this.referCondition.title = title
+        this.$refs.refer.init(this.referCondition)
+      },
+      selectionsToInput(selection) {
+        if (this.referCondition.type == 'CONTACTS_PARAM') {
+          this.personOptions = selection
+          this.queryParams.charger = selection[0].id
+          this.queryParams.chargerName = selection[0].name
+        }
+        if (this.referCondition.type == 'DEPT_PARAM') {
+          this.deptOptions = selection
+          this.queryParams.dept = selection[0].id
+          this.queryParams.deptName = selection[0].name
+        }
+        if (this.referCondition.type == 'MK_SALESAREA_PARAM') {
+          this.personOptions = selection
+          this.queryParams.marketingArea = selection[0].id
+          this.queryParams.marketingAreaName = selection[0].name
+        }
+      },
+      selectionsToInput2(selection) {
+        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>
 
 <style lang="scss" scoped>
-#PlanLise {
-  height: calc(100vh - 84px);
-  padding: 12px;
-  box-sizing: border-box;
-  overflow-y: scroll;
-}
-.btn_grooup {
-  margin-bottom: 10px;
-  display: flex;
-  justify-content: flex-end;
-}
-.lines {
-  margin-top: 0;
-}
-.el-pagination {
-  margin-top: 10px;
-  text-align: right;
-}
-</style>
+  #PlanLise {
+    height: calc(100vh - 84px);
+    padding: 12px;
+    box-sizing: border-box;
+    overflow-y: scroll;
+  }
+
+  .btn_grooup {
+    margin-bottom: 10px;
+    display: flex;
+    justify-content: flex-end;
+  }
+
+  .lines {
+    margin-top: 0;
+  }
+
+  .el-pagination {
+    margin-top: 10px;
+    text-align: right;
+  }
+
+</style>