Compare commits

..

3 Commits

6 changed files with 142 additions and 43 deletions

View File

@ -121,6 +121,11 @@ export default {
showOverflowtooltip: true, showOverflowtooltip: true,
filter: parseTime, filter: parseTime,
}, },
{
prop: 'checkPeriod',
label: '巡检频率(天/次)',
showOverflowtooltip: true,
},
{ {
width: 144, width: 144,
prop: 'confirmTimeLimit', prop: 'confirmTimeLimit',

View File

@ -50,6 +50,31 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </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-col>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" /> <el-input v-model="dataForm.remark" placeholder="请输入备注" />
@ -71,7 +96,9 @@ export default {
id: null, id: null,
name: null, name: null,
departmentId: null, departmentId: null,
groupClass: null, groupClass: [],
checkPerson: [],
planCheckTime: null,
// special: true, // special: true,
}, },
dataRule: { dataRule: {
@ -82,6 +109,7 @@ export default {
equipmentOptions: [], equipmentOptions: [],
groupOptions: [], groupOptions: [],
departmentOptions: [], departmentOptions: [],
inspectorOptions: [],
}; };
}, },
mounted() { mounted() {
@ -93,7 +121,9 @@ export default {
id: null, id: null,
name: null, name: null,
departmentId: null, departmentId: null,
groupClass: null, groupClass: [],
checkPerson: [],
planCheckTime: null,
// special: true, // special: true,
}; };
}, },
@ -120,6 +150,31 @@ export default {
value: item.id, 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; this.formLoading = false;
} catch (err) { } catch (err) {
this.formLoading = false; this.formLoading = false;
@ -129,6 +184,8 @@ export default {
async init(row) { async init(row) {
if (!row || !row.id) { if (!row || !row.id) {
/** 新增 */
this.dataForm.checkPerson = [this.$store.getters.nickname];
return; return;
} }
const res = await this.$axios({ const res = await this.$axios({
@ -176,7 +233,7 @@ export default {
status: 1, status: 1,
// status: confirmed ? 2 : 1, // status: confirmed ? 2 : 1,
groupClass: this.dataForm.groupClass?.join(','), groupClass: this.dataForm.groupClass?.join(','),
checkPerson: this.$store.getters.nickname, checkPerson: this.dataForm.checkPerson?.join(','),
}, },
}); });
if (res.code == 0) { if (res.code == 0) {

View File

@ -496,6 +496,9 @@ export default {
this.form[key] = res.data[key]; this.form[key] = res.data[key];
} }
}); });
if (!res.data.checkPerson || res.data.checkPerson.trim() == '') {
this.form.checkPerson = [this.$store.getters.nickname];
}
this.formLoading = false; this.formLoading = false;
} }
this.formLoading = false; this.formLoading = false;
@ -550,7 +553,7 @@ export default {
inspectorList = inspectorList.concat( inspectorList = inspectorList.concat(
workerlist.data.map((item) => ({ workerlist.data.map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.name,
})) }))
); );
} }

View File

