|
@@ -27,7 +27,7 @@
|
|
|
<text class="label">查核人</text>
|
|
|
<view class="content">
|
|
|
<text :class="['base-text', item.empName ? 'black-color' : '']">
|
|
|
- {{ item.empName ? item.empName : '选择查核成员'}}
|
|
|
+ {{ item.empName?item.empName : '选择查核成员'}}
|
|
|
</text>
|
|
|
</view>
|
|
|
<image class="arrow" src="/static/images/icon-more.png"></image>
|
|
@@ -228,106 +228,137 @@
|
|
|
this.checkedList = this.checkedList.concat([deptId]);
|
|
|
}
|
|
|
},
|
|
|
- // 完成
|
|
|
- submit() {
|
|
|
- // baseEmpList: 第一次计划修改的数据; changePlanList: 批量分配,记录第一次计划修改数据的信息; multipleEmpList: 批量修改的数据
|
|
|
- let baseEmpList = [],
|
|
|
- changePlanList = [],
|
|
|
- multipleEmpList = [];
|
|
|
- // planStartTimestamp: 开始计划时间戳;
|
|
|
- let planStartTimestamp = this.dateToTimestamp(this.startDate);
|
|
|
- this.checkList.map((item, i) => {
|
|
|
- const {
|
|
|
- checkId,
|
|
|
- deptId,
|
|
|
- empId,
|
|
|
- empName,
|
|
|
- startDate,
|
|
|
- endDate
|
|
|
- } = item;
|
|
|
- if (empId && startDate && endDate) {
|
|
|
- baseEmpList.push({
|
|
|
- checkId,
|
|
|
- deptId,
|
|
|
- empId,
|
|
|
- empName,
|
|
|
- startDate: startDate || '',
|
|
|
- endDate: endDate || ''
|
|
|
- });
|
|
|
- if (this.multiple === 'true') { // 批量分配
|
|
|
- changePlanList.push({
|
|
|
- index: i, // 第一次计划修改的下标
|
|
|
- baseEmpListIndex: baseEmpList.length - 1,
|
|
|
- startDiffTimestamp: (startDate && planStartTimestamp != -1) ? this
|
|
|
- .dateToTimestamp(startDate) - planStartTimestamp : -1, // 开始时间差
|
|
|
- endDifTimestamp: (endDate && planStartTimestamp != -1) ? this
|
|
|
- .dateToTimestamp(endDate) - planStartTimestamp : -1 // 结束时间差
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- if (this.multiple === 'true') { // 批量分配
|
|
|
- this.$store.dispatch({
|
|
|
- type: 'planList/commActions',
|
|
|
- payload: {
|
|
|
- key: 'planList',
|
|
|
- data: {
|
|
|
- situationId: this.situationId
|
|
|
- }
|
|
|
- }
|
|
|
- }).then((planList) => {
|
|
|
- (planList || []).map(((planItem, planI) => {
|
|
|
- if (planI != 0) { // 过滤掉第一条
|
|
|
- // 计划开始时间戳
|
|
|
- let planStartTimestamp = planItem.startDate ? this.dateToTimestamp(
|
|
|
- planItem.startDate + ' 00:00') : -1;
|
|
|
- // 计划结束时间戳
|
|
|
- let planEndTimestamp = planItem.endDate ? this.dateToTimestamp(planItem
|
|
|
- .endDate + ' 23:59') : -1;
|
|
|
-
|
|
|
- planItem.empList && planItem.empList.map((empItem, empI) => {
|
|
|
- // 当前分配明细
|
|
|
- let currentEmp = changePlanList.find(item => item.index ===
|
|
|
- empI);
|
|
|
- if (currentEmp) {
|
|
|
- const {
|
|
|
- baseEmpListIndex,
|
|
|
- startDiffTimestamp,
|
|
|
- endDifTimestamp
|
|
|
- } = currentEmp;
|
|
|
- const {
|
|
|
- empId,
|
|
|
- empName
|
|
|
- } = baseEmpList[baseEmpListIndex] || {};
|
|
|
- multipleEmpList.push({
|
|
|
- empId,
|
|
|
- empName,
|
|
|
- checkId: empItem.checkId,
|
|
|
- deptId: empItem.deptId,
|
|
|
- startDate: (planStartTimestamp > -1 &&
|
|
|
- startDiffTimestamp > -1) ?
|
|
|
- this.getDateStr(planStartTimestamp,
|
|
|
- planEndTimestamp,
|
|
|
- startDiffTimestamp, planItem
|
|
|
- .endDate) : '',
|
|
|
- endDate: (planStartTimestamp > -1 &&
|
|
|
- endDifTimestamp > -1) ?
|
|
|
- this.getDateStr(planStartTimestamp,
|
|
|
- planEndTimestamp, endDifTimestamp,
|
|
|
- planItem.endDate) : ''
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }))
|
|
|
- multipleEmpList = [...baseEmpList, ...multipleEmpList];
|
|
|
- // console.log('批量',multipleEmpList )
|
|
|
- this.batchDistribute(multipleEmpList);
|
|
|
- })
|
|
|
- } else { // 单个分配
|
|
|
- this.batchDistribute(baseEmpList);
|
|
|
- }
|
|
|
+ // 完成
|
|
|
+ submit(){
|
|
|
+ const hadDistributionList = this.checkList.filter((item,index)=>{
|
|
|
+ return item.isDistribution||item.empId;
|
|
|
+ });
|
|
|
+ const commitData = hadDistributionList.map(item=>({
|
|
|
+ "checkId": item.checkId,
|
|
|
+ "deptId": item.deptId,
|
|
|
+ "empId":item.empId,
|
|
|
+ "empName":item.empName,
|
|
|
+ "startDate":item.startDate,
|
|
|
+ "endDate": item.endDate,
|
|
|
+ "categoryIds":item.categoryIds
|
|
|
+
|
|
|
+ }));
|
|
|
+ // console.log({commitData});
|
|
|
+ this.batchDistribute(commitData);
|
|
|
+
|
|
|
},
|
|
|
+ // submit1() {
|
|
|
+ // // baseEmpList: 第一次计划修改的数据; changePlanList: 批量分配,记录第一次计划修改数据的信息; multipleEmpList: 批量修改的数据
|
|
|
+ // let baseEmpList = [],
|
|
|
+ // changePlanList = [],
|
|
|
+ // multipleEmpList = [];
|
|
|
+ // // planStartTimestamp: 开始计划时间戳;
|
|
|
+ // let planStartTimestamp = this.dateToTimestamp(this.startDate);
|
|
|
+
|
|
|
+ // this.checkList.map((item, i) => {
|
|
|
+ // const {
|
|
|
+ // checkId,
|
|
|
+ // deptId,
|
|
|
+ // empId,
|
|
|
+ // empName,
|
|
|
+ // categoryIds,
|
|
|
+ // startDate,
|
|
|
+ // endDate
|
|
|
+ // } = item;
|
|
|
+
|
|
|
+ // if (empId && startDate && endDate) {
|
|
|
+ // baseEmpList.push({
|
|
|
+ // checkId,
|
|
|
+ // deptId,
|
|
|
+ // empId,
|
|
|
+ // empName,
|
|
|
+ // categoryIds,
|
|
|
+ // startDate: startDate || '',
|
|
|
+ // endDate: endDate || ''
|
|
|
+ // });
|
|
|
+ // if (this.multiple === 'true') { // 批量分配
|
|
|
+ // changePlanList.push({
|
|
|
+ // index: i, // 第一次计划修改的下标
|
|
|
+ // empId,
|
|
|
+ // empName,
|
|
|
+ // categoryIds,
|
|
|
+ // baseEmpListIndex: baseEmpList.length - 1,
|
|
|
+ // startDiffTimestamp: (startDate && planStartTimestamp != -1) ? this
|
|
|
+ // .dateToTimestamp(startDate) - planStartTimestamp : -1, // 开始时间差
|
|
|
+ // endDifTimestamp: (endDate && planStartTimestamp != -1) ? this
|
|
|
+ // .dateToTimestamp(endDate) - planStartTimestamp : -1 // 结束时间差
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // console.log({changePlanList,baseEmpList});
|
|
|
+ // return;
|
|
|
+ // if (this.multiple === 'true') { // 批量分配
|
|
|
+ // this.$store.dispatch({
|
|
|
+ // type: 'planList/commActions',
|
|
|
+ // payload: {
|
|
|
+ // key: 'planList',
|
|
|
+ // data: {
|
|
|
+ // situationId: this.situationId
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }).then((planList) => {
|
|
|
+ // (planList || []).map(((planItem, planI) => {
|
|
|
+ // if (planI != 0) { // 过滤掉第一条
|
|
|
+ // // 计划开始时间戳
|
|
|
+ // let planStartTimestamp = planItem.startDate ? this.dateToTimestamp(
|
|
|
+ // planItem.startDate + ' 00:00') : -1;
|
|
|
+ // // 计划结束时间戳
|
|
|
+ // let planEndTimestamp = planItem.endDate ? this.dateToTimestamp(planItem
|
|
|
+ // .endDate + ' 23:59') : -1;
|
|
|
+
|
|
|
+ // planItem.empList && planItem.empList.map((empItem, empI) => {
|
|
|
+ // // 当前分配明细
|
|
|
+ // let currentEmp = changePlanList.find(item => item.index ===
|
|
|
+ // empI);
|
|
|
+ // if (currentEmp) {
|
|
|
+ // const {
|
|
|
+ // baseEmpListIndex,
|
|
|
+ // startDiffTimestamp,
|
|
|
+ // endDifTimestamp
|
|
|
+ // } = currentEmp;
|
|
|
+ // const {
|
|
|
+ // categoryIds,
|
|
|
+ // empId,
|
|
|
+ // empName,
|
|
|
+ // } = baseEmpList[baseEmpListIndex] || {};
|
|
|
+
|
|
|
+ // multipleEmpList.push({
|
|
|
+ // categoryIds,
|
|
|
+ // empId,
|
|
|
+ // empName,
|
|
|
+ // checkId: empItem.checkId,
|
|
|
+ // deptId: empItem.deptId,
|
|
|
+ // startDate: (planStartTimestamp > -1 &&
|
|
|
+ // startDiffTimestamp > -1) ?
|
|
|
+ // this.getDateStr(planStartTimestamp,
|
|
|
+ // planEndTimestamp,
|
|
|
+ // startDiffTimestamp, planItem
|
|
|
+ // .endDate) : '',
|
|
|
+ // endDate: (planStartTimestamp > -1 &&
|
|
|
+ // endDifTimestamp > -1) ?
|
|
|
+ // this.getDateStr(planStartTimestamp,
|
|
|
+ // planEndTimestamp, endDifTimestamp,
|
|
|
+ // planItem.endDate) : ''
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }))
|
|
|
+ // multipleEmpList = [...baseEmpList, ...multipleEmpList];
|
|
|
+ // // console.log('批量',multipleEmpList,baseEmpList);
|
|
|
+ // // return;
|
|
|
+ // this.batchDistribute(multipleEmpList);
|
|
|
+ // })
|
|
|
+ // } else { // 单个分配
|
|
|
+ // this.batchDistribute(baseEmpList);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
/**
|
|
|
* 获取时间字符串
|
|
|
* @param {Number} startTimestamp 计划开始时间戳
|