tianheng-ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -18
- package/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
- package/lib/2d84c80112a372bc149cad3464e90fa3.js +1617 -0
- package/lib/5977b934a4c6b480790864ea01303173.js +10834 -0
- package/lib/7745f3e776488705a38e62f85adad54d.js +16 -0
- package/lib/de8dee841ffdaaede3a2254deef30376.js +15395 -0
- package/lib/e78eab250e7f8ccac3d918dfdb06ca10.js +8904 -0
- package/lib/theme-chalk/fonts/PingFang.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.eot +0 -0
- package/lib/theme-chalk/fonts/bpmn.svg +224 -0
- package/lib/theme-chalk/fonts/bpmn.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff2 +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.eot +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.svg +2671 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.ttf +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff2 +0 -0
- package/lib/theme-chalk/fonts/iconfont.eot +0 -0
- package/lib/theme-chalk/fonts/iconfont.svg +155 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/lib/theme-chalk/images/notData.png +0 -0
- package/lib/theme-chalk/index.scss +31 -0
- package/lib/theme-chalk/js/Log.js +99 -0
- package/lib/theme-chalk/js/axios.js +86 -0
- package/lib/theme-chalk/js/store/getters.js +5 -0
- package/lib/theme-chalk/js/store/modules/makingForm.js +21 -0
- package/lib/theme-chalk/js/store/store.js +26 -0
- package/lib/theme-chalk/styles/button.scss +501 -0
- package/lib/theme-chalk/styles/card.scss +29 -0
- package/lib/theme-chalk/styles/cell.scss +54 -0
- package/lib/theme-chalk/styles/codeEditor.scss +9 -0
- package/lib/theme-chalk/styles/col.scss +151 -0
- package/lib/theme-chalk/styles/dialog.scss +56 -0
- package/lib/theme-chalk/styles/empty.scss +22 -0
- package/lib/theme-chalk/styles/feature.scss +46 -0
- package/lib/theme-chalk/styles/font.css +7 -0
- package/lib/theme-chalk/styles/grid.scss +41 -0
- package/lib/theme-chalk/styles/icon.css +1944 -0
- package/lib/theme-chalk/styles/imagePreview.scss +113 -0
- package/lib/theme-chalk/styles/img.scss +35 -0
- package/lib/theme-chalk/styles/reset.scss +17 -0
- package/lib/theme-chalk/styles/root.css +64 -0
- package/lib/theme-chalk/styles/row.scss +23 -0
- package/lib/theme-chalk/styles/upload.scss +744 -0
- package/lib/theme-chalk/styles/variable.scss +80 -0
- package/lib/tianheng-ui.js +116 -0
- package/package.json +86 -48
- package/packages/Button/index.js +8 -0
- package/packages/Button/index.vue +80 -0
- package/packages/Card/index.js +8 -0
- package/packages/Card/index.vue +37 -0
- package/packages/Cell/index.js +8 -0
- package/packages/Cell/index.vue +68 -0
- package/packages/CodeEditor/index.js +8 -0
- package/packages/CodeEditor/index.vue +177 -0
- package/packages/Col/index.js +8 -0
- package/packages/Col/index.vue +43 -0
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/index.vue +129 -0
- package/packages/Empty/index.js +8 -0
- package/packages/Empty/index.vue +35 -0
- package/packages/FormMaking/FormConfig.vue +60 -0
- package/packages/FormMaking/GenerateForm.vue +308 -0
- package/packages/FormMaking/GenerateFormItem.vue +887 -0
- package/packages/FormMaking/GenerateFormItemH5.vue +825 -0
- package/packages/FormMaking/Upload/index.vue +572 -0
- package/packages/FormMaking/WidgetConfig.vue +472 -0
- package/packages/FormMaking/WidgetForm.vue +159 -0
- package/packages/FormMaking/WidgetFormItem.vue +187 -0
- package/packages/FormMaking/custom/config.js +762 -0
- package/packages/FormMaking/custom/configs/alliance.vue +0 -0
- package/packages/FormMaking/custom/configs/blank.vue +54 -0
- package/packages/FormMaking/custom/configs/button.vue +172 -0
- package/packages/FormMaking/custom/configs/cascader.vue +175 -0
- package/packages/FormMaking/custom/configs/cell.vue +81 -0
- package/packages/FormMaking/custom/configs/checkbox.vue +234 -0
- package/packages/FormMaking/custom/configs/color.vue +137 -0
- package/packages/FormMaking/custom/configs/date.vue +158 -0
- package/packages/FormMaking/custom/configs/divider.vue +61 -0
- package/packages/FormMaking/custom/configs/editor.vue +71 -0
- package/packages/FormMaking/custom/configs/filler.vue +57 -0
- package/packages/FormMaking/custom/configs/grid.vue +103 -0
- package/packages/FormMaking/custom/configs/image.vue +138 -0
- package/packages/FormMaking/custom/configs/input.vue +176 -0
- package/packages/FormMaking/custom/configs/number.vue +140 -0
- package/packages/FormMaking/custom/configs/radio.vue +211 -0
- package/packages/FormMaking/custom/configs/rate.vue +109 -0
- package/packages/FormMaking/custom/configs/select.vue +305 -0
- package/packages/FormMaking/custom/configs/slider.vue +142 -0
- package/packages/FormMaking/custom/configs/switch.vue +130 -0
- package/packages/FormMaking/custom/configs/table.vue +105 -0
- package/packages/FormMaking/custom/configs/table_h5.vue +102 -0
- package/packages/FormMaking/custom/configs/tabs.vue +175 -0
- package/packages/FormMaking/custom/configs/text.vue +71 -0
- package/packages/FormMaking/custom/configs/textarea.vue +167 -0
- package/packages/FormMaking/custom/configs/time.vue +153 -0
- package/packages/FormMaking/custom/configs/upload.vue +155 -0
- package/packages/FormMaking/custom/index.js +32 -0
- package/packages/FormMaking/custom/items/alliance.vue +132 -0
- package/packages/FormMaking/custom/items/blank.vue +16 -0
- package/packages/FormMaking/custom/items/button.vue +27 -0
- package/packages/FormMaking/custom/items/cascader.vue +29 -0
- package/packages/FormMaking/custom/items/cell.vue +18 -0
- package/packages/FormMaking/custom/items/checkbox.vue +46 -0
- package/packages/FormMaking/custom/items/color.vue +19 -0
- package/packages/FormMaking/custom/items/date.vue +29 -0
- package/packages/FormMaking/custom/items/divider.vue +14 -0
- package/packages/FormMaking/custom/items/editor.vue +22 -0
- package/packages/FormMaking/custom/items/filler.vue +17 -0
- package/packages/FormMaking/custom/items/grid.vue +130 -0
- package/packages/FormMaking/custom/items/image.vue +70 -0
- package/packages/FormMaking/custom/items/input.vue +33 -0
- package/packages/FormMaking/custom/items/login.vue +13 -0
- package/packages/FormMaking/custom/items/number.vue +24 -0
- package/packages/FormMaking/custom/items/radio.vue +44 -0
- package/packages/FormMaking/custom/items/rate.vue +20 -0
- package/packages/FormMaking/custom/items/select.vue +32 -0
- package/packages/FormMaking/custom/items/slider.vue +34 -0
- package/packages/FormMaking/custom/items/switch.vue +22 -0
- package/packages/FormMaking/custom/items/table.vue +106 -0
- package/packages/FormMaking/custom/items/table_h5.vue +126 -0
- package/packages/FormMaking/custom/items/tabs.vue +145 -0
- package/packages/FormMaking/custom/items/text.vue +18 -0
- package/packages/FormMaking/custom/items/textarea.vue +37 -0
- package/packages/FormMaking/custom/items/time.vue +32 -0
- package/packages/FormMaking/custom/items/upload.vue +102 -0
- package/packages/FormMaking/custom/mixins/index.js +61 -0
- package/packages/FormMaking/custom/register.js +18 -0
- package/packages/FormMaking/generate.js +5 -0
- package/packages/FormMaking/iconfont/demo.css +539 -0
- package/packages/FormMaking/iconfont/demo_index.html +1159 -0
- package/packages/FormMaking/iconfont/iconfont.css +189 -0
- package/packages/FormMaking/iconfont/iconfont.eot +0 -0
- package/packages/FormMaking/iconfont/iconfont.js +1 -0
- package/packages/FormMaking/iconfont/iconfont.svg +155 -0
- package/packages/FormMaking/iconfont/iconfont.ttf +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff2 +0 -0
- package/packages/FormMaking/index.js +33 -0
- package/packages/FormMaking/index.vue +807 -0
- package/packages/FormMaking/lang/en-US.js +187 -0
- package/packages/FormMaking/lang/zh-CN.js +187 -0
- package/packages/FormMaking/making.js +9 -0
- package/packages/FormMaking/styles/cover.scss +41 -0
- package/packages/FormMaking/styles/index.scss +785 -0
- package/packages/FormMaking/util/generateCode.js +163 -0
- package/packages/FormMaking/util/index.js +33 -0
- package/packages/FormMaking/util/request.js +28 -0
- package/packages/Grid/index.js +8 -0
- package/packages/Grid/index.vue +21 -0
- package/packages/GridItem/index.js +8 -0
- package/packages/GridItem/index.vue +69 -0
- package/packages/Icons/index.js +8 -0
- package/packages/Icons/index.vue +377 -0
- package/packages/Image/index.js +8 -0
- package/packages/Image/index.vue +146 -0
- package/packages/ImagePreview/index.js +8 -0
- package/packages/ImagePreview/index.vue +386 -0
- package/packages/Row/index.js +8 -0
- package/packages/Row/index.vue +33 -0
- package/packages/Table/action.js +8 -0
- package/packages/Table/action.vue +168 -0
- package/packages/Table/column.vue +63 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/index.vue +327 -0
- package/packages/Table/search.js +8 -0
- package/packages/Table/search.vue +163 -0
- package/packages/Table/tools.js +8 -0
- package/packages/Table/tools.vue +49 -0
- package/packages/TableMaking/custom/configs/fieldSearch.vue +17 -0
- package/packages/TableMaking/custom/configs/fieldTable.vue +15 -0
- package/packages/TableMaking/custom/items/search/index.vue +158 -0
- package/packages/TableMaking/custom/items/tools/index.vue +49 -0
- package/packages/TableMaking/generate.js +5 -0
- package/packages/TableMaking/generateTable.vue +560 -0
- package/packages/TableMaking/index.vue +234 -0
- package/packages/TableMaking/making.js +5 -0
- package/packages/TableMaking/util/index.js +433 -0
- package/packages/TableMaking/widgetConfig.vue +390 -0
- package/packages/TableMaking/widgetTable.vue +305 -0
- package/packages/Upload/ajax.js +85 -0
- package/packages/Upload/index.js +8 -0
- package/packages/Upload/index.vue +325 -0
- package/packages/Upload/upload-dragger.vue +70 -0
- package/packages/Upload/upload-list.vue +121 -0
- package/packages/Upload/upload.vue +193 -0
- package/packages/VueEditor/index.js +8 -0
- package/packages/VueEditor/index.vue +38 -0
- package/packages/Workflow/Log.js +99 -0
- package/packages/Workflow/designer/ProcessDesigner.vue +628 -0
- package/packages/Workflow/designer/index.js +7 -0
- package/packages/Workflow/designer/plugins/content-pad/contentPadProvider.js +390 -0
- package/packages/Workflow/designer/plugins/content-pad/index.js +6 -0
- package/packages/Workflow/designer/plugins/defaultEmpty.js +24 -0
- package/packages/Workflow/designer/plugins/descriptor/activitiDescriptor.json +1071 -0
- package/packages/Workflow/designer/plugins/descriptor/camundaDescriptor.json +1087 -0
- package/packages/Workflow/designer/plugins/descriptor/flowableDescriptor.json +1215 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/activitiExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/index.js +9 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/extension.js +148 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/index.js +6 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/flowableExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/index.js +9 -0
- package/packages/Workflow/designer/plugins/palette/CustomPalette.js +156 -0
- package/packages/Workflow/designer/plugins/palette/index.js +6 -0
- package/packages/Workflow/designer/plugins/palette/paletteProvider.js +160 -0
- package/packages/Workflow/designer/plugins/translate/customTranslate.js +41 -0
- package/packages/Workflow/designer/plugins/translate/zh.js +238 -0
- package/packages/Workflow/highlight/index.js +5 -0
- package/packages/Workflow/index.js +34 -0
- package/packages/Workflow/index.vue +399 -0
- package/packages/Workflow/modules/auto-place/CustomAutoPlace.js +81 -0
- package/packages/Workflow/modules/auto-place/index.js +6 -0
- package/packages/Workflow/modules/custom-renderer/CustomRenderer.js +17 -0
- package/packages/Workflow/modules/custom-renderer/index.js +6 -0
- package/packages/Workflow/modules/rules/CustomRules.js +16 -0
- package/packages/Workflow/modules/rules/index.js +6 -0
- package/packages/Workflow/palette/ProcessPalette.vue +106 -0
- package/packages/Workflow/palette/index.js +7 -0
- package/packages/Workflow/penal/PropertiesPanel.vue +245 -0
- package/packages/Workflow/penal/base/ElementBaseInfo.vue +80 -0
- package/packages/Workflow/penal/flow-condition/FlowCondition.vue +142 -0
- package/packages/Workflow/penal/form/ElementForm.vue +367 -0
- package/packages/Workflow/penal/index.js +7 -0
- package/packages/Workflow/penal/listeners/ElementListeners.vue +299 -0
- package/packages/Workflow/penal/listeners/UserTaskListeners.vue +322 -0
- package/packages/Workflow/penal/listeners/template.js +178 -0
- package/packages/Workflow/penal/listeners/utilSelf.js +64 -0
- package/packages/Workflow/penal/multi-instance/ElementMultiInstance.vue +200 -0
- package/packages/Workflow/penal/other/ElementOtherConfig.vue +59 -0
- package/packages/Workflow/penal/properties/ElementProperties.vue +135 -0
- package/packages/Workflow/penal/signal-message/SignalAndMessage.vue +104 -0
- package/packages/Workflow/penal/task/ElementTask.vue +73 -0
- package/packages/Workflow/penal/task/task-components/ReceiveTask.vue +97 -0
- package/packages/Workflow/penal/task/task-components/ScriptTask.vue +85 -0
- package/packages/Workflow/penal/task/task-components/UserTask.vue +535 -0
- package/packages/Workflow/theme/element-variables.scss +70 -0
- package/packages/Workflow/theme/index.scss +2 -0
- package/packages/Workflow/theme/process-designer.scss +157 -0
- package/packages/Workflow/theme/process-panel.scss +107 -0
- package/packages/Workflow/translations.js +25 -0
- package/packages/Workflow/utils.js +71 -0
- package/packages/index.js +160 -0
- package/babel.config.js +0 -15
- package/index.js +0 -11
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/App.vue +0 -28
- package/src/assets/logo.png +0 -0
- package/src/components/HelloWorld.vue +0 -58
- package/src/main.js +0 -8
@@ -0,0 +1,142 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="panel-tab__content">
|
3
|
+
<el-form :model="flowConditionForm" label-width="90px" size="mini" @submit.native.prevent>
|
4
|
+
<el-form-item label="流转类型">
|
5
|
+
<el-select v-model="flowConditionForm.type" @change="updateFlowType">
|
6
|
+
<el-option label="普通流转路径" value="normal" />
|
7
|
+
<el-option label="默认流转路径" value="default" />
|
8
|
+
<el-option label="条件流转路径" value="condition" />
|
9
|
+
</el-select>
|
10
|
+
</el-form-item>
|
11
|
+
<el-form-item label="条件格式" v-if="flowConditionForm.type === 'condition'" key="condition">
|
12
|
+
<el-select v-model="flowConditionForm.conditionType">
|
13
|
+
<el-option label="表达式" value="expression" />
|
14
|
+
<el-option label="脚本" value="script" />
|
15
|
+
</el-select>
|
16
|
+
</el-form-item>
|
17
|
+
<el-form-item label="表达式" v-if="flowConditionForm.conditionType && flowConditionForm.conditionType === 'expression'" key="express">
|
18
|
+
<el-input v-model="flowConditionForm.body" clearable @change="updateFlowCondition" />
|
19
|
+
</el-form-item>
|
20
|
+
<template v-if="flowConditionForm.conditionType && flowConditionForm.conditionType === 'script'">
|
21
|
+
<el-form-item label="脚本语言" key="language">
|
22
|
+
<el-input v-model="flowConditionForm.language" clearable @change="updateFlowCondition" />
|
23
|
+
</el-form-item>
|
24
|
+
<el-form-item label="脚本类型" key="scriptType">
|
25
|
+
<el-select v-model="flowConditionForm.scriptType">
|
26
|
+
<el-option label="内联脚本" value="inlineScript" />
|
27
|
+
<el-option label="外部脚本" value="externalScript" />
|
28
|
+
</el-select>
|
29
|
+
</el-form-item>
|
30
|
+
<el-form-item label="脚本" v-if="flowConditionForm.scriptType === 'inlineScript'" key="body">
|
31
|
+
<el-input v-model="flowConditionForm.body" type="textarea" clearable @change="updateFlowCondition" />
|
32
|
+
</el-form-item>
|
33
|
+
<el-form-item label="资源地址" v-if="flowConditionForm.scriptType === 'externalScript'" key="resource">
|
34
|
+
<el-input v-model="flowConditionForm.resource" clearable @change="updateFlowCondition" />
|
35
|
+
</el-form-item>
|
36
|
+
</template>
|
37
|
+
</el-form>
|
38
|
+
</div>
|
39
|
+
</template>
|
40
|
+
|
41
|
+
<script>
|
42
|
+
export default {
|
43
|
+
name: "FlowCondition",
|
44
|
+
props: {
|
45
|
+
businessObject: Object,
|
46
|
+
type: String
|
47
|
+
},
|
48
|
+
data() {
|
49
|
+
return {
|
50
|
+
flowConditionForm: {}
|
51
|
+
};
|
52
|
+
},
|
53
|
+
watch: {
|
54
|
+
businessObject: {
|
55
|
+
immediate: true,
|
56
|
+
handler() {
|
57
|
+
this.$nextTick(() => this.resetFlowCondition());
|
58
|
+
}
|
59
|
+
}
|
60
|
+
},
|
61
|
+
methods: {
|
62
|
+
resetFlowCondition() {
|
63
|
+
this.bpmnElement = window.bpmnInstances.bpmnElement;
|
64
|
+
this.bpmnElementSource = this.bpmnElement.source;
|
65
|
+
this.bpmnElementSourceRef = this.bpmnElement.businessObject.sourceRef;
|
66
|
+
if (this.bpmnElementSourceRef && this.bpmnElementSourceRef.default && this.bpmnElementSourceRef.default.id === this.bpmnElement.id) {
|
67
|
+
// 默认
|
68
|
+
this.flowConditionForm = { type: "default" };
|
69
|
+
} else if (!this.bpmnElement.businessObject.conditionExpression) {
|
70
|
+
// 普通
|
71
|
+
this.flowConditionForm = { type: "normal" };
|
72
|
+
} else {
|
73
|
+
// 带条件
|
74
|
+
const conditionExpression = this.bpmnElement.businessObject.conditionExpression;
|
75
|
+
this.flowConditionForm = { ...conditionExpression, type: "condition" };
|
76
|
+
// resource 可直接标识 是否是外部资源脚本
|
77
|
+
if (this.flowConditionForm.resource) {
|
78
|
+
this.$set(this.flowConditionForm, "conditionType", "script");
|
79
|
+
this.$set(this.flowConditionForm, "scriptType", "externalScript");
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
if (conditionExpression.language) {
|
83
|
+
this.$set(this.flowConditionForm, "conditionType", "script");
|
84
|
+
this.$set(this.flowConditionForm, "scriptType", "inlineScript");
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
this.$set(this.flowConditionForm, "conditionType", "expression");
|
88
|
+
}
|
89
|
+
},
|
90
|
+
updateFlowType(flowType) {
|
91
|
+
// 正常条件类
|
92
|
+
if (flowType === "condition") {
|
93
|
+
this.flowConditionRef = window.bpmnInstances.moddle.create("bpmn:FormalExpression");
|
94
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
|
95
|
+
conditionExpression: this.flowConditionRef
|
96
|
+
});
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
// 默认路径
|
100
|
+
if (flowType === "default") {
|
101
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
|
102
|
+
conditionExpression: null
|
103
|
+
});
|
104
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElementSource, {
|
105
|
+
default: this.bpmnElement
|
106
|
+
});
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
// 正常路径,如果来源节点的默认路径是当前连线时,清除父元素的默认路径配置
|
110
|
+
if (this.bpmnElementSourceRef.default && this.bpmnElementSourceRef.default.id === this.bpmnElement.id) {
|
111
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElementSource, {
|
112
|
+
default: null
|
113
|
+
});
|
114
|
+
}
|
115
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
|
116
|
+
conditionExpression: null
|
117
|
+
});
|
118
|
+
},
|
119
|
+
updateFlowCondition() {
|
120
|
+
let { conditionType, scriptType, body, resource, language } = this.flowConditionForm;
|
121
|
+
let condition;
|
122
|
+
if (conditionType === "expression") {
|
123
|
+
condition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body });
|
124
|
+
} else {
|
125
|
+
if (scriptType === "inlineScript") {
|
126
|
+
condition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body, language });
|
127
|
+
this.$set(this.flowConditionForm, "resource", "");
|
128
|
+
} else {
|
129
|
+
this.$set(this.flowConditionForm, "body", "");
|
130
|
+
condition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { resource, language });
|
131
|
+
}
|
132
|
+
}
|
133
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { conditionExpression: condition });
|
134
|
+
}
|
135
|
+
},
|
136
|
+
beforeDestroy() {
|
137
|
+
this.bpmnElement = null;
|
138
|
+
this.bpmnElementSource = null;
|
139
|
+
this.bpmnElementSourceRef = null;
|
140
|
+
}
|
141
|
+
};
|
142
|
+
</script>
|
@@ -0,0 +1,367 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="panel-tab__content">
|
3
|
+
<el-form size="mini" label-width="80px" @submit.native.prevent>
|
4
|
+
<el-form-item label="表单标识">
|
5
|
+
<el-input v-model="formKey" clearable @change="updateElementFormKey" />
|
6
|
+
</el-form-item>
|
7
|
+
<el-form-item label="业务标识">
|
8
|
+
<el-select v-model="businessKey" @change="updateElementBusinessKey">
|
9
|
+
<el-option v-for="i in fieldList" :key="i.id" :value="i.id" :label="i.label" />
|
10
|
+
<el-option label="无" value="" />
|
11
|
+
</el-select>
|
12
|
+
</el-form-item>
|
13
|
+
</el-form>
|
14
|
+
|
15
|
+
<!--字段列表-->
|
16
|
+
<div class="element-property list-property">
|
17
|
+
<el-divider><i class="el-icon-coin"></i> 表单字段</el-divider>
|
18
|
+
<el-table :data="fieldList" size="mini" max-height="240" border fit>
|
19
|
+
<el-table-column label="序号" type="index" width="50px" />
|
20
|
+
<el-table-column label="字段名称" prop="label" min-width="80px" show-overflow-tooltip />
|
21
|
+
<el-table-column label="字段类型" prop="type" min-width="80px" :formatter="row => fieldType[row.type] || row.type" show-overflow-tooltip />
|
22
|
+
<el-table-column label="默认值" prop="defaultValue" min-width="80px" show-overflow-tooltip />
|
23
|
+
<el-table-column label="操作" width="90px">
|
24
|
+
<template slot-scope="{ row, $index }">
|
25
|
+
<el-button size="mini" type="text" @click="openFieldForm(row, $index)">编辑</el-button>
|
26
|
+
<el-divider direction="vertical" />
|
27
|
+
<el-button size="mini" type="text" style="color: #ff4d4f" @click="removeField(row, $index)">移除</el-button>
|
28
|
+
</template>
|
29
|
+
</el-table-column>
|
30
|
+
</el-table>
|
31
|
+
</div>
|
32
|
+
<div class="element-drawer__button">
|
33
|
+
<el-button size="mini" type="primary" icon="el-icon-plus" @click="openFieldForm(null, -1)">添加字段</el-button>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<!--字段配置侧边栏-->
|
37
|
+
<el-drawer :visible.sync="fieldModelVisible" title="字段配置" :size="`${width}px`" append-to-body destroy-on-close>
|
38
|
+
<el-form :model="formFieldForm" label-width="90px" size="mini" @submit.native.prevent>
|
39
|
+
<el-form-item label="字段ID">
|
40
|
+
<el-input v-model="formFieldForm.id" clearable />
|
41
|
+
</el-form-item>
|
42
|
+
<el-form-item label="类型">
|
43
|
+
<el-select v-model="formFieldForm.typeType" placeholder="请选择字段类型" clearable @change="changeFieldTypeType">
|
44
|
+
<el-option v-for="(value, key) of fieldType" :label="value" :value="key" :key="key" />
|
45
|
+
</el-select>
|
46
|
+
</el-form-item>
|
47
|
+
<el-form-item label="类型名称" v-if="formFieldForm.typeType === 'custom'">
|
48
|
+
<el-input v-model="formFieldForm.type" clearable />
|
49
|
+
</el-form-item>
|
50
|
+
<el-form-item label="名称">
|
51
|
+
<el-input v-model="formFieldForm.label" clearable />
|
52
|
+
</el-form-item>
|
53
|
+
<el-form-item label="时间格式" v-if="formFieldForm.typeType === 'date'">
|
54
|
+
<el-input v-model="formFieldForm.datePattern" clearable />
|
55
|
+
</el-form-item>
|
56
|
+
<el-form-item label="默认值">
|
57
|
+
<el-input v-model="formFieldForm.defaultValue" clearable />
|
58
|
+
</el-form-item>
|
59
|
+
</el-form>
|
60
|
+
|
61
|
+
<!-- 枚举值设置 -->
|
62
|
+
<template v-if="formFieldForm.type === 'enum'">
|
63
|
+
<el-divider key="enum-divider" />
|
64
|
+
<p class="listener-filed__title" key="enum-title">
|
65
|
+
<span><i class="el-icon-menu"></i>枚举值列表:</span>
|
66
|
+
<el-button size="mini" type="primary" @click="openFieldOptionForm(null, -1, 'enum')">添加枚举值</el-button>
|
67
|
+
</p>
|
68
|
+
<el-table :data="fieldEnumList" size="mini" key="enum-table" max-height="240" border fit>
|
69
|
+
<el-table-column label="序号" width="50px" type="index" />
|
70
|
+
<el-table-column label="枚举值编号" prop="id" min-width="100px" show-overflow-tooltip />
|
71
|
+
<el-table-column label="枚举值名称" prop="name" min-width="100px" show-overflow-tooltip />
|
72
|
+
<el-table-column label="操作" width="90px">
|
73
|
+
<template slot-scope="{ row, $index }">
|
74
|
+
<el-button size="mini" type="text" @click="openFieldOptionForm(row, $index, 'enum')">编辑</el-button>
|
75
|
+
<el-divider direction="vertical" />
|
76
|
+
<el-button size="mini" type="text" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'enum')">移除</el-button>
|
77
|
+
</template>
|
78
|
+
</el-table-column>
|
79
|
+
</el-table>
|
80
|
+
</template>
|
81
|
+
|
82
|
+
<!-- 校验规则 -->
|
83
|
+
<el-divider key="validation-divider" />
|
84
|
+
<p class="listener-filed__title" key="validation-title">
|
85
|
+
<span><i class="el-icon-menu"></i>约束条件列表:</span>
|
86
|
+
<el-button size="mini" type="primary" @click="openFieldOptionForm(null, -1, 'constraint')">添加约束</el-button>
|
87
|
+
</p>
|
88
|
+
<el-table :data="fieldConstraintsList" size="mini" key="validation-table" max-height="240" border fit>
|
89
|
+
<el-table-column label="序号" width="50px" type="index" />
|
90
|
+
<el-table-column label="约束名称" prop="name" min-width="100px" show-overflow-tooltip />
|
91
|
+
<el-table-column label="约束配置" prop="config" min-width="100px" show-overflow-tooltip />
|
92
|
+
<el-table-column label="操作" width="90px">
|
93
|
+
<template slot-scope="{ row, $index }">
|
94
|
+
<el-button size="mini" type="text" @click="openFieldOptionForm(row, $index, 'constraint')">编辑</el-button>
|
95
|
+
<el-divider direction="vertical" />
|
96
|
+
<el-button size="mini" type="text" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'constraint')">移除</el-button>
|
97
|
+
</template>
|
98
|
+
</el-table-column>
|
99
|
+
</el-table>
|
100
|
+
|
101
|
+
<!-- 表单属性 -->
|
102
|
+
<el-divider key="property-divider" />
|
103
|
+
<p class="listener-filed__title" key="property-title">
|
104
|
+
<span><i class="el-icon-menu"></i>字段属性列表:</span>
|
105
|
+
<el-button size="mini" type="primary" @click="openFieldOptionForm(null, -1, 'property')">添加属性</el-button>
|
106
|
+
</p>
|
107
|
+
<el-table :data="fieldPropertiesList" size="mini" key="property-table" max-height="240" border fit>
|
108
|
+
<el-table-column label="序号" width="50px" type="index" />
|
109
|
+
<el-table-column label="属性编号" prop="id" min-width="100px" show-overflow-tooltip />
|
110
|
+
<el-table-column label="属性值" prop="value" min-width="100px" show-overflow-tooltip />
|
111
|
+
<el-table-column label="操作" width="90px">
|
112
|
+
<template slot-scope="{ row, $index }">
|
113
|
+
<el-button size="mini" type="text" @click="openFieldOptionForm(row, $index, 'property')">编辑</el-button>
|
114
|
+
<el-divider direction="vertical" />
|
115
|
+
<el-button size="mini" type="text" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'property')">移除</el-button>
|
116
|
+
</template>
|
117
|
+
</el-table-column>
|
118
|
+
</el-table>
|
119
|
+
|
120
|
+
<!-- 底部按钮 -->
|
121
|
+
<div class="element-drawer__button">
|
122
|
+
<el-button size="mini">取 消</el-button>
|
123
|
+
<el-button size="mini" type="primary" @click="saveField">保 存</el-button>
|
124
|
+
</div>
|
125
|
+
</el-drawer>
|
126
|
+
|
127
|
+
<el-dialog :visible.sync="fieldOptionModelVisible" :title="optionModelTitle" width="600px" append-to-body destroy-on-close>
|
128
|
+
<el-form :model="fieldOptionForm" size="mini" label-width="96px" @submit.native.prevent>
|
129
|
+
<el-form-item label="编号/ID" v-if="fieldOptionType !== 'constraint'" key="option-id">
|
130
|
+
<el-input v-model="fieldOptionForm.id" clearable />
|
131
|
+
</el-form-item>
|
132
|
+
<el-form-item label="名称" v-if="fieldOptionType !== 'property'" key="option-name">
|
133
|
+
<el-input v-model="fieldOptionForm.name" clearable />
|
134
|
+
</el-form-item>
|
135
|
+
<el-form-item label="配置" v-if="fieldOptionType === 'constraint'" key="option-config">
|
136
|
+
<el-input v-model="fieldOptionForm.config" clearable />
|
137
|
+
</el-form-item>
|
138
|
+
<el-form-item label="值" v-if="fieldOptionType === 'property'" key="option-value">
|
139
|
+
<el-input v-model="fieldOptionForm.value" clearable />
|
140
|
+
</el-form-item>
|
141
|
+
</el-form>
|
142
|
+
<template slot="footer">
|
143
|
+
<el-button size="mini" @click="fieldOptionModelVisible = false">取 消</el-button>
|
144
|
+
<el-button size="mini" type="primary" @click="saveFieldOption">确 定</el-button>
|
145
|
+
</template>
|
146
|
+
</el-dialog>
|
147
|
+
</div>
|
148
|
+
</template>
|
149
|
+
|
150
|
+
<script>
|
151
|
+
export default {
|
152
|
+
name: "ElementForm",
|
153
|
+
props: {
|
154
|
+
id: String,
|
155
|
+
type: String
|
156
|
+
},
|
157
|
+
inject: {
|
158
|
+
prefix: "prefix",
|
159
|
+
width: "width"
|
160
|
+
},
|
161
|
+
data() {
|
162
|
+
return {
|
163
|
+
formKey: "",
|
164
|
+
businessKey: "",
|
165
|
+
optionModelTitle: "",
|
166
|
+
fieldList: [],
|
167
|
+
formFieldForm: {},
|
168
|
+
fieldType: {
|
169
|
+
long: "长整型",
|
170
|
+
string: "字符串",
|
171
|
+
boolean: "布尔类",
|
172
|
+
date: "日期类",
|
173
|
+
enum: "枚举类",
|
174
|
+
custom: "自定义类型"
|
175
|
+
},
|
176
|
+
formFieldIndex: -1, // 编辑中的字段, -1 为新增
|
177
|
+
formFieldOptionIndex: -1, // 编辑中的字段配置项, -1 为新增
|
178
|
+
fieldModelVisible: false,
|
179
|
+
fieldOptionModelVisible: false,
|
180
|
+
fieldOptionForm: {}, // 当前激活的字段配置项数据
|
181
|
+
fieldOptionType: "", // 当前激活的字段配置项弹窗 类型
|
182
|
+
fieldEnumList: [], // 枚举值列表
|
183
|
+
fieldConstraintsList: [], // 约束条件列表
|
184
|
+
fieldPropertiesList: [] // 绑定属性列表
|
185
|
+
};
|
186
|
+
},
|
187
|
+
watch: {
|
188
|
+
id: {
|
189
|
+
immediate: true,
|
190
|
+
handler(val) {
|
191
|
+
val && val.length && this.$nextTick(() => this.resetFormList());
|
192
|
+
}
|
193
|
+
}
|
194
|
+
},
|
195
|
+
methods: {
|
196
|
+
resetFormList() {
|
197
|
+
this.bpmnElement = window.bpmnInstances.bpmnElement;
|
198
|
+
this.formKey = this.bpmnElement.businessObject.formKey;
|
199
|
+
// 获取元素扩展属性 或者 创建扩展属性
|
200
|
+
this.elExtensionElements =
|
201
|
+
this.bpmnElement.businessObject.get("extensionElements") || window.bpmnInstances.moddle.create("bpmn:ExtensionElements", { values: [] });
|
202
|
+
// 获取元素表单配置 或者 创建新的表单配置
|
203
|
+
this.formData =
|
204
|
+
this.elExtensionElements.values.filter(ex => ex.$type === `${this.prefix}:FormData`)?.[0] ||
|
205
|
+
window.bpmnInstances.moddle.create(`${this.prefix}:FormData`, { fields: [] });
|
206
|
+
|
207
|
+
// 业务标识 businessKey, 绑定在 formData 中
|
208
|
+
this.businessKey = this.formData.businessKey;
|
209
|
+
|
210
|
+
// 保留剩余扩展元素,便于后面更新该元素对应属性
|
211
|
+
this.otherExtensions = this.elExtensionElements.values.filter(ex => ex.$type !== `${this.prefix}:FormData`);
|
212
|
+
|
213
|
+
// 复制原始值,填充表格
|
214
|
+
this.fieldList = JSON.parse(JSON.stringify(this.formData.fields || []));
|
215
|
+
|
216
|
+
// 更新元素扩展属性,避免后续报错
|
217
|
+
this.updateElementExtensions();
|
218
|
+
},
|
219
|
+
updateElementFormKey() {
|
220
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { formKey: this.formKey });
|
221
|
+
},
|
222
|
+
updateElementBusinessKey() {
|
223
|
+
window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.formData, {
|
224
|
+
businessKey: this.businessKey
|
225
|
+
});
|
226
|
+
},
|
227
|
+
// 根据类型调整字段type
|
228
|
+
changeFieldTypeType(type) {
|
229
|
+
this.$set(this.formFieldForm, "type", type === "custom" ? "" : type);
|
230
|
+
},
|
231
|
+
|
232
|
+
// 打开字段详情侧边栏
|
233
|
+
openFieldForm(field, index) {
|
234
|
+
this.formFieldIndex = index;
|
235
|
+
if (index !== -1) {
|
236
|
+
const FieldObject = this.formData.fields[index];
|
237
|
+
this.formFieldForm = JSON.parse(JSON.stringify(field));
|
238
|
+
// 设置自定义类型
|
239
|
+
this.$set(this.formFieldForm, "typeType", !this.fieldType[field.type] ? "custom" : field.type);
|
240
|
+
// 初始化枚举值列表
|
241
|
+
field.type === "enum" && (this.fieldEnumList = JSON.parse(JSON.stringify(FieldObject?.values || [])));
|
242
|
+
// 初始化约束条件列表
|
243
|
+
this.fieldConstraintsList = JSON.parse(JSON.stringify(FieldObject?.validation?.constraints || []));
|
244
|
+
// 初始化自定义属性列表
|
245
|
+
this.fieldPropertiesList = JSON.parse(JSON.stringify(FieldObject?.properties?.values || []));
|
246
|
+
} else {
|
247
|
+
this.formFieldForm = {};
|
248
|
+
// 初始化枚举值列表
|
249
|
+
this.fieldEnumList = [];
|
250
|
+
// 初始化约束条件列表
|
251
|
+
this.fieldConstraintsList = [];
|
252
|
+
// 初始化自定义属性列表
|
253
|
+
this.fieldPropertiesList = [];
|
254
|
+
}
|
255
|
+
this.fieldModelVisible = true;
|
256
|
+
},
|
257
|
+
// 打开字段 某个 配置项 弹窗
|
258
|
+
openFieldOptionForm(option, index, type) {
|
259
|
+
this.fieldOptionModelVisible = true;
|
260
|
+
this.fieldOptionType = type;
|
261
|
+
this.formFieldOptionIndex = index;
|
262
|
+
if (type === "property") {
|
263
|
+
this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {};
|
264
|
+
return (this.optionModelTitle = "属性配置");
|
265
|
+
}
|
266
|
+
if (type === "enum") {
|
267
|
+
this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {};
|
268
|
+
return (this.optionModelTitle = "枚举值配置");
|
269
|
+
}
|
270
|
+
this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {};
|
271
|
+
return (this.optionModelTitle = "约束条件配置");
|
272
|
+
},
|
273
|
+
|
274
|
+
// 保存字段 某个 配置项
|
275
|
+
saveFieldOption() {
|
276
|
+
if (this.formFieldOptionIndex === -1) {
|
277
|
+
if (this.fieldOptionType === "property") {
|
278
|
+
this.fieldPropertiesList.push(this.fieldOptionForm);
|
279
|
+
}
|
280
|
+
if (this.fieldOptionType === "constraint") {
|
281
|
+
this.fieldConstraintsList.push(this.fieldOptionForm);
|
282
|
+
}
|
283
|
+
if (this.fieldOptionType === "enum") {
|
284
|
+
this.fieldEnumList.push(this.fieldOptionForm);
|
285
|
+
}
|
286
|
+
} else {
|
287
|
+
this.fieldOptionType === "property" && this.fieldPropertiesList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm);
|
288
|
+
this.fieldOptionType === "constraint" && this.fieldConstraintsList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm);
|
289
|
+
this.fieldOptionType === "enum" && this.fieldEnumList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm);
|
290
|
+
}
|
291
|
+
this.fieldOptionModelVisible = false;
|
292
|
+
this.fieldOptionForm = {};
|
293
|
+
},
|
294
|
+
// 保存字段配置
|
295
|
+
saveField() {
|
296
|
+
const { id, type, label, defaultValue, datePattern } = this.formFieldForm;
|
297
|
+
const Field = window.bpmnInstances.moddle.create(`${this.prefix}:FormField`, { id, type, label });
|
298
|
+
defaultValue && (Field.defaultValue = defaultValue);
|
299
|
+
datePattern && (Field.datePattern = datePattern);
|
300
|
+
// 构建属性
|
301
|
+
if (this.fieldPropertiesList && this.fieldPropertiesList.length) {
|
302
|
+
const fieldPropertyList = this.fieldPropertiesList.map(fp => {
|
303
|
+
return window.bpmnInstances.moddle.create(`${this.prefix}:Property`, { id: fp.id, value: fp.value });
|
304
|
+
});
|
305
|
+
Field.properties = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, {
|
306
|
+
values: fieldPropertyList
|
307
|
+
});
|
308
|
+
}
|
309
|
+
// 构建校验规则
|
310
|
+
if (this.fieldConstraintsList && this.fieldConstraintsList.length) {
|
311
|
+
const fieldConstraintList = this.fieldConstraintsList.map(fc => {
|
312
|
+
return window.bpmnInstances.moddle.create(`${this.prefix}:Constraint`, { name: fc.name, config: fc.config });
|
313
|
+
});
|
314
|
+
Field.validation = window.bpmnInstances.moddle.create(`${this.prefix}:Validation`, {
|
315
|
+
constraints: fieldConstraintList
|
316
|
+
});
|
317
|
+
}
|
318
|
+
// 构建枚举值
|
319
|
+
if (this.fieldEnumList && this.fieldEnumList.length) {
|
320
|
+
Field.values = this.fieldEnumList.map(fe => {
|
321
|
+
return window.bpmnInstances.moddle.create(`${this.prefix}:Value`, { name: fe.name, id: fe.id });
|
322
|
+
});
|
323
|
+
}
|
324
|
+
// 更新数组 与 表单配置实例
|
325
|
+
if (this.formFieldIndex === -1) {
|
326
|
+
this.fieldList.push(this.formFieldForm);
|
327
|
+
this.formData.fields.push(Field);
|
328
|
+
} else {
|
329
|
+
this.fieldList.splice(this.formFieldIndex, 1, this.formFieldForm);
|
330
|
+
this.formData.fields.splice(this.formFieldIndex, 1, Field);
|
331
|
+
}
|
332
|
+
this.updateElementExtensions();
|
333
|
+
this.fieldModelVisible = false;
|
334
|
+
},
|
335
|
+
|
336
|
+
// 移除某个 字段的 配置项
|
337
|
+
removeFieldOptionItem(option, index, type) {
|
338
|
+
if (type === "property") {
|
339
|
+
this.fieldPropertiesList.splice(index, 1);
|
340
|
+
return;
|
341
|
+
}
|
342
|
+
if (type === "enum") {
|
343
|
+
this.fieldEnumList.splice(index, 1);
|
344
|
+
return;
|
345
|
+
}
|
346
|
+
this.fieldConstraintsList.splice(index, 1);
|
347
|
+
},
|
348
|
+
// 移除 字段
|
349
|
+
removeField(field, index) {
|
350
|
+
this.fieldList.splice(index, 1);
|
351
|
+
this.formData.fields.splice(index, 1);
|
352
|
+
this.updateElementExtensions();
|
353
|
+
},
|
354
|
+
|
355
|
+
updateElementExtensions() {
|
356
|
+
// 更新回扩展元素
|
357
|
+
const newElExtensionElements = window.bpmnInstances.moddle.create(`bpmn:ExtensionElements`, {
|
358
|
+
values: this.otherExtensions.concat(this.formData)
|
359
|
+
});
|
360
|
+
// 更新到元素上
|
361
|
+
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
|
362
|
+
extensionElements: newElExtensionElements
|
363
|
+
});
|
364
|
+
}
|
365
|
+
}
|
366
|
+
};
|
367
|
+
</script>
|