This commit is contained in:
lb
2024-03-01 11:16:53 +08:00
parent c66e82b152
commit 4c41d6fad9
6 changed files with 142 additions and 43 deletions

View File

@@ -50,6 +50,31 @@
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="巡检人" prop="checkPerson">
<el-select
v-model="dataForm.checkPerson"
:placeholder="`请选择巡检人`"
multiple
clearable
filterable>
<el-option
v-for="opt in inspectorOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="巡检时间" prop="planCheckTime">
<el-date-picker
v-model="dataForm.planCheckTime"
type="datetime"
placeholder="请选择计划开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<!-- <el-col>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" />
@@ -71,7 +96,9 @@ export default {
id: null,
name: null,
departmentId: null,
groupClass: null,
groupClass: [],
checkPerson: [],
planCheckTime: null,
// special: true,
},
dataRule: {
@@ -82,6 +109,7 @@ export default {
equipmentOptions: [],
groupOptions: [],
departmentOptions: [],
inspectorOptions: [],
};
},
mounted() {
@@ -93,7 +121,9 @@ export default {
id: null,
name: null,
departmentId: null,
groupClass: null,
groupClass: [],
checkPerson: [],
planCheckTime: null,
// special: true,
};
},
@@ -120,6 +150,31 @@ export default {
value: item.id,
}));
}
/** get user list and worker list */
let inspectorList = [];
const userlist = await this.$axios({
url: '/system/user/page',
params: { pageNo: 1, pageSize: 100 },
});
if (userlist.code == 0) {
inspectorList = inspectorList.concat(
(userlist.data?.list || []).map((item) => ({
label: item.nickname,
value: item.nickname,
}))
);
}
const workerlist = await this.$axios('/base/core-worker/listAll');
if (workerlist.code == 0) {
inspectorList = inspectorList.concat(
workerlist.data.map((item) => ({
label: item.name,
value: item.name,
}))
);
}
this.inspectorOptions = inspectorList;
/** endget */
this.formLoading = false;
} catch (err) {
this.formLoading = false;
@@ -129,6 +184,8 @@ export default {
async init(row) {
if (!row || !row.id) {
/** 新增 */
this.dataForm.checkPerson = [this.$store.getters.nickname];
return;
}
const res = await this.$axios({
@@ -176,7 +233,7 @@ export default {
status: 1,
// status: confirmed ? 2 : 1,
groupClass: this.dataForm.groupClass?.join(','),
checkPerson: this.$store.getters.nickname,
checkPerson: this.dataForm.checkPerson?.join(','),
},
});
if (res.code == 0) {