提交 | 用户 | 时间
|
a57dc2
|
1 |
<template> |
W |
2 |
<div class="panel-tab__content"> |
|
3 |
<el-form size="mini" label-width="90px" @submit.native.prevent> |
|
4 |
<el-form-item label="ID"> |
|
5 |
<el-input |
|
6 |
v-model="elementBaseInfo.id" |
|
7 |
:disabled="idEditDisabled || elementBaseInfo.$type === 'bpmn:Process'" |
|
8 |
clearable |
|
9 |
@change="updateBaseInfo('id')" |
|
10 |
/> |
|
11 |
</el-form-item> |
|
12 |
<el-form-item label="名称"> |
|
13 |
<el-input v-model="elementBaseInfo.name" clearable @change="updateBaseInfo('name')" /> |
|
14 |
</el-form-item> |
|
15 |
<!--流程的基础属性--> |
|
16 |
<template v-if="elementBaseInfo.$type === 'bpmn:Process'"> |
|
17 |
<el-form-item label="版本标签"> |
|
18 |
<el-input v-model="elementBaseInfo.versionTag" clearable @change="updateBaseInfo('versionTag')" /> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item label="可执行"> |
|
21 |
<el-switch v-model="elementBaseInfo.isExecutable" active-text="是" inactive-text="否" @change="updateBaseInfo('isExecutable')" /> |
|
22 |
</el-form-item> |
|
23 |
</template> |
|
24 |
</el-form> |
|
25 |
</div> |
|
26 |
</template> |
|
27 |
<script> |
|
28 |
|
|
29 |
export default { |
|
30 |
name: "ElementBaseInfo", |
|
31 |
props: { |
|
32 |
businessObject: Object, |
|
33 |
type: String, |
|
34 |
idEditDisabled: { |
|
35 |
type: Boolean, |
|
36 |
default: true |
|
37 |
} |
|
38 |
}, |
|
39 |
data() { |
|
40 |
return { |
|
41 |
elementBaseInfo: {}, |
|
42 |
}; |
|
43 |
}, |
|
44 |
watch: { |
|
45 |
businessObject: { |
|
46 |
immediate: false, |
|
47 |
handler: function(val) { |
|
48 |
if (val) { |
|
49 |
this.$nextTick(() => this.resetBaseInfo()); |
|
50 |
} |
|
51 |
} |
|
52 |
} |
|
53 |
}, |
|
54 |
methods: { |
|
55 |
resetBaseInfo() { |
|
56 |
this.bpmnElement = window?.bpmnInstances?.bpmnElement; |
|
57 |
this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject)); |
|
58 |
}, |
|
59 |
updateBaseInfo(key) { |
|
60 |
const attrObj = Object.create(null); |
|
61 |
attrObj[key] = this.elementBaseInfo[key]; |
|
62 |
if (key === "id") { |
|
63 |
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
|
64 |
id: this.elementBaseInfo[key], |
|
65 |
di: { id: `${this.elementBaseInfo[key]}_di` } |
|
66 |
}); |
|
67 |
} else { |
|
68 |
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, attrObj); |
|
69 |
} |
|
70 |
} |
|
71 |
}, |
|
72 |
beforeDestroy() { |
|
73 |
this.bpmnElement = null; |
|
74 |
} |
|
75 |
}; |
|
76 |
</script> |