projects/mes-test #133

Merged
gtz217 merged 281 commits from projects/mes-test into projects/mes 2023-11-30 09:11:34 +08:00
4 changed files with 167 additions and 18 deletions
Showing only changes of commit cfbd00b560 - Show all commits

View File

@ -8,6 +8,50 @@
<template> <template>
<section class="process-bom"> <section class="process-bom">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" /> <SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
<div
class="btns"
style="
text-align: right;
position: absolute;
top: 20px;
right: 20px;
display: flex;
">
<el-button type="primary" plain class="btn-create" icon="el-icon-plus">
分配设备
</el-button>
<el-input
icon="el-icon-search"
placeholder="搜索"
style="margin-left: 20px">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
</div>
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
</section> </section>
</template> </template>
@ -19,15 +63,40 @@ export default {
data() { data() {
return { return {
searchBarFormConfig: [{ label: '工序下设备' }], searchBarFormConfig: [{ label: '工序下设备' }],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'name', label: '设备名称' },
{ prop: 'code', label: '物料BOM' },
{ prop: 'remark', label: '参数BOM' },
],
list: [],
total: 0,
tableBtn: [],
queryParams: {
pageNo: 1,
pageSize: 10,
},
}; };
}, },
computed: {}, computed: {},
methods: {}, methods: {
handleEmitFun() {},
handleTableBtnClick() {},
getList() {},
},
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.process-bom { .process-bom {
position: relative;
flex: 1;
padding: 12px 20px; padding: 12px 20px;
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;

View File

@ -9,6 +9,23 @@
<section class="process-graph"> <section class="process-graph">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" /> <SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
<div
class="btns"
style="text-align: right; position: absolute; top: 20px; right: 20px">
<el-button
type="primary"
plain
class="btn-create"
icon="el-icon-plus"
@click="createDet">
新建工序
</el-button>
<el-button class="btn-serialize" @click="graphToJson">序列化</el-button>
<el-button class="btn-antiserialize" @click="jsonToGraph">
反序列化
</el-button>
</div>
<div class="process-graph__panel" ref="panel"></div> <div class="process-graph__panel" ref="panel"></div>
</section> </section>
</template> </template>
@ -25,6 +42,7 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
graph: null,
searchBarFormConfig: [{ label: '工序列表' }], searchBarFormConfig: [{ label: '工序列表' }],
}; };
}, },
@ -48,6 +66,8 @@ export default {
y: 30, y: 30,
processName: '工序00A', processName: '工序00A',
workshopName: '工段1', workshopName: '工段1',
processDesc: 'test test test',
processId: '1',
}); });
const pn2 = graph.addNode({ const pn2 = graph.addNode({
shape: 'process-node', shape: 'process-node',
@ -55,6 +75,8 @@ export default {
y: 30, y: 30,
processName: '工序00B', processName: '工序00B',
workshopName: '工段1', workshopName: '工段1',
processDesc: 'test test test',
processId: '1',
}); });
const pn3 = graph.addNode({ const pn3 = graph.addNode({
@ -63,6 +85,8 @@ export default {
y: 30, y: 30,
processName: '工序00C', processName: '工序00C',
workshopName: '工段1', workshopName: '工段1',
processDesc: 'test test test',
processId: '1',
}); });
const pn4 = graph.addNode({ const pn4 = graph.addNode({
@ -71,6 +95,8 @@ export default {
y: 120, y: 120,
processName: '工序00D', processName: '工序00D',
workshopName: '工段1', workshopName: '工段1',
processDesc: 'test test test',
processId: '1',
}); });
const pn5 = graph.addNode({ const pn5 = graph.addNode({
@ -79,6 +105,8 @@ export default {
y: 30, y: 30,
processName: '工序00E', processName: '工序00E',
workshopName: '工段1', workshopName: '工段1',
processDesc: 'test test test',
processId: '1',
}); });
graph.addEdge({ graph.addEdge({
@ -156,9 +184,19 @@ export default {
}, },
}, },
}); });
this.graph = graph;
}, },
computed: {}, computed: {},
methods: {}, methods: {
createDet() {},
jsonToGraph() {},
graphToJson() {
if (this.graph) {
console.log(JSON.stringify(this.graph.toJSON(), null, 2));
}
},
},
}; };
</script> </script>
@ -167,6 +205,7 @@ export default {
padding: 12px 20px 20px; padding: 12px 20px 20px;
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;
position: relative;
} }
.process-graph__panel { .process-graph__panel {

View File

@ -42,23 +42,27 @@ ProcessNode.config({
}, },
{ {
tagName: 'text', tagName: 'text',
textContent: '工序名称', selector: 'processName',
attrs: { attrs: {
x: 20, x: 20,
y: 30, y: 30,
// fill: '#777',
// fontSize: 14
}, },
}, },
{ {
tagName: 'text', tagName: 'text',
textContent: '工段名称', selector: 'workshopName',
attrs: { attrs: {
x: 115, x: 115,
y: 30, y: 30,
// fill: '#777',
// fontSize: 14
}, },
}, },
{ {
tagName: 'text', tagName: 'text',
selector: 'processName', selector: 'processDesc',
// textContent: '工序00A', // textContent: '工序00A',
attrs: { attrs: {
x: 26, x: 26,
@ -67,22 +71,49 @@ ProcessNode.config({
fontSize: 14 fontSize: 14
}, },
}, },
{ // {
tagName: 'text', // tagName: 'text',
selector: 'workshopName', // textContent: '工序名称',
// textContent: '工段1', // attrs: {
attrs: { // x: 20,
x: 128, // y: 30,
y: 80, // },
fill: '#777', // },
fontSize: 14 // {
}, // tagName: 'text',
}, // textContent: '工段名称',
// attrs: {
// x: 115,
// y: 30,
// },
// },
// {
// tagName: 'text',
// selector: 'processName',
// // textContent: '工序00A',
// attrs: {
// x: 26,
// y: 80,
// fill: '#777',
// fontSize: 14
// },
// },
// {
// tagName: 'text',
// selector: 'workshopName',
// // textContent: '工段1',
// attrs: {
// x: 128,
// y: 80,
// fill: '#777',
// fontSize: 14
// },
// },
], ],
// //
propHooks(metadata) { propHooks(metadata) {
const { processName, workshopName, ...others } = metadata; const { processName, workshopName, processDesc, processId, ...others } = metadata;
debugger; // debugger;
if (processName) { if (processName) {
console.log("processName", processName) console.log("processName", processName)
ObjectExt.setByPath(others, 'attrs/processName/text', processName); ObjectExt.setByPath(others, 'attrs/processName/text', processName);
@ -91,6 +122,14 @@ ProcessNode.config({
console.log("workshopName", workshopName) console.log("workshopName", workshopName)
ObjectExt.setByPath(others, 'attrs/workshopName/text', workshopName); ObjectExt.setByPath(others, 'attrs/workshopName/text', workshopName);
} }
if (processDesc) {
console.log("processDesc", processDesc)
ObjectExt.setByPath(others, 'attrs/processDesc/text', processDesc);
}
if (processId) {
console.log("processId", processId)
ObjectExt.setByPath(others, 'processId', processId);
}
return others; return others;
} }
}) })

View File

@ -38,5 +38,7 @@ export default {
padding: 8px; padding: 8px;
flex: 1; flex: 1;
background: #f2f4f9; background: #f2f4f9;
display: flex;
flex-direction: column;
} }
</style> </style>