质量管理
This commit is contained in:
@@ -0,0 +1,302 @@
|
||||
<!--
|
||||
filename: ProcessBomList.vue
|
||||
author: liubin
|
||||
date: 2023-10-20 15:00:58
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<section class="process-bom">
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||
<!-- <small-title :no-padding="true">
|
||||
设备名称: {{ name }}
|
||||
</small-title> -->
|
||||
<div class="btns" style="
|
||||
text-align: right;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
display: flex;
|
||||
">
|
||||
<!-- <el-input icon="el-icon-search" placeholder="搜索" v-model="searchText" style="margin-left: 20px">
|
||||
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
||||
</el-input>
|
||||
<el-button type="primary" plain :disabled="currentDet == null" class="btn-create" icon="el-icon-plus">
|
||||
分配设备
|
||||
</el-button> -->
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-row>
|
||||
<div style="margin-bottom: 10px;font-size: 16px;">设备名称:{{ name }}</div>
|
||||
<el-col class="custom-tabs">
|
||||
<el-tabs v-model="activeName" :stretch="true" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="'\u2002物料追溯\u2002'" name="material">
|
||||
<!-- 列表 -->
|
||||
<base-table class="base-table__margin" :table-props="materialTableProps" :page="1" :limit="10"
|
||||
:table-data="materialList" @emitFun="handleEmitFun"></base-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000参数追溯\u3000'" name="value" style="overflow: inherit">
|
||||
<base-table class="base-table__margin" :table-props="valueTableProps" :page="1" :limit="10"
|
||||
:table-data="valueList" @emitFun="handleEmitFun"></base-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import SmallTitle from './SmallTitle';
|
||||
import {
|
||||
getDetMaterial,
|
||||
getDetValue
|
||||
} from '@/api/quality/processTraceabilityDetail';
|
||||
import StatusBtn from './statusBtn.vue'
|
||||
export default {
|
||||
name: 'ProcessBom',
|
||||
components: {
|
||||
// SmallTitle
|
||||
},
|
||||
props: {
|
||||
currentDet: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detId:undefined,
|
||||
activeName: 'material',
|
||||
searchBarFormConfig: [{ label: '设备参数及物料追溯' },
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间段',
|
||||
dateType: 'daterange', // datetimerange
|
||||
// format: 'yyyy-MM-dd HH:mm:ss',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期',
|
||||
defaultTime: ['00:00:00', '23:59:59'],
|
||||
param: 'timeVal',
|
||||
// width: 350,
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},],
|
||||
materialTableProps: [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: '添加时间',
|
||||
// fixed: true,
|
||||
// width: 180,
|
||||
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
// },
|
||||
{ prop: 'name', label: '物料名称' },
|
||||
{ prop: 'planNum', label: '预计使用数量' },
|
||||
{ prop: 'actualNum', label: '实际使用数量' },
|
||||
],
|
||||
name:null,
|
||||
materialList: [],
|
||||
valueTableProps: [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: '添加时间',
|
||||
// fixed: true,
|
||||
// width: 180,
|
||||
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
// },
|
||||
{ prop: 'name', label: '参数名' },
|
||||
{
|
||||
prop: 'name', label: '设定范围最小- 最大 / 标准',
|
||||
subcomponent: StatusBtn
|
||||
},
|
||||
{
|
||||
prop: 'code', label: '最小值',
|
||||
children: [
|
||||
{
|
||||
prop: 'minValueSet',
|
||||
label: '值'
|
||||
},
|
||||
{
|
||||
prop: 'minValueAppearTime',
|
||||
label: '出现时间'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: 'code', label: '最大值',
|
||||
children: [
|
||||
{
|
||||
prop: 'maxValueSet',
|
||||
label: '值'
|
||||
},
|
||||
{
|
||||
prop: 'maxValueAppearTime',
|
||||
label: '出现时间'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: 'averageValueAppear', label: '平均值',
|
||||
},
|
||||
],
|
||||
valueList: [],
|
||||
total: 0,
|
||||
tableBtn: [],
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
searchText: ''
|
||||
};
|
||||
},
|
||||
// components: {
|
||||
// SmallTitle,
|
||||
// },
|
||||
watch: {
|
||||
currentDet: {
|
||||
handler(val) {
|
||||
if (val != null) {
|
||||
this.getList(val);
|
||||
this.detId = val.detId
|
||||
console.log(val);
|
||||
} else {
|
||||
this.clearList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSearchBarBtnClick(val) {
|
||||
console.log(val)
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
|
||||
},).then((res) => {
|
||||
console.log(res);
|
||||
})
|
||||
// if (timeVal && timeVal.length > 0) {
|
||||
// this.queryParams.time = timeVal;
|
||||
// } else {
|
||||
// this.queryParams.time = [];
|
||||
// }
|
||||
// await this.handleQuery();
|
||||
},
|
||||
handleEmitFun() { },
|
||||
handleTableBtnClick() { },
|
||||
put(payload) {
|
||||
return this.http(this.updateUrl, 'put', payload);
|
||||
},
|
||||
post(payload) {
|
||||
return this.http(this.addUrl, 'post', payload);
|
||||
},
|
||||
recv(payload) {
|
||||
return this.http(this.pageUrl, 'get', payload);
|
||||
},
|
||||
info(payload) {
|
||||
return this.http(this.infoUrl, 'get', payload);
|
||||
},
|
||||
http(url, method, payload) {
|
||||
return this.$axios({
|
||||
url,
|
||||
method,
|
||||
params: method === 'get' ? payload : null,
|
||||
data: method !== 'get' ? payload : null,
|
||||
})
|
||||
},
|
||||
|
||||
// getList({ detId, detName, detDesc, flowId, sectionName } = {}) {
|
||||
// console.log('get list')
|
||||
|
||||
// },
|
||||
handleTabClick(val) {
|
||||
// console.log(this.activeName);
|
||||
if (this.activeName === 'material') {
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
|
||||
},).then((res) => {
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
})
|
||||
} else {
|
||||
getDetValue({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
|
||||
}).then((res) => {
|
||||
this.valueList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
})
|
||||
}
|
||||
},
|
||||
getList(val) {
|
||||
console.log(val);
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
flowDetId: [this.detId],
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
})
|
||||
},
|
||||
clearList() {
|
||||
this.list = [];
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.process-bom {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
padding: 12px 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
:deep(.custom-tabs) {
|
||||
.el-tabs__header {
|
||||
margin-bottom: 8px;
|
||||
display: inline-block;
|
||||
transform: translateY(-12px);
|
||||
}
|
||||
|
||||
.el-tabs__content {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.el-tabs__item {
|
||||
padding-left: 0 !important;
|
||||
padding-right: 0 !important;
|
||||
line-height: 36px !important;
|
||||
height: 36px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,488 @@
|
||||
<!--
|
||||
filename: ProcessGraph.vue
|
||||
author: liubin
|
||||
date: 2023-10-20 15:00:58
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<section class="process-graph">
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
|
||||
|
||||
<!-- <div class="btns" style="text-align: right; position: absolute; top: 20px; right: 20px">
|
||||
<el-button type="warning" @click="undo" plain v-if="allowUndo" :disabled="!allowUndo" icon="el-icon-back">
|
||||
撤销
|
||||
</el-button>
|
||||
<el-button type="warning" @click="redo" plain v-if="allowRedo" :disabled="!allowRedo">
|
||||
下一步
|
||||
<i class="el-icon-right el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-button class="btn-refresh" @click="handleUpdateLayout" icon="el-icon-refresh">
|
||||
刷新布局</el-button>
|
||||
<el-button type="primary" plain class="btn-create" icon="el-icon-plus" @click="handleAdd">
|
||||
新建工序
|
||||
</el-button>
|
||||
<el-button class="btn-edit" :disabled="currentDet == null" @click="handleEdit">编辑</el-button>
|
||||
</div> -->
|
||||
|
||||
<div class="process-graph__panel" ref="panel"></div>
|
||||
|
||||
<base-dialog :dialogTitle="title" :dialogVisible="open" width="35%" @close="cancel" @cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
|
||||
</base-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Graph } from '@antv/x6';
|
||||
import ProcessNode, { createProcessNode, CACHE_NAME, getSectionFrom } from './ProcessNode';
|
||||
import DialogForm from '@/components/DialogForm';
|
||||
// import { IdToName } from '@/utils'
|
||||
// if (process - node){
|
||||
|
||||
// }
|
||||
Graph.registerNode('process-node', ProcessNode, true);
|
||||
|
||||
export default {
|
||||
name: 'ProcessGraph',
|
||||
components: { DialogForm },
|
||||
props: {},
|
||||
inject: ['getFlowId'],
|
||||
data() {
|
||||
return {
|
||||
allowRedo: false,
|
||||
allowUndo: false,
|
||||
graph: null,
|
||||
searchBarFormConfig: [{ label: '工序列表' }],
|
||||
title: '',
|
||||
open: false,
|
||||
form: {
|
||||
name: '', // 工序名称
|
||||
sectionId: '', // 工段id
|
||||
remark: '', // 描述
|
||||
},
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '工序名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '工段',
|
||||
prop: 'sectionId',
|
||||
url: '/base/core-workshop-section/listAll',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
cache: CACHE_NAME
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
textarea: true,
|
||||
label: '工序说明',
|
||||
prop: 'remark',
|
||||
},
|
||||
],
|
||||
],
|
||||
updateUrl: '/extend/process-flow-det/update',
|
||||
deleteUrl: '/extend/process-flow-det/delete',
|
||||
addUrl: '/extend/process-flow-det/create',
|
||||
// pageUrl: '/extend/process-flow-det/get',
|
||||
infoUrl: '/extend/process-flow-view/getByFlowId',
|
||||
layout: {
|
||||
id: null,
|
||||
flowId: null,
|
||||
content: '',
|
||||
createTime: null
|
||||
},
|
||||
currentDet: null,
|
||||
currentNode: null
|
||||
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'form.sectionId': {
|
||||
handler(id) {
|
||||
},
|
||||
immediate: false,
|
||||
},
|
||||
currentDet: {
|
||||
handler(val) {
|
||||
this.$emit('det-selected', val)
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.$route.params.id)
|
||||
this.loadLayout().then(json => {
|
||||
this.initGraph(json)
|
||||
})
|
||||
},
|
||||
// mounted () {
|
||||
// },
|
||||
destroyed() {
|
||||
this.graph.dispose();
|
||||
this.$nextTick(() => {
|
||||
this.resetLayout();
|
||||
this.graph = null;
|
||||
})
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
|
||||
initGraph(json) {
|
||||
const graph = new Graph({
|
||||
container: this.$refs.panel,
|
||||
grid: {
|
||||
size: 10,
|
||||
visible: true,
|
||||
},
|
||||
history: true,
|
||||
selecting: {
|
||||
className: 'my-select'
|
||||
},
|
||||
connecting: {
|
||||
snap: true,
|
||||
allowBlank: false,
|
||||
allowLoop: false,
|
||||
allowNode: false,
|
||||
allowPort: true,
|
||||
allowEdge: false,
|
||||
},
|
||||
panning: true,
|
||||
// scroller: {
|
||||
// enabled: true,
|
||||
// pannable: true,
|
||||
// cursor: '',
|
||||
// width: 800,
|
||||
// height: 200
|
||||
// },
|
||||
mousewheel: {
|
||||
enabled: true,
|
||||
modifiers: ['ctrl', 'meta']
|
||||
}
|
||||
});
|
||||
|
||||
graph.fromJSON(json)
|
||||
this.graph = graph;
|
||||
this.$nextTick(() => {
|
||||
this.registerGraphEvents();
|
||||
})
|
||||
},
|
||||
|
||||
registerGraphEvents() {
|
||||
const reset = () => {
|
||||
const nodes = this.graph.getNodes();
|
||||
const edges = this.graph.getEdges();
|
||||
this.currentDet = null;
|
||||
this.currentNode = null;
|
||||
|
||||
nodes.forEach(node => {
|
||||
node.attr('container/stroke', '#ccc');
|
||||
});
|
||||
edges.forEach(edge => {
|
||||
edge.attr('line/stroke', '#ccc')
|
||||
})
|
||||
}
|
||||
|
||||
this.graph.on('node:click', ({ e, x, y, node, view }) => {
|
||||
reset();
|
||||
node.attr('container/stroke', '#0b58ff');
|
||||
const { detId, detName, detDesc, processId, sectionId, sectionName } = node.attrs;
|
||||
this.currentDet = {}
|
||||
this.$set(this.currentDet, 'detId', detId.text)
|
||||
this.$set(this.currentDet, 'sectionId', sectionId.text)
|
||||
this.$set(this.currentDet, 'detName', detName.text)
|
||||
this.$set(this.currentDet, 'detDesc', detDesc.text)
|
||||
this.$set(this.currentDet, 'flowId', processId.text)
|
||||
this.$set(this.currentDet, 'sectionName', sectionName.text)
|
||||
this.currentNode = node
|
||||
});
|
||||
this.graph.on('edge:click', ({ e, x, y, edge, view }) => {
|
||||
// console.log('edge clicked!', edge)
|
||||
reset();
|
||||
edge.attr('line/stroke', '#0b58ff')
|
||||
});
|
||||
this.graph.on('blank:click', ({ e, x, y }) => {x
|
||||
reset();
|
||||
});
|
||||
this.graph.on('node:mouseenter', ({ node }) => {
|
||||
node.addTools({
|
||||
name: 'button-remove',
|
||||
args: {
|
||||
x: '100%',
|
||||
y: 0,
|
||||
offset: { x: 0, y: 0 },
|
||||
onClick: ({ e, cell, view }) => {
|
||||
this.$confirm(
|
||||
'确定删除这个工序吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
).then(async () => {
|
||||
const id = node.attrs.detId.text;
|
||||
const status = await this.handleDelete(id);
|
||||
if (status) {
|
||||
view.cell.remove();
|
||||
}
|
||||
}).catch(err => {
|
||||
return;
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
this.graph.on('node:mouseleave', ({ node }) => {
|
||||
node.removeTools();
|
||||
})
|
||||
},
|
||||
|
||||
resetLayout() {
|
||||
this.layout = {
|
||||
id: null,
|
||||
flowId: null,
|
||||
content: '',
|
||||
createTime: null
|
||||
}
|
||||
},
|
||||
|
||||
async loadLayout() {
|
||||
const flowId = this.$route.params.id;
|
||||
console.log(flowId)
|
||||
if (!flowId) return { cells: [] }
|
||||
const { code, data } = await this.info({ id: flowId });
|
||||
if (code == 0) {
|
||||
if (data) {
|
||||
this.layout = data;
|
||||
return JSON.parse(data?.content) || { cells: [] };
|
||||
}
|
||||
return { cells: [] };
|
||||
}
|
||||
this.resetLayout();
|
||||
return Promise.reject(this.infoUrl + ' 接口出错!');
|
||||
},
|
||||
|
||||
handleToJson() { },
|
||||
|
||||
handleLoadJson() { },
|
||||
|
||||
handleDumpJson() {
|
||||
if (this.graph) {
|
||||
console.log(JSON.stringify(this.graph.toJSON(), null, 2));
|
||||
}
|
||||
},
|
||||
|
||||
async handleUpdateLayout() {
|
||||
this.layout.content = JSON.stringify(this.graph.toJSON());
|
||||
let code, data;
|
||||
console.table([this.layout, this.$route.params.id])
|
||||
// 手动刷新布局
|
||||
if (this.layout.id) {
|
||||
({ code, data } = await this.http('/extend/process-flow-view/update', 'put', this.layout));
|
||||
} else {
|
||||
this.layout.flowId = this.$route.params.id;
|
||||
({ code, data } = await this.http('/extend/process-flow-view/create', 'post', this.layout));
|
||||
}
|
||||
|
||||
if (code == 0) {
|
||||
this.$modal.msgSuccess('布局已刷新!')
|
||||
}
|
||||
},
|
||||
|
||||
reset() {
|
||||
this.form = {
|
||||
name: '', // 工序名称
|
||||
sectionId: '', // 工段id
|
||||
remark: '', // 描述
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加工序';
|
||||
},
|
||||
|
||||
handleEdit() {
|
||||
this.form.name = this.currentDet.detName;
|
||||
this.form.sectionId = this.currentDet.sectionId;
|
||||
this.form.remark = this.currentDet.detDesc;
|
||||
this.form.id = this.currentDet.detId;
|
||||
this.title = '编辑工序';
|
||||
this.$nextTick(() => {
|
||||
this.open = true;
|
||||
})
|
||||
},
|
||||
|
||||
async handleDelete(id) {
|
||||
const { code, data } = await this.delete({ id });
|
||||
debugger;
|
||||
if (code == 0) {
|
||||
this.$modal.msgSuccess('成功删除一个工序!');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
this.updateProcess()
|
||||
.then((form) => {
|
||||
const { name, sectionId, remark } = form;
|
||||
getSectionFrom(sectionId).then(sectionName => {
|
||||
// 修改当前node的信息
|
||||
this.currentNode.setAttrs({
|
||||
detName: { text: name },
|
||||
sectionId: { text: sectionId },
|
||||
sectionName: { text: sectionName },
|
||||
detDesc: { text: remark }
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(err => { });
|
||||
return;
|
||||
}
|
||||
|
||||
this.createProcess()
|
||||
.then(({ id, name, sectionId, remark, flowId }) => {
|
||||
if (!id) return null;
|
||||
return createProcessNode({
|
||||
flowId: flowId,
|
||||
name, sectionId, remark,
|
||||
id,
|
||||
})
|
||||
}).then(node => {
|
||||
if (!node) {
|
||||
this.$modal.msgError('创建节点失败');
|
||||
return;
|
||||
};
|
||||
this.graph.addNode(node);
|
||||
}).catch(err => {
|
||||
return;
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
updateProcess() {
|
||||
const flowId = this.getFlowId();
|
||||
if (!flowId) {
|
||||
this.$modal.msgError('工艺ID不能为空');
|
||||
return Promise.reject('工艺ID不能为空');
|
||||
}
|
||||
return this.put({ flowId, ...this.form })
|
||||
.then(({ code, data }) => {
|
||||
if (code == 0) {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
} else {
|
||||
this.$modal.msgError('修改失败');
|
||||
}
|
||||
const formCopy = { ...this.form }
|
||||
this.open = false;
|
||||
return formCopy;
|
||||
});
|
||||
},
|
||||
|
||||
createProcess() {
|
||||
// const flowId = this.$route.params.id;
|
||||
const flowId = this.getFlowId(); // it also works
|
||||
if (!flowId) {
|
||||
this.$modal.msgError('工艺ID不能为空');
|
||||
return Promise.reject('工艺ID不能为空');
|
||||
}
|
||||
console.log('create process', this.form)
|
||||
// 添加的提交
|
||||
return this.post({ flowId, ...this.form }).then(
|
||||
({ code, data }) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
// this.getList();
|
||||
return {
|
||||
id: data, // 服务器返回的新建的工段id
|
||||
...this.form, // 保存一份 this.form 副本,当 open->false 时 this.form 里的信息就清空了
|
||||
flowId
|
||||
};
|
||||
}
|
||||
).catch(err => {
|
||||
this.$modal.msgError(err)
|
||||
});
|
||||
},
|
||||
|
||||
put(payload) {
|
||||
return this.http(this.updateUrl, 'put', payload);
|
||||
},
|
||||
post(payload) {
|
||||
return this.http(this.addUrl, 'post', payload);
|
||||
},
|
||||
recv(payload) {
|
||||
return this.http(this.pageUrl, 'get', payload);
|
||||
},
|
||||
info(payload) {
|
||||
return this.http(this.infoUrl, 'get', payload);
|
||||
},
|
||||
delete({ id }) {
|
||||
return this.$axios({
|
||||
url: this.deleteUrl + `?id=${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
},
|
||||
http(url, method, payload) {
|
||||
return this.$axios({
|
||||
url,
|
||||
method,
|
||||
params: method === 'get' ? payload : null,
|
||||
data: method !== 'get' ? payload : null,
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.process-graph {
|
||||
padding: 12px 20px 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.process-graph__panel {
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.x6-widget-selection-selected {
|
||||
border: 1px solid red;
|
||||
}
|
||||
|
||||
.my-select {
|
||||
border: 1px solid red;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,126 @@
|
||||
<!--
|
||||
filename: ProcessInfo.vue
|
||||
author: liubin
|
||||
date: 2023-10-20 15:00:58
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<section class="process-info">
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
|
||||
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="6">
|
||||
<InfoItem label="工单名称" :value="form.name" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<InfoItem label="工艺名称" :value="form.processFlowName" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<InfoItem label="产品名称" :value="form.productName" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<InfoItem label="产品规格" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
const InfoItem = {
|
||||
name: 'InfoItem',
|
||||
components: {},
|
||||
props: ['label', 'value'],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {},
|
||||
methods: {},
|
||||
render: function (h) {
|
||||
return (
|
||||
<div style="display: flex; align-items: center; font-size: 14px; line-height: 1.5">
|
||||
<span style="width: 100px; text-align: left; font-weight: 700">{this.label}:</span>
|
||||
<span style="width: 200px; text-align: left; text-overflow: ellipse; white-space: nowrap">
|
||||
{this.value}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'ProcessInfo',
|
||||
components: { InfoItem },
|
||||
props: {},
|
||||
inject: ['getFlowId'],
|
||||
data() {
|
||||
return {
|
||||
infoUrl: '/extend/process-flow/get',
|
||||
searchBarFormConfig: [{ label: '工艺详情' }],
|
||||
form: {
|
||||
id: null,
|
||||
name: null,
|
||||
productName: null,
|
||||
processFlowName: null,
|
||||
// remark: null,
|
||||
// enable: null,
|
||||
// code: null
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getInfo()
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
// utils
|
||||
// http(url, method, payload) {
|
||||
// return this.$axios({
|
||||
// url,
|
||||
// method,
|
||||
// params: method === 'get' ? payload : null,
|
||||
// data: method !== 'get' ? payload : null,
|
||||
// })
|
||||
// },
|
||||
// put(payload) {
|
||||
// return this.http(this.updateUrl, 'put', payload);
|
||||
// },
|
||||
// post(payload) {
|
||||
// return this.http(this.addUrl, 'post', payload);
|
||||
// },
|
||||
// recv(payload) {
|
||||
// return this.http(this.pageUrl, 'get', payload);
|
||||
// },
|
||||
// info(payload) {
|
||||
// return this.http(this.infoUrl, 'get', payload);
|
||||
// },
|
||||
async getInfo() {
|
||||
this.form.name = this.$route.params.name
|
||||
this.form.productName = this.$route.params.productName
|
||||
this.form.processFlowName = this.$route.params.processFlowName
|
||||
// this.form.name = this.$route.params.name
|
||||
// const flowId = this.$route.params.id;
|
||||
// console.log(flowId);
|
||||
// if (!flowId) this.$router.go(-1);
|
||||
// const { code, data } = await this.info({ id: flowId });
|
||||
// // debugger;
|
||||
// if (code == 0) {
|
||||
// this.form = {
|
||||
// ...data
|
||||
// };
|
||||
// } else {
|
||||
// this.$modal.msgError('工艺信息获取失败')
|
||||
// }
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.process-info {
|
||||
padding: 12px 20px 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,170 @@
|
||||
import { Node, ObjectExt, Shape } from '@antv/x6';
|
||||
import { IdToName } from '@/utils'
|
||||
import cache from '@/utils/cache'
|
||||
import axios from '@/utils/request'
|
||||
import { v4 } from 'uuid'
|
||||
|
||||
Shape.Edge.config({
|
||||
attrs: {
|
||||
line: {
|
||||
stroke: '#ccc',
|
||||
strokeWidth: 1,
|
||||
targetMarker: {
|
||||
name: 'block',
|
||||
width: 1,
|
||||
height: 1
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
export default class ProcessNode extends Node { }
|
||||
ProcessNode.config({
|
||||
width: 200,
|
||||
height: 100,
|
||||
markup: [
|
||||
{
|
||||
tagName: 'rect',
|
||||
selector: 'container',
|
||||
attrs: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 200,
|
||||
height: 100,
|
||||
fill: 'transparent',
|
||||
stroke: '#ccc'
|
||||
},
|
||||
},
|
||||
{
|
||||
tagName: 'rect',
|
||||
attrs: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 200,
|
||||
height: 50,
|
||||
fill: '#ffffff',
|
||||
},
|
||||
},
|
||||
{
|
||||
tagName: 'rect',
|
||||
attrs: {
|
||||
x: 0,
|
||||
y: 50,
|
||||
width: 200,
|
||||
height: 50,
|
||||
fill: '#f8f8f8',
|
||||
},
|
||||
},
|
||||
{
|
||||
tagName: 'text',
|
||||
selector: 'detName',
|
||||
attrs: {
|
||||
x: 20,
|
||||
y: 30,
|
||||
},
|
||||
},
|
||||
{
|
||||
tagName: 'text',
|
||||
selector: 'sectionName',
|
||||
attrs: {
|
||||
x: 115,
|
||||
y: 30,
|
||||
},
|
||||
},
|
||||
{
|
||||
tagName: 'text',
|
||||
selector: 'detDesc',
|
||||
attrs: {
|
||||
x: 26,
|
||||
y: 80,
|
||||
fill: '#777',
|
||||
fontSize: 14,
|
||||
fill: '#1a90fc',
|
||||
},
|
||||
},
|
||||
],
|
||||
attrs: {
|
||||
line: {
|
||||
fill: 'red'
|
||||
}
|
||||
},
|
||||
ports: {
|
||||
groups: {
|
||||
in: {
|
||||
position: 'left',
|
||||
attrs: {
|
||||
circle: {
|
||||
r: 2,
|
||||
magnet: true,
|
||||
stroke: '#0b58ff',
|
||||
strokeWidth: 1,
|
||||
fill: '#0b58ff'
|
||||
}
|
||||
}
|
||||
},
|
||||
out: {
|
||||
position: 'right',
|
||||
attrs: {
|
||||
circle: {
|
||||
r: 2,
|
||||
magnet: true,
|
||||
stroke: '#0b58ff',
|
||||
strokeWidth: 1,
|
||||
fill: '#0b58ff'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
propHooks(metadata) {
|
||||
const { detId, detName, detDesc, sectionName, processId, sectionId, ...others } = metadata;
|
||||
// debugger;
|
||||
if (detName) ObjectExt.setByPath(others, 'attrs/detName/text', detName);
|
||||
if (detDesc) ObjectExt.setByPath(others, 'attrs/detDesc/text', detDesc);
|
||||
if (sectionName) ObjectExt.setByPath(others, 'attrs/sectionName/text', sectionName);
|
||||
if (detId) ObjectExt.setByPath(others, 'attrs/detId/text', detId);
|
||||
if (processId) ObjectExt.setByPath(others, 'attrs/processId/text', processId);
|
||||
if (sectionId) ObjectExt.setByPath(others, 'attrs/sectionId/text', sectionId);
|
||||
return others;
|
||||
}
|
||||
});
|
||||
|
||||
export const CACHE_NAME = 'ProcessDetail::section';
|
||||
|
||||
export async function getSectionFrom(sectionId) {
|
||||
const sectionList = await cache.getList(
|
||||
CACHE_NAME,
|
||||
async () => {
|
||||
const { code, data } = await axios(
|
||||
'/base/core-production-line/listAll'
|
||||
);
|
||||
if (code == 0) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
);
|
||||
return IdToName(sectionId, sectionList);
|
||||
}
|
||||
|
||||
export async function createProcessNode({ flowId, id, name, sectionId, remark }) {
|
||||
const sectionName = await getSectionFrom(sectionId);
|
||||
return {
|
||||
shape: 'process-node',
|
||||
x: 0,
|
||||
y: 0,
|
||||
detName: name, // 工序名称
|
||||
sectionName, // 工段
|
||||
sectionId,
|
||||
detDesc: remark, // 工序说明
|
||||
processId: flowId, // 工艺ID
|
||||
detId: id, // 工序ID
|
||||
tools: [],
|
||||
ports: [
|
||||
{ id: v4(), group: 'in' },
|
||||
{ id: v4(), group: 'out' },
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
export async function createEdge(src, dest) { }
|
||||
@@ -0,0 +1,72 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-09 16:32:21
|
||||
* @LastEditTime: 2023-11-09 16:32:21
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-07 19:28:13
|
||||
* @LastEditTime: 2023-11-08 14:11:43
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div :class="[className, { 'p-0': noPadding }]">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
size: {
|
||||
// 取值范围: xl lg md sm
|
||||
type: String,
|
||||
default: 'de',
|
||||
validator: function (val) {
|
||||
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
|
||||
},
|
||||
},
|
||||
noPadding: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
className: function () {
|
||||
return `${this.size}-title`;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
|
||||
$mgr: 8px;
|
||||
@each $size, $height in $pxls {
|
||||
.#{$size}-title {
|
||||
font-size: 18px;
|
||||
line-height: $height;
|
||||
color: #000;
|
||||
font-weight: 500;
|
||||
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 4px;
|
||||
height: $height + 2px;
|
||||
border-radius: 1px;
|
||||
margin-right: $mgr;
|
||||
background-color: #0b58ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.p-0 {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,63 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-10 09:18:48
|
||||
* @LastEditTime: 2023-11-10 09:23:24
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<span>
|
||||
{{ injectData.minValueSet + '-' + injectData.maxValueSet + "/" + injectData / defaultValueSet }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// state: false
|
||||
}
|
||||
},
|
||||
// computed: {
|
||||
// readonly() {
|
||||
// return !!this.injectData.readonly
|
||||
// }
|
||||
// },
|
||||
// mounted() {
|
||||
// this.mapToState()
|
||||
// },
|
||||
|
||||
methods: {
|
||||
// mapToState() {
|
||||
// if (this.injectData.prop === 'enabled') {
|
||||
// this.state = this.injectData.enabled === 1 ? true : false
|
||||
// }
|
||||
// },
|
||||
// changeHandler() {
|
||||
// // let params = {}
|
||||
// let payload = {}
|
||||
// // params.name = 'state'
|
||||
// payload.id = this.injectData.id
|
||||
// payload.enabled = this.state ? '1' : '0'
|
||||
// payload.code = this.injectData.code
|
||||
// payload.name = this.injectData.name
|
||||
// payload.equipmentId = this.injectData.equipmentId
|
||||
// payload.remark = this.injectData.remark
|
||||
|
||||
// // params.payload = payload
|
||||
// updateProcessEquMaterialBom(payload).then((res) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$modal.msgSuccess("操作成功");
|
||||
// }
|
||||
// })
|
||||
// // this.$emit('emitData', params)
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user