@ -257,10 +257,17 @@ export default {
this.$message.warning('请选择待确认的巡检单'); this.$message.warning('请选择待确认的巡检单');
return; return;
} }
const res = await this.$axios({ let checkPersonParam = '';
if (!row.checkPerson || row.checkPerson.trim() == '') {
/** 如有必要,更新巡检人 */
checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
}
const res = this.$axios({
url: url:
'/base/equipment-check-order/confirm?confirmPerson=' + `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` +
this.$store.getters.userId, checkPersonParam,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put', method: 'put',
data: this.$refs['check-order-list-table'].selectedOrder.map( data: this.$refs['check-order-list-table'].selectedOrder.map(
(item) => item.id (item) => item.id
@ -301,7 +308,11 @@ export default {
/** 按钮、选择权限 */ /** 按钮、选择权限 */
checkConfirmPermission(row) { checkConfirmPermission(row) {
const isAdmin = false; // const isAdmin = false; //
return !row.confirmDueTime || row.confirmDueTime >= new Date().getTime() || isAdmin; return (
!row.confirmDueTime ||
row.confirmDueTime >= new Date().getTime() ||
isAdmin
);
}, },
/** 编辑 */ /** 编辑 */
@ -318,10 +329,16 @@ export default {
this.$modal this.$modal
.confirm('是否确认巡检单"' + row.name + '"?') .confirm('是否确认巡检单"' + row.name + '"?')
.then(() => { .then(() => {
let checkPersonParam = '';
if (!row.checkPerson || row.checkPerson.trim() == '') {
/** 如有必要,更新巡检人 */
checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
}
return this.$axios({ return this.$axios({
url: url:
'/base/equipment-check-order/confirm?confirmPerson=' + `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` +
this.$store.getters.nickname, checkPersonParam,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''), // '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put', method: 'put',
data: [id], data: [id],

View File

@ -30,37 +30,37 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检单名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
{{ form.name }} <div style="">{{ form.name }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="部门" prop="department"> <el-form-item label="部门" prop="department">
{{ form.department }} <div style="">{{ form.department }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="班次" prop="groupClass"> <el-form-item label="班次" prop="groupClass">
{{ form.groupClass }} <div style="">{{ form.groupClass || '---' }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检人" prop="checkPerson"> <el-form-item label="巡检人" prop="checkPerson">
{{ form.checkPerson }} <div style="">{{ form.checkPerson || '---' }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检时间" prop="planCheckTime"> <el-form-item label="巡检时间" prop="planCheckTime">
{{ form.planCheckTime | parseTime }} <div style="">{{ form.planCheckTime | parseTime }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="确认人" prop="confirmPerson"> <el-form-item label="确认人" prop="confirmPerson">
{{ form.confirmPerson }} <div style="">{{ form.confirmPerson || '---' }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -15,33 +15,17 @@
v-loading="formLoading" v-loading="formLoading"
label-position="top"> label-position="top">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col> <el-col :span="12">
<el-form-item label="巡检单名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入巡检单名称" /> <el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col> <el-col :span="12">
<el-form-item label="巡检单编码" prop="code"> <el-form-item label="巡检单编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入巡检单编码" /> <el-input v-model="dataForm.code" placeholder="请输入巡检单编码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col> <el-col :span="12">
<el-form-item
label="部门"
prop="departmentId"
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
<el-select
v-model="dataForm.departmentId"
:placeholder="`请选择部门`">
<el-option
v-for="opt in departmentOptions"
: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-form-item label="计划巡检时间" prop="planCheckTime">
<el-date-picker <el-date-picker
v-model="dataForm.planCheckTime" v-model="dataForm.planCheckTime"
@ -51,15 +35,24 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="确认时限 (时)" prop="confirmTimeLimit"> <el-form-item label="巡检频率(天/次)" prop="checkPeriod">
<el-input <el-input
v-model="dataForm.confirmTimeLimit" v-model="dataForm.checkPeriod"
:placeholder="`请输入确认时限`" /> placeholder="请输入巡检频率(天/次)" />
<!-- <el-date-picker </el-form-item>
v-model="dataForm.confirmTimeLimit" </el-col>
type="datetime"
:placeholder="`请选择确认时限`" <el-col :span="12">
value-format="timestamp" /> --> <el-form-item label="部门" prop="departmentId">
<el-select
v-model="dataForm.departmentId"
:placeholder="`请选择部门`">
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -79,6 +72,20 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="确认时限 (时)" prop="confirmTimeLimit">
<el-input
v-model="dataForm.confirmTimeLimit"
:placeholder="`请输入确认时限`" />
<!-- <el-date-picker
v-model="dataForm.confirmTimeLimit"
type="datetime"
:placeholder="`请选择确认时限`"
value-format="timestamp" /> -->
</el-form-item>
</el-col>
<el-col> <el-col>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" /> <el-input v-model="dataForm.remark" placeholder="请输入备注" />
@ -125,6 +132,15 @@ export default {
planCheckTime: [ planCheckTime: [
{ required: true, message: '计划巡检时间不能为空', trigger: 'blur' }, { required: true, message: '计划巡检时间不能为空', trigger: 'blur' },
], ],
checkPeriod: [
{ required: true, message: '巡检频率不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字类型',
trigger: 'blur',
transform: (val) => Number(val),
},
],
}, },
equipmentOptions: [], equipmentOptions: [],
groupOptions: [], groupOptions: [],
@ -145,6 +161,7 @@ export default {
confirmTimeLimit: null, confirmTimeLimit: null,
groupClass: null, groupClass: null,
remark: null, remark: null,
checkPeriod: null
// special: true, // special: true,
}; };
}, },