projects/mesxc-dy #216

Merged
juzi merged 4 commits from projects/mesxc-dy into projects/mesxc-test 2024-02-28 15:09:47 +08:00
4 changed files with 252 additions and 99 deletions
Showing only changes of commit 1a622dc4d3 - Show all commits

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-28 09:15:02
* @LastEditTime: 2024-02-28 14:45:58
* @Description:
-->
<template>
@ -143,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
@ -206,6 +207,7 @@ export default {
tableProps,
topBtnConfig,
addOrUpdateVisible: false,
isshowConfirm: false,
urlOptions: {
isGetCode: false,
createURL: createCheckOrder,
@ -399,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) => {
@ -430,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");

View File

@ -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,
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
// ),
data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
),
});
if (res.code == 0) {
this.$message.success('确认成功');
})
.then((res) => {
this.getList();
}
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break;
}
},
@ -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) => {

View File

@ -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,6 +184,7 @@
</el-form>
</div>
<div v-if="showTable">
<SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative">
@ -223,10 +224,13 @@
@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,24 +444,107 @@ 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({
// 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(',')
},
});
if (code == 0) {
this.$modal.msgSuccess('更新成功');
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(','),
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();
});
});
},
handleEmitFun(val) {
@ -464,15 +553,22 @@ export default {
init(row) {
this.visible = true;
if (row) {
this.row = row;
this.getInfo(row);
this.getAttrList(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,
},
});

View File

@ -258,17 +258,27 @@ export default {
this.$message.warning('请选择待确认的设备保养记录');
return;
}
const res = await this.$axios({
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('确认成功');
// 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({
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('确认成功');
// 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) {