| | |
| | | }, |
| | | "dependencies": { |
| | | "@ant-design/icons-vue": "^7.0.1", |
| | | "@element-plus/icons-vue": "^2.3.1", |
| | | "@form-create/designer": "^3.2.11", |
| | | "@form-create/element-ui": "^3.2.25", |
| | | "@tinymce/tinymce-vue": "^6.0.1", |
| | |
| | | "ant-design-vue": "catalog:", |
| | | "axios": "^1.10.0", |
| | | "bpmn-js": "^18.6.2", |
| | | "bpmn-js-token-simulation": "^0.38.1", |
| | | "codemirror": "5.65.0", |
| | | "codemirror-editor-vue3": "^2.8.0", |
| | | "cropperjs": "^1.6.2", |
| | | "crypto-js": "^4.2.0", |
| | | "dayjs": "catalog:", |
| | | "diagram-js": "^15.3.0", |
| | | "diagram-js-minimap": "^5.2.0", |
| | | "echarts": "^5.5.1", |
| | | "element-plus": "^2.10.2", |
| | | "jsencrypt": "^3.3.2", |
| | | "lodash": "^4.17.21", |
| | | "lodash-es": "^4.17.21", |
| | | "min-dash": "^4.2.3", |
| | | "pinia": "catalog:", |
| | | "qs": "^6.13.1", |
| | | "tinymce": "^7.3.0", |
| | | "unplugin-vue-components": "^0.27.3", |
| | | "vue": "catalog:", |
| | | "vue-router": "catalog:" |
| | | "vue-router": "catalog:", |
| | | "x2js": "^3.4.4" |
| | | }, |
| | | "devDependencies": { |
| | | "@types/crypto-js": "^4.2.2", |
| | |
| | | import type { |
| | | CategoryForm, |
| | | CategoryQuery, |
| | | CategoryTree, |
| | | CategoryVO, |
| | | } from './model'; |
| | | |
| | | import type { ID, IDS } from '#/api/common'; |
| | | |
| | | // import request from '#/utils/request'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | /** |
| | | * è·åæµç¨åç±»æ å表 |
| | | * @returns tree |
| | | */ |
| | | export function categoryTree() { |
| | | return requestClient.get<CategoryTree[]>('/workflow/category/categoryTree'); |
| | | // æ¥è¯¢æµç¨åç±»å表 |
| | | export function listCategory(query) { |
| | | return requestClient.get('/category/list', { params: query }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»å表 |
| | | * @param params |
| | | * @returns æµç¨åç±»å表 |
| | | */ |
| | | export function categoryList(params?: CategoryQuery) { |
| | | return requestClient.get<CategoryVO[]>(`/workflow/category/list`, { params }); |
| | | // æ¥è¯¢æµç¨åç±»å表 |
| | | export function listAllCategory(query) { |
| | | return requestClient.get('/category/listAll', { params: query }); |
| | | } |
| | | // æ¥è¯¢æµç¨åç±»è¯¦ç» |
| | | export function getCategory(categoryId) { |
| | | return requestClient.get(`/category/${categoryId}`); |
| | | } |
| | | // æ°å¢æµç¨åç±» |
| | | export function addCategory(data) { |
| | | return requestClient.post('/category', { data }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨å类详æ
|
| | | * @param id id |
| | | * @returns æµç¨å类详æ
|
| | | */ |
| | | export function categoryInfo(id: ID) { |
| | | return requestClient.get<CategoryVO>(`/workflow/category/${id}`); |
| | | // ä¿®æ¹æµç¨åç±» |
| | | export function updateCategory(data) { |
| | | return requestClient.put('/category', { data }); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | * @param data |
| | | * @returns void |
| | | */ |
| | | export function categoryAdd(data: CategoryForm) { |
| | | return requestClient.postWithMsg<void>('/workflow/category', data); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°æµç¨åç±» |
| | | * @param data |
| | | * @returns void |
| | | */ |
| | | export function categoryUpdate(data: CategoryForm) { |
| | | return requestClient.putWithMsg<void>('/workflow/category', data); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨åç±» |
| | | * @param id id |
| | | * @returns void |
| | | */ |
| | | export function categoryRemove(id: ID | IDS) { |
| | | return requestClient.deleteWithMsg<void>(`/workflow/category/${id}`); |
| | | // å 餿µç¨åç±» |
| | | export function delCategory(categoryIds) { |
| | | return requestClient.delete(`/category/${categoryIds}`); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { |
| | | CategoryForm, |
| | | CategoryQuery, |
| | | CategoryTree, |
| | | CategoryVO, |
| | | } from './model'; |
| | | |
| | | import type { ID, IDS } from '#/api/common'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | /** |
| | | * è·åæµç¨åç±»æ å表 |
| | | * @returns tree |
| | | */ |
| | | export function categoryTree() { |
| | | return requestClient.get<CategoryTree[]>('/workflow/category/categoryTree'); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»å表 |
| | | * @param params |
| | | * @returns æµç¨åç±»å表 |
| | | */ |
| | | export function categoryList(params?: CategoryQuery) { |
| | | return requestClient.get<CategoryVO[]>(`/workflow/category/list`, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨å类详æ
|
| | | * @param id id |
| | | * @returns æµç¨å类详æ
|
| | | */ |
| | | export function categoryInfo(id: ID) { |
| | | return requestClient.get<CategoryVO>(`/workflow/category/${id}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | * @param data |
| | | * @returns void |
| | | */ |
| | | export function categoryAdd(data: CategoryForm) { |
| | | return requestClient.postWithMsg<void>('/workflow/category', data); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°æµç¨åç±» |
| | | * @param data |
| | | * @returns void |
| | | */ |
| | | export function categoryUpdate(data: CategoryForm) { |
| | | return requestClient.putWithMsg<void>('/workflow/category', data); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨åç±» |
| | | * @param id id |
| | | * @returns void |
| | | */ |
| | | export function categoryRemove(id: ID | IDS) { |
| | | return requestClient.deleteWithMsg<void>(`/workflow/category/${id}`); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // import request from '#/utils/request'; |
| | | import { requestClient } from '#/api/request'; |
| | | // æ¥è¯¢æµç¨é¨ç½²å表 |
| | | export function listDeploy(query) { |
| | | return requestClient.get('/deploy/list', { params: query }); |
| | | } |
| | | |
| | | export function listPublish(query) { |
| | | return requestClient.get('/deploy/publishList', { params: query }); |
| | | } |
| | | // è·åæµç¨æ¨¡åæµç¨å¾ |
| | | export function getBpmnXml(definitionId) { |
| | | return requestClient.get(`/deploy/bpmnXml/${definitionId}`); |
| | | } |
| | | // ä¿®æ¹æµç¨ç¶æ |
| | | export function changeState(params) { |
| | | return requestClient.put('/model', { params: params }); |
| | | } |
| | | |
| | | // å 餿µç¨é¨ç½² |
| | | export function delDeploy(deployIds) { |
| | | return requestClient.delete(`/deploy/${deployIds}`); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // import request from '#/utils/request'; |
| | | import { requestClient } from '#/api/request'; |
| | | // æ¥è¯¢æµç¨è¡¨åå表 |
| | | export function listForm(query) { |
| | | return requestClient.get('/flowable/form/list', { params: query }); |
| | | } |
| | | |
| | | // æ¥è¯¢æµç¨è¡¨åè¯¦ç» |
| | | export function getForm(formId) { |
| | | return requestClient.get(`/form/${formId}`); |
| | | } |
| | | // æ°å¢æµç¨è¡¨å |
| | | export function addForm(data) { |
| | | return requestClient.post('/form', { data }); |
| | | } |
| | | // ä¿®æ¹æµç¨è¡¨å |
| | | export function updateForm(data) { |
| | | return requestClient.put('/form', { data }); |
| | | } |
| | | |
| | | // å 餿µç¨è¡¨å |
| | | export function delForm(formId) { |
| | | return requestClient.delete(`/form/${formId}`); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // import request from '#/utils/request'; |
| | | import { requestClient } from '#/api/request'; |
| | | // æ¥è¯¢æµç¨æ¨¡åä¿¡æ¯ |
| | | |
| | | export function selectUser(query) { |
| | | return requestClient.get('/system/user/list', { params: query }); |
| | | } |
| | | |
| | | export function deptTreeSelect() { |
| | | return requestClient.get('/system/user/deptTree'); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // import request from '#/utils/request'; |
| | | import { requestClient } from '#/api/request'; |
| | | // å页æ¥è¯¢æµç¨çå¬å¨ |
| | | export function queryListenerPage(query) { |
| | | return requestClient.get('/flowable/listener/queryPage', { params: query }); |
| | | } |
| | | |
| | | // å表æ¥è¯¢æµç¨çå¬å¨ |
| | | export function queryListenerList(query) { |
| | | return requestClient.get('/flowable/listener/queryList', { params: query }); |
| | | } |
| | | |
| | | // è¯¦ç»æ¥è¯¢æµç¨çå¬å¨ |
| | | export function getListener(formId) { |
| | | return requestClient.get(`/flowable/listener/query/${formId}`); |
| | | } |
| | | |
| | | // æ°å¢æµç¨çå¬å¨ |
| | | export function addListener(data) { |
| | | return requestClient.post('/flowable/listener/insert', { data }); |
| | | } |
| | | // ä¿®æ¹æµç¨çå¬å¨ |
| | | export function updateListener(data) { |
| | | return requestClient.post('/flowable/listener/update', { data }); |
| | | } |
| | | |
| | | // å 餿µç¨çå¬å¨ |
| | | export function delListener(listenerId) { |
| | | return requestClient.post(`/listener/delete/${listenerId}`); |
| | | } |
| | | |
| | | // æ°å¢æµç¨çå¬å¨å段 |
| | | export function insertListenerFieldAPI(data) { |
| | | return requestClient.post('/listener/insertField', { data }); |
| | | } |
| | | |
| | | // ä¿®æ¹æµç¨çå¬å¨å段 |
| | | export function updateListenerFieldAPI(data) { |
| | | return requestClient.post('/listener/updateField', { data }); |
| | | } |
| | | |
| | | // å 餿µç¨çå¬å¨å段 |
| | | export function deleteListenerFieldAPI(fieldIds) { |
| | | return requestClient.post(`/listener/deleteField/${fieldIds}`); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | // æ¥è¯¢æµç¨æ¨¡åä¿¡æ¯ |
| | | export function listModel(query) { |
| | | return requestClient.get('/model/list', { params: query }); |
| | | } |
| | | |
| | | // æ¥è¯¢å岿µç¨æ¨¡åä¿¡æ¯ |
| | | export function historyModel(query) { |
| | | return requestClient.get('/model/historyList', { params: query }); |
| | | } |
| | | |
| | | export function getModel(modelId) { |
| | | return requestClient.get(`/model/${modelId}`); |
| | | } |
| | | |
| | | // æ°å¢æ¨¡åä¿¡æ¯ |
| | | export function addModel(data) { |
| | | return requestClient.post('/model', { data }); |
| | | } |
| | | |
| | | // ä¿®æ¹æ¨¡åä¿¡æ¯ |
| | | export function updateModel(data) { |
| | | return requestClient.put('/model', { data }); |
| | | } |
| | | |
| | | // ä¿åæµç¨æ¨¡å |
| | | export function saveModel(data) { |
| | | return requestClient.post('/model/save', { data }); |
| | | } |
| | | |
| | | export function latestModel(params) { |
| | | return requestClient.post('/model/latest', { params }); |
| | | } |
| | | |
| | | export function delModel(modelIds) { |
| | | return requestClient.delete(`/model/${modelIds}`); |
| | | } |
| | | |
| | | export function deployModel(params) { |
| | | return requestClient.post('/model/deploy', { params }); |
| | | } |
| | | |
| | | // è·åæµç¨æ¨¡åæµç¨å¾ |
| | | export function getBpmnXml(modelId) { |
| | | return requestClient.get(`/model/bpmnXml/${modelId}`); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | // æ¥è¯¢æµç¨å表 |
| | | export function listProcess(query) { |
| | | return requestClient.get('/process/list', { params: query }); |
| | | } |
| | | |
| | | // æ¥è¯¢æµç¨å表 |
| | | export function getProcessForm(query) { |
| | | return requestClient.get('/process/getProcessForm', { params: query }); |
| | | } |
| | | // é¨ç½²æµç¨å®ä¾ |
| | | export function startProcess(processDefId,data) { |
| | | return requestClient.post(`/process/start/${processDefId}`, { data }); |
| | | } |
| | | // å 餿µç¨å®ä¾ |
| | | export function delProcess(ids) { |
| | | return requestClient.delete(`/process/instance/${ids}`); |
| | | } |
| | | |
| | | // è·åæµç¨å¾ |
| | | export function getBpmnXml(processDefId) { |
| | | return requestClient.get(`/process/bpmnXml/${processDefId}`); |
| | | } |
| | | |
| | | export function detailProcess(query) { |
| | | return requestClient.get('/process/detail', { params: query }); |
| | | } |
| | | |
| | | // æçåèµ·çæµç¨ |
| | | export function listOwnProcess(query) { |
| | | return requestClient.get('/process/ownList', { params: query }); |
| | | } |
| | | // æå¾
åçæµç¨ |
| | | export function listTodoProcess(query) { |
| | | return requestClient.get('/process/todoList', { params: query }); |
| | | } |
| | | // æå¾
ç¾çæµç¨ |
| | | export function listClaimProcess(query) { |
| | | return requestClient.get('/process/claimList', { params: query }); |
| | | } |
| | | // æå·²åçæµç¨ |
| | | export function listFinishedProcess(query) { |
| | | return requestClient({ |
| | | url: '/process/finishedList', |
| | | method: 'get', |
| | | params: query |
| | | }); |
| | | } |
| | | export function listFinishedProcess(query) { |
| | | return requestClient.get('/process/finishedList', { params: query }); |
| | | } |
| | | |
| | | // æ¥è¯¢æµç¨æéå表 |
| | | export function listCopyProcess(query) { |
| | | return requestClient.get('/process/copyList', { params: query }); |
| | | } |
| | | |
| | | // åæ¶ç³è¯· |
| | | export function stopProcess(data) { |
| | | return requestClient.post('/task/stopProcess', { data }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // import request from '#/utils/request'; |
| | | import { requestClient } from '#/api/request'; |
| | | // å®æä»»å¡ |
| | | export function complete(data) { |
| | | return requestClient.post('/task/complete', { data }); |
| | | } |
| | | |
| | | // å§æ´¾ä»»å¡ |
| | | export function delegate(data) { |
| | | return requestClient.post('/task/delegate', { data }); |
| | | } |
| | | // 转åä»»å¡ |
| | | export function transfer(data) { |
| | | return requestClient.post('/task/transfer', { data }); |
| | | } |
| | | // éåä»»å¡ |
| | | export function returnTask(data) { |
| | | return requestClient.post('/task/return', { data }); |
| | | } |
| | | // æç»ä»»å¡ |
| | | export function rejectTask(data) { |
| | | return requestClient.post('/task/reject', { data }); |
| | | } |
| | | // ç¾æ¶ä»»å¡ |
| | | export function claimTask(data) { |
| | | return requestClient.post('/task/claim', { data }); |
| | | } |
| | | // å¯éåä»»å¡å表 |
| | | export function returnList(data) { |
| | | return requestClient.post('/task/returnList', { data }); |
| | | } |
| | | // æ¤åä»»å¡ |
| | | export function revokeProcess(data) { |
| | | return requestClient.post('/task/revokeProcess', { data }); |
| | | } |
| | |
| | | import { initStores } from '@vben/stores'; |
| | | import '@vben/styles'; |
| | | import '@vben/styles/antd'; |
| | | |
| | | import * as ElementPlusIconsVue from '@element-plus/icons-vue'; |
| | | import { useTitle } from '@vueuse/core'; |
| | | import ElementPlus from 'element-plus'; |
| | | import 'element-plus/dist/index.css'; // æ ·å¼æä»¶ |
| | |
| | | app.use(formCreate); |
| | | app.use(FcDesigner); |
| | | app.use(Antd); |
| | | for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
| | | app.component(key, component); |
| | | } |
| | | // å¨ææ´æ°æ é¢ |
| | | watchEffect(() => { |
| | | if (preferences.app.dynamicTitle) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="process-design" :style="'display: flex; height:' + height"> |
| | | <my-process-designer |
| | | v-model="xmlString" |
| | | v-bind="controlForm" |
| | | keyboard |
| | | ref="processDesigner" |
| | | :events="[ |
| | | 'element.click', |
| | | 'connection.added', |
| | | 'connection.removed', |
| | | 'connection.changed' |
| | | ]" |
| | | @element-click="elementClick" |
| | | @init-finished="initModeler" |
| | | @element-contextmenu="elementContextmenu" |
| | | @save="onSaveProcess" |
| | | /> |
| | | <my-process-penal :bpmn-modeler="modeler" :prefix="controlForm.prefix" class="process-panel" /> |
| | | |
| | | <!-- demo config --> |
| | | <!-- <div class="demo-control-bar">--> |
| | | <!-- <div class="open-model-button" @click="controlDrawerVisible = true"><el-icon><setting /></el-icon></div>--> |
| | | <!-- </div>--> |
| | | <!-- <el-drawer v-model="controlDrawerVisible" size="400px" title="å好设置" append-to-body destroy-on-close>--> |
| | | <!-- <el-form :model="controlForm" size="small" label-width="100px" class="control-form" @submit.prevent>--> |
| | | <!-- <el-form-item label="æµç¨ID">--> |
| | | <!-- <el-input v-model="controlForm.processId" @change="reloadProcessDesigner(true)" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="æµç¨åç§°">--> |
| | | <!-- <el-input v-model="controlForm.processName" @change="reloadProcessDesigner(true)" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="æµè½¬æ¨¡æ">--> |
| | | <!-- <el-switch v-model="controlForm.simulation" inactive-text="åç¨" active-text="å¯ç¨" @change="reloadProcessDesigner()" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="ç¦ç¨åå»">--> |
| | | <!-- <el-switch v-model="controlForm.labelEditing" inactive-text="åç¨" active-text="å¯ç¨" @change="changeLabelEditingStatus" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="èªå®ä¹æ¸²æ">--> |
| | | <!-- <el-switch v-model="controlForm.labelVisible" inactive-text="åç¨" active-text="å¯ç¨" @change="changeLabelVisibleStatus" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="æµç¨å¼æ">--> |
| | | <!-- <el-radio-group v-model="controlForm.prefix" @change="reloadProcessDesigner()">--> |
| | | <!-- <el-radio label="camunda">camunda</el-radio>--> |
| | | <!-- <el-radio label="flowable">flowable</el-radio>--> |
| | | <!-- <el-radio label="activiti">activiti</el-radio>--> |
| | | <!-- </el-radio-group>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="å·¥å
·æ ">--> |
| | | <!-- <el-radio-group v-model="controlForm.headerButtonSize">--> |
| | | <!-- <el-radio label="small">small</el-radio>--> |
| | | <!-- <el-radio label="default">default</el-radio>--> |
| | | <!-- <el-radio label="large">large</el-radio>--> |
| | | <!-- </el-radio-group>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-switch v-model="pageMode" active-text="dark" inactive-text="light" @change="changePageMode"></el-switch>--> |
| | | <!-- </el-form>--> |
| | | <!-- </el-drawer>--> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import MyProcessDesigner from '#/package/designer'; |
| | | // import MyProcessPalette from '@/package/palette'; |
| | | import MyProcessPenal from '#/package/penal'; |
| | | // èªå®ä¹æ¸²æï¼éèäº label æ ç¾ï¼ |
| | | import CustomRenderer from '#/modules/custom-renderer'; |
| | | // èªå®ä¹å
ç´ é䏿¶çå¼¹åºèåï¼ä¿®æ¹ é»è®¤ä»»å¡ 为 ç¨æ·ä»»å¡ï¼ |
| | | import CustomContentPadProvider from '#/package/designer/plugins/content-pad'; |
| | | // èªå®ä¹å·¦ä¾§èåï¼ä¿®æ¹ é»è®¤ä»»å¡ 为 ç¨æ·ä»»å¡ï¼ |
| | | import CustomPaletteProvider from '#/package/designer/plugins/palette'; |
| | | |
| | | import '#/package/theme/index.scss'; |
| | | import 'bpmn-js/dist/assets/diagram-js.css'; |
| | | import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'; |
| | | import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'; |
| | | |
| | | export default { |
| | | name: 'ProcessDesigner', |
| | | props: { |
| | | bpmnXml: { |
| | | type: String, |
| | | required: true |
| | | }, |
| | | designerForm: { |
| | | type: Object, |
| | | required: true |
| | | } |
| | | }, |
| | | components: { |
| | | MyProcessDesigner, |
| | | MyProcessPenal |
| | | }, |
| | | data () { |
| | | return { |
| | | height: document.documentElement.clientHeight - 94.5 + "px;", |
| | | xmlString: this.bpmnXml, |
| | | modeler: null, |
| | | controlDrawerVisible: false, |
| | | infoTipVisible: false, |
| | | pageMode: false, |
| | | controlForm: { |
| | | processId: this.designerForm.processKey || '', |
| | | processName: this.designerForm.processName || '', |
| | | simulation: true, |
| | | labelEditing: false, |
| | | labelVisible: false, |
| | | prefix: 'flowable', |
| | | headerButtonSize: 'default', |
| | | additionalModel: [CustomContentPadProvider, CustomPaletteProvider] |
| | | }, |
| | | addis: { |
| | | CustomContentPadProvider, |
| | | CustomPaletteProvider |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | reloadProcessDesigner(notDeep) { |
| | | this.controlForm.additionalModel = []; |
| | | for (const key in this.addis) { |
| | | if (this.addis[key]) { |
| | | this.controlForm.additionalModel.push(this.addis[key]); |
| | | } |
| | | } |
| | | !notDeep && (this.xmlString = undefined); |
| | | this.reloadIndex += 1; |
| | | this.modeler = null; // é¿å
panel å¼å¸¸ |
| | | }, |
| | | changeLabelEditingStatus(status) { |
| | | this.addis.labelEditing = status ? { labelEditingProvider: ['value', ''] } : false; |
| | | this.reloadProcessDesigner(); |
| | | }, |
| | | changeLabelVisibleStatus(status) { |
| | | this.addis.customRenderer = status ? CustomRenderer : false; |
| | | this.reloadProcessDesigner(); |
| | | }, |
| | | elementClick(element) { |
| | | this.element = element; |
| | | }, |
| | | initModeler(modeler) { |
| | | setTimeout(() => { |
| | | this.modeler = modeler; |
| | | }, 10); |
| | | }, |
| | | elementContextmenu(element) { |
| | | }, |
| | | onSaveProcess(saveData) { |
| | | this.$emit('save', saveData); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | body { |
| | | overflow: hidden; |
| | | margin: 0; |
| | | box-sizing: border-box; |
| | | } |
| | | body, |
| | | body * { |
| | | /* æ»å¨æ¡ */ |
| | | &::-webkit-scrollbar-track-piece { |
| | | background-color: #fff; /*æ»å¨æ¡çèæ¯é¢è²*/ |
| | | -webkit-border-radius: 0; /*æ»å¨æ¡çåè§å®½åº¦*/ |
| | | } |
| | | |
| | | &::-webkit-scrollbar { |
| | | width: 10px; /*æ»å¨æ¡ç宽度*/ |
| | | height: 8px; /*æ»å¨æ¡çé«åº¦*/ |
| | | } |
| | | |
| | | &::-webkit-scrollbar-thumb:vertical { |
| | | /*åç´æ»å¨æ¡çæ ·å¼*/ |
| | | height: 50px; |
| | | background-color: rgba(153, 153, 153, 0.5); |
| | | -webkit-border-radius: 4px; |
| | | outline: 2px solid #fff; |
| | | outline-offset: -2px; |
| | | border: 2px solid #fff; |
| | | } |
| | | |
| | | &::-webkit-scrollbar-thumb { |
| | | /*æ»å¨æ¡çhoveræ ·å¼*/ |
| | | background-color: rgba(159, 159, 159, 0.3); |
| | | -webkit-border-radius: 4px; |
| | | } |
| | | |
| | | &::-webkit-scrollbar-thumb:hover { |
| | | /*æ»å¨æ¡çhoveræ ·å¼*/ |
| | | background-color: rgba(159, 159, 159, 0.5); |
| | | -webkit-border-radius: 4px; |
| | | } |
| | | } |
| | | .demo-control-bar { |
| | | position: fixed; |
| | | right: 8px; |
| | | bottom: 48px; |
| | | z-index: 1; |
| | | } |
| | | .open-model-button { |
| | | width: 48px; |
| | | height: 48px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border-radius: 4px; |
| | | font-size: 32px; |
| | | background: rgba(64, 158, 255, 1); |
| | | color: #ffffff; |
| | | cursor: pointer; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="process-viewer"> |
| | | <div class="process-canvas" style="height: 100%;" ref="processCanvas" v-show="!isLoading" /> |
| | | <!-- èªå®ä¹ç®å¤´æ ·å¼ï¼ç¨äºæåç¶æä¸æµç¨è¿çº¿ç®å¤´ --> |
| | | <defs ref="customSuccessDefs"> |
| | | <marker id="sequenceflow-end-white-success" viewBox="0 0 20 20" refX="11" refY="10" markerWidth="10" markerHeight="10" orient="auto"> |
| | | <path class="success-arrow" d="M 1 5 L 11 10 L 1 15 Z" style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;"></path> |
| | | </marker> |
| | | <marker id="conditional-flow-marker-white-success" viewBox="0 0 20 20" refX="-1" refY="10" markerWidth="10" markerHeight="10" orient="auto"> |
| | | <path class="success-conditional" d="M 0 10 L 8 6 L 16 10 L 8 14 Z" style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;"></path> |
| | | </marker> |
| | | </defs> |
| | | <!-- èªå®ä¹ç®å¤´æ ·å¼ï¼ç¨äºå¤±è´¥ç¶æä¸æµç¨è¿çº¿ç®å¤´ --> |
| | | <defs ref="customFailDefs"> |
| | | <marker id="sequenceflow-end-white-fail" viewBox="0 0 20 20" refX="11" refY="10" markerWidth="10" markerHeight="10" orient="auto"> |
| | | <path class="fail-arrow" d="M 1 5 L 11 10 L 1 15 Z" style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;"></path> |
| | | </marker> |
| | | <marker id="conditional-flow-marker-white-fail" viewBox="0 0 20 20" refX="-1" refY="10" markerWidth="10" markerHeight="10" orient="auto"> |
| | | <path class="fail-conditional" d="M 0 10 L 8 6 L 16 10 L 8 14 Z" style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;"></path> |
| | | </marker> |
| | | </defs> |
| | | <!-- 已宿èç¹æ¬æµ®å¼¹çª --> |
| | | <el-dialog class="comment-dialog" :title="dlgTitle || '审æ¹è®°å½'" v-model="dialogVisible"> |
| | | <el-row> |
| | | <el-table :data="taskCommentList" border header-cell-class-name="table-header-gray"> |
| | | <el-table-column label="åºå·" header-align="center" align="center" type="index" width="55px" /> |
| | | <el-table-column label="åéåç" prop="candidate" width="150px" align="center" /> |
| | | <el-table-column label="å®é
åç" prop="assigneeName" width="100px" align="center" /> |
| | | <el-table-column label="å¤çæ¶é´" prop="createTime" width="140px" align="center" /> |
| | | <el-table-column label="åç»æ¶é´" prop="finishTime" width="140px" align="center" /> |
| | | <el-table-column label="èæ¶" prop="duration" width="100px" align="center" /> |
| | | <el-table-column label="å®¡æ¹æè§" align="center"> |
| | | <template #default="scope"> |
| | | {{scope.row.commentList&&scope.row.commentList[0]?scope.row.commentList[0].fullMessage:''}} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-row> |
| | | </el-dialog> |
| | | <div style="position: absolute; top: 0; left: 0; width: 100%;"> |
| | | <el-row type="flex" justify="end"> |
| | | <el-button-group key="scale-control"> |
| | | <el-button :plain="true" :disabled="defaultZoom <= 0.3" icon="ZoomOut" @click="processZoomOut()" /> |
| | | <el-button style="width: 90px;">{{ Math.floor(this.defaultZoom * 10 * 10) + "%" }}</el-button> |
| | | <el-button :plain="true" :disabled="defaultZoom >= 3.9" icon="ZoomIn" @click="processZoomIn()" /> |
| | | <el-button icon="ScaleToOriginal" @click="processReZoom()" /> |
| | | <slot /> |
| | | </el-button-group> |
| | | </el-row> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import '#/package/theme/index.scss'; |
| | | import BpmnViewer from 'bpmn-js/lib/Viewer'; |
| | | import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas'; |
| | | |
| | | export default { |
| | | props: { |
| | | xml: { |
| | | type: String |
| | | }, |
| | | finishedInfo: { |
| | | type: Object |
| | | }, |
| | | // ææèç¹å®¡æ¹è®°å½ |
| | | allCommentList: { |
| | | type: Array |
| | | } |
| | | }, |
| | | data () { |
| | | return { |
| | | dialogVisible: false, |
| | | dlgTitle: undefined, |
| | | defaultZoom: 1, |
| | | // æ¯å¦æ£å¨å è½½æµç¨å¾ |
| | | isLoading: false, |
| | | bpmnViewer: undefined, |
| | | // 已宿æµç¨å
ç´ |
| | | processNodeInfo: undefined, |
| | | // å½åä»»å¡id |
| | | selectTaskId: undefined, |
| | | // ä»»å¡èç¹å®¡æ¹è®°å½ |
| | | taskCommentList: [], |
| | | // 已宿任塿¬æµ®å»¶è¿Timer |
| | | hoverTimer: null |
| | | } |
| | | }, |
| | | watch: { |
| | | xml: { |
| | | handler(newXml) { |
| | | this.importXML(newXml); |
| | | }, |
| | | immediate: true |
| | | }, |
| | | finishedInfo: { |
| | | handler(newInfo) { |
| | | this.setProcessStatus(newInfo); |
| | | }, |
| | | immediate: true |
| | | } |
| | | }, |
| | | created() { |
| | | this.$nextTick(() => { |
| | | this.importXML(this.xml) |
| | | this.setProcessStatus(this.finishedInfo); |
| | | }) |
| | | }, |
| | | methods: { |
| | | processReZoom() { |
| | | this.defaultZoom = 1; |
| | | this.bpmnViewer.get('canvas').zoom('fit-viewport', 'auto'); |
| | | }, |
| | | processZoomIn(zoomStep = 0.1) { |
| | | let newZoom = Math.floor(this.defaultZoom * 100 + zoomStep * 100) / 100; |
| | | if (newZoom > 4) { |
| | | throw new Error('[Process Designer Warn ]: The zoom ratio cannot be greater than 4'); |
| | | } |
| | | this.defaultZoom = newZoom; |
| | | this.bpmnViewer.get('canvas').zoom(this.defaultZoom); |
| | | }, |
| | | processZoomOut(zoomStep = 0.1) { |
| | | let newZoom = Math.floor(this.defaultZoom * 100 - zoomStep * 100) / 100; |
| | | if (newZoom < 0.2) { |
| | | throw new Error('[Process Designer Warn ]: The zoom ratio cannot be less than 0.2'); |
| | | } |
| | | this.defaultZoom = newZoom; |
| | | this.bpmnViewer.get('canvas').zoom(this.defaultZoom); |
| | | }, |
| | | // æµç¨å¾é¢è§æ¸
空 |
| | | clearViewer() { |
| | | if (this.$refs.processCanvas) { |
| | | this.$refs.processCanvas.innerHTML = ''; |
| | | } |
| | | if (this.bpmnViewer) { |
| | | this.bpmnViewer.destroy(); |
| | | } |
| | | this.bpmnViewer = null; |
| | | }, |
| | | // æ·»å èªå®ä¹ç®å¤´ |
| | | addCustomDefs() { |
| | | const canvas = this.bpmnViewer.get('canvas'); |
| | | const svg = canvas._svg; |
| | | const customSuccessDefs = this.$refs.customSuccessDefs; |
| | | const customFailDefs = this.$refs.customFailDefs; |
| | | svg.appendChild(customSuccessDefs); |
| | | svg.appendChild(customFailDefs); |
| | | }, |
| | | // 任塿¬æµ®å¼¹çª |
| | | onSelectElement(element) { |
| | | this.selectTaskId = undefined; |
| | | this.dlgTitle = undefined; |
| | | |
| | | if (this.processNodeInfo == null || this.processNodeInfo.finishedTaskSet == null) return; |
| | | |
| | | if (element == null || this.processNodeInfo.finishedTaskSet.indexOf(element.id) === -1) { |
| | | return; |
| | | } |
| | | |
| | | this.selectTaskId = element.id; |
| | | this.dlgTitle = element.businessObject ? element.businessObject.name : undefined; |
| | | // 计ç®å½åæ¬æµ®ä»»å¡å®¡æ¹è®°å½ï¼å¦æè®°å½ä¸ºç©ºä¸æ¾ç¤ºå¼¹çª |
| | | this.taskCommentList = (this.allCommentList || []).filter(item => { |
| | | return item.activityId === this.selectTaskId; |
| | | }); |
| | | this.dialogVisible = true; |
| | | }, |
| | | // æ¾ç¤ºæµç¨å¾ |
| | | async importXML(xml) { |
| | | this.clearViewer(); |
| | | if (xml != null && xml !== '') { |
| | | try { |
| | | this.bpmnViewer = new BpmnViewer({ |
| | | additionalModules: [ |
| | | // ç§»å¨æ´ä¸ªç»å¸ |
| | | MoveCanvasModule |
| | | ], |
| | | container: this.$refs.processCanvas, |
| | | }); |
| | | // ä»»å¡èç¹æ¬æµ®äºä»¶ |
| | | this.bpmnViewer.on('element.click', ({ element }) => { |
| | | this.onSelectElement(element); |
| | | }); |
| | | |
| | | this.isLoading = true; |
| | | await this.bpmnViewer.importXML(xml); |
| | | this.addCustomDefs(); |
| | | } catch (e) { |
| | | this.clearViewer(); |
| | | } finally { |
| | | this.isLoading = false; |
| | | this.setProcessStatus(this.processNodeInfo); |
| | | } |
| | | } |
| | | }, |
| | | // 设置æµç¨å¾å
ç´ ç¶æ |
| | | setProcessStatus (processNodeInfo) { |
| | | this.processNodeInfo = processNodeInfo; |
| | | if (this.isLoading || this.processNodeInfo == null || this.bpmnViewer == null) return; |
| | | let { finishedTaskSet, rejectedTaskSet, unfinishedTaskSet, finishedSequenceFlowSet } = this.processNodeInfo; |
| | | const canvas = this.bpmnViewer.get('canvas'); |
| | | const elementRegistry = this.bpmnViewer.get('elementRegistry'); |
| | | if (Array.isArray(finishedSequenceFlowSet)) { |
| | | finishedSequenceFlowSet.forEach(item => { |
| | | if (item != null) { |
| | | canvas.addMarker(item, 'success'); |
| | | let element = elementRegistry.get(item); |
| | | const conditionExpression = element.businessObject.conditionExpression; |
| | | if (conditionExpression) { |
| | | canvas.addMarker(item, 'condition-expression'); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | if (Array.isArray(finishedTaskSet)) { |
| | | finishedTaskSet.forEach(item => canvas.addMarker(item, 'success')); |
| | | } |
| | | if (Array.isArray(unfinishedTaskSet)) { |
| | | unfinishedTaskSet.forEach(item => canvas.addMarker(item, 'primary')); |
| | | } |
| | | if (Array.isArray(rejectedTaskSet)) { |
| | | rejectedTaskSet.forEach(item => { |
| | | if (item != null) { |
| | | let element = elementRegistry.get(item); |
| | | if (element.type.includes('Task')) { |
| | | canvas.addMarker(item, 'danger'); |
| | | } else { |
| | | canvas.addMarker(item, 'warning'); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import AutoPlace from 'diagram-js/lib/features/auto-place/AutoPlace'; |
| | | |
| | | export default function CustomAutoPlace(eventBus, modeling) { |
| | | AutoPlace.call(this, eventBus, modeling, 3000); |
| | | |
| | | eventBus.on('autoPlace', 3000, function(context) { |
| | | const shape = context.shape; |
| | | const source = context.source; |
| | | |
| | | return getNewCustomShapePosition(source, shape); |
| | | }); |
| | | |
| | | this.append = function(source, shape, hints) { |
| | | eventBus.fire('autoPlace.start', { |
| | | source: source, |
| | | shape: shape |
| | | }); |
| | | |
| | | // allow others to provide the position |
| | | var position = eventBus.fire('autoPlace', { |
| | | source: source, |
| | | shape: shape |
| | | }); |
| | | |
| | | console.log('hints', hints, 'position', position); |
| | | |
| | | var newShape = modeling.appendShape(source, shape, position, source.parent, hints); |
| | | |
| | | eventBus.fire('autoPlace.end', { |
| | | source: source, |
| | | shape: newShape |
| | | }); |
| | | |
| | | return newShape; |
| | | }; |
| | | } |
| | | |
| | | export function asTRBL(bounds) { |
| | | return { |
| | | top: bounds.y, |
| | | right: bounds.x + (bounds.width || 0), |
| | | bottom: bounds.y + (bounds.height || 0), |
| | | left: bounds.x |
| | | }; |
| | | } |
| | | |
| | | export function roundPoint(point) { |
| | | return { |
| | | x: Math.round(point.x), |
| | | y: Math.round(point.y) |
| | | }; |
| | | } |
| | | |
| | | export function getMid(bounds) { |
| | | return roundPoint({ |
| | | x: bounds.x + (bounds.width || 0) / 2, |
| | | y: bounds.y + (bounds.height || 0) / 2 |
| | | }); |
| | | } |
| | | |
| | | export function getNewCustomShapePosition(source, element, hints) { |
| | | if (!hints) { |
| | | hints = {}; |
| | | } |
| | | |
| | | var distance = hints.defaultDistance || 50; |
| | | |
| | | var sourceMid = getMid(source); |
| | | var sourceTrbl = asTRBL(source); |
| | | |
| | | // simply put element right next to source |
| | | return { |
| | | x: sourceMid.x, |
| | | y: sourceTrbl.bottom + distance + element.height / 2 |
| | | }; |
| | | } |
| | | |
| | | const F = function() {}; // æ ¸å¿ï¼å©ç¨ç©ºå¯¹è±¡ä½ä¸ºä¸ä»ï¼ |
| | | F.prototype = AutoPlace.prototype; // æ ¸å¿ï¼å°ç¶ç±»çååèµå¼ç»ç©ºå¯¹è±¡Fï¼ |
| | | CustomAutoPlace.prototype = new F(); // æ ¸å¿ï¼å° Fçå®ä¾èµå¼ç»åç±»ï¼ |
| | | CustomAutoPlace.prototype.constructor = AutoPlace; // ä¿®å¤åç±»CustomRendererçæé 卿åï¼é²æ¢ååé¾çæ··ä¹±ï¼ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import CustomAutoPlace from './CustomAutoPlace'; |
| | | |
| | | export default { |
| | | __init__: ['autoPlace'], |
| | | autoPlace: ['type', CustomAutoPlace] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import BpmnRenderer from 'bpmn-js/lib/draw/BpmnRenderer'; |
| | | |
| | | export default function CustomRenderer(eventBus, styles, pathMap, canvas, textRenderer) { |
| | | const config = { |
| | | defaultFillColor: '', |
| | | defaultStrokeColor: '#8b238f', |
| | | defaultLabelColor: '#2dd257' |
| | | }; |
| | | BpmnRenderer.call(this, config, eventBus, styles, pathMap, canvas, textRenderer, 2000); |
| | | } |
| | | |
| | | CustomRenderer.$inject = ['eventBus', 'styles', 'pathMap', 'canvas', 'textRenderer']; |
| | | |
| | | const F = function() {}; // æ ¸å¿ï¼å©ç¨ç©ºå¯¹è±¡ä½ä¸ºä¸ä»ï¼ |
| | | F.prototype = BpmnRenderer.prototype; // æ ¸å¿ï¼å°ç¶ç±»çååèµå¼ç»ç©ºå¯¹è±¡Fï¼ |
| | | CustomRenderer.prototype = new F(); // æ ¸å¿ï¼å° Fçå®ä¾èµå¼ç»åç±»ï¼ |
| | | CustomRenderer.prototype.constructor = CustomRenderer; // ä¿®å¤åç±»CustomRendererçæé 卿åï¼é²æ¢ååé¾çæ··ä¹±ï¼ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import CustomRenderer from './CustomRenderer'; |
| | | |
| | | export default { |
| | | __init__: ['customRenderer'], |
| | | customRenderer: ['type', CustomRenderer] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import BpmnRules from 'bpmn-js/lib/features/rules/BpmnRules'; |
| | | import inherits from 'inherits'; |
| | | |
| | | export default function CustomRules(eventBus) { |
| | | BpmnRules.call(this, eventBus); |
| | | } |
| | | |
| | | inherits(CustomRules, BpmnRules); |
| | | |
| | | CustomRules.prototype.canDrop = function() { |
| | | return false; |
| | | }; |
| | | |
| | | CustomRules.prototype.canMove = function() { |
| | | return false; |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import CustomRules from './CustomRules'; |
| | | |
| | | export default { |
| | | __init__: ['customRules'], |
| | | customRules: ['type', CustomRules] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | function Log() {} |
| | | |
| | | Log.prototype.type = ['primary', 'success', 'warn', 'error', 'info']; |
| | | |
| | | Log.prototype.typeColor = function(type) { |
| | | let color = ''; |
| | | switch (type) { |
| | | case 'primary': |
| | | color = '#2d8cf0'; |
| | | break; |
| | | case 'success': |
| | | color = '#19be6b'; |
| | | break; |
| | | case 'info': |
| | | color = '#909399'; |
| | | break; |
| | | case 'warn': |
| | | color = '#ff9900'; |
| | | break; |
| | | case 'error': |
| | | color = '#f03f14'; |
| | | break; |
| | | default: |
| | | color = '#35495E'; |
| | | break; |
| | | } |
| | | return color; |
| | | }; |
| | | |
| | | Log.prototype.isArray = function(obj) { |
| | | return Object.prototype.toString.call(obj) === '[object Array]'; |
| | | }; |
| | | |
| | | Log.prototype.print = function(text, type = 'default', back = false) { |
| | | if (typeof text === 'object') { |
| | | // 妿æ¯å°è±¡åèª¿ç¨æå°å°è±¡æ¹å¼ |
| | | this.isArray(text) ? console.table(text) : console.dir(text); |
| | | return; |
| | | } |
| | | if (back) { |
| | | // å¦ææ¯æå°å¸¶èæ¯åç |
| | | console.log(`%c ${text} `, `background:${this.typeColor(type)}; padding: 2px; border-radius: 4px; color: #fff;`); |
| | | } else { |
| | | console.log( |
| | | `%c ${text} `, |
| | | `border: 1px solid ${this.typeColor(type)}; |
| | | padding: 2px; border-radius: 4px; |
| | | color: ${this.typeColor(type)};` |
| | | ); |
| | | } |
| | | }; |
| | | |
| | | Log.prototype.printBack = function(type = 'primary', title) { |
| | | this.print(type, title, true); |
| | | }; |
| | | |
| | | Log.prototype.pretty = function(type = 'primary', title, text) { |
| | | if (typeof text === 'object') { |
| | | console.group('Console Group', title); |
| | | console.log( |
| | | `%c ${title}`, |
| | | `background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)}; |
| | | padding: 1px; border-radius: 4px; color: #fff;` |
| | | ); |
| | | this.isArray(text) ? console.table(text) : console.dir(text); |
| | | console.groupEnd(); |
| | | return; |
| | | } |
| | | console.log( |
| | | `%c ${title} %c ${text} %c`, |
| | | `background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)}; |
| | | padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`, |
| | | `border:1px solid ${this.typeColor(type)}; |
| | | padding: 1px; border-radius: 0 4px 4px 0; color: ${this.typeColor(type)};`, |
| | | 'background:transparent' |
| | | ); |
| | | }; |
| | | |
| | | Log.prototype.prettyPrimary = function(title, ...text) { |
| | | text.forEach(t => this.pretty('primary', title, t)); |
| | | }; |
| | | |
| | | Log.prototype.prettySuccess = function(title, ...text) { |
| | | text.forEach(t => this.pretty('success', title, t)); |
| | | }; |
| | | |
| | | Log.prototype.prettyWarn = function(title, ...text) { |
| | | text.forEach(t => this.pretty('warn', title, t)); |
| | | }; |
| | | |
| | | Log.prototype.prettyError = function(title, ...text) { |
| | | text.forEach(t => this.pretty('error', title, t)); |
| | | }; |
| | | |
| | | Log.prototype.prettyInfo = function(title, ...text) { |
| | | text.forEach(t => this.pretty('info', title, t)); |
| | | }; |
| | | |
| | | export default new Log(); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="my-process-designer"> |
| | | <div class="my-process-designer__header"> |
| | | <slot name="control-header"></slot> |
| | | <template v-if="!$slots['control-header']"> |
| | | <el-button-group key="file-control"> |
| | | <el-button :size="headerButtonSize" :type="headerButtonType" icon="el-icon-edit-outline" @click="onSave">ä¿åæµç¨</el-button> |
| | | <el-button :size="headerButtonSize" :type="headerButtonType" :icon="FolderOpened" @click="$refs.refFile.click()">æå¼æä»¶</el-button> |
| | | <el-tooltip effect="light"> |
| | | <template #content> |
| | | <a :size="headerButtonSize" @click="downloadProcessAsXml()" class="link-type">ä¸è½½ä¸ºXMLæä»¶</a> |
| | | <br /> |
| | | <a :size="headerButtonSize" type="text" @click="downloadProcessAsSvg()" class="link-type">ä¸è½½ä¸ºSVGæä»¶</a> |
| | | <br /> |
| | | <a :size="headerButtonSize" type="text" @click="downloadProcessAsBpmn()" class="link-type">ä¸è½½ä¸ºBPMNæä»¶</a> |
| | | </template> |
| | | <el-button :size="headerButtonSize" :type="headerButtonType" :icon="Download">ä¸è½½æä»¶</el-button> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light"> |
| | | <template #content> |
| | | <a :size="headerButtonSize" type="text" @click="previewProcessXML" class="link-type">é¢è§XML</a> |
| | | <br /> |
| | | <a :size="headerButtonSize" type="text" @click="previewProcessJson" class="link-type">é¢è§JSON</a> |
| | | </template> |
| | | <el-button :size="headerButtonSize" :type="headerButtonType" :icon="View">é¢è§</el-button> |
| | | </el-tooltip> |
| | | <el-tooltip v-if="simulation" effect="light" :content="this.simulationStatus ? 'éåºæ¨¡æ' : 'å¼å¯æ¨¡æ'"> |
| | | <el-button :size="headerButtonSize" :type="headerButtonType" :icon="Cpu" @click="processSimulation"> |
| | | 模æ |
| | | </el-button> |
| | | </el-tooltip> |
| | | </el-button-group> |
| | | <el-button-group key="align-control"> |
| | | <el-tooltip effect="light" content="å左对é½"> |
| | | <el-button :size="headerButtonSize" class="align align-left" :icon="Histogram" @click="elementsAlign('left')" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="åå³å¯¹é½"> |
| | | <el-button :size="headerButtonSize" class="align align-right" :icon="Histogram" @click="elementsAlign('right')" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="åä¸å¯¹é½"> |
| | | <el-button :size="headerButtonSize" class="align align-top" :icon="Histogram" @click="elementsAlign('top')" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="åä¸å¯¹é½"> |
| | | <el-button :size="headerButtonSize" class="align align-bottom" :icon="Histogram" @click="elementsAlign('bottom')" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="æ°´å¹³å±
ä¸"> |
| | | <el-button :size="headerButtonSize" class="align align-center" :icon="Histogram" @click="elementsAlign('center')" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="åç´å±
ä¸"> |
| | | <el-button :size="headerButtonSize" class="align align-middle" :icon="Histogram" @click="elementsAlign('middle')" /> |
| | | </el-tooltip> |
| | | </el-button-group> |
| | | <el-button-group key="scale-control"> |
| | | <el-tooltip effect="light" content="缩å°è§å¾"> |
| | | <el-button :size="headerButtonSize" :disabled="defaultZoom < 0.2" :icon="ZoomOut" @click="processZoomOut()" /> |
| | | </el-tooltip> |
| | | <el-button :size="headerButtonSize">{{ Math.floor(this.defaultZoom * 10 * 10) + "%" }}</el-button> |
| | | <el-tooltip effect="light" content="æ¾å¤§è§å¾"> |
| | | <el-button :size="headerButtonSize" :disabled="defaultZoom > 4" :icon="ZoomIn" @click="processZoomIn()" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="éç½®è§å¾å¹¶å±
ä¸"> |
| | | <el-button :size="headerButtonSize" :icon="ScaleToOriginal" @click="processReZoom()" /> |
| | | </el-tooltip> |
| | | </el-button-group> |
| | | <el-button-group key="stack-control"> |
| | | <el-tooltip effect="light" content="æ¤é"> |
| | | <el-button :size="headerButtonSize" :disabled="!revocable" :icon="RefreshLeft" @click="processUndo()" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="æ¢å¤"> |
| | | <el-button :size="headerButtonSize" :disabled="!recoverable" :icon="RefreshRight" @click="processRedo()" /> |
| | | </el-tooltip> |
| | | <el-tooltip effect="light" content="éæ°ç»å¶"> |
| | | <el-button :size="headerButtonSize" :icon="Refresh" @click="processRestart" /> |
| | | </el-tooltip> |
| | | </el-button-group> |
| | | </template> |
| | | <!-- ç¨äºæå¼æ¬å°æä»¶--> |
| | | <input type="file" id="files" ref="refFile" style="display: none" accept=".xml, .bpmn" @change="importLocalFile" /> |
| | | </div> |
| | | <div class="my-process-designer__container"> |
| | | <div class="my-process-designer__canvas" ref="bpmn-canvas"></div> |
| | | </div> |
| | | <el-dialog :title="`é¢è§${previewType}`" width="60%" v-model="previewModelVisible" append-to-body destroy-on-close> |
| | | <Codemirror |
| | | v-model:value="previewResult" |
| | | :options="cmOptions" |
| | | border |
| | | :height="600" |
| | | /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import BpmnModeler from "bpmn-js/lib/Modeler"; |
| | | import DefaultEmptyXML from "./plugins/defaultEmpty"; |
| | | // ç¿»è¯æ¹æ³ |
| | | import customTranslate from "./plugins/translate/customTranslate"; |
| | | import translationsCN from "./plugins/translate/zh"; |
| | | // æ¨¡ææµè½¬æµç¨ |
| | | import tokenSimulation from "bpmn-js-token-simulation"; |
| | | // æ ç¾è§£ææå»ºå¨ |
| | | // import bpmnPropertiesProvider from "bpmn-js-properties-panel/lib/provider/bpmn"; |
| | | // æ ç¾è§£æ Moddle |
| | | import camundaModdleDescriptor from './plugins/descriptor/camundaDescriptor.json'; |
| | | import activitiModdleDescriptor from './plugins/descriptor/activitiDescriptor.json'; |
| | | import flowableModdleDescriptor from './plugins/descriptor/flowableDescriptor.json'; |
| | | // æ ç¾è§£æ Extension |
| | | import camundaModdleExtension from './plugins/extension-moddle/camunda'; |
| | | import activitiModdleExtension from './plugins/extension-moddle/activiti'; |
| | | import flowableModdleExtension from './plugins/extension-moddle/flowable'; |
| | | // å¼å
¥json转æ¢ä¸é«äº® |
| | | // import convert from "xml-js"; |
| | | import X2JS from "x2js"; |
| | | |
| | | import Codemirror from 'codemirror-editor-vue3'; |
| | | import 'codemirror/theme/monokai.css' |
| | | import 'codemirror/mode/javascript/javascript.js'; |
| | | import 'codemirror/mode/xml/xml.js'; |
| | | |
| | | export default { |
| | | name: "MyProcessDesigner", |
| | | componentName: "MyProcessDesigner", |
| | | components: { |
| | | Codemirror |
| | | }, |
| | | setup() { |
| | | return { |
| | | Histogram, Cpu, Refresh, RefreshLeft, RefreshRight, ZoomOut, ZoomIn, View, Download, FolderOpened, ScaleToOriginal |
| | | } |
| | | }, |
| | | emits: ['destroy', 'init-finished', 'commandStack-changed', 'update:modelValue', 'change', 'canvas-viewbox-changed', 'element-click',"save","connection-added"], |
| | | props: { |
| | | modelValue: String, // xml å符串 |
| | | processId: String, |
| | | processName: String, |
| | | translations: Object, // èªå®ä¹çç¿»è¯æä»¶ |
| | | options: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | }, // èªå®ä¹çç¿»è¯æä»¶ |
| | | additionalModel: [Object, Array], // èªå®ä¹model |
| | | moddleExtension: Object, // èªå®ä¹moddle |
| | | onlyCustomizeAddi: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | onlyCustomizeModdle: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | simulation: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | keyboard: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | prefix: { |
| | | type: String, |
| | | default: "camunda" |
| | | }, |
| | | events: { |
| | | type: Array, |
| | | default: () => ["element.click"] |
| | | }, |
| | | headerButtonSize: { |
| | | type: String, |
| | | default: "small", |
| | | validator: value => ["default", "medium", "small", "mini"].indexOf(value) !== -1 |
| | | }, |
| | | headerButtonType: { |
| | | type: String, |
| | | default: "primary", |
| | | validator: value => ["default", "primary", "success", "warning", "danger", "info"].indexOf(value) !== -1 |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | defaultZoom: 1, |
| | | previewModelVisible: false, |
| | | simulationStatus: false, |
| | | previewResult: "", |
| | | previewType: "xml", |
| | | recoverable: false, |
| | | revocable: false, |
| | | cmOptions: { |
| | | mode: 'xml', // è¯è¨æ¨¡å¼ |
| | | theme: 'monokai', // ä¸»é¢ |
| | | lineNumbers: true, // æ¾ç¤ºè¡å· |
| | | smartIndent: true, // æºè½ç¼©è¿ |
| | | readOnly: true, |
| | | indentUnit: 2, // æºè½ç¼©è¿åä½ä¸º4ä¸ªç©ºæ ¼é¿åº¦ |
| | | foldGutter: true, // å¯ç¨è¡æ§½ä¸çä»£ç æå |
| | | styleActiveLine: true // æ¾ç¤ºéä¸è¡çæ ·å¼ |
| | | } |
| | | }; |
| | | }, |
| | | computed: { |
| | | additionalModules() { |
| | | const Modules = []; |
| | | // ä»
ä¿çç¨æ·èªå®ä¹æ©å±æ¨¡å |
| | | if (this.onlyCustomizeAddi) { |
| | | if (Object.prototype.toString.call(this.additionalModel) === "[object Array]") { |
| | | return this.additionalModel || []; |
| | | } |
| | | return [this.additionalModel]; |
| | | } |
| | | |
| | | // æå
¥ç¨æ·èªå®ä¹æ©å±æ¨¡å |
| | | if (Object.prototype.toString.call(this.additionalModel) === "[object Array]") { |
| | | Modules.push(...this.additionalModel); |
| | | } else { |
| | | this.additionalModel && Modules.push(this.additionalModel); |
| | | } |
| | | |
| | | // ç¿»è¯æ¨¡å |
| | | const TranslateModule = { |
| | | translate: ["value", customTranslate(this.translations || translationsCN)] |
| | | }; |
| | | Modules.push(TranslateModule); |
| | | |
| | | // æ¨¡ææµè½¬æ¨¡å |
| | | if (this.simulation) { |
| | | Modules.push(tokenSimulation); |
| | | } |
| | | |
| | | // æ ¹æ®éè¦çæµç¨ç±»å设置æ©å±å
ç´ æå»ºæ¨¡å |
| | | // if (this.prefix === "bpmn") { |
| | | // Modules.push(bpmnModdleExtension); |
| | | // } |
| | | if (this.prefix === "camunda") { |
| | | Modules.push(camundaModdleExtension); |
| | | } |
| | | if (this.prefix === "flowable") { |
| | | Modules.push(flowableModdleExtension); |
| | | } |
| | | if (this.prefix === "activiti") { |
| | | Modules.push(activitiModdleExtension); |
| | | } |
| | | |
| | | return Modules; |
| | | }, |
| | | moddleExtensions() { |
| | | const Extensions = {}; |
| | | // ä»
使ç¨ç¨æ·èªå®ä¹æ¨¡å |
| | | if (this.onlyCustomizeModdle) { |
| | | return this.moddleExtension || null; |
| | | } |
| | | |
| | | // æå
¥ç¨æ·èªå®ä¹æ¨¡å |
| | | if (this.moddleExtension) { |
| | | for (let key in this.moddleExtension) { |
| | | Extensions[key] = this.moddleExtension[key]; |
| | | } |
| | | } |
| | | |
| | | // æ ¹æ®éè¦ç "æµç¨ç±»å" 设置 对åºçè§£ææä»¶ |
| | | if (this.prefix === "activiti") { |
| | | Extensions.activiti = activitiModdleDescriptor; |
| | | } |
| | | if (this.prefix === "flowable") { |
| | | Extensions.flowable = flowableModdleDescriptor; |
| | | } |
| | | if (this.prefix === "camunda") { |
| | | Extensions.camunda = camundaModdleDescriptor; |
| | | } |
| | | |
| | | return Extensions; |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.initBpmnModeler(); |
| | | this.createNewDiagram(this.modelValue); |
| | | // this.$once("hook:beforeUnmount", () => { |
| | | // if (this.bpmnModeler) this.bpmnModeler.destroy(); |
| | | // this.$emit("destroy", this.bpmnModeler); |
| | | // this.bpmnModeler = null; |
| | | // }); |
| | | }, |
| | | beforeUnmount() { |
| | | if (this.bpmnModeler) this.bpmnModeler.destroy(); |
| | | this.$emit("destroy", this.bpmnModeler); |
| | | this.bpmnModeler = null; |
| | | }, |
| | | methods: { |
| | | onSave () { |
| | | return new Promise((resolve, reject) => { |
| | | if (this.bpmnModeler == null) { |
| | | reject(); |
| | | } |
| | | this.bpmnModeler.saveXML({ format: true }).then(({ xml }) => { |
| | | this.$emit('save', xml); |
| | | resolve(xml); |
| | | }); |
| | | }) |
| | | }, |
| | | initBpmnModeler() { |
| | | if (this.bpmnModeler) return; |
| | | this.bpmnModeler = new BpmnModeler({ |
| | | container: this.$refs["bpmn-canvas"], |
| | | keyboard: this.keyboard ? { bindTo: document } : null, |
| | | additionalModules: this.additionalModules, |
| | | moddleExtensions: this.moddleExtensions, |
| | | ...this.options |
| | | }); |
| | | this.$emit("init-finished", this.bpmnModeler); |
| | | this.initModelListeners(); |
| | | }, |
| | | initModelListeners() { |
| | | const EventBus = this.bpmnModeler.get("eventBus"); |
| | | const that = this; |
| | | // 注åéè¦ççå¬äºä»¶, å°. æ¿æ¢ä¸º - , é¿å
è§£æå¼å¸¸ |
| | | this.events.forEach(event => { |
| | | EventBus.on(event, function(eventObj) { |
| | | let eventName = event.replace(/\./g, "-"); |
| | | let element = eventObj ? eventObj.element : null; |
| | | that.$emit(eventName, element, eventObj); |
| | | }); |
| | | }); |
| | | // çå¬å¾å½¢æ¹åè¿åxml |
| | | EventBus.on("commandStack.changed", async event => { |
| | | try { |
| | | this.recoverable = this.bpmnModeler.get("commandStack").canRedo(); |
| | | this.revocable = this.bpmnModeler.get("commandStack").canUndo(); |
| | | let { xml } = await this.bpmnModeler.saveXML({ format: true }); |
| | | this.$emit("commandStack-changed", event); |
| | | this.$emit('update:modelValue', xml); |
| | | this.$emit("change", xml); |
| | | } catch (e) { |
| | | console.error(`[Process Designer Warn]: ${e.message || e}`); |
| | | } |
| | | }); |
| | | // çå¬è§å¾ç¼©æ¾åå |
| | | this.bpmnModeler.on("canvas.viewbox.changed", ({ viewbox }) => { |
| | | this.$emit("canvas-viewbox-changed", { viewbox }); |
| | | const { scale } = viewbox; |
| | | this.defaultZoom = Math.floor(scale * 100) / 100; |
| | | }); |
| | | }, |
| | | /* å建æ°çæµç¨å¾ */ |
| | | async createNewDiagram(xml) { |
| | | // å°åç¬¦ä¸²è½¬æ¢æå¾æ¾ç¤ºåºæ¥ |
| | | let newId = this.processId || `Process_${new Date().getTime()}`; |
| | | let newName = this.processName || `ä¸å¡æµç¨_${new Date().getTime()}`; |
| | | let xmlString = xml || DefaultEmptyXML(newId, newName, this.prefix); |
| | | try { |
| | | let { warnings } = await this.bpmnModeler.importXML(xmlString); |
| | | if (warnings && warnings.length) { |
| | | warnings.forEach(warn => console.warn(warn)); |
| | | } |
| | | } catch (e) { |
| | | console.error(`[Process Designer Warn]: ${e?.message || e}`); |
| | | } |
| | | }, |
| | | |
| | | // ä¸è½½æµç¨å¾å°æ¬å° |
| | | /** |
| | | * @param {string} type |
| | | * @param {*} name |
| | | */ |
| | | async downloadProcess(type, name) { |
| | | try { |
| | | const _this = this; |
| | | // æéè¦ç±»åå建æä»¶å¹¶ä¸è½½ |
| | | if (type === "xml" || type === "bpmn") { |
| | | const { err, xml } = await this.bpmnModeler.saveXML(); |
| | | // 读åå¼å¸¸æ¶æåºå¼å¸¸ |
| | | if (err) { |
| | | console.error(`[Process Designer Warn ]: ${err.message || err}`); |
| | | } |
| | | let { href, filename } = _this.setEncoded(type.toUpperCase(), name, xml); |
| | | downloadFunc(href, filename); |
| | | } else { |
| | | const { err, svg } = await this.bpmnModeler.saveSVG(); |
| | | // 读åå¼å¸¸æ¶æåºå¼å¸¸ |
| | | if (err) { |
| | | return console.error(err); |
| | | } |
| | | let { href, filename } = _this.setEncoded("SVG", name, svg); |
| | | downloadFunc(href, filename); |
| | | } |
| | | } catch (e) { |
| | | console.error(`[Process Designer Warn ]: ${e.message || e}`); |
| | | } |
| | | // æä»¶ä¸è½½æ¹æ³ |
| | | function downloadFunc(href, filename) { |
| | | if (href && filename) { |
| | | let a = document.createElement("a"); |
| | | a.download = filename; //æå®ä¸è½½çæä»¶å |
| | | a.href = href; // URL对象 |
| | | a.click(); // 模æç¹å» |
| | | URL.revokeObjectURL(a.href); // éæ¾URL 对象 |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // æ ¹æ®æéç±»åè¿è¡è½¬ç å¹¶è¿åä¸è½½å°å |
| | | setEncoded(type, filename = "diagram", data) { |
| | | const encodedData = encodeURIComponent(data); |
| | | return { |
| | | filename: `${filename}.${type}`, |
| | | href: `data:application/${type === "svg" ? "text/xml" : "bpmn20-xml"};charset=UTF-8,${encodedData}`, |
| | | data: data |
| | | }; |
| | | }, |
| | | |
| | | // å è½½æ¬å°æä»¶ |
| | | importLocalFile() { |
| | | const that = this; |
| | | const file = this.$refs.refFile.files[0]; |
| | | const reader = new FileReader(); |
| | | reader.readAsText(file); |
| | | reader.onload = function() { |
| | | let xmlStr = this.result; |
| | | that.createNewDiagram(xmlStr); |
| | | }; |
| | | }, |
| | | /* ------------------------------------------------ refs methods ------------------------------------------------------ */ |
| | | downloadProcessAsXml() { |
| | | this.downloadProcess("xml"); |
| | | }, |
| | | downloadProcessAsBpmn() { |
| | | this.downloadProcess("bpmn"); |
| | | }, |
| | | downloadProcessAsSvg() { |
| | | this.downloadProcess("svg"); |
| | | }, |
| | | processSimulation() { |
| | | this.simulationStatus = !this.simulationStatus; |
| | | this.simulation && this.bpmnModeler.get("toggleMode").toggleMode(); |
| | | }, |
| | | processRedo() { |
| | | this.bpmnModeler.get("commandStack").redo(); |
| | | }, |
| | | processUndo() { |
| | | this.bpmnModeler.get("commandStack").undo(); |
| | | }, |
| | | processZoomIn(zoomStep = 0.1) { |
| | | let newZoom = Math.floor(this.defaultZoom * 100 + zoomStep * 100) / 100; |
| | | if (newZoom > 4) { |
| | | throw new Error("[Process Designer Warn ]: The zoom ratio cannot be greater than 4"); |
| | | } |
| | | this.defaultZoom = newZoom; |
| | | this.bpmnModeler.get("canvas").zoom(this.defaultZoom); |
| | | }, |
| | | processZoomOut(zoomStep = 0.1) { |
| | | let newZoom = Math.floor(this.defaultZoom * 100 - zoomStep * 100) / 100; |
| | | if (newZoom < 0.2) { |
| | | throw new Error("[Process Designer Warn ]: The zoom ratio cannot be less than 0.2"); |
| | | } |
| | | this.defaultZoom = newZoom; |
| | | this.bpmnModeler.get("canvas").zoom(this.defaultZoom); |
| | | }, |
| | | processZoomTo(newZoom = 1) { |
| | | if (newZoom < 0.2) { |
| | | throw new Error("[Process Designer Warn ]: The zoom ratio cannot be less than 0.2"); |
| | | } |
| | | if (newZoom > 4) { |
| | | throw new Error("[Process Designer Warn ]: The zoom ratio cannot be greater than 4"); |
| | | } |
| | | this.defaultZoom = newZoom; |
| | | this.bpmnModeler.get("canvas").zoom(newZoom); |
| | | }, |
| | | processReZoom() { |
| | | this.defaultZoom = 1; |
| | | this.bpmnModeler.get("canvas").zoom("fit-viewport", "auto"); |
| | | }, |
| | | processRestart() { |
| | | this.recoverable = false; |
| | | this.revocable = false; |
| | | this.createNewDiagram(null); |
| | | }, |
| | | elementsAlign(align) { |
| | | const Align = this.bpmnModeler.get("alignElements"); |
| | | const Selection = this.bpmnModeler.get("selection"); |
| | | const SelectedElements = Selection.get(); |
| | | if (!SelectedElements || SelectedElements.length <= 1) { |
| | | this.$message.warning("请æä½ Ctrl é®éæ©å¤ä¸ªå
ç´ å¯¹é½"); |
| | | return; |
| | | } |
| | | this.$confirm("èªå¨å¯¹é½å¯è½é æå¾å½¢åå½¢ï¼æ¯å¦ç»§ç»ï¼", "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(() => Align.trigger(SelectedElements, align)); |
| | | }, |
| | | /*----------------------------- æ¹æ³ç»æ ---------------------------------*/ |
| | | previewProcessXML() { |
| | | this.bpmnModeler.saveXML({ format: true }).then(({ xml }) => { |
| | | this.previewResult = xml; |
| | | this.previewType = 'xml'; |
| | | this.cmOptions.mode = 'xml' |
| | | this.previewModelVisible = true; |
| | | }); |
| | | }, |
| | | previewProcessJson() { |
| | | // this.bpmnModeler.saveXML({ format: true }).then(({ xml }) => { |
| | | // this.previewResult = convert.xml2json(xml, { spaces: 2 }); |
| | | // this.previewType = "json"; |
| | | // this.previewModelVisible = true; |
| | | // }); |
| | | const newConvert = new X2JS(); |
| | | this.bpmnModeler.saveXML({ format: true }).then(({ xml }) => { |
| | | const { definitions } = newConvert.xml2js(xml); |
| | | if (definitions) { |
| | | this.previewResult = JSON.stringify(definitions, null, 4); |
| | | } else { |
| | | this.previewResult = ""; |
| | | } |
| | | |
| | | this.previewType = "json"; |
| | | this.previewModelVisible = true; |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import MyProcessDesigner from './ProcessDesigner.vue'; |
| | | |
| | | MyProcessDesigner.install = function(Vue) { |
| | | Vue.component(MyProcessDesigner.name, MyProcessDesigner); |
| | | }; |
| | | |
| | | export default MyProcessDesigner; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { assign, forEach, isArray } from 'min-dash'; |
| | | |
| | | import { is } from 'bpmn-js/lib/util/ModelUtil'; |
| | | |
| | | import { isExpanded, isEventSubProcess } from 'bpmn-js/lib/util/DiUtil'; |
| | | |
| | | import { isAny } from 'bpmn-js/lib/features/modeling/util/ModelingUtil'; |
| | | |
| | | import { getChildLanes } from 'bpmn-js/lib/features/modeling/util/LaneUtil'; |
| | | |
| | | import { hasPrimaryModifier } from 'diagram-js/lib/util/Mouse'; |
| | | |
| | | /** |
| | | * A provider for BPMN 2.0 elements context pad |
| | | */ |
| | | export default function ContextPadProvider( |
| | | config, |
| | | injector, |
| | | eventBus, |
| | | contextPad, |
| | | modeling, |
| | | elementFactory, |
| | | connect, |
| | | create, |
| | | popupMenu, |
| | | canvas, |
| | | rules, |
| | | translate, |
| | | elementRegistry |
| | | ) { |
| | | config = config || {}; |
| | | |
| | | contextPad.registerProvider(this); |
| | | |
| | | this._contextPad = contextPad; |
| | | |
| | | this._modeling = modeling; |
| | | |
| | | this._elementFactory = elementFactory; |
| | | this._connect = connect; |
| | | this._create = create; |
| | | this._popupMenu = popupMenu; |
| | | this._canvas = canvas; |
| | | this._rules = rules; |
| | | this._translate = translate; |
| | | |
| | | if (config.autoPlace !== false) { |
| | | this._autoPlace = injector.get('autoPlace', false); |
| | | } |
| | | |
| | | eventBus.on('create.end', 250, function(event) { |
| | | var context = event.context; |
| | | var shape = context.shape; |
| | | |
| | | if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) { |
| | | return; |
| | | } |
| | | |
| | | var entries = contextPad.getEntries(shape); |
| | | |
| | | if (entries.replace) { |
| | | entries.replace.action.click(event, shape); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | ContextPadProvider.$inject = [ |
| | | 'config.contextPad', |
| | | 'injector', |
| | | 'eventBus', |
| | | 'contextPad', |
| | | 'modeling', |
| | | 'elementFactory', |
| | | 'connect', |
| | | 'create', |
| | | 'popupMenu', |
| | | 'canvas', |
| | | 'rules', |
| | | 'translate', |
| | | 'elementRegistry' |
| | | ]; |
| | | |
| | | ContextPadProvider.prototype.getContextPadEntries = function(element) { |
| | | var contextPad = this._contextPad; |
| | | var modeling = this._modeling; |
| | | var elementFactory = this._elementFactory; |
| | | var connect = this._connect; |
| | | var create = this._create; |
| | | var popupMenu = this._popupMenu; |
| | | var canvas = this._canvas; |
| | | var rules = this._rules; |
| | | var autoPlace = this._autoPlace; |
| | | var translate = this._translate; |
| | | |
| | | var actions = {}; |
| | | |
| | | if (element.type === 'label') { |
| | | return actions; |
| | | } |
| | | |
| | | var businessObject = element.businessObject; |
| | | |
| | | function startConnect(event, element) { |
| | | connect.start(event, element); |
| | | } |
| | | |
| | | function removeElement() { |
| | | modeling.removeElements([element]); |
| | | } |
| | | |
| | | function getReplaceMenuPosition(element) { |
| | | var Y_OFFSET = 5; |
| | | |
| | | var diagramContainer = canvas.getContainer(); |
| | | var pad = contextPad.getPad(element).html; |
| | | |
| | | var diagramRect = diagramContainer.getBoundingClientRect(); |
| | | var padRect = pad.getBoundingClientRect(); |
| | | |
| | | var top = padRect.top - diagramRect.top; |
| | | var left = padRect.left - diagramRect.left; |
| | | |
| | | var pos = { |
| | | x: left, |
| | | y: top + padRect.height + Y_OFFSET |
| | | }; |
| | | |
| | | return pos; |
| | | } |
| | | |
| | | /** |
| | | * Create an append action |
| | | * |
| | | * @param {string} type |
| | | * @param {string} className |
| | | * @param {string} [title] |
| | | * @param {Object} [options] |
| | | * |
| | | * @return {Object} descriptor |
| | | */ |
| | | function appendAction(type, className, title, options) { |
| | | if (typeof title !== 'string') { |
| | | options = title; |
| | | title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') }); |
| | | } |
| | | |
| | | function appendStart(event, element) { |
| | | var shape = elementFactory.createShape(assign({ type: type }, options)); |
| | | create.start(event, shape, { |
| | | source: element |
| | | }); |
| | | } |
| | | |
| | | var append = autoPlace |
| | | ? function(event, element) { |
| | | var shape = elementFactory.createShape(assign({ type: type }, options)); |
| | | |
| | | autoPlace.append(element, shape); |
| | | } |
| | | : appendStart; |
| | | |
| | | return { |
| | | group: 'model', |
| | | className: className, |
| | | title: title, |
| | | action: { |
| | | dragstart: appendStart, |
| | | click: append |
| | | } |
| | | }; |
| | | } |
| | | |
| | | function splitLaneHandler(count) { |
| | | return function(event, element) { |
| | | // actual split |
| | | modeling.splitLane(element, count); |
| | | |
| | | // refresh context pad after split to |
| | | // get rid of split icons |
| | | contextPad.open(element, true); |
| | | }; |
| | | } |
| | | |
| | | if (isAny(businessObject, ['bpmn:Lane', 'bpmn:Participant']) && isExpanded(businessObject)) { |
| | | var childLanes = getChildLanes(element); |
| | | |
| | | assign(actions, { |
| | | 'lane-insert-above': { |
| | | group: 'lane-insert-above', |
| | | className: 'bpmn-icon-lane-insert-above', |
| | | title: translate('Add Lane above'), |
| | | action: { |
| | | click: function(event, element) { |
| | | modeling.addLane(element, 'top'); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (childLanes.length < 2) { |
| | | if (element.height >= 120) { |
| | | assign(actions, { |
| | | 'lane-divide-two': { |
| | | group: 'lane-divide', |
| | | className: 'bpmn-icon-lane-divide-two', |
| | | title: translate('Divide into two Lanes'), |
| | | action: { |
| | | click: splitLaneHandler(2) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (element.height >= 180) { |
| | | assign(actions, { |
| | | 'lane-divide-three': { |
| | | group: 'lane-divide', |
| | | className: 'bpmn-icon-lane-divide-three', |
| | | title: translate('Divide into three Lanes'), |
| | | action: { |
| | | click: splitLaneHandler(3) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | assign(actions, { |
| | | 'lane-insert-below': { |
| | | group: 'lane-insert-below', |
| | | className: 'bpmn-icon-lane-insert-below', |
| | | title: translate('Add Lane below'), |
| | | action: { |
| | | click: function(event, element) { |
| | | modeling.addLane(element, 'bottom'); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (is(businessObject, 'bpmn:FlowNode')) { |
| | | if (is(businessObject, 'bpmn:EventBasedGateway')) { |
| | | assign(actions, { |
| | | 'append.receive-task': appendAction('bpmn:ReceiveTask', 'bpmn-icon-receive-task', translate('Append ReceiveTask')), |
| | | 'append.message-intermediate-event': appendAction( |
| | | 'bpmn:IntermediateCatchEvent', |
| | | 'bpmn-icon-intermediate-event-catch-message', |
| | | translate('Append MessageIntermediateCatchEvent'), |
| | | { eventDefinitionType: 'bpmn:MessageEventDefinition' } |
| | | ), |
| | | 'append.timer-intermediate-event': appendAction( |
| | | 'bpmn:IntermediateCatchEvent', |
| | | 'bpmn-icon-intermediate-event-catch-timer', |
| | | translate('Append TimerIntermediateCatchEvent'), |
| | | { eventDefinitionType: 'bpmn:TimerEventDefinition' } |
| | | ), |
| | | 'append.condition-intermediate-event': appendAction( |
| | | 'bpmn:IntermediateCatchEvent', |
| | | 'bpmn-icon-intermediate-event-catch-condition', |
| | | translate('Append ConditionIntermediateCatchEvent'), |
| | | { eventDefinitionType: 'bpmn:ConditionalEventDefinition' } |
| | | ), |
| | | 'append.signal-intermediate-event': appendAction( |
| | | 'bpmn:IntermediateCatchEvent', |
| | | 'bpmn-icon-intermediate-event-catch-signal', |
| | | translate('Append SignalIntermediateCatchEvent'), |
| | | { eventDefinitionType: 'bpmn:SignalEventDefinition' } |
| | | ) |
| | | }); |
| | | } else if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) { |
| | | assign(actions, { |
| | | 'append.compensation-activity': appendAction('bpmn:Task', 'bpmn-icon-task', translate('Append compensation activity'), { |
| | | isForCompensation: true |
| | | }) |
| | | }); |
| | | } else if ( |
| | | !is(businessObject, 'bpmn:EndEvent') && |
| | | !businessObject.isForCompensation && |
| | | !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') && |
| | | !isEventSubProcess(businessObject) |
| | | ) { |
| | | assign(actions, { |
| | | 'append.end-event': appendAction('bpmn:EndEvent', 'bpmn-icon-end-event-none', translate('Append EndEvent')), |
| | | 'append.gateway': appendAction('bpmn:ExclusiveGateway', 'bpmn-icon-gateway-none', translate('Append Gateway')), |
| | | 'append.append-task': appendAction('bpmn:UserTask', 'bpmn-icon-user-task', translate('Append Task')), |
| | | 'append.intermediate-event': appendAction( |
| | | 'bpmn:IntermediateThrowEvent', |
| | | 'bpmn-icon-intermediate-event-none', |
| | | translate('Append Intermediate/Boundary Event') |
| | | ) |
| | | }); |
| | | } |
| | | } |
| | | |
| | | if (!popupMenu.isEmpty(element, 'bpmn-replace')) { |
| | | // Replace menu entry |
| | | assign(actions, { |
| | | replace: { |
| | | group: 'edit', |
| | | className: 'bpmn-icon-screw-wrench', |
| | | title: translate('Change type'), |
| | | action: { |
| | | click: function(event, element) { |
| | | var position = assign(getReplaceMenuPosition(element), { |
| | | cursor: { x: event.x, y: event.y } |
| | | }); |
| | | |
| | | popupMenu.open(element, 'bpmn-replace', position); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (isAny(businessObject, ['bpmn:FlowNode', 'bpmn:InteractionNode', 'bpmn:DataObjectReference', 'bpmn:DataStoreReference'])) { |
| | | assign(actions, { |
| | | 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation'), |
| | | |
| | | connect: { |
| | | group: 'connect', |
| | | className: 'bpmn-icon-connection-multi', |
| | | title: translate('Connect using ' + (businessObject.isForCompensation ? '' : 'Sequence/MessageFlow or ') + 'Association'), |
| | | action: { |
| | | click: startConnect, |
| | | dragstart: startConnect |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (isAny(businessObject, ['bpmn:DataObjectReference', 'bpmn:DataStoreReference'])) { |
| | | assign(actions, { |
| | | connect: { |
| | | group: 'connect', |
| | | className: 'bpmn-icon-connection-multi', |
| | | title: translate('Connect using DataInputAssociation'), |
| | | action: { |
| | | click: startConnect, |
| | | dragstart: startConnect |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (is(businessObject, 'bpmn:Group')) { |
| | | assign(actions, { |
| | | 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation') |
| | | }); |
| | | } |
| | | |
| | | // delete element entry, only show if allowed by rules |
| | | var deleteAllowed = rules.allowed('elements.delete', { elements: [element] }); |
| | | |
| | | if (isArray(deleteAllowed)) { |
| | | // was the element returned as a deletion candidate? |
| | | deleteAllowed = deleteAllowed[0] === element; |
| | | } |
| | | |
| | | if (deleteAllowed) { |
| | | assign(actions, { |
| | | delete: { |
| | | group: 'edit', |
| | | className: 'bpmn-icon-trash', |
| | | title: translate('Remove'), |
| | | action: { |
| | | click: removeElement |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return actions; |
| | | }; |
| | | |
| | | // helpers ///////// |
| | | |
| | | function isEventType(eventBo, type, definition) { |
| | | var isType = eventBo.$instanceOf(type); |
| | | var isDefinition = false; |
| | | |
| | | var definitions = eventBo.eventDefinitions || []; |
| | | forEach(definitions, function(def) { |
| | | if (def.$type === definition) { |
| | | isDefinition = true; |
| | | } |
| | | }); |
| | | |
| | | return isType && isDefinition; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import CustomContextPadProvider from './contentPadProvider'; |
| | | |
| | | export default { |
| | | __init__: ['contextPadProvider'], |
| | | contextPadProvider: ['type', CustomContextPadProvider] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export default (key, name, type) => { |
| | | if (!type) type = 'camunda'; |
| | | const TYPE_TARGET = { |
| | | activiti: 'http://activiti.org/bpmn', |
| | | camunda: 'http://bpmn.io/schema/bpmn', |
| | | flowable: 'http://flowable.org/bpmn' |
| | | }; |
| | | return `<?xml version="1.0" encoding="UTF-8"?> |
| | | <bpmn2:definitions |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" |
| | | xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" |
| | | xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" |
| | | xmlns:di="http://www.omg.org/spec/DD/20100524/DI" |
| | | id="diagram_${key}" |
| | | targetNamespace="${TYPE_TARGET[type]}"> |
| | | <bpmn2:process id="${key}" name="${name}" isExecutable="true"> |
| | | </bpmn2:process> |
| | | <bpmndi:BPMNDiagram id="BPMNDiagram_1"> |
| | | <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${key}"> |
| | | </bpmndi:BPMNPlane> |
| | | </bpmndi:BPMNDiagram> |
| | | </bpmn2:definitions>`; |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name": "Activiti", |
| | | "uri": "http://activiti.org/bpmn", |
| | | "prefix": "activiti", |
| | | "xml": { |
| | | "tagAlias": "lowerCase" |
| | | }, |
| | | "associations": [], |
| | | "types": [ |
| | | { |
| | | "name": "Definitions", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Definitions" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "diagramRelationId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InOutBinding", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "isAbstract": true, |
| | | "properties": [ |
| | | { |
| | | "name": "source", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "sourceExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "target", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "businessKey", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "local", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "variables", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "In", |
| | | "superClass": [ |
| | | "InOutBinding" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:CallActivity" |
| | | ] |
| | | } |
| | | }, |
| | | { |
| | | "name": "Out", |
| | | "superClass": [ |
| | | "InOutBinding" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:CallActivity" |
| | | ] |
| | | } |
| | | }, |
| | | { |
| | | "name": "AsyncCapable", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Activity", |
| | | "bpmn:Gateway", |
| | | "bpmn:Event" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "async", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "asyncBefore", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "asyncAfter", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "exclusive", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "JobPriorized", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Process", |
| | | "activiti:AsyncCapable" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "jobPriority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "SignalEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:SignalEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "async", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ErrorEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:ErrorEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "errorCodeVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "errorMessageVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Error", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Error" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "activiti:errorMessage", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "PotentialStarter", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "resourceAssignmentExpression", |
| | | "type": "bpmn:ResourceAssignmentExpression" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormSupported", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:StartEvent", |
| | | "bpmn:UserTask" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "formHandlerClass", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "formKey", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TemplateSupported", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Process", |
| | | "bpmn:FlowElement" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "modelerTemplate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Initiator", |
| | | "isAbstract": true, |
| | | "extends": [ "bpmn:StartEvent" ], |
| | | "properties": [ |
| | | { |
| | | "name": "initiator", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ScriptTask", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:ScriptTask" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "resultVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Process", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Process" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "candidateStarterGroups", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateStarterUsers", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "versionTag", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "historyTimeToLive", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "isStartableInTasklist", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": true |
| | | }, |
| | | { |
| | | "name":"executionListener", |
| | | "isAbstract": true, |
| | | "type":"Expression" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "EscalationEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:EscalationEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "escalationCodeVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormalExpression", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:FormalExpression" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "multiinstance_type", |
| | | "superClass":[ |
| | | "Element" |
| | | ] |
| | | }, |
| | | { |
| | | "name": "multiinstance_condition", |
| | | "superClass":[ |
| | | "Element" |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Assignable", |
| | | "extends": [ "bpmn:UserTask" ], |
| | | "properties": [ |
| | | { |
| | | "name": "assignee", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateUsers", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateGroups", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "dueDate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "followUpDate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "priority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "multiinstance_condition", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "CallActivity", |
| | | "extends": [ "bpmn:CallActivity" ], |
| | | "properties": [ |
| | | { |
| | | "name": "calledElementBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "calledElementVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "calledElementVersionTag", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "calledElementTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseRef", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "caseVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableMappingClass", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableMappingDelegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ServiceTaskLike", |
| | | "extends": [ |
| | | "bpmn:ServiceTask", |
| | | "bpmn:BusinessRuleTask", |
| | | "bpmn:SendTask", |
| | | "bpmn:MessageEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resultVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "DmnCapable", |
| | | "extends": [ |
| | | "bpmn:BusinessRuleTask" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "decisionRef", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "decisionRefBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "decisionRefVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "mapDecisionResult", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "resultList" |
| | | }, |
| | | { |
| | | "name": "decisionRefTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ExternalCapable", |
| | | "extends": [ |
| | | "activiti:ServiceTaskLike" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "type", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "topic", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TaskPriorized", |
| | | "extends": [ |
| | | "bpmn:Process", |
| | | "activiti:ExternalCapable" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "taskPriority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Properties", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ "*" ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "values", |
| | | "type": "Property", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Property", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Connector", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "activiti:ServiceTaskLike" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "inputOutput", |
| | | "type": "InputOutput" |
| | | }, |
| | | { |
| | | "name": "connectorId", |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutput", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:FlowNode", |
| | | "activiti:Connector" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "inputOutput", |
| | | "type": "InputOutput" |
| | | }, |
| | | { |
| | | "name": "connectorId", |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "inputParameters", |
| | | "isMany": true, |
| | | "type": "InputParameter" |
| | | }, |
| | | { |
| | | "name": "outputParameters", |
| | | "isMany": true, |
| | | "type": "OutputParameter" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutputParameter", |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "definition", |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutputParameterDefinition", |
| | | "isAbstract": true |
| | | }, |
| | | { |
| | | "name": "List", |
| | | "superClass": [ "InputOutputParameterDefinition" ], |
| | | "properties": [ |
| | | { |
| | | "name": "items", |
| | | "isMany": true, |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Map", |
| | | "superClass": [ "InputOutputParameterDefinition" ], |
| | | "properties": [ |
| | | { |
| | | "name": "entries", |
| | | "isMany": true, |
| | | "type": "Entry" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Entry", |
| | | "properties": [ |
| | | { |
| | | "name": "key", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "definition", |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Value", |
| | | "superClass": [ |
| | | "InputOutputParameterDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Script", |
| | | "superClass": [ "InputOutputParameterDefinition" ], |
| | | "properties": [ |
| | | { |
| | | "name": "scriptFormat", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Field", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "activiti:ServiceTaskLike", |
| | | "activiti:ExecutionListener", |
| | | "activiti:TaskListener" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "expression", |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "stringValue", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "string", |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputParameter", |
| | | "superClass": [ "InputOutputParameter" ] |
| | | }, |
| | | { |
| | | "name": "OutputParameter", |
| | | "superClass": [ "InputOutputParameter" ] |
| | | }, |
| | | { |
| | | "name": "Collectable", |
| | | "isAbstract": true, |
| | | "extends": [ "bpmn:MultiInstanceLoopCharacteristics" ], |
| | | "superClass": [ "activiti:AsyncCapable" ], |
| | | "properties": [ |
| | | { |
| | | "name": "collection", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "elementVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FailedJobRetryTimeCycle", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "activiti:AsyncCapable", |
| | | "bpmn:MultiInstanceLoopCharacteristics" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "body", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ExecutionListener", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:Task", |
| | | "bpmn:ServiceTask", |
| | | "bpmn:UserTask", |
| | | "bpmn:BusinessRuleTask", |
| | | "bpmn:ScriptTask", |
| | | "bpmn:ReceiveTask", |
| | | "bpmn:ManualTask", |
| | | "bpmn:ExclusiveGateway", |
| | | "bpmn:SequenceFlow", |
| | | "bpmn:ParallelGateway", |
| | | "bpmn:InclusiveGateway", |
| | | "bpmn:EventBasedGateway", |
| | | "bpmn:StartEvent", |
| | | "bpmn:IntermediateCatchEvent", |
| | | "bpmn:IntermediateThrowEvent", |
| | | "bpmn:EndEvent", |
| | | "bpmn:BoundaryEvent", |
| | | "bpmn:CallActivity", |
| | | "bpmn:SubProcess", |
| | | "bpmn:Process" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "event", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "script", |
| | | "type": "Script" |
| | | }, |
| | | { |
| | | "name": "fields", |
| | | "type": "Field", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TaskListener", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:UserTask" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "event", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "script", |
| | | "type": "Script" |
| | | }, |
| | | { |
| | | "name": "fields", |
| | | "type": "Field", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormProperty", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:StartEvent", |
| | | "bpmn:UserTask" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "required", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "readable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "writable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "variable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "expression", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "datePattern", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "default", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "values", |
| | | "type": "Value", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormProperty", |
| | | "superClass": [ "Element" ], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "label", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "datePattern", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "defaultValue", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "properties", |
| | | "type": "Properties" |
| | | }, |
| | | { |
| | | "name": "validation", |
| | | "type": "Validation" |
| | | }, |
| | | { |
| | | "name": "values", |
| | | "type": "Value", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Validation", |
| | | "superClass": [ "Element" ], |
| | | "properties": [ |
| | | { |
| | | "name": "constraints", |
| | | "type": "Constraint", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Constraint", |
| | | "superClass": [ "Element" ], |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "config", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ConditionalEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:ConditionalEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "variableName", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableEvent", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | "emumerations": [ ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name": "Camunda", |
| | | "uri": "http://camunda.org/schema/1.0/bpmn", |
| | | "prefix": "camunda", |
| | | "xml": { |
| | | "tagAlias": "lowerCase" |
| | | }, |
| | | "associations": [], |
| | | "types": [ |
| | | { |
| | | "name": "Definitions", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Definitions" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "diagramRelationId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InOutBinding", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "isAbstract": true, |
| | | "properties": [ |
| | | { |
| | | "name": "source", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "sourceExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "target", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "businessKey", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "local", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "variables", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "In", |
| | | "superClass": [ |
| | | "InOutBinding" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:CallActivity", |
| | | "bpmn:SignalEventDefinition" |
| | | ] |
| | | } |
| | | }, |
| | | { |
| | | "name": "Out", |
| | | "superClass": [ |
| | | "InOutBinding" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:CallActivity" |
| | | ] |
| | | } |
| | | }, |
| | | { |
| | | "name": "AsyncCapable", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Activity", |
| | | "bpmn:Gateway", |
| | | "bpmn:Event" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "async", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "asyncBefore", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "asyncAfter", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "exclusive", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "JobPriorized", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Process", |
| | | "camunda:AsyncCapable" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "jobPriority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "SignalEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:SignalEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "async", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ErrorEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:ErrorEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "errorCodeVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "errorMessageVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Error", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Error" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "camunda:errorMessage", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "PotentialStarter", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "resourceAssignmentExpression", |
| | | "type": "bpmn:ResourceAssignmentExpression" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormSupported", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:StartEvent", |
| | | "bpmn:UserTask" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "formHandlerClass", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "formKey", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TemplateSupported", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Process", |
| | | "bpmn:FlowElement" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "modelerTemplate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "modelerTemplateVersion", |
| | | "isAttr": true, |
| | | "type": "Integer" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Initiator", |
| | | "isAbstract": true, |
| | | "extends": [ "bpmn:StartEvent" ], |
| | | "properties": [ |
| | | { |
| | | "name": "initiator", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ScriptTask", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:ScriptTask" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "resultVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Process", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:Process" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "candidateStarterGroups", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateStarterUsers", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "versionTag", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "historyTimeToLive", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "isStartableInTasklist", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "EscalationEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:EscalationEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "escalationCodeVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormalExpression", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:FormalExpression" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Assignable", |
| | | "extends": [ "bpmn:UserTask" ], |
| | | "properties": [ |
| | | { |
| | | "name": "assignee", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateUsers", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateGroups", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "dueDate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "followUpDate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "priority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "CallActivity", |
| | | "extends": [ "bpmn:CallActivity" ], |
| | | "properties": [ |
| | | { |
| | | "name": "calledElementBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "calledElementVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "calledElementVersionTag", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "calledElementTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseRef", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "caseVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableMappingClass", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableMappingDelegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ServiceTaskLike", |
| | | "extends": [ |
| | | "bpmn:ServiceTask", |
| | | "bpmn:BusinessRuleTask", |
| | | "bpmn:SendTask", |
| | | "bpmn:MessageEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resultVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "DmnCapable", |
| | | "extends": [ |
| | | "bpmn:BusinessRuleTask" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "decisionRef", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "decisionRefBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "decisionRefVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "mapDecisionResult", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "resultList" |
| | | }, |
| | | { |
| | | "name": "decisionRefTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ExternalCapable", |
| | | "extends": [ |
| | | "camunda:ServiceTaskLike" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "type", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "topic", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TaskPriorized", |
| | | "extends": [ |
| | | "bpmn:Process", |
| | | "camunda:ExternalCapable" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "taskPriority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Properties", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ "*" ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "values", |
| | | "type": "Property", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Property", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Connector", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "camunda:ServiceTaskLike" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "inputOutput", |
| | | "type": "InputOutput" |
| | | }, |
| | | { |
| | | "name": "connectorId", |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutput", |
| | | "superClass": [ |
| | | "Element" |
| | | ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:FlowNode", |
| | | "camunda:Connector" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "inputOutput", |
| | | "type": "InputOutput" |
| | | }, |
| | | { |
| | | "name": "connectorId", |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "inputParameters", |
| | | "isMany": true, |
| | | "type": "InputParameter" |
| | | }, |
| | | { |
| | | "name": "outputParameters", |
| | | "isMany": true, |
| | | "type": "OutputParameter" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutputParameter", |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "definition", |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutputParameterDefinition", |
| | | "isAbstract": true |
| | | }, |
| | | { |
| | | "name": "List", |
| | | "superClass": [ "InputOutputParameterDefinition" ], |
| | | "properties": [ |
| | | { |
| | | "name": "items", |
| | | "isMany": true, |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Map", |
| | | "superClass": [ "InputOutputParameterDefinition" ], |
| | | "properties": [ |
| | | { |
| | | "name": "entries", |
| | | "isMany": true, |
| | | "type": "Entry" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Entry", |
| | | "properties": [ |
| | | { |
| | | "name": "key", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "definition", |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Value", |
| | | "superClass": [ |
| | | "InputOutputParameterDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Script", |
| | | "superClass": [ "InputOutputParameterDefinition" ], |
| | | "properties": [ |
| | | { |
| | | "name": "scriptFormat", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Field", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "camunda:ServiceTaskLike", |
| | | "camunda:ExecutionListener", |
| | | "camunda:TaskListener" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "expression", |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "stringValue", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "string", |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputParameter", |
| | | "superClass": [ "InputOutputParameter" ] |
| | | }, |
| | | { |
| | | "name": "OutputParameter", |
| | | "superClass": [ "InputOutputParameter" ] |
| | | }, |
| | | { |
| | | "name": "Collectable", |
| | | "isAbstract": true, |
| | | "extends": [ "bpmn:MultiInstanceLoopCharacteristics" ], |
| | | "superClass": [ "camunda:AsyncCapable" ], |
| | | "properties": [ |
| | | { |
| | | "name": "collection", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "elementVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FailedJobRetryTimeCycle", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "camunda:AsyncCapable", |
| | | "bpmn:MultiInstanceLoopCharacteristics" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "body", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ExecutionListener", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:Task", |
| | | "bpmn:ServiceTask", |
| | | "bpmn:UserTask", |
| | | "bpmn:BusinessRuleTask", |
| | | "bpmn:ScriptTask", |
| | | "bpmn:ReceiveTask", |
| | | "bpmn:ManualTask", |
| | | "bpmn:ExclusiveGateway", |
| | | "bpmn:SequenceFlow", |
| | | "bpmn:ParallelGateway", |
| | | "bpmn:InclusiveGateway", |
| | | "bpmn:EventBasedGateway", |
| | | "bpmn:StartEvent", |
| | | "bpmn:IntermediateCatchEvent", |
| | | "bpmn:IntermediateThrowEvent", |
| | | "bpmn:EndEvent", |
| | | "bpmn:BoundaryEvent", |
| | | "bpmn:CallActivity", |
| | | "bpmn:SubProcess", |
| | | "bpmn:Process" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "event", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "script", |
| | | "type": "Script" |
| | | }, |
| | | { |
| | | "name": "fields", |
| | | "type": "Field", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TaskListener", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:UserTask" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "event", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "script", |
| | | "type": "Script" |
| | | }, |
| | | { |
| | | "name": "fields", |
| | | "type": "Field", |
| | | "isMany": true |
| | | }, |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "eventDefinitions", |
| | | "type": "bpmn:TimerEventDefinition", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormProperty", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:StartEvent", |
| | | "bpmn:UserTask" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "required", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "readable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "writable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "variable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "expression", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "datePattern", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "default", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "values", |
| | | "type": "Value", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormData", |
| | | "superClass": [ "Element" ], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:StartEvent", |
| | | "bpmn:UserTask" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "fields", |
| | | "type": "FormField", |
| | | "isMany": true |
| | | }, |
| | | { |
| | | "name": "businessKey", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormField", |
| | | "superClass": [ "Element" ], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "label", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "datePattern", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "defaultValue", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "properties", |
| | | "type": "Properties" |
| | | }, |
| | | { |
| | | "name": "validation", |
| | | "type": "Validation" |
| | | }, |
| | | { |
| | | "name": "values", |
| | | "type": "Value", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Validation", |
| | | "superClass": [ "Element" ], |
| | | "properties": [ |
| | | { |
| | | "name": "constraints", |
| | | "type": "Constraint", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Constraint", |
| | | "superClass": [ "Element" ], |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "config", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ConditionalEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": [ |
| | | "bpmn:ConditionalEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "variableName", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableEvents", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | "emumerations": [ ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name": "Flowable", |
| | | "uri": "http://flowable.org/bpmn", |
| | | "prefix": "flowable", |
| | | "xml": { |
| | | "tagAlias": "lowerCase" |
| | | }, |
| | | "associations": [], |
| | | "types": [ |
| | | { |
| | | "name": "InOutBinding", |
| | | "superClass": ["Element"], |
| | | "isAbstract": true, |
| | | "properties": [ |
| | | { |
| | | "name": "source", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "sourceExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "target", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "businessKey", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "local", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "variables", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "In", |
| | | "superClass": ["InOutBinding"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:CallActivity"] |
| | | } |
| | | }, |
| | | { |
| | | "name": "Out", |
| | | "superClass": ["InOutBinding"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:CallActivity"] |
| | | } |
| | | }, |
| | | { |
| | | "name": "AsyncCapable", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:Activity", "bpmn:Gateway", "bpmn:Event"], |
| | | "properties": [ |
| | | { |
| | | "name": "async", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "asyncBefore", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "asyncAfter", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "exclusive", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "JobPriorized", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:Process", "flowable:AsyncCapable"], |
| | | "properties": [ |
| | | { |
| | | "name": "jobPriority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "SignalEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:SignalEventDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "async", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ErrorEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:ErrorEventDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "errorCodeVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "errorMessageVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Error", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:Error"], |
| | | "properties": [ |
| | | { |
| | | "name": "flowable:errorMessage", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "PotentialStarter", |
| | | "superClass": ["Element"], |
| | | "properties": [ |
| | | { |
| | | "name": "resourceAssignmentExpression", |
| | | "type": "bpmn:ResourceAssignmentExpression" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormSupported", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:StartEvent", "bpmn:UserTask"], |
| | | "properties": [ |
| | | { |
| | | "name": "formHandlerClass", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "formKey", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "formType", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "formReadOnly", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": false |
| | | }, |
| | | { |
| | | "name": "formInit", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TemplateSupported", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:Process", "bpmn:FlowElement"], |
| | | "properties": [ |
| | | { |
| | | "name": "modelerTemplate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Initiator", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:StartEvent"], |
| | | "properties": [ |
| | | { |
| | | "name": "initiator", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ScriptTask", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:ScriptTask"], |
| | | "properties": [ |
| | | { |
| | | "name": "resultVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Process", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:Process"], |
| | | "properties": [ |
| | | { |
| | | "name": "candidateStarterGroups", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateStarterUsers", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "versionTag", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "historyTimeToLive", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "isStartableInTasklist", |
| | | "isAttr": true, |
| | | "type": "Boolean", |
| | | "default": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "EscalationEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:EscalationEventDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "escalationCodeVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormalExpression", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:FormalExpression"], |
| | | "properties": [ |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Assignable", |
| | | "extends": ["bpmn:UserTask"], |
| | | "properties": [ |
| | | { |
| | | "name": "assignee", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateUsers", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "candidateGroups", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "dueDate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "followUpDate", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "priority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "dataType", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "text", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "deptId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Assignee", |
| | | "supperClass": "Element", |
| | | "meta": { |
| | | "allowedIn": ["*"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "label", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "viewId", |
| | | "type": "Number", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "CallActivity", |
| | | "extends": ["bpmn:CallActivity"], |
| | | "properties": [ |
| | | { |
| | | "name": "calledElementBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "calledElementVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "calledElementVersionTag", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "calledElementTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseRef", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "caseVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "caseTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableMappingClass", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableMappingDelegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ServiceTaskLike", |
| | | "extends": [ |
| | | "bpmn:ServiceTask", |
| | | "bpmn:BusinessRuleTask", |
| | | "bpmn:SendTask", |
| | | "bpmn:MessageEventDefinition" |
| | | ], |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resultVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "DmnCapable", |
| | | "extends": ["bpmn:BusinessRuleTask"], |
| | | "properties": [ |
| | | { |
| | | "name": "decisionRef", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "decisionRefBinding", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "latest" |
| | | }, |
| | | { |
| | | "name": "decisionRefVersion", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "mapDecisionResult", |
| | | "isAttr": true, |
| | | "type": "String", |
| | | "default": "resultList" |
| | | }, |
| | | { |
| | | "name": "decisionRefTenantId", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ExternalCapable", |
| | | "extends": ["flowable:ServiceTaskLike"], |
| | | "properties": [ |
| | | { |
| | | "name": "type", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "topic", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TaskPriorized", |
| | | "extends": ["bpmn:Process", "flowable:ExternalCapable"], |
| | | "properties": [ |
| | | { |
| | | "name": "taskPriority", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Properties", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["*"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "values", |
| | | "type": "Property", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Property", |
| | | "superClass": ["Element"], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Button", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:UserTask"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "code", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "isHide", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "next", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "sort", |
| | | "type": "Integer", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Assignee", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:UserTask"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "condition", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "operationType", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "sort", |
| | | "type": "Integer", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Connector", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["flowable:ServiceTaskLike"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "inputOutput", |
| | | "type": "InputOutput" |
| | | }, |
| | | { |
| | | "name": "connectorId", |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutput", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:FlowNode", "flowable:Connector"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "inputOutput", |
| | | "type": "InputOutput" |
| | | }, |
| | | { |
| | | "name": "connectorId", |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "inputParameters", |
| | | "isMany": true, |
| | | "type": "InputParameter" |
| | | }, |
| | | { |
| | | "name": "outputParameters", |
| | | "isMany": true, |
| | | "type": "OutputParameter" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutputParameter", |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "definition", |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputOutputParameterDefinition", |
| | | "isAbstract": true |
| | | }, |
| | | { |
| | | "name": "List", |
| | | "superClass": ["InputOutputParameterDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "items", |
| | | "isMany": true, |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Map", |
| | | "superClass": ["InputOutputParameterDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "entries", |
| | | "isMany": true, |
| | | "type": "Entry" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Entry", |
| | | "properties": [ |
| | | { |
| | | "name": "key", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "definition", |
| | | "type": "InputOutputParameterDefinition" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Value", |
| | | "superClass": ["InputOutputParameterDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Script", |
| | | "superClass": ["InputOutputParameterDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "scriptFormat", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "resource", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Field", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "flowable:ServiceTaskLike", |
| | | "flowable:ExecutionListener", |
| | | "flowable:TaskListener", |
| | | "bpmn:ServiceTask" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "expression", |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "stringValue", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "string", |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "htmlVar", |
| | | "type": "Expression" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ChildField", |
| | | "superClass": ["Element"], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "required", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "readable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "writable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "variable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "expression", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "datePattern", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "default", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "values", |
| | | "type": "Value", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "InputParameter", |
| | | "superClass": ["InputOutputParameter"] |
| | | }, |
| | | { |
| | | "name": "OutputParameter", |
| | | "superClass": ["InputOutputParameter"] |
| | | }, |
| | | { |
| | | "name": "Collectable", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:MultiInstanceLoopCharacteristics"], |
| | | "superClass": ["flowable:AsyncCapable"], |
| | | "properties": [ |
| | | { |
| | | "name": "collection", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "elementVariable", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FailedJobRetryTimeCycle", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "flowable:AsyncCapable", |
| | | "bpmn:MultiInstanceLoopCharacteristics" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "body", |
| | | "isBody": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ExecutionListener", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": [ |
| | | "bpmn:Task", |
| | | "bpmn:ServiceTask", |
| | | "bpmn:UserTask", |
| | | "bpmn:BusinessRuleTask", |
| | | "bpmn:ScriptTask", |
| | | "bpmn:ReceiveTask", |
| | | "bpmn:ManualTask", |
| | | "bpmn:ExclusiveGateway", |
| | | "bpmn:SequenceFlow", |
| | | "bpmn:ParallelGateway", |
| | | "bpmn:InclusiveGateway", |
| | | "bpmn:EventBasedGateway", |
| | | "bpmn:StartEvent", |
| | | "bpmn:IntermediateCatchEvent", |
| | | "bpmn:IntermediateThrowEvent", |
| | | "bpmn:EndEvent", |
| | | "bpmn:BoundaryEvent", |
| | | "bpmn:CallActivity", |
| | | "bpmn:SubProcess", |
| | | "bpmn:Process" |
| | | ] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "event", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "script", |
| | | "type": "Script" |
| | | }, |
| | | { |
| | | "name": "fields", |
| | | "type": "Field", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "TaskListener", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:UserTask"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "expression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "class", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "delegateExpression", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "event", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "script", |
| | | "type": "Script" |
| | | }, |
| | | { |
| | | "name": "fields", |
| | | "type": "Field", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormProperty", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:StartEvent", "bpmn:UserTask"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "required", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "readable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "writable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "variable", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "expression", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "datePattern", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "default", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "values", |
| | | "type": "Value", |
| | | "isMany": true |
| | | }, |
| | | { |
| | | "name": "children", |
| | | "type": "ChildField", |
| | | "isMany": true |
| | | }, |
| | | { |
| | | "name": "extensionElements", |
| | | "type": "bpmn:ExtensionElements", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormData", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:StartEvent", "bpmn:UserTask"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "fields", |
| | | "type": "FormField", |
| | | "isMany": true |
| | | }, |
| | | { |
| | | "name": "businessKey", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "FormField", |
| | | "superClass": ["Element"], |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "label", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "type", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "datePattern", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "defaultValue", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "properties", |
| | | "type": "Properties" |
| | | }, |
| | | { |
| | | "name": "validation", |
| | | "type": "Validation" |
| | | }, |
| | | { |
| | | "name": "values", |
| | | "type": "Value", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Validation", |
| | | "superClass": ["Element"], |
| | | "properties": [ |
| | | { |
| | | "name": "constraints", |
| | | "type": "Constraint", |
| | | "isMany": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Constraint", |
| | | "superClass": ["Element"], |
| | | "properties": [ |
| | | { |
| | | "name": "name", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "config", |
| | | "type": "String", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "ConditionalEventDefinition", |
| | | "isAbstract": true, |
| | | "extends": ["bpmn:ConditionalEventDefinition"], |
| | | "properties": [ |
| | | { |
| | | "name": "variableName", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | }, |
| | | { |
| | | "name": "variableEvent", |
| | | "isAttr": true, |
| | | "type": "String" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "name": "Condition", |
| | | "superClass": ["Element"], |
| | | "meta": { |
| | | "allowedIn": ["bpmn:SequenceFlow"] |
| | | }, |
| | | "properties": [ |
| | | { |
| | | "name": "id", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "field", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "compare", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "value", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "logic", |
| | | "type": "String", |
| | | "isAttr": true |
| | | }, |
| | | { |
| | | "name": "sort", |
| | | "type": "Integer", |
| | | "isAttr": true |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | "emumerations": [] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 'use strict'; |
| | | |
| | | import { some } from '#/utils/min-dash.js'; |
| | | |
| | | var ALLOWED_TYPES = { |
| | | FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'], |
| | | Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'], |
| | | Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'] |
| | | }; |
| | | |
| | | function is(element, type) { |
| | | return element && typeof element.$instanceOf === 'function' && element.$instanceOf(type); |
| | | } |
| | | |
| | | function exists(element) { |
| | | return element && element.length; |
| | | } |
| | | |
| | | function includesType(collection, type) { |
| | | return ( |
| | | exists(collection) && |
| | | some(collection, function(element) { |
| | | return is(element, type); |
| | | }) |
| | | ); |
| | | } |
| | | |
| | | function anyType(element, types) { |
| | | return some(types, function(type) { |
| | | return is(element, type); |
| | | }); |
| | | } |
| | | |
| | | function isAllowed(propName, propDescriptor, newElement) { |
| | | var name = propDescriptor.name; |
| | | var types = ALLOWED_TYPES[name.replace(/activiti:/, '')]; |
| | | |
| | | return name === propName && anyType(newElement, types); |
| | | } |
| | | |
| | | export default function ActivitiModdleExtension(eventBus) { |
| | | eventBus.on( |
| | | 'property.clone', |
| | | function(context) { |
| | | var newElement = context.newElement; |
| | | var propDescriptor = context.propertyDescriptor; |
| | | |
| | | this.canCloneProperty(newElement, propDescriptor); |
| | | }, |
| | | this |
| | | ); |
| | | } |
| | | |
| | | ActivitiModdleExtension.$inject = ['eventBus']; |
| | | |
| | | ActivitiModdleExtension.prototype.canCloneProperty = function(newElement, propDescriptor) { |
| | | if (isAllowed('activiti:FailedJobRetryTimeCycle', propDescriptor, newElement)) { |
| | | return ( |
| | | includesType(newElement.eventDefinitions, 'bpmn:TimerEventDefinition') || |
| | | includesType(newElement.eventDefinitions, 'bpmn:SignalEventDefinition') || |
| | | is(newElement.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics') |
| | | ); |
| | | } |
| | | |
| | | if (isAllowed('activiti:Connector', propDescriptor, newElement)) { |
| | | return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition'); |
| | | } |
| | | |
| | | if (isAllowed('activiti:Field', propDescriptor, newElement)) { |
| | | return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition'); |
| | | } |
| | | }; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * @author igdianov |
| | | * address https://github.com/igdianov/activiti-bpmn-moddle |
| | | * */ |
| | | |
| | | import ActivitiModdleExtension from './activitiExtension.js' |
| | | export default { |
| | | __init__: ['ActivitiModdleExtension'], |
| | | ActivitiModdleExtension: ['type', ActivitiModdleExtension] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 'use strict'; |
| | | |
| | | import { some, isObject, isFunction } from '#/utils/min-dash.js'; |
| | | |
| | | var WILDCARD = '*'; |
| | | |
| | | export default function CamundaModdleExtension(eventBus) { |
| | | var self = this; |
| | | |
| | | eventBus.on('moddleCopy.canCopyProperty', function(context) { |
| | | var property = context.property; |
| | | var parent = context.parent; |
| | | |
| | | return self.canCopyProperty(property, parent); |
| | | }); |
| | | } |
| | | |
| | | CamundaModdleExtension.$inject = ['eventBus']; |
| | | |
| | | /** |
| | | * Check wether to disallow copying property. |
| | | */ |
| | | CamundaModdleExtension.prototype.canCopyProperty = function(property, parent) { |
| | | // (1) check wether property is allowed in parent |
| | | if (isObject(property) && !isAllowedInParent(property, parent)) { |
| | | return false; |
| | | } |
| | | |
| | | // (2) check more complex scenarios |
| | | |
| | | if (is(property, 'camunda:InputOutput') && !this.canHostInputOutput(parent)) { |
| | | return false; |
| | | } |
| | | |
| | | if (isAny(property, ['camunda:Connector', 'camunda:Field']) && !this.canHostConnector(parent)) { |
| | | return false; |
| | | } |
| | | |
| | | if (is(property, 'camunda:In') && !this.canHostIn(parent)) { |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | CamundaModdleExtension.prototype.canHostInputOutput = function(parent) { |
| | | // allowed in camunda:Connector |
| | | var connector = getParent(parent, 'camunda:Connector'); |
| | | |
| | | if (connector) { |
| | | return true; |
| | | } |
| | | |
| | | // special rules inside bpmn:FlowNode |
| | | var flowNode = getParent(parent, 'bpmn:FlowNode'); |
| | | |
| | | if (!flowNode) { |
| | | return false; |
| | | } |
| | | |
| | | if (isAny(flowNode, ['bpmn:StartEvent', 'bpmn:Gateway', 'bpmn:BoundaryEvent'])) { |
| | | return false; |
| | | } |
| | | |
| | | if (is(flowNode, 'bpmn:SubProcess') && flowNode.get('triggeredByEvent')) { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | }; |
| | | |
| | | CamundaModdleExtension.prototype.canHostConnector = function(parent) { |
| | | var serviceTaskLike = getParent(parent, 'camunda:ServiceTaskLike'); |
| | | |
| | | if (is(serviceTaskLike, 'bpmn:MessageEventDefinition')) { |
| | | // only allow on throw and end events |
| | | return getParent(parent, 'bpmn:IntermediateThrowEvent') || getParent(parent, 'bpmn:EndEvent'); |
| | | } |
| | | |
| | | return true; |
| | | }; |
| | | |
| | | CamundaModdleExtension.prototype.canHostIn = function(parent) { |
| | | var callActivity = getParent(parent, 'bpmn:CallActivity'); |
| | | |
| | | if (callActivity) { |
| | | return true; |
| | | } |
| | | |
| | | var signalEventDefinition = getParent(parent, 'bpmn:SignalEventDefinition'); |
| | | |
| | | if (signalEventDefinition) { |
| | | // only allow on throw and end events |
| | | return getParent(parent, 'bpmn:IntermediateThrowEvent') || getParent(parent, 'bpmn:EndEvent'); |
| | | } |
| | | |
| | | return true; |
| | | }; |
| | | |
| | | // helpers ////////// |
| | | |
| | | function is(element, type) { |
| | | return element && isFunction(element.$instanceOf) && element.$instanceOf(type); |
| | | } |
| | | |
| | | function isAny(element, types) { |
| | | return some(types, function(t) { |
| | | return is(element, t); |
| | | }); |
| | | } |
| | | |
| | | function getParent(element, type) { |
| | | if (!type) { |
| | | return element.$parent; |
| | | } |
| | | |
| | | if (is(element, type)) { |
| | | return element; |
| | | } |
| | | |
| | | if (!element.$parent) { |
| | | return; |
| | | } |
| | | |
| | | return getParent(element.$parent, type); |
| | | } |
| | | |
| | | function isAllowedInParent(property, parent) { |
| | | // (1) find property descriptor |
| | | var descriptor = property.$type && property.$model.getTypeDescriptor(property.$type); |
| | | |
| | | var allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn; |
| | | |
| | | if (!allowedIn || isWildcard(allowedIn)) { |
| | | return true; |
| | | } |
| | | |
| | | // (2) check wether property has parent of allowed type |
| | | return some(allowedIn, function(type) { |
| | | return getParent(parent, type); |
| | | }); |
| | | } |
| | | |
| | | function isWildcard(allowedIn) { |
| | | return allowedIn.indexOf(WILDCARD) !== -1; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 'use strict'; |
| | | |
| | | import CamundaModdleExtension from './extension.js'; |
| | | export default { |
| | | __init__: ['CamundaModdleExtension'], |
| | | CamundaModdleExtension: ['type', CamundaModdleExtension] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 'use strict'; |
| | | |
| | | import { some } from '#/utils/min-dash.js'; |
| | | |
| | | var ALLOWED_TYPES = { |
| | | FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'], |
| | | Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'], |
| | | Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'] |
| | | }; |
| | | |
| | | function is(element, type) { |
| | | return element && typeof element.$instanceOf === 'function' && element.$instanceOf(type); |
| | | } |
| | | |
| | | function exists(element) { |
| | | return element && element.length; |
| | | } |
| | | |
| | | function includesType(collection, type) { |
| | | return ( |
| | | exists(collection) && |
| | | some(collection, function(element) { |
| | | return is(element, type); |
| | | }) |
| | | ); |
| | | } |
| | | |
| | | function anyType(element, types) { |
| | | return some(types, function(type) { |
| | | return is(element, type); |
| | | }); |
| | | } |
| | | |
| | | function isAllowed(propName, propDescriptor, newElement) { |
| | | var name = propDescriptor.name; |
| | | var types = ALLOWED_TYPES[name.replace(/flowable:/, '')]; |
| | | |
| | | return name === propName && anyType(newElement, types); |
| | | } |
| | | |
| | | export default function FlowableModdleExtension(eventBus) { |
| | | eventBus.on( |
| | | 'property.clone', |
| | | function(context) { |
| | | var newElement = context.newElement; |
| | | var propDescriptor = context.propertyDescriptor; |
| | | |
| | | this.canCloneProperty(newElement, propDescriptor); |
| | | }, |
| | | this |
| | | ); |
| | | } |
| | | |
| | | FlowableModdleExtension.$inject = ['eventBus']; |
| | | |
| | | FlowableModdleExtension.prototype.canCloneProperty = function(newElement, propDescriptor) { |
| | | if (isAllowed('flowable:FailedJobRetryTimeCycle', propDescriptor, newElement)) { |
| | | return ( |
| | | includesType(newElement.eventDefinitions, 'bpmn:TimerEventDefinition') || |
| | | includesType(newElement.eventDefinitions, 'bpmn:SignalEventDefinition') || |
| | | is(newElement.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics') |
| | | ); |
| | | } |
| | | |
| | | if (isAllowed('flowable:Connector', propDescriptor, newElement)) { |
| | | return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition'); |
| | | } |
| | | |
| | | if (isAllowed('flowable:Field', propDescriptor, newElement)) { |
| | | return includesType(newElement.eventDefinitions, 'bpmn:MessageEventDefinition'); |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * @author igdianov |
| | | * address https://github.com/igdianov/activiti-bpmn-moddle |
| | | * */ |
| | | |
| | | import FlowableModdleExtension from './flowableExtension.js' |
| | | export default { |
| | | __init__: ['FlowableModdleExtension'], |
| | | FlowableModdleExtension: ['type', FlowableModdleExtension] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider'; |
| | | import { assign } from '#/utils/min-dash.js'; |
| | | |
| | | export default function CustomPalette(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) { |
| | | PaletteProvider.call(this, palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate, 2000); |
| | | } |
| | | |
| | | const F = function() {}; // æ ¸å¿ï¼å©ç¨ç©ºå¯¹è±¡ä½ä¸ºä¸ä»ï¼ |
| | | F.prototype = PaletteProvider.prototype; // æ ¸å¿ï¼å°ç¶ç±»çååèµå¼ç»ç©ºå¯¹è±¡Fï¼ |
| | | |
| | | // å©ç¨ä¸ä»å½æ°éååå龿¹æ³ |
| | | F.prototype.getPaletteEntries = function() { |
| | | var actions = {}; |
| | | var create = this._create; |
| | | var elementFactory = this._elementFactory; |
| | | var spaceTool = this._spaceTool; |
| | | var lassoTool = this._lassoTool; |
| | | var handTool = this._handTool; |
| | | var globalConnect = this._globalConnect; |
| | | var translate = this._translate; |
| | | |
| | | function createAction(type, group, className, title, options) { |
| | | function createListener(event) { |
| | | var shape = elementFactory.createShape(assign({ type: type }, options)); |
| | | |
| | | if (options) { |
| | | shape.businessObject.di.isExpanded = options.isExpanded; |
| | | } |
| | | |
| | | create.start(event, shape); |
| | | } |
| | | |
| | | var shortType = type.replace(/^bpmn:/, ''); |
| | | |
| | | return { |
| | | group: group, |
| | | className: className, |
| | | title: title || translate('Create {type}', { type: shortType }), |
| | | action: { |
| | | dragstart: createListener, |
| | | click: createListener |
| | | } |
| | | }; |
| | | } |
| | | |
| | | function createSubprocess(event) { |
| | | var subProcess = elementFactory.createShape({ |
| | | type: 'bpmn:SubProcess', |
| | | x: 0, |
| | | y: 0, |
| | | isExpanded: true |
| | | }); |
| | | |
| | | var startEvent = elementFactory.createShape({ |
| | | type: 'bpmn:StartEvent', |
| | | x: 40, |
| | | y: 82, |
| | | parent: subProcess |
| | | }); |
| | | |
| | | create.start(event, [subProcess, startEvent], { |
| | | hints: { |
| | | autoSelect: [startEvent] |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function createParticipant(event) { |
| | | create.start(event, elementFactory.createParticipantShape()); |
| | | } |
| | | |
| | | assign(actions, { |
| | | 'hand-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-hand-tool', |
| | | title: translate('Activate the hand tool'), |
| | | action: { |
| | | click: function(event) { |
| | | handTool.activateHand(event); |
| | | } |
| | | } |
| | | }, |
| | | 'lasso-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-lasso-tool', |
| | | title: translate('Activate the lasso tool'), |
| | | action: { |
| | | click: function(event) { |
| | | lassoTool.activateSelection(event); |
| | | } |
| | | } |
| | | }, |
| | | 'space-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-space-tool', |
| | | title: translate('Activate the create/remove space tool'), |
| | | action: { |
| | | click: function(event) { |
| | | spaceTool.activateSelection(event); |
| | | } |
| | | } |
| | | }, |
| | | 'global-connect-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-connection-multi', |
| | | title: translate('Activate the global connect tool'), |
| | | action: { |
| | | click: function(event) { |
| | | globalConnect.toggle(event); |
| | | } |
| | | } |
| | | }, |
| | | 'tool-separator': { |
| | | group: 'tools', |
| | | separator: true |
| | | }, |
| | | 'create.start-event': createAction('bpmn:StartEvent', 'event', 'bpmn-icon-start-event-none', translate('Create StartEvent')), |
| | | 'create.intermediate-event': createAction( |
| | | 'bpmn:IntermediateThrowEvent', |
| | | 'event', |
| | | 'bpmn-icon-intermediate-event-none', |
| | | translate('Create Intermediate/Boundary Event') |
| | | ), |
| | | 'create.end-event': createAction('bpmn:EndEvent', 'event', 'bpmn-icon-end-event-none', translate('Create EndEvent')), |
| | | 'create.exclusive-gateway': createAction('bpmn:ExclusiveGateway', 'gateway', 'bpmn-icon-gateway-none', translate('Create Gateway')), |
| | | 'create.user-task': createAction('bpmn:UserTask', 'activity', 'bpmn-icon-user-task', translate('Create User Task')), |
| | | 'create.data-object': createAction('bpmn:DataObjectReference', 'data-object', 'bpmn-icon-data-object', translate('Create DataObjectReference')), |
| | | 'create.data-store': createAction('bpmn:DataStoreReference', 'data-store', 'bpmn-icon-data-store', translate('Create DataStoreReference')), |
| | | 'create.subprocess-expanded': { |
| | | group: 'activity', |
| | | className: 'bpmn-icon-subprocess-expanded', |
| | | title: translate('Create expanded SubProcess'), |
| | | action: { |
| | | dragstart: createSubprocess, |
| | | click: createSubprocess |
| | | } |
| | | }, |
| | | 'create.participant-expanded': { |
| | | group: 'collaboration', |
| | | className: 'bpmn-icon-participant', |
| | | title: translate('Create Pool/Participant'), |
| | | action: { |
| | | dragstart: createParticipant, |
| | | click: createParticipant |
| | | } |
| | | }, |
| | | 'create.group': createAction('bpmn:Group', 'artifact', 'bpmn-icon-group', translate('Create Group')) |
| | | }); |
| | | |
| | | return actions; |
| | | }; |
| | | |
| | | CustomPalette.$inject = ['palette', 'create', 'elementFactory', 'spaceTool', 'lassoTool', 'handTool', 'globalConnect', 'translate']; |
| | | |
| | | CustomPalette.prototype = new F(); // æ ¸å¿ï¼å° Fçå®ä¾èµå¼ç»åç±»ï¼ |
| | | CustomPalette.prototype.constructor = CustomPalette; // ä¿®å¤åç±»CustomPaletteçæé 卿åï¼é²æ¢ååé¾çæ··ä¹±ï¼ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import CustomPalette from './CustomPalette'; |
| | | |
| | | export default { |
| | | __init__: ['customPalette'], |
| | | customPalette: ['type', CustomPalette] |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { assign } from '#/utils/min-dash.js'; |
| | | |
| | | /** |
| | | * A palette provider for BPMN 2.0 elements. |
| | | */ |
| | | export default function PaletteProvider(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) { |
| | | this._palette = palette; |
| | | this._create = create; |
| | | this._elementFactory = elementFactory; |
| | | this._spaceTool = spaceTool; |
| | | this._lassoTool = lassoTool; |
| | | this._handTool = handTool; |
| | | this._globalConnect = globalConnect; |
| | | this._translate = translate; |
| | | |
| | | palette.registerProvider(this); |
| | | } |
| | | |
| | | PaletteProvider.$inject = ['palette', 'create', 'elementFactory', 'spaceTool', 'lassoTool', 'handTool', 'globalConnect', 'translate']; |
| | | |
| | | PaletteProvider.prototype.getPaletteEntries = function() { |
| | | var actions = {}; |
| | | var create = this._create; |
| | | var elementFactory = this._elementFactory; |
| | | var spaceTool = this._spaceTool; |
| | | var lassoTool = this._lassoTool; |
| | | var handTool = this._handTool; |
| | | var globalConnect = this._globalConnect; |
| | | var translate = this._translate; |
| | | |
| | | function createAction(type, group, className, title, options) { |
| | | function createListener(event) { |
| | | var shape = elementFactory.createShape(assign({ type: type }, options)); |
| | | |
| | | if (options) { |
| | | shape.businessObject.di.isExpanded = options.isExpanded; |
| | | } |
| | | |
| | | create.start(event, shape); |
| | | } |
| | | |
| | | var shortType = type.replace(/^bpmn:/, ''); |
| | | |
| | | return { |
| | | group: group, |
| | | className: className, |
| | | title: title || translate('Create {type}', { type: shortType }), |
| | | action: { |
| | | dragstart: createListener, |
| | | click: createListener |
| | | } |
| | | }; |
| | | } |
| | | |
| | | function createSubprocess(event) { |
| | | var subProcess = elementFactory.createShape({ |
| | | type: 'bpmn:SubProcess', |
| | | x: 0, |
| | | y: 0, |
| | | isExpanded: true |
| | | }); |
| | | |
| | | var startEvent = elementFactory.createShape({ |
| | | type: 'bpmn:StartEvent', |
| | | x: 40, |
| | | y: 82, |
| | | parent: subProcess |
| | | }); |
| | | |
| | | create.start(event, [subProcess, startEvent], { |
| | | hints: { |
| | | autoSelect: [startEvent] |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function createParticipant(event) { |
| | | create.start(event, elementFactory.createParticipantShape()); |
| | | } |
| | | |
| | | assign(actions, { |
| | | 'hand-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-hand-tool', |
| | | title: translate('Activate the hand tool'), |
| | | action: { |
| | | click: function(event) { |
| | | handTool.activateHand(event); |
| | | } |
| | | } |
| | | }, |
| | | 'lasso-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-lasso-tool', |
| | | title: translate('Activate the lasso tool'), |
| | | action: { |
| | | click: function(event) { |
| | | lassoTool.activateSelection(event); |
| | | } |
| | | } |
| | | }, |
| | | 'space-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-space-tool', |
| | | title: translate('Activate the create/remove space tool'), |
| | | action: { |
| | | click: function(event) { |
| | | spaceTool.activateSelection(event); |
| | | } |
| | | } |
| | | }, |
| | | 'global-connect-tool': { |
| | | group: 'tools', |
| | | className: 'bpmn-icon-connection-multi', |
| | | title: translate('Activate the global connect tool'), |
| | | action: { |
| | | click: function(event) { |
| | | globalConnect.toggle(event); |
| | | } |
| | | } |
| | | }, |
| | | 'tool-separator': { |
| | | group: 'tools', |
| | | separator: true |
| | | }, |
| | | 'create.start-event': createAction('bpmn:StartEvent', 'event', 'bpmn-icon-start-event-none', translate('Create StartEvent')), |
| | | 'create.intermediate-event': createAction( |
| | | 'bpmn:IntermediateThrowEvent', |
| | | 'event', |
| | | 'bpmn-icon-intermediate-event-none', |
| | | translate('Create Intermediate/Boundary Event') |
| | | ), |
| | | 'create.end-event': createAction('bpmn:EndEvent', 'event', 'bpmn-icon-end-event-none', translate('Create EndEvent')), |
| | | 'create.exclusive-gateway': createAction('bpmn:ExclusiveGateway', 'gateway', 'bpmn-icon-gateway-none', translate('Create Gateway')), |
| | | 'create.user-task': createAction('bpmn:UserTask', 'activity', 'bpmn-icon-user-task', translate('Create User Task')), |
| | | 'create.data-object': createAction('bpmn:DataObjectReference', 'data-object', 'bpmn-icon-data-object', translate('Create DataObjectReference')), |
| | | 'create.data-store': createAction('bpmn:DataStoreReference', 'data-store', 'bpmn-icon-data-store', translate('Create DataStoreReference')), |
| | | 'create.subprocess-expanded': { |
| | | group: 'activity', |
| | | className: 'bpmn-icon-subprocess-expanded', |
| | | title: translate('Create expanded SubProcess'), |
| | | action: { |
| | | dragstart: createSubprocess, |
| | | click: createSubprocess |
| | | } |
| | | }, |
| | | 'create.participant-expanded': { |
| | | group: 'collaboration', |
| | | className: 'bpmn-icon-participant', |
| | | title: translate('Create Pool/Participant'), |
| | | action: { |
| | | dragstart: createParticipant, |
| | | click: createParticipant |
| | | } |
| | | }, |
| | | 'create.group': createAction('bpmn:Group', 'artifact', 'bpmn-icon-group', translate('Create Group')) |
| | | }); |
| | | |
| | | return actions; |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // import translations from "./zh"; |
| | | // |
| | | // export default function customTranslate(template, replacements) { |
| | | // replacements = replacements || {}; |
| | | // |
| | | // // Translate |
| | | // template = translations[template] || template; |
| | | // |
| | | // // Replace |
| | | // return template.replace(/{([^}]+)}/g, function(_, key) { |
| | | // let str = replacements[key]; |
| | | // if ( |
| | | // translations[replacements[key]] !== null && |
| | | // translations[replacements[key]] !== "undefined" |
| | | // ) { |
| | | // // eslint-disable-next-line no-mixed-spaces-and-tabs |
| | | // str = translations[replacements[key]]; |
| | | // // eslint-disable-next-line no-mixed-spaces-and-tabs |
| | | // } |
| | | // return str || "{" + key + "}"; |
| | | // }); |
| | | // } |
| | | |
| | | export default function customTranslate(translations) { |
| | | return function(template, replacements) { |
| | | replacements = replacements || {}; |
| | | // Translate |
| | | template = translations[template] || template; |
| | | |
| | | // Replace |
| | | return template.replace(/{([^}]+)}/g, function(_, key) { |
| | | let str = replacements[key]; |
| | | if (translations[replacements[key]] !== null && translations[replacements[key]] !== undefined) { |
| | | // eslint-disable-next-line no-mixed-spaces-and-tabs |
| | | str = translations[replacements[key]]; |
| | | // eslint-disable-next-line no-mixed-spaces-and-tabs |
| | | } |
| | | return str || '{' + key + '}'; |
| | | }); |
| | | }; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * This is a sample file that should be replaced with the actual translation. |
| | | * |
| | | * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available |
| | | * translations and labels to translate. |
| | | */ |
| | | export default { |
| | | // æ·»å é¨å |
| | | 'Append EndEvent': '追å ç»æäºä»¶', |
| | | 'Append Gateway': '追å ç½å
³', |
| | | 'Append Task': '追å ä»»å¡', |
| | | 'Append Intermediate/Boundary Event': '追å ä¸é´æåºäºä»¶/è¾¹çäºä»¶', |
| | | |
| | | 'Activate the global connect tool': 'æ¿æ´»å
¨å±è¿æ¥å·¥å
·', |
| | | 'Append {type}': 'æ·»å {type}', |
| | | 'Add Lane above': 'å¨ä¸é¢æ·»å é', |
| | | 'Divide into two Lanes': 'åå²æä¸¤ä¸ªé', |
| | | 'Divide into three Lanes': 'å岿ä¸ä¸ªé', |
| | | 'Add Lane below': 'å¨ä¸é¢æ·»å é', |
| | | 'Append compensation activity': '追å è¡¥å¿æ´»å¨', |
| | | 'Change type': 'ä¿®æ¹ç±»å', |
| | | 'Connect using Association': '使ç¨å
³èè¿æ¥', |
| | | 'Connect using Sequence/MessageFlow or Association': '使ç¨é¡ºåº/æ¶æ¯æµæè
å
³èè¿æ¥', |
| | | 'Connect using DataInputAssociation': 'ä½¿ç¨æ°æ®è¾å
¥å
³èè¿æ¥', |
| | | Remove: 'ç§»é¤', |
| | | 'Activate the hand tool': 'æ¿æ´»ææå·¥å
·', |
| | | 'Activate the lasso tool': 'æ¿æ´»å¥ç´¢å·¥å
·', |
| | | 'Activate the create/remove space tool': 'æ¿æ´»å建/å é¤ç©ºé´å·¥å
·', |
| | | 'Create expanded SubProcess': 'å建æ©å±åè¿ç¨', |
| | | 'Create IntermediateThrowEvent/BoundaryEvent': 'å建ä¸é´æåºäºä»¶/è¾¹çäºä»¶', |
| | | 'Create Pool/Participant': 'åå»ºæ± /åä¸è
', |
| | | 'Parallel Multi Instance': 'å¹¶è¡å¤éäºä»¶', |
| | | 'Sequential Multi Instance': 'æ¶åºå¤éäºä»¶', |
| | | DataObjectReference: 'æ°æ®å¯¹è±¡åè', |
| | | DataStoreReference: 'æ°æ®åå¨åè', |
| | | Loop: '循ç¯', |
| | | 'Ad-hoc': 'å³å¸', |
| | | 'Create {type}': 'å建 {type}', |
| | | Task: 'ä»»å¡', |
| | | 'Send Task': 'åéä»»å¡', |
| | | 'Receive Task': 'æ¥æ¶ä»»å¡', |
| | | 'User Task': 'ç¨æ·ä»»å¡', |
| | | 'Manual Task': 'æå·¥ä»»å¡', |
| | | 'Business Rule Task': 'ä¸å¡è§åä»»å¡', |
| | | 'Service Task': 'æå¡ä»»å¡', |
| | | 'Script Task': 'èæ¬ä»»å¡', |
| | | 'Call Activity': 'è°ç¨æ´»å¨', |
| | | 'Sub Process (collapsed)': 'åæµç¨ï¼æå çï¼', |
| | | 'Sub Process (expanded)': 'åæµç¨ï¼å±å¼çï¼', |
| | | 'Start Event': 'å¼å§äºä»¶', |
| | | StartEvent: 'å¼å§äºä»¶', |
| | | 'Intermediate Throw Event': 'ä¸é´äºä»¶', |
| | | 'End Event': 'ç»æäºä»¶', |
| | | EndEvent: 'ç»æäºä»¶', |
| | | 'Create StartEvent': 'å建å¼å§äºä»¶', |
| | | 'Create EndEvent': 'åå»ºç»æäºä»¶', |
| | | 'Create Task': 'å建任å¡', |
| | | 'Create User Task': 'åå»ºç¨æ·ä»»å¡', |
| | | 'Create Gateway': 'å建ç½å
³', |
| | | 'Create DataObjectReference': 'åå»ºæ°æ®å¯¹è±¡', |
| | | 'Create DataStoreReference': 'åå»ºæ°æ®åå¨', |
| | | 'Create Group': 'å建åç»', |
| | | 'Create Intermediate/Boundary Event': 'å建ä¸é´/è¾¹çäºä»¶', |
| | | 'Message Start Event': 'æ¶æ¯å¼å§äºä»¶', |
| | | 'Timer Start Event': '宿¶å¼å§äºä»¶', |
| | | 'Conditional Start Event': 'æ¡ä»¶å¼å§äºä»¶', |
| | | 'Signal Start Event': 'ä¿¡å·å¼å§äºä»¶', |
| | | 'Error Start Event': 'é误å¼å§äºä»¶', |
| | | 'Escalation Start Event': 'å级å¼å§äºä»¶', |
| | | 'Compensation Start Event': 'è¡¥å¿å¼å§äºä»¶', |
| | | 'Message Start Event (non-interrupting)': 'æ¶æ¯å¼å§äºä»¶ï¼é䏿ï¼', |
| | | 'Timer Start Event (non-interrupting)': '宿¶å¼å§äºä»¶ï¼é䏿ï¼', |
| | | 'Conditional Start Event (non-interrupting)': 'æ¡ä»¶å¼å§äºä»¶ï¼é䏿ï¼', |
| | | 'Signal Start Event (non-interrupting)': 'ä¿¡å·å¼å§äºä»¶ï¼é䏿ï¼', |
| | | 'Escalation Start Event (non-interrupting)': 'å级å¼å§äºä»¶ï¼é䏿ï¼', |
| | | 'Message Intermediate Catch Event': 'æ¶æ¯ä¸é´æè·äºä»¶', |
| | | 'Message Intermediate Throw Event': 'æ¶æ¯ä¸é´æåºäºä»¶', |
| | | 'Timer Intermediate Catch Event': '宿¶ä¸é´æè·äºä»¶', |
| | | 'Escalation Intermediate Throw Event': 'å级ä¸é´æåºäºä»¶', |
| | | 'Conditional Intermediate Catch Event': 'æ¡ä»¶ä¸é´æè·äºä»¶', |
| | | 'Link Intermediate Catch Event': '龿¥ä¸é´æè·äºä»¶', |
| | | 'Link Intermediate Throw Event': '龿¥ä¸é´æåºäºä»¶', |
| | | 'Compensation Intermediate Throw Event': 'è¡¥å¿ä¸é´æåºäºä»¶', |
| | | 'Signal Intermediate Catch Event': 'ä¿¡å·ä¸é´æè·äºä»¶', |
| | | 'Signal Intermediate Throw Event': 'ä¿¡å·ä¸é´æåºäºä»¶', |
| | | 'Message End Event': 'æ¶æ¯ç»æäºä»¶', |
| | | 'Escalation End Event': '宿¶ç»æäºä»¶', |
| | | 'Error End Event': 'éè¯¯ç»æäºä»¶', |
| | | 'Cancel End Event': 'åæ¶ç»æäºä»¶', |
| | | 'Compensation End Event': 'è¡¥å¿ç»æäºä»¶', |
| | | 'Signal End Event': 'ä¿¡å·ç»æäºä»¶', |
| | | 'Terminate End Event': 'ç»æ¢ç»æäºä»¶', |
| | | 'Message Boundary Event': 'æ¶æ¯è¾¹çäºä»¶', |
| | | 'Message Boundary Event (non-interrupting)': 'æ¶æ¯è¾¹çäºä»¶ï¼é䏿ï¼', |
| | | 'Timer Boundary Event': '宿¶è¾¹çäºä»¶', |
| | | 'Timer Boundary Event (non-interrupting)': '宿¶è¾¹çäºä»¶ï¼é䏿ï¼', |
| | | 'Escalation Boundary Event': 'å级边çäºä»¶', |
| | | 'Escalation Boundary Event (non-interrupting)': 'å级边çäºä»¶ï¼é䏿ï¼', |
| | | 'Conditional Boundary Event': 'æ¡ä»¶è¾¹çäºä»¶', |
| | | 'Conditional Boundary Event (non-interrupting)': 'æ¡ä»¶è¾¹çäºä»¶ï¼é䏿ï¼', |
| | | 'Error Boundary Event': 'é误边çäºä»¶', |
| | | 'Cancel Boundary Event': 'åæ¶è¾¹çäºä»¶', |
| | | 'Signal Boundary Event': 'ä¿¡å·è¾¹çäºä»¶', |
| | | 'Signal Boundary Event (non-interrupting)': 'ä¿¡å·è¾¹çäºä»¶ï¼é䏿ï¼', |
| | | 'Compensation Boundary Event': 'è¡¥å¿è¾¹çäºä»¶', |
| | | 'Exclusive Gateway': 'äºæ¥ç½å
³', |
| | | 'Parallel Gateway': 'å¹¶è¡ç½å
³', |
| | | 'Inclusive Gateway': 'ç¸å®¹ç½å
³', |
| | | 'Complex Gateway': '夿ç½å
³', |
| | | 'Event based Gateway': 'äºä»¶ç½å
³', |
| | | Transaction: '转è¿', |
| | | 'Sub Process': 'åæµç¨', |
| | | 'Event Sub Process': 'äºä»¶åæµç¨', |
| | | 'Collapsed Pool': 'æå æ± ', |
| | | 'Expanded Pool': 'å±å¼æ± ', |
| | | |
| | | // Errors |
| | | 'no parent for {element} in {parent}': 'å¨{parent}éï¼{element}没æç¶ç±»', |
| | | 'no shape type specified': '没ææå®çå½¢ç¶ç±»å', |
| | | 'flow elements must be children of pools/participants': 'æµå
ç´ å¿
é¡»æ¯æ± /åä¸è
çåç±»', |
| | | 'out of bounds release': 'out of bounds release', |
| | | 'more than {count} child lanes': 'åé大äº{count} ', |
| | | 'element required': 'å
ç´ ä¸è½ä¸ºç©º', |
| | | 'diagram not part of bpmn:Definitions': 'æµç¨å¾ä¸ç¬¦åbpmnè§è', |
| | | 'no diagram to display': '没æå¯å±ç¤ºçæµç¨å¾', |
| | | 'no process or collaboration to display': '没æå¯å±ç¤ºçæµç¨/åä½', |
| | | 'element {element} referenced by {referenced}#{property} not yet drawn': 'ç±{referenced}#{property}å¼ç¨ç{element}å
ç´ ä»æªç»å¶', |
| | | 'already rendered {element}': '{element} 已被渲æ', |
| | | 'failed to import {element}': '导å
¥{element}失败', |
| | | // 屿§é¢æ¿çåæ° |
| | | Id: 'ç¼å·', |
| | | Name: 'åç§°', |
| | | General: '常è§', |
| | | Details: '详æ
', |
| | | 'Message Name': 'æ¶æ¯åç§°', |
| | | Message: 'æ¶æ¯', |
| | | Initiator: 'å建è
', |
| | | 'Asynchronous Continuations': 'æç»å¼æ¥', |
| | | 'Asynchronous Before': '弿¥å', |
| | | 'Asynchronous After': '弿¥å', |
| | | 'Job Configuration': 'å·¥ä½é
ç½®', |
| | | Exclusive: 'æé¤', |
| | | 'Job Priority': 'å·¥ä½ä¼å
级', |
| | | 'Retry Time Cycle': 'éè¯æ¶é´å¨æ', |
| | | Documentation: 'ææ¡£', |
| | | 'Element Documentation': 'å
ç´ ææ¡£', |
| | | 'History Configuration': 'åå²é
ç½®', |
| | | 'History Time To Live': 'åå²ççåæ¶é´', |
| | | Forms: '表å', |
| | | 'Form Key': '表åkey', |
| | | 'Form Fields': '表ååæ®µ', |
| | | 'Business Key': 'ä¸å¡key', |
| | | 'Form Field': '表ååæ®µ', |
| | | ID: 'ç¼å·', |
| | | Type: 'ç±»å', |
| | | Label: 'åç§°', |
| | | 'Default Value': 'é»è®¤å¼', |
| | | 'Default Flow': 'é»è®¤æµè½¬è·¯å¾', |
| | | 'Conditional Flow': 'æ¡ä»¶æµè½¬è·¯å¾', |
| | | 'Sequence Flow': 'æ®éæµè½¬è·¯å¾', |
| | | Validation: 'æ ¡éª', |
| | | 'Add Constraint': 'æ·»å 约æ', |
| | | Config: 'é
ç½®', |
| | | Properties: '屿§', |
| | | 'Add Property': 'æ·»å 屿§', |
| | | Value: 'å¼', |
| | | Listeners: 'çå¬å¨', |
| | | 'Execution Listener': 'æ§è¡çå¬', |
| | | 'Event Type': 'äºä»¶ç±»å', |
| | | 'Listener Type': 'çå¬å¨ç±»å', |
| | | 'Java Class': 'Javaç±»', |
| | | Expression: '表达å¼', |
| | | 'Must provide a value': 'å¿
é¡»æä¾ä¸ä¸ªå¼', |
| | | 'Delegate Expression': '代ç表达å¼', |
| | | Script: 'èæ¬', |
| | | 'Script Format': 'èæ¬æ ¼å¼', |
| | | 'Script Type': 'èæ¬ç±»å', |
| | | 'Inline Script': 'å
èèæ¬', |
| | | 'External Script': 'å¤é¨èæ¬', |
| | | Resource: 'èµæº', |
| | | 'Field Injection': 'åæ®µæ³¨å
¥', |
| | | Extensions: 'æ©å±', |
| | | 'Input/Output': 'è¾å
¥/è¾åº', |
| | | 'Input Parameters': 'è¾å
¥åæ°', |
| | | 'Output Parameters': 'è¾åºåæ°', |
| | | Parameters: 'åæ°', |
| | | 'Output Parameter': 'è¾åºåæ°', |
| | | 'Timer Definition Type': '宿¶å¨å®ä¹ç±»å', |
| | | 'Timer Definition': '宿¶å¨å®ä¹', |
| | | Date: 'æ¥æ', |
| | | Duration: 'æç»', |
| | | Cycle: '循ç¯', |
| | | Signal: 'ä¿¡å·', |
| | | 'Signal Name': 'ä¿¡å·åç§°', |
| | | Escalation: 'å级', |
| | | Error: 'é误', |
| | | 'Link Name': '龿¥åç§°', |
| | | Condition: 'æ¡ä»¶åç§°', |
| | | 'Variable Name': 'åéåç§°', |
| | | 'Variable Event': 'åéäºä»¶', |
| | | 'Specify more than one variable change event as a comma separated list.': 'å¤ä¸ªåéäºä»¶ä»¥éå·éå¼', |
| | | 'Wait for Completion': 'çå¾
宿', |
| | | 'Activity Ref': 'æ´»å¨åè', |
| | | 'Version Tag': 'çæ¬æ ç¾', |
| | | Executable: '坿§è¡æä»¶', |
| | | 'External Task Configuration': 'æ©å±ä»»å¡é
ç½®', |
| | | 'Task Priority': 'ä»»å¡ä¼å
级', |
| | | External: 'å¤é¨', |
| | | Connector: 'è¿æ¥å¨', |
| | | 'Must configure Connector': 'å¿
é¡»é
ç½®è¿æ¥å¨', |
| | | 'Connector Id': 'è¿æ¥å¨ç¼å·', |
| | | Implementation: 'å®ç°æ¹å¼', |
| | | 'Field Injections': 'åæ®µæ³¨å
¥', |
| | | Fields: 'åæ®µ', |
| | | 'Result Variable': 'ç»æåé', |
| | | Topic: '主é¢', |
| | | 'Configure Connector': 'é
ç½®è¿æ¥å¨', |
| | | 'Input Parameter': 'è¾å
¥åæ°', |
| | | Assignee: '代ç人', |
| | | 'Candidate Users': 'åéç¨æ·', |
| | | 'Candidate Groups': 'åéç»', |
| | | 'Due Date': 'å°ææ¶é´', |
| | | 'Follow Up Date': 'è·è¸ªæ¥æ', |
| | | Priority: 'ä¼å
级', |
| | | 'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': |
| | | 'è·è¸ªæ¥æå¿
须符åEL表达å¼ï¼å¦ï¼ ${someDate} ,æè
ä¸ä¸ªISOæ 忥æï¼å¦ï¼2015-06-26T09:54:00', |
| | | 'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': |
| | | 'è·è¸ªæ¥æå¿
须符åEL表达å¼ï¼å¦ï¼ ${someDate} ,æè
ä¸ä¸ªISOæ 忥æï¼å¦ï¼2015-06-26T09:54:00', |
| | | Variables: 'åé', |
| | | 'Candidate Starter Configuration': 'åé人起å¨å¨é
ç½®', |
| | | 'Candidate Starter Groups': 'åé人起å¨å¨ç»', |
| | | 'This maps to the process definition key.': 'è¿æ å°å°æµç¨å®ä¹é®ã', |
| | | 'Candidate Starter Users': 'åé人起å¨å¨çç¨æ·', |
| | | 'Specify more than one user as a comma separated list.': 'æå®å¤ä¸ªç¨æ·ä½ä¸ºéå·åéçå表ã', |
| | | 'Tasklist Configuration': 'Tasklisté
ç½®', |
| | | Startable: 'å¯å¨', |
| | | 'Specify more than one group as a comma separated list.': 'æå®å¤ä¸ªç»ä½ä¸ºéå·åéçå表ã' |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import MyProcessDesigner from './designer'; |
| | | import MyProcessPalette from './palette'; |
| | | import MyProcessPenal from './penal'; |
| | | |
| | | const components = [MyProcessDesigner, MyProcessPenal, MyProcessPalette]; |
| | | |
| | | const install = function(Vue) { |
| | | components.forEach(component => { |
| | | Vue.component(component.name, component); |
| | | }); |
| | | }; |
| | | |
| | | if (typeof window !== 'undefined' && window.Vue) { |
| | | install(window.Vue); |
| | | } |
| | | |
| | | export default { |
| | | version: '0.0.1', |
| | | install, |
| | | ...components |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="my-process-palette"> |
| | | <p>ç®æpalette</p> |
| | | <el-collapse> |
| | | <el-collapse-item title="ä»»å¡" name="1"> |
| | | <!-- å¯ä»¥ç®åããã --> |
| | | <div class="custom-button" @click="createElement($event, 'Task')" @mousedown="createElement($event, 'Task')"> |
| | | ä»»å¡ |
| | | </div> |
| | | <div class="custom-button" @click="createElement($event, 'UserTask')" @mousedown="createElement($event, 'UserTask')"> |
| | | ç¨æ·ä»»å¡ |
| | | </div> |
| | | <div class="custom-button" @click="createElement($event, 'SendTask')" @mousedown="createElement($event, 'SendTask')"> |
| | | åéä»»å¡ |
| | | </div> |
| | | <div class="custom-button" @click="createElement($event, 'ReceiveTask')" @mousedown="createElement($event, 'ReceiveTask')"> |
| | | æ¥æ¶ä»»å¡ |
| | | </div> |
| | | <div class="custom-button" @click="createElement($event, 'ScriptTask')" @mousedown="createElement($event, 'ScriptTask')"> |
| | | èæ¬ä»»å¡ |
| | | </div> |
| | | <div class="custom-button" @click="createElement($event, 'ServiceTask')" @mousedown="createElement($event, 'ServiceTask')"> |
| | | æå¡ä»»å¡ |
| | | </div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="ç½å
³" name="2"> |
| | | <div class="custom-button" @click="createElement($event, 'Gateway')" @mousedown="createElement($event, 'Gateway')"> |
| | | ç½å
³ |
| | | </div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="å¼å§" name="3"> |
| | | <div class="custom-button" @click="createElement($event, 'StartEvent')" @mousedown="createElement($event, 'StartEvent')"> |
| | | å¼å§ |
| | | </div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="ç»æ" name="4"> |
| | | <div class="custom-button" @click="createElement($event, 'EndEvent')" @mousedown="createElement($event, 'EndEvent')"> |
| | | ç»æ |
| | | </div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="å·¥å
·" name="5"> |
| | | <div class="custom-button" @click="startTool($event, 'handTool')" @mousedown="startTool($event, 'handTool')"> |
| | | æåå·¥å
· |
| | | </div> |
| | | <div class="custom-button" @click="startTool($event, 'lassoTool')" @mousedown="startTool($event, 'lassoTool')"> |
| | | æ¡éå·¥å
· |
| | | </div> |
| | | <div class="custom-button" @click="startTool($event, 'connectTool')" @mousedown="startTool($event, 'connectTool')"> |
| | | è¿çº¿å·¥å
· |
| | | </div> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { assign } from 'min-dash'; |
| | | |
| | | export default { |
| | | name: 'MyProcessPalette', |
| | | data() { |
| | | return {}; |
| | | }, |
| | | mounted() {}, |
| | | methods: { |
| | | createElement(event, type, options = {}) { |
| | | const ElementFactory = window.bpmnInstances.elementFactory; |
| | | const create = window.bpmnInstances.modeler.get('create'); |
| | | const shape = ElementFactory.createShape(assign({ type: `bpmn:${type}` }, options)); |
| | | if (options) { |
| | | shape.businessObject.di.isExpanded = options.isExpanded; |
| | | } |
| | | create.start(event, shape); |
| | | }, |
| | | startTool(event, type) { |
| | | if (type === 'handTool') { |
| | | window.bpmnInstances.modeler.get('handTool').activateHand(event); |
| | | } |
| | | if (type === 'lassoTool') { |
| | | window.bpmnInstances.modeler.get('lassoTool').activateSelection(event); |
| | | } |
| | | if (type === 'connectTool') { |
| | | window.bpmnInstances.modeler.get('globalConnect').toggle(event); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .my-process-palette { |
| | | box-sizing: border-box; |
| | | padding: 8px; |
| | | .custom-button { |
| | | box-sizing: border-box; |
| | | padding: 4px 8px; |
| | | border-radius: 4px; |
| | | border: 1px solid rgba(24, 144, 255, 0.8); |
| | | cursor: pointer; |
| | | margin-bottom: 8px; |
| | | &:first-child { |
| | | margin-top: 8px; |
| | | } |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import MyPropertiesPalette from './ProcessPalette.vue'; |
| | | |
| | | MyPropertiesPalette.install = function(Vue) { |
| | | Vue.component(MyPropertiesPalette.name, MyPropertiesPalette); |
| | | }; |
| | | |
| | | export default MyPropertiesPalette; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="process-panel__container" :style="{ width: `${this.width}px` }"> |
| | | <el-collapse v-model="activeTab"> |
| | | <el-collapse-item name="base"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><info-filled /></el-icon>常è§</div> |
| | | </template> |
| | | <element-base-info :id-edit-disabled="idEditDisabled" :business-object="elementBusinessObject" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="condition" v-if="elementType === 'Process'" key="message"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><comment /></el-icon>æ¶æ¯ä¸ä¿¡å·</div> |
| | | </template> |
| | | <signal-and-massage /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="condition" v-if="conditionFormVisible" key="condition"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><promotion /></el-icon>æµè½¬æ¡ä»¶</div> |
| | | </template> |
| | | <flow-condition :business-object="elementBusinessObject" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="condition" v-if="formVisible" key="form"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><list /></el-icon>表å</div> |
| | | </template> |
| | | <element-form :id="elementId" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="task" v-if="elementType.indexOf('Task') !== -1" key="task"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><checked /></el-icon>ä»»å¡</div> |
| | | </template> |
| | | <element-task :id="elementId" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="multiInstance" v-if="elementType.indexOf('Task') !== -1" key="multiInstance"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><help-filled /></el-icon>å¤å®ä¾</div> |
| | | </template> |
| | | <element-multi-instance :business-object="elementBusinessObject" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="taskListeners" v-if="elementType === 'UserTask'" key="taskListeners"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><bell-filled /></el-icon>ä»»å¡çå¬å¨</div> |
| | | </template> |
| | | <user-task-listeners :id="elementId" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="listeners" key="listeners"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><bell-filled /></el-icon>æ§è¡çå¬å¨</div> |
| | | </template> |
| | | <element-listeners :id="elementId" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="extensions" key="extensions"> |
| | | <template #title> |
| | | <div class="panel-tab__title"><el-icon><circle-plus /></el-icon>æ©å±å±æ§</div> |
| | | </template> |
| | | <element-properties :id="elementId" :type="elementType" /> |
| | | </el-collapse-item> |
| | | <el-collapse-item name="other" key="other"> |
| | | <template #title> |
| | | |
| | | <div class="panel-tab__title"><el-icon><promotion /></el-icon>å
¶ä»</div> |
| | | </template> |
| | | <element-other-config :id="elementId" /> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import ElementBaseInfo from "./base/ElementBaseInfo.vue"; |
| | | import ElementOtherConfig from "./other/ElementOtherConfig.vue"; |
| | | import ElementTask from "./task/ElementTask.vue"; |
| | | import ElementMultiInstance from "./multi-instance/ElementMultiInstance.vue"; |
| | | import FlowCondition from "./flow-condition/FlowCondition.vue"; |
| | | import SignalAndMassage from "./signal-message/SignalAndMessage.vue"; |
| | | import ElementListeners from "./listeners/ElementListeners.vue"; |
| | | import ElementProperties from "./properties/ElementProperties.vue"; |
| | | import ElementForm from "./form/ElementForm.vue"; |
| | | import UserTaskListeners from "./listeners/UserTaskListeners.vue"; |
| | | import Log from "../Log"; |
| | | /** |
| | | * ä¾§è¾¹æ |
| | | * @Author MiyueFE |
| | | import ElementProperties from "./properties/ElementProperties"; |
| | | import ElementForm from "./form/ElementForm"; |
| | | import UserTaskListeners from "./listeners/UserTaskListeners"; |
| | | import Log from "../Log"; |
| | | /** |
| | | * ä¾§è¾¹æ |
| | | * @Author MiyueFE |
| | | * @Home https://github.com/miyuesc |
| | | * @Date 2021å¹´3æ31æ¥18:57:51 |
| | | */ |
| | | export default { |
| | | name: "MyPropertiesPanel", |
| | | components: { |
| | | UserTaskListeners, |
| | | ElementForm, |
| | | ElementProperties, |
| | | ElementListeners, |
| | | SignalAndMassage, |
| | | FlowCondition, |
| | | ElementMultiInstance, |
| | | ElementTask, |
| | | ElementOtherConfig, |
| | | ElementBaseInfo |
| | | }, |
| | | componentName: "MyPropertiesPanel", |
| | | props: { |
| | | bpmnModeler: Object, |
| | | prefix: { |
| | | type: String, |
| | | default: "camunda" |
| | | }, |
| | | width: { |
| | | type: Number, |
| | | default: 480 |
| | | }, |
| | | idEditDisabled: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | provide() { |
| | | return { |
| | | prefix: this.prefix, |
| | | width: this.width |
| | | }; |
| | | }, |
| | | data() { |
| | | return { |
| | | activeTab: "base", |
| | | elementId: "", |
| | | elementType: "", |
| | | elementBusinessObject: {}, // å
ç´ businessObject éåï¼æä¾ç»éè¦å夿çç»ä»¶ä½¿ç¨ |
| | | conditionFormVisible: false, // æµè½¬æ¡ä»¶è®¾ç½® |
| | | formVisible: false // 表åé
ç½® |
| | | }; |
| | | }, |
| | | watch: { |
| | | elementId: { |
| | | handler() { |
| | | this.activeTab = "base"; |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.initModels(); |
| | | }, |
| | | methods: { |
| | | initModels() { |
| | | // åå§å modeler 以åå
¶ä» moddle |
| | | if (!this.bpmnModeler) { |
| | | // é¿å
å è½½æ¶ æµç¨å¾ å¹¶æªå è½½å®æ |
| | | this.timer = setTimeout(() => this.initModels(), 10); |
| | | return; |
| | | } |
| | | if (this.timer) clearTimeout(this.timer); |
| | | window.bpmnInstances = { |
| | | modeler: this.bpmnModeler, |
| | | modeling: this.bpmnModeler.get("modeling"), |
| | | moddle: this.bpmnModeler.get("moddle"), |
| | | eventBus: this.bpmnModeler.get("eventBus"), |
| | | bpmnFactory: this.bpmnModeler.get("bpmnFactory"), |
| | | elementFactory: this.bpmnModeler.get("elementFactory"), |
| | | elementRegistry: this.bpmnModeler.get("elementRegistry"), |
| | | replace: this.bpmnModeler.get("replace"), |
| | | selection: this.bpmnModeler.get("selection") |
| | | }; |
| | | this.getActiveElement(); |
| | | }, |
| | | getActiveElement() { |
| | | // åå§ç¬¬ä¸ä¸ªéä¸å
ç´ bpmn:Process |
| | | this.initFormOnChanged(null); |
| | | this.bpmnModeler.on("import.done", e => { |
| | | this.initFormOnChanged(null); |
| | | }); |
| | | // çå¬éæ©äºä»¶ï¼ä¿®æ¹å½åæ¿æ´»çå
ç´ ä»¥å表å |
| | | this.bpmnModeler.on("selection.changed", ({ newSelection }) => { |
| | | this.initFormOnChanged(newSelection[0] || null); |
| | | }); |
| | | this.bpmnModeler.on("element.changed", ({ element }) => { |
| | | // ä¿è¯ ä¿®æ¹ "é»è®¤æµè½¬è·¯å¾" 类似éè¦ä¿®æ¹å¤ä¸ªå
ç´ çäºä»¶åççæ¶åï¼æ´æ°è¡¨åçå
ç´ ä¸åéä¸å
ç´ ä¸ä¸è´ã |
| | | if (element && element.id === this.elementId) { |
| | | this.initFormOnChanged(element); |
| | | } |
| | | }); |
| | | }, |
| | | // åå§åæ°æ® |
| | | initFormOnChanged(element) { |
| | | let activatedElement = element; |
| | | if (!activatedElement) { |
| | | activatedElement = |
| | | window.bpmnInstances.elementRegistry.find(el => el.type === "bpmn:Process") ?? |
| | | window.bpmnInstances.elementRegistry.find(el => el.type === "bpmn:Collaboration"); |
| | | } |
| | | if (!activatedElement) return; |
| | | Log.printBack(`select element changed: id: ${activatedElement.id} , type: ${activatedElement.businessObject.$type}`); |
| | | Log.prettyInfo("businessObject", activatedElement.businessObject); |
| | | window.bpmnInstances.bpmnElement = activatedElement; |
| | | this.bpmnElement = activatedElement; |
| | | this.elementId = activatedElement.id; |
| | | this.elementType = activatedElement.type.split(":")[1] || ""; |
| | | this.elementBusinessObject = JSON.parse(JSON.stringify(activatedElement.businessObject)); |
| | | this.conditionFormVisible = !!( |
| | | this.elementType === "SequenceFlow" && |
| | | activatedElement.source && |
| | | activatedElement.source.type.indexOf("StartEvent") === -1 |
| | | ); |
| | | this.formVisible = this.elementType === "UserTask" || this.elementType === "StartEvent"; |
| | | }, |
| | | beforeUnmount() { |
| | | window.bpmnInstances = null; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-form size="small" label-width="90px" @submit.prevent> |
| | | <el-form-item label="ID"> |
| | | <el-input v-model="elementBaseInfo.id" :disabled="idEditDisabled" clearable @change="updateBaseInfo('id')" /> |
| | | </el-form-item> |
| | | <el-form-item label="åç§°"> |
| | | <el-input v-model="elementBaseInfo.name" clearable @change="updateBaseInfo('name')" /> |
| | | </el-form-item> |
| | | <!--æµç¨çåºç¡å±æ§--> |
| | | <template v-if="elementBaseInfo.$type === 'bpmn:Process'"> |
| | | <el-form-item label="çæ¬æ ç¾"> |
| | | <el-input v-model="elementBaseInfo.versionTag" clearable @change="updateBaseInfo('versionTag')" /> |
| | | </el-form-item> |
| | | <el-form-item label="坿§è¡"> |
| | | <el-switch v-model="elementBaseInfo.isExecutable" active-text="æ¯" inactive-text="å¦" @change="updateBaseInfo('isExecutable')" /> |
| | | </el-form-item> |
| | | </template> |
| | | <el-form-item v-if="elementBaseInfo.$type === 'bpmn:SubProcess'" label="ç¶æ"> |
| | | <el-switch v-model="elementBaseInfo.isExpanded" active-text="å±å¼" inactive-text="æå " @change="updateBaseInfo('isExpanded')" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | name: "ElementBaseInfo", |
| | | props: { |
| | | businessObject: Object, |
| | | type: String, |
| | | idEditDisabled: { |
| | | type: Boolean, |
| | | default: true |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | elementBaseInfo: {} |
| | | }; |
| | | }, |
| | | watch: { |
| | | businessObject: { |
| | | immediate: false, |
| | | handler: function(val) { |
| | | if (val) { |
| | | this.$nextTick(() => this.resetBaseInfo()); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | resetBaseInfo() { |
| | | this.bpmnElement = window?.bpmnInstances?.bpmnElement || {}; |
| | | this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject)); |
| | | if (this.elementBaseInfo && this.elementBaseInfo.$type === "bpmn:SubProcess") { |
| | | this.elementBaseInfo["isExpanded"] = this.elementBaseInfo.di?.isExpanded |
| | | } |
| | | }, |
| | | updateBaseInfo(key) { |
| | | if (key === "id") { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | id: this.elementBaseInfo[key], |
| | | di: { id: `${this.elementBaseInfo[key]}_di` } |
| | | }); |
| | | return; |
| | | } |
| | | if (key === "isExpanded") { |
| | | window?.bpmnInstances?.modeling.toggleCollapse(this.bpmnElement); |
| | | return; |
| | | } |
| | | const attrObj = Object.create(null); |
| | | attrObj[key] = this.elementBaseInfo[key]; |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, attrObj); |
| | | } |
| | | }, |
| | | beforeUnmount() { |
| | | this.bpmnElement = null; |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-form :model="flowConditionForm" label-width="90px" size="small" @submit.prevent> |
| | | <el-form-item label="æµè½¬ç±»å"> |
| | | <el-select v-model="flowConditionForm.type" @change="updateFlowType"> |
| | | <el-option label="æ®éæµè½¬è·¯å¾" value="normal" /> |
| | | <el-option label="é»è®¤æµè½¬è·¯å¾" value="default" /> |
| | | <el-option label="æ¡ä»¶æµè½¬è·¯å¾" value="condition" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¡ä»¶æ ¼å¼" v-if="flowConditionForm.type === 'condition'" key="condition"> |
| | | <el-select v-model="flowConditionForm.conditionType"> |
| | | <el-option label="表达å¼" value="expression" /> |
| | | <el-option label="èæ¬" value="script" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="表达å¼" v-if="flowConditionForm.conditionType && flowConditionForm.conditionType === 'expression'" key="express"> |
| | | <el-input v-model="flowConditionForm.body" clearable @change="updateFlowCondition" /> |
| | | </el-form-item> |
| | | <template v-if="flowConditionForm.conditionType && flowConditionForm.conditionType === 'script'"> |
| | | <el-form-item label="èæ¬è¯è¨" key="language"> |
| | | <el-input v-model="flowConditionForm.language" clearable @change="updateFlowCondition" /> |
| | | </el-form-item> |
| | | <el-form-item label="èæ¬ç±»å" key="scriptType"> |
| | | <el-select v-model="flowConditionForm.scriptType"> |
| | | <el-option label="å
èèæ¬" value="inlineScript" /> |
| | | <el-option label="å¤é¨èæ¬" value="externalScript" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="èæ¬" v-if="flowConditionForm.scriptType === 'inlineScript'" key="body"> |
| | | <el-input v-model="flowConditionForm.body" type="textarea" clearable @change="updateFlowCondition" /> |
| | | </el-form-item> |
| | | <el-form-item label="èµæºå°å" v-if="flowConditionForm.scriptType === 'externalScript'" key="resource"> |
| | | <el-input v-model="flowConditionForm.resource" clearable @change="updateFlowCondition" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'FlowCondition', |
| | | props: { |
| | | businessObject: Object, |
| | | type: String |
| | | }, |
| | | data() { |
| | | return { |
| | | flowConditionForm: {} |
| | | }; |
| | | }, |
| | | watch: { |
| | | businessObject: { |
| | | immediate: true, |
| | | handler() { |
| | | this.$nextTick(() => this.resetFlowCondition()); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | resetFlowCondition() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.bpmnElementSource = this.bpmnElement.source; |
| | | this.bpmnElementSourceRef = this.bpmnElement.businessObject.sourceRef; |
| | | if (this.bpmnElementSourceRef && this.bpmnElementSourceRef.default && this.bpmnElementSourceRef.default.id === this.bpmnElement.id) { |
| | | // é»è®¤ |
| | | this.flowConditionForm = { type: 'default' }; |
| | | } else if (!this.bpmnElement.businessObject.conditionExpression) { |
| | | // æ®é |
| | | this.flowConditionForm = { type: 'normal' }; |
| | | } else { |
| | | // 带æ¡ä»¶ |
| | | const conditionExpression = this.bpmnElement.businessObject.conditionExpression; |
| | | this.flowConditionForm = { ...conditionExpression, type: 'condition' }; |
| | | // resource å¯ç´æ¥æ è¯ æ¯å¦æ¯å¤é¨èµæºèæ¬ |
| | | if (this.flowConditionForm.resource) { |
| | | this.flowConditionForm['conditionType'] = 'script' |
| | | this.flowConditionForm['scriptType'] = 'externalScript' |
| | | return; |
| | | } |
| | | if (conditionExpression.language) { |
| | | this.flowConditionForm['conditionType'] = 'script' |
| | | this.flowConditionForm['scriptType'] = 'inlineScript' |
| | | return; |
| | | } |
| | | this.flowConditionForm['conditionType'] = 'expression' |
| | | } |
| | | }, |
| | | updateFlowType(flowType) { |
| | | // æ£å¸¸æ¡ä»¶ç±» |
| | | if (flowType === 'condition') { |
| | | this.flowConditionRef = window.bpmnInstances.moddle.create('bpmn:FormalExpression'); |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | conditionExpression: this.flowConditionRef |
| | | }); |
| | | return; |
| | | } |
| | | // é»è®¤è·¯å¾ |
| | | if (flowType === 'default') { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | conditionExpression: null |
| | | }); |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElementSource, { |
| | | default: this.bpmnElement |
| | | }); |
| | | return; |
| | | } |
| | | // æ£å¸¸è·¯å¾ï¼å¦ææ¥æºèç¹çé»è®¤è·¯å¾æ¯å½åè¿çº¿æ¶ï¼æ¸
é¤ç¶å
ç´ çé»è®¤è·¯å¾é
ç½® |
| | | if (this.bpmnElementSourceRef.default && this.bpmnElementSourceRef.default.id === this.bpmnElement.id) { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElementSource, { |
| | | default: null |
| | | }); |
| | | } |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | conditionExpression: null |
| | | }); |
| | | }, |
| | | updateFlowCondition() { |
| | | const { conditionType, scriptType, body, resource, language } = this.flowConditionForm; |
| | | let condition; |
| | | if (conditionType === 'expression') { |
| | | condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { body }); |
| | | } else { |
| | | if (scriptType === 'inlineScript') { |
| | | condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { body, language }); |
| | | this.flowConditionForm['resource'] = '' |
| | | } else { |
| | | this.flowConditionForm['body'] = '' |
| | | condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { resource, language }); |
| | | } |
| | | } |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { conditionExpression: condition }); |
| | | } |
| | | }, |
| | | beforeUnmount() { |
| | | this.bpmnElement = null; |
| | | this.bpmnElementSource = null; |
| | | this.bpmnElementSourceRef = null; |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-form size="small" label-width="80px" @submit.prevent> |
| | | <el-form-item label="表å" prop="formKey"> |
| | | <el-select v-model="formKey" placeholder="è¯·éæ©è¡¨å" @change="updateElementFormKey" clearable> |
| | | <el-option v-for="item in formOptions" :key="item.formId" :label="item.formName" :value="`key_${item.formId}`" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item prop="localScope"> |
| | | <template #label> |
| | | <div class="flex align-center"> |
| | | <el-tooltip content="è¥ä¸ºèç¹è¡¨åï¼å表åä¿¡æ¯ä»
卿¤èç¹å¯ç¨ï¼é»è®¤ä¸ºå
¨å±è¡¨åï¼è¡¨åä¿¡æ¯å¨æ´ä¸ªæµç¨å®ä¾ä¸å¯ç¨" placement="top-start"> |
| | | <el-icon><InfoFilled /></el-icon> |
| | | </el-tooltip> |
| | | <span>èç¹è¡¨å</span> |
| | | </div> |
| | | </template> |
| | | <el-switch |
| | | :disabled="type === 'StartEvent'" |
| | | v-model="localScope" |
| | | active-text="æ¯" |
| | | inactive-text="å¦" |
| | | @change="updateElementFormScope()" |
| | | ></el-switch> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="è¡¨åæ è¯">--> |
| | | <!-- <el-input v-model="formKey" clearable @change="updateElementFormKey" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="ä¸å¡æ è¯">--> |
| | | <!-- <el-select v-model="businessKey" @change="updateElementBusinessKey">--> |
| | | <!-- <el-option v-for="i in fieldList" :key="i.id" :value="i.id" :label="i.label" />--> |
| | | <!-- <el-option label="æ " value="" />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | </el-form> |
| | | |
| | | <!--åæ®µå表--> |
| | | <!-- <div class="element-property list-property">--> |
| | | <!-- <el-divider><el-icon><coin /></el-icon> 表ååæ®µ</el-divider>--> |
| | | <!-- <el-table :data="fieldList" size="small" max-height="240" border fit>--> |
| | | <!-- <el-table-column label="åºå·" type="index" width="50px" />--> |
| | | <!-- <el-table-column label="åæ®µåç§°" prop="label" min-width="80px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="åæ®µç±»å" prop="type" min-width="80px" :formatter="row => fieldType[row.type] || row.type" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="é»è®¤å¼" prop="defaultValue" min-width="80px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="æä½" width="90px">--> |
| | | <!-- <template v-slot="{ row, $index }">--> |
| | | <!-- <el-button link type="" @click="openFieldForm(row, $index)">ç¼è¾</el-button>--> |
| | | <!-- <el-divider direction="vertical" />--> |
| | | <!-- <el-button link type="" style="color: #ff4d4f" @click="removeField(row, $index)">ç§»é¤</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- </el-table>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="element-drawer__button">--> |
| | | <!-- <el-button size="small" type="primary" :icon="Plus" @click="openFieldForm(null, -1)">æ·»å åæ®µ</el-button>--> |
| | | <!-- </div>--> |
| | | |
| | | <!--åæ®µé
置侧边æ --> |
| | | <!-- <el-drawer v-model="fieldModelVisible" title="åæ®µé
ç½®" :size="`${width}px`" append-to-body destroy-on-close>--> |
| | | <!-- <el-form :model="formFieldForm" label-width="90px" size="small" @submit.prevent>--> |
| | | <!-- <el-form-item label="åæ®µID">--> |
| | | <!-- <el-input v-model="formFieldForm.id" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="ç±»å">--> |
| | | <!-- <el-select v-model="formFieldForm.typeType" placeholder="è¯·éæ©åæ®µç±»å" clearable @change="changeFieldTypeType">--> |
| | | <!-- <el-option v-for="(value, key) of fieldType" :key="key" :label="value" :value="key" />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item v-if="formFieldForm.typeType === 'custom'" label="ç±»ååç§°">--> |
| | | <!-- <el-input v-model="formFieldForm.type" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="åç§°">--> |
| | | <!-- <el-input v-model="formFieldForm.label" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item v-if="formFieldForm.typeType === 'date'" label="æ¶é´æ ¼å¼">--> |
| | | <!-- <el-input v-model="formFieldForm.datePattern" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="é»è®¤å¼">--> |
| | | <!-- <el-input v-model="formFieldForm.defaultValue" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-form>--> |
| | | |
| | | <!-- æä¸¾å¼è®¾ç½® --> |
| | | <!-- <template v-if="formFieldForm.type === 'enum'">--> |
| | | <!-- <el-divider key="enum-divider" />--> |
| | | <!-- <p key="enum-title" class="listener-filed__title">--> |
| | | <!-- <span>--> |
| | | <!-- <el-icon>--> |
| | | <!-- <menu />--> |
| | | <!-- </el-icon>--> |
| | | <!-- æä¸¾å¼å表ï¼--> |
| | | <!-- </span>--> |
| | | <!-- <el-button size="small" type="primary" @click="openFieldOptionForm(null, -1, 'enum')">æ·»å æä¸¾å¼</el-button>--> |
| | | <!-- </p>--> |
| | | <!-- <el-table key="enum-table" :data="fieldEnumList" size="small" max-height="240" border fit>--> |
| | | <!-- <el-table-column label="åºå·" width="50px" type="index" />--> |
| | | <!-- <el-table-column label="æä¸¾å¼ç¼å·" prop="id" min-width="100px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="æä¸¾å¼åç§°" prop="name" min-width="100px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="æä½" width="90px">--> |
| | | <!-- <template v-slot="{ row, $index }">--> |
| | | <!-- <el-button link type="" @click="openFieldOptionForm(row, $index, 'enum')">ç¼è¾</el-button>--> |
| | | <!-- <el-divider direction="vertical" />--> |
| | | <!-- <el-button link type="" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'enum')">ç§»é¤</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- </el-table>--> |
| | | <!-- </template>--> |
| | | |
| | | <!-- æ ¡éªè§å --> |
| | | <!-- <el-divider key="validation-divider" />--> |
| | | <!-- <p key="validation-title" class="listener-filed__title">--> |
| | | <!-- <span><el-icon><menu /></el-icon>çº¦ææ¡ä»¶å表ï¼</span>--> |
| | | <!-- <el-button size="small" type="primary" @click="openFieldOptionForm(null, -1, 'constraint')">æ·»å 约æ</el-button>--> |
| | | <!-- </p>--> |
| | | <!-- <el-table key="validation-table" :data="fieldConstraintsList" size="small" max-height="240" border fit>--> |
| | | <!-- <el-table-column label="åºå·" width="50px" type="index" />--> |
| | | <!-- <el-table-column label="约æåç§°" prop="name" min-width="100px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="约æé
ç½®" prop="config" min-width="100px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="æä½" width="90px">--> |
| | | <!-- <template v-slot="{ row, $index }">--> |
| | | <!-- <el-button link type="" @click="openFieldOptionForm(row, $index, 'constraint')">ç¼è¾</el-button>--> |
| | | <!-- <el-divider direction="vertical" />--> |
| | | <!-- <el-button link type="" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'constraint')">ç§»é¤</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- </el-table>--> |
| | | |
| | | <!-- 表å屿§ --> |
| | | <!-- <el-divider key="property-divider" />--> |
| | | <!-- <p key="property-title" class="listener-filed__title">--> |
| | | <!-- <span><el-icon><menu /></el-icon>åæ®µå±æ§å表ï¼</span>--> |
| | | <!-- <el-button size="small" type="primary" @click="openFieldOptionForm(null, -1, 'property')">æ·»å 屿§</el-button>--> |
| | | <!-- </p>--> |
| | | <!-- <el-table key="property-table" :data="fieldPropertiesList" size="small" max-height="240" border fit>--> |
| | | <!-- <el-table-column label="åºå·" width="50px" type="index" />--> |
| | | <!-- <el-table-column label="屿§ç¼å·" prop="id" min-width="100px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="屿§å¼" prop="value" min-width="100px" show-overflow-tooltip />--> |
| | | <!-- <el-table-column label="æä½" width="90px">--> |
| | | <!-- <template v-slot="{ row, $index }">--> |
| | | <!-- <el-button link type="" @click="openFieldOptionForm(row, $index, 'property')">ç¼è¾</el-button>--> |
| | | <!-- <el-divider direction="vertical" />--> |
| | | <!-- <el-button link type="" style="color: #ff4d4f" @click="removeFieldOptionItem(row, $index, 'property')">ç§»é¤</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- </el-table>--> |
| | | |
| | | <!-- åºé¨æé® --> |
| | | <!-- <div class="element-drawer__button">--> |
| | | <!-- <el-button size="small">å æ¶</el-button>--> |
| | | <!-- <el-button size="small" type="primary" @click="saveField">ä¿ å</el-button>--> |
| | | <!-- </div>--> |
| | | <!-- </el-drawer>--> |
| | | |
| | | <el-dialog v-model="fieldOptionModelVisible" :title="optionModelTitle" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="fieldOptionForm" size="small" label-width="96px" @submit.prevent> |
| | | <el-form-item v-if="fieldOptionType !== 'constraint'" key="option-id" label="ç¼å·/ID"> |
| | | <el-input v-model="fieldOptionForm.id" clearable /> |
| | | </el-form-item> |
| | | <el-form-item v-if="fieldOptionType !== 'property'" key="option-name" label="åç§°"> |
| | | <el-input v-model="fieldOptionForm.name" clearable /> |
| | | </el-form-item> |
| | | <el-form-item v-if="fieldOptionType === 'constraint'" key="option-config" label="é
ç½®"> |
| | | <el-input v-model="fieldOptionForm.config" clearable /> |
| | | </el-form-item> |
| | | <el-form-item v-if="fieldOptionType === 'property'" key="option-value" label="å¼"> |
| | | <el-input v-model="fieldOptionForm.value" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button size="small" @click="fieldOptionModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveFieldOption">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listForm } from "#/api/workflow/form"; |
| | | |
| | | export default { |
| | | name: 'ElementForm', |
| | | setup() { |
| | | return { |
| | | Plus |
| | | } |
| | | }, |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | inject: { |
| | | prefix: 'prefix', |
| | | width: 'width' |
| | | }, |
| | | data() { |
| | | return { |
| | | formKey: '', |
| | | formOptions: [], |
| | | localScope: false, |
| | | businessKey: '', |
| | | optionModelTitle: '', |
| | | fieldList: [], |
| | | formFieldForm: {}, |
| | | fieldType: { |
| | | long: 'é¿æ´å', |
| | | string: 'å符串', |
| | | boolean: 'å¸å°ç±»', |
| | | date: 'æ¥æç±»', |
| | | enum: 'æä¸¾ç±»', |
| | | custom: 'èªå®ä¹ç±»å' |
| | | }, |
| | | formFieldIndex: -1, // ç¼è¾ä¸çåæ®µï¼ -1 为æ°å¢ |
| | | formFieldOptionIndex: -1, // ç¼è¾ä¸çåæ®µé
ç½®é¡¹ï¼ -1 为æ°å¢ |
| | | fieldModelVisible: false, |
| | | fieldOptionModelVisible: false, |
| | | fieldOptionForm: {}, // å½åæ¿æ´»çåæ®µé
ç½®é¡¹æ°æ® |
| | | fieldOptionType: '', // å½åæ¿æ´»çåæ®µé
ç½®é¡¹å¼¹çª ç±»å |
| | | fieldEnumList: [], // æä¸¾å¼å表 |
| | | fieldConstraintsList: [], // çº¦ææ¡ä»¶å表 |
| | | fieldPropertiesList: [] // ç»å®å±æ§å表 |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler(val) { |
| | | val && val.length && this.$nextTick(() => this.resetFormList()); |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | this.getFormList(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢è¡¨åå表 */ |
| | | getFormList() { |
| | | listForm().then(response => { |
| | | this.formOptions = response.rows; |
| | | } |
| | | ) |
| | | }, |
| | | resetFormList() { |
| | | this.bpmnELement = window.bpmnInstances.bpmnElement; |
| | | this.formKey = this.bpmnELement.businessObject.formKey; |
| | | this.localScope = this.bpmnELement.businessObject.localScope; |
| | | // è·åå
ç´ æ©å±å±æ§ æè
å建æ©å±å±æ§ |
| | | this.elExtensionElements = |
| | | this.bpmnELement.businessObject.get('extensionElements') || window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { values: [] }); |
| | | // è·åå
ç´ è¡¨åé
ç½® æè
å建æ°ç表åé
ç½® |
| | | // try { |
| | | // this.formData = |
| | | // this.elExtensionElements.values.filter(ex => ex.$type === `${this.prefix}:FormData`)[0] || |
| | | // window.bpmnInstances.moddle.create(`${this.prefix}:FormData`, { fields: [] }); |
| | | // } catch (error) { |
| | | // this.formData = {} |
| | | // console.log(error) |
| | | // } |
| | | |
| | | // ä¸å¡æ è¯ businessKeyï¼ ç»å®å¨ formData ä¸ |
| | | // this.businessKey = this.formData.businessKey; |
| | | |
| | | // ä¿çå©ä½æ©å±å
ç´ ï¼ä¾¿äºå颿´æ°è¯¥å
ç´ å¯¹åºå±æ§ |
| | | this.otherExtensions = this.elExtensionElements.values.filter(ex => ex.$type !== `${this.prefix}:FormData`); |
| | | |
| | | // å¤å¶åå§å¼ï¼å¡«å
è¡¨æ ¼ |
| | | // this.fieldList = JSON.parse(JSON.stringify(this.formData.fields || [])); |
| | | |
| | | // æ´æ°å
ç´ æ©å±å±æ§ï¼é¿å
åç»æ¥é |
| | | // this.updateElementExtensions(); |
| | | }, |
| | | updateElementFormKey() { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnELement, { formKey: this.formKey }); |
| | | }, |
| | | updateElementFormScope() { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnELement, { localScope: this.localScope }); |
| | | }, |
| | | updateElementBusinessKey() { |
| | | window.bpmnInstances.modeling.updateModdleProperties(this.bpmnELement, this.formData, { businessKey: this.businessKey }); |
| | | }, |
| | | // æ ¹æ®ç±»åè°æ´å段type |
| | | changeFieldTypeType(type) { |
| | | this.formFieldForm['type'] = type === 'custom' ? '' : type |
| | | }, |
| | | |
| | | // æå¼å段详æ
ä¾§è¾¹æ |
| | | openFieldForm(field, index) { |
| | | this.formFieldIndex = index; |
| | | if (index !== -1) { |
| | | const FieldObject = this.formData.fields[index]; |
| | | this.formFieldForm = JSON.parse(JSON.stringify(field)); |
| | | // 设置èªå®ä¹ç±»å |
| | | this.formFieldForm['typeType'] = !this.fieldType[field.type] ? 'custom' : field.type |
| | | // åå§åæä¸¾å¼å表 |
| | | field.type === 'enum' && (this.fieldEnumList = JSON.parse(JSON.stringify(FieldObject?.values || []))); |
| | | // åå§åçº¦ææ¡ä»¶å表 |
| | | this.fieldConstraintsList = JSON.parse(JSON.stringify(FieldObject?.validation?.constraints || [])); |
| | | // åå§åèªå®ä¹å±æ§å表 |
| | | this.fieldPropertiesList = JSON.parse(JSON.stringify(FieldObject?.properties?.values || [])); |
| | | } else { |
| | | this.formFieldForm = {}; |
| | | // åå§åæä¸¾å¼å表 |
| | | this.fieldEnumList = []; |
| | | // åå§åçº¦ææ¡ä»¶å表 |
| | | this.fieldConstraintsList = []; |
| | | // åå§åèªå®ä¹å±æ§å表 |
| | | this.fieldPropertiesList = []; |
| | | } |
| | | this.fieldModelVisible = true; |
| | | }, |
| | | // æå¼å段 æä¸ª é
置项 å¼¹çª |
| | | openFieldOptionForm(option, index, type) { |
| | | this.fieldOptionModelVisible = true; |
| | | this.fieldOptionType = type; |
| | | this.formFieldOptionIndex = index; |
| | | if (type === 'property') { |
| | | this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {}; |
| | | return (this.optionModelTitle = '屿§é
ç½®'); |
| | | } |
| | | if (type === 'enum') { |
| | | this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {}; |
| | | return (this.optionModelTitle = 'æä¸¾å¼é
ç½®'); |
| | | } |
| | | this.fieldOptionForm = option ? JSON.parse(JSON.stringify(option)) : {}; |
| | | return (this.optionModelTitle = 'çº¦ææ¡ä»¶é
ç½®'); |
| | | }, |
| | | |
| | | // ä¿ååæ®µ æä¸ª é
置项 |
| | | saveFieldOption() { |
| | | if (this.formFieldOptionIndex === -1) { |
| | | if (this.fieldOptionType === 'property') { |
| | | this.fieldPropertiesList.push(this.fieldOptionForm); |
| | | } |
| | | if (this.fieldOptionType === 'constraint') { |
| | | this.fieldConstraintsList.push(this.fieldOptionForm); |
| | | } |
| | | if (this.fieldOptionType === 'enum') { |
| | | this.fieldEnumList.push(this.fieldOptionForm); |
| | | } |
| | | } else { |
| | | this.fieldOptionType === 'property' && this.fieldPropertiesList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm); |
| | | this.fieldOptionType === 'constraint' && this.fieldConstraintsList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm); |
| | | this.fieldOptionType === 'enum' && this.fieldEnumList.splice(this.formFieldOptionIndex, 1, this.fieldOptionForm); |
| | | } |
| | | this.fieldOptionModelVisible = false; |
| | | this.fieldOptionForm = {}; |
| | | }, |
| | | // ä¿ååæ®µé
ç½® |
| | | saveField() { |
| | | const { id, type, label, defaultValue, datePattern } = this.formFieldForm; |
| | | const Field = window.bpmnInstances.moddle.create(`${this.prefix}:FormField`, { id, type, label }); |
| | | defaultValue && (Field.defaultValue = defaultValue); |
| | | datePattern && (Field.datePattern = datePattern); |
| | | // æå»ºå±æ§ |
| | | if (this.fieldPropertiesList && this.fieldPropertiesList.length) { |
| | | const fieldPropertyList = this.fieldPropertiesList.map(fp => { |
| | | return window.bpmnInstances.moddle.create(`${this.prefix}:Property`, { id: fp.id, value: fp.value }); |
| | | }); |
| | | Field.properties = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, { values: fieldPropertyList }); |
| | | } |
| | | // æå»ºæ ¡éªè§å |
| | | if (this.fieldConstraintsList && this.fieldConstraintsList.length) { |
| | | const fieldConstraintList = this.fieldConstraintsList.map(fc => { |
| | | return window.bpmnInstances.moddle.create(`${this.prefix}:Constraint`, { name: fc.name, config: fc.config }); |
| | | }); |
| | | Field.validation = window.bpmnInstances.moddle.create(`${this.prefix}:Validation`, { constraints: fieldConstraintList }); |
| | | } |
| | | // æå»ºæä¸¾å¼ |
| | | if (this.fieldEnumList && this.fieldEnumList.length) { |
| | | Field.values = this.fieldEnumList.map(fe => { |
| | | return window.bpmnInstances.moddle.create(`${this.prefix}:Value`, { name: fe.name, id: fe.id }); |
| | | }); |
| | | } |
| | | // æ´æ°æ°ç» ä¸ è¡¨åé
ç½®å®ä¾ |
| | | if (this.formFieldIndex === -1) { |
| | | this.fieldList.push(this.formFieldForm); |
| | | this.formData.fields && this.formData.fields.push(Field); |
| | | } else { |
| | | this.fieldList.splice(this.formFieldIndex, 1, this.formFieldForm); |
| | | this.formData.fields.splice(this.formFieldIndex, 1, Field); |
| | | } |
| | | this.updateElementExtensions(); |
| | | this.fieldModelVisible = false; |
| | | }, |
| | | |
| | | // ç§»é¤æä¸ª åæ®µç é
置项 |
| | | removeFieldOptionItem(option, index, type) { |
| | | if (type === 'property') { |
| | | this.fieldPropertiesList.splice(index, 1); |
| | | return; |
| | | } |
| | | if (type === 'enum') { |
| | | this.fieldEnumList.splice(index, 1); |
| | | return; |
| | | } |
| | | this.fieldConstraintsList.splice(index, 1); |
| | | }, |
| | | // ç§»é¤ åæ®µ |
| | | removeField(field, index) { |
| | | this.fieldList.splice(index, 1); |
| | | this.formData.fields.splice(index, 1); |
| | | this.updateElementExtensions(); |
| | | }, |
| | | |
| | | updateElementExtensions() { |
| | | // æ´æ°åæ©å±å
ç´ |
| | | const newElExtensionElements = window.bpmnInstances.moddle.create(`bpmn:ExtensionElements`, { |
| | | values: this.otherExtensions.concat(this.formData) |
| | | }); |
| | | // æ´æ°å°å
ç´ ä¸ |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnELement, { |
| | | extensionElements: newElExtensionElements |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import MyPropertiesPanel from './PropertiesPanel.vue'; |
| | | |
| | | MyPropertiesPanel.install = function(Vue) { |
| | | Vue.component(MyPropertiesPanel.name, MyPropertiesPanel); |
| | | }; |
| | | |
| | | export default MyPropertiesPanel; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-table :data="elementListenersList" size="small" border> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="äºä»¶ç±»å" min-width="100px" prop="event" /> |
| | | <el-table-column label="çå¬å¨ç±»å" min-width="100px" show-overflow-tooltip :formatter="row => listenerTypeObject[row.listenerType]" /> |
| | | <el-table-column label="æä½" width="90px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="" @click="openListenerForm(row, $index)">ç¼è¾</el-button> |
| | | <el-divider direction="vertical" /> |
| | | <el-button link type="" style="color: #ff4d4f" @click="removeListener(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" type="primary" :icon="Plus" @click="openListenerForm(null)">æ·»å çå¬å¨</el-button> |
| | | </div> |
| | | |
| | | <!-- çå¬å¨ ç¼è¾/å建 é¨å --> |
| | | <el-drawer v-model="listenerFormModelVisible" title="æ§è¡çå¬å¨" :size="`${width}px`" append-to-body destroy-on-close> |
| | | <el-form size="small" :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.prevent> |
| | | <el-form-item label="äºä»¶ç±»å" prop="event" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-select v-model="listenerForm.event"> |
| | | <el-option label="start" value="start" /> |
| | | <el-option label="end" value="end" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="çå¬å¨ç±»å" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-select v-model="listenerForm.listenerType"> |
| | | <el-option v-for="i in Object.keys(listenerTypeObject)" :key="i" :label="listenerTypeObject[i]" :value="i" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.listenerType === 'classListener'" |
| | | label="Javaç±»" |
| | | prop="class" |
| | | key="listener-class" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerForm.class" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.listenerType === 'expressionListener'" |
| | | label="表达å¼" |
| | | prop="expression" |
| | | key="listener-expression" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerForm.expression" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.listenerType === 'delegateExpressionListener'" |
| | | label="代ç表达å¼" |
| | | prop="delegateExpression" |
| | | key="listener-delegate" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerForm.delegateExpression" clearable /> |
| | | </el-form-item> |
| | | <template v-if="listenerForm.listenerType === 'scriptListener'"> |
| | | <el-form-item |
| | | label="èæ¬æ ¼å¼" |
| | | prop="scriptFormat" |
| | | key="listener-script-format" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬æ ¼å¼' }" |
| | | > |
| | | <el-input v-model="listenerForm.scriptFormat" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="èæ¬ç±»å" |
| | | prop="scriptType" |
| | | key="listener-script-type" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©èæ¬ç±»å' }" |
| | | > |
| | | <el-select v-model="listenerForm.scriptType"> |
| | | <el-option label="å
èèæ¬" value="inlineScript" /> |
| | | <el-option label="å¤é¨èæ¬" value="externalScript" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.scriptType === 'inlineScript'" |
| | | label="èæ¬å
容" |
| | | prop="value" |
| | | key="listener-script" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬å
容' }" |
| | | > |
| | | <el-input v-model="listenerForm.value" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.scriptType === 'externalScript'" |
| | | label="èµæºå°å" |
| | | prop="resource" |
| | | key="listener-resource" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèµæºå°å' }" |
| | | > |
| | | <el-input v-model="listenerForm.resource" clearable /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | | <el-divider /> |
| | | <p class="listener-filed__title"> |
| | | <span><el-icon><Menu /></el-icon>注å
¥å段ï¼</span> |
| | | <el-button size="small" type="primary" @click="openListenerFieldForm(null)">æ·»å åæ®µ</el-button> |
| | | </p> |
| | | <el-table :data="fieldsListOfListener" size="small" max-height="240" border fit style="flex: none"> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="åæ®µåç§°" min-width="100px" prop="name" /> |
| | | <el-table-column label="åæ®µç±»å" min-width="80px" show-overflow-tooltip :formatter="row => fieldTypeObject[row.fieldType]" /> |
| | | <el-table-column label="åæ®µå¼/表达å¼" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" /> |
| | | <el-table-column label="æä½" width="100px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="" @click="openListenerFieldForm(row, $index)">ç¼è¾</el-button> |
| | | <el-divider direction="vertical" /> |
| | | <el-button link type="" style="color: #ff4d4f" @click="removeListenerField(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" @click="listenerFormModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveListenerConfig">ä¿ å</el-button> |
| | | </div> |
| | | </el-drawer> |
| | | |
| | | <!-- 注å
¥è¥¿æ®µ ç¼è¾/å建 é¨å --> |
| | | <el-dialog title="åæ®µé
ç½®" v-model="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="listenerFieldForm" size="small" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.prevent> |
| | | <el-form-item label="åæ®µåç§°ï¼" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-input v-model="listenerFieldForm.name" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ®µç±»åï¼" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-select v-model="listenerFieldForm.fieldType"> |
| | | <el-option v-for="i in Object.keys(fieldTypeObject)" :key="i" :label="fieldTypeObject[i]" :value="i" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === 'string'" |
| | | label="åæ®µå¼ï¼" |
| | | prop="string" |
| | | key="field-string" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.string" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === 'expression'" |
| | | label="表达å¼ï¼" |
| | | prop="expression" |
| | | key="field-expression" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.expression" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button size="small" @click="listenerFieldFormModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveListenerFiled">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { createListenerObject, updateElementExtensions } from "../../utils"; |
| | | import { initListenerType, initListenerForm, LISTENER_TYPE, FIELD_TYPE } from "./utilSelf"; |
| | | |
| | | export default { |
| | | name: "ElementListeners", |
| | | setup() { |
| | | return { Plus } |
| | | }, |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | inject: { |
| | | prefix: "prefix", |
| | | width: "width" |
| | | }, |
| | | data() { |
| | | return { |
| | | elementListenersList: [], // çå¬å¨å表 |
| | | listenerForm: {}, // çå¬å¨è¯¦æ
表å |
| | | listenerFormModelVisible: false, // çå¬å¨ ç¼è¾ ä¾§è¾¹æ æ¾ç¤ºç¶æ |
| | | fieldsListOfListener: [], |
| | | listenerFieldForm: {}, // çå¬å¨ 注å
¥å段 详æ
表å |
| | | listenerFieldFormModelVisible: false, // çå¬å¨ 注å
¥å段表åå¼¹çª æ¾ç¤ºç¶æ |
| | | editingListenerIndex: -1, // çå¬å¨æå¨ä¸æ ï¼-1 为æ°å¢ |
| | | editingListenerFieldIndex: -1, // åæ®µæå¨ä¸æ ï¼-1 为æ°å¢ |
| | | listenerTypeObject: LISTENER_TYPE, |
| | | fieldTypeObject: FIELD_TYPE |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler(val) { |
| | | val && val.length && this.$nextTick(() => this.resetListenersList()); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | resetListenersList() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.otherExtensionList = []; |
| | | this.bpmnElementListeners = |
| | | this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type === `${this.prefix}:ExecutionListener`) ?? []; |
| | | this.elementListenersList = this.bpmnElementListeners.map(listener => initListenerType(listener)); |
| | | }, |
| | | // æå¼ çå¬å¨è¯¦æ
ä¾§è¾¹æ |
| | | openListenerForm(listener, index) { |
| | | if (listener) { |
| | | this.listenerForm = initListenerForm(listener); |
| | | this.editingListenerIndex = index; |
| | | } else { |
| | | this.listenerForm = {}; |
| | | this.editingListenerIndex = -1; // æ 记为æ°å¢ |
| | | } |
| | | if (listener && listener.fields) { |
| | | this.fieldsListOfListener = listener.fields.map(field => ({ |
| | | ...field, |
| | | fieldType: field.string ? "string" : "expression" |
| | | })); |
| | | } else { |
| | | this.fieldsListOfListener = []; |
| | | this.listenerForm["fields"] = [] |
| | | } |
| | | // æå¼ä¾§è¾¹æ å¹¶æ¸
æ¥éªè¯ç¶æ |
| | | this.listenerFormModelVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs["listenerFormRef"]) this.$refs["listenerFormRef"].clearValidate(); |
| | | }); |
| | | }, |
| | | // æå¼çå¬å¨å段ç¼è¾å¼¹çª |
| | | openListenerFieldForm(field, index) { |
| | | this.listenerFieldForm = field ? JSON.parse(JSON.stringify(field)) : {}; |
| | | this.editingListenerFieldIndex = field ? index : -1; |
| | | this.listenerFieldFormModelVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs["listenerFieldFormRef"]) this.$refs["listenerFieldFormRef"].clearValidate(); |
| | | }); |
| | | }, |
| | | // ä¿åçå¬å¨æ³¨å
¥å段 |
| | | async saveListenerFiled() { |
| | | let validateStatus = await this.$refs["listenerFieldFormRef"].validate(); |
| | | if (!validateStatus) return; // éªè¯ä¸éè¿ç´æ¥è¿å |
| | | if (this.editingListenerFieldIndex === -1) { |
| | | this.fieldsListOfListener.push(this.listenerFieldForm); |
| | | this.listenerForm.fields.push(this.listenerFieldForm); |
| | | } else { |
| | | this.fieldsListOfListener.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm); |
| | | this.listenerForm.fields.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm); |
| | | } |
| | | this.listenerFieldFormModelVisible = false; |
| | | this.$nextTick(() => (this.listenerFieldForm = {})); |
| | | }, |
| | | // ç§»é¤çå¬å¨å段 |
| | | removeListenerField(field, index) { |
| | | this.$confirm("确认移é¤è¯¥å段åï¼", "æç¤º", { |
| | | confirmButtonText: "确 认", |
| | | cancelButtonText: "å æ¶" |
| | | }) |
| | | .then(() => { |
| | | this.fieldsListOfListener.splice(index, 1); |
| | | this.listenerForm.fields.splice(index, 1); |
| | | }) |
| | | .catch(() => console.info("æä½åæ¶")); |
| | | }, |
| | | // ç§»é¤çå¬å¨ |
| | | removeListener(listener, index) { |
| | | this.$confirm("确认移é¤è¯¥çå¬å¨åï¼", "æç¤º", { |
| | | confirmButtonText: "确 认", |
| | | cancelButtonText: "å æ¶" |
| | | }) |
| | | .then(() => { |
| | | this.bpmnElementListeners.splice(index, 1); |
| | | this.elementListenersList.splice(index, 1); |
| | | updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners)); |
| | | }) |
| | | .catch(() => console.info("æä½åæ¶")); |
| | | }, |
| | | // ä¿åçå¬å¨é
ç½® |
| | | async saveListenerConfig() { |
| | | let validateStatus = await this.$refs["listenerFormRef"].validate(); |
| | | if (!validateStatus) return; // éªè¯ä¸éè¿ç´æ¥è¿å |
| | | const listenerObject = createListenerObject(this.listenerForm, false, this.prefix); |
| | | if (this.editingListenerIndex === -1) { |
| | | this.bpmnElementListeners.push(listenerObject); |
| | | this.elementListenersList.push(this.listenerForm); |
| | | } else { |
| | | this.bpmnElementListeners.splice(this.editingListenerIndex, 1, listenerObject); |
| | | this.elementListenersList.splice(this.editingListenerIndex, 1, this.listenerForm); |
| | | } |
| | | // ä¿åå
¶ä»é
ç½® |
| | | this.otherExtensionList = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type !== `${this.prefix}:ExecutionListener`) ?? []; |
| | | updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners)); |
| | | // 4. éèä¾§è¾¹æ |
| | | this.listenerFormModelVisible = false; |
| | | this.listenerForm = {}; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-table :data="elementListenersList" size="small" border> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="äºä»¶ç±»å" min-width="80px" show-overflow-tooltip :formatter="formatterEvent" /> |
| | | <!-- <el-table-column label="äºä»¶id" min-width="80px" prop="id" show-overflow-tooltip />--> |
| | | <el-table-column label="çå¬å¨ç±»å" min-width="80px" show-overflow-tooltip :formatter="formatterListener" /> |
| | | <el-table-column label="æä½" width="90px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="primary" @click="openListenerForm(row, $index)">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="removeListener(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" type="primary" :icon="Plus" @click="openListenerForm(null)">æ·»å çå¬å¨</el-button> |
| | | </div> |
| | | |
| | | <!-- çå¬å¨ ç¼è¾/å建 é¨å --> |
| | | <el-drawer |
| | | v-model="listenerFormModelVisible" |
| | | title="ä»»å¡çå¬å¨" |
| | | :size="`${width}px`" |
| | | class="listener-drawer" |
| | | append-to-body |
| | | destroy-on-close> |
| | | <el-form :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.prevent> |
| | | <el-form-item label="äºä»¶ç±»å" prop="event" :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©äºä»¶ç±»å' }"> |
| | | <el-select v-model="listenerForm.event" style="width: 100%"> |
| | | <el-option v-for="item in TASK_EVENT_TYPE" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="çå¬å¨ç±»å" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©çå¬å¨ç±»å' }"> |
| | | <el-input |
| | | v-model="listenerForm[selectedProp]" |
| | | clearable |
| | | class="input-with-select"> |
| | | <template #prepend> |
| | | <el-select v-model="listenerForm.listenerType" style="width: 100%"> |
| | | <el-option v-for="item in LISTENER_TYPE" :key="item.key" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </template> |
| | | <template #append> |
| | | <el-button :icon="Search" /> |
| | | </template> |
| | | </el-input> |
| | | |
| | | </el-form-item> |
| | | <!-- èæ¬ç±»å --> |
| | | <!-- <template v-if="listenerForm.listenerType === LISTENER_TYPE[LISTENER_TYPE.length - 1].value">--> |
| | | <!-- <el-form-item--> |
| | | <!-- label="èæ¬æ ¼å¼"--> |
| | | <!-- prop="scriptFormat"--> |
| | | <!-- key="listener-script-format"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬æ ¼å¼' }"--> |
| | | <!-- >--> |
| | | <!-- <el-input v-model="listenerForm.scriptFormat" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item--> |
| | | <!-- label="èæ¬ç±»å"--> |
| | | <!-- prop="scriptType"--> |
| | | <!-- key="listener-script-type"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©èæ¬ç±»å' }"--> |
| | | <!-- >--> |
| | | <!-- <el-select v-model="listenerForm.scriptType">--> |
| | | <!-- <el-option v-for="item in SCRIPT_TYPE" :key="item.value" :label="item.label" :value="item.value" />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item--> |
| | | <!-- v-if="listenerForm.scriptType === SCRIPT_TYPE[0].value"--> |
| | | <!-- label="èæ¬å
容"--> |
| | | <!-- prop="value"--> |
| | | <!-- key="listener-script"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬å
容' }"--> |
| | | <!-- >--> |
| | | <!-- <el-input v-model="listenerForm.value" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item--> |
| | | <!-- v-if="listenerForm.scriptType === SCRIPT_TYPE[1].value"--> |
| | | <!-- label="èµæºå°å"--> |
| | | <!-- prop="resource"--> |
| | | <!-- key="listener-resource"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèµæºå°å' }"--> |
| | | <!-- >--> |
| | | <!-- <el-input v-model="listenerForm.resource" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </template>--> |
| | | <!-- çå¬äºä»¶ï¼ è¶
æ¶ --> |
| | | <template v-if="listenerForm.event === TASK_EVENT_TYPE[TASK_EVENT_TYPE.length - 1].value"> |
| | | <el-form-item label="宿¶å¨ç±»å" prop="eventDefinitionType" key="eventDefinitionType"> |
| | | <el-select v-model="listenerForm.eventDefinitionType"> |
| | | <el-option v-for="item in EVENT_DEFINITION_TYPE" :key="item.value" :value="item.value" :label="item.label" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="!!listenerForm.eventDefinitionType && listenerForm.eventDefinitionType !== 'null'" |
| | | label="宿¶å¨" |
| | | prop="eventTimeDefinitions" |
| | | key="eventTimeDefinitions" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填å宿¶å¨é
ç½®' }" |
| | | > |
| | | <el-input v-model="listenerForm.eventTimeDefinitions" clearable /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | | <el-divider /> |
| | | <div class="listener-filed__title"> |
| | | <span><el-icon><Menu /></el-icon>注å
¥å段ï¼</span> |
| | | <el-button size="small" type="primary" @click="openListenerFieldForm(null)">æ·»å åæ®µ</el-button> |
| | | </div> |
| | | <el-table :data="fieldsListOfListener" size="small" max-height="240" border fit style="flex: none"> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="åæ®µåç§°" min-width="100px" prop="name" /> |
| | | <el-table-column label="åæ®µç±»å" min-width="80px" show-overflow-tooltip :formatter="formatterField" /> |
| | | <el-table-column label="åæ®µå¼/表达å¼" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" /> |
| | | <el-table-column label="æä½" width="100px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="primary" @click="openListenerFieldForm(row, $index)">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="removeListenerField(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div class="element-drawer__button"> |
| | | <el-button @click="listenerFormModelVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="saveListenerConfig">ä¿ å</el-button> |
| | | </div> |
| | | </el-drawer> |
| | | |
| | | <!-- 注å
¥è¥¿æ®µ ç¼è¾/å建 é¨å --> |
| | | <el-dialog title="åæ®µé
ç½®" v-model="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="listenerFieldForm" size="small" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.prevent> |
| | | <el-form-item label="åæ®µåç§°ï¼" prop="name" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填ååæ®µåç§°' }"> |
| | | <el-input v-model="listenerFieldForm.name" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ®µç±»åï¼" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©åæ®µç±»å' }"> |
| | | <el-select v-model="listenerFieldForm.fieldType"> |
| | | <el-option v-for="item in FIELD_TYPE" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === FIELD_TYPE[0].value" |
| | | label="åæ®µå¼ï¼" |
| | | prop="string" |
| | | key="field-string" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填ååæ®µå¼' }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.string" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === FIELD_TYPE[1].value" |
| | | label="表达å¼ï¼" |
| | | prop="expression" |
| | | key="field-expression" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填å表达å¼' }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.expression" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button @click="listenerFieldFormModelVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="saveListenerFiled">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { createListenerObject, updateElementExtensions } from "../../utils"; |
| | | import { |
| | | initListenerForm, |
| | | initListenerType, |
| | | FIELD_TYPE, |
| | | LISTENER_TYPE, |
| | | TASK_EVENT_TYPE, |
| | | SCRIPT_TYPE, |
| | | EVENT_DEFINITION_TYPE |
| | | } from "./utilSelf"; |
| | | export default { |
| | | name: "UserTaskListeners", |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | inject: { |
| | | prefix: "prefix", |
| | | width: "width" |
| | | }, |
| | | setup() { |
| | | return { Plus, Search } |
| | | }, |
| | | data() { |
| | | return { |
| | | elementListenersList: [], |
| | | listenerFormModelVisible: false, |
| | | listenerForm: {}, |
| | | fieldsListOfListener: [], |
| | | listenerFieldFormModelVisible: false, // çå¬å¨ 注å
¥å段表åå¼¹çª æ¾ç¤ºç¶æ |
| | | editingListenerIndex: -1, // çå¬å¨æå¨ä¸æ ï¼-1 为æ°å¢ |
| | | editingListenerFieldIndex: -1, // åæ®µæå¨ä¸æ ï¼-1 为æ°å¢ |
| | | listenerFieldForm: {} // çå¬å¨ 注å
¥å段 详æ
表å |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler(val) { |
| | | val && val.length && this.$nextTick(() => this.resetListenersList()); |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | TASK_EVENT_TYPE() { return TASK_EVENT_TYPE }, |
| | | LISTENER_TYPE() { return LISTENER_TYPE }, |
| | | FIELD_TYPE() { return FIELD_TYPE }, |
| | | SCRIPT_TYPE() { return SCRIPT_TYPE }, |
| | | EVENT_DEFINITION_TYPE() { return EVENT_DEFINITION_TYPE }, |
| | | formatterEvent() { |
| | | return (row) => { |
| | | return TASK_EVENT_TYPE.find(find => find.value === row.event)?.label || "" |
| | | } |
| | | }, |
| | | formatterListener() { |
| | | return (row) => { |
| | | return LISTENER_TYPE.find(find => find.value === row.listener)?.label || "" |
| | | } |
| | | }, |
| | | formatterField() { |
| | | return (row) => { |
| | | return FIELD_TYPE.find(find => find.value === row.fieldType)?.label || "" |
| | | } |
| | | }, |
| | | selectedProp() { |
| | | return LISTENER_TYPE.find(find => find.value === this.listenerForm.listenerType)?.prop || '' |
| | | } |
| | | }, |
| | | methods: { |
| | | resetListenersList() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.otherExtensionList = []; |
| | | this.bpmnElementListeners = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type === `${this.prefix}:TaskListener`) ?? []; |
| | | this.elementListenersList = this.bpmnElementListeners.map(listener => initListenerType(listener)); |
| | | }, |
| | | openListenerForm(listener, index) { |
| | | if (listener) { |
| | | this.listenerForm = initListenerForm(listener); |
| | | this.editingListenerIndex = index; |
| | | } else { |
| | | this.listenerForm = {}; |
| | | this.editingListenerIndex = -1; // æ 记为æ°å¢ |
| | | } |
| | | if (listener && listener.fields) { |
| | | this.fieldsListOfListener = listener.fields.map(field => ({ |
| | | ...field, |
| | | fieldType: field.string ? "string" : "expression" |
| | | })); |
| | | } else { |
| | | this.fieldsListOfListener = []; |
| | | this.listenerForm["fields"] = [] |
| | | } |
| | | // æå¼ä¾§è¾¹æ å¹¶æ¸
æ¥éªè¯ç¶æ |
| | | this.listenerFormModelVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs["listenerFormRef"]) this.$refs["listenerFormRef"].clearValidate(); |
| | | }); |
| | | }, |
| | | // ç§»é¤çå¬å¨ |
| | | removeListener(listener, index) { |
| | | this.$confirm("确认移é¤è¯¥çå¬å¨åï¼", "æç¤º", { |
| | | confirmButtonText: "确 认", |
| | | cancelButtonText: "å æ¶" |
| | | }) |
| | | .then(() => { |
| | | this.bpmnElementListeners.splice(index, 1); |
| | | this.elementListenersList.splice(index, 1); |
| | | updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners)); |
| | | }) |
| | | .catch(() => console.info("æä½åæ¶")); |
| | | }, |
| | | // ä¿åçå¬å¨ |
| | | async saveListenerConfig() { |
| | | let validateStatus = await this.$refs["listenerFormRef"].validate(); |
| | | if (!validateStatus) return; // éªè¯ä¸éè¿ç´æ¥è¿å |
| | | const listenerObject = createListenerObject(this.listenerForm, true, this.prefix); |
| | | if (this.editingListenerIndex === -1) { |
| | | this.bpmnElementListeners.push(listenerObject); |
| | | this.elementListenersList.push(this.listenerForm); |
| | | } else { |
| | | this.bpmnElementListeners.splice(this.editingListenerIndex, 1, listenerObject); |
| | | this.elementListenersList.splice(this.editingListenerIndex, 1, this.listenerForm); |
| | | } |
| | | // ä¿åå
¶ä»é
ç½® |
| | | this.otherExtensionList = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type !== `${this.prefix}:TaskListener`) ?? []; |
| | | updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners)); |
| | | // 4. éèä¾§è¾¹æ |
| | | this.listenerFormModelVisible = false; |
| | | this.listenerForm = {}; |
| | | }, |
| | | // æå¼çå¬å¨å段ç¼è¾å¼¹çª |
| | | openListenerFieldForm(field, index) { |
| | | this.listenerFieldForm = field ? JSON.parse(JSON.stringify(field)) : {}; |
| | | this.editingListenerFieldIndex = field ? index : -1; |
| | | this.listenerFieldFormModelVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs["listenerFieldFormRef"]) this.$refs["listenerFieldFormRef"].clearValidate(); |
| | | }); |
| | | }, |
| | | // ä¿åçå¬å¨æ³¨å
¥å段 |
| | | async saveListenerFiled() { |
| | | let validateStatus = await this.$refs["listenerFieldFormRef"].validate(); |
| | | if (!validateStatus) return; // éªè¯ä¸éè¿ç´æ¥è¿å |
| | | if (this.editingListenerFieldIndex === -1) { |
| | | this.fieldsListOfListener.push(this.listenerFieldForm); |
| | | this.listenerForm.fields.push(this.listenerFieldForm); |
| | | } else { |
| | | this.fieldsListOfListener.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm); |
| | | this.listenerForm.fields.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm); |
| | | } |
| | | this.listenerFieldFormModelVisible = false; |
| | | this.$nextTick(() => (this.listenerFieldForm = {})); |
| | | }, |
| | | // ç§»é¤çå¬å¨å段 |
| | | removeListenerField(field, index) { |
| | | this.$confirm("确认移é¤è¯¥å段åï¼", "æç¤º", { |
| | | confirmButtonText: "确 认", |
| | | cancelButtonText: "å æ¶" |
| | | }) |
| | | .then(() => { |
| | | this.fieldsListOfListener.splice(index, 1); |
| | | this.listenerForm.fields.splice(index, 1); |
| | | }) |
| | | .catch(() => console.info("æä½åæ¶")); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const template = isTaskListener => { |
| | | return ` |
| | | <div class="panel-tab__content"> |
| | | <el-table :data="elementListenersList" size="small" border> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="äºä»¶ç±»å" min-width="100px" prop="event" /> |
| | | <el-table-column label="çå¬å¨ç±»å" min-width="100px" show-overflow-tooltip :formatter="row => listenerTypeObject[row.listenerType]" /> |
| | | <el-table-column label="æä½" width="90px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="" @click="openListenerForm(row, $index)">ç¼è¾</el-button> |
| | | <el-divider direction="vertical" /> |
| | | <el-button link type="" style="color: #ff4d4f" @click="removeListener(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" type="primary" :icon="Plus" @click="openListenerForm(null)">æ·»å çå¬å¨</el-button> |
| | | </div> |
| | | |
| | | <!-- çå¬å¨ ç¼è¾/å建 é¨å --> |
| | | <el-drawer v-model="listenerFormModelVisible" title="æ§è¡çå¬å¨" :size="width + 'px'" append-to-body destroy-on-close> |
| | | <el-form size="small" :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.prevent> |
| | | <el-form-item label="äºä»¶ç±»å" prop="event" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-select v-model="listenerForm.event"> |
| | | <el-option label="start" value="start" /> |
| | | <el-option label="end" value="end" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="çå¬å¨ç±»å" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-select v-model="listenerForm.listenerType"> |
| | | <el-option v-for="i in Object.keys(listenerTypeObject)" :key="i" :label="listenerTypeObject[i]" :value="i" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.listenerType === 'classListener'" |
| | | label="Javaç±»" |
| | | prop="class" |
| | | key="listener-class" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerForm.class" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.listenerType === 'expressionListener'" |
| | | label="表达å¼" |
| | | prop="expression" |
| | | key="listener-expression" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerForm.expression" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.listenerType === 'delegateExpressionListener'" |
| | | label="代ç表达å¼" |
| | | prop="delegateExpression" |
| | | key="listener-delegate" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerForm.delegateExpression" clearable /> |
| | | </el-form-item> |
| | | <template v-if="listenerForm.listenerType === 'scriptListener'"> |
| | | <el-form-item |
| | | label="èæ¬æ ¼å¼" |
| | | prop="scriptFormat" |
| | | key="listener-script-format" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬æ ¼å¼' }" |
| | | > |
| | | <el-input v-model="listenerForm.scriptFormat" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="èæ¬ç±»å" |
| | | prop="scriptType" |
| | | key="listener-script-type" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©èæ¬ç±»å' }" |
| | | > |
| | | <el-select v-model="listenerForm.scriptType"> |
| | | <el-option label="å
èèæ¬" value="inlineScript" /> |
| | | <el-option label="å¤é¨èæ¬" value="externalScript" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.scriptType === 'inlineScript'" |
| | | label="èæ¬å
容" |
| | | prop="value" |
| | | key="listener-script" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬å
容' }" |
| | | > |
| | | <el-input v-model="listenerForm.value" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerForm.scriptType === 'externalScript'" |
| | | label="èµæºå°å" |
| | | prop="resource" |
| | | key="listener-resource" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèµæºå°å' }" |
| | | > |
| | | <el-input v-model="listenerForm.resource" clearable /> |
| | | </el-form-item> |
| | | </template> |
| | | ${ |
| | | isTaskListener |
| | | ? "<el-form-item label='宿¶å¨ç±»å' prop='eventDefinitionType' key='eventDefinitionType'>" + |
| | | "<el-select v-model='listenerForm.eventDefinitionType'>" + |
| | | "<el-option label='æ¥æ' value='date' />" + |
| | | "<el-option label='æç»æ¶é¿' value='duration' />" + |
| | | "<el-option label='循ç¯' value='cycle' />" + |
| | | "<el-option label='æ ' value='' />" + |
| | | '</el-select>' + |
| | | '</el-form-item>' + |
| | | "<el-form-item v-if='!!listenerForm.eventDefinitionType' label='宿¶å¨' prop='eventDefinitions' key='eventDefinitions'>" + |
| | | "<el-input v-model='listenerForm.eventDefinitions' clearable />" + |
| | | '</el-form-item>' |
| | | : '' |
| | | } |
| | | </el-form> |
| | | <el-divider /> |
| | | <p class="listener-filed__title"> |
| | | <span><el-icon><Menu /></el-icon>注å
¥å段ï¼</span> |
| | | <el-button size="small" type="primary" @click="openListenerFieldForm(null)">æ·»å åæ®µ</el-button> |
| | | </p> |
| | | <el-table :data="fieldsListOfListener" size="small" max-height="240" border fit style="flex: none"> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="åæ®µåç§°" min-width="100px" prop="name" /> |
| | | <el-table-column label="åæ®µç±»å" min-width="80px" show-overflow-tooltip :formatter="row => fieldTypeObject[row.fieldType]" /> |
| | | <el-table-column label="åæ®µå¼/表达å¼" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" /> |
| | | <el-table-column label="æä½" width="100px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="" @click="openListenerFieldForm(row, $index)">ç¼è¾</el-button> |
| | | <el-divider direction="vertical" /> |
| | | <el-button link type="" style="color: #ff4d4f" @click="removeListenerField(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" @click="listenerFormModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveListenerConfig">ä¿ å</el-button> |
| | | </div> |
| | | </el-drawer> |
| | | |
| | | <!-- 注å
¥è¥¿æ®µ ç¼è¾/å建 é¨å --> |
| | | <el-dialog title="åæ®µé
ç½®" v-model="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="listenerFieldForm" size="small" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.prevent> |
| | | <el-form-item label="åæ®µåç§°ï¼" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-input v-model="listenerFieldForm.name" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ®µç±»åï¼" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-select v-model="listenerFieldForm.fieldType"> |
| | | <el-option v-for="i in Object.keys(fieldTypeObject)" :key="i" :label="fieldTypeObject[i]" :value="i" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === 'string'" |
| | | label="åæ®µå¼ï¼" |
| | | prop="string" |
| | | key="field-string" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.string" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === 'expression'" |
| | | label="表达å¼ï¼" |
| | | prop="expression" |
| | | key="field-expression" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.expression" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button size="small" @click="listenerFieldFormModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveListenerFiled">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | `; |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // åå§åè¡¨åæ°æ® |
| | | export function initListenerForm(listener) { |
| | | let self = { |
| | | ...listener |
| | | }; |
| | | if (listener.script) { |
| | | self = { |
| | | ...listener, |
| | | ...listener.script, |
| | | scriptType: listener.script.resource ? "externalScript" : "inlineScript" |
| | | }; |
| | | } |
| | | if (listener.event === "timeout" && listener.eventDefinitions) { |
| | | if (listener.eventDefinitions.length) { |
| | | let k = ""; |
| | | for (let key in listener.eventDefinitions[0]) { |
| | | console.log(listener.eventDefinitions, key); |
| | | if (key.indexOf("time") !== -1) { |
| | | k = key; |
| | | self.eventDefinitionType = key.replace("time", "").toLowerCase(); |
| | | } |
| | | } |
| | | console.log(k); |
| | | self.eventTimeDefinitions = listener.eventDefinitions[0][k].body; |
| | | } |
| | | } |
| | | return self; |
| | | } |
| | | |
| | | export function initListenerType(listener) { |
| | | let listenerType; |
| | | if (listener.class) listenerType = "classListener"; |
| | | if (listener.expression) listenerType = "expressionListener"; |
| | | if (listener.delegateExpression) listenerType = "delegateExpressionListener"; |
| | | if (listener.script) listenerType = "scriptListener"; |
| | | return { |
| | | ...JSON.parse(JSON.stringify(listener)), |
| | | ...(listener.script ?? {}), |
| | | listenerType: listenerType |
| | | }; |
| | | } |
| | | |
| | | // çå¬ç±»å |
| | | export const LISTENER_TYPE = [ |
| | | { label: "Java ç±»", value: "classListener", prop: "class", key: "listener-class" }, |
| | | { label: "表达å¼", value: "expressionListener", prop: "expression", key: "listener-expression" }, |
| | | { label: "代ç表达å¼", value: "delegateExpressionListener", prop: "delegateExpression", key: "listener-delegate" }, |
| | | // { label: "èæ¬", value: "scriptListener", prop: "scriptFormat", key: "listener-script-format" }, |
| | | ] |
| | | // èæ¬ç±»å |
| | | export const SCRIPT_TYPE = [ |
| | | { label: "å
èèæ¬", value: "inlineScript" }, |
| | | { label: "å¤é¨èæ¬", value: "externalScript" }, |
| | | ] |
| | | // ä»»å¡çå¬å¨: äºä»¶ç±»å |
| | | export const TASK_EVENT_TYPE = [ |
| | | { label: "å建", value: "create" }, |
| | | { label: "ææ´¾", value: "assignment" }, |
| | | { label: "宿", value: "complete" }, |
| | | { label: "å é¤", value: "delete" }, |
| | | { label: "æ´æ°", value: "update" }, |
| | | { label: "è¶
æ¶", value: "timeout" }, |
| | | ] |
| | | // æ§è¡çå¬å¨: äºä»¶ç±»å |
| | | export const EXECUTION_EVENT_TYPE = [ |
| | | { label: "å¼å§", value: "start" }, |
| | | { label: "ç»æ", value: "end" }, |
| | | ] |
| | | // äºä»¶ç±»å: 宿¶å¨ç±»å |
| | | export const EVENT_DEFINITION_TYPE = [ |
| | | { label: "æ ", value: "null" }, |
| | | { label: "æ¥æ", value: "date" }, |
| | | { label: "æç»æ¶é¿", value: "duration" }, |
| | | { label: "循ç¯", value: "cycle" }, |
| | | ] |
| | | // åæ®µé
ç½® |
| | | export const FIELD_TYPE = [ |
| | | { label: "å符串", value: "string" }, |
| | | { label: "表达å¼", value: "expression" }, |
| | | ] |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-table :data="elementListenersList" size="small" border> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="äºä»¶ç±»å" min-width="100px" prop="event" :formatter="formatterEvent" /> |
| | | <el-table-column label="çå¬å¨ç±»å" min-width="100px" show-overflow-tooltip :formatter="formatterListener" /> |
| | | <el-table-column label="æä½" width="90px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="primary" @click="openListenerForm(row, $index)">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="removeListener(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" type="primary" :icon="Plus" @click="openListenerForm(null)">æ·»å çå¬å¨</el-button> |
| | | </div> |
| | | |
| | | <!-- çå¬å¨ ç¼è¾/å建 é¨å --> |
| | | <el-drawer |
| | | v-model="listenerFormModelVisible" |
| | | title="æ§è¡çå¬å¨" |
| | | :size="`${width}px`" |
| | | class="listener-drawer" |
| | | append-to-body |
| | | destroy-on-close> |
| | | <el-form :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.prevent> |
| | | <el-form-item label="äºä»¶ç±»å" prop="event" :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©äºä»¶ç±»å' }"> |
| | | <el-select v-model="listenerForm.event"> |
| | | <el-option v-for="item in EXECUTION_EVENT_TYPE" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="çå¬å¨ç±»å" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©çå¬å¨ç±»å' }"> |
| | | <el-input |
| | | v-model="listenerForm[selectedProp]" |
| | | clearable |
| | | class="input-with-select"> |
| | | <template #prepend> |
| | | <el-select v-model="listenerForm.listenerType" style="width: 100%"> |
| | | <el-option v-for="item in LISTENER_TYPE" :key="item.key" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </template> |
| | | <template #append> |
| | | <el-button :icon="Search" /> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <template v-for="item in LISTENER_TYPEWithoutJB"> |
| | | <el-form-item |
| | | v-if="listenerForm.listenerType === item.value" |
| | | :key="item.key" |
| | | :label="item.label" |
| | | :prop="item.prop" |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerForm[item.prop]" clearable /> |
| | | </el-form-item> |
| | | </template> |
| | | <!-- èæ¬ç±»å --> |
| | | <!-- <template v-if="listenerForm.listenerType === LISTENER_TYPE[LISTENER_TYPE.length - 1].value">--> |
| | | <!-- <el-form-item--> |
| | | <!-- label="èæ¬æ ¼å¼"--> |
| | | <!-- prop="scriptFormat"--> |
| | | <!-- key="listener-script-format"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬æ ¼å¼' }"--> |
| | | <!-- >--> |
| | | <!-- <el-input v-model="listenerForm.scriptFormat" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item--> |
| | | <!-- label="èæ¬ç±»å"--> |
| | | <!-- prop="scriptType"--> |
| | | <!-- key="listener-script-type"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©èæ¬ç±»å' }"--> |
| | | <!-- >--> |
| | | <!-- <el-select v-model="listenerForm.scriptType">--> |
| | | <!-- <el-option v-for="item in SCRIPT_TYPE" :key="item.value" :label="item.label" :value="item.value" />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item--> |
| | | <!-- v-if="listenerForm.scriptType === SCRIPT_TYPE[0].value"--> |
| | | <!-- label="èæ¬å
容"--> |
| | | <!-- prop="value"--> |
| | | <!-- key="listener-script"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèæ¬å
容' }"--> |
| | | <!-- >--> |
| | | <!-- <el-input v-model="listenerForm.value" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item--> |
| | | <!-- v-if="listenerForm.scriptType === SCRIPT_TYPE[1].value"--> |
| | | <!-- label="èµæºå°å"--> |
| | | <!-- prop="resource"--> |
| | | <!-- key="listener-resource"--> |
| | | <!-- :rules="{ required: true, trigger: ['blur', 'change'], message: '请填åèµæºå°å' }"--> |
| | | <!-- >--> |
| | | <!-- <el-input v-model="listenerForm.resource" clearable />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </template>--> |
| | | </el-form> |
| | | <el-divider /> |
| | | <div class="listener-filed__title"> |
| | | <span><el-icon><Menu /></el-icon>注å
¥å段ï¼</span> |
| | | <el-button size="small" type="primary" @click="openListenerFieldForm(null)">æ·»å åæ®µ</el-button> |
| | | </div> |
| | | <el-table :data="fieldsListOfListener" size="small" max-height="240" border fit style="flex: none"> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="åæ®µåç§°" min-width="100px" prop="name" /> |
| | | <el-table-column label="åæ®µç±»å" min-width="80px" show-overflow-tooltip :formatter="formatterField" /> |
| | | <el-table-column label="åæ®µå¼/表达å¼" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" /> |
| | | <el-table-column label="æä½" width="100px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="primary" @click="openListenerFieldForm(row, $index)">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="removeListenerField(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" @click="listenerFormModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveListenerConfig">ä¿ å</el-button> |
| | | </div> |
| | | </el-drawer> |
| | | |
| | | <!-- 注å
¥è¥¿æ®µ ç¼è¾/å建 é¨å --> |
| | | <el-dialog title="åæ®µé
ç½®" v-model="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="listenerFieldForm" size="small" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.prevent> |
| | | <el-form-item label="åæ®µåç§°ï¼" prop="name" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填ååæ®µåç§°' }"> |
| | | <el-input v-model="listenerFieldForm.name" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ®µç±»åï¼" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'], message: 'è¯·éæ©åæ®µç±»å' }"> |
| | | <el-select v-model="listenerFieldForm.fieldType"> |
| | | <el-option v-for="item in FIELD_TYPE" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === FIELD_TYPE[0].value" |
| | | label="åæ®µå¼ï¼" |
| | | prop="string" |
| | | key="field-string" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填ååæ®µå¼' }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.string" clearable /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === FIELD_TYPE[1].value" |
| | | label="表达å¼ï¼" |
| | | prop="expression" |
| | | key="field-expression" |
| | | :rules="{ required: true, trigger: ['blur', 'change'], message: '请填å表达å¼' }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.expression" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button size="small" @click="listenerFieldFormModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveListenerFiled">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { createListenerObject, updateElementExtensions } from "../../utils"; |
| | | import { |
| | | initListenerType, |
| | | initListenerForm, |
| | | EXECUTION_EVENT_TYPE, |
| | | LISTENER_TYPE, |
| | | FIELD_TYPE, |
| | | SCRIPT_TYPE, |
| | | EVENT_DEFINITION_TYPE |
| | | } from "./utilSelf"; |
| | | import { Plus, Search } from "@element-plus/icons-vue"; |
| | | |
| | | export default { |
| | | name: "ElementListeners", |
| | | setup() { |
| | | return { Plus, Search } |
| | | }, |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | inject: { |
| | | prefix: "prefix", |
| | | width: "width" |
| | | }, |
| | | data() { |
| | | return { |
| | | elementListenersList: [], // çå¬å¨å表 |
| | | listenerForm: {}, // çå¬å¨è¯¦æ
表å |
| | | listenerFormModelVisible: false, // çå¬å¨ ç¼è¾ ä¾§è¾¹æ æ¾ç¤ºç¶æ |
| | | fieldsListOfListener: [], |
| | | listenerFieldForm: {}, // çå¬å¨ 注å
¥å段 详æ
表å |
| | | listenerFieldFormModelVisible: false, // çå¬å¨ 注å
¥å段表åå¼¹çª æ¾ç¤ºç¶æ |
| | | editingListenerIndex: -1, // çå¬å¨æå¨ä¸æ ï¼-1 为æ°å¢ |
| | | editingListenerFieldIndex: -1, // åæ®µæå¨ä¸æ ï¼-1 为æ°å¢ |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler(val) { |
| | | val && val.length && this.$nextTick(() => this.resetListenersList()); |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | EXECUTION_EVENT_TYPE() { return EXECUTION_EVENT_TYPE }, |
| | | LISTENER_TYPE() { return LISTENER_TYPE }, |
| | | FIELD_TYPE() { return FIELD_TYPE }, |
| | | SCRIPT_TYPE() { return SCRIPT_TYPE }, |
| | | EVENT_DEFINITION_TYPE() { return EVENT_DEFINITION_TYPE }, |
| | | formatterEvent() { |
| | | return (row) => { |
| | | return EXECUTION_EVENT_TYPE.find(find => find.value === row.event)?.label || "" |
| | | } |
| | | }, |
| | | formatterListener() { |
| | | return (row) => { |
| | | return LISTENER_TYPE.find(find => find.value === row.listener)?.label || "" |
| | | } |
| | | }, |
| | | formatterField() { |
| | | return (row) => { |
| | | return FIELD_TYPE.find(find => find.value === row.fieldType)?.label || "" |
| | | } |
| | | }, |
| | | selectedProp() { |
| | | return LISTENER_TYPE.find(find => find.value === this.listenerForm.listenerType)?.prop || '' |
| | | } |
| | | }, |
| | | methods: { |
| | | resetListenersList() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.otherExtensionList = []; |
| | | this.bpmnElementListeners = |
| | | this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type === `${this.prefix}:ExecutionListener`) ?? []; |
| | | this.elementListenersList = this.bpmnElementListeners.map(listener => initListenerType(listener)); |
| | | }, |
| | | // æå¼ çå¬å¨è¯¦æ
ä¾§è¾¹æ |
| | | openListenerForm(listener, index) { |
| | | if (listener) { |
| | | this.listenerForm = initListenerForm(listener); |
| | | this.editingListenerIndex = index; |
| | | } else { |
| | | this.listenerForm = {}; |
| | | this.editingListenerIndex = -1; // æ 记为æ°å¢ |
| | | } |
| | | if (listener && listener.fields) { |
| | | this.fieldsListOfListener = listener.fields.map(field => ({ |
| | | ...field, |
| | | fieldType: field.string ? "string" : "expression" |
| | | })); |
| | | } else { |
| | | this.fieldsListOfListener = []; |
| | | this.listenerForm["fields"] = [] |
| | | } |
| | | // æå¼ä¾§è¾¹æ å¹¶æ¸
æ¥éªè¯ç¶æ |
| | | this.listenerFormModelVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs["listenerFormRef"]) this.$refs["listenerFormRef"].clearValidate(); |
| | | }); |
| | | }, |
| | | // æå¼çå¬å¨å段ç¼è¾å¼¹çª |
| | | openListenerFieldForm(field, index) { |
| | | this.listenerFieldForm = field ? JSON.parse(JSON.stringify(field)) : {}; |
| | | this.editingListenerFieldIndex = field ? index : -1; |
| | | this.listenerFieldFormModelVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs["listenerFieldFormRef"]) this.$refs["listenerFieldFormRef"].clearValidate(); |
| | | }); |
| | | }, |
| | | // ä¿åçå¬å¨æ³¨å
¥å段 |
| | | async saveListenerFiled() { |
| | | let validateStatus = await this.$refs["listenerFieldFormRef"].validate(); |
| | | if (!validateStatus) return; // éªè¯ä¸éè¿ç´æ¥è¿å |
| | | if (this.editingListenerFieldIndex === -1) { |
| | | this.fieldsListOfListener.push(this.listenerFieldForm); |
| | | this.listenerForm.fields.push(this.listenerFieldForm); |
| | | } else { |
| | | this.fieldsListOfListener.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm); |
| | | this.listenerForm.fields.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm); |
| | | } |
| | | this.listenerFieldFormModelVisible = false; |
| | | this.$nextTick(() => (this.listenerFieldForm = {})); |
| | | }, |
| | | // ç§»é¤çå¬å¨å段 |
| | | removeListenerField(field, index) { |
| | | this.$confirm("确认移é¤è¯¥å段åï¼", "æç¤º", { |
| | | confirmButtonText: "确 认", |
| | | cancelButtonText: "å æ¶" |
| | | }) |
| | | .then(() => { |
| | | this.fieldsListOfListener.splice(index, 1); |
| | | this.listenerForm.fields.splice(index, 1); |
| | | }) |
| | | .catch(() => console.info("æä½åæ¶")); |
| | | }, |
| | | // ç§»é¤çå¬å¨ |
| | | removeListener(listener, index) { |
| | | this.$confirm("确认移é¤è¯¥çå¬å¨åï¼", "æç¤º", { |
| | | confirmButtonText: "确 认", |
| | | cancelButtonText: "å æ¶" |
| | | }) |
| | | .then(() => { |
| | | this.bpmnElementListeners.splice(index, 1); |
| | | this.elementListenersList.splice(index, 1); |
| | | updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners)); |
| | | }) |
| | | .catch(() => console.info("æä½åæ¶")); |
| | | }, |
| | | // ä¿åçå¬å¨é
ç½® |
| | | async saveListenerConfig() { |
| | | let validateStatus = await this.$refs["listenerFormRef"].validate(); |
| | | if (!validateStatus) return; // éªè¯ä¸éè¿ç´æ¥è¿å |
| | | const listenerObject = createListenerObject(this.listenerForm, false, this.prefix); |
| | | if (this.editingListenerIndex === -1) { |
| | | this.bpmnElementListeners.push(listenerObject); |
| | | this.elementListenersList.push(this.listenerForm); |
| | | } else { |
| | | this.bpmnElementListeners.splice(this.editingListenerIndex, 1, listenerObject); |
| | | this.elementListenersList.splice(this.editingListenerIndex, 1, this.listenerForm); |
| | | } |
| | | // ä¿åå
¶ä»é
ç½® |
| | | this.otherExtensionList = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type !== `${this.prefix}:ExecutionListener`) ?? []; |
| | | updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners)); |
| | | // 4. éèä¾§è¾¹æ |
| | | this.listenerFormModelVisible = false; |
| | | this.listenerForm = {}; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // åå§åè¡¨åæ°æ® |
| | | export function initListenerForm(listener) { |
| | | let self = { |
| | | ...listener |
| | | }; |
| | | if (listener.script) { |
| | | self = { |
| | | ...listener, |
| | | ...listener.script, |
| | | scriptType: listener.script.resource ? "externalScript" : "inlineScript" |
| | | }; |
| | | } |
| | | if (listener.event === "timeout" && listener.eventDefinitions) { |
| | | if (listener.eventDefinitions.length) { |
| | | let k = ""; |
| | | for (let key in listener.eventDefinitions[0]) { |
| | | console.log(listener.eventDefinitions, key); |
| | | if (key.indexOf("time") !== -1) { |
| | | k = key; |
| | | self.eventDefinitionType = key.replace("time", "").toLowerCase(); |
| | | } |
| | | } |
| | | console.log(k); |
| | | self.eventTimeDefinitions = listener.eventDefinitions[0][k].body; |
| | | } |
| | | } |
| | | return self; |
| | | } |
| | | |
| | | export function initListenerType(listener) { |
| | | let listenerType; |
| | | if (listener.class) listenerType = "classListener"; |
| | | if (listener.expression) listenerType = "expressionListener"; |
| | | if (listener.delegateExpression) listenerType = "delegateExpressionListener"; |
| | | if (listener.script) listenerType = "scriptListener"; |
| | | return { |
| | | ...JSON.parse(JSON.stringify(listener)), |
| | | ...(listener.script ?? {}), |
| | | listenerType: listenerType |
| | | }; |
| | | } |
| | | |
| | | // çå¬ç±»å |
| | | export const LISTENER_TYPE = [ |
| | | { label: "Java ç±»", value: "classListener", prop: "class", key: "listener-class" }, |
| | | { label: "表达å¼", value: "expressionListener", prop: "expression", key: "listener-expression" }, |
| | | { label: "代ç表达å¼", value: "delegateExpressionListener", prop: "delegateExpression", key: "listener-delegate" }, |
| | | // { label: "èæ¬", value: "scriptListener", prop: "scriptFormat", key: "listener-script-format" }, |
| | | ] |
| | | // èæ¬ç±»å |
| | | export const SCRIPT_TYPE = [ |
| | | { label: "å
èèæ¬", value: "inlineScript" }, |
| | | { label: "å¤é¨èæ¬", value: "externalScript" }, |
| | | ] |
| | | // ä»»å¡çå¬å¨: äºä»¶ç±»å |
| | | export const TASK_EVENT_TYPE = [ |
| | | { label: "å建", value: "create" }, |
| | | { label: "ææ´¾", value: "assignment" }, |
| | | { label: "宿", value: "complete" }, |
| | | { label: "å é¤", value: "delete" }, |
| | | { label: "æ´æ°", value: "update" }, |
| | | { label: "è¶
æ¶", value: "timeout" }, |
| | | ] |
| | | // æ§è¡çå¬å¨: äºä»¶ç±»å |
| | | export const EXECUTION_EVENT_TYPE = [ |
| | | { label: "å¼å§", value: "start" }, |
| | | { label: "ç»æ", value: "end" }, |
| | | ] |
| | | // äºä»¶ç±»å: 宿¶å¨ç±»å |
| | | export const EVENT_DEFINITION_TYPE = [ |
| | | { label: "æ ", value: "null" }, |
| | | { label: "æ¥æ", value: "date" }, |
| | | { label: "æç»æ¶é¿", value: "duration" }, |
| | | { label: "循ç¯", value: "cycle" }, |
| | | ] |
| | | // åæ®µé
ç½® |
| | | export const FIELD_TYPE = [ |
| | | { label: "å符串", value: "string" }, |
| | | { label: "表达å¼", value: "expression" }, |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <div class="element-property input-property"> |
| | | <div class="element-property__label">å
ç´ ææ¡£ï¼</div> |
| | | <div class="element-property__value"> |
| | | <el-input |
| | | type="textarea" |
| | | v-model="documentation" |
| | | size="small" |
| | | resize="vertical" |
| | | :autosize="{ minRows: 2, maxRows: 4 }" |
| | | @input="updateDocumentation" |
| | | @blur="updateDocumentation" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "ElementOtherConfig", |
| | | props: { |
| | | id: String |
| | | }, |
| | | data() { |
| | | return { |
| | | documentation: "" |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler: function(id) { |
| | | if (id && id.length) { |
| | | this.$nextTick(() => { |
| | | const documentations = window.bpmnInstances.bpmnElement.businessObject?.documentation; |
| | | this.documentation = documentations && documentations.length ? documentations[0].text : ""; |
| | | }); |
| | | } else { |
| | | this.documentation = ""; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | updateDocumentation() { |
| | | (this.bpmnElement && this.bpmnElement.id === this.id) || (this.bpmnElement = window.bpmnInstances.elementRegistry.get(this.id)); |
| | | const documentation = window.bpmnInstances.bpmnFactory.create("bpmn:Documentation", { text: this.documentation }); |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | documentation: [documentation] |
| | | }); |
| | | } |
| | | }, |
| | | beforeUnmount() { |
| | | this.bpmnElement = null; |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-table :data="elementPropertyList" size="small" max-height="240" border fit> |
| | | <el-table-column label="åºå·" width="50px" type="index" /> |
| | | <el-table-column label="屿§å" prop="name" min-width="100px" show-overflow-tooltip /> |
| | | <el-table-column label="屿§å¼" prop="value" min-width="100px" show-overflow-tooltip /> |
| | | <el-table-column label="æä½" width="90px"> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-button link type="" @click="openAttributesForm(row, $index)">ç¼è¾</el-button> |
| | | <el-divider direction="vertical" /> |
| | | <el-button link type="" style="color: #ff4d4f" @click="removeAttributes(row, $index)">ç§»é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="element-drawer__button"> |
| | | <el-button size="small" type="primary" :icon="Plus" @click="openAttributesForm(null, -1)">æ·»å 屿§</el-button> |
| | | </div> |
| | | |
| | | <el-dialog v-model="propertyFormModelVisible" title="屿§é
ç½®" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="propertyForm" label-width="80px" size="small" ref="attributeFormRef" @submit.prevent> |
| | | <el-form-item label="屿§åï¼" prop="name"> |
| | | <el-input v-model="propertyForm.name" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="屿§å¼ï¼" prop="value"> |
| | | <el-input v-model="propertyForm.value" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button size="small" @click="propertyFormModelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="saveAttribute">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { Plus } from '@element-plus/icons-vue' |
| | | export default { |
| | | name: "ElementProperties", |
| | | setup() { |
| | | return { |
| | | Plus |
| | | } |
| | | }, |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | inject: { |
| | | prefix: "prefix", |
| | | width: "width" |
| | | }, |
| | | data() { |
| | | return { |
| | | elementPropertyList: [], |
| | | propertyForm: {}, |
| | | editingPropertyIndex: -1, |
| | | propertyFormModelVisible: false |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler(val) { |
| | | val && val.length && this.resetAttributesList(); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | resetAttributesList() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.otherExtensionList = []; // å
¶ä»æ©å±é
ç½® |
| | | this.bpmnElementProperties = |
| | | this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => { |
| | | if (ex.$type !== `${this.prefix}:Properties`) { |
| | | this.otherExtensionList.push(ex); |
| | | } |
| | | return ex.$type === `${this.prefix}:Properties`; |
| | | }) ?? []; |
| | | |
| | | // ä¿åææç æ©å±å±æ§å段 |
| | | this.bpmnElementPropertyList = this.bpmnElementProperties.reduce((pre, current) => pre.concat(current.values), []); |
| | | // å¤å¶ æ¾ç¤º |
| | | this.elementPropertyList = JSON.parse(JSON.stringify(this.bpmnElementPropertyList ?? [])); |
| | | }, |
| | | openAttributesForm(attr, index) { |
| | | this.editingPropertyIndex = index; |
| | | this.propertyForm = index === -1 ? {} : JSON.parse(JSON.stringify(attr)); |
| | | this.propertyFormModelVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs["attributeFormRef"]) this.$refs["attributeFormRef"].clearValidate(); |
| | | }); |
| | | }, |
| | | removeAttributes(attr, index) { |
| | | this.$confirm("确认移é¤è¯¥å±æ§åï¼", "æç¤º", { |
| | | confirmButtonText: "确 认", |
| | | cancelButtonText: "å æ¶" |
| | | }) |
| | | .then(() => { |
| | | this.elementPropertyList.splice(index, 1); |
| | | this.bpmnElementPropertyList.splice(index, 1); |
| | | // æ°å»ºä¸ä¸ªå±æ§å段çä¿åå表 |
| | | const propertiesObject = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, { |
| | | values: this.bpmnElementPropertyList |
| | | }); |
| | | this.updateElementExtensions(propertiesObject); |
| | | this.resetAttributesList(); |
| | | }) |
| | | .catch(() => console.info("æä½åæ¶")); |
| | | }, |
| | | saveAttribute() { |
| | | const { name, value } = this.propertyForm; |
| | | console.log(this.bpmnElementPropertyList); |
| | | if (this.editingPropertyIndex !== -1) { |
| | | window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.bpmnElementPropertyList[this.editingPropertyIndex], { |
| | | name, |
| | | value |
| | | }); |
| | | } else { |
| | | // æ°å»ºå±æ§å段 |
| | | const newPropertyObject = window.bpmnInstances.moddle.create(`${this.prefix}:Property`, { name, value }); |
| | | // æ°å»ºä¸ä¸ªå±æ§å段çä¿åå表 |
| | | const propertiesObject = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, { |
| | | values: this.bpmnElementPropertyList.concat([newPropertyObject]) |
| | | }); |
| | | this.updateElementExtensions(propertiesObject); |
| | | } |
| | | this.propertyFormModelVisible = false; |
| | | this.resetAttributesList(); |
| | | }, |
| | | updateElementExtensions(properties) { |
| | | const extensions = window.bpmnInstances.moddle.create("bpmn:ExtensionElements", { |
| | | values: this.otherExtensionList.concat([properties]) |
| | | }); |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | extensionElements: extensions |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <div class="panel-tab__content--title"> |
| | | <span><el-icon style="margin-right: 8px; color: #555555"><Menu /></el-icon>æ¶æ¯å表</span> |
| | | <el-button size="small" type="primary" :icon="Plus" @click="openModel('message')">åå»ºæ°æ¶æ¯</el-button> |
| | | </div> |
| | | <el-table :data="messageList" size="small" border> |
| | | <el-table-column type="index" label="åºå·" width="60px" /> |
| | | <el-table-column label="æ¶æ¯ID" prop="id" max-width="300px" show-overflow-tooltip /> |
| | | <el-table-column label="æ¶æ¯åç§°" prop="name" max-width="300px" show-overflow-tooltip /> |
| | | </el-table> |
| | | <div class="panel-tab__content--title" style="padding-top: 8px; margin-top: 8px; border-top: 1px solid #eeeeee"> |
| | | <span><el-icon style="margin-right: 8px; color: #555555"><Menu /></el-icon>ä¿¡å·å表</span> |
| | | <el-button size="small" type="primary" :icon="Plus" @click="openModel('signal')">å建æ°ä¿¡å·</el-button> |
| | | </div> |
| | | <el-table :data="signalList" size="small" border> |
| | | <el-table-column type="index" label="åºå·" width="60px" /> |
| | | <el-table-column label="ä¿¡å·ID" prop="id" max-width="300px" show-overflow-tooltip /> |
| | | <el-table-column label="ä¿¡å·åç§°" prop="name" max-width="300px" show-overflow-tooltip /> |
| | | </el-table> |
| | | |
| | | <el-dialog v-model="modelVisible" :title="modelConfig.title" :close-on-click-modal="false" width="400px" append-to-body destroy-on-close> |
| | | <el-form :model="modelObjectForm" size="small" label-width="90px" @submit.prevent> |
| | | <el-form-item :label="modelConfig.idLabel"> |
| | | <el-input v-model="modelObjectForm.id" clearable /> |
| | | </el-form-item> |
| | | <el-form-item :label="modelConfig.nameLabel"> |
| | | <el-input v-model="modelObjectForm.name" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button size="small" @click="modelVisible = false">å æ¶</el-button> |
| | | <el-button size="small" type="primary" @click="addNewObject">ä¿ å</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { Plus } from '@element-plus/icons-vue' |
| | | export default { |
| | | name: 'SignalAndMassage', |
| | | setup() { |
| | | return { |
| | | Plus |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | signalList: [], |
| | | messageList: [], |
| | | modelVisible: false, |
| | | modelType: '', |
| | | modelObjectForm: {} |
| | | }; |
| | | }, |
| | | computed: { |
| | | modelConfig() { |
| | | if (this.modelType === 'message') { |
| | | return { title: 'åå»ºæ¶æ¯', idLabel: 'æ¶æ¯ID', nameLabel: 'æ¶æ¯åç§°' }; |
| | | } else { |
| | | return { title: 'å建信å·', idLabel: 'ä¿¡å·ID', nameLabel: 'ä¿¡å·åç§°' }; |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.initDataList(); |
| | | }, |
| | | methods: { |
| | | initDataList() { |
| | | this.rootElements = window.bpmnInstances.modeler.getDefinitions().rootElements; |
| | | this.messageIdMap = {}; |
| | | this.signalIdMap = {}; |
| | | this.messageList = []; |
| | | this.signalList = []; |
| | | this.rootElements.forEach(el => { |
| | | if (el.$type === 'bpmn:Message') { |
| | | this.messageIdMap[el.id] = true; |
| | | this.messageList.push({ ...el }); |
| | | } |
| | | if (el.$type === 'bpmn:Signal') { |
| | | this.signalIdMap[el.id] = true; |
| | | this.signalList.push({ ...el }); |
| | | } |
| | | }); |
| | | }, |
| | | openModel(type) { |
| | | this.modelType = type; |
| | | this.modelObjectForm = {}; |
| | | this.modelVisible = true; |
| | | }, |
| | | addNewObject() { |
| | | if (this.modelType === 'message') { |
| | | if (this.messageIdMap[this.modelObjectForm.id]) { |
| | | return this.$message.error('è¯¥æ¶æ¯å·²åå¨ï¼è¯·ä¿®æ¹idåéæ°ä¿å'); |
| | | } |
| | | const messageRef = window.bpmnInstances.moddle.create('bpmn:Message', this.modelObjectForm); |
| | | this.rootElements.push(messageRef); |
| | | } else { |
| | | if (this.signalIdMap[this.modelObjectForm.id]) { |
| | | return this.$message.error('该信å·å·²åå¨ï¼è¯·ä¿®æ¹idåéæ°ä¿å'); |
| | | } |
| | | const signalRef = window.bpmnInstances.moddle.create('bpmn:Signal', this.modelObjectForm); |
| | | this.rootElements.push(signalRef); |
| | | } |
| | | this.modelVisible = false; |
| | | this.initDataList(); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="panel-tab__content"> |
| | | <el-form size="small" label-width="90px" @submit.prevent> |
| | | <!-- <el-form-item label="弿¥å»¶ç»">--> |
| | | <!-- <el-checkbox v-model="taskConfigForm.asyncBefore" label="弿¥å" @change="changeTaskAsync" />--> |
| | | <!-- <el-checkbox v-model="taskConfigForm.asyncAfter" label="弿¥å" @change="changeTaskAsync" />--> |
| | | <!-- <el-checkbox v-model="taskConfigForm.exclusive" v-if="taskConfigForm.asyncAfter || taskConfigForm.asyncBefore" label="æé¤" @change="changeTaskAsync" />--> |
| | | <!-- </el-form-item>--> |
| | | <component :is="witchTaskComponent" v-bind="$props" /> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import UserTask from "./task-components/UserTask.vue"; |
| | | import ScriptTask from "./task-components/ScriptTask.vue"; |
| | | import ReceiveTask from "./task-components/ReceiveTask.vue"; |
| | | |
| | | export default { |
| | | name: "ElementTaskConfig", |
| | | components: { UserTask, ScriptTask, ReceiveTask }, |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | data() { |
| | | return { |
| | | taskConfigForm: { |
| | | asyncAfter: false, |
| | | asyncBefore: false, |
| | | exclusive: false |
| | | }, |
| | | witchTaskComponent: "", |
| | | installedComponent: { |
| | | // æå·¥ä»»å¡ä¸æ®éä»»å¡ä¸è´ï¼ä¸éè¦å
¶ä»é
ç½® |
| | | // æ¥æ¶æ¶æ¯ä»»å¡ï¼éè¦å¨å
¨å±ä¸æå
¥æ°çæ¶æ¯å®ä¾ï¼å¹¶å¨è¯¥èç¹ä¸ç messageRef 屿§ç»å®è¯¥å®ä¾ |
| | | // åéä»»å¡ãæå¡ä»»å¡ãä¸å¡è§åä»»å¡å
±ç¨ä¸ä¸ªç¸åé
ç½® |
| | | UserTask: "UserTask", // ç¨æ·ä»»å¡é
ç½® |
| | | ScriptTask: "ScriptTask", // èæ¬ä»»å¡é
ç½® |
| | | ReceiveTask: "ReceiveTask" // æ¶æ¯æ¥æ¶ä»»å¡ |
| | | } |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | // this.taskConfigForm.asyncBefore = this.bpmnElement?.businessObject?.asyncBefore; |
| | | // this.taskConfigForm.asyncAfter = this.bpmnElement?.businessObject?.asyncAfter; |
| | | // this.taskConfigForm.exclusive = this.bpmnElement?.businessObject?.exclusive; |
| | | } |
| | | }, |
| | | type: { |
| | | immediate: true, |
| | | handler() { |
| | | this.witchTaskComponent = this.installedComponent[this.$props.type]; |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | changeTaskAsync() { |
| | | if (!this.taskConfigForm.asyncBefore && !this.taskConfigForm.asyncAfter) { |
| | | this.taskConfigForm.exclusive = false; |
| | | } |
| | | window.bpmnInstances.modeling.updateProperties(window.bpmnInstances.bpmnElement, { |
| | | ...this.taskConfigForm |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="margin-top: 16px"> |
| | | <el-form-item label="æ¶æ¯å®ä¾"> |
| | | <div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap"> |
| | | <el-select v-model="bindMessageId" @change="updateTaskMessage"> |
| | | <el-option v-for="id in Object.keys(messageMap)" :value="id" :label="messageMap[id]" :key="id" /> |
| | | </el-select> |
| | | <el-button size="small" type="primary" :icon="Plus" style="margin-left: 8px" @click="openMessageModel" /> |
| | | </div> |
| | | </el-form-item> |
| | | <el-dialog v-model="messageModelVisible" :close-on-click-modal="false" title="åå»ºæ°æ¶æ¯" width="400px" append-to-body destroy-on-close> |
| | | <el-form :model="newMessageForm" size="small" label-width="90px" @submit.prevent> |
| | | <el-form-item label="æ¶æ¯ID"> |
| | | <el-input v-model="newMessageForm.id" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="æ¶æ¯åç§°"> |
| | | <el-input v-model="newMessageForm.name" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template v-slot:footer> |
| | | <el-button size="small" type="primary" @click="createNewMessage">确 认</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "ReceiveTask", |
| | | setup() { |
| | | return { |
| | | Plus |
| | | } |
| | | }, |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | data() { |
| | | return { |
| | | bindMessageId: "", |
| | | newMessageForm: {}, |
| | | messageMap: {}, |
| | | messageModelVisible: false |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler() { |
| | | this.$nextTick(() => this.getBindMessage()); |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.bpmnMessageRefsMap = Object.create(null); |
| | | this.bpmnRootElements = window.bpmnInstances.modeler.getDefinitions().rootElements; |
| | | this.bpmnRootElements |
| | | .filter(el => el.$type === "bpmn:Message") |
| | | .forEach(m => { |
| | | this.bpmnMessageRefsMap[m.id] = m; |
| | | this.messageMap[m.id] = m.name |
| | | }); |
| | | this.messageMap["-1"] = "æ " // æ·»å ä¸ä¸ªç©ºå¯¹è±¡ï¼ä¿è¯å¯ä»¥åæ¶åæ¶æ¯ç»å® |
| | | }, |
| | | methods: { |
| | | getBindMessage() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.bindMessageId = this.bpmnElement.businessObject?.messageRef?.id || "-1"; |
| | | }, |
| | | openMessageModel() { |
| | | this.messageModelVisible = true; |
| | | this.newMessageForm = {}; |
| | | }, |
| | | createNewMessage() { |
| | | if (this.messageMap[this.newMessageForm.id]) { |
| | | this.$message.error("è¯¥æ¶æ¯å·²åå¨ï¼è¯·ä¿®æ¹idåéæ°ä¿å"); |
| | | return; |
| | | } |
| | | const newMessage = window.bpmnInstances.moddle.create("bpmn:Message", this.newMessageForm); |
| | | this.bpmnRootElements.push(newMessage); |
| | | this.messageMap[this.newMessageForm.id] = this.newMessageForm.name |
| | | this.bpmnMessageRefsMap[this.newMessageForm.id] = newMessage; |
| | | this.messageModelVisible = false; |
| | | }, |
| | | updateTaskMessage(messageId) { |
| | | if (messageId === "-1") { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | messageRef: null |
| | | }); |
| | | } else { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | messageRef: this.bpmnMessageRefsMap[messageId] |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | beforeUnmount() { |
| | | this.bpmnElement = null; |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="margin-top: 16px"> |
| | | <el-form-item label="èæ¬æ ¼å¼"> |
| | | <el-input v-model="scriptTaskForm.scriptFormat" clearable @input="updateElementTask()" @change="updateElementTask()" /> |
| | | </el-form-item> |
| | | <el-form-item label="èæ¬ç±»å"> |
| | | <el-select v-model="scriptTaskForm.scriptType"> |
| | | <el-option label="å
èèæ¬" value="inline" /> |
| | | <el-option label="å¤é¨èµæº" value="external" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="èæ¬" v-show="scriptTaskForm.scriptType === 'inline'"> |
| | | <el-input |
| | | v-model="scriptTaskForm.script" |
| | | type="textarea" |
| | | resize="vertical" |
| | | :autosize="{ minRows: 2, maxRows: 4 }" |
| | | clearable |
| | | @input="updateElementTask()" |
| | | @change="updateElementTask()" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="èµæºå°å" v-show="scriptTaskForm.scriptType === 'external'"> |
| | | <el-input v-model="scriptTaskForm.resource" clearable @input="updateElementTask()" @change="updateElementTask()" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»æåé"> |
| | | <el-input v-model="scriptTaskForm.resultVariable" clearable @input="updateElementTask()" @change="updateElementTask()" /> |
| | | </el-form-item> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "ScriptTask", |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | data() { |
| | | return { |
| | | defaultTaskForm: { |
| | | scriptFormat: "", |
| | | script: "", |
| | | resource: "", |
| | | resultVariable: "" |
| | | }, |
| | | scriptTaskForm: {} |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.$nextTick(() => this.resetTaskForm()); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | resetTaskForm() { |
| | | for (let key in this.defaultTaskForm) { |
| | | let value = this.bpmnElement?.businessObject[key] || this.defaultTaskForm[key]; |
| | | this.scriptTaskForm[key] = value |
| | | } |
| | | this.scriptTaskForm["scriptType"] = this.scriptTaskForm.script ? "inline" : "external" |
| | | }, |
| | | updateElementTask() { |
| | | let taskAttr = Object.create(null); |
| | | taskAttr.scriptFormat = this.scriptTaskForm.scriptFormat || null; |
| | | taskAttr.resultVariable = this.scriptTaskForm.resultVariable || null; |
| | | if (this.scriptTaskForm.scriptType === "inline") { |
| | | taskAttr.script = this.scriptTaskForm.script || null; |
| | | taskAttr.resource = null; |
| | | } else { |
| | | taskAttr.resource = this.scriptTaskForm.resource || null; |
| | | taskAttr.script = null; |
| | | } |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, taskAttr); |
| | | } |
| | | }, |
| | | beforeUnmount() { |
| | | this.bpmnElement = null; |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="margin-top: 16px"> |
| | | <el-row> |
| | | <h4 class="mb-10 fw-700">审æ¹äººè®¾ç½®</h4> |
| | | <el-radio-group v-model="dataType" @change="changeDataType"> |
| | | <el-radio |
| | | v-for="item in USER_TASK_GROUP" |
| | | :key="item.value" |
| | | :label="item.value" |
| | | >{{item.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24" v-if="dataType === USER_TASK_GROUP[0].value"> |
| | | <el-tag v-for="userText in selectedUser.text" :key="userText" effect="plain" closable @close="handleClose(userText)"> |
| | | {{userText}} |
| | | </el-tag> |
| | | <div class="element-drawer__button"> |
| | | <el-button size="default" type="primary" :icon="Plus" @click="onSelectUsers()">æ·»å ç¨æ·</el-button> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="24" v-else-if="dataType === USER_TASK_GROUP[1].value"> |
| | | <el-select v-model="roleIds" multiple size="default" placeholder="è¯·éæ©è§è²" @change="changeSelectRoles" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in roleOptions" |
| | | :key="item.roleId" |
| | | :label="item.roleName" |
| | | :value="`ROLE${item.roleId}`" |
| | | :disabled="item.status === 1"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="24" v-else-if="dataType === USER_TASK_GROUP[2].value"> |
| | | <el-tree-select |
| | | v-model="deptIds" |
| | | :data="deptTreeData" |
| | | :props="deptProps" |
| | | value-key="id" |
| | |  placeholder="éæ©é¨é¨" |
| | | check-strictly |
| | | clearable |
| | | @clear="clearDept" |
| | | ref="selectTree" |
| | | @node-click="checkedDeptChangeNode" |
| | | /> |
| | | |
| | | |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24" v-show="showMultiFlog"> |
| | | <el-divider /> |
| | | <h4><b>å¤å®ä¾å®¡æ¹æ¹å¼</b></h4> |
| | | <el-row> |
| | | <el-radio-group v-model="multiLoopType" @change="changeMultiLoopType()" class="flex-column radio-group-flex"> |
| | | <el-row v-for="item in MULTI_INSTANCE_TYPE" :key="item.value"> |
| | | <el-radio :label="item.value">{{item.label}}</el-radio> |
| | | </el-row> |
| | | </el-radio-group> |
| | | </el-row> |
| | | <el-row v-if="multiLoopType !== MULTI_INSTANCE_TYPE[0].value"> |
| | | <el-tooltip content="å¼å¯åï¼å®ä¾éæé¡ºåºè½®æµå®¡æ¹" placement="top-start" @click.stop.prevent> |
| | | <el-icon><InfoFilled /></el-icon> |
| | | </el-tooltip> |
| | | <span class="custom-label">顺åºå®¡æ¹ï¼</span> |
| | | <el-switch v-model="isSequential" @change="changeMultiLoopType()" /> |
| | | </el-row> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- åéç¨æ·å¼¹çª --> |
| | | <el-dialog title="åéç¨æ·" v-model="userOpen" width="60%" append-to-body> |
| | | <el-row type="flex" :gutter="20"> |
| | | <!--é¨é¨æ°æ®--> |
| | | <el-col :span="7"> |
| | | <el-card shadow="never" style="height: 100%"> |
| | | <div class="head-container"> |
| | | <el-input |
| | | v-model="queryParamsDeptIds" |
| | | placeholder="请è¾å
¥é¨é¨åç§°" |
| | | clearable |
| | | size="small" |
| | | :prefix-icon="Search" |
| | | style="margin-bottom: 20px" |
| | | /> |
| | | <el-tree |
| | | :data="deptOptions" |
| | | :props="deptProps" |
| | | :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" |
| | | ref="deptTree" |
| | | :default-expand-all="false" |
| | | node-key="id" |
| | | highlight-current |
| | | @current-change="handleNodeClick" |
| | | /> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="17"> |
| | | <el-form |
| | | :model="queryParams" |
| | | ref="queryForm" |
| | | size="small" |
| | | :inline="true" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="ç¨æ·åç§°" prop="nickName"> |
| | | <el-input |
| | | v-model="queryParams.nickName" |
| | | placeholder="请è¾å
¥ç¨æ·åç§°" |
| | | clearable |
| | | style="width: 150px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | | :icon="Search" |
| | | @click="handleQuery" |
| | | >æç´¢</el-button> |
| | | <el-button |
| | | :icon="Refresh" |
| | | @click="resetQuery" |
| | | >éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table |
| | | ref="multipleTable" |
| | | height="600" |
| | | v-loading="tableLoading" |
| | | :data="userTableList" |
| | | border |
| | | @row-click="clickRow" |
| | | @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="50" align="center" /> |
| | | <el-table-column label="ç¨æ·å" align="center" prop="nickName" /> |
| | | <el-table-column label="é¨é¨" align="center" prop="dept.deptName" /> |
| | | </el-table> |
| | | <pagination |
| | | :total="userTotal" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </el-col> |
| | | </el-row> |
| | | <template #footer class="dialog-footer"> |
| | | <el-button type="primary" size="default" @click="handleTaskUserComplete">ç¡® å®</el-button> |
| | | <el-button size="default" @click="userOpen = false">å æ¶</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { userList, getDeptTree } from "#/api/system/user"; |
| | | import { roleList } from "#/api/system/role"; |
| | | import { uniqBy } from 'lodash' |
| | | |
| | | const USER_TASK_GROUP = [ |
| | | { |
| | | label: "æå®ç¨æ·", |
| | | value: "USERS", |
| | | }, |
| | | { |
| | | label: "è§è²", |
| | | value: "ROLES", |
| | | }, |
| | | { |
| | | label: "é¨é¨", |
| | | value: "DEPTS", |
| | | }, |
| | | { |
| | | label: "å起人", |
| | | value: "INITIATOR", |
| | | }, |
| | | ] |
| | | const USER_TASK_FORM = { |
| | | dataType: '', |
| | | assignee: '', |
| | | candidateUsers: '', |
| | | candidateGroups: '', |
| | | text: '', |
| | | deptId: '', |
| | | // dueDate: '', |
| | | // followUpDate: '', |
| | | // priority: '' |
| | | } |
| | | const MULTI_INSTANCE_TYPE = [ |
| | | { label: "æ ", value: 'Null' }, |
| | | { label: "ä¼ç¾ï¼éææå®¡æ¹äººåæï¼", value: 'SequentialMultiInstance' }, |
| | | { label: "æç¾ï¼ä¸å审æ¹äººåæå³å¯ï¼", value: 'ParallelMultiInstance' }, |
| | | { label: "èªå®ä¹", value: 'DiyMultiInstance' }, |
| | | ] |
| | | export default { |
| | | name: "UserTask", |
| | | props: { |
| | | id: String, |
| | | type: String |
| | | }, |
| | | setup() { |
| | | |
| | | return { Plus, Search, Refresh } |
| | | }, |
| | | data() { |
| | | return { |
| | | tableLoading: false, |
| | | dataType: USER_TASK_GROUP[0].value, |
| | | selectedUser: { |
| | | ids: [], |
| | | text: [] |
| | | }, |
| | | userOpen: false, |
| | | deptName: undefined, |
| | | deptOptions: [], //é¨é¨å表 |
| | | deptProps: { |
| | | children: "children", |
| | | label: "label", |
| | | value: 'id' |
| | | }, |
| | | userTableList: [], |
| | | userTotal: 0, |
| | | selectedUserDate: [], |
| | | roleOptions: [], |
| | | roleIds: [], |
| | | deptTreeData: [], |
| | | deptIds: [], |
| | | queryParamsDeptIds:[], |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | deptId: undefined, |
| | | nickName: undefined, |
| | | pageNum: 1, |
| | | pageSize: 20, |
| | | }, |
| | | showMultiFlog: false, |
| | | isSequential: false, |
| | | multiLoopType: MULTI_INSTANCE_TYPE[0].value, |
| | | }; |
| | | }, |
| | | watch: { |
| | | id: { |
| | | immediate: true, |
| | | handler() { |
| | | this.bpmnElement = window.bpmnInstances.bpmnElement; |
| | | this.$nextTick(() => this.resetTaskForm()); |
| | | } |
| | | }, |
| | | // æ ¹æ®åç§°çéé¨é¨æ |
| | | queryParamsDeptIds(val) { |
| | | this.$nextTick(() => { |
| | | this.$refs.deptTree.filter(val); |
| | | }) |
| | | } |
| | | }, |
| | | computed: { |
| | | USER_TASK_GROUP() { return USER_TASK_GROUP }, |
| | | MULTI_INSTANCE_TYPE() { return MULTI_INSTANCE_TYPE } |
| | | }, |
| | | methods: { |
| | | // åå§ååé |
| | | async resetTaskForm() { |
| | | const bpmnElementObj = this.bpmnElement?.businessObject; |
| | | if (!bpmnElementObj) { |
| | | return; |
| | | } |
| | | this.clearOptionsData() |
| | | this.dataType = bpmnElementObj.dataType; |
| | | if (this.dataType === USER_TASK_GROUP[0].value) { |
| | | let userIdData = bpmnElementObj['candidateUsers'] || bpmnElementObj['assignee']; |
| | | let userText = bpmnElementObj.text || []; |
| | | if (userIdData && userIdData.toString().length > 0 && userText && userText.length > 0) { |
| | | this.selectedUser.ids = userIdData.toString().split(','); |
| | | this.selectedUser.text = userText.split(','); |
| | | } |
| | | if (this.selectedUser.ids.length > 1) { |
| | | this.showMultiFlog = true; |
| | | } |
| | | } else if (this.dataType === USER_TASK_GROUP[1].value) { |
| | | // è·åè§è²å表 |
| | | this.getRoleOptions(); |
| | | let roleIdData = bpmnElementObj['candidateGroups'] || []; |
| | | if (roleIdData && roleIdData.length > 0) { |
| | | this.roleIds = roleIdData.split(',') |
| | | } |
| | | this.showMultiFlog = true; |
| | | } else if (this.dataType === USER_TASK_GROUP[2].value) { |
| | | // è·åé¨é¨å表 |
| | | await this.getDeptTreeData(); |
| | | let deptIdData = bpmnElementObj['candidateGroups'] || []; |
| | | if (deptIdData && deptIdData.length > 0) { |
| | | this.deptIds = deptIdData.split(','); |
| | | // åæ¾ |
| | | this.checkedDeptChange(this.deptIds); |
| | | } |
| | | this.showMultiFlog = true; |
| | | } |
| | | this.getElementLoop(bpmnElementObj); |
| | | }, |
| | | // æ¸
空éé¡¹æ°æ® |
| | | clearOptionsData() { |
| | | this.selectedUser.ids = []; |
| | | this.selectedUser.text = []; |
| | | this.roleIds = []; |
| | | this.deptIds = []; |
| | | }, |
| | | // æ´æ°èç¹æ°æ® |
| | | updateElementTask() { |
| | | const taskObj = Object.assign({}, { ...USER_TASK_FORM }) |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, taskObj); |
| | | }, |
| | | // æ¥è¯¢é¨é¨ä¸ææ ç»æ |
| | | getDeptOptions() { |
| | | return new Promise((resolve, reject) => { |
| | | if (!this.deptOptions || this.deptOptions.length <= 0) { |
| | | // éæ©é¨é¨æ æ°æ®ç¬¬ä¸æ¬¡è¯·æ± |
| | | getDeptTree().then(response => { |
| | | this.deptOptions = [].concat( |
| | | [{ id: '', label: 'å
¨é¨', children: [] }], |
| | | [...response.data] |
| | | ); |
| | | this.handleNodeClick(this.deptOptions[0]) |
| | | resolve() |
| | | }) |
| | | } else { |
| | | // ç¡®ä¿éæ©é¨é¨æ å·²åå§å ä½ä»è¯·æ±è¡¨æ ¼æ°æ® å¤éæ¡åæ¾ |
| | | this.handleNodeClick(this.deptOptions[0]) |
| | | } |
| | | }); |
| | | }, |
| | | // æ¥è¯¢é¨é¨ä¸ææ ç»æï¼å«é¨é¨åç¼ï¼ |
| | | getDeptTreeData() { |
| | | function refactorTree(data) { |
| | | return data.map(node => { |
| | | let treeData = { id: `DEPT${node.id}`, label: node.label, parentId: node.parentId, weight: node.weight }; |
| | | if (node.children && node.children.length > 0) { |
| | | treeData.children = refactorTree(node.children); |
| | | } |
| | | return treeData; |
| | | }); |
| | | } |
| | | return new Promise((resolve, reject) => { |
| | | if (!this.deptTreeData || this.deptTreeData.length <= 0) { |
| | | getDeptTree().then((res) => { |
| | | this.deptTreeData = refactorTree(res.data); |
| | | resolve() |
| | | }).catch(() => { |
| | | reject() |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | }, |
| | | // æ¥è¯¢é¨é¨ä¸ææ ç»æ |
| | | getRoleOptions() { |
| | | if (!this.roleOptions || this.roleOptions.length <= 0) { |
| | | roleList().then(response => this.roleOptions = response.rows); |
| | | } |
| | | }, |
| | | // æ¥è¯¢ç¨æ·å表 |
| | | getList() { |
| | | this.tableLoading = true |
| | | userList({ ...this.queryParams }).then(response => { |
| | | this.userTableList = response.rows; |
| | | this.userTotal = response.total; |
| | | // this.$nextTick(() => { |
| | | // setTimeout(() => { |
| | | // this.selectedUserDate.forEach(each => { |
| | | // const findObj = this.userTableList.find(find => find.userId === each.userId) || {} |
| | | // if(Object.keys(findObj).length > 0) { |
| | | // this.$refs.multipleTable.toggleRowSelection(findObj) |
| | | // } |
| | | // }) |
| | | // }, 500) |
| | | // }) |
| | | }).finally(() => { |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.$refs.queryForm.resetFields(); |
| | | this.$refs.queryForm.clearValidate(); |
| | | this.queryParams = { |
| | | deptId: '', |
| | | nickName: undefined, |
| | | pageSize: 20 |
| | | }; |
| | | this.handleQuery(); |
| | | }, |
| | | // çéèç¹ |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | return data.label.indexOf(value) !== -1; |
| | | }, |
| | | // èç¹åå»äºä»¶ |
| | | handleNodeClick(data) { |
| | | this.queryParams.deptId = data.id; |
| | | this.handleQuery(); |
| | | }, |
| | | // å
³éæ ç¾ |
| | | handleClose(tag) { |
| | | this.selectedUserDate.splice(this.selectedUserDate.indexOf(tag), 1); |
| | | this.handleTaskUserChange() |
| | | }, |
| | | /** |
| | | * éæ©è¡ |
| | | */ |
| | | clickRow(row) { |
| | | this.$refs.multipleTable.toggleRowSelection(row); |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | if(selection.length) { |
| | | const concatData = [].concat(selection, this.selectedUserDate); |
| | | this.selectedUserDate = uniqBy(concatData, 'userId'); |
| | | } |
| | | }, |
| | | // æ·»å ç¨æ· |
| | | onSelectUsers() { |
| | | this.$nextTick(()=> |
| | | { |
| | | setTimeout(() => { |
| | | this.$refs.multipleTable.clearSelection(),100 |
| | | }) |
| | | }) |
| | | this.getDeptOptions() |
| | | this.userOpen = true; |
| | | |
| | | }, |
| | | // æ·»å ç¨æ·-确认æé® |
| | | handleTaskUserComplete() { |
| | | if (!this.selectedUserDate || this.selectedUserDate.length <= 0) { |
| | | this.$modal.msgError('è¯·éæ©ç¨æ·'); |
| | | return; |
| | | } |
| | | USER_TASK_FORM.dataType = USER_TASK_GROUP[0].value; |
| | | this.handleTaskUserChange() |
| | | this.changeMultiLoopType(); |
| | | this.userOpen = false; |
| | | }, |
| | | // æå®ç¨æ·æ¹åç¡®å® |
| | | handleTaskUserChange() { |
| | | this.selectedUser.text = this.selectedUserDate.map(item => item.nickName) || []; |
| | | if (this.selectedUserDate.length === 1) { |
| | | let data = this.selectedUserDate[0]; |
| | | USER_TASK_FORM.assignee = data.userId; |
| | | USER_TASK_FORM.text = data.nickName; |
| | | USER_TASK_FORM.candidateUsers = null; |
| | | this.showMultiFlog = false; |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[0].value; |
| | | } else { |
| | | USER_TASK_FORM.candidateUsers = this.selectedUserDate.map(item => item.userId).join() || null; |
| | | USER_TASK_FORM.text = this.selectedUserDate.map(item => item.nickName).join() || null; |
| | | USER_TASK_FORM.assignee = null; |
| | | this.showMultiFlog = true; |
| | | } |
| | | this.selectedUserDate=[]; |
| | | this.updateElementTask(); |
| | | }, |
| | | // éä¸è§è² |
| | | changeSelectRoles(roleArray) { |
| | | let groups = null; |
| | | let text = null; |
| | | if (roleArray && roleArray.length > 0) { |
| | | USER_TASK_FORM.dataType = USER_TASK_GROUP[1].value; |
| | | groups = roleArray.join() || null; |
| | | let textArr = this.roleOptions.filter(k => roleArray.indexOf(`ROLE${k.roleId}`) >= 0); |
| | | text = textArr?.map(k => k.roleName).join() || null; |
| | | } else { |
| | | USER_TASK_FORM.dataType = null; |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[0].value; |
| | | } |
| | | USER_TASK_FORM.candidateGroups = groups; |
| | | USER_TASK_FORM.text = text; |
| | | this.updateElementTask(); |
| | | this.changeMultiLoopType(); |
| | | }, |
| | | |
| | | |
| | | checkedDeptChangeNode(node){ |
| | | this.checkedDeptChange([node.id]); |
| | | }, |
| | | clearDept(){ |
| | | USER_TASK_FORM.candidateGroups = ""; |
| | | USER_TASK_FORM.text = ""; |
| | | USER_TASK_FORM.assignee =""; |
| | | USER_TASK_FORM.candidateUsers =""; |
| | | this.updateElementTask(); |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[0].value; |
| | | this.changeMultiLoopType(); |
| | | }, |
| | | // éä¸é¨é¨ |
| | | checkedDeptChange(deptArray) { |
| | | let groups = null; |
| | | let text = null; |
| | | this.deptIds = deptArray[0]; |
| | | if (deptArray && deptArray.length > 0) { |
| | | USER_TASK_FORM.dataType = USER_TASK_GROUP[2].value; |
| | | groups = deptArray.join(',') || null; |
| | | let treeStarkData = JSON.parse(JSON.stringify(this.deptTreeData)); |
| | | const filterData = this.filterTreeData(treeStarkData, deptArray); |
| | | text = filterData.map(item => item.label).join(',') || null |
| | | } else { |
| | | USER_TASK_FORM.dataType = null; |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[0].value; |
| | | } |
| | | USER_TASK_FORM.candidateGroups = groups; |
| | | USER_TASK_FORM.text = text; |
| | | this.updateElementTask(); |
| | | this.changeMultiLoopType(); |
| | | }, |
| | | filterTreeData (data, deptArray) { |
| | | const result = []; |
| | | const traverse = (items) => { |
| | | for (const item of items) { |
| | | // æ£æ¥å½åèç¹æ¯å¦å¨ deptArray ä¸ |
| | | if (deptArray.includes(item.id)) { |
| | | result.push(item); // 妿å¨ï¼æ·»å å°ç»ææ°ç»ä¸ |
| | | } |
| | | |
| | | // 妿æ childrenï¼éå½å¤ç |
| | | if (item.children) { |
| | | traverse(item.children); |
| | | } |
| | | } |
| | | }; |
| | | traverse(data); // å¼å§éå |
| | | return result; // è¿åæå¹³åçç»ææ°ç» |
| | | }, |
| | | |
| | | // ä¿®æ¹å®¡æ¹äººç±»å |
| | | changeDataType(val) { |
| | | if (val === USER_TASK_GROUP[1].value || val === USER_TASK_GROUP[2].value || (val === USER_TASK_GROUP[0].value && this.selectedUser.ids.length > 1)) { |
| | | this.showMultiFlog = true; |
| | | } else { |
| | | this.showMultiFlog = false; |
| | | } |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[0].value; |
| | | this.changeMultiLoopType(); |
| | | // æ¸
空 USER_TASK_FORM ææå±æ§å¼ |
| | | Object.keys(USER_TASK_FORM).forEach(key => USER_TASK_FORM[key] = null); |
| | | USER_TASK_FORM.dataType = val; |
| | | if (val === USER_TASK_GROUP[0].value) { |
| | | if (this.selectedUser && this.selectedUser.ids && this.selectedUser.ids.length > 0) { |
| | | if (this.selectedUser.ids.length === 1) { |
| | | USER_TASK_FORM.assignee = this.selectedUser.ids[0]; |
| | | } else { |
| | | USER_TASK_FORM.candidateUsers = this.selectedUser.ids.join() |
| | | } |
| | | USER_TASK_FORM.text = this.selectedUser.text?.join() || null |
| | | } |
| | | } else if (val === USER_TASK_GROUP[1].value) { |
| | | this.getRoleOptions(); |
| | | if (this.roleIds && this.roleIds.length > 0) { |
| | | USER_TASK_FORM.candidateGroups = this.roleIds.join() || null; |
| | | let textArr = this.roleOptions.filter(k => this.roleIds.indexOf(`ROLE${k.roleId}`) >= 0); |
| | | USER_TASK_FORM.text = textArr?.map(k => k.roleName).join() || null; |
| | | } |
| | | } else if (val === USER_TASK_GROUP[2].value) { |
| | | this.getDeptTreeData(); |
| | | if (this.deptIds && this.deptIds.length > 0) { |
| | | USER_TASK_FORM.candidateGroups = this.deptIds.join() || null; |
| | | let textArr = [] |
| | | let treeStarkData = JSON.parse(JSON.stringify(this.deptTreeData)); |
| | | this.deptIds.forEach(id => { |
| | | let stark = [] |
| | | stark = stark.concat(treeStarkData); |
| | | while(stark.length) { |
| | | let temp = stark.shift(); |
| | | if(temp.children) { |
| | | stark = temp.children.concat(stark); |
| | | } |
| | | if(id === temp.id) { |
| | | textArr.push(temp); |
| | | } |
| | | } |
| | | }) |
| | | USER_TASK_FORM.text = textArr?.map(k => k.label).join() || null; |
| | | } |
| | | } else { |
| | | USER_TASK_FORM.assignee = "${initiator}"; |
| | | USER_TASK_FORM.text = "æµç¨å起人"; |
| | | } |
| | | this.updateElementTask(); |
| | | }, |
| | | // åå§åå¤å®ä¾åé |
| | | getElementLoop(businessObject) { |
| | | if (!businessObject.loopCharacteristics) { |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[0].value; |
| | | return; |
| | | } |
| | | this.isSequential = businessObject.loopCharacteristics.isSequential; |
| | | if (businessObject.loopCharacteristics.completionCondition) { |
| | | if (businessObject.loopCharacteristics.completionCondition.body === "${nrOfCompletedInstances >= nrOfInstances}") { |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[1].value; // ä¼ç¾ |
| | | } else if (businessObject.loopCharacteristics.completionCondition.body === "${nrOfCompletedInstances >= 0}") { |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[2].value; // æç¾ |
| | | } else { |
| | | this.multiLoopType = MULTI_INSTANCE_TYPE[3].value; // èªå®ä¹ |
| | | } |
| | | } |
| | | }, |
| | | // æ´æ°å¤å®ä¾åé |
| | | changeMultiLoopType() { |
| | | // åæ¶å¤å®ä¾é
ç½® |
| | | if (this.multiLoopType === MULTI_INSTANCE_TYPE[0].value) { |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { loopCharacteristics: null, candidateUsers: null }); |
| | | return; |
| | | } |
| | | |
| | | this.multiLoopInstance = window.bpmnInstances.moddle.create("bpmn:MultiInstanceLoopCharacteristics", { isSequential: this.isSequential }); |
| | | // æ´æ°å¤å®ä¾é
ç½® |
| | | window.bpmnInstances.modeling.updateProperties(this.bpmnElement, { |
| | | loopCharacteristics: this.multiLoopInstance, |
| | | assignee: '${assignee}' |
| | | }); |
| | | // 设置审æ¹äºº |
| | | USER_TASK_FORM.assignee = '${assignee}'; |
| | | // 宿æ¡ä»¶ |
| | | let completionCondition = null; |
| | | switch (this.multiLoopType) { |
| | | case MULTI_INSTANCE_TYPE[1].value: |
| | | completionCondition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body: "${nrOfCompletedInstances >= nrOfInstances}" }); |
| | | break; |
| | | case MULTI_INSTANCE_TYPE[2].value: |
| | | completionCondition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body: "${nrOfCompletedInstances > 0}" }); |
| | | break; |
| | | default: |
| | | completionCondition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body: "" }); |
| | | break; |
| | | } |
| | | // æ´æ°æ¨¡å屿§ä¿¡æ¯ |
| | | window.bpmnInstances.modeling.updateModdleProperties(this.bpmnElement, this.multiLoopInstance, { |
| | | collection: MULTI_INSTANCE_TYPE[1].value || MULTI_INSTANCE_TYPE[2].value ? '${multiInstanceHandler.getUserIds(execution)}' : "", |
| | | elementVariable: MULTI_INSTANCE_TYPE[1].value || MULTI_INSTANCE_TYPE[2].value ? 'assignee' : "", |
| | | completionCondition |
| | | }); |
| | | }, |
| | | }, |
| | | beforeDestroy() { |
| | | this.bpmnElement = null; |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | .el-row .el-radio-group { |
| | | margin-bottom: 15px; |
| | | .el-radio { |
| | | line-height: 28px; |
| | | } |
| | | } |
| | | .el-tag { |
| | | margin-bottom: 10px; |
| | | + .el-tag { |
| | | margin-left: 10px; |
| | | } |
| | | } |
| | | |
| | | .custom-label { |
| | | padding-left: 5px; |
| | | font-weight: 500; |
| | | font-size: 14px; |
| | | color: #606266; |
| | | } |
| | | |
| | | .head-container { |
| | | height: 480px; |
| | | overflow-y: auto; |
| | | } |
| | | .el-row .radio-group-flex { |
| | | margin: 15px 0 0 0; |
| | | justify-items: flex-start; |
| | | align-items: flex-start !important; |
| | | } |
| | | </style> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* æ¹å主é¢è²åé */ |
| | | $--color-primary: #1890ff; |
| | | $--color-danger: #ff4d4f; |
| | | |
| | | /* æ¹å icon åä½è·¯å¾åéï¼å¿
é */ |
| | | // $--font-path: '~element-ui/lib/theme-chalk/fonts'; |
| | | |
| | | // @import "~element-ui/packages/theme-chalk/src/index"; |
| | | |
| | | .el-table td, |
| | | .el-table th { |
| | | color: #333; |
| | | } |
| | | .el-drawer__header { |
| | | padding: 16px 16px 8px 16px; |
| | | margin: 0; |
| | | line-height: 24px; |
| | | font-size: 18px; |
| | | color: #303133; |
| | | box-sizing: border-box; |
| | | border-bottom: 1px solid #e8e8e8; |
| | | } |
| | | div[class^="el-drawer"]:focus, |
| | | span:focus { |
| | | outline: none; |
| | | } |
| | | .el-drawer__body { |
| | | box-sizing: border-box; |
| | | padding: 16px; |
| | | width: 100%; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .el-dialog { |
| | | margin-top: 50vh !important; |
| | | transform: translateY(-50%); |
| | | overflow: hidden; |
| | | } |
| | | .el-dialog__wrapper { |
| | | overflow: hidden; |
| | | max-height: 100vh; |
| | | } |
| | | .el-dialog__header { |
| | | padding: 16px 16px 8px 16px; |
| | | box-sizing: border-box; |
| | | border-bottom: 1px solid #e8e8e8; |
| | | } |
| | | .el-dialog__body { |
| | | padding: 16px; |
| | | max-height: 80vh; |
| | | box-sizing: border-box; |
| | | overflow-y: auto; |
| | | } |
| | | .el-dialog__footer { |
| | | padding: 16px; |
| | | box-sizing: border-box; |
| | | border-top: 1px solid #e8e8e8; |
| | | } |
| | | .el-dialog__close { |
| | | font-weight: 600; |
| | | } |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | .el-divider:not(.el-divider--horizontal) { |
| | | margin: 0 8px ; |
| | | } |
| | | .el-divider.el-divider--horizontal { |
| | | margin: 16px 0; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @use "bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css"; |
| | | @use "bpmn-js/dist/assets/diagram-js.css"; |
| | | @use "bpmn-js/dist/assets/bpmn-font/css/bpmn.css"; |
| | | @use "bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css"; |
| | | @use "./process-designer.scss"; |
| | | @use "./process-panel.scss"; |
| | | |
| | | $success-color: #4eb819; |
| | | $primary-color: #409EFF; |
| | | $warning-color: #E6A23C; |
| | | $danger-color: #F56C6C; |
| | | $cancel-color: #909399; |
| | | |
| | | .process-viewer { |
| | | position: relative; |
| | | border: 1px solid #EFEFEF; |
| | | background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImEiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTTAgMTBoNDBNMTAgMHY0ME0wIDIwaDQwTTIwIDB2NDBNMCAzMGg0ME0zMCAwdjQwIiBmaWxsPSJub25lIiBzdHJva2U9IiNlMGUwZTAiIG9wYWNpdHk9Ii4yIi8+PHBhdGggZD0iTTQwIDBIMHY0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIi8+PC9wYXR0ZXJuPjwvZGVmcz48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+') repeat!important; |
| | | |
| | | .success-arrow { |
| | | fill: $success-color; |
| | | stroke: $success-color; |
| | | } |
| | | |
| | | .success-conditional { |
| | | fill: white; |
| | | stroke: $success-color; |
| | | } |
| | | |
| | | .fail-arrow { |
| | | fill: $warning-color; |
| | | stroke: $warning-color; |
| | | } |
| | | |
| | | .fail-conditional { |
| | | fill: white; |
| | | stroke: $warning-color; |
| | | } |
| | | |
| | | .success.djs-connection { |
| | | .djs-visual path { |
| | | stroke: $success-color!important; |
| | | marker-end: url(#sequenceflow-end-white-success)!important; |
| | | } |
| | | } |
| | | |
| | | .success.djs-connection.condition-expression { |
| | | .djs-visual path { |
| | | marker-start: url(#conditional-flow-marker-white-success)!important; |
| | | } |
| | | } |
| | | |
| | | .success.djs-shape { |
| | | .djs-visual rect { |
| | | stroke: $success-color!important; |
| | | fill: $success-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | |
| | | .djs-visual polygon { |
| | | stroke: $success-color!important; |
| | | } |
| | | |
| | | .djs-visual path:nth-child(2) { |
| | | stroke: $success-color!important; |
| | | fill: $success-color!important; |
| | | } |
| | | |
| | | .djs-visual circle { |
| | | stroke: $success-color!important; |
| | | fill: $success-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | } |
| | | |
| | | .primary.djs-shape { |
| | | .djs-visual rect { |
| | | stroke: $primary-color!important; |
| | | fill: $primary-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | |
| | | .djs-visual polygon { |
| | | stroke: $primary-color!important; |
| | | } |
| | | |
| | | .djs-visual circle { |
| | | stroke: $primary-color!important; |
| | | fill: $primary-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | } |
| | | |
| | | .warning.djs-connection { |
| | | .djs-visual path { |
| | | stroke: $warning-color!important; |
| | | marker-end: url(#sequenceflow-end-white-fail)!important; |
| | | } |
| | | } |
| | | |
| | | .warning.djs-connection.condition-expression { |
| | | .djs-visual path { |
| | | marker-start: url(#conditional-flow-marker-white-fail)!important; |
| | | } |
| | | } |
| | | |
| | | .warning.djs-shape { |
| | | .djs-visual rect { |
| | | stroke: $warning-color!important; |
| | | fill: $warning-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | |
| | | .djs-visual polygon { |
| | | stroke: $warning-color!important; |
| | | } |
| | | |
| | | .djs-visual path:nth-child(2) { |
| | | stroke: $warning-color!important; |
| | | fill: $warning-color!important; |
| | | } |
| | | |
| | | .djs-visual circle { |
| | | stroke: $warning-color!important; |
| | | fill: $warning-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | } |
| | | |
| | | .danger.djs-shape { |
| | | .djs-visual rect { |
| | | stroke: $danger-color!important; |
| | | fill: $danger-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | |
| | | .djs-visual polygon { |
| | | stroke: $danger-color!important; |
| | | } |
| | | |
| | | .djs-visual circle { |
| | | stroke: $danger-color!important; |
| | | fill: $danger-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | } |
| | | |
| | | .cancel.djs-shape { |
| | | .djs-visual rect { |
| | | stroke: $cancel-color!important; |
| | | fill: $cancel-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | |
| | | .djs-visual polygon { |
| | | stroke: $cancel-color!important; |
| | | } |
| | | |
| | | .djs-visual circle { |
| | | stroke: $cancel-color!important; |
| | | fill: $cancel-color!important; |
| | | fill-opacity: 0.15!important; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .process-viewer .djs-tooltip-container, .process-viewer .djs-overlay-container, .process-viewer .djs-palette { |
| | | display: none; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import "bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css"; |
| | | @import "diagram-js-minimap/assets/diagram-js-minimap.css"; |
| | | |
| | | // è¾¹æ¡è¢« token-simulation æ ·å¼è¦çäº |
| | | .djs-palette { |
| | | background: var(--palette-background-color); |
| | | border: solid 1px var(--palette-border-color) !important; |
| | | border-radius: 2px; |
| | | } |
| | | |
| | | .my-process-designer { |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 100%; |
| | | height: 100%; |
| | | box-sizing: border-box; |
| | | .my-process-designer__header { |
| | | width: 100%; |
| | | min-height: 36px; |
| | | .el-button { |
| | | text-align: center; |
| | | } |
| | | .el-button-group { |
| | | margin: 4px; |
| | | } |
| | | .el-tooltip__popper { |
| | | .el-button { |
| | | width: 100%; |
| | | text-align: left; |
| | | padding-left: 8px; |
| | | padding-right: 8px; |
| | | } |
| | | .el-button:hover { |
| | | background: rgba(64, 158, 255, 0.8); |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | .align { |
| | | position: relative; |
| | | i { |
| | | &:after { |
| | | content: "|"; |
| | | position: absolute; |
| | | transform: rotate(90deg) translate(200%, -10%); |
| | | } |
| | | } |
| | | } |
| | | .align.align-left i { |
| | | transform: rotate(90deg); |
| | | } |
| | | .align.align-right i { |
| | | transform: rotate(-90deg); |
| | | } |
| | | .align.align-top i { |
| | | transform: rotate(180deg); |
| | | } |
| | | .align.align-bottom i { |
| | | transform: rotate(0deg); |
| | | } |
| | | .align.align-center i { |
| | | transform: rotate(90deg); |
| | | &:after { |
| | | transform: rotate(90deg) translate(0, -10%); |
| | | } |
| | | } |
| | | .align.align-middle i { |
| | | transform: rotate(0deg); |
| | | &:after { |
| | | transform: rotate(90deg) translate(0, -10%); |
| | | } |
| | | } |
| | | } |
| | | .my-process-designer__container { |
| | | display: inline-flex; |
| | | width: 100%; |
| | | flex: 1; |
| | | .my-process-designer__canvas { |
| | | flex: 1; |
| | | height: 100%; |
| | | position: relative; |
| | | background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImEiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTTAgMTBoNDBNMTAgMHY0ME0wIDIwaDQwTTIwIDB2NDBNMCAzMGg0ME0zMCAwdjQwIiBmaWxsPSJub25lIiBzdHJva2U9IiNlMGUwZTAiIG9wYWNpdHk9Ii4yIi8+PHBhdGggZD0iTTQwIDBIMHY0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIi8+PC9wYXR0ZXJuPjwvZGVmcz48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+") |
| | | repeat !important; |
| | | div.toggle-mode { |
| | | display: none; |
| | | } |
| | | } |
| | | .my-process-designer__property-panel { |
| | | height: 100%; |
| | | overflow: scroll; |
| | | overflow-y: auto; |
| | | z-index: 10; |
| | | * { |
| | | box-sizing: border-box; |
| | | } |
| | | } |
| | | svg { |
| | | width: 100%; |
| | | height: 100%; |
| | | min-height: 100%; |
| | | overflow: hidden; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //ä¾§è¾¹æ é
ç½® |
| | | .djs-palette.open { |
| | | .djs-palette-entries { |
| | | div[class^="bpmn-icon-"]:before, |
| | | div[class*="bpmn-icon-"]:before { |
| | | line-height: unset; |
| | | } |
| | | div.entry { |
| | | position: relative; |
| | | } |
| | | div.entry:hover { |
| | | &::after { |
| | | width: max-content; |
| | | content: attr(title); |
| | | vertical-align: text-bottom; |
| | | position: absolute; |
| | | right: -10px; |
| | | top: 0; |
| | | bottom: 0; |
| | | overflow: hidden; |
| | | transform: translateX(100%); |
| | | font-size: 0.5em; |
| | | display: inline-block; |
| | | text-decoration: inherit; |
| | | font-variant: normal; |
| | | text-transform: none; |
| | | background: #fafafa; |
| | | box-shadow: 0 0 6px #eeeeee; |
| | | border: 1px solid #cccccc; |
| | | box-sizing: border-box; |
| | | padding: 0 16px; |
| | | border-radius: 4px; |
| | | z-index: 100; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | pre { |
| | | margin: 0; |
| | | height: 100%; |
| | | overflow: hidden; |
| | | max-height: calc(80vh - 32px); |
| | | overflow-y: auto; |
| | | } |
| | | .hljs { |
| | | word-break: break-word; |
| | | white-space: pre-wrap; |
| | | } |
| | | .hljs * { |
| | | font-family: Consolas, Monaco, monospace; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .process-panel__container { |
| | | box-sizing: border-box; |
| | | padding: 0 8px; |
| | | border-left: 1px solid #eeeeee; |
| | | box-shadow: 0 0 8px #cccccc; |
| | | max-height: 100%; |
| | | overflow-y: scroll; |
| | | } |
| | | .panel-tab__title { |
| | | font-weight: 600; |
| | | padding: 0 8px; |
| | | font-size: 1.1em; |
| | | line-height: 1.2em; |
| | | i { |
| | | margin-right: 8px; |
| | | font-size: 1.2em; |
| | | } |
| | | } |
| | | .panel-tab__content { |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | border-top: 1px solid #eeeeee; |
| | | padding: 8px 16px; |
| | | .panel-tab__content--title { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | padding-bottom: 8px; |
| | | span { |
| | | flex: 1; |
| | | text-align: left; |
| | | } |
| | | } |
| | | } |
| | | .element-property { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: flex-start; |
| | | margin: 8px 0; |
| | | .element-property__label { |
| | | display: block; |
| | | width: 90px; |
| | | text-align: right; |
| | | overflow: hidden; |
| | | padding-right: 12px; |
| | | line-height: 32px; |
| | | font-size: 14px; |
| | | box-sizing: border-box; |
| | | } |
| | | .element-property__value { |
| | | flex: 1; |
| | | line-height: 32px; |
| | | } |
| | | .el-form-item { |
| | | width: 100%; |
| | | margin-bottom: 0; |
| | | padding-bottom: 18px; |
| | | } |
| | | } |
| | | .list-property { |
| | | flex-direction: column; |
| | | .element-listener-item { |
| | | width: 100%; |
| | | display: inline-grid; |
| | | grid-template-columns: 16px auto 32px 32px; |
| | | grid-column-gap: 8px; |
| | | } |
| | | .element-listener-item + .element-listener-item { |
| | | margin-top: 8px; |
| | | } |
| | | } |
| | | .listener-drawer { |
| | | |
| | | .el-drawer__header { |
| | | margin: 0PX; |
| | | padding: 10PX; |
| | | border-bottom: 1px solid #eeeeee; |
| | | .el-drawer__title { |
| | | font-size: 18px |
| | | } |
| | | } |
| | | |
| | | .el-drawer__body { |
| | | .el-form-item__label { |
| | | font-size: 14PX; |
| | | font-weight: 500; |
| | | } |
| | | .input-with-select .el-input-group__prepend { |
| | | background-color: var(--el-fill-color-blank); |
| | | padding: 0; |
| | | } |
| | | } |
| | | } |
| | | .listener-filed__title { |
| | | display: inline-flex; |
| | | width: 100%; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-top: 0; |
| | | span { |
| | | // width: 200px; |
| | | text-align: left; |
| | | font-size: 14px; |
| | | } |
| | | i { |
| | | margin-right: 8px; |
| | | } |
| | | } |
| | | .element-drawer__button { |
| | | margin-top: 8px; |
| | | width: 100%; |
| | | display: inline-flex; |
| | | justify-content: space-around; |
| | | } |
| | | .element-drawer__button > .el-button { |
| | | width: 100%; |
| | | } |
| | | |
| | | .el-collapse-item__content { |
| | | padding-bottom: 0; |
| | | } |
| | | .el-input.is-disabled .el-input__inner { |
| | | color: #999999; |
| | | } |
| | | .el-form-item.el-form-item--mini { |
| | | margin-bottom: 0; |
| | | & + .el-form-item { |
| | | margin-top: 16px; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // å建çå¬å¨å®ä¾ |
| | | export function createListenerObject(options, isTask, prefix) { |
| | | const listenerObj = Object.create(null); |
| | | listenerObj.event = options.event; |
| | | isTask && (listenerObj.id = options.id); // ä»»å¡çå¬å¨ç¹æç id åæ®µ |
| | | switch (options.listenerType) { |
| | | case 'scriptListener': |
| | | listenerObj.script = createScriptObject(options, prefix); |
| | | break; |
| | | case 'expressionListener': |
| | | listenerObj.expression = options.expression; |
| | | break; |
| | | case 'delegateExpressionListener': |
| | | listenerObj.delegateExpression = options.delegateExpression; |
| | | break; |
| | | default: |
| | | listenerObj.class = options.class; |
| | | } |
| | | // 注å
¥å段 |
| | | if (options.fields) { |
| | | listenerObj.fields = options.fields.map(field => { |
| | | return createFieldObject(field, prefix); |
| | | }); |
| | | } |
| | | // ä»»å¡çå¬å¨ç 宿¶å¨ 设置 |
| | | if (isTask && options.event === 'timeout' && !!options.eventDefinitionType) { |
| | | const timeDefinition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { |
| | | body: options.eventTimeDefinitions |
| | | }); |
| | | const TimerEventDefinition = window.bpmnInstances.moddle.create('bpmn:TimerEventDefinition', { |
| | | id: `TimerEventDefinition_${uuid(8)}`, |
| | | [`time${options.eventDefinitionType.replace(/^\S/, s => s.toUpperCase())}`]: timeDefinition |
| | | }); |
| | | listenerObj.eventDefinitions = [TimerEventDefinition]; |
| | | } |
| | | return window.bpmnInstances.moddle.create(`${prefix}:${isTask ? 'TaskListener' : 'ExecutionListener'}`, listenerObj); |
| | | } |
| | | |
| | | // å建 çå¬å¨ç注å
¥å段 å®ä¾ |
| | | export function createFieldObject(option, prefix) { |
| | | const { name, fieldType, string, expression } = option; |
| | | const fieldConfig = fieldType === 'string' ? { name, string } : { name, expression }; |
| | | return window.bpmnInstances.moddle.create(`${prefix}:Field`, fieldConfig); |
| | | } |
| | | |
| | | // åå»ºèæ¬å®ä¾ |
| | | export function createScriptObject(options, prefix) { |
| | | const { scriptType, scriptFormat, value, resource } = options; |
| | | const scriptConfig = scriptType === 'inlineScript' ? { scriptFormat, value } : { scriptFormat, resource }; |
| | | return window.bpmnInstances.moddle.create(`${prefix}:Script`, scriptConfig); |
| | | } |
| | | |
| | | // æ´æ°å
ç´ æ©å±å±æ§ |
| | | export function updateElementExtensions(element, extensionList) { |
| | | const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { |
| | | values: extensionList |
| | | }); |
| | | window.bpmnInstances.modeling.updateProperties(element, { |
| | | extensionElements: extensions |
| | | }); |
| | | } |
| | | |
| | | // å建ä¸ä¸ªid |
| | | export function uuid(length = 8, chars) { |
| | | let result = ''; |
| | | const charsString = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| | | for (let i = length; i > 0; --i) { |
| | | result += charsString[Math.floor(Math.random() * charsString.length)]; |
| | | } |
| | | return result; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable no-func-assign */ |
| | | /** |
| | | * Flatten array, one level deep. |
| | | * |
| | | * @param {Array<?>} arr |
| | | * |
| | | * @return {Array<?>} |
| | | */ |
| | | function flatten(arr) { |
| | | return Array.prototype.concat.apply([], arr); |
| | | } |
| | | |
| | | var nativeToString = Object.prototype.toString; |
| | | var nativeHasOwnProperty = Object.prototype.hasOwnProperty; |
| | | function isUndefined(obj) { |
| | | return obj === undefined; |
| | | } |
| | | function isDefined(obj) { |
| | | return obj !== undefined; |
| | | } |
| | | function isNil(obj) { |
| | | return obj == null; |
| | | } |
| | | function isArray(obj) { |
| | | return nativeToString.call(obj) === '[object Array]'; |
| | | } |
| | | function isObject(obj) { |
| | | return nativeToString.call(obj) === '[object Object]'; |
| | | } |
| | | function isNumber(obj) { |
| | | return nativeToString.call(obj) === '[object Number]'; |
| | | } |
| | | function isFunction(obj) { |
| | | var tag = nativeToString.call(obj); |
| | | return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]'; |
| | | } |
| | | function isString(obj) { |
| | | return nativeToString.call(obj) === '[object String]'; |
| | | } |
| | | /** |
| | | * Ensure collection is an array. |
| | | * |
| | | * @param {Object} obj |
| | | */ |
| | | |
| | | function ensureArray(obj) { |
| | | if (isArray(obj)) { |
| | | return; |
| | | } |
| | | |
| | | throw new Error('must supply array'); |
| | | } |
| | | /** |
| | | * Return true, if target owns a property with the given key. |
| | | * |
| | | * @param {Object} target |
| | | * @param {String} key |
| | | * |
| | | * @return {Boolean} |
| | | */ |
| | | |
| | | function has(target, key) { |
| | | return nativeHasOwnProperty.call(target, key); |
| | | } |
| | | |
| | | /** |
| | | * Find element in collection. |
| | | * |
| | | * @param {Array|Object} collection |
| | | * @param {Function|Object} matcher |
| | | * |
| | | * @return {Object} |
| | | */ |
| | | |
| | | function find(collection, matcher) { |
| | | matcher = toMatcher(matcher); |
| | | var match; |
| | | forEach(collection, function(val, key) { |
| | | if (matcher(val, key)) { |
| | | match = val; |
| | | return false; |
| | | } |
| | | }); |
| | | return match; |
| | | } |
| | | /** |
| | | * Find element index in collection. |
| | | * |
| | | * @param {Array|Object} collection |
| | | * @param {Function} matcher |
| | | * |
| | | * @return {Object} |
| | | */ |
| | | |
| | | function findIndex(collection, matcher) { |
| | | matcher = toMatcher(matcher); |
| | | var idx = isArray(collection) ? -1 : undefined; |
| | | forEach(collection, function(val, key) { |
| | | if (matcher(val, key)) { |
| | | idx = key; |
| | | return false; |
| | | } |
| | | }); |
| | | return idx; |
| | | } |
| | | /** |
| | | * Find element in collection. |
| | | * |
| | | * @param {Array|Object} collection |
| | | * @param {Function} matcher |
| | | * |
| | | * @return {Array} result |
| | | */ |
| | | |
| | | function filter(collection, matcher) { |
| | | var result = []; |
| | | forEach(collection, function(val, key) { |
| | | if (matcher(val, key)) { |
| | | result.push(val); |
| | | } |
| | | }); |
| | | return result; |
| | | } |
| | | /** |
| | | * Iterate over collection; returning something |
| | | * (non-undefined) will stop iteration. |
| | | * |
| | | * @param {Array|Object} collection |
| | | * @param {Function} iterator |
| | | * |
| | | * @return {Object} return result that stopped the iteration |
| | | */ |
| | | |
| | | function forEach(collection, iterator) { |
| | | var val, result; |
| | | |
| | | if (isUndefined(collection)) { |
| | | return; |
| | | } |
| | | |
| | | var convertKey = isArray(collection) ? toNum : identity; |
| | | |
| | | for (var key in collection) { |
| | | if (has(collection, key)) { |
| | | val = collection[key]; |
| | | result = iterator(val, convertKey(key)); |
| | | |
| | | if (result === false) { |
| | | return val; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * Return collection without element. |
| | | * |
| | | * @param {Array} arr |
| | | * @param {Function} matcher |
| | | * |
| | | * @return {Array} |
| | | */ |
| | | |
| | | function without(arr, matcher) { |
| | | if (isUndefined(arr)) { |
| | | return []; |
| | | } |
| | | |
| | | ensureArray(arr); |
| | | matcher = toMatcher(matcher); |
| | | return arr.filter(function(el, idx) { |
| | | return !matcher(el, idx); |
| | | }); |
| | | } |
| | | /** |
| | | * Reduce collection, returning a single result. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * @param {Function} iterator |
| | | * @param {Any} result |
| | | * |
| | | * @return {Any} result returned from last iterator |
| | | */ |
| | | |
| | | function reduce(collection, iterator, result) { |
| | | forEach(collection, function(value, idx) { |
| | | result = iterator(result, value, idx); |
| | | }); |
| | | return result; |
| | | } |
| | | /** |
| | | * Return true if every element in the collection |
| | | * matches the criteria. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * @param {Function} matcher |
| | | * |
| | | * @return {Boolean} |
| | | */ |
| | | |
| | | function every(collection, matcher) { |
| | | return !!reduce(collection, function(matches, val, key) { |
| | | return matches && matcher(val, key); |
| | | }, true); |
| | | } |
| | | /** |
| | | * Return true if some elements in the collection |
| | | * match the criteria. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * @param {Function} matcher |
| | | * |
| | | * @return {Boolean} |
| | | */ |
| | | |
| | | function some(collection, matcher) { |
| | | return !!find(collection, matcher); |
| | | } |
| | | /** |
| | | * Transform a collection into another collection |
| | | * by piping each member through the given fn. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * @param {Function} fn |
| | | * |
| | | * @return {Array} transformed collection |
| | | */ |
| | | |
| | | function map(collection, fn) { |
| | | var result = []; |
| | | forEach(collection, function(val, key) { |
| | | result.push(fn(val, key)); |
| | | }); |
| | | return result; |
| | | } |
| | | /** |
| | | * Get the collections keys. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * |
| | | * @return {Array} |
| | | */ |
| | | |
| | | function keys(collection) { |
| | | return collection && Object.keys(collection) || []; |
| | | } |
| | | /** |
| | | * Shorthand for `keys(o).length`. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * |
| | | * @return {Number} |
| | | */ |
| | | |
| | | function size(collection) { |
| | | return keys(collection).length; |
| | | } |
| | | /** |
| | | * Get the values in the collection. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * |
| | | * @return {Array} |
| | | */ |
| | | |
| | | function values(collection) { |
| | | return map(collection, function(val) { |
| | | return val; |
| | | }); |
| | | } |
| | | /** |
| | | * Group collection members by attribute. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * @param {Function} extractor |
| | | * |
| | | * @return {Object} map with { attrValue => [ a, b, c ] } |
| | | */ |
| | | |
| | | function groupBy(collection, extractor) { |
| | | var grouped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
| | | extractor = toExtractor(extractor); |
| | | forEach(collection, function(val) { |
| | | var discriminator = extractor(val) || '_'; |
| | | var group = grouped[discriminator]; |
| | | |
| | | if (!group) { |
| | | group = grouped[discriminator] = []; |
| | | } |
| | | |
| | | group.push(val); |
| | | }); |
| | | return grouped; |
| | | } |
| | | function uniqueBy(extractor) { |
| | | extractor = toExtractor(extractor); |
| | | var grouped = {}; |
| | | |
| | | for (var _len = arguments.length, collections = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
| | | collections[_key - 1] = arguments[_key]; |
| | | } |
| | | |
| | | forEach(collections, function(c) { |
| | | return groupBy(c, extractor, grouped); |
| | | }); |
| | | var result = map(grouped, function(val, key) { |
| | | return val[0]; |
| | | }); |
| | | return result; |
| | | } |
| | | var unionBy = uniqueBy; |
| | | /** |
| | | * Sort collection by criteria. |
| | | * |
| | | * @param {Object|Array} collection |
| | | * @param {String|Function} extractor |
| | | * |
| | | * @return {Array} |
| | | */ |
| | | |
| | | function sortBy(collection, extractor) { |
| | | extractor = toExtractor(extractor); |
| | | var sorted = []; |
| | | forEach(collection, function(value, key) { |
| | | var disc = extractor(value, key); |
| | | var entry = { |
| | | d: disc, |
| | | v: value |
| | | }; |
| | | |
| | | for (var idx = 0; idx < sorted.length; idx++) { |
| | | var d = sorted[idx].d; |
| | | |
| | | if (disc < d) { |
| | | sorted.splice(idx, 0, entry); |
| | | return; |
| | | } |
| | | } // not inserted, append (!) |
| | | |
| | | sorted.push(entry); |
| | | }); |
| | | return map(sorted, function(e) { |
| | | return e.v; |
| | | }); |
| | | } |
| | | /** |
| | | * Create an object pattern matcher. |
| | | * |
| | | * @example |
| | | * |
| | | * const matcher = matchPattern({ id: 1 }); |
| | | * |
| | | * let element = find(elements, matcher); |
| | | * |
| | | * @param {Object} pattern |
| | | * |
| | | * @return {Function} matcherFn |
| | | */ |
| | | |
| | | function matchPattern(pattern) { |
| | | return function(el) { |
| | | return every(pattern, function(val, key) { |
| | | return el[key] === val; |
| | | }); |
| | | }; |
| | | } |
| | | |
| | | function toExtractor(extractor) { |
| | | return isFunction(extractor) ? extractor : function(e) { |
| | | return e[extractor]; |
| | | }; |
| | | } |
| | | |
| | | function toMatcher(matcher) { |
| | | return isFunction(matcher) ? matcher : function(e) { |
| | | return e === matcher; |
| | | }; |
| | | } |
| | | |
| | | function identity(arg) { |
| | | return arg; |
| | | } |
| | | |
| | | function toNum(arg) { |
| | | return Number(arg); |
| | | } |
| | | |
| | | /** |
| | | * Debounce fn, calling it only once if the given time |
| | | * elapsed between calls. |
| | | * |
| | | * Lodash-style the function exposes methods to `#clear` |
| | | * and `#flush` to control internal behavior. |
| | | * |
| | | * @param {Function} fn |
| | | * @param {Number} timeout |
| | | * |
| | | * @return {Function} debounced function |
| | | */ |
| | | function debounce(fn, timeout) { |
| | | var timer; |
| | | var lastArgs; |
| | | var lastThis; |
| | | var lastNow; |
| | | |
| | | function fire(force) { |
| | | var now = Date.now(); |
| | | var scheduledDiff = force ? 0 : lastNow + timeout - now; |
| | | |
| | | if (scheduledDiff > 0) { |
| | | return schedule(scheduledDiff); |
| | | } |
| | | |
| | | fn.apply(lastThis, lastArgs); |
| | | clear(); |
| | | } |
| | | |
| | | function schedule(timeout) { |
| | | timer = setTimeout(fire, timeout); |
| | | } |
| | | |
| | | function clear() { |
| | | if (timer) { |
| | | clearTimeout(timer); |
| | | } |
| | | |
| | | timer = lastNow = lastArgs = lastThis = undefined; |
| | | } |
| | | |
| | | function flush() { |
| | | if (timer) { |
| | | fire(true); |
| | | } |
| | | |
| | | clear(); |
| | | } |
| | | |
| | | function callback() { |
| | | lastNow = Date.now(); |
| | | |
| | | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
| | | args[_key] = arguments[_key]; |
| | | } |
| | | |
| | | lastArgs = args; |
| | | lastThis = this; // ensure an execution is scheduled |
| | | |
| | | if (!timer) { |
| | | schedule(timeout); |
| | | } |
| | | } |
| | | |
| | | callback.flush = flush; |
| | | callback.cancel = clear; |
| | | return callback; |
| | | } |
| | | /** |
| | | * Throttle fn, calling at most once |
| | | * in the given interval. |
| | | * |
| | | * @param {Function} fn |
| | | * @param {Number} interval |
| | | * |
| | | * @return {Function} throttled function |
| | | */ |
| | | |
| | | function throttle(fn, interval) { |
| | | var throttling = false; |
| | | return function() { |
| | | if (throttling) { |
| | | return; |
| | | } |
| | | |
| | | fn.apply(void 0, arguments); |
| | | throttling = true; |
| | | setTimeout(function() { |
| | | throttling = false; |
| | | }, interval); |
| | | }; |
| | | } |
| | | /** |
| | | * Bind function against target <this>. |
| | | * |
| | | * @param {Function} fn |
| | | * @param {Object} target |
| | | * |
| | | * @return {Function} bound function |
| | | */ |
| | | |
| | | function bind(fn, target) { |
| | | return fn.bind(target); |
| | | } |
| | | |
| | | function _typeof(obj) { |
| | | '@babel/helpers - typeof'; |
| | | |
| | | if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') { |
| | | _typeof = function(obj) { |
| | | return typeof obj; |
| | | }; |
| | | } else { |
| | | _typeof = function(obj) { |
| | | return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; |
| | | }; |
| | | } |
| | | |
| | | return _typeof(obj); |
| | | } |
| | | |
| | | function _extends() { |
| | | _extends = Object.assign || function(target) { |
| | | for (var i = 1; i < arguments.length; i++) { |
| | | var source = arguments[i]; |
| | | |
| | | for (var key in source) { |
| | | if (Object.prototype.hasOwnProperty.call(source, key)) { |
| | | target[key] = source[key]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return target; |
| | | }; |
| | | |
| | | return _extends.apply(this, arguments); |
| | | } |
| | | |
| | | /** |
| | | * Convenience wrapper for `Object.assign`. |
| | | * |
| | | * @param {Object} target |
| | | * @param {...Object} others |
| | | * |
| | | * @return {Object} the target |
| | | */ |
| | | |
| | | function assign(target) { |
| | | for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
| | | others[_key - 1] = arguments[_key]; |
| | | } |
| | | |
| | | return _extends.apply(void 0, [target].concat(others)); |
| | | } |
| | | /** |
| | | * Sets a nested property of a given object to the specified value. |
| | | * |
| | | * This mutates the object and returns it. |
| | | * |
| | | * @param {Object} target The target of the set operation. |
| | | * @param {(string|number)[]} path The path to the nested value. |
| | | * @param {any} value The value to set. |
| | | */ |
| | | |
| | | function set(target, path, value) { |
| | | var currentTarget = target; |
| | | forEach(path, function(key, idx) { |
| | | if (typeof key !== 'number' && typeof key !== 'string') { |
| | | throw new Error('illegal key type: ' + _typeof(key) + '. Key should be of type number or string.'); |
| | | } |
| | | |
| | | if (key === 'constructor') { |
| | | throw new Error('illegal key: constructor'); |
| | | } |
| | | |
| | | if (key === '__proto__') { |
| | | throw new Error('illegal key: __proto__'); |
| | | } |
| | | |
| | | var nextKey = path[idx + 1]; |
| | | var nextTarget = currentTarget[key]; |
| | | |
| | | if (isDefined(nextKey) && isNil(nextTarget)) { |
| | | nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : []; |
| | | } |
| | | |
| | | if (isUndefined(nextKey)) { |
| | | if (isUndefined(value)) { |
| | | delete currentTarget[key]; |
| | | } else { |
| | | currentTarget[key] = value; |
| | | } |
| | | } else { |
| | | currentTarget = nextTarget; |
| | | } |
| | | }); |
| | | return target; |
| | | } |
| | | /** |
| | | * Gets a nested property of a given object. |
| | | * |
| | | * @param {Object} target The target of the get operation. |
| | | * @param {(string|number)[]} path The path to the nested value. |
| | | * @param {any} [defaultValue] The value to return if no value exists. |
| | | */ |
| | | |
| | | function get(target, path, defaultValue) { |
| | | var currentTarget = target; |
| | | forEach(path, function(key) { |
| | | // accessing nil property yields <undefined> |
| | | if (isNil(currentTarget)) { |
| | | currentTarget = undefined; |
| | | return false; |
| | | } |
| | | |
| | | currentTarget = currentTarget[key]; |
| | | }); |
| | | return isUndefined(currentTarget) ? defaultValue : currentTarget; |
| | | } |
| | | /** |
| | | * Pick given properties from the target object. |
| | | * |
| | | * @param {Object} target |
| | | * @param {Array} properties |
| | | * |
| | | * @return {Object} target |
| | | */ |
| | | |
| | | function pick(target, properties) { |
| | | var result = {}; |
| | | var obj = Object(target); |
| | | forEach(properties, function(prop) { |
| | | if (prop in obj) { |
| | | result[prop] = target[prop]; |
| | | } |
| | | }); |
| | | return result; |
| | | } |
| | | /** |
| | | * Pick all target properties, excluding the given ones. |
| | | * |
| | | * @param {Object} target |
| | | * @param {Array} properties |
| | | * |
| | | * @return {Object} target |
| | | */ |
| | | |
| | | function omit(target, properties) { |
| | | var result = {}; |
| | | var obj = Object(target); |
| | | forEach(obj, function(prop, key) { |
| | | if (properties.indexOf(key) === -1) { |
| | | result[key] = prop; |
| | | } |
| | | }); |
| | | return result; |
| | | } |
| | | /** |
| | | * Recursively merge `...sources` into given target. |
| | | * |
| | | * Does support merging objects; does not support merging arrays. |
| | | * |
| | | * @param {Object} target |
| | | * @param {...Object} sources |
| | | * |
| | | * @return {Object} the target |
| | | */ |
| | | |
| | | function merge(target) { |
| | | for (var _len2 = arguments.length, sources = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { |
| | | sources[_key2 - 1] = arguments[_key2]; |
| | | } |
| | | |
| | | if (!sources.length) { |
| | | return target; |
| | | } |
| | | |
| | | forEach(sources, function(source) { |
| | | // skip non-obj sources, i.e. null |
| | | if (!source || !isObject(source)) { |
| | | return; |
| | | } |
| | | |
| | | forEach(source, function(sourceVal, key) { |
| | | if (key === '__proto__') { |
| | | return; |
| | | } |
| | | |
| | | var targetVal = target[key]; |
| | | |
| | | if (isObject(sourceVal)) { |
| | | if (!isObject(targetVal)) { |
| | | // override target[key] with object |
| | | targetVal = {}; |
| | | } |
| | | |
| | | target[key] = merge(targetVal, sourceVal); |
| | | } else { |
| | | target[key] = sourceVal; |
| | | } |
| | | }); |
| | | }); |
| | | return target; |
| | | } |
| | | |
| | | export { assign, bind, debounce, ensureArray, every, filter, find, findIndex, flatten, forEach, get, groupBy, has, isArray, isDefined, isFunction, isNil, isNumber, isObject, isString, isUndefined, keys, map, matchPattern, merge, omit, pick, reduce, set, size, some, sortBy, throttle, unionBy, uniqueBy, values, without }; |
| | |
| | | <script setup lang="ts"> |
| | | import type { VbenFormProps } from '@vben/common-ui'; |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { nextTick } from 'vue'; |
| | | |
| | | import { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { categoryList, categoryRemove } from '#/api/workflow/category'; |
| | | |
| | | import categoryModal from './category-modal.vue'; |
| | | import { columns, querySchema } from './data'; |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | | labelWidth: 80, |
| | | componentProps: { |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | schema: querySchema(), |
| | | wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', |
| | | }; |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: { |
| | | enabled: false, |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async (_, formValues = {}) => { |
| | | const resp = await categoryList({ |
| | | ...formValues, |
| | | }); |
| | | return { rows: resp }; |
| | | }, |
| | | // é»è®¤è¯·æ±æ¥å£åå±å¼å
¨é¨ ä¸éè¦å¯ä»¥å é¤è¿æ®µ |
| | | querySuccess: () => { |
| | | nextTick(() => { |
| | | expandAll(); |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | /** |
| | | * èææ»å¨ é»è®¤å
³é |
| | | */ |
| | | scrollY: { |
| | | enabled: false, |
| | | gt: 0, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'categoryId', |
| | | }, |
| | | treeConfig: { |
| | | parentField: 'parentId', |
| | | rowField: 'categoryId', |
| | | transform: true, |
| | | }, |
| | | // è¡¨æ ¼å
¨å±å¯ä¸è¡¨ç¤º ä¿ååé
ç½®éè¦ç¨å° |
| | | id: 'workflow-category-index', |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions }); |
| | | const [CategoryModal, modalApi] = useVbenModal({ |
| | | connectedComponent: categoryModal, |
| | | }); |
| | | |
| | | function handleAdd(row?: Recordable<any>) { |
| | | modalApi.setData({ parentId: row?.categoryId }); |
| | | modalApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(row: Recordable<any>) { |
| | | modalApi.setData({ id: row.categoryId }); |
| | | modalApi.open(); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await categoryRemove(row.categoryId); |
| | | await tableApi.query(); |
| | | } |
| | | |
| | | function expandAll() { |
| | | tableApi.grid?.setAllTreeExpand(true); |
| | | } |
| | | |
| | | function collapseAll() { |
| | | tableApi.grid?.setAllTreeExpand(false); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <BasicTable table-title="æµç¨åç±»å表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button @click="collapseAll"> |
| | | {{ $t('pages.common.collapse') }} |
| | | </a-button> |
| | | <a-button @click="expandAll"> |
| | | {{ $t('pages.common.expand') }} |
| | | </a-button> |
| | | <a-button |
| | | type="primary" |
| | | v-access:code="['workflow:category:add']" |
| | | @click="handleAdd" |
| | | > |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px"> |
| | | <el-form-item label="åç±»åç§°" prop="categoryName"> |
| | | <el-input v-model="queryParams.categoryName" placeholder="请è¾å
¥åç±»åç§°" clearable @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="åç±»ç¼ç " prop="code"> |
| | | <el-input v-model="queryParams.code" placeholder="请è¾å
¥åç±»ç¼ç " clearable @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['workflow:category:add']">æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['workflow:category:edit']"> |
| | | ä¿®æ¹ |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['workflow:category:remove']"> |
| | | å é¤ |
| | | </el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button |
| | | v-access:code="['workflow:category:edit']" |
| | | @click.stop="handleEdit(row)" |
| | | > |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <ghost-button |
| | | class="btn-success" |
| | | v-access:code="['workflow:category:edit']" |
| | | @click.stop="handleAdd(row)" |
| | | > |
| | | {{ $t('pages.common.add') }} |
| | | </ghost-button> |
| | | <Popconfirm |
| | | :get-popup-container="getVxePopupContainer" |
| | | placement="left" |
| | | title="确认å é¤ï¼" |
| | | @confirm="handleDelete(row)" |
| | | > |
| | | <ghost-button |
| | | danger |
| | | v-access:code="['workflow:category:remove']" |
| | | @click.stop="" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | |
| | | <el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="åç±»ç¼å·" align="center" prop="categoryId" v-if="true" /> |
| | | <el-table-column label="åç±»åç§°" align="center" prop="categoryName" /> |
| | | <el-table-column label="åç±»ç¼ç " align="center" prop="code" /> |
| | | <el-table-column label="夿³¨" align="center" prop="remark" /> |
| | | <el-table-column label="æä½" align="center" width="150" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="ä¿®æ¹" placement="top"> |
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['workflow:category:edit']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['workflow:category:remove']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </BasicTable> |
| | | <CategoryModal @reload="tableApi.query()" /> |
| | | </Page> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | |
| | | <!-- æ·»å æä¿®æ¹åæ°é
ç½®å¯¹è¯æ¡ --> |
| | | <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> |
| | | <el-form ref="categoryFormRef" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="åç±»åç§°" prop="categoryName"> |
| | | <el-input v-model="form.categoryName" placeholder="请è¾å
¥åç±»åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="åç±»ç¼ç " prop="code"> |
| | | <el-input v-model="form.code" placeholder="请è¾å
¥åç±»ç¼ç " /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="form.remark" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Category" > |
| | | import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "#/api/workflow/category"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const categoryList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | |
| | | const queryFormRef = ref(); |
| | | const categoryFormRef = ref(); |
| | | const dialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | const initFormData = { |
| | | categoryId: undefined, |
| | | categoryName: '', |
| | | code: '', |
| | | remark: '' |
| | | } |
| | | const data = reactive({ |
| | | form: {...initFormData}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | categoryName: '', |
| | | code: '' |
| | | }, |
| | | rules: { |
| | | categoryName: [{ required: true, message: "åç±»åç§°ä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | code: [{ required: true, message: "åç±»ç¼ç ä¸è½ä¸ºç©º", trigger: "blur" }] |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | /** æ¥è¯¢åæ°å表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listCategory(queryParams.value); |
| | | categoryList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** åæ¶æé® */ |
| | | const cancel = () => { |
| | | reset(); |
| | | dialog.visible = false; |
| | | } |
| | | /** 表åéç½® */ |
| | | const reset = () => { |
| | | form.value = {...initFormData}; |
| | | categoryFormRef.value.resetFields(); |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | const handleSelectionChange = (selection) => { |
| | | ids.value = selection.map(item => item.categoryId); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | /** æ°å¢æé®æä½ */ |
| | | const handleAdd = () => { |
| | | dialog.visible = true; |
| | | dialog.title = "æ·»å åæ°"; |
| | | nextTick(() => { |
| | | reset(); |
| | | }) |
| | | } |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | const handleUpdate = (row) => { |
| | | dialog.visible = true; |
| | | dialog.title = "ä¿®æ¹åæ°"; |
| | | const categoryId = row?.categoryId || ids.value[0]; |
| | | nextTick(async () => { |
| | | reset(); |
| | | const res = await getCategory(categoryId); |
| | | form.value = res.data; |
| | | }) |
| | | } |
| | | /** æäº¤æé® */ |
| | | const submitForm = () => { |
| | | categoryFormRef.value.validate(async (valid) => { |
| | | if (valid) { |
| | | form.value.categoryId ? await updateCategory(form.value) : await addCategory(form.value); |
| | | proxy?.$modal.msgSuccess("æä½æå"); |
| | | dialog.visible = false; |
| | | getList(); |
| | | } |
| | | }); |
| | | } |
| | | /** å é¤æé®æä½ */ |
| | | const handleDelete = async (row) => { |
| | | const categoryIds = row?.categoryId || ids.value; |
| | | await proxy?.$modal.confirm('æ¯å¦ç¡®è®¤å é¤åæ°ç¼å·ä¸º"' + categoryIds + '"çæ°æ®é¡¹ï¼'); |
| | | await delCategory(categoryIds); |
| | | getList(); |
| | | proxy?.$modal.msgSuccess("å 餿å"); |
| | | } |
| | | /** å¯¼åºæé®æä½ */ |
| | | const handleExport = () => { |
| | | proxy?.download("workflow/category/export", { |
| | | ...queryParams.value |
| | | }, `category_${new Date().getTime()}.xlsx`); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }) |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px"> |
| | | <el-form-item label="æµç¨æ è¯" prop="processKey"> |
| | | <el-input v-model="queryParams.processKey" placeholder="请è¾å
¥æµç¨æ è¯" clearable @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç§°" prop="processName"> |
| | | <el-input v-model="queryParams.processName" placeholder="请è¾å
¥æµç¨åç§°" clearable @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="æµç¨åç±»" style="width: 240px"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="state"> |
| | | <el-select v-model="queryParams.state" clearable placeholder="è¯·éæ©ç¶æ" style="width: 240px"> |
| | | <el-option :key="1" label="æ¿æ´»" value="active" /> |
| | | <el-option :key="2" label="æèµ·" value="suspended" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['workflow:deploy:remove']"> |
| | | å é¤ |
| | | </el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" fit :data="deployList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="æµç¨æ è¯" align="center" prop="processKey" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" prop="processName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç±»" align="center" prop="categoryName" :formatter="categoryFormat" /> |
| | | <el-table-column label="æµç¨çæ¬" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag size="small">v{{ scope.row.version }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¶æ" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag type="success" v-if="!scope.row.suspended">æ¿æ´»</el-tag> |
| | | <el-tag type="warning" v-if="scope.row.suspended">æèµ·</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="é¨ç½²æ¶é´" align="center" prop="deploymentTime" width="180" > |
| | | <template #default="scope"> |
| | | {{ parseTime(scope.row.deploymentTime, '{y}-{m}-{d} {h}:{i}:{s}')}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="çæ¬ç®¡ç" placement="top"> |
| | | <el-button link type="primary" icon="PriceTag" @click="handlePublish(scope.row)" v-hasPermi="['workflow:deploy:list']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['workflow:deploy:remove']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | |
| | | <!-- <!– æµç¨å¾å¯¹è¯æ¡ –>--> |
| | | <!-- <el-dialog :title="processDialog.title" v-model="processDialog.visible" width="500px" append-to-body>--> |
| | | <!-- <process-viewer :key="`designer-${processView.index}`" :xml="processView.xmlData" :style="{height: '400px'}" />--> |
| | | <!-- </el-dialog>--> |
| | | |
| | | <!-- çæ¬ç®¡ç --> |
| | | <el-dialog title="çæ¬ç®¡ç" v-model="publishDialog.visible" width="700px" append-to-body> |
| | | <el-table v-loading="publishLoading" :data="publishList"> |
| | | <el-table-column label="æµç¨æ è¯" align="center" prop="processKey" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <a class="link-type" @click="handleProcessView(scope.row)"> |
| | | <span>{{ scope.row.processName }}</span> |
| | | </a> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æµç¨çæ¬" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag size="small">v{{ scope.row.version }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¶æ" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag type="success" v-if="!scope.row.suspended">æ¿æ´»</el-tag> |
| | | <el-tag type="warning" v-if="scope.row.suspended">æèµ·</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="æèµ·" placement="top"> |
| | | <el-button link type="primary" icon="VideoPause" @click="handleChangeState(scope.row, 'suspended')" v-hasPermi="['workflow:deploy:status']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="æ¿æ´»" placement="top"> |
| | | <el-button link type="primary" icon="VideoPlay" @click="handleChangeState(scope.row, 'active')" v-hasPermi="['workflow:deploy:status']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['workflow:deploy:remove']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="publishTotal > 0" :total="publishTotal" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getPublishList" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Deploy" lang="js"> |
| | | import { listAllCategory } from '#/api/workflow/category' |
| | | import { listDeploy, listPublish, getBpmnXml, changeState, delDeploy } from '#/api/workflow/deploy' |
| | | import { ElForm } from 'element-plus'; |
| | | |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const categoryOptions = ref([]); |
| | | |
| | | const deployList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true) |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const publishList = ref([]); |
| | | const publishLoading = ref(true); |
| | | const publishTotal = ref(0); |
| | | |
| | | const queryFormRef = ref(); |
| | | const processDialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | const publishDialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | const data = reactive({ |
| | | form: {}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | processKey: '', |
| | | processName: '', |
| | | category: '' |
| | | }, |
| | | rules: {} |
| | | }); |
| | | const { queryParams } = toRefs(data); |
| | | |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | }; |
| | | |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listDeploy(queryParams.value); |
| | | deployList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | const handleSelectionChange = (selection) => { |
| | | ids.value = selection.map(item => item.deploymentId); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | /** å é¤æé®æä½ */ |
| | | const handleDelete = async (row) => { |
| | | const deploymentIds = row.deploymentId || ids.value; |
| | | await proxy.$modal.confirm('æ¯å¦ç¡®è®¤å é¤åæ°ç¼å·ä¸º"' + deploymentIds + '"çæ°æ®é¡¹ï¼'); |
| | | await delDeploy(deploymentIds); |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | } |
| | | const getPublishList = async () => { |
| | | publishLoading.value = true; |
| | | const res = await listPublish(queryParams.value); |
| | | publishList.value = res.rows; |
| | | publishTotal.value = res.total; |
| | | publishLoading.value = false; |
| | | } |
| | | const handlePublish = (row) => { |
| | | queryParams.value.processKey = row.processKey; |
| | | publishDialog.visible = true; |
| | | getPublishList(); |
| | | } |
| | | const handleProcessView = (row) => { |
| | | |
| | | } |
| | | const handleChangeState = async (row, state) => { |
| | | const params = { |
| | | definitionId: row.definitionId, |
| | | state: state |
| | | } |
| | | await changeState(params); |
| | | proxy.$modal.msgSuccess("æä½æå"); |
| | | getPublishList(); |
| | | } |
| | | |
| | | const categoryFormat = (row) => { |
| | | var category = categoryOptions.value.find(function(k) { |
| | | return k.code === row.category; |
| | | }); |
| | | return category ? category.categoryName : ''; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getCategoryList(); |
| | | getList(); |
| | | }) |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="表ååç§°" prop="formName"> |
| | | <el-input v-model="queryParams.formName" placeholder="请è¾å
¥è¡¨ååç§°" clearable @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['workflow:form:add']">æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['workflow:form:edit']">ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['workflow:form:remove']">å é¤</el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" :data="formList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="表å主é®" align="center" prop="formId" v-if="false" /> |
| | | <el-table-column label="表ååç§°" align="center" prop="formName" /> |
| | | <el-table-column label="夿³¨" align="center" prop="remark" /> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="详æ
" placement="top"> |
| | | <el-button link type="primary" icon="View" @click="handleDetail(scope.row)" v-hasPermi="['workflow:form:query']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="ä¿®æ¹" placement="top"> |
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['workflow:form:edit']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['workflow:form:remove']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | |
| | | <!-- æµç¨è¡¨å设计å¨å¯¹è¯æ¡ --> |
| | | <el-dialog :title="designer.title" v-model="designer.visible" fullscreen> |
| | | <div id="form-designer"> |
| | | <v-form-designer ref="vfDesignerRef" :resetFormJson="true" :designer-config="designerConfig"> |
| | | <!-- èªå®ä¹æé®ææ§½ --> |
| | | <template #customToolButtons> |
| | | <el-button link type="primary" icon="Finished" @click="dialog.visible = true">ä¿å</el-button> |
| | | </template> |
| | | </v-form-designer> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- é¢è§è¡¨åå¯¹è¯æ¡ --> |
| | | <el-dialog :title="render.title" v-model="render.visible" width="60%" append-to-body> |
| | | <v-form-render :form-json="{}" :form-data="{}" ref="vfRenderRef" /> |
| | | </el-dialog> |
| | | |
| | | <!-- æ·»å æä¿®æ¹æµç¨è¡¨åå¯¹è¯æ¡ --> |
| | | <el-dialog :title="dialog.title" v-model="dialog.visible" width="600px" append-to-body> |
| | | <el-form ref="formFormRef" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="表ååç§°" prop="formName"> |
| | | <el-input v-model="form.formName" placeholder="请è¾å
¥è¡¨ååç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="form.remark" placeholder="请è¾å
¥å¤æ³¨" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Form" > |
| | | import { listForm, addForm, updateForm, getForm, delForm } from "#/api/workflow/form"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const formList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | |
| | | const vfDesignerRef = ref(null); |
| | | const vfRenderRef = ref(null); |
| | | const formFormRef = ref(); |
| | | const queryFormRef = ref(); |
| | | |
| | | const designerConfig = reactive({ |
| | | externalLink: true, |
| | | toolbarMaxWidth: 510, |
| | | // languageMenu: true, |
| | | //externalLink: false, |
| | | //formTemplates: false, |
| | | //eventCollapse: false, |
| | | //clearDesignerButton: false, |
| | | //previewFormButton: false, |
| | | }) |
| | | const designer = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }) |
| | | const render = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }) |
| | | const dialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | const initFormData = { |
| | | formId: undefined, |
| | | formName: '', |
| | | content: '', |
| | | remark: '' |
| | | } |
| | | const data = reactive({ |
| | | form: {...initFormData}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | formName: '' |
| | | }, |
| | | rules: { |
| | | formName: [{ required: true, message: "表ååç§°ä¸è½ä¸ºç©º", trigger: "blur" }] |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | /** æ¥è¯¢å²ä½å表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listForm(queryParams.value); |
| | | formList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** åæ¶æé® */ |
| | | const cancel = () => { |
| | | reset(); |
| | | dialog.visible = false; |
| | | } |
| | | /** 表åéç½® */ |
| | | const reset = () => { |
| | | form.value = {...initFormData}; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | const handleSelectionChange = (selection) => { |
| | | ids.value = selection.map(item => item.formId); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | /** æ°å¢è¡¨åæä½ */ |
| | | const handleAdd = () => { |
| | | designer.visible = true; |
| | | nextTick(() => { |
| | | reset(); |
| | | vfDesignerRef.value.clearDesigner(); |
| | | }) |
| | | } |
| | | /** ä¿®æ¹è¡¨åæä½ */ |
| | | const handleUpdate = (row) => { |
| | | designer.visible = true; |
| | | nextTick(async () => { |
| | | const formId = row?.formId || ids.value[0]; |
| | | const res = await getForm(formId); |
| | | form.value = res.data; |
| | | vfDesignerRef.value.setFormJson(form.value.content); |
| | | }) |
| | | } |
| | | /** æ¥ç表åæä½ */ |
| | | const handleDetail = (row) => { |
| | | render.visible = true; |
| | | render.title = 'æ¥ç表å详æ
'; |
| | | nextTick(async () => { |
| | | vfRenderRef.value.setFormJson(row.content || {formConfig: {}, widgetList: []}); |
| | | }); |
| | | } |
| | | /** æäº¤è¡¨åæä½ */ |
| | | const submitForm = () => { |
| | | const formJson = vfDesignerRef.value.getFormJson(); |
| | | form.value.content = JSON.stringify(formJson); |
| | | nextTick(async () => { |
| | | form.value.formId ? await updateForm(form.value) : await addForm(form.value); |
| | | proxy?.$modal.msgSuccess("æä½æå"); |
| | | dialog.visible = false; |
| | | designer.visible = false; |
| | | getList(); |
| | | }) |
| | | } |
| | | /** å é¤æé®æä½ */ |
| | | const handleDelete = async (row) => { |
| | | const formIds = row?.formId || ids.value; |
| | | await proxy?.$modal.confirm('æ¯å¦ç¡®è®¤å é¤è¡¨åç¼å·ä¸º"' + formIds + '"çæ°æ®é¡¹ï¼'); |
| | | await delForm(formIds); |
| | | getList(); |
| | | proxy?.$modal.msgSuccess("å 餿å"); |
| | | } |
| | | /** å¯¼åºæé®æä½ */ |
| | | const handleExport = () => { |
| | | proxy?.download("workflow/form/export", { |
| | | ...queryParams.value |
| | | }, `form_${new Date().getTime()}.xlsx`); |
| | | } |
| | | |
| | | getList(); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | #form-designer { |
| | | .main-container { |
| | | margin: 0; |
| | | } |
| | | label { |
| | | font-weight: normal; |
| | | } |
| | | :deep(.external-link) { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æ¥è¯¢æ¡ä»¶ --> |
| | | <div v-show="showSearch" class="search"> |
| | | <el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="120"> |
| | | <el-form-item label="çå¬ç±»å" prop="listenerType"> |
| | | <el-select v-model="queryParams.listenerType" clearable placeholder="è¯·éæ©çå¬ç±»å" @change="handleQuery"> |
| | | <el-option v-for="dict in sys_listener_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="queryParams.name" clearable placeholder="请è¾å
¥åç§°" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="äºä»¶ç±»å" prop="eventType"> |
| | | <el-select v-model="queryParams.eventType" clearable placeholder="è¯·éæ©äºä»¶ç±»å" @change="handleQuery"> |
| | | <el-option |
| | | v-for="dict in sys_task_listener_event_type" |
| | | v-if="queryParams.listenerType === 'task'" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-option |
| | | v-for="dict in sys_execution_listener_event_type" |
| | | v-if="queryParams.listenerType === 'execution'" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-option |
| | | v-for="dict in sys_task_listener_event_type" |
| | | v-if="!queryParams.listenerType" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-option |
| | | v-for="dict in sys_execution_listener_event_type" |
| | | v-if="!queryParams.listenerType" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button icon="Search" type="primary" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <!-- æä½æé® --> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button v-hasPermi="['workflow:listener:add']" icon="Plus" plain type="primary" @click="handleAdd">æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button v-hasPermi="['workflow:listener:edit']" :disabled="single" icon="Edit" plain type="success" @click="handleUpdate()" |
| | | >ä¿®æ¹</el-button |
| | | > |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button v-hasPermi="['workflow:listener:remove']" :disabled="multiple" icon="Delete" plain type="danger" @click="handleDelete()" |
| | | >å é¤</el-button |
| | | > |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button v-hasPermi="['workflow:listener:export']" icon="Download" plain type="warning" @click="handleExport">导åº</el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <!-- å页å表 --> |
| | | <el-table |
| | | v-loading="tableLoading" |
| | | :data="listenerList" |
| | | @selection-change="handleSelectionChange" |
| | | v-fixTableHeight |
| | | highlight-current-row |
| | | show-overflow-tooltip |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column type="expand" width="50px"> |
| | | <template #default="props"> |
| | | <el-table :data="props.row.fields" width="60%"> |
| | | <el-table-column v-if="false" label="主é®" prop="id" /> |
| | | <el-table-column label="åæ®µåç§°" prop="fieldName" /> |
| | | <el-table-column label="åæ®µç±»å" prop="fieldType"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_listener_field_type" :value="scope.row.fieldType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åæ®µå¼" prop="fieldValue" /> |
| | | <el-table-column align="center" class-name="small-padding fixed-width" label="æä½"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="ä¿®æ¹" placement="top"> |
| | | <el-button |
| | | v-hasPermi="['workflow:listener:edit']" |
| | | icon="Edit" |
| | | link |
| | | type="primary" |
| | | @click="handleFieldUpdate(scope.row)" |
| | | ></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button |
| | | v-hasPermi="['workflow:listener:remove']" |
| | | icon="Delete" |
| | | link |
| | | type="danger" |
| | | @click="handleFieldDelete(scope.row)" |
| | | ></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="false" align="center" label="主é®" prop="id" /> |
| | | <el-table-column align="center" label="çå¬ç±»å" prop="listenerType"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_listener_type" :value="scope.row.listenerType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="åç§°" prop="name" /> |
| | | <el-table-column align="center" label="å¼ç±»å" prop="valueType"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_listener_value_type" :value="scope.row.valueType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="å¼" prop="value" /> |
| | | <el-table-column align="center" label="äºä»¶ç±»å" prop="eventType"> |
| | | <template #default="scope"> |
| | | <dict-tag v-if="scope.row.listenerType === 'task'" :options="sys_task_listener_event_type" :value="scope.row.eventType" /> |
| | | <dict-tag v-if="scope.row.listenerType === 'execution'" :options="sys_execution_listener_event_type" :value="scope.row.eventType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" class-name="small-padding fixed-width" label="æä½"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="æ·»å åæ®µ" placement="top"> |
| | | <el-button v-hasPermi="['workflow:listener:edit']" icon="Plus" link type="primary" @click="addField(scope.row)"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="ä¿®æ¹" placement="top"> |
| | | <el-button v-hasPermi="['workflow:listener:edit']" icon="Edit" link type="primary" @click="handleUpdate(scope.row)"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button v-hasPermi="['workflow:listener:remove']" icon="Delete" link type="danger" @click="handleDelete(scope.row)"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" /> |
| | | </el-card> |
| | | |
| | | <!-- æ·»å æä¿®æ¹æµç¨è¡¨åå¯¹è¯æ¡ --> |
| | | <el-dialog v-model="dialog.visible" :close-on-click-modal="false" :title="dialog.title" append-to-body width="600px"> |
| | | <el-form ref="listenerFormRef" v-loading="formLoading" :model="form" :rules="rules" label-width="120px"> |
| | | <el-form-item label="çå¬ç±»å" prop="listenerType"> |
| | | <el-radio-group v-model="form.listenerType"> |
| | | <el-radio v-for="dict in sys_listener_type" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请è¾å
¥åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="å¼ç±»å" prop="valueType"> |
| | | <el-radio-group v-model="form.valueType"> |
| | | <el-radio v-for="dict in sys_listener_value_type" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="å¼" prop="value"> |
| | | <el-input v-model="form.value" placeholder="请è¾å
¥å¼" /> |
| | | </el-form-item> |
| | | <el-form-item label="äºä»¶ç±»å" prop="eventType"> |
| | | <el-select v-model="form.eventType" clearable placeholder="è¯·éæ©äºä»¶ç±»å" style="width: 100%"> |
| | | <el-option |
| | | v-for="dict in sys_task_listener_event_type" |
| | | v-if="form.listenerType === 'task'" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-option |
| | | v-for="dict in sys_execution_listener_event_type" |
| | | v-if="form.listenerType === 'execution'" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- çå¬å¨åæ®µå¯¹è¯æ¡ --> |
| | | <el-dialog v-model="fieldDialog.visible" :close-on-click-modal="false" :title="fieldDialog.title" append-to-body width="600px"> |
| | | <el-form ref="listenerFieldFormRef" v-loading="fieldFormLoading" :model="initFieldFormData" :rules="filedRules" label-width="120px"> |
| | | <el-form-item label="åç§°" prop="fieldName"> |
| | | <el-input v-model="filedForm.fieldName" placeholder="请è¾å
¥åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ®µç±»å" prop="fieldType"> |
| | | <el-radio-group v-model="filedForm.fieldType"> |
| | | <el-radio v-for="dict in sys_listener_field_type" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="å¼" prop="fieldValue"> |
| | | <el-input v-model="filedForm.fieldValue" placeholder="请è¾å
¥å¼" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitFieldForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script name="Form" setup> |
| | | getList(); |
| | | |
| | | import { |
| | | addListener, |
| | | deleteListenerFieldAPI, |
| | | delListener, |
| | | getListener, |
| | | insertListenerFieldAPI, |
| | | queryListenerPage, |
| | | updateListener, |
| | | updateListenerFieldAPI |
| | | } from "#/api/workflow/listener"; |
| | | |
| | | |
| | | |
| | | const { proxy } = getCurrentInstance() ; |
| | | const { |
| | | sys_listener_type, |
| | | sys_listener_value_type, |
| | | sys_task_listener_event_type, |
| | | sys_execution_listener_event_type, |
| | | sys_listener_field_type |
| | | } = proxy.useDict("sys_listener_type", "sys_listener_value_type", "sys_task_listener_event_type", "sys_execution_listener_event_type", "sys_listener_field_type"); |
| | | |
| | | const listenerList = ref([]); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const names = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const tableLoading = ref(false); |
| | | const formLoading = ref(false); |
| | | const fieldFormLoading = ref(false); |
| | | const listenerFormRef = ref(); |
| | | const listenerFieldFormRef = ref(); |
| | | const queryFormRef = ref(); |
| | | const listenerId = ref(''); |
| | | |
| | | const dialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | |
| | | const fieldDialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | const initFormData = { |
| | | id: undefined, |
| | | valueType: '', |
| | | eventType: '', |
| | | listenerType: '', |
| | | name: '', |
| | | value: '' |
| | | } |
| | | |
| | | const data = reactive({ |
| | | form: {...initFormData}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | name: '', |
| | | listenerType: '', |
| | | eventType: '' |
| | | }, |
| | | rules: { |
| | | listenerType: [{ required: true, message: "çå¬ç±»åä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | name: [{ required: true, message: "åç§°ä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | valueType: [{ required: true, message: "å¼ç±»åä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | value: [{ required: true, message: "å¼ä¸è½ä¸ºç©º", trigger: "blur" }] |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | const initFieldFormData={ |
| | | id: undefined, |
| | | listenerId: undefined, |
| | | fieldName: undefined, |
| | | fieldType: undefined, |
| | | fieldValue: undefined |
| | | } |
| | | |
| | | const filedData = reactive({ |
| | | filedForm: {...initFieldFormData}, |
| | | filedRules: { |
| | | fieldName: [{ required: true, message: "请è¾å
¥å段åç§°", trigger: "blur" }], |
| | | fieldType: [{ required: true, message: "è¯·éæ©åæ®µç±»å", trigger: "blur" }] |
| | | } |
| | | }) |
| | | |
| | | const { filedForm, filedRules } = toRefs(filedData); |
| | | |
| | | /** æ¥è¯¢å表 */ |
| | | const getList = async () => { |
| | | tableLoading.value = true; |
| | | const res = await queryListenerPage(queryParams.value); |
| | | listenerList.value = res.rows; |
| | | total.value = res.total; |
| | | tableLoading.value = false; |
| | | } |
| | | /** åæ¶æé® */ |
| | | const cancel = () => { |
| | | reset(); |
| | | dialog.visible = false; |
| | | fieldDialog.visible = false; |
| | | } |
| | | /** 表åéç½® */ |
| | | const reset = () => { |
| | | form.value = {...initFormData}; |
| | | filedForm.value = {...initFieldFormData}; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | const handleSelectionChange = (selection) => { |
| | | ids.value = selection.map(item => item.id); |
| | | names.value = selection.map(item => item.name); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | /** æ°å¢è¡¨åæä½ */ |
| | | const handleAdd = () => { |
| | | dialog.visible = true; |
| | | nextTick(() => { |
| | | reset(); |
| | | }) |
| | | } |
| | | /** ä¿®æ¹è¡¨åæä½ */ |
| | | const handleUpdate = (row) => { |
| | | dialog.visible = true; |
| | | const id = row?.id || ids.value[0]; |
| | | nextTick(async () => { |
| | | formLoading.value = true; |
| | | reset(); |
| | | const res = await getListener(id); |
| | | formLoading.value = false; |
| | | form.value = res.data; |
| | | }) |
| | | } |
| | | /** æäº¤è¡¨åæä½ */ |
| | | const submitForm = () => { |
| | | listenerFormRef.value.validate(async (valid) => { |
| | | if (valid) { |
| | | dialog.visible = true; |
| | | formLoading.value = true; |
| | | try { |
| | | form.value.id ? await updateListener(form.value) : await addListener(form.value); |
| | | } finally { |
| | | formLoading.value = false; |
| | | } |
| | | dialog.visible = false; |
| | | proxy?.$modal.msgSuccess("æä½æå"); |
| | | getList(); |
| | | } |
| | | }); |
| | | } |
| | | /** å é¤æé®æä½ */ |
| | | const handleDelete = async (row) => { |
| | | const listenerIds = row?.id || ids.value; |
| | | const listenerNames = row?.name || ids.value; |
| | | await proxy?.$modal.confirm('æ¯å¦ç¡®è®¤å é¤ã' + listenerNames + 'ãçæ°æ®é¡¹ï¼'); |
| | | tableLoading.value = true; |
| | | try { |
| | | await delListener(listenerIds); |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | getList(); |
| | | proxy?.$modal.msgSuccess("å 餿å"); |
| | | } |
| | | /** æ·»å åæ®µæä½ */ |
| | | const addField = (ro) => { |
| | | fieldDialog.visible = true; |
| | | // listenerField.value = row.fields; |
| | | listenerId.value = row.id; |
| | | nextTick(() => { |
| | | reset(); |
| | | filedForm.value.listenerId = row.id; |
| | | }) |
| | | } |
| | | /** ä¿®æ¹å段æä½ */ |
| | | const handleFieldUpdate = (row) => { |
| | | fieldDialog.visible = true; |
| | | filedForm.value.id = row.id; |
| | | filedForm.value.listenerId = row.listenerId; |
| | | filedForm.value.fieldName = row.fieldName; |
| | | filedForm.value.fieldType = row.fieldType; |
| | | filedForm.value.fieldValue = row.fieldValue; |
| | | } |
| | | /** æäº¤å段表åæä½ */ |
| | | const submitFieldForm = () => { |
| | | listenerFieldFormRef.value.validate(async (vali) => { |
| | | if (valid) { |
| | | fieldDialog.visible = true; |
| | | fieldFormLoading.value = true; |
| | | try { |
| | | filedForm.value.id ? await updateListenerFieldAPI(filedForm.value) : await insertListenerFieldAPI(filedForm.value); |
| | | } finally { |
| | | fieldFormLoading.value = false; |
| | | } |
| | | listenerId.value = ''; |
| | | fieldDialog.visible = false; |
| | | proxy.$modal.msgSuccess("æä½æå"); |
| | | getList(); |
| | | } |
| | | }); |
| | | } |
| | | /** å é¤å段æé®æä½ */ |
| | | const handleFieldDelete = async (ro) => { |
| | | const fieldIds = row?.id || ids.value; |
| | | const fieldNames = row?.fieldName || ids.value; |
| | | await proxy?.$modal.confirm('æ¯å¦ç¡®è®¤å é¤ã' + fieldNames + 'ãçæ°æ®é¡¹ï¼'); |
| | | tableLoading.value = true; |
| | | try { |
| | | await deleteListenerFieldAPI(fieldIds); |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | getList(); |
| | | proxy?.$modal.msgSuccess("å 餿å"); |
| | | } |
| | | /** å¯¼åºæé®æä½ */ |
| | | const handleExport = () => { |
| | | proxy?.download("workflow/form/export", { |
| | | ...queryParams.value |
| | | }, `form_${new Date().getTime()}.xlsx`); |
| | | } |
| | | |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="æ¨¡åæ è¯" prop="modelKey"> |
| | | <el-input v-model="queryParams.modelKey" placeholder="请è¾å
¥æ¨¡åæ è¯" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="模ååç§°" prop="modelName"> |
| | | <el-input v-model="queryParams.modelName" placeholder="请è¾å
¥æ¨¡ååç§°" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="è¯·éæ©" @change="handleQuery" style="width: 240px"> |
| | | <el-option |
| | | v-for="item in categoryOptions" |
| | | :key="item.categoryId" |
| | | :label="item.categoryName" |
| | | :value="item.code"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['workflow:model:add']">æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete" v-hasPermi="['workflow:model:remove']">å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['workflow:model:export']">导åº</el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" :data="modelList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="æ¨¡åæ è¯" align="center" prop="modelKey" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="模ååç§°" align="center" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <a class="link-type" @click="handleProcessView(scope.row)"> |
| | | <span>{{ scope.row.modelName }}</span> |
| | | </a> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æµç¨åç±»" align="center" prop="categoryName" :formatter="categoryFormat" /> |
| | | <el-table-column label="模åçæ¬" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag size="small">v{{ scope.row.version }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æè¿°" align="center" prop="description" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180" > |
| | | <template #default="scope"> |
| | | {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}')}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="ä¿®æ¹" placement="top"> |
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['workflow:model:edit']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['workflow:model:remove']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="设计" placement="top"> |
| | | <el-button link type="primary" icon="Brush" @click="handleDesigner(scope.row)" v-hasPermi="['workflow:model:designer']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="é¨ç½²" placement="top"> |
| | | <el-button link type="primary" icon="Promotion" @click="handleDeploy(scope.row)" v-hasPermi="['workflow:model:deploy']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="åå²" placement="top"> |
| | | <el-button link type="primary" icon="Discount" @click="handleHistory(scope.row)" v-hasPermi="['workflow:model:list']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | |
| | | <!-- æ·»å æä¿®æ¹æ¨¡åä¿¡æ¯å¯¹è¯æ¡ --> |
| | | <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> |
| | | <el-form ref="modelFormRef" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="æ¨¡åæ è¯" prop="modelKey"> |
| | | <el-input v-model="form.modelKey" clearable disabled placeholder="请è¾å
¥æ¨¡åæ è¯" /> |
| | | </el-form-item> |
| | | <el-form-item label="模ååç§°" prop="modelName"> |
| | | <el-input v-model="form.modelName" clearable :disabled="form.modelId !== undefined" placeholder="请è¾å
¥æ¨¡ååç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="form.category" placeholder="è¯·éæ©" clearable style="width:100%"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æè¿°" prop="description"> |
| | | <el-input v-model="form.description" type="textarea" placeholder="请è¾å
¥å
容" maxlength="200" show-word-limit /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <el-dialog :title="designer.title" v-model="designer.visible" append-to-body fullscreen> |
| | | <ProcessDesigner |
| | | :key="`designer-${reloadIndex}`" |
| | | ref="modelDesignerRef" |
| | | v-loading="designerLoading" |
| | | :designer-form="designerForm" |
| | | :bpmn-xml="bpmnXml" |
| | | @save="onSaveDesigner" |
| | | /> |
| | | </el-dialog> |
| | | |
| | | <el-dialog :title="history.title" v-model="history.visible" append-to-body> |
| | | <el-table v-loading="historyLoading" :data="historyList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="æ¨¡åæ è¯" align="center" prop="modelKey" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="模ååç§°" align="center" prop="modelName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç±»" align="center" prop="categoryName" :formatter="categoryFormat" /> |
| | | <el-table-column label="模åçæ¬" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag>v{{ scope.row.version }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æè¿°" align="center" prop="description" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180" /> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="é¨ç½²" placement="top"> |
| | | <el-button link type="primary" icon="Promotion" @click="handleDeploy(scope.row)" v-hasPermi="['workflow:model:deploy']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="è®¾ä¸ºææ°" placement="top"> |
| | | <el-button link type="primary" icon="Star" @click="handleLatest(scope.row)" v-hasPermi="['workflow:model:save']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-dialog> |
| | | |
| | | <!-- æµç¨å¾ --> |
| | | <el-dialog :title="processDialog.title" v-model="processDialog.visible" width="70%"> |
| | | <ProcessViewer :key="`designer-${reloadIndex}`" :xml="processXml" :style="{height: '650px'}" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { getBpmnXml, listModel, historyModel, latestModel, addModel, updateModel, saveModel, delModel, deployModel, getModel } from "#/api/workflow/model"; |
| | | import { listAllCategory } from "#/api/workflow/category"; |
| | | |
| | | import {getCurrentInstance,ref,reactive,toRefs,onMounted} from "vue"; |
| | | import {useRouter} from "vue-router"; |
| | | import { defineAsyncComponent } from "vue"; |
| | | // 弿¥å è½½ç»ä»¶ |
| | | const ProcessDesigner = defineAsyncComponent(() => |
| | | import('#/components/ProcessDesigner/index.vue') |
| | | ); |
| | | const ProcessViewer = defineAsyncComponent(() => |
| | | import('#/components/ProcessViewer/index.vue') |
| | | ); |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const modelList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const categoryOptions = ref([]); |
| | | const designerLoading = ref(true); |
| | | const bpmnXml = ref(''); |
| | | const reloadIndex = ref(0); |
| | | const processXml = ref(""); |
| | | |
| | | const historyList = ref([]); |
| | | const historyLoading = ref(true); |
| | | const historyTotal = ref(0); |
| | | |
| | | const modelFormRef = ref(); |
| | | const queryFormRef = ref(); |
| | | const modelDesignerRef = ref(null) |
| | | |
| | | const dialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | |
| | | const processDialog = reactive({ |
| | | visible: false, |
| | | title: 'æµç¨å¾' |
| | | }); |
| | | |
| | | const designer = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | |
| | | const history = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | |
| | | const initFormData={ |
| | | modelId: undefined, |
| | | modelKey: `Process_${new Date().getTime()}`, |
| | | modelName: `ä¸å¡æµç¨_${new Date().getTime()}`, |
| | | category: '', |
| | | description: '', |
| | | formType: undefined, |
| | | formId: undefined, |
| | | bpmnXml: '', |
| | | newVersion: false |
| | | } |
| | | |
| | | const data = reactive({ |
| | | form: {...initFormData}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | modelKey: '', |
| | | modelName: '', |
| | | category: '' |
| | | }, |
| | | rules: { |
| | | modelKey: [{ required: true, message: "å²ä½åç§°ä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | modelName: [{ required: true, message: "å²ä½ç¼ç ä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | } |
| | | }); |
| | | |
| | | const designerForm = reactive({ |
| | | modelId: '', |
| | | form: { |
| | | processName: '', |
| | | processKey: '' |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | const router = useRouter(); |
| | | |
| | | /** æ¥è¯¢æ¨¡åå表 */ |
| | | const getList = async () => { |
| | | // loading.value = true; |
| | | const res = await listModel(queryParams.value); |
| | | console.log(res) |
| | | modelList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** åæ¶æé® */ |
| | | const cancel = () => { |
| | | reset(); |
| | | dialog.visible = false; |
| | | } |
| | | /** 表åéç½® */ |
| | | const reset = () => { |
| | | form.value = {...initFormData}; |
| | | modelFormRef.value.resetFields(); |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | const handleSelectionChange = (selection) => { |
| | | ids.value = selection.map(item => item.modelId); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | /** æ°å¢æé®æä½ */ |
| | | const handleAdd = () => { |
| | | dialog.visible = true; |
| | | dialog.title = "æ·»å æ¨¡å"; |
| | | nextTick(() => { |
| | | reset(); |
| | | }) |
| | | } |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | const handleUpdate = (row) => { |
| | | dialog.visible = true; |
| | | dialog.title = "ä¿®æ¹æ¨¡å"; |
| | | nextTick(async () => { |
| | | reset(); |
| | | const modelId = row.modelId || ids.value[0]; |
| | | const res = await getModel(modelId); |
| | | form.value = res.data; |
| | | }); |
| | | }; |
| | | /** å é¤æé®æä½ */ |
| | | const handleDelete = async (row) => { |
| | | const modelIds = row.modelId || ids.value; |
| | | await proxy?.$modal.confirm('æ¯å¦ç¡®è®¤å é¤åæ°ç¼å·ä¸º"' + modelIds + '"çæ°æ®é¡¹ï¼'); |
| | | await delModel(modelIds); |
| | | getList(); |
| | | proxy?.$modal.msgSuccess("å 餿å"); |
| | | } |
| | | /** å¯¼åºæé®æä½ */ |
| | | const handleExport = () => { |
| | | proxy?.download("workflow/model/export", { |
| | | ...queryParams.value |
| | | }, `model_${new Date().getTime()}.xlsx`); |
| | | }; |
| | | /** æ¥çæµç¨å¾ */ |
| | | const handleProcessView = async (row) => { |
| | | reloadIndex.value++; |
| | | // åé请æ±ï¼è·åxml |
| | | const res = await getBpmnXml(row.modelId); |
| | | processXml.value = res.data; |
| | | processDialog.visible = true; |
| | | } |
| | | /** 设计æé®æä½ */ |
| | | const handleDesigner = async (row) => { |
| | | reloadIndex.value++; |
| | | designerForm.modelId = row.modelId; |
| | | const res = await getBpmnXml(row.modelId); |
| | | bpmnXml.value = res.data || ''; |
| | | designerLoading.value = false; |
| | | designer.title = "æµç¨è®¾è®¡ - " + row.modelName; |
| | | designer.visible = true; |
| | | } |
| | | const handleDeploy = (row) => { |
| | | loading.value = true; |
| | | nextTick(async () => { |
| | | await deployModel({ modelId: row?.modelId }); |
| | | proxy.$modal.msgSuccess("æä½æå"); |
| | | router.push({ |
| | | name: 'Deploy', |
| | | path: '/workflow/deploy' |
| | | }); |
| | | loading.value = false; |
| | | }); |
| | | } |
| | | const handleLatest = async (row) => { |
| | | await proxy.$modal.confirm('æ¯å¦å°æ¤æ¨¡åä¿å为æ°çæ¬?'); |
| | | historyLoading.value = true; |
| | | await latestModel({modelId: row.modelId}); |
| | | history.visible = false; |
| | | getList(); |
| | | proxy?.$modal.msgSuccess("æä½æå"); |
| | | historyLoading.value = false; |
| | | } |
| | | /** æ¥è¯¢åå²å表 */ |
| | | const getHistoryList = async () => { |
| | | historyLoading.value = true; |
| | | const res = await historyModel(queryParams.value); |
| | | historyList.value = res.rows; |
| | | historyTotal.value = res.total; |
| | | historyLoading.value = false; |
| | | } |
| | | const handleHistory = (row) => { |
| | | history.visible = true; |
| | | history.title = "模ååå²"; |
| | | queryParams.value.modelKey = row?.modelKey; |
| | | getHistoryList(); |
| | | } |
| | | /** æäº¤è¡¨åæä½ */ |
| | | const submitForm = () => { |
| | | modelFormRef.value.validate(async (valid) => { |
| | | if (valid) { |
| | | form.value.modelId ? await updateModel(form.value) : await addModel(form.value); |
| | | proxy.$modal.msgSuccess("æä½æå"); |
| | | dialog.visible = false; |
| | | getList(); |
| | | } |
| | | }) |
| | | } |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | } |
| | | |
| | | const onSaveDesigner = async (str) => { |
| | | bpmnXml.value = str; |
| | | let dataBody = { |
| | | modelId: designerForm.modelId, |
| | | bpmnXml: str |
| | | } |
| | | proxy.$modal.confirm('æ¯å¦å°æ¤æ¨¡åä¿å为æ°çæ¬?').then(() => { |
| | | confirmSave(dataBody, true) |
| | | }).catch(action => { |
| | | if (action === 'cancel') { |
| | | confirmSave(dataBody, false) |
| | | } |
| | | }) |
| | | } |
| | | const confirmSave = async (body, newVersion) => { |
| | | designerLoading.value = true; |
| | | console.log(body,"body"); |
| | | await saveModel(Object.assign(body, { newVersion: newVersion })); |
| | | getList(); |
| | | proxy.$modal.msgSuccess("ä¿åæå"); |
| | | designerLoading.value = false; |
| | | designer.visible = false; |
| | | } |
| | | |
| | | const categoryFormat = (row) => { |
| | | var category = categoryOptions.value.find(function(k) { |
| | | return k.code === row.category; |
| | | }); |
| | | return category ? category.categoryName : ''; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getCategoryList() |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .el-dialog__body { |
| | | max-height: calc(100vh) !important; |
| | | overflow-y: auto; |
| | | overflow-x: hidden; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="æµç¨åç§°" prop="processName"> |
| | | <el-input v-model="queryParams.processName" placeholder="请è¾å
¥æµç¨åç§°" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="è¯·éæ©" style="width: 240px"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¥æ¶æ¶é´" style="width: 308px;"> |
| | | <el-date-picker |
| | | v-model="dateRange" |
| | | value-format="YYYY-MM-DD" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | |
| | | <el-table v-loading="loading" :data="claimList"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="ä»»å¡ç¼å·" align="center" prop="taskId" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" prop="procDefName" /> |
| | | <el-table-column label="ä»»å¡èç¹" align="center" prop="taskName" /> |
| | | <el-table-column label="æµç¨çæ¬" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag>v{{scope.row.procDefVersion}}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æµç¨å起人" align="center" prop="startUserName" /> |
| | | <el-table-column label="æ¥æ¶æ¶é´" align="center" prop="createTime" width="180" /> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="ç¾æ¶" placement="top"> |
| | | <el-button link type="primary" icon="EditPen" @click="handleClaim(scope.row)" v-hasPermi="['workflow:process:claim']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Claim" lang="js"> |
| | | import { listClaimProcess } from "#/api/workflow/work/process"; |
| | | import { claimTask } from "#/api/workflow/work/task"; |
| | | |
| | | import { listAllCategory } from "#/api/workflow/category"; |
| | | |
| | | const router = useRouter(); |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const claimList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const dateRange = ref(['','']); |
| | | const categoryOptions = ref([]); |
| | | const queryFormRef = ref(); |
| | | |
| | | const queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | processName: '' |
| | | }); |
| | | |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | } |
| | | /** æ¥è¯¢å¾
åå表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listClaimProcess(proxy.addDateRange(queryParams.value, dateRange.value)); |
| | | claimList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** ç¾æ¶æé®æä½ */ |
| | | const handleClaim = async (row) => { |
| | | const res = await claimTask({ taskId: row.taskId }) |
| | | proxy.$modal.msgSuccess(res.msg); |
| | | router.push({ path: '/work/todo' }) |
| | | } |
| | | |
| | | const categoryFormat = (row) => { |
| | | var category = categoryOptions.value.find(function(k) { |
| | | return k.code === row.category; |
| | | }); |
| | | return category && category.categoryName ? category.categoryName : ''; |
| | | } |
| | | onMounted(() => { |
| | | getCategoryList(); |
| | | getList(); |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="æµç¨åç§°" prop="processName"> |
| | | <el-input v-model="queryParams.processName" placeholder="请è¾å
¥æµç¨åç§°" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="è¯·éæ©" style="width: 240px"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å起人" prop="originatorName"> |
| | | <el-input v-model="queryParams.originatorName" placeholder="请è¾å
¥å起人" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" :data="copyList"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="æéç¼å·" align="center" prop="copyId" /> |
| | | <el-table-column label="æ é¢" align="center" prop="title" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" prop="processName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç±»" align="center" prop="categoryId" :formatter="categoryFormat" /> |
| | | <el-table-column label="å起人" align="center" prop="originatorName" /> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime"> |
| | | <template #default="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="详æ
" placement="top"> |
| | | <el-button link type="primary" icon="View" @click="handleDetails(scope.row)" v-hasPermi="['workflow:process:query']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Copy" lang="js"> |
| | | import { listCopyProcess } from "#/api/workflow/work/process" |
| | | const router = useRouter(); |
| | | import { listAllCategory } from "#/api/workflow/category"; |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const copyList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const categoryOptions = ref([]); |
| | | const queryFormRef = ref(); |
| | | |
| | | const queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | processName: "", |
| | | originatorName: "", |
| | | category: '' |
| | | }); |
| | | |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | } |
| | | /** æ¥è¯¢å¾
åå表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listCopyProcess(queryParams.value); |
| | | copyList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** æµç¨è¯¦æ
*/ |
| | | const handleDetails = (row) => { |
| | | router.push({ |
| | | path: '/workflow/process/detail/' + row.instanceId, |
| | | query: { |
| | | processed: false |
| | | } |
| | | }) |
| | | } |
| | | const categoryFormat = (row) => { |
| | | var category = categoryOptions.value.find(function(find) { |
| | | return find.code === row.categoryId; |
| | | }); |
| | | return category && category.categoryName ? category.categoryName : ''; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getCategoryList(); |
| | | getList(); |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-tabs tab-position="top" :model-value="processed === true ? 'approval' : 'form'"> |
| | | <el-tab-pane label="ä»»å¡åç" name="approval" v-if="processed === true"> |
| | | <el-card class="box-card" shadow="hover" v-if="taskFormOpen"> |
| | | <template #header> |
| | | <span>å¡«å表å</span> |
| | | </template> |
| | | <div class="cu-content"> |
| | | <v-form-render :form-json="{}" :form-data="{}" ref="vfRenderRef" /> |
| | | </div> |
| | | </el-card> |
| | | <el-card class="box-card" shadow="hover"> |
| | | <template #header> |
| | | <span>å®¡æ¹æµç¨</span> |
| | | </template> |
| | | <el-row> |
| | | <el-col :span="20" :offset="2"> |
| | | <el-form ref="taskFormRef" :model="taskForm" :rules="rules" label-width="120px"> |
| | | <el-form-item label="å®¡æ¹æè§" prop="comment"> |
| | | <el-input type="textarea" :rows="5" v-model="taskForm.comment" placeholder="请è¾å
¥ å®¡æ¹æè§" /> |
| | | </el-form-item> |
| | | <el-form-item label="æé人" prop="copyUserIds"> |
| | | <el-tag :key="index" v-for="(item, index) in copyUser" closable :disable-transitions="false" @close="handleClose('copy', item)"> |
| | | {{ item.nickName }} |
| | | </el-tag> |
| | | <el-button class="button-new-tag" type="primary" icon="el-icon-plus" circle @click="onSelectCopyUsers" /> |
| | | </el-form-item> |
| | | <el-form-item label="æå®å®¡æ¹äºº" prop="copyUserIds"> |
| | | <el-tag :key="index" v-for="(item, index) in nextUser" closable :disable-transitions="false" @close="handleClose('next', item)"> |
| | | {{ item.nickName }} |
| | | </el-tag> |
| | | <el-button class="button-new-tag" type="primary" icon="el-icon-plus" circle @click="onSelectNextUsers" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="10" type="flex" justify="center"> |
| | | <el-col :span="1.5"> |
| | | <el-button icon="CircleCheck" type="success" @click="handleComplete">éè¿</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button icon="ChatLineSquare" type="primary" @click="handleDelegate">å§æ´¾</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button icon="Switch" type="success" @click="handleTransfer">转å</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button icon="RefreshLeft" type="warning" @click="handleReturn">éå</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button icon="CircleClose" type="danger" @click="handleReject">æç»</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | </el-tab-pane> |
| | | |
| | | <el-tab-pane label="表åä¿¡æ¯" name="form"> |
| | | <div v-if="formVisible"> |
| | | <el-card class="box-card" shadow="never" v-for="(item, index) in processFormList" :key="index"> |
| | | <template #header> |
| | | <span>{{ item.title }}</span> |
| | | </template> |
| | | <!--æµç¨å¤çè¡¨åæ¨¡å--> |
| | | <div class="cu-content"> |
| | | <v-form-render :form-json="item.formModel" :form-data="item.formData" ref="vFormRenderRef" /> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </el-tab-pane> |
| | | |
| | | <el-tab-pane label="æµè½¬è®°å½" name="record"> |
| | | <el-card class="box-card" shadow="never"> |
| | | <el-col :span="20" :offset="2"> |
| | | <div class="block"> |
| | | <el-timeline> |
| | | <el-timeline-item v-for="(item, index) in historyProcNodeList" :key="index" :type="tagType(item.endTime)"> |
| | | <p style="font-weight: 700">{{ item.activityName }}</p> |
| | | <el-card v-if="item.activityType === 'startEvent'" class="box-card" shadow="hover"> |
| | | {{ item.assigneeName }} å¨ {{ item.createTime }} åèµ·æµç¨ |
| | | </el-card> |
| | | <el-card v-if="item.activityType === 'userTask'" class="box-card" shadow="hover"> |
| | | <el-descriptions :column="5" :labelStyle="{'font-weight': 'bold'}"> |
| | | <el-descriptions-item label="å®é
åç">{{ item.assigneeName || '-'}}</el-descriptions-item> |
| | | <el-descriptions-item label="åéåç">{{ item.candidate || '-'}}</el-descriptions-item> |
| | | <el-descriptions-item label="æ¥æ¶æ¶é´">{{ item.createTime || '-'}}</el-descriptions-item> |
| | | <el-descriptions-item label="åç»æ¶é´">{{ item.endTime || '-' }}</el-descriptions-item> |
| | | <el-descriptions-item label="èæ¶">{{ item.duration || '-'}}</el-descriptions-item> |
| | | </el-descriptions> |
| | | <div v-if="item.commentList && item.commentList.length > 0"> |
| | | <div v-for="(comment, index) in item.commentList" :key="index"> |
| | | <el-divider content-position="left"> |
| | | <el-tag :type="approveTypeTag(comment.type)">{{ commentType(comment.type) }}</el-tag> |
| | | <el-tag type="info" effect="plain">{{ parseTime(comment.time, '{y}-{m}-{d} {h}:{i}:{s}')}}</el-tag> |
| | | </el-divider> |
| | | <span>{{ comment.fullMessage }}</span> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | <el-card v-if="item.activityType === 'endEvent'" class="box-card" shadow="hover"> |
| | | {{ item.createTime }} ç»ææµç¨ |
| | | </el-card> |
| | | </el-timeline-item> |
| | | </el-timeline> |
| | | </div> |
| | | </el-col> |
| | | </el-card> |
| | | </el-tab-pane> |
| | | |
| | | <el-tab-pane label="æµç¨è·è¸ª" name="track"> |
| | | <el-card class="box-card" shadow="never"> |
| | | <ProcessViewer |
| | | :key="`designer-${loadIndex}`" |
| | | :style="'height:' + height" |
| | | :xml="processXml" |
| | | :finishedInfo="finishedInfo" |
| | | :allCommentList="historyProcNodeList" |
| | | /> |
| | | </el-card> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <!--éåæµç¨--> |
| | | <el-dialog :title="returnDialog.title" v-model="returnDialog.visible" width="40%" append-to-body> |
| | | <el-radio-group v-model="returnTaskKey"> |
| | | <el-radio-button v-for="item in returnTaskList" :key="item.id" :label="item.id"> |
| | | {{ item.name }} |
| | | </el-radio-button> |
| | | </el-radio-group> |
| | | <template #footer> |
| | | <el-button @click="returnDialog.visible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="submitReturn">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <el-dialog :title="userSelectDialog.title" v-model="userSelectDialog.visible" width="60%" append-to-body> |
| | | <el-row type="flex" :gutter="20"> |
| | | <!--é¨é¨æ°æ®--> |
| | | <el-col :span="5"> |
| | | <el-card shadow="never" style="height: 100%"> |
| | | <template #header> |
| | | <span>é¨é¨å表</span> |
| | | </template> |
| | | <div class="head-container"> |
| | | <el-input v-model="deptName" placeholder="请è¾å
¥é¨é¨åç§°" prefix-icon="Search" clearable /> |
| | | <el-tree |
| | | :data="deptOptions" |
| | | :props="{ label: 'label', children: 'children' }" |
| | | :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" |
| | | ref="deptTreeRef" |
| | | default-expand-all |
| | | @node-click="handleNodeClick" |
| | | /> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="18"> |
| | | <el-table |
| | | ref="userTable" |
| | | :key="userSelectType" |
| | | height="500" |
| | | v-loading="userLoading" |
| | | :data="userList" |
| | | highlight-current-row |
| | | @current-change="changeCurrentUser" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column v-if="userSelectType === 'copy' || userSelectType === 'next'" width="55" type="selection" /> |
| | | <el-table-column v-else width="30"> |
| | | <template #default="scope"> |
| | | <el-radio :label="scope.row.userId" v-model="currentUserId">{{''}}</el-radio> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¨æ·åç§°" align="center" prop="userName" /> |
| | | <el-table-column label="ç¨æ·æµç§°" align="center" prop="nickName" /> |
| | | <el-table-column label="ææº" align="center" prop="phonenumber" /> |
| | | </el-table> |
| | | <pagination :total="userTotal" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList(selectDeptId)" /> |
| | | </el-col> |
| | | </el-row> |
| | | <template #footer> |
| | | <el-button @click="userSelectDialog.visible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="submitUserData">ç¡® å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Detail" lang="js"> |
| | | import { detailProcess } from "#/api/workflow/work/process"; |
| | | import { complete, delegate, transfer, rejectTask, returnList, returnTask } from "#/api/workflow/work/task"; |
| | | import { deptTreeSelect, selectUser } from "#/api/workflow/identity"; |
| | | import ProcessViewer from "#/components/ProcessViewer"; |
| | | import {useRoute} from "vue-router"; |
| | | |
| | | const route = useRoute(); |
| | | const router = useRouter(); |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const userList = ref([]); |
| | | const processed = ref(false); |
| | | const taskFormOpen = ref(false) |
| | | const userMultipleSelection = ref([]); |
| | | const userSelectType = ref(); |
| | | const currentUserId = ref(); |
| | | const userLoading = ref(false); |
| | | const userTotal = ref(0); |
| | | const loadIndex = ref(0); |
| | | const height = ref(document.documentElement.clientHeight - 205 + 'px;'); |
| | | const processXml = ref(''); |
| | | const taskFormVisible = ref(false); |
| | | const processFormList = ref([]); |
| | | const taskFormData = ref([]); |
| | | const historyProcNodeList = ref(); |
| | | const formVisible = ref(false); |
| | | const finishedInfo = ref({}); |
| | | |
| | | const deptName = ref(''); |
| | | const selectDeptId = ref(''); |
| | | const deptOptions = ref([]); |
| | | |
| | | const returnTaskList = ref(); |
| | | const returnTaskKey = ref(); |
| | | |
| | | const copyUser = ref([]); |
| | | const nextUser = ref([]); |
| | | |
| | | const taskFormRef = ref(); |
| | | const vFormRenderRef = ref(null); |
| | | const deptTreeRef = ref(null); |
| | | |
| | | const returnDialog = reactive({ |
| | | visible: false, |
| | | title: 'éåæµç¨' |
| | | }); |
| | | |
| | | const userSelectDialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | |
| | | const taskForm = reactive({ |
| | | comment: '', |
| | | procInsId: '', |
| | | taskId: '', |
| | | userId: '', |
| | | copyUserIds: '', |
| | | nextUserIds: '', |
| | | vars: '', |
| | | targetKey: '' |
| | | }); |
| | | |
| | | const rules = ref({ |
| | | comment: [{ required: true, message: '请è¾å
¥å®¡æ¹æè§', trigger: 'blur' }] |
| | | }); |
| | | |
| | | const queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }); |
| | | const tagType = (val) => { |
| | | if (val) { |
| | | return "success"; |
| | | } else { |
| | | return "info"; |
| | | } |
| | | } |
| | | const commentType = (val) => { |
| | | switch (val) { |
| | | case '1': return 'éè¿' |
| | | case '2': return 'éå' |
| | | case '3': return '驳å' |
| | | case '4': return 'å§æ´¾' |
| | | case '5': return '转å' |
| | | case '6': return 'ç»æ¢' |
| | | case '7': return 'æ¤å' |
| | | } |
| | | } |
| | | const approveTypeTag = (val) => { |
| | | switch (val) { |
| | | case '1': return 'success' |
| | | case '2': return 'warning' |
| | | case '3': return 'danger' |
| | | case '4': return 'primary' |
| | | case '5': return 'success' |
| | | case '6': return 'danger' |
| | | case '7': return 'info' |
| | | } |
| | | } |
| | | |
| | | const initData = () => { |
| | | taskForm.procInsId = route.params && route.params.procInsId ; |
| | | taskForm.taskId = route.query && route.query.taskId ; |
| | | processed.value = route.query && (route.query.processed || false) === "true"; |
| | | |
| | | // æµç¨ä»»å¡éè·ååé表å |
| | | getProcessDetails(taskForm.procInsId, taskForm.taskId); |
| | | loadIndex.value++; |
| | | }; |
| | | /** éè¿æ¡ä»¶è¿æ»¤èç¹ */ |
| | | const filterNode = (value, data) => { |
| | | if (!value) return true |
| | | return data.label.includes(value) |
| | | } |
| | | /** æ ¹æ®åç§°çéé¨é¨æ */ |
| | | watch(deptName, (val) => { |
| | | deptTreeRef.value.filter(val) |
| | | }) |
| | | // èç¹åå»äºä»¶ |
| | | const handleNodeClick = (data) => { |
| | | selectDeptId.value=data.id; |
| | | getList(data.id); |
| | | } |
| | | /** æ¥è¯¢é¨é¨ä¸ææ ç»æ */ |
| | | const getTreeSelect = async () => { |
| | | const res = await deptTreeSelect(); |
| | | deptOptions.value = res.data; |
| | | }; |
| | | /** æ¥è¯¢ç¨æ·å表 */ |
| | | const getList = async (deptId) => { |
| | | userLoading.value = true; |
| | | const res = await selectUser( |
| | | { |
| | | deptId: deptId, |
| | | pageNum:queryParams.value.pageNum, |
| | | pageSize:queryParams.value.pageSize |
| | | }); |
| | | userLoading.value = false; |
| | | userList.value = res.rows; |
| | | userTotal.value = res.total; |
| | | } |
| | | |
| | | const getProcessDetails = async (procInsId, taskId) => { |
| | | const params = {procInsId: procInsId, taskId: taskId} |
| | | const res = await detailProcess(params); |
| | | const data = res.data; |
| | | processXml.value = data.bpmnXml; |
| | | processFormList.value = data.processFormList; |
| | | taskFormVisible.value = data.existTaskForm; |
| | | if (taskFormVisible.value) { |
| | | taskFormData.value = data.taskFormData; |
| | | } |
| | | historyProcNodeList.value = data.historyProcNodeList; |
| | | finishedInfo.value = data.flowViewer; |
| | | formVisible.value = true; |
| | | nextTick(() => { |
| | | processFormList.value.forEach((item, index) => { |
| | | if (item.disabled) { |
| | | vFormRenderRef.value[index].disableForm(); |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | const onSelectCopyUsers = () => { |
| | | userMultipleSelection.value = copyUser.value; |
| | | onSelectUsers('æ·»å æé人', 'copy') |
| | | } |
| | | const onSelectNextUsers = () => { |
| | | userMultipleSelection.value = nextUser; |
| | | onSelectUsers('æå®å®¡æ¹äºº', 'next') |
| | | } |
| | | const onSelectUsers = (title, type) => { |
| | | userSelectType.value = type; |
| | | userSelectDialog.title = title; |
| | | userSelectDialog.visible = true; |
| | | getTreeSelect(); |
| | | getList() |
| | | } |
| | | /** éè¿ä»»å¡ */ |
| | | const handleComplete = () => { |
| | | // æ ¡éªè¡¨å |
| | | taskFormRef.value.validate(async (valid) => { |
| | | if (valid) { |
| | | const res = await complete(taskForm) |
| | | proxy.$modal.msgSuccess(res.msg); |
| | | goBack(); |
| | | } |
| | | }); |
| | | } |
| | | /** å§æ´¾ä»»å¡ */ |
| | | const handleDelegate = () => { |
| | | userSelectType.value = 'delegate'; |
| | | userSelectDialog.title = 'å§æ´¾ä»»å¡' |
| | | userSelectDialog.visible = true; |
| | | getTreeSelect(); |
| | | } |
| | | /** 转åä»»å¡ */ |
| | | const handleTransfer = () => { |
| | | userSelectType.value = 'transfer'; |
| | | userSelectDialog.title = '转åä»»å¡'; |
| | | userSelectDialog.visible = true; |
| | | getTreeSelect(); |
| | | } |
| | | /** éåä»»å¡ */ |
| | | const handleReturn = async () => { |
| | | // æ ¡éªè¡¨å |
| | | taskFormRef.value.validate(async (valid) => { |
| | | if (valid) { |
| | | const res = await returnList(taskForm); |
| | | returnTaskList.value = res.data; |
| | | returnDialog.visible = true; |
| | | } |
| | | }); |
| | | } |
| | | /** æç»ä»»å¡ */ |
| | | const handleReject = async () => { |
| | | await proxy.$modal.confirm('æç»å®¡æ¹åæµç¨ä¼ç»æ¢ï¼æ¯å¦ç»§ç»?'); |
| | | await rejectTask(taskForm); |
| | | proxy?.$modal.msgSuccess("æä½æå"); |
| | | goBack(); |
| | | } |
| | | |
| | | /** è¿åé¡µé¢ */ |
| | | const goBack = () => { |
| | | // å
³éå½åæ ç¾é¡µå¹¶è¿åä¸ä¸ªé¡µé¢ |
| | | proxy?.$tab.closePage(route); |
| | | router.back() |
| | | } |
| | | // å
³éæ ç¾ |
| | | const handleClose = (type, tag) => { |
| | | let userObj = userMultipleSelection.value.find(item => item.userId === tag.id); |
| | | userMultipleSelection.value.splice(userMultipleSelection.value.indexOf(userObj), 1); |
| | | if (type === 'copy') { |
| | | copyUser.value = userMultipleSelection.value; |
| | | // 设置æé人ID |
| | | if (copyUser.value && copyUser.value.length > 0) { |
| | | const val = copyUser.value.map(item => item.id); |
| | | taskForm.copyUserIds = val instanceof Array ? val.join(',') : val; |
| | | } else { |
| | | taskForm.copyUserIds = ''; |
| | | } |
| | | } else if (type === 'next') { |
| | | nextUser.value = userMultipleSelection.value; |
| | | // 设置æé人ID |
| | | if (nextUser.value && nextUser.value.length > 0) { |
| | | const val = nextUser.value.map(item => item.id); |
| | | taskForm.nextUserIds = val instanceof Array ? val.join(',') : val; |
| | | } else { |
| | | taskForm.nextUserIds = ''; |
| | | } |
| | | } |
| | | } |
| | | const changeCurrentUser = (val) => { |
| | | // currentUserId = val.userId |
| | | } |
| | | const handleSelectionChange = (val) => { |
| | | userMultipleSelection.value=val; |
| | | } |
| | | const submitReturn = () => { |
| | | // æ ¡éªè¡¨å |
| | | taskFormRef.value.validate(async (valid) => { |
| | | if (valid) { |
| | | if (!returnTaskKey) { |
| | | proxy.$modal.msgError("è¯·éæ©éåèç¹ï¼"); |
| | | } |
| | | taskForm.targetKey = returnTaskKey.value; |
| | | const res = await returnTask(taskForm); |
| | | proxy.$modal.msgSuccess(res.msg); |
| | | goBack() |
| | | } |
| | | }); |
| | | console.log("taskForm => ", taskForm.targetKey); |
| | | } |
| | | const submitUserData = () => { |
| | | let type = userSelectType.value; |
| | | if (type === 'copy' || type === 'next') { |
| | | if (!userMultipleSelection || userMultipleSelection.value.length <= 0) { |
| | | proxy.$modal.msgError("è¯·éæ©ç¨æ·"); |
| | | return false; |
| | | } |
| | | let userIds = userMultipleSelection.value.map(k => k.userId); |
| | | if (type === 'copy') { |
| | | // 设置æé人IDä¿¡æ¯ |
| | | copyUser.value = userMultipleSelection.value; |
| | | taskForm.copyUserIds = userIds instanceof Array ? userIds.join(',') : userIds; |
| | | } else if (type === 'next') { |
| | | // 设置ä¸ä¸çº§å®¡æ¹äººIDä¿¡æ¯ |
| | | nextUser.value = userMultipleSelection.value; |
| | | taskForm.nextUserIds = userIds instanceof Array ? userIds.join(',') : userIds; |
| | | } |
| | | userSelectDialog.visible = false; |
| | | } else { |
| | | if (!taskForm.comment) { |
| | | proxy?.$modal.msgError("请è¾å
¥å®¡æ¹æè§"); |
| | | return false; |
| | | } |
| | | if (!currentUserId.value) { |
| | | proxy?.$modal.msgError("è¯·éæ©ç¨æ·"); |
| | | return false; |
| | | } |
| | | taskForm.userId = currentUserId.value; |
| | | if (type === 'delegate') { |
| | | delegate(taskForm).then(res => { |
| | | proxy?.$modal.msgSuccess(res.msg); |
| | | goBack(); |
| | | }); |
| | | } |
| | | if (type === 'transfer') { |
| | | transfer(taskForm).then(res => { |
| | | proxy?.$modal.msgSuccess(res.msg); |
| | | goBack(); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | onMounted(() => { |
| | | initData(); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .clearfix:before, |
| | | .clearfix:after { |
| | | display: table; |
| | | content: ""; |
| | | } |
| | | .clearfix:after { |
| | | clear: both |
| | | } |
| | | |
| | | .box-card { |
| | | width: 100%; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .el-tag + .el-tag { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | .el-row { |
| | | margin-bottom: 20px; |
| | | &:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | } |
| | | .el-col { |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .button-new-tag { |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="æµç¨åç§°" prop="processName"> |
| | | <el-input v-model="queryParams.processName" placeholder="请è¾å
¥æµç¨åç§°" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="è¯·éæ©" style="width: 240px"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å®¡æ¹æ¶é´" style="width: 308px;"> |
| | | <el-date-picker |
| | | v-model="dateRange" |
| | | value-format="YYYY-MM-DD" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" :data="finishedList"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="ä»»å¡ç¼å·" align="center" prop="taskId" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" prop="procDefName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç±»" align="center" prop="category" :formatter="categoryFormat" /> |
| | | <el-table-column label="ä»»å¡èç¹" align="center" prop="taskName" /> |
| | | <el-table-column label="æµç¨å起人" align="center" prop="startUserName" /> |
| | | <el-table-column label="æ¥æ¶æ¶é´" align="center" prop="createTime" width="180" /> |
| | | <el-table-column label="å®¡æ¹æ¶é´" align="center" prop="finishTime" width="180" /> |
| | | <el-table-column label="èæ¶" align="center" prop="duration" width="180" /> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="详æ
" placement="top"> |
| | | <el-button link type="primary" icon="View" @click="handleDetails(scope.row)" v-hasPermi="['workflow:process:query']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="æ¤å" placement="top"> |
| | | <el-button link type="primary" icon="RefreshLeft" @click="handleRevoke(scope.row)" v-hasPermi="['workflow:process:revoke']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Finished" lang="js"> |
| | | import { listFinishedProcess } from "#/api/workflow/work/process"; |
| | | import { revokeProcess } from "#/api/workflow/work/task"; |
| | | |
| | | import { listAllCategory } from "#/api/workflow/category"; |
| | | const router = useRouter(); |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const finishedList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const dateRange = ref(['','']); |
| | | const categoryOptions = ref([]); |
| | | const queryFormRef = ref(); |
| | | |
| | | const queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | processName: '', |
| | | category: '' |
| | | }); |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | } |
| | | /** æ¥è¯¢å¾
åå表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listFinishedProcess(proxy.addDateRange(queryParams.value, dateRange.value)); |
| | | finishedList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** æµç¨æµè½¬è®°å½ */ |
| | | const handleDetails = (row) => { |
| | | router.push({ |
| | | path: '/workflow/process/detail/' + row.procInsId, |
| | | query: { |
| | | processed: false |
| | | } |
| | | }) |
| | | } |
| | | /** æ¤åä»»å¡ */ |
| | | const handleRevoke = async (row) => { |
| | | const params = { |
| | | procInsId: row.procInsId, |
| | | taskId: row.taskId |
| | | }; |
| | | const res = await revokeProcess(params); |
| | | proxy.$modal.msgSuccess(res.msg); |
| | | getList(); |
| | | } |
| | | const categoryFormat = (row) => { |
| | | var category = categoryOptions.value.find(function(find) { |
| | | return find.code === row.category; |
| | | }); |
| | | return category && category.categoryName ? category.categoryName : ''; |
| | | } |
| | | onMounted(() => { |
| | | getCategoryList(); |
| | | getList(); |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="æµç¨æ è¯" prop="processKey"> |
| | | <el-input v-model="queryParams.processKey" placeholder="请è¾å
¥æµç¨æ è¯" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç§°" prop="processName"> |
| | | <el-input v-model="queryParams.processName" placeholder="请è¾å
¥æµç¨åç§°" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="è¯·éæ©" style="width: 240px"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" :data="processList"> |
| | | <el-table-column label="æµç¨æ è¯" align="center" prop="processKey" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <a @click="handleProcessView(scope.row)" class="link-type"> |
| | | <span>{{ scope.row.processName }}</span> |
| | | </a> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æµç¨åç±»" align="center" prop="categoryName" :formatter="categoryFormat" /> |
| | | <el-table-column label="æµç¨çæ¬" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag>v{{ scope.row.version }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¶æ" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag type="success" v-if="!scope.row.suspended">æ¿æ´»</el-tag> |
| | | <el-tag type="warning" v-if="scope.row.suspended">æèµ·</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="é¨ç½²æ¶é´" align="center" prop="deploymentTime" width="180" > |
| | | <template #default="scope"> |
| | | {{ parseTime(scope.row.deploymentTime, '{y}-{m}-{d} {h}:{i}:{s}')}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="åèµ·" placement="top"> |
| | | <el-button link type="primary" icon="VideoPlay" @click="handleStart(scope.row)" v-hasPermi="['workflow:process:start']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | |
| | | <!-- æµç¨å¾ --> |
| | | <el-dialog :title="processDialog.title" v-model="processDialog.visible" width="70%"> |
| | | <ProcessViewer :key="`designer-${reloadIndex}`" :xml="processXml" :style="{height: '650px'}" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="WorkProcess" lang="js"> |
| | | import { listProcess, getBpmnXml } from "#/api/workflow/work/process"; |
| | | import { listAllCategory } from "#/api/workflow/category"; |
| | | import ProcessViewer from "#/components/ProcessViewer/index.vue"; |
| | | |
| | | const router = useRouter(); |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const processList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const total = ref(0); |
| | | const reloadIndex = ref(0); |
| | | const processXml = ref(""); |
| | | const categoryOptions = ref([]); |
| | | |
| | | const queryFormRef = ref(); |
| | | |
| | | const processDialog = reactive({ |
| | | visible: false, |
| | | title: 'æµç¨å¾' |
| | | }); |
| | | |
| | | const queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | processKey: '', |
| | | processName: '', |
| | | category: '' |
| | | }); |
| | | |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | } |
| | | /** æ¥è¯¢æµç¨å表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listProcess(queryParams.value); |
| | | processList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** æ¥çæµç¨å¾ */ |
| | | const handleProcessView = async (row) => { |
| | | reloadIndex.value++; |
| | | // åé请æ±ï¼è·åxml |
| | | const res = await getBpmnXml(row.definitionId); |
| | | console.log(res.data); |
| | | processXml.value = res.data; |
| | | processDialog.visible = true; |
| | | } |
| | | /** åèµ·æµç¨ */ |
| | | const handleStart = (row) => { |
| | | router.push({ |
| | | path: '/workflow/process/start/' + row.deploymentId, |
| | | query: { |
| | | definitionId: row.definitionId, |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | const categoryFormat = (row) => { |
| | | var category = categoryOptions.value.find(function(k) { |
| | | return k.code === row.category; |
| | | }); |
| | | return category ? category.categoryName : ''; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getCategoryList(); |
| | | getList(); |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="æµç¨æ è¯" prop="processKey"> |
| | | <el-input v-model="queryParams.processKey" placeholder="请è¾å
¥æµç¨æ è¯" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç§°" prop="processName"> |
| | | <el-input v-model="queryParams.processName" placeholder="请è¾å
¥æµç¨åç§°" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="æµç¨åç±»" style="width: 240px"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æäº¤æ¶é´" style="width: 308px;"> |
| | | <el-date-picker |
| | | v-model="dateRange" |
| | | value-format="YYYY-MM-DD" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['workflow:process:remove']"> |
| | | å é¤ |
| | | </el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" :data="ownProcessList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="æµç¨ç¼å·" align="center" prop="procInsId" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" prop="procDefName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨ç±»å«" align="center" prop="category" :formatter="categoryFormat" /> |
| | | <el-table-column label="æµç¨çæ¬" align="center" width="80px"> |
| | | <template #default="scope"> |
| | | <el-tag>v{{ scope.row.procDefVersion }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å½åèç¹" align="center" prop="taskName" /> |
| | | <el-table-column label="æäº¤æ¶é´" align="center" prop="createTime" width="180" /> |
| | | <el-table-column label="æµç¨ç¶æ" align="center" width="100"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="wf_process_status" :value="scope.row.processStatus" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="èæ¶" align="center" prop="duration" width="180" /> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="详æ
" placement="top"> |
| | | <el-button link type="primary" icon="View" @click="handleDetails(scope.row)" v-hasPermi="['workflow:process:query']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="åæ¶" placement="top"> |
| | | <el-button link type="primary" icon="CircleClose" @click="handleStop(scope.row)" v-hasPermi="['workflow:process:cancel']"></el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['workflow:process:remove']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Own" lang="js"> |
| | | import { listOwnProcess, stopProcess, delProcess } from "#/api/workflow/work/process"; |
| | | import { listAllCategory } from "#/api/workflow/category"; |
| | | |
| | | |
| | | const router = useRouter(); |
| | | const { proxy } = getCurrentInstance() ; |
| | | const { wf_process_status } = proxy.useDict("wf_process_status"); |
| | | |
| | | |
| | | |
| | | |
| | | const categoryOptions = ref([]); |
| | | |
| | | const ownProcessList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const dateRange = ref(['','']); |
| | | |
| | | const queryFormRef = ref(); |
| | | |
| | | const queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | processKey: '', |
| | | processName: '', |
| | | category: '' |
| | | }); |
| | | |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | }; |
| | | /** æ¥è¯¢æçæµç¨å表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listOwnProcess(proxy.addDateRange(queryParams.value, dateRange.value)); |
| | | ownProcessList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | const handleSelectionChange = (selection) => { |
| | | ids.value = selection.map(item => item.procInsId); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | /** æµç¨è¯¦æ
*/ |
| | | const handleDetails = (row) => { |
| | | router.push({ |
| | | path: '/workflow/process/detail/' + row.procInsId, |
| | | query: { |
| | | processed: false |
| | | } |
| | | }) |
| | | } |
| | | /** åæ¶æµç¨ç³è¯· */ |
| | | const handleStop = async (row) => { |
| | | await stopProcess( { procInsId: row.procInsId }); |
| | | proxy?.$modal.msgSuccess("æä½æå"); |
| | | getList(); |
| | | } |
| | | /** 忬¡åèµ·æµç¨ */ |
| | | const handleAgain = (row) => { |
| | | // router.push({ |
| | | // path: '/workflow/process/start/' + row.deployId, |
| | | // query: { |
| | | // definitionId: row.procDefId, |
| | | // procInsId: row.procInsId |
| | | // } |
| | | // }) |
| | | } |
| | | /** å é¤æé®æä½ */ |
| | | const handleDelete = async (row) => { |
| | | const procInsIds = row.procInsId || ids.value; |
| | | await proxy.$modal.confirm('æ¯å¦ç¡®è®¤å 餿µç¨å®ä¹ç¼å·ä¸º"' + procInsIds + '"çæ°æ®é¡¹?'); |
| | | await delProcess(procInsIds); |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | } |
| | | |
| | | /** å¯¼åºæé®æä½ */ |
| | | const handleExport = () => { |
| | | proxy.download("workflow/process/ownExport", { |
| | | ...queryParams.value |
| | | }, `own_process_${new Date().getTime()}.xlsx`); |
| | | } |
| | | |
| | | const categoryFormat = (row) => { |
| | | return categoryOptions.value.find(k => k.code === row.category).categoryName ?categoryOptions.value.find(k => k.code === row.category).categoryName: ''; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getCategoryList(); |
| | | getList(); |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-card class="box-card"> |
| | | <template #header> |
| | | <span>åèµ·æµç¨</span> |
| | | </template> |
| | | <div class="form-conf" v-if="dialog.visible"> |
| | | <v-form-render :form-json="formModel" :form-data="formData" ref="vfRenderRef"></v-form-render> |
| | | <div class="cu-submit"> |
| | | <el-button type="primary" @click="submit">æäº¤</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="WorkStart" lang="js"> |
| | | import { getProcessForm, startProcess } from '#/api/workflow/work/process'; |
| | | |
| | | |
| | | const route = useRoute(); |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const vfRenderRef = ref(null); |
| | | |
| | | const deployId = ref(); |
| | | const definitionId = ref(); |
| | | const formModel = ref({}); |
| | | const formData = ref({}); |
| | | |
| | | const dialog = reactive({ |
| | | visible: false, |
| | | title: '' |
| | | }); |
| | | |
| | | const initData = async () => { |
| | | deployId.value = route.params && route.params.deployId; |
| | | definitionId.value = route.query && route.query.definitionId; |
| | | const res = await getProcessForm({ definitionId: definitionId.value, deployId: deployId.value }); |
| | | formModel.value = res.data.formModel; |
| | | dialog.visible = true; |
| | | nextTick(async () => { |
| | | vfRenderRef.value.setFormJson(formModel.value || {formConfig: {}, widgetList: []}); |
| | | }); |
| | | } |
| | | |
| | | const submit = async () => { |
| | | const data = await vfRenderRef.value.getFormData(); |
| | | if (definitionId.value) { |
| | | const res = await startProcess(definitionId.value, JSON.stringify(data)); |
| | | proxy.$modal.msgSuccess(res.msg); |
| | | // const obj = { path: "/work/own" }; |
| | | // proxy?.$tab.closeOpenPage(obj); |
| | | proxy.$tab.closePage(); |
| | | proxy.$router.back(); |
| | | } |
| | | } |
| | | |
| | | const reset = () => { |
| | | vfRenderRef.value.resetForm(); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | initData(); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .form-conf { |
| | | margin: 15px auto; |
| | | width: 80%; |
| | | padding: 15px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search" v-show="showSearch"> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="70"> |
| | | <el-form-item label="æµç¨åç§°" prop="processName"> |
| | | <el-input v-model="queryParams.processName" placeholder="请è¾å
¥æµç¨åç§°" clearable style="width: 200px" @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¨åç±»" prop="category"> |
| | | <el-select v-model="queryParams.category" clearable placeholder="è¯·éæ©" style="width: 240px"> |
| | | <el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¥æ¶æ¶é´" style="width: 308px;"> |
| | | <el-date-picker |
| | | v-model="dateRange" |
| | | value-format="YYYY-MM-DD" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-card shadow="never"> |
| | | <template #header> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <el-table v-loading="loading" :data="todoList"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="ä»»å¡ç¼å·" align="center" prop="taskId" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æµç¨åç§°" align="center" prop="procDefName" /> |
| | | <el-table-column label="ä»»å¡èç¹" align="center" prop="taskName" /> |
| | | <el-table-column label="æµç¨åç±»" align="center" prop="category" :formatter="categoryFormat" /> |
| | | <el-table-column label="æµç¨çæ¬" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag>v{{scope.row.procDefVersion}}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æµç¨å起人" align="center" prop="startUserName" /> |
| | | <el-table-column label="æ¥æ¶æ¶é´" align="center" prop="createTime" width="180" /> |
| | | <el-table-column label="æä½" width="180" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="åç" placement="top"> |
| | | <el-button link type="primary" icon="EditPen" @click="handleProcess(scope.row)" v-hasPermi="['workflow:process:approval']"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Todo" lang="js"> |
| | | import { listTodoProcess } from '#/api/workflow/work/process'; |
| | | |
| | | import { listAllCategory } from "#/api/workflow/category"; |
| | | const router = useRouter(); |
| | | const { proxy } = getCurrentInstance() ; |
| | | |
| | | const todoList = ref([]); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const dateRange = ref(['','']); |
| | | const categoryOptions = ref([]); |
| | | const queryFormRef = ref(); |
| | | |
| | | const queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | processName: '', |
| | | category: '' |
| | | }); |
| | | /** æ¥è¯¢æµç¨åç±»å表 */ |
| | | const getCategoryList = async () => { |
| | | const res = await listAllCategory(); |
| | | categoryOptions.value = res.data; |
| | | } |
| | | /** æ¥è¯¢å¾
åå表 */ |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await listTodoProcess(proxy.addDateRange(queryParams.value, dateRange.value)); |
| | | todoList.value = res.rows; |
| | | total.value = res.total; |
| | | loading.value = false; |
| | | } |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** 跳转å°å¤çé¡µé¢ */ |
| | | const handleProcess = (row) => { |
| | | router.push({ |
| | | path: '/workflow/process/detail/' + row.procInsId, |
| | | query: { |
| | | taskId: row.taskId, |
| | | processed: true |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const categoryFormat = (row) => { |
| | | var category = categoryOptions.value.find(function(k) { |
| | | return k.code === row.category; |
| | | }); |
| | | return category && category.categoryName ? category.categoryName : ''; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getCategoryList(); |
| | | getList(); |
| | | }); |
| | | </script> |