feat: 优化routepack 添加wf组件

This commit is contained in:
caoqianming 2025-09-23 13:24:15 +08:00
parent a293bfe1ae
commit 83edbad12d
3 changed files with 96 additions and 131 deletions

View File

@ -1,59 +1,36 @@
<template> <template>
<el-drawer <el-container v-loading="loading">
title="查看"
v-model="visible" <el-main class="nopadding" style="padding-right: 1px;">
:size="'90%'" <el-container>
destroy-on-close <el-header style="height: 80px;display: block;padding:0">
@closed="$emit('closed')" <el-card shadow="hover">
:close-on-click-modal="false" <el-descriptions :column="3" title="基本信息">
> <el-descriptions-item label="工艺名称:">{{
<el-container v-loading="loading"> form.name
<el-header style="height: 80px;display: block;padding:0"> }}</el-descriptions-item>
<el-card shadow="hover"> <el-descriptions-item label="物料名称:">{{
<el-descriptions :column="3" title="基本信息"> form.material_name
<el-descriptions-item label="工艺名称:">{{ }}</el-descriptions-item>
form.name </el-descriptions>
}}</el-descriptions-item> </el-card>
<el-descriptions-item label="物料名称:">{{ </el-header>
form.material_name <el-main>
}}</el-descriptions-item> <el-container>
</el-descriptions> <el-aside style="width: 50%;overflow: scroll;">
</el-card> <div
</el-header> style="font-weight: 600;color: #303133;font-size: 16px;padding: 10px 0;position: fixed;">
<el-main id="degInnerMain"> 工艺路线流程图</div>
<el-container> <el-tabs v-if="tabsTitle.length > 1" v-model="activeName" :tab-position="'left'"
<el-side style="width: 50%;overflow: scroll;"> style="flex-direction: row;" @tab-click="tabshandleClick">
<div style="font-weight: 600;color: #303133;font-size: 16px;padding: 10px 0;position: fixed;">工艺路线流程图</div> <el-tab-pane :label="item" v-for="item in tabsTitle" :key="item"></el-tab-pane>
<el-tabs </el-tabs>
v-if="tabsTitle.length>1" <scDegra style="margin-top: 50px;" v-if="limitedWatch" ref="degraDialogs" :nodes="nodes"
v-model="activeName" :edges="edges" :rankdir="'DL'" @closeDialog="limitedWatch = false">
:tab-position="'left'" </scDegra>
style="flex-direction: row;" </el-aside>
@tab-click="tabshandleClick" <el-main class="padding: 1px">
> <scTable ref="tables" :data="tableData" row-key="id" hidePagination hideDo stripe border>
<el-tab-pane :label="item" v-for="item in tabsTitle" :key="item"></el-tab-pane>
</el-tabs>
<scDegra
style="margin-top: 50px;"
v-if="limitedWatch"
ref="degraDialogs"
:nodes="nodes"
:edges="edges"
:rankdir="'DL'"
@closeDialog="limitedWatch = false"
>
</scDegra>
</el-side>
<el-main>
<scTable
ref="tables"
:data="tableData"
row-key="id"
hidePagination
hideDo
stripe
border
>
<el-table-column label="排序" prop="sort" width="50"> <el-table-column label="排序" prop="sort" width="50">
</el-table-column> </el-table-column>
<el-table-column label="工序" prop="process_name"> <el-table-column label="工序" prop="process_name">
@ -73,25 +50,36 @@
</el-table-column> </el-table-column>
<el-table-column label="工时" prop="hour_work"> <el-table-column label="工时" prop="hour_work">
</el-table-column> </el-table-column>
<el-table-column label="批次校验" v-if="project_code!=='bxerp'"> <el-table-column label="批次校验" v-if="project_code !== 'bxerp'">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.batch_bind" type="success"></el-tag> <el-tag v-if="scope.row.batch_bind" type="success"></el-tag>
</template> </template>
</el-table-column> </el-table-column>
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>
</el-main>
</el-container> </el-main>
</el-drawer>
</el-container>
</el-main>
<el-aside width="20%" v-if="form.ticket">
<ticketd :ticketId="form.ticket"></ticketd>
</el-aside>
</el-container>
</template> </template>
<script> <script>
import ticketd from '@/views/wf/ticketd.vue'
export default { export default {
emits: ["success", "closed"], emits: ["success", "closed"],
components: { ticketd },
props: {
modelId: { type: String, default: null },
},
data() { data() {
return { return {
loading: false, loading: false,
visible: false,
isSaveing: false, isSaveing: false,
state_: { state_: {
10: "创建中", 10: "创建中",
@ -99,24 +87,29 @@ export default {
40: "进行中", 40: "进行中",
50: "已完成", 50: "已完成",
}, },
tracking_:{ tracking_: {
10:"批次", 10: "批次",
20:"单个", 20: "单个",
}, },
form: {}, form: {
nodes:[], ticket: null
edges:[], },
tabsTitle:['总图'], nodes: [],
tabsData:{}, edges: [],
tabsTitle: ['总图'],
tabsData: {},
tableData: [], tableData: [],
project_code: "", project_code: "",
activeName:"总图", activeName: "总图",
limitedWatch:false, limitedWatch: false,
}; };
}, },
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) {
this.getRoutePackDetail(this.modelId);
}
}, },
methods: { methods: {
// //
@ -132,13 +125,17 @@ export default {
that.getDEGdatas(data.id); that.getDEGdatas(data.id);
this.getTabsList(data.id); this.getTabsList(data.id);
}, },
getDEGdatas(id){ async getRoutePackDetail(id) {
let res = await this.$API.mtm.routepack.item.req(id);
this.setData(res);
},
getDEGdatas(id) {
let that = this; let that = this;
that.$API.mtm.routepack.dag.req(id).then((res) => { that.$API.mtm.routepack.dag.req(id).then((res) => {
that.nodes = res.nodes; that.nodes = res.nodes;
that.edges = res.edges; that.edges = res.edges;
that.tabsData['总图'] = res; that.tabsData['总图'] = res;
if(!that.limitedWatch){ if (!that.limitedWatch) {
that.limitedWatch = true; that.limitedWatch = true;
that.$nextTick(() => { that.$nextTick(() => {
that.$refs.degraDialogs.open(); that.$refs.degraDialogs.open();
@ -146,17 +143,17 @@ export default {
} }
}) })
}, },
getTabsList(id){ getTabsList(id) {
let that = this; let that = this;
that.$API.mtm.routepack.dags.req(id).then((res) => { that.$API.mtm.routepack.dags.req(id).then((res) => {
let arr = []; let arr = [];
for(let key in res){ for (let key in res) {
arr.push(key); arr.push(key);
} }
if(arr.length>1){ if (arr.length > 1) {
for(let key in res){ for (let key in res) {
that.tabsTitle.push(res[key].name); that.tabsTitle.push(res[key].name);
that.tabsData[res[key].name]=res[key]; that.tabsData[res[key].name] = res[key];
} }
} }
console.log(that.tabsData); console.log(that.tabsData);
@ -170,11 +167,11 @@ export default {
this.tableData = res; this.tableData = res;
}); });
}, },
tabshandleClick(val){ tabshandleClick(val) {
let that = this; let that = this;
let label = val.props.label; let label = val.props.label;
that.$nextTick(() => { that.$nextTick(() => {
that.nodes = that.tabsData[label].nodes; that.nodes = that.tabsData[label].nodes;
that.edges = that.tabsData[label].edges; that.edges = that.tabsData[label].edges;
}) })
}, },

View File

@ -185,11 +185,17 @@
@closed="saveClose" @closed="saveClose"
> >
</save-dialog> </save-dialog>
<show-dialog <el-drawer
v-if="dialog.show" v-model="dialog.show"
ref="showDialog" title="查看"
:size="'90%'"
destroy-on-close
@closed="dialog.show = false" @closed="dialog.show = false"
></show-dialog> :close-on-click-modal="false"
>
<show-dialog ref="showDialog"></show-dialog>
</el-drawer>
</template> </template>
<script> <script>
import saveDialog from "./routepack_form.vue"; import saveDialog from "./routepack_form.vue";

View File

@ -93,7 +93,7 @@
<!--工序!--> <!--工序!-->
<el-main class="nopadding" v-if="active === 1"> <el-main class="nopadding" v-if="active === 1">
<el-container> <el-container>
<el-side style="width: 50%;overflow: scroll;"> <el-aside style="width: 50%;overflow: scroll;">
<div style="font-weight: 600;color: #303133;font-size: 16px;padding: 10px 0;position: fixed;width: 30px;">工艺路线流程图</div> <div style="font-weight: 600;color: #303133;font-size: 16px;padding: 10px 0;position: fixed;width: 30px;">工艺路线流程图</div>
<scDegra <scDegra
style="margin-top: 50px;" style="margin-top: 50px;"
@ -104,7 +104,7 @@
:rankdir="'DL'" :rankdir="'DL'"
> >
</scDegra> </scDegra>
</el-side> </el-aside>
<el-main style="width: 50%;overflow: scroll;"> <el-main style="width: 50%;overflow: scroll;">
<el-container> <el-container>
<el-header> <el-header>
@ -177,15 +177,8 @@
</el-main> </el-main>
<el-footer v-if="active === 1" style="text-align: center"> <el-footer v-if="active === 1" style="text-align: center">
<el-button @click="handleLastStep" style="margin-right: 4px">上一步</el-button> <el-button @click="handleLastStep" style="margin-right: 4px">上一步</el-button>
<el-button <ticketd_b_start :workflow_key="'routepack'" :title="form.name" :t_id="form.id"
v-for="item in initForm.transitions" @success="$emit('closed')"></ticketd_b_start>
:key="item.id"
type="primary"
:loading="isSaveing"
:disabled="isSaveing"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button>
<el-button @click="$emit('closed')" type="warning">退出</el-button> <el-button @click="$emit('closed')" type="warning">退出</el-button>
</el-footer> </el-footer>
</el-container> </el-container>
@ -200,9 +193,10 @@
</template> </template>
<script> <script>
import saveDialog from "./route_form.vue"; import saveDialog from "./route_form.vue";
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
export default { export default {
name: "routepack_form", name: "routepack_form",
components: { saveDialog }, components: { saveDialog, ticketd_b_start },
data() { data() {
return { return {
active: 0, active: 0,
@ -250,7 +244,7 @@ export default {
mounted() { mounted() {
this.isSaveing = false; this.isSaveing = false;
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.getInit(); // this.getInit();
// this.getMaterials(); // this.getMaterials();
}, },
methods: { methods: {
@ -379,38 +373,6 @@ export default {
return err; return err;
}); });
}, },
//
getInit() {
let that = this;
that.$API.wf.workflow.initkey.req("routepack").then((res) => {
that.initForm = res;
});
},
//,
submitTicketCreate(id) {
let that = this;
let ticket = {};
that.isSaveing = true;
ticket.title = that.form.name;
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {
t_id: that.routepack,
};
ticket.transition = id;
that.$API.wf.ticket.create
.req(ticket)
.then((res) => {
that.tLoading = false;
that.$message.success("提交成功");
that.$emit("close");
that.visible = false;
})
.catch((e) => {
that.tLoading = false;
});
},
// //
handleSaveSuccess() { handleSaveSuccess() {
console.log("handleSaveSuccess"); console.log("handleSaveSuccess");