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="确认截止时间"
prop="confirmDueTime">
<template slot-scope="scope">
{{ scope.row.confirmDueTime || '---' }}
{{ scope.row.confirmDueTime | timeFilter }}
</template>
</el-table-column>
<el-table-column

View File

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

View File

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

View File

@ -11,25 +11,8 @@
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@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
ref="check-order-list-table"
:table-data="list"
@ -136,6 +119,7 @@ export default {
prop: 'confirmDueTime',
label: '确认截止时间',
showOverflowtooltip: true,
filter: parseTime,
// filter: (val) =>
// val != null && val > 24
// ? `${(val - (val % 24)) / 24}${val % 24}`
@ -207,28 +191,19 @@ export default {
handleSubmit() {
this.$refs.add.dataFormSubmit();
},
successSubmit() {
this.cancel();
this.getList();
},
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.allSpecialEquipments = 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) {
this.$set(
this.searchBarFormConfig[2],
@ -239,6 +214,7 @@ export default {
}))
);
},
/** 查询列表 */
getList() {
this.loading = true;
@ -249,33 +225,20 @@ export default {
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.$refs.add.reset();
this.open = false;
this.title = '';
},
/** 表单重置 */
reset() {
this.form = {
id: null,
name: null,
content: null,
program: null,
remark: null,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.open = true;
@ -284,6 +247,7 @@ export default {
this.$refs.add.init();
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.open = true;
@ -292,29 +256,7 @@ export default {
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) {
this.editOpen = true;
@ -322,8 +264,10 @@ export default {
this.$refs['content-edit'].init(row);
});
},
/** 确认巡检单 */
handleConfirm(row) {},
/** 删除巡检单 */
handleDelete(row) {
const id = row.id;
@ -338,23 +282,7 @@ export default {
})
.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) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
@ -362,13 +290,7 @@ export default {
this.$refs.addOrUpdate.init(row?.id, true);
});
},
handleAddDetail(row) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '添加内容';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});
},
/** 导出按钮操作 */
handleExport() {
//

View File

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