projects/mesxc-lb #205
@ -16,12 +16,12 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="保养计划单号"
|
||||
prop="code"
|
||||
prop="maintainOrderNumber"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入保养计划单号', trigger: 'blur' },
|
||||
]">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
v-model="form.maintainOrderNumber"
|
||||
@change="$emit('update', form)"
|
||||
:placeholder="`请输入保养计划单号`"
|
||||
:disabled="disabled" />
|
||||
@ -102,13 +102,13 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划开始时间" prop="firstMaintenanceTime">
|
||||
<el-form-item label="计划开始时间" prop="planStartTime">
|
||||
<el-input value="---" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划结束时间" prop="firstMaintenanceTime">
|
||||
<el-form-item label="计划结束时间" prop="planEndTime">
|
||||
<el-input value="---" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -116,12 +116,12 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际开始时间"
|
||||
prop="firstMaintenanceTime"
|
||||
prop="startTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际开始时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
v-model="form.startTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择实际开始时间"
|
||||
@ -133,12 +133,12 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际结束时间"
|
||||
prop="firstMaintenanceTime"
|
||||
prop="endTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际结束时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
v-model="form.endTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择实际结束时间"
|
||||
@ -150,13 +150,13 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际保养人员"
|
||||
prop="maintainer"
|
||||
prop="maintainWorker"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际保养人员', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.maintainer"
|
||||
:placeholder="`请选择计划保养人员`"
|
||||
v-model="form.maintainWorker"
|
||||
:placeholder="`请选择实际保养人员`"
|
||||
:disabled="disabled"
|
||||
multiple
|
||||
clearable
|
||||
@ -268,7 +268,7 @@ export default {
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
!this.edit && this.getCode('/base/equipment-maintain-plan/getCode');
|
||||
// !this.edit && this.getCode('/base/equipment-maintain-plan/getCode');
|
||||
this.getList('maintainer');
|
||||
this.getList('department');
|
||||
this.getList('line');
|
||||
|
@ -120,6 +120,7 @@ export default {
|
||||
// 'equipmentId',
|
||||
// 'specialType',
|
||||
],
|
||||
tobeConfirmedIdList: [],
|
||||
tableBtn: [
|
||||
// this.$auth.hasPermi('equipment:maintain-record:update')
|
||||
// ? {
|
||||
@ -150,16 +151,51 @@ export default {
|
||||
// },
|
||||
{
|
||||
type: 'selection',
|
||||
prop: '_selection',
|
||||
label: '批量选择',
|
||||
width: 128,
|
||||
selectable: (row, index) => {
|
||||
return index % 2 == 0;
|
||||
},
|
||||
// prop: '_selection',
|
||||
// label: '批量选择',
|
||||
width: 48,
|
||||
subcomponent: {
|
||||
render: (h, { row, index }) => {
|
||||
return <h1>hello</h1>;
|
||||
// return <el-checkbox v-model={this.$refs.table.selection} />
|
||||
props: ['injectData'],
|
||||
data() {
|
||||
return {
|
||||
outside: false,
|
||||
selected: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
selected(val) {
|
||||
if (!this.outside) {
|
||||
console.log("emit row-selected...")
|
||||
this.$emit('emitData', {
|
||||
action: 'row-selected',
|
||||
value: {
|
||||
row: this.injectData,
|
||||
selected: val,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
injectData: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler: function (val) {
|
||||
this.outside = true;
|
||||
this.selected = !!((val._selection & 0b01) != 0);
|
||||
this.$nextTick(() => {
|
||||
this.outside = false;
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
render(h) {
|
||||
const enabled = 0b10 & this.injectData._selection;
|
||||
// return this.injectData?._selection ? h('h1', null, 'hello') : h('h1', null, '1');
|
||||
return (
|
||||
<div>
|
||||
<span>{this.selected}</span>
|
||||
<el-checkbox disabled={!enabled} v-model={this.selected} />
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -397,6 +433,15 @@ export default {
|
||||
allSpecialEquipments: [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
tobeConfirmedIdList: {
|
||||
handler(val) {
|
||||
if (val.length == this.list.length) {
|
||||
this.$refs['table'].toggleAllSelection();
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.initSearchBar();
|
||||
// if (this.$route.query) {
|
||||
@ -426,7 +471,31 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleSelectionChange(list) {
|
||||
console.log('handleSelectionChange', list);
|
||||
if (this.tobeConfirmedIdList.length) {
|
||||
this.tobeConfirmedIdList = [];
|
||||
this.list.forEach((item) => {
|
||||
this.handleEmitFun({
|
||||
action: 'row-selected',
|
||||
value: { row: item, selected: false },
|
||||
});
|
||||
});
|
||||
console.log(
|
||||
'清空选择列表',
|
||||
this.list.map((item) => item._selection)
|
||||
);
|
||||
} else {
|
||||
this.tobeConfirmedIdList = list.map((item) => item.id);
|
||||
this.list.forEach((item) => {
|
||||
this.handleEmitFun({
|
||||
action: 'row-selected',
|
||||
value: { row: item, selected: true },
|
||||
});
|
||||
});
|
||||
console.log(
|
||||
'全选',
|
||||
this.list.map((item) => item._selection)
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
handleEmitFun({ action, value }) {
|
||||
@ -441,6 +510,18 @@ export default {
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'row-selected':
|
||||
if (value.selected) {
|
||||
this.tobeConfirmedIdList.push(value.row.id);
|
||||
value.row._selection = 0b11;
|
||||
} else {
|
||||
const index = this.tobeConfirmedIdList.indexOf(value.row.id);
|
||||
if (index != -1) {
|
||||
this.tobeConfirmedIdList.splice(index, 1);
|
||||
}
|
||||
}
|
||||
console.log('tobeConfirmedIdList', this.tobeConfirmedIdList);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@ -455,16 +536,6 @@ export default {
|
||||
);
|
||||
}
|
||||
},
|
||||
// setSearchBarEquipmentList(eqList) {
|
||||
// this.$set(
|
||||
// this.searchBarFormConfig[1],
|
||||
// 'selectOptions',
|
||||
// eqList.map((item) => ({
|
||||
// name: item.name,
|
||||
// id: item.id,
|
||||
// }))
|
||||
// );
|
||||
// },
|
||||
initSearchBar() {
|
||||
// this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
|
||||
// this.allSpecialEquipments = data.filter((item) => item.special);
|
||||
@ -490,28 +561,20 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
this.recv({ ...this.queryParams, special: true, confirmed: false }).then(
|
||||
(response) => {
|
||||
this.list =
|
||||
// [
|
||||
// {
|
||||
// id: 213,
|
||||
// maintainOrderNumber: 123,
|
||||
// planName: 'hhh',
|
||||
// departmentName: 'asdf',
|
||||
// lineName: 456,
|
||||
// planStartTime: '2024-01-01',
|
||||
// planEndTime: '2024-01-01',
|
||||
// startTime: '2024-01-01',
|
||||
// endTime: '2024-01-01',
|
||||
// relatePlan: 1,
|
||||
// },
|
||||
// ];
|
||||
response.data.list;
|
||||
this.recv({
|
||||
...this.queryParams,
|
||||
special: true,
|
||||
relatePlan: 2,
|
||||
confirmed: false,
|
||||
}).then((response) => {
|
||||
this.list = response.data.list.map((item) => ({
|
||||
...item,
|
||||
planName: '---',
|
||||
_selection: 0b10,
|
||||
}));
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
@ -524,22 +587,13 @@ export default {
|
||||
this.form = {
|
||||
id: null,
|
||||
relatePlan: null,
|
||||
maintainPlanId: null,
|
||||
equipmentId: null,
|
||||
maintainWorker: [],
|
||||
maintainOrderNumber: null,
|
||||
departmentId: null,
|
||||
lineId: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
timeUsed: null,
|
||||
remark: null,
|
||||
maintenanceDes: null,
|
||||
files: [
|
||||
// {
|
||||
// fileName: '',
|
||||
// fileType: '',
|
||||
// fileUrl: '',
|
||||
// },
|
||||
],
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
@ -556,32 +610,32 @@ export default {
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
if (this.$route.query.addRecord) {
|
||||
// 赋值
|
||||
const tempRow = this.$route.query.row;
|
||||
this.form.equipmentId = tempRow.equipmentId;
|
||||
this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2;
|
||||
this.form.startTime = tempRow.nextMaintainTime;
|
||||
this.form.maintainPlanId = tempRow.id;
|
||||
// await (() => {
|
||||
// return new Promise((acpt, rejt) => {
|
||||
// this.form.relatePlan =
|
||||
// this.$route.query.relatePlan ||
|
||||
// (tempRow.nextMaintainTime ? 1 : 2);
|
||||
// this.form.startTime = tempRow.nextMaintainTime;
|
||||
// acpt();
|
||||
// });
|
||||
// })();
|
||||
// this.$nextTick(() => {
|
||||
// this.form.maintainPlanId = tempRow.id;
|
||||
// if (this.$route.query.addRecord) {
|
||||
// // 赋值
|
||||
// const tempRow = this.$route.query.row;
|
||||
// this.form.equipmentId = tempRow.equipmentId;
|
||||
// });
|
||||
}
|
||||
if (this.$route.query.isAdd) {
|
||||
// 赋值
|
||||
this.form.equipmentId = this.$route.query.equipmentId;
|
||||
this.form.maintainPlanId = this.$route.query.maintainPlanId;
|
||||
}
|
||||
// this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2;
|
||||
// this.form.startTime = tempRow.nextMaintainTime;
|
||||
// this.form.maintainPlanId = tempRow.id;
|
||||
// // await (() => {
|
||||
// // return new Promise((acpt, rejt) => {
|
||||
// // this.form.relatePlan =
|
||||
// // this.$route.query.relatePlan ||
|
||||
// // (tempRow.nextMaintainTime ? 1 : 2);
|
||||
// // this.form.startTime = tempRow.nextMaintainTime;
|
||||
// // acpt();
|
||||
// // });
|
||||
// // })();
|
||||
// // this.$nextTick(() => {
|
||||
// // this.form.maintainPlanId = tempRow.id;
|
||||
// // this.form.equipmentId = tempRow.equipmentId;
|
||||
// // });
|
||||
// }
|
||||
// if (this.$route.query.isAdd) {
|
||||
// // 赋值
|
||||
// this.form.equipmentId = this.$route.query.equipmentId;
|
||||
// this.form.maintainPlanId = this.$route.query.maintainPlanId;
|
||||
// }
|
||||
this.open = true;
|
||||
this.title = '添加待确认保养记录';
|
||||
},
|
||||
@ -607,6 +661,8 @@ export default {
|
||||
this.put({
|
||||
...this.form,
|
||||
maintainWorker: this.form.maintainWorker.join(','),
|
||||
special: true,
|
||||
relatePlan: 2,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
@ -618,26 +674,29 @@ export default {
|
||||
this.post({
|
||||
...this.form,
|
||||
maintainWorker: this.form.maintainWorker.join(','),
|
||||
special: true,
|
||||
relatePlan: 2,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
|
||||
// 跳转至 备品备件 保养
|
||||
const toSparePartsMaintain = () => {
|
||||
this.open = false;
|
||||
// 没有备品备件保养模块。。。
|
||||
};
|
||||
// const toSparePartsMaintain = () => {
|
||||
// this.open = false;
|
||||
// };
|
||||
|
||||
this.$confirm('是否有备品备件更换?', '提示', {
|
||||
confirmButtonText: '有',
|
||||
cancelButtonText: '没有',
|
||||
})
|
||||
.then(toSparePartsMaintain)
|
||||
.catch(() => {
|
||||
// this.$confirm('是否有备品备件更换?', '提示', {
|
||||
// confirmButtonText: '有',
|
||||
// cancelButtonText: '没有',
|
||||
// })
|
||||
// .then(toSparePartsMaintain)
|
||||
// .catch(() => {
|
||||
// this.open = false;
|
||||
// this.getList();
|
||||
// });
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
|
Loading…
Reference in New Issue
Block a user