add:引入bpmn
This commit is contained in:
@@ -7,6 +7,9 @@
|
|||||||
<el-form-item label="节点名称">
|
<el-form-item label="节点名称">
|
||||||
<el-input v-model="form.name" @input="nameChange"></el-input>
|
<el-input v-model="form.name" @input="nameChange"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="表单类型">
|
||||||
|
<el-input v-model="form.type22" @input="nameChange"></el-input>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="节点颜色">
|
<el-form-item label="节点颜色">
|
||||||
<el-color-picker v-model="form.color" @active-change="colorChange"></el-color-picker>
|
<el-color-picker v-model="form.color" @active-change="colorChange"></el-color-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -21,7 +24,7 @@
|
|||||||
<!-- 指定人员 -->
|
<!-- 指定人员 -->
|
||||||
<el-form-item label="指定人员" v-if="userTask && form.userType === 'assignee'">
|
<el-form-item label="指定人员" v-if="userTask && form.userType === 'assignee'">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.assignee"
|
v-model="form.form_type"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
key="1"
|
key="1"
|
||||||
@change="(value) => addUser({assignee: value})"
|
@change="(value) => addUser({assignee: value})"
|
||||||
@@ -83,7 +86,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "PropertyPanel",
|
name: 'PropertyPanel',
|
||||||
props: {
|
props: {
|
||||||
modeler: {
|
modeler: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -93,7 +96,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
userTask() {
|
userTask() {
|
||||||
if (!this.element) {
|
if (!this.element) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
return this.element.type === 'bpmn:UserTask'
|
return this.element.type === 'bpmn:UserTask'
|
||||||
},
|
},
|
||||||
@@ -109,7 +112,8 @@ export default {
|
|||||||
form: {
|
form: {
|
||||||
id: "",
|
id: "",
|
||||||
name: "",
|
name: "",
|
||||||
color: null
|
color: null,
|
||||||
|
form_type: null
|
||||||
},
|
},
|
||||||
element: {},
|
element: {},
|
||||||
users: [
|
users: [
|
||||||
@@ -151,7 +155,6 @@ export default {
|
|||||||
this.modeler.on("selection.changed", e => {
|
this.modeler.on("selection.changed", e => {
|
||||||
const element = e.newSelection[0];
|
const element = e.newSelection[0];
|
||||||
this.element = element;
|
this.element = element;
|
||||||
console.log(this.element);
|
|
||||||
if (!element) return;
|
if (!element) return;
|
||||||
this.form = {
|
this.form = {
|
||||||
...element.businessObject,
|
...element.businessObject,
|
||||||
@@ -182,11 +185,16 @@ export default {
|
|||||||
// 属性面板颜色,更新回流程节点
|
// 属性面板颜色,更新回流程节点
|
||||||
colorChange(color) {
|
colorChange(color) {
|
||||||
const modeling = this.modeler.get("modeling");
|
const modeling = this.modeler.get("modeling");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
modeling.setColor(this.element, {
|
modeling.setColor(this.element, {
|
||||||
fill: null,
|
fill: null,
|
||||||
stroke: color
|
stroke: color
|
||||||
});
|
})
|
||||||
modeling.updateProperties(this.element, { color: color });
|
modeling.updateProperties(this.element, { color: color })
|
||||||
|
// 设置扩展属性
|
||||||
|
|
||||||
},
|
},
|
||||||
// 任务节点配置人员
|
// 任务节点配置人员
|
||||||
addUser(properties) {
|
addUser(properties) {
|
||||||
@@ -206,11 +214,11 @@ export default {
|
|||||||
},
|
},
|
||||||
// 在这里我们封装一个通用的更新节点属性的方法
|
// 在这里我们封装一个通用的更新节点属性的方法
|
||||||
updateProperties(properties) {
|
updateProperties(properties) {
|
||||||
const modeling = this.modeler.get("modeling");
|
const modeling = this.modeler.get('modeling')
|
||||||
modeling.updateProperties(this.element, properties);
|
modeling.updateProperties(this.element, properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -29,9 +29,12 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
const canvas = this.$refs.canvas
|
const canvas = this.$refs.canvas
|
||||||
// 生成实例
|
// 生成实例
|
||||||
|
const panel = this.$refs.panel
|
||||||
|
|
||||||
this.bpmnModeler = new BpmnModeler({
|
this.bpmnModeler = new BpmnModeler({
|
||||||
additionalModules: [customPalette],
|
additionalModules: [customPalette],
|
||||||
container: canvas
|
container: canvas
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取a标签dom节点
|
// 获取a标签dom节点
|
||||||
@@ -161,7 +164,7 @@ export default {
|
|||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
} else {
|
} else {
|
||||||
this.adjustPalette()
|
// this.adjustPalette()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -235,6 +238,7 @@ export default {
|
|||||||
const encodedData = encodeURIComponent(data)
|
const encodedData = encodeURIComponent(data)
|
||||||
// 获取到图的xml,保存就是把这个xml提交给后台
|
// 获取到图的xml,保存就是把这个xml提交给后台
|
||||||
this.xmlStr = data
|
this.xmlStr = data
|
||||||
|
console.log(data)
|
||||||
// 下载图的具体操作,改变a的属性,className令a标签可点击,href令能下载,download是下载的文件的名字
|
// 下载图的具体操作,改变a的属性,className令a标签可点击,href令能下载,download是下载的文件的名字
|
||||||
if (data) {
|
if (data) {
|
||||||
link.className = 'active'
|
link.className = 'active'
|
||||||
@@ -252,6 +256,7 @@ export default {
|
|||||||
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn.css";
|
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn.css";
|
||||||
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css";
|
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css";
|
||||||
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css";
|
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css";
|
||||||
|
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css";
|
||||||
|
|
||||||
.containers {
|
.containers {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
|
|||||||
group: 'tools',
|
group: 'tools',
|
||||||
className: 'bpmn-icon-lasso-tool',
|
className: 'bpmn-icon-lasso-tool',
|
||||||
title: translate('Activate the lasso tool'),
|
title: translate('Activate the lasso tool'),
|
||||||
action: {
|
action: {//时间:点击拖拽等等
|
||||||
click: function(event) {
|
click: function(event) {
|
||||||
lassoTool.activateSelection(event);
|
lassoTool.activateSelection(event);
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
|
|||||||
'create.subprocess-expanded': {
|
'create.subprocess-expanded': {
|
||||||
group: 'activity',
|
group: 'activity',
|
||||||
className: 'bpmn-icon-subprocess-expanded',
|
className: 'bpmn-icon-subprocess-expanded',
|
||||||
title: translate('Create expanded SubProcess'),
|
title: '创建一个样式Create expanded SubProcess',
|
||||||
action: {
|
action: {
|
||||||
dragstart: createSubprocess,
|
dragstart: createSubprocess,
|
||||||
click: createSubprocess
|
click: createSubprocess
|
||||||
|
|||||||
Reference in New Issue
Block a user