待确认

This commit is contained in:
helloDy 2024-02-28 15:03:21 +08:00
parent c71d99a21e
commit 1a622dc4d3
4 changed files with 252 additions and 99 deletions

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-28 09:15:02 * @LastEditTime: 2024-02-28 14:45:58
* @Description: * @Description:
--> -->
<template> <template>
@ -143,7 +143,8 @@
<div v-if="!isdetail" class="drawer-body__footer"> <div v-if="!isdetail" class="drawer-body__footer">
<el-button @click="goback()">取消</el-button> <el-button @click="goback()">取消</el-button>
<!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</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> </div>
<attr-add <attr-add
@ -206,6 +207,7 @@ export default {
tableProps, tableProps,
topBtnConfig, topBtnConfig,
addOrUpdateVisible: false, addOrUpdateVisible: false,
isshowConfirm: false,
urlOptions: { urlOptions: {
isGetCode: false, isGetCode: false,
createURL: createCheckOrder, createURL: createCheckOrder,
@ -399,6 +401,34 @@ export default {
this.$refs.addOrUpdate.init(id); 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() { dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
@ -430,6 +460,7 @@ export default {
}).then(response => { }).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.idAttrShow = true this.idAttrShow = true
this.isshowConfirm = true
this.dataForm.id = response.data this.dataForm.id = response.data
// this.visible = false; // this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");

View File

@ -172,24 +172,27 @@ export default {
async searchBarClicked(btn) { async searchBarClicked(btn) {
switch (btn.btnName) { switch (btn.btnName) {
case 'batchConfirm': case 'batchConfirm':
const ids = this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
)
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) { if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
this.$message.warning('请选择待确认的设备巡检单'); this.$message.warning('请选择待确认的设备巡检单');
return; return;
} }
const res = await this.$axios({ this.$modal
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId + '&ids=' + ids, .confirm('是否确认所有选中保养单"?')
method: 'put', .then(() => {
// data: this.$refs['waiting-list-table'].selectedPlan.map( return this.$axios({
// (item) => item.id url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId,
// ), method: 'put',
}); data: this.$refs['waiting-list-table'].selectedPlan.map(
if (res.code == 0) { (item) => item.id
this.$message.success('确认成功'); ),
this.getList(); });
} })
.then((res) => {
this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break; break;
} }
}, },
@ -388,17 +391,16 @@ export default {
}, },
/** 确认 */ /** 确认 */
async handleConfirm(row) { async handleConfirm(row) {
console.log('111', this.$store.getters.userId)
this.$modal this.$modal
.confirm('是否确认巡检单"' + row.name + '"?') .confirm('是否确认巡检单"' + row.name + '"?')
.then(() => { .then(() => {
return this.$axios({ return this.$axios({
url: url:
'/base/equipment-check-order/confirm?confirmPerson=' + '/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("\"", ''), // '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put', method: 'put',
// data: [row.id], data: [row.id],
}); });
}) })
.then((res) => { .then((res) => {

View File

@ -14,7 +14,7 @@
custom-class="mes-drawer" custom-class="mes-drawer"
size="60%" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title">编辑</SmallTitle> <SmallTitle slot="title">{{ showTable ? '编辑' : '新增' }}</SmallTitle>
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
@ -184,49 +184,53 @@
</el-form> </el-form>
</div> </div>
<SmallTitle>保养内容</SmallTitle> <div v-if="showTable">
<SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
<SearchBar <SearchBar
:formConfigs="searchBarFormConfig" :formConfigs="searchBarFormConfig"
ref="attr-search-bar" ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" /> @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> </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>
<!-- 分页组件 --> <div style="margin-top: 12px; position: relative">
<pagination <div style="position: absolute; top: -40px; right: 0">
v-show="attrTotal > 0" <el-button @click="handleAddAttr" type="text">
:total="attrTotal" <i class="el-icon-plus"></i>
:page.sync="attrQuery.params.pageNo" 添加属性
:limit.sync="attrQuery.params.pageSize" </el-button>
@pagination="getAttrList" /> </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> </div>
<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 v-if="isAdd" type="primary" @click="addConfirm">保存</el-button>
<el-button v-else type="primary" @click="handleConfirm">保存</el-button>
<!-- sections的第二项必须是 属性列表 --> <!-- sections的第二项必须是 属性列表 -->
<!-- <el-button <!-- <el-button
v-if="sections[1].allowAdd" v-if="sections[1].allowAdd"
@ -292,6 +296,8 @@ export default {
return { return {
visible: false, visible: false,
btnLoading: false, btnLoading: false,
showTable: false,
isAdd: false,
form: {}, form: {},
formLoading: false, formLoading: false,
lineList: [], lineList: [],
@ -387,7 +393,7 @@ export default {
attrListLoading: false, attrListLoading: false,
// syncFileListFlag: null, // syncFileListFlag: null,
tableBtn: [], tableBtn: [],
row: null, row: {},
}; };
}, },
computed: { computed: {
@ -438,23 +444,106 @@ export default {
break; 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() { async handleConfirm() {
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-maintain-log/update',
method: 'put', // 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: { data: {
...this.form, ...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) { init(row) {
this.visible = true; this.visible = true;
this.row = row; if (row) {
this.getInfo(row); this.row = 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; this.formLoading = true;
const res = await this.$axios( const res = await this.$axios(
'/base/equipment-maintain-log/get?id=' + row.id '/base/equipment-maintain-log/get?id=' + id
); );
if (res.code == 0) { if (res.code == 0) {
this.form = res.data; this.form = res.data;
@ -482,15 +578,15 @@ export default {
this.formLoading = false; this.formLoading = false;
}, },
async getAttrList(row, condition = {}) { async getAttrList(id, condition = {}) {
if (!row) row = this.row; if (!id) id = this.row.id;
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-maintain-log-det/page',
method: 'get', method: 'get',
params: { params: {
...this.attrQuery.params, ...this.attrQuery.params,
logId: row.id, logId: id,
...condition, ...condition,
}, },
}); });

View File

@ -258,17 +258,27 @@ export default {
this.$message.warning('请选择待确认的设备保养记录'); this.$message.warning('请选择待确认的设备保养记录');
return; return;
} }
const res = await this.$axios({ this.$modal
url: '/base/equipment-maintain-log/confirm', .confirm('是否确认所有选中保养单"?')
method: 'put', .then(() => {
data: this.$refs['waiting-list-table'].selectedPlan.map( return this.$axios({
(item) => item.id url: '/base/equipment-maintain-log/confirm',
), method: 'put',
}); data: this.$refs['waiting-list-table'].selectedPlan.map(
if (res.code == 0) { (item) => item.id
this.$message.success('确认成功'); ),
this.getList(); });
} // 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; break;
} }
}, },
@ -412,9 +422,13 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); // this.reset();
this.open = true; // this.open = true;
this.title = '添加待确认保养记录'; // this.title = '';
this.openUnplannedDrawer = true;
this.$nextTick(() => {
this.$refs.unplanned.init();
});
}, },
getConfirmed() { getConfirmed() {
@ -478,15 +492,25 @@ export default {
}, },
/** 确认 */ /** 确认 */
async handleConfirm(row) { async handleConfirm(row) {
const res = await this.$axios({ this.$modal
url: '/base/equipment-maintain-log/confirm', .confirm('是否确认保养单"' + row.maintainOrderNumber + '"?')
method: 'put', .then(() => {
data: [row.id], return this.$axios({
}); url: '/base/equipment-maintain-log/confirm',
if (res.code == 0) { method: 'put',
this.$message.success('确认成功'); data: [row.id],
this.getList(); });
} // 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) { async handleEdit(row) {