feat: 优化handover_form

This commit is contained in:
caoqianming 2025-09-24 14:14:48 +08:00
parent d445981929
commit 53ce3694be
3 changed files with 254 additions and 294 deletions

View File

@ -75,7 +75,7 @@ export default {
emits: ["success", "closed"], emits: ["success", "closed"],
components: { ticketd }, components: { ticketd },
props: { props: {
modelId: { type: String, default: null }, t_id: { type: String, default: null },
}, },
data() { data() {
return { return {
@ -107,8 +107,8 @@ export default {
mounted() { mounted() {
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code; this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
this.tableData = []; this.tableData = [];
if (this.modelId) { if (this.t_id) {
this.getRoutePackDetail(this.modelId); this.getRoutePackDetail(this.t_id);
} }
}, },
methods: { methods: {

View File

@ -251,8 +251,14 @@
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>
<el-drawer
v-model="dialog.save"
:title="titleMap[mode]"
:size="'90%'"
destroy-on-close
:close-on-click-modal="false"
>
<save-dialog <save-dialog
v-if="dialog.save"
ref="saveDialog" ref="saveDialog"
:type="type" :type="type"
:process = "processId" :process = "processId"
@ -261,8 +267,8 @@
:mgroupId="mgroupId" :mgroupId="mgroupId"
@success="handleSaveSuccess" @success="handleSaveSuccess"
@closed="dialog.save = false" @closed="dialog.save = false"
> ></save-dialog>
</save-dialog> </el-drawer>
<el-dialog title="退料操作" v-model="backDialogVisible" style="width: 70%;"> <el-dialog title="退料操作" v-model="backDialogVisible" style="width: 70%;">
<el-row v-for="item in handoverbList" :key="item.id" style="padding: 10px 10px 0 20px;"> <el-row v-for="item in handoverbList" :key="item.id" style="padding: 10px 10px 0 20px;">
<el-col style="display: flex;border-bottom: 1px dashed #eee;"> <el-col style="display: flex;border-bottom: 1px dashed #eee;">
@ -379,6 +385,12 @@ export default {
}, },
route_code: "", route_code: "",
// setNameVisible: false, // setNameVisible: false,
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
mode: "add"
}; };
}, },
mounted() { mounted() {
@ -410,6 +422,7 @@ export default {
// //
table_add(type) { table_add(type) {
this.dialog.save = true; this.dialog.save = true;
this.mode = "add";
this.type = type; this.type = type;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("add",'',10); this.$refs.saveDialog.open("add",'',10);
@ -419,6 +432,7 @@ export default {
let that = this; let that = this;
that.type = 10; that.type = 10;
that.codeText = codeText; that.codeText = codeText;
that.mode = "add";
that.dialog.save = true; that.dialog.save = true;
that.$nextTick(() => { that.$nextTick(() => {
that.$refs.saveDialog.open("add",codeText,10); that.$refs.saveDialog.open("add",codeText,10);
@ -429,6 +443,7 @@ export default {
this.type = 20; this.type = 20;
that.codeText2 = codeText2; that.codeText2 = codeText2;
this.dialog.save = true; this.dialog.save = true;
that.mode = "add";
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("add",codeText2,10); this.$refs.saveDialog.open("add",codeText2,10);
}); });
@ -437,6 +452,7 @@ export default {
table_edit(row) { table_edit(row) {
this.type=row.type; this.type=row.type;
this.dialog.save = true; this.dialog.save = true;
this.mode = "edit";
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row); this.$refs.saveDialog.open("edit").setData(row);
}); });
@ -444,6 +460,7 @@ export default {
table_show(row){ table_show(row){
this.type=row.type; this.type=row.type;
this.dialog.save = true; this.dialog.save = true;
this.mode = "show";
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row); this.$refs.saveDialog.open("show").setData(row);
}); });
@ -561,7 +578,7 @@ export default {
// //
// //
handleSaveSuccess(data, mode) { handleSaveSuccess(data, mode) {
this.dialog.save = true; this.dialog.save = false;
this.$refs.table.refresh(); this.$refs.table.refresh();
}, },
}, },

View File

@ -1,12 +1,6 @@
<template> <template>
<el-dialog <el-container>
:title="titleMap[mode]" <el-main class="nopadding">
v-model="visible"
width="1000px"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-form <el-form
ref="dialogForm" ref="dialogForm"
:model="form" :model="form"
@ -193,25 +187,32 @@
</el-form> </el-form>
<el-footer v-show="mode!=='show'"> <el-footer v-show="mode!=='show'">
<template v-if="(route_code=='tuihuo'&&type==10&&mtype==10)||form.ticket!=null"> <template v-if="(route_code=='tuihuo'&&type==10&&mtype==10)||form.ticket!=null">
<el-button <ticketd_b_start :workflow_key="'backfire'" :title="'退火交接审批单'" :t_id="form.id" :ticketId="form.ticket"
v-for="item in transitions" @success="()=>{$emit('success')} " :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b_start>
:key="item.id"
type="primary"
:loading="isSaveing"
:disabled="isSaveing"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button>
</template> </template>
<el-button v-else type="primary" v-loading="isSaveing" @click="submit">确定</el-button> <el-button v-else type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
<el-button @click="visible = false">取消</el-button> <el-button @click="$emit('closed')">取消</el-button>
</el-footer> </el-footer>
</el-dialog> </el-main>
<el-aside width="20%" v-if="form.ticket">
<ticketd :ticketId="form.ticket" @success="$emit('success')"></ticketd>
</el-aside>
</el-container>
</template> </template>
<script> <script>
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
import ticketd from '@/views/wf/ticketd.vue'
export default { export default {
emits: ["success", "closed"], emits: ["success", "closed"],
components: {
ticketd_b_start, ticketd
},
props: { props: {
t_id: {
type: String,
default: null
},
type: { type: {
type: Number, type: Number,
default: 10, default: 10,
@ -245,12 +246,7 @@ export default {
selectItems:[], selectItems:[],
yseorno: ["是", "否"], yseorno: ["是", "否"],
loading: false, loading: false,
mode: "add", mode: "show",
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
lists:[],// lists:[],//
handle_user: [], handle_user: [],
form: { form: {
@ -331,7 +327,6 @@ export default {
mgroupOptions: [], mgroupOptions: [],
materialOptions: [], materialOptions: [],
addShow: false, addShow: false,
visible: false,
scanVisible:false, scanVisible:false,
isSaveing: false, isSaveing: false,
setFiltersVisible: false, setFiltersVisible: false,
@ -380,25 +375,25 @@ export default {
}else{ }else{
that.getMgroupOptions(); that.getMgroupOptions();
} }
if(that.route_code=='tuihuo'){ that.getTid();
that.getInit();
}
}, },
methods: { methods: {
// getTid (){
getInit() { var that = this;
let that = this; if (that.t_id) {
if(this.form.ticket!==null){ that.$API.wpm.handover.item.req(that.t_id).then(res=>{
this.$API.wf.ticket.ticketTransitions.req(this.form.ticket).then((res) => { that.setData(res);
that.transitions = res; if(res.ticket_.state_.type == 1 && res.create_by == that.$TOOL.data.get("USER_INFO").id ) {
}) that.mode = "edit";
}else{ }else{
that.$API.wf.workflow.initkey.req(" backfire").then((res) => { that.mode = "show";
that.initForm = res;
that.transitions = res.transitions;
});
} }
that.$nextTick(()=>{
that.$refs.ticketd_b_start.init();
})
})
}
}, },
// //
getMgroupOptions() { getMgroupOptions() {
@ -517,7 +512,6 @@ export default {
if(mtype==30){// if(mtype==30){//
this.change_batch = true; this.change_batch = true;
} }
this.visible = true;
return this; return this;
}, },
//handoverb //handoverb
@ -560,61 +554,13 @@ export default {
fileUPSuccess(res) { fileUPSuccess(res) {
this.test_file = res.path; this.test_file = res.path;
}, },
//退, async submit_b_func() {
submitTicketCreate(id) {
let that = this; let that = this;
that.isSaveing = true;
that.form.oinfo_json = {};
that.form.oinfo_json.test_file = that.test_file;
if(that.mode == "add") { if(that.mode == "add") {
that.$API.wpm.handover.create.req(that.form).then((res) => { let res = await that.$API.wpm.handover.create.req(that.form);
let ticket = {}; that.form.id = res.id;
ticket.title = '退火交接审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
}).catch((e) => {
that.isSaveing = false;
});
} else if (that.mode == "edit") { } else if (that.mode == "edit") {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => { await that.$API.wpm.handover.update.req(that.form.id, that.form);
if (that.form.ticket == null) {
let ticket = {};
ticket.title = '退火交接审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
} else {
let data = {transition: id, ticket_data: {}}
that.$API.wf.ticket.ticketHandle.req(that.form.ticket, data).then(res=>{
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
})
}
}).catch((err) => {
that.isSaveing = false;
return err;
});
} }
}, },
// //
@ -634,7 +580,6 @@ export default {
that.$API.wpm.handover.createsubmit.req(that.form).then((res) => { that.$API.wpm.handover.createsubmit.req(that.form).then((res) => {
that.isSaveing = false; that.isSaveing = false;
that.$emit("success"); that.$emit("success");
that.visible = false;
that.$message.success("操作成功"); that.$message.success("操作成功");
}).catch((err) => { }).catch((err) => {
that.isSaveing = false; that.isSaveing = false;
@ -645,7 +590,6 @@ export default {
that.$API.wpm.handover.create.req(that.form).then((res) => { that.$API.wpm.handover.create.req(that.form).then((res) => {
that.isSaveing = false; that.isSaveing = false;
that.$emit("success"); that.$emit("success");
that.visible = false;
that.$message.success("操作成功"); that.$message.success("操作成功");
}).catch((err) => { }).catch((err) => {
that.isSaveing = false; that.isSaveing = false;
@ -655,7 +599,6 @@ export default {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => { that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => {
that.isSaveing = false; that.isSaveing = false;
that.$emit("success", that.form, that.mode); that.$emit("success", that.form, that.mode);
that.visible = false;
that.$message.success("操作成功"); that.$message.success("操作成功");
}).catch((err) => { }).catch((err) => {
that.isSaveing = false; that.isSaveing = false;