|
@@ -14,7 +14,7 @@
|
|
|
<template v-for="(item, index) in timePeriod">
|
|
|
<el-form-item :label="item.partrolTime" :key="index">
|
|
|
<el-cascader
|
|
|
- :ref="`userName${index}`"
|
|
|
+ :ref="`userName`"
|
|
|
v-model="item.partolUserId"
|
|
|
:props="defaultProps"
|
|
|
:options="findUser"
|
|
@@ -37,6 +37,7 @@ export default {
|
|
|
value: 'id', // 唯一标识
|
|
|
label: 'label', // 标签显示
|
|
|
children: 'children',
|
|
|
+ multiple: true,
|
|
|
emitPath: false
|
|
|
},
|
|
|
formData: {
|
|
@@ -67,28 +68,46 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
findUserToggle(index) {
|
|
|
- let thisObj = this.$refs[`userName${index}`][0].getCheckedNodes()[0];
|
|
|
- this.timePeriod[index].partolName = thisObj.label;
|
|
|
+ // let thisObj = this.$refs[`userName${index}`][0].getCheckedNodes()[0];
|
|
|
+ // this.timePeriod[index].partolName = thisObj.label;
|
|
|
},
|
|
|
submit() {
|
|
|
+ let selectAll = this.$refs[`userName`];
|
|
|
+ let rosterUserDtos = [];
|
|
|
+ selectAll.map((item, index) => {
|
|
|
+ let partolNames = [],
|
|
|
+ partolUserIds = [];
|
|
|
+ item.getCheckedNodes().map((items) => {
|
|
|
+ if (items.level !== 1 && items.children.length == 0) {
|
|
|
+ partolNames.push(items.label);
|
|
|
+ partolUserIds.push(items.value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ rosterUserDtos.push({
|
|
|
+ partolName: partolNames.join(','),
|
|
|
+ partolUserId: partolUserIds.join(','),
|
|
|
+ partrolTime: this.timePeriod[index].partrolTime
|
|
|
+ });
|
|
|
+ });
|
|
|
if (!this.params.isSingle) {
|
|
|
this.$refs['formRu'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.add();
|
|
|
+ this.add(rosterUserDtos);
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- this.add();
|
|
|
+ this.add(rosterUserDtos);
|
|
|
}
|
|
|
},
|
|
|
- add() {
|
|
|
+ add(rosterUserDtos) {
|
|
|
let data = this.params.thisObj;
|
|
|
let initData = {
|
|
|
communityId: data.communityId,
|
|
|
patrolRouteId: data.id,
|
|
|
periodType: data.periodType,
|
|
|
periodValue: data.periodValue,
|
|
|
- rosterUserDtos: this.timePeriod,
|
|
|
+ // rosterUserDtos: this.timePeriod,
|
|
|
+ rosterUserDtos: rosterUserDtos,
|
|
|
partrolDate: this.thisDay.day,
|
|
|
startDate: data.startDate,
|
|
|
endDate: data.endDate
|