projects/mesxc-dy #216
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2024-02-27 09:41:00
|
||||
* @LastEditTime: 2024-02-28 14:45:58
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -27,13 +27,14 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="巡检单名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
|
||||
<el-input v-model="dataForm.name" :disabled="isdetail" placeholder="请输入巡检单名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="部门" prop="departmentId">
|
||||
<el-select
|
||||
v-model="dataForm.departmentId"
|
||||
:disabled="isdetail"
|
||||
:placeholder="`请选择部门`">
|
||||
<el-option
|
||||
v-for="opt in departmentOptions"
|
||||
@ -50,7 +51,7 @@
|
||||
filterable
|
||||
clearable
|
||||
multiple
|
||||
:disabled="isedit"
|
||||
:disabled="isdetail"
|
||||
style="width: 100%"
|
||||
placeholder="请选择班次">
|
||||
<el-option
|
||||
@ -70,7 +71,7 @@
|
||||
:placeholder="`请选择巡检人`"
|
||||
multiple
|
||||
clearable
|
||||
:disabled="isedit"
|
||||
:disabled="isdetail"
|
||||
filterable>
|
||||
<el-option
|
||||
v-for="opt in inspectorOptions"
|
||||
@ -85,7 +86,7 @@
|
||||
<el-date-picker
|
||||
v-model="dataForm.planCheckTime"
|
||||
type="datetime"
|
||||
:disabled="isedit"
|
||||
:disabled="isdetail"
|
||||
placeholder="请选择巡检时间"
|
||||
value-format="timestamp"></el-date-picker>
|
||||
</el-form-item>
|
||||
@ -142,7 +143,8 @@
|
||||
<div v-if="!isdetail" class="drawer-body__footer">
|
||||
<el-button @click="goback()">取消</el-button>
|
||||
<!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> -->
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
<el-button v-if="isshowConfirm" type="primary" @click="confirmIns()">保存</el-button>
|
||||
<el-button v-else type="primary" @click="dataFormSubmit()">保存</el-button>
|
||||
</div>
|
||||
|
||||
<attr-add
|
||||
@ -205,6 +207,7 @@ export default {
|
||||
tableProps,
|
||||
topBtnConfig,
|
||||
addOrUpdateVisible: false,
|
||||
isshowConfirm: false,
|
||||
urlOptions: {
|
||||
isGetCode: false,
|
||||
createURL: createCheckOrder,
|
||||
@ -398,6 +401,34 @@ export default {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
});
|
||||
},
|
||||
getConfirmed() {
|
||||
return this.$confirm('是否直接确认巡检记录', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
});
|
||||
},
|
||||
async confirmIns() {
|
||||
await this.getConfirmed().then(confirm => {
|
||||
this.$axios({
|
||||
url:
|
||||
'/base/equipment-check-order/confirm?confirmPerson=' +
|
||||
this.$store.getters.userId,
|
||||
method: 'put',
|
||||
data: [this.dataForm.id],
|
||||
}).then(res =>{
|
||||
if (res.code == 0) {
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
this.$message.success('已确认');
|
||||
}
|
||||
}).catch(() => {
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
this.$message.success('取消确认');
|
||||
})
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs["dataForm"].validate((valid) => {
|
||||
@ -429,6 +460,7 @@ export default {
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.idAttrShow = true
|
||||
this.isshowConfirm = true
|
||||
this.dataForm.id = response.data
|
||||
// this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
|
@ -172,24 +172,27 @@ export default {
|
||||
async searchBarClicked(btn) {
|
||||
switch (btn.btnName) {
|
||||
case 'batchConfirm':
|
||||
const ids = this.$refs['waiting-list-table'].selectedPlan.map(
|
||||
(item) => item.id
|
||||
)
|
||||
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
|
||||
this.$message.warning('请选择待确认的设备巡检单');
|
||||
return;
|
||||
}
|
||||
const res = await this.$axios({
|
||||
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId + '&ids=' + ids,
|
||||
method: 'put',
|
||||
// data: this.$refs['waiting-list-table'].selectedPlan.map(
|
||||
// (item) => item.id
|
||||
// ),
|
||||
});
|
||||
if (res.code == 0) {
|
||||
this.$message.success('确认成功');
|
||||
this.getList();
|
||||
}
|
||||
this.$modal
|
||||
.confirm('是否确认所有选中保养单"?')
|
||||
.then(() => {
|
||||
return this.$axios({
|
||||
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId,
|
||||
method: 'put',
|
||||
data: this.$refs['waiting-list-table'].selectedPlan.map(
|
||||
(item) => item.id
|
||||
),
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
this.getList();
|
||||
res.code == 0 && this.$modal.msgSuccess('确认成功');
|
||||
res.code != 0 && this.$modal.msgError('确认失败');
|
||||
})
|
||||
.catch(() => {});
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -328,7 +331,7 @@ export default {
|
||||
// },
|
||||
|
||||
getConfirmed() {
|
||||
return this.$confirm('是否直接确认保养记录', '提示', {
|
||||
return this.$confirm('是否直接确认巡检记录', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
@ -388,17 +391,16 @@ export default {
|
||||
},
|
||||
/** 确认 */
|
||||
async handleConfirm(row) {
|
||||
console.log('111', this.$store.getters.userId)
|
||||
this.$modal
|
||||
.confirm('是否确认巡检单"' + row.name + '"?')
|
||||
.then(() => {
|
||||
return this.$axios({
|
||||
url:
|
||||
'/base/equipment-check-order/confirm?confirmPerson=' +
|
||||
this.$store.getters.userId + '&ids=' + [row.id],
|
||||
this.$store.getters.userId,
|
||||
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
|
||||
method: 'put',
|
||||
// data: [row.id],
|
||||
data: [row.id],
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
|
@ -14,7 +14,7 @@
|
||||
custom-class="mes-drawer"
|
||||
size="60%"
|
||||
@closed="$emit('destroy')">
|
||||
<SmallTitle slot="title">编辑</SmallTitle>
|
||||
<SmallTitle slot="title">{{ showTable ? '编辑' : '新增' }}</SmallTitle>
|
||||
|
||||
<div class="drawer-body flex">
|
||||
<div class="drawer-body__content">
|
||||
@ -184,49 +184,53 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<SmallTitle>保养内容</SmallTitle>
|
||||
<div v-if="showTable">
|
||||
<SmallTitle>保养内容</SmallTitle>
|
||||
|
||||
<div style="margin-top: 12px; position: relative">
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="attr-search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 12px; position: relative">
|
||||
<div style="position: absolute; top: -40px; right: 0">
|
||||
<el-button @click="handleAddAttr" type="text">
|
||||
<i class="el-icon-plus"></i>
|
||||
添加属性
|
||||
</el-button>
|
||||
<div style="margin-top: 12px; position: relative">
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="attr-search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
</div>
|
||||
<base-table
|
||||
v-loading="attrListLoading"
|
||||
:table-props="attrTableProps"
|
||||
:page="attrQuery?.params.pageNo || 1"
|
||||
:limit="attrQuery?.params.pageSize || 10"
|
||||
:table-data="attrList"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="attrTotal > 0"
|
||||
:total="attrTotal"
|
||||
:page.sync="attrQuery.params.pageNo"
|
||||
:limit.sync="attrQuery.params.pageSize"
|
||||
@pagination="getAttrList" />
|
||||
<div style="margin-top: 12px; position: relative">
|
||||
<div style="position: absolute; top: -40px; right: 0">
|
||||
<el-button @click="handleAddAttr" type="text">
|
||||
<i class="el-icon-plus"></i>
|
||||
添加属性
|
||||
</el-button>
|
||||
</div>
|
||||
<base-table
|
||||
v-loading="attrListLoading"
|
||||
:table-props="attrTableProps"
|
||||
:page="attrQuery?.params.pageNo || 1"
|
||||
:limit="attrQuery?.params.pageSize || 10"
|
||||
:table-data="attrList"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="attrTotal > 0"
|
||||
:total="attrTotal"
|
||||
:page.sync="attrQuery.params.pageNo"
|
||||
:limit.sync="attrQuery.params.pageSize"
|
||||
@pagination="getAttrList" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" @click="handleCancel">取消</el-button>
|
||||
<el-button type="primary" @click="handleConfirm">保存</el-button>
|
||||
<!-- 新增可确认 -->
|
||||
<el-button v-if="isAdd" type="primary" @click="addConfirm">保存</el-button>
|
||||
<el-button v-else type="primary" @click="handleConfirm">保存</el-button>
|
||||
<!-- sections的第二项必须是 属性列表 -->
|
||||
<!-- <el-button
|
||||
v-if="sections[1].allowAdd"
|
||||
@ -292,6 +296,8 @@ export default {
|
||||
return {
|
||||
visible: false,
|
||||
btnLoading: false,
|
||||
showTable: false,
|
||||
isAdd: false,
|
||||
form: {},
|
||||
formLoading: false,
|
||||
lineList: [],
|
||||
@ -387,7 +393,7 @@ export default {
|
||||
attrListLoading: false,
|
||||
// syncFileListFlag: null,
|
||||
tableBtn: [],
|
||||
row: null,
|
||||
row: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -438,23 +444,106 @@ export default {
|
||||
break;
|
||||
}
|
||||
},
|
||||
async addConfirm() {
|
||||
console.log('11', this.showTable)
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.getConfirmed().then(confirm => {
|
||||
console.log('111', confirm)
|
||||
this.$axios({
|
||||
url:
|
||||
'/base/equipment-maintain-log/confirm?confirmPerson=' +
|
||||
this.$store.getters.userId,
|
||||
method: 'put',
|
||||
data: [this.form.id],
|
||||
}).then(res =>{
|
||||
if (res.code == 0) {
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
this.$message.success('已确认');
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
this.$message.success('取消确认');
|
||||
})
|
||||
})
|
||||
});
|
||||
},
|
||||
getConfirmed() {
|
||||
return this.$confirm('是否直接确认保养记录', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
});
|
||||
},
|
||||
async handleConfirm() {
|
||||
this.btnLoading = true;
|
||||
this.$nextTick(async () => {
|
||||
const { code, data } = await this.$axios({
|
||||
url: '/base/equipment-maintain-log/update',
|
||||
method: 'put',
|
||||
// this.$nextTick(async () => {
|
||||
// const { code, data } = await this.$axios({
|
||||
// url: '/base/equipment-maintain-log/update',
|
||||
// method: 'put',
|
||||
// data: {
|
||||
// ...this.form,
|
||||
// maintainWorker: this.form.maintainWorker.join(',')
|
||||
// },
|
||||
// });
|
||||
// if (code == 0) {
|
||||
// this.$modal.msgSuccess('更新成功');
|
||||
// }
|
||||
// this.btnLoading = false;
|
||||
// this.$emit('refreshDataList');
|
||||
// this.handleCancel();
|
||||
// });
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
this.$axios({
|
||||
url: '/base/equipment-maintain-log/update',
|
||||
method: 'put',
|
||||
data: {
|
||||
...this.form,
|
||||
maintainWorker: this.form.maintainWorker.join(','),
|
||||
special: false,
|
||||
relatePlan: 2
|
||||
}
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.btnLoading = false;
|
||||
this.$emit('refreshDataList');
|
||||
this.handleCancel();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加的提交
|
||||
this.$axios({
|
||||
url: '/base/equipment-maintain-log/create',
|
||||
method: 'post',
|
||||
data: {
|
||||
...this.form,
|
||||
maintainWorker: this.form.maintainWorker.join(',')
|
||||
},
|
||||
maintainWorker: this.form.maintainWorker.join(','),
|
||||
special: false,
|
||||
relatePlan: 2,
|
||||
confirmed: false,
|
||||
}
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.btnLoading = false;
|
||||
this.form.id = response.data
|
||||
this.row.id = response.data
|
||||
this.showTable = true
|
||||
this.isAdd = true
|
||||
this.$emit('refreshDataList');
|
||||
// this.handleCancel();
|
||||
});
|
||||
if (code == 0) {
|
||||
this.$modal.msgSuccess('更新成功');
|
||||
}
|
||||
this.btnLoading = false;
|
||||
this.$emit('refreshDataList');
|
||||
this.handleCancel();
|
||||
});
|
||||
},
|
||||
|
||||
@ -464,15 +553,22 @@ export default {
|
||||
|
||||
init(row) {
|
||||
this.visible = true;
|
||||
this.row = row;
|
||||
this.getInfo(row);
|
||||
this.getAttrList(row);
|
||||
if (row) {
|
||||
this.row = row;
|
||||
this.showTable = row ? true : false;
|
||||
this.$nextTick(() => {
|
||||
if (row.id) {
|
||||
this.getInfo(row.id);
|
||||
this.getAttrList(row.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async getInfo(row) {
|
||||
async getInfo(id) {
|
||||
this.formLoading = true;
|
||||
const res = await this.$axios(
|
||||
'/base/equipment-maintain-log/get?id=' + row.id
|
||||
'/base/equipment-maintain-log/get?id=' + id
|
||||
);
|
||||
if (res.code == 0) {
|
||||
this.form = res.data;
|
||||
@ -482,15 +578,15 @@ export default {
|
||||
this.formLoading = false;
|
||||
},
|
||||
|
||||
async getAttrList(row, condition = {}) {
|
||||
if (!row) row = this.row;
|
||||
async getAttrList(id, condition = {}) {
|
||||
if (!id) id = this.row.id;
|
||||
this.attrListLoading = true;
|
||||
const res = await this.$axios({
|
||||
url: '/base/equipment-maintain-log-det/page',
|
||||
method: 'get',
|
||||
params: {
|
||||
...this.attrQuery.params,
|
||||
logId: row.id,
|
||||
logId: id,
|
||||
...condition,
|
||||
},
|
||||
});
|
||||
|
@ -258,17 +258,27 @@ export default {
|
||||
this.$message.warning('请选择待确认的设备保养记录');
|
||||
return;
|
||||
}
|
||||
const res = await this.$axios({
|
||||
url: '/base/equipment-maintain-log/confirm',
|
||||
method: 'put',
|
||||
data: this.$refs['waiting-list-table'].selectedPlan.map(
|
||||
(item) => item.id
|
||||
),
|
||||
});
|
||||
if (res.code == 0) {
|
||||
this.$message.success('确认成功');
|
||||
this.getList();
|
||||
}
|
||||
this.$modal
|
||||
.confirm('是否确认所有选中保养单"?')
|
||||
.then(() => {
|
||||
return this.$axios({
|
||||
url: '/base/equipment-maintain-log/confirm',
|
||||
method: 'put',
|
||||
data: this.$refs['waiting-list-table'].selectedPlan.map(
|
||||
(item) => item.id
|
||||
),
|
||||
});
|
||||
// if (res.code == 0) {
|
||||
// this.$message.success('确认成功');
|
||||
// this.getList();
|
||||
// }
|
||||
})
|
||||
.then((res) => {
|
||||
this.getList();
|
||||
res.code == 0 && this.$modal.msgSuccess('确认成功');
|
||||
res.code != 0 && this.$modal.msgError('确认失败');
|
||||
})
|
||||
.catch(() => {});
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -412,9 +422,13 @@ export default {
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加待确认保养记录';
|
||||
// this.reset();
|
||||
// this.open = true;
|
||||
// this.title = '添加待确认保养记录';
|
||||
this.openUnplannedDrawer = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.unplanned.init();
|
||||
});
|
||||
},
|
||||
|
||||
getConfirmed() {
|
||||
@ -478,15 +492,25 @@ export default {
|
||||
},
|
||||
/** 确认 */
|
||||
async handleConfirm(row) {
|
||||
const res = await this.$axios({
|
||||
url: '/base/equipment-maintain-log/confirm',
|
||||
method: 'put',
|
||||
data: [row.id],
|
||||
});
|
||||
if (res.code == 0) {
|
||||
this.$message.success('确认成功');
|
||||
this.getList();
|
||||
}
|
||||
this.$modal
|
||||
.confirm('是否确认保养单"' + row.maintainOrderNumber + '"?')
|
||||
.then(() => {
|
||||
return this.$axios({
|
||||
url: '/base/equipment-maintain-log/confirm',
|
||||
method: 'put',
|
||||
data: [row.id],
|
||||
});
|
||||
// if (res.code == 0) {
|
||||
// this.$message.success('确认成功');
|
||||
// this.getList();
|
||||
// }
|
||||
})
|
||||
.then((res) => {
|
||||
this.getList();
|
||||
res.code == 0 && this.$modal.msgSuccess('确认成功');
|
||||
res.code != 0 && this.$modal.msgError('确认失败');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 编辑 */
|
||||
async handleEdit(row) {
|
||||
|
Loading…
Reference in New Issue
Block a user