|
@@ -9,25 +9,57 @@ |
|
|
<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="warning" @click="undo" plain v-if="allowUndo" :disabled="!allowUndo" icon="el-icon-back"> |
|
|
|
|
|
|
|
|
<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> |
|
|
<el-button type="warning" @click="redo" plain v-if="allowRedo" :disabled="!allowRedo"> |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
type="warning" |
|
|
|
|
|
@click="redo" |
|
|
|
|
|
plain |
|
|
|
|
|
v-if="allowRedo" |
|
|
|
|
|
:disabled="!allowRedo"> |
|
|
下一步 |
|
|
下一步 |
|
|
<i class="el-icon-right el-icon--right"></i> |
|
|
<i class="el-icon-right el-icon--right"></i> |
|
|
</el-button> |
|
|
</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 |
|
|
|
|
|
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> |
|
|
<el-button class="btn-edit" :disabled="currentDet == null" @click="handleEdit">编辑</el-button> |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
class="btn-edit" |
|
|
|
|
|
:disabled="currentDet == null" |
|
|
|
|
|
@click="handleEdit"> |
|
|
|
|
|
编辑 |
|
|
|
|
|
</el-button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="process-graph__panel" ref="panel"></div> |
|
|
<div class="process-graph__panel" ref="panel"></div> |
|
|
|
|
|
|
|
|
<base-dialog :dialogTitle="title" :dialogVisible="open" width="35%" @close="cancel" @cancel="cancel" |
|
|
|
|
|
|
|
|
<base-dialog |
|
|
|
|
|
:dialogTitle="title" |
|
|
|
|
|
:dialogVisible="open" |
|
|
|
|
|
width="35%" |
|
|
|
|
|
@close="cancel" |
|
|
|
|
|
@cancel="cancel" |
|
|
@confirm="submitForm"> |
|
|
@confirm="submitForm"> |
|
|
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" /> |
|
|
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" /> |
|
|
</base-dialog> |
|
|
</base-dialog> |
|
@@ -36,11 +68,15 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { Graph } from '@antv/x6'; |
|
|
import { Graph } from '@antv/x6'; |
|
|
import ProcessNode, { createProcessNode, CACHE_NAME, getSectionFrom } from './ProcessNode'; |
|
|
|
|
|
|
|
|
import ProcessNode, { |
|
|
|
|
|
createProcessNode, |
|
|
|
|
|
CACHE_NAME, |
|
|
|
|
|
getSectionFrom, |
|
|
|
|
|
} from './ProcessNode'; |
|
|
import DialogForm from '@/components/DialogForm'; |
|
|
import DialogForm from '@/components/DialogForm'; |
|
|
// import { IdToName } from '@/utils' |
|
|
// import { IdToName } from '@/utils' |
|
|
|
|
|
|
|
|
Graph.registerNode('process-node', ProcessNode,true); |
|
|
|
|
|
|
|
|
Graph.registerNode('process-node', ProcessNode, true); |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'ProcessGraph', |
|
|
name: 'ProcessGraph', |
|
@@ -79,7 +115,7 @@ export default { |
|
|
bind: { |
|
|
bind: { |
|
|
filterable: true, |
|
|
filterable: true, |
|
|
}, |
|
|
}, |
|
|
cache: CACHE_NAME |
|
|
|
|
|
|
|
|
cache: CACHE_NAME, |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
@@ -99,42 +135,39 @@ export default { |
|
|
id: null, |
|
|
id: null, |
|
|
flowId: null, |
|
|
flowId: null, |
|
|
content: '', |
|
|
content: '', |
|
|
createTime: null |
|
|
|
|
|
|
|
|
createTime: null, |
|
|
}, |
|
|
}, |
|
|
currentDet: null, |
|
|
currentDet: null, |
|
|
currentNode: null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currentNode: null, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
'form.sectionId': { |
|
|
'form.sectionId': { |
|
|
handler(id) { |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
handler(id) {}, |
|
|
immediate: false, |
|
|
immediate: false, |
|
|
}, |
|
|
}, |
|
|
currentDet: { |
|
|
currentDet: { |
|
|
handler(val) { |
|
|
handler(val) { |
|
|
this.$emit('det-selected', val) |
|
|
|
|
|
|
|
|
this.$emit('det-selected', val); |
|
|
}, |
|
|
}, |
|
|
deep: true, |
|
|
deep: true, |
|
|
immediate: true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
immediate: true, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
activated() { |
|
|
activated() { |
|
|
this.loadLayout().then(json => { |
|
|
|
|
|
this.initGraph(json) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
this.loadLayout().then((json) => { |
|
|
|
|
|
this.initGraph(json); |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
deactivated() { |
|
|
deactivated() { |
|
|
this.graph.dispose(); |
|
|
this.graph.dispose(); |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.resetLayout(); |
|
|
this.resetLayout(); |
|
|
this.graph = null; |
|
|
this.graph = null; |
|
|
}) |
|
|
|
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
computed: {}, |
|
|
computed: {}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
|
|
|
initGraph(json) { |
|
|
initGraph(json) { |
|
|
const graph = new Graph({ |
|
|
const graph = new Graph({ |
|
|
container: this.$refs.panel, |
|
|
container: this.$refs.panel, |
|
@@ -144,7 +177,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
history: true, |
|
|
history: true, |
|
|
selecting: { |
|
|
selecting: { |
|
|
className: 'my-select' |
|
|
|
|
|
|
|
|
className: 'my-select', |
|
|
}, |
|
|
}, |
|
|
connecting: { |
|
|
connecting: { |
|
|
snap: true, |
|
|
snap: true, |
|
@@ -155,24 +188,17 @@ export default { |
|
|
allowEdge: false, |
|
|
allowEdge: false, |
|
|
}, |
|
|
}, |
|
|
panning: true, |
|
|
panning: true, |
|
|
// scroller: { |
|
|
|
|
|
// enabled: true, |
|
|
|
|
|
// pannable: true, |
|
|
|
|
|
// cursor: '', |
|
|
|
|
|
// width: 800, |
|
|
|
|
|
// height: 200 |
|
|
|
|
|
// }, |
|
|
|
|
|
mousewheel: { |
|
|
mousewheel: { |
|
|
enabled: true, |
|
|
enabled: true, |
|
|
modifiers: ['ctrl', 'meta'] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
modifiers: ['ctrl', 'meta'], |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
console.log(json) |
|
|
|
|
|
graph.fromJSON(json) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
graph.fromJSON(json); |
|
|
this.graph = graph; |
|
|
this.graph = graph; |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.registerGraphEvents(); |
|
|
this.registerGraphEvents(); |
|
|
}) |
|
|
|
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
registerGraphEvents() { |
|
|
registerGraphEvents() { |
|
@@ -182,31 +208,33 @@ export default { |
|
|
this.currentDet = null; |
|
|
this.currentDet = null; |
|
|
this.currentNode = null; |
|
|
this.currentNode = null; |
|
|
|
|
|
|
|
|
nodes.forEach(node => { |
|
|
|
|
|
|
|
|
nodes.forEach((node) => { |
|
|
node.attr('container/stroke', '#ccc'); |
|
|
node.attr('container/stroke', '#ccc'); |
|
|
}); |
|
|
}); |
|
|
edges.forEach(edge => { |
|
|
|
|
|
edge.attr('line/stroke', '#ccc') |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
edges.forEach((edge) => { |
|
|
|
|
|
edge.attr('line/stroke', '#ccc'); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
this.graph.on('node:click', ({ e, x, y, node, view }) => { |
|
|
this.graph.on('node:click', ({ e, x, y, node, view }) => { |
|
|
reset(); |
|
|
reset(); |
|
|
node.attr('container/stroke', '#0b58ff'); |
|
|
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 |
|
|
|
|
|
|
|
|
const { detId, detName, detDesc, processId, sectionId, sectionName } = |
|
|
|
|
|
node.attrs; |
|
|
|
|
|
console.log('node clicked!', node) |
|
|
|
|
|
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 }) => { |
|
|
this.graph.on('edge:click', ({ e, x, y, edge, view }) => { |
|
|
// console.log('edge clicked!', edge) |
|
|
// console.log('edge clicked!', edge) |
|
|
reset(); |
|
|
reset(); |
|
|
edge.attr('line/stroke', '#0b58ff') |
|
|
|
|
|
|
|
|
edge.attr('line/stroke', '#0b58ff'); |
|
|
}); |
|
|
}); |
|
|
this.graph.on('blank:click', ({ e, x, y }) => { |
|
|
this.graph.on('blank:click', ({ e, x, y }) => { |
|
|
reset(); |
|
|
reset(); |
|
@@ -219,30 +247,30 @@ export default { |
|
|
y: 0, |
|
|
y: 0, |
|
|
offset: { x: 0, y: 0 }, |
|
|
offset: { x: 0, y: 0 }, |
|
|
onClick: ({ e, cell, view }) => { |
|
|
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.$confirm('确定删除这个工序吗?', '提示', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning', |
|
|
}) |
|
|
}) |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
.then(async () => { |
|
|
|
|
|
const id = node.attrs.detId.text; |
|
|
|
|
|
const status = await this.handleDelete(id); |
|
|
|
|
|
if (status) { |
|
|
|
|
|
view.cell.remove(); |
|
|
|
|
|
// 更新布局,不然下次打开删除的节点还在 |
|
|
|
|
|
this.handleUpdateLayout(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
return; |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
this.graph.on('node:mouseleave', ({ node }) => { |
|
|
this.graph.on('node:mouseleave', ({ node }) => { |
|
|
node.removeTools(); |
|
|
node.removeTools(); |
|
|
}) |
|
|
|
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
resetLayout() { |
|
|
resetLayout() { |
|
@@ -250,13 +278,13 @@ export default { |
|
|
id: null, |
|
|
id: null, |
|
|
flowId: null, |
|
|
flowId: null, |
|
|
content: '', |
|
|
content: '', |
|
|
createTime: null |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
createTime: null, |
|
|
|
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async loadLayout() { |
|
|
async loadLayout() { |
|
|
const flowId = this.$route.params.id; |
|
|
const flowId = this.$route.params.id; |
|
|
if (!flowId) return { cells: [] } |
|
|
|
|
|
|
|
|
if (!flowId) return { cells: [] }; |
|
|
const { code, data } = await this.info({ id: flowId }); |
|
|
const { code, data } = await this.info({ id: flowId }); |
|
|
if (code == 0) { |
|
|
if (code == 0) { |
|
|
if (data) { |
|
|
if (data) { |
|
@@ -269,9 +297,9 @@ export default { |
|
|
return Promise.reject(this.infoUrl + ' 接口出错!'); |
|
|
return Promise.reject(this.infoUrl + ' 接口出错!'); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleToJson() { }, |
|
|
|
|
|
|
|
|
handleToJson() {}, |
|
|
|
|
|
|
|
|
handleLoadJson() { }, |
|
|
|
|
|
|
|
|
handleLoadJson() {}, |
|
|
|
|
|
|
|
|
handleDumpJson() { |
|
|
handleDumpJson() { |
|
|
if (this.graph) { |
|
|
if (this.graph) { |
|
@@ -282,17 +310,25 @@ export default { |
|
|
async handleUpdateLayout() { |
|
|
async handleUpdateLayout() { |
|
|
this.layout.content = JSON.stringify(this.graph.toJSON()); |
|
|
this.layout.content = JSON.stringify(this.graph.toJSON()); |
|
|
let code, data; |
|
|
let code, data; |
|
|
console.table([this.layout, this.$route.params.id]) |
|
|
|
|
|
|
|
|
console.table([this.layout, this.$route.params.id]); |
|
|
// 手动刷新布局 |
|
|
// 手动刷新布局 |
|
|
if (this.layout.id) { |
|
|
if (this.layout.id) { |
|
|
({ code, data } = await this.http('/extend/process-flow-view/update', 'put', this.layout)); |
|
|
|
|
|
|
|
|
({ code, data } = await this.http( |
|
|
|
|
|
'/extend/process-flow-view/update', |
|
|
|
|
|
'put', |
|
|
|
|
|
this.layout |
|
|
|
|
|
)); |
|
|
} else { |
|
|
} else { |
|
|
this.layout.flowId = this.$route.params.id; |
|
|
this.layout.flowId = this.$route.params.id; |
|
|
({ code, data } = await this.http('/extend/process-flow-view/create', 'post', this.layout)); |
|
|
|
|
|
|
|
|
({ code, data } = await this.http( |
|
|
|
|
|
'/extend/process-flow-view/create', |
|
|
|
|
|
'post', |
|
|
|
|
|
this.layout |
|
|
|
|
|
)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == 0) { |
|
|
if (code == 0) { |
|
|
this.$modal.msgSuccess('布局已刷新!') |
|
|
|
|
|
|
|
|
this.$modal.msgSuccess('布局已刷新!'); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@@ -325,12 +361,11 @@ export default { |
|
|
this.title = '编辑工序'; |
|
|
this.title = '编辑工序'; |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.open = true; |
|
|
this.open = true; |
|
|
}) |
|
|
|
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async handleDelete(id) { |
|
|
async handleDelete(id) { |
|
|
const { code, data } = await this.delete({ id }); |
|
|
const { code, data } = await this.delete({ id }); |
|
|
debugger; |
|
|
|
|
|
if (code == 0) { |
|
|
if (code == 0) { |
|
|
this.$modal.msgSuccess('成功删除一个工序!'); |
|
|
this.$modal.msgSuccess('成功删除一个工序!'); |
|
|
return true; |
|
|
return true; |
|
@@ -349,17 +384,17 @@ export default { |
|
|
this.updateProcess() |
|
|
this.updateProcess() |
|
|
.then((form) => { |
|
|
.then((form) => { |
|
|
const { name, sectionId, remark } = form; |
|
|
const { name, sectionId, remark } = form; |
|
|
getSectionFrom(sectionId).then(sectionName => { |
|
|
|
|
|
|
|
|
getSectionFrom(sectionId).then((sectionName) => { |
|
|
// 修改当前node的信息 |
|
|
// 修改当前node的信息 |
|
|
this.currentNode.setAttrs({ |
|
|
this.currentNode.setAttrs({ |
|
|
detName: { text: name }, |
|
|
detName: { text: name }, |
|
|
sectionId: { text: sectionId }, |
|
|
sectionId: { text: sectionId }, |
|
|
sectionName: { text: sectionName }, |
|
|
sectionName: { text: sectionName }, |
|
|
detDesc: { text: remark } |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
detDesc: { text: remark }, |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
}) |
|
|
}) |
|
|
.catch(err => { }); |
|
|
|
|
|
|
|
|
.catch((err) => {}); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -368,19 +403,22 @@ export default { |
|
|
if (!id) return null; |
|
|
if (!id) return null; |
|
|
return createProcessNode({ |
|
|
return createProcessNode({ |
|
|
flowId: flowId, |
|
|
flowId: flowId, |
|
|
name, sectionId, remark, |
|
|
|
|
|
|
|
|
name, |
|
|
|
|
|
sectionId, |
|
|
|
|
|
remark, |
|
|
id, |
|
|
id, |
|
|
}) |
|
|
|
|
|
}).then(node => { |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}) |
|
|
|
|
|
.then((node) => { |
|
|
if (!node) { |
|
|
if (!node) { |
|
|
this.$modal.msgError('创建节点失败'); |
|
|
this.$modal.msgError('创建节点失败'); |
|
|
return; |
|
|
return; |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
this.graph.addNode(node); |
|
|
this.graph.addNode(node); |
|
|
}).catch(err => { |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
return; |
|
|
return; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@@ -390,17 +428,16 @@ export default { |
|
|
this.$modal.msgError('工艺ID不能为空'); |
|
|
this.$modal.msgError('工艺ID不能为空'); |
|
|
return Promise.reject('工艺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; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
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() { |
|
|
createProcess() { |
|
@@ -410,22 +447,22 @@ export default { |
|
|
this.$modal.msgError('工艺ID不能为空'); |
|
|
this.$modal.msgError('工艺ID不能为空'); |
|
|
return Promise.reject('工艺ID不能为空'); |
|
|
return Promise.reject('工艺ID不能为空'); |
|
|
} |
|
|
} |
|
|
console.log('create process', this.form) |
|
|
|
|
|
|
|
|
console.log('create process', this.form); |
|
|
// 添加的提交 |
|
|
// 添加的提交 |
|
|
return this.post({ flowId, ...this.form }).then( |
|
|
|
|
|
({ code, data }) => { |
|
|
|
|
|
|
|
|
return this.post({ flowId, ...this.form }) |
|
|
|
|
|
.then(({ code, data }) => { |
|
|
this.$modal.msgSuccess('新增成功'); |
|
|
this.$modal.msgSuccess('新增成功'); |
|
|
this.open = false; |
|
|
this.open = false; |
|
|
// this.getList(); |
|
|
// this.getList(); |
|
|
return { |
|
|
return { |
|
|
id: data, // 服务器返回的新建的工段id |
|
|
id: data, // 服务器返回的新建的工段id |
|
|
...this.form, // 保存一份 this.form 副本,当 open->false 时 this.form 里的信息就清空了 |
|
|
|
|
|
flowId |
|
|
|
|
|
|
|
|
...this.form, // 保存一份 this.form 副本,当 open->false 时 this.form 里的信息就清空了 |
|
|
|
|
|
flowId, |
|
|
}; |
|
|
}; |
|
|
} |
|
|
|
|
|
).catch(err => { |
|
|
|
|
|
this.$modal.msgError(err) |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
this.$modal.msgError(err); |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
put(payload) { |
|
|
put(payload) { |
|
@@ -452,7 +489,7 @@ export default { |
|
|
method, |
|
|
method, |
|
|
params: method === 'get' ? payload : null, |
|
|
params: method === 'get' ? payload : null, |
|
|
data: method !== 'get' ? payload : null, |
|
|
data: method !== 'get' ? payload : null, |
|
|
}) |
|
|
|
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|