update 待确认

This commit is contained in:
lb 2024-02-23 15:11:36 +08:00
parent 99b225e3dc
commit f72cd9d68e
5 changed files with 81 additions and 150 deletions

View File

@ -64,7 +64,7 @@
label="确认截止时间" label="确认截止时间"
prop="confirmDueTime"> prop="confirmDueTime">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.confirmDueTime || '---' }} {{ scope.row.confirmDueTime | timeFilter }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column

View File

@ -142,12 +142,27 @@ export default {
} }
}, },
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async dataFormSubmit() { async dataFormSubmit() {
let valid = false; let valid = false;
try { try {
valid = await this.$refs.form.validate(); valid = await this.$refs.form.validate();
} catch (err) {} } catch (err) {}
if (!valid) return; if (!valid) return;
let confirmed = false;
try {
confirmed = await this.getConfirmed();
} catch (err) {
confirmed = false;
}
const res = await this.$axios({ const res = await this.$axios({
url: url:
'/base/equipment-check-order' + '/base/equipment-check-order' +
@ -156,8 +171,9 @@ export default {
data: { data: {
...this.dataForm, ...this.dataForm,
special: true, special: true,
status: 1, status: confirmed ? 2 : 1,
groupClass: this.dataForm.groupClass.join(','), groupClass: this.dataForm.groupClass.join(','),
checkPerson: this.$store.getters.userId,
}, },
}); });
if (res.code == 0) { if (res.code == 0) {

View File

@ -71,16 +71,14 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="巡检人" prop="checkPerson">
label="巡检人" <!-- :rules="[
prop="checkPerson"
:rules="[
{ {
required: true, required: true,
message: '请选择巡检人', message: '请选择巡检人',
trigger: 'blur', trigger: 'blur',
}, },
]"> ]" -->
<el-select <el-select
v-model="form.checkPerson" v-model="form.checkPerson"
:placeholder="`请选择巡检人`" :placeholder="`请选择巡检人`"
@ -97,9 +95,9 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检时间" prop="planStartTime"> <el-form-item label="巡检时间" prop="planCheckTime">
<el-date-picker <el-date-picker
v-model="form.planStartTime" v-model="form.planCheckTime"
type="datetime" type="datetime"
placeholder="请选择计划开始时间" placeholder="请选择计划开始时间"
value-format="timestamp"></el-date-picker> value-format="timestamp"></el-date-picker>
@ -157,7 +155,9 @@
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">保存</el-button> <el-button type="primary" :loading="btnLoading" @click="handleConfirm">
保存
</el-button>
</div> </div>
</div> </div>
@ -230,7 +230,7 @@ export default {
label: '巡检项目', label: '巡检项目',
}, },
{ {
prop: 'maintenanceDes', prop: 'checkResult',
label: '巡检结果', label: '巡检结果',
}, },
], ],
@ -239,10 +239,10 @@ export default {
attrTitle: '', attrTitle: '',
attrForm: { attrForm: {
id: null, id: null,
logId: null, orderId: null,
program: null, program: null,
maintenanceDes: null, checkResult: null,
remark: null, equipmentId: null,
}, },
attrFormVisible: false, attrFormVisible: false,
attrRows: [ attrRows: [
@ -252,12 +252,6 @@ export default {
label: '设备名称', label: '设备名称',
prop: 'equipmentId', prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true', url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true',
// method: 'post',
// queryParams: {
// pageNo: 1,
// pageSize: 100,
// special: true,
// },
rules: [ rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' }, { required: true, message: '设备不能为空', trigger: 'blur' },
], ],
@ -266,22 +260,21 @@ export default {
[ [
{ {
input: true, input: true,
label: '保养项目', label: '巡检项目',
prop: 'program', prop: 'program',
rules: [
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
{ {
input: true, input: true,
label: '保养描述', label: '巡检结果',
prop: 'maintenanceDes', prop: 'checkResult',
}, rules: [
], { required: true, message: '巡检结果不能为空', trigger: 'blur' },
[ ],
{
input: true,
label: '备注',
prop: 'remark',
}, },
], ],
], ],
@ -333,6 +326,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.formLoading = true;
this.getList('department'); this.getList('department');
this.getList('groupClass'); this.getList('groupClass');
this.getList('inspector'); this.getList('inspector');
@ -360,12 +354,12 @@ export default {
this.btnLoading = true; this.btnLoading = true;
this.$nextTick(async () => { this.$nextTick(async () => {
const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
url: '/base/equipment-maintain-log/update', url: '/base/equipment-check-order/update',
method: 'put', method: 'put',
data: { data: {
...this.form, ...this.form,
maintainWorker: this.form.maintainWorker.join(','), groupClass: this.form.groupClass.join(','),
planMaintainWorker: this.form.planMaintainWorker?.join(','), checkPerson: this.form.checkPerson.join(','),
}, },
}); });
if (code == 0) { if (code == 0) {
@ -385,19 +379,18 @@ export default {
console.log('row', row); console.log('row', row);
this.visible = true; this.visible = true;
this.row = row; this.row = row;
// this.getInfo(row); this.getInfo(row);
// this.getAttrList(row); this.getAttrList(row);
}, },
async getInfo(row) { async getInfo(row) {
this.formLoading = true;
const res = await this.$axios( const res = await this.$axios(
'/base/equipment-maintain-log/get?id=' + row.id '/base/equipment-check-order/get?id=' + row.id
); );
if (res.code == 0) { if (res.code == 0) {
this.form = res.data; this.form = res.data;
this.form.maintainWorker = res.data.maintainWorker.split(','); this.form.groupClass = res.data.groupClass.split(',');
this.form.planMaintainWorker = res.data.planMaintainWorker?.split(','); this.form.checkPerson = res.data.checkPerson.split(',');
this.formLoading = false; this.formLoading = false;
} }
this.formLoading = false; this.formLoading = false;
@ -407,11 +400,11 @@ export default {
if (!row) row = this.row; if (!row) row = this.row;
this.attrListLoading = true; this.attrListLoading = true;
const res = await this.$axios({ const res = await this.$axios({
url: '/base/equipment-maintain-log-det/page', url: '/base/equipment-check-order-det/page',
method: 'get', method: 'get',
params: { params: {
...this.attrQuery.params, ...this.attrQuery.params,
logId: row.id, orderId: row.id,
...condition, ...condition,
}, },
}); });
@ -456,11 +449,14 @@ export default {
})) }))
); );
} }
this.inspectorOptions = inspectorList; this.inspectorOptions = inspectorList;
break; break;
case 'groupClass': case 'groupClass':
res = await this.$axios(urls[1]); res = await this.$axios(urls[1]);
this.lineList = res.data || []; this.groupOptions = (res.data || []).map((item) => ({
label: item.name,
value: item.id,
}));
break; break;
} }
this.formLoading = false; this.formLoading = false;
@ -489,10 +485,10 @@ export default {
resetAttrform() { resetAttrform() {
this.attrForm = { this.attrForm = {
id: null, id: null,
logId: this.row.id, orderId: null,
maintenanceDes: '', equipmentId: null,
program: null, program: null,
remark: null, checkResult: null,
}; };
}, },
@ -507,27 +503,27 @@ export default {
// //
async handleEditAttr(attrId) { async handleEditAttr(attrId) {
const res = await this.$axios({ const res = await this.$axios({
url: '/base/equipment-maintain-log-det/get', url: '/base/equipment-check-order-det/get',
method: 'get', method: 'get',
params: { id: attrId }, params: { id: attrId },
}); });
if (res.code == 0) { if (res.code == 0) {
this.attrForm = res.data; this.attrForm = res.data;
this.attrTitle = '编辑设备属性'; this.attrTitle = '编辑巡检单详情';
this.attrFormVisible = true; this.attrFormVisible = true;
} }
}, },
// //
handleDeleteAttr(attrId) { handleDeleteAttr(attrId) {
this.$confirm('确定删除该保养内容?', '提示', { this.$confirm('确定删除该巡检内容?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}) })
.then(async () => { .then(async () => {
const res = await this.$axios({ const res = await this.$axios({
url: '/base/equipment-maintain-log-det/delete?id=' + attrId, url: '/base/equipment-check-order-det/delete?id=' + attrId,
method: 'delete', method: 'delete',
}); });
if (res.code == 0) { if (res.code == 0) {
@ -556,10 +552,10 @@ export default {
this.attrFormSubmitting = true; this.attrFormSubmitting = true;
const res = await this.$axios({ const res = await this.$axios({
url: isEdit url: isEdit
? '/base/equipment-maintain-log-det/update' ? '/base/equipment-check-order-det/update'
: '/base/equipment-maintain-log-det/create', : '/base/equipment-check-order-det/create',
method: isEdit ? 'put' : 'post', method: isEdit ? 'put' : 'post',
data: this.attrForm, data: { ...this.attrForm, orderId: this.row.id },
}); });
if (res.code == 0) { if (res.code == 0) {

View File

@ -11,25 +11,8 @@
<SearchBar <SearchBar
:formConfigs="searchBarFormConfig" :formConfigs="searchBarFormConfig"
ref="search-bar" ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" /> @headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<!-- <base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="180"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table> -->
<CheckOrderListTable <CheckOrderListTable
ref="check-order-list-table" ref="check-order-list-table"
:table-data="list" :table-data="list"
@ -136,6 +119,7 @@ export default {
prop: 'confirmDueTime', prop: 'confirmDueTime',
label: '确认截止时间', label: '确认截止时间',
showOverflowtooltip: true, showOverflowtooltip: true,
filter: parseTime,
// filter: (val) => // filter: (val) =>
// val != null && val > 24 // val != null && val > 24
// ? `${(val - (val % 24)) / 24}${val % 24}` // ? `${(val - (val % 24)) / 24}${val % 24}`
@ -207,28 +191,19 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs.add.dataFormSubmit(); this.$refs.add.dataFormSubmit();
}, },
successSubmit() { successSubmit() {
this.cancel(); this.cancel();
this.getList(); this.getList();
}, },
initSearchBar() { initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.allSpecialEquipments = data.filter((item) => item.special); this.allSpecialEquipments = data.filter((item) => item.special);
this.setSearchBarEquipmentList(data.filter((item) => item.special)); this.setSearchBarEquipmentList(data.filter((item) => item.special));
}); });
}, },
//
handleSearchBarChange({ param, value }) {
if ('specialType' === param) {
if (!value) {
this.setSearchBarEquipmentList(this.allSpecialEquipments);
return;
}
this.setSearchBarEquipmentList(
this.allSpecialEquipments.filter((item) => item.specialType == value)
);
}
},
setSearchBarEquipmentList(eqList) { setSearchBarEquipmentList(eqList) {
this.$set( this.$set(
this.searchBarFormConfig[2], this.searchBarFormConfig[2],
@ -239,6 +214,7 @@ export default {
})) }))
); );
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -249,33 +225,20 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.$refs.add.reset(); this.$refs.add.reset();
this.open = false; this.open = false;
this.title = ''; this.title = '';
}, },
/** 表单重置 */
reset() {
this.form = {
id: null,
name: null,
content: null,
program: null,
remark: null,
};
this.resetForm('form');
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.open = true; this.open = true;
@ -284,6 +247,7 @@ export default {
this.$refs.add.init(); this.$refs.add.init();
}); });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.open = true; this.open = true;
@ -292,29 +256,7 @@ export default {
this.$refs.add.init(row); this.$refs.add.init(row);
}); });
}, },
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 编辑 */ /** 编辑 */
handleEdit(row) { handleEdit(row) {
this.editOpen = true; this.editOpen = true;
@ -322,8 +264,10 @@ export default {
this.$refs['content-edit'].init(row); this.$refs['content-edit'].init(row);
}); });
}, },
/** 确认巡检单 */ /** 确认巡检单 */
handleConfirm(row) {}, handleConfirm(row) {},
/** 删除巡检单 */ /** 删除巡检单 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
@ -338,23 +282,7 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
//
handleTableBtnClick({ data, type }) {
switch (type) {
case 'edit':
this.handleUpdate(data);
break;
case 'delete':
this.handleDelete(data);
break;
case 'detail':
this.handleDetail(data);
break;
case 'add':
this.handleAddDetail(data);
break;
}
},
handleDetail(row) { handleDetail(row) {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情'; this.addOrEditTitle = '详情';
@ -362,13 +290,7 @@ export default {
this.$refs.addOrUpdate.init(row?.id, true); this.$refs.addOrUpdate.init(row?.id, true);
}); });
}, },
handleAddDetail(row) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '添加内容';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
// //

View File

@ -278,10 +278,8 @@ export default {
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
actualTime: null,
configId: null,
special: true, special: true,
specialType: null, status: 2,
}, },
// //
form: {}, form: {},
@ -328,8 +326,7 @@ export default {
this.loading = true; this.loading = true;
// //
this.recv(this.queryParams).then((response) => { this.recv(this.queryParams).then((response) => {
// this.list = response.data.list; this.list = response.data.list;
this.list = [{}];
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });