From a0c61a83da0b95baf9d1e05fee5ef8d603b6ac98 Mon Sep 17 00:00:00 2001 From: shijing Date: Tue, 21 Jun 2022 18:22:18 +0800 Subject: [PATCH] woekflow --- npm | 0 package.json | 7 +- src/api/model/system.js | 34 ++- src/api/model/wf.js | 286 ++++++++++++++++++++++++ src/views/hrm/employee.vue | 2 +- src/views/sys/post.vue | 108 ++++++--- src/views/sys/post_role_form.vue | 195 ++++++++-------- src/views/sys/user.vue | 1 + src/views/wf/configuration.vue | 49 ++++ src/views/wf/field.vue | 275 +++++++++++++++++++++++ src/views/wf/state.vue | 372 +++++++++++++++++++++++++++++++ src/views/wf/ticket.vue | 326 +++++++++++++++++++++++++++ src/views/wf/transform.vue | 218 ++++++++++++++++++ src/views/wf/workflow.vue | 243 ++++++++++++++++++++ 14 files changed, 1989 insertions(+), 127 deletions(-) create mode 100644 npm create mode 100644 src/api/model/wf.js create mode 100644 src/views/wf/configuration.vue create mode 100644 src/views/wf/field.vue create mode 100644 src/views/wf/state.vue create mode 100644 src/views/wf/transform.vue diff --git a/npm b/npm new file mode 100644 index 00000000..e69de29b diff --git a/package.json b/package.json index 7170fed6..a2a11f57 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "tinymce": "6.0.3", "vue": "3.2.36", "vue-i18n": "9.1.10", + "vue-json-editor": "^1.4.3", "vue-router": "4.0.15", "vuedraggable": "4.0.3", "vuex": "4.0.2", @@ -49,8 +50,7 @@ "APP_CONFIG": true }, "extends": [ - "plugin:vue/vue3-essential", - "eslint:recommended" + "plugin:vue/vue3-essential" ], "parserOptions": { "parser": "@babel/eslint-parser" @@ -62,7 +62,8 @@ "vue/no-unused-components": 0, "vue/multi-word-component-names": 0, "no-debugger": "off", - "no-console": "off" + "no-console": "off", + "no-trailing-spaces": "off" } }, "browserslist": [ diff --git a/src/api/model/system.js b/src/api/model/system.js index 5744e3e4..c4be44c4 100644 --- a/src/api/model/system.js +++ b/src/api/model/system.js @@ -29,7 +29,7 @@ export default { delete: { name: "删除部门", req: async function(id){ - return await http.delete(`${config.API_URL}/system/employee/${id}/`); + return await http.delete(`${config.API_URL}/system/dept/${id}/`); } } }, @@ -233,4 +233,36 @@ export default { } } }, + postrole: { + list: { + url: `${config.API_URL}/system/post_role/`, + name: "获取岗位列表", + req: async function(data){ + return await http.get(this.url, data); + } + }, + create: { + url: `${config.API_URL}/system/post_role/`, + name: "新增岗位", + req: async function(data){ + return await http.post(this.url,data); + } + }, + /*update: { + name: "更新岗位", + req: async function(id, data){ + return await http.put( + `${config.API_URL}/system/post_role/${id}/`, + data + ); + } + },*/ + delete: { + name: "删除岗位", + req: async function(id){ + return await http.delete(`${config.API_URL}/system/post_role/${id}/`); + } + } + }, + } diff --git a/src/api/model/wf.js b/src/api/model/wf.js new file mode 100644 index 00000000..d936b9ce --- /dev/null +++ b/src/api/model/wf.js @@ -0,0 +1,286 @@ +import config from "@/config" +import http from "@/utils/request" + +export default { + workflow: { + list: { + url: `${config.API_URL}/wf/workflow/`, + name: "工作流列表", + req: async function(data){ + return await http.get(this.url, data); + } + }, + item: { + name: "工作流详情", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/workflow/${id}/`); + } + }, + create: { + url: `${config.API_URL}/wf/workflow/`, + name: "新增工作流", + req: async function(data){ + return await http.post(this.url, data); + } + }, + update: { + name: "更新工作流", + req: async function(id, data){ + return await http.put( + `${config.API_URL}/wf/workflow/${id}/`, + data + ); + } + }, + delete: { + name: "删除工作流", + req: async function(id){ + return await http.delete(`${config.API_URL}/wf/workflow/${id}/`); + } + }, + init: { + name: "新建工单初始化", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/workflow/${id}/init/`); + } + }, + customfields: { + name: "工作流下的自定义字段", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/workflow/${id}/customfields/`); + } + }, + states: { + name: "工作流下的状态节点", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/workflow/${id}/states/`); + } + }, + transitions: { + name: "工作流下的流转规则", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/workflow/${id}/transitions/`); + } + } + }, + ticket: { + list: { + url: `${config.API_URL}/wf/ticket/`, + name: "工单列表", + req: async function(data){ + return await http.get(this.url, data); + } + }, + ticketItem: { + name: "工单详情", + req: async function(id){ + return await http.get(`${config.API_URL}​/wf​/ticket​/${id}​/`); + } + }, + create: { + url: `${config.API_URL}/wf/ticket/`, + name: "新增工单", + req: async function(data){ + return await http.post(this.url, data); + } + }, + destorys: { + url: `${config.API_URL}/wf/ticket/destorys/`, + name: "批量物理删除", + req: async function(data){ + return await http.post(this.url, data); + } + }, + ticketAccept: { + name: "接单", + req: async function(id){ + return await http.post(`${config.API_URL}/wf/ticket/${id}/accpet/`); + } + }, + addNodeEnd: { + name: "加签完成", + req: async function(id,data){ + return await http.post(`${config.API_URL}/wf/ticket/${id}/add_node_end/`,data); + } + }, + addNode: { + name: "加签", + req: async function(id,data){ + return await http.post(`${config.API_URL}/wf/ticket/${id}/add_node/`,data); + } + }, + ticketClose: { + name: "关闭工单", + req: async function(id,data){ + return await http.post(`${config.API_URL}/wf/ticket/{id}/close/`,data); + } + }, + ticketDeliver: { + name: "转交工单", + req: async function(id,data){ + return await http.post(`${config.API_URL}/wf/ticket/${id}/deliver/`,data); + } + }, + ticketHandle: { + name: "处理工单", + req: async function(id,data){ + return await http.post(`${config.API_URL}/wf/ticket/${id}/handle/`,data); + } + }, + ticketRetreat: { + name: "撤回工单", + req: async function(id,data){ + return await http.post(`${config.API_URL}/wf/ticket/${id}/retreat/`,data); + } + }, + ticketFlowlogs: { + name: "工单流转记录", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/ticket/${id}/flowlogs/`); + } + }, + ticketFlowSteps: { + name: "工单流转step, 用于显示当前状态的step图(线性结构)", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/ticket/${id}/flowsteps/`); + } + }, + ticketTransitions: { + name: "获取工单可执行的操作", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/ticket/${id}/transitions/`); + } + }, + dutyAgg: { + url: `${config.API_URL}/wf/ticket/duty_agg/`, + name: "工单待办聚合", + req: async function(data){ + return await http.get(this.url, data); + } + }, + ticketFlow: { + url: `${config.API_URL}/wf/ticketflow/`, + name: "工单日志", + req: async function(data){ + return await http.get(this.url, data); + } + }, + ticketFlowItem: { + name: "获取工单可执行的操作", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/ticketflow/${id}/`); + } + } + }, + customfield:{ + list: { + url: `${config.API_URL}/wf/customfield/`, + name: "字段列表", + req: async function(data){ + return await http.get(this.url, data); + } + }, + item: { + name: "字段详情", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/customfield/${id}/`); + } + }, + create: { + url: `${config.API_URL}/wf/customfield/`, + name: "新增字段", + req: async function(data){ + return await http.post(this.url, data); + } + }, + update: { + name: "更新字段", + req: async function(id, data){ + return await http.put( + `${config.API_URL}/wf/customfield/${id}/`, + data + ); + } + }, + delete: { + name: "删除字段", + req: async function(id){ + return await http.delete(`${config.API_URL}/wf/customfield/${id}/`); + } + } + }, + state:{ + list: { + url: `${config.API_URL}/wf/state/`, + name: "状态列表", + req: async function(data){ + return await http.get(this.url, data); + } + }, + item: { + name: "状态详情", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/state/${id}/`); + } + }, + create: { + url: `${config.API_URL}/wf/state/`, + name: "新增状态", + req: async function(data){ + return await http.post(this.url, data); + } + }, + update: { + name: "更新状态", + req: async function(id, data){ + return await http.put( + `${config.API_URL}/wf/state/${id}/`, + data + ); + } + }, + delete: { + name: "删除状态", + req: async function(id){ + return await http.delete(`${config.API_URL}/wf/state/${id}/`); + } + } + }, + transition:{ + list: { + url: `${config.API_URL}/wf/transition/`, + name: "流转列表", + req: async function(data){ + return await http.get(this.url, data); + } + }, + item: { + name: "流转详情", + req: async function(id){ + return await http.get( `${config.API_URL}/wf/transition/${id}/`); + } + }, + create: { + url: `${config.API_URL}/wf/transition/`, + name: "新增流转", + req: async function(data){ + return await http.post(this.url, data); + } + }, + update: { + name: "更新流转", + req: async function(id, data){ + return await http.put( + `${config.API_URL}/wf/transition/${id}/`, + data + ); + } + }, + delete: { + name: "删除流转", + req: async function(id){ + return await http.delete(`${config.API_URL}/wf/transition/${id}/`); + } + } + } +} diff --git a/src/views/hrm/employee.vue b/src/views/hrm/employee.vue index 9218feec..9d708a7d 100644 --- a/src/views/hrm/employee.vue +++ b/src/views/hrm/employee.vue @@ -75,7 +75,7 @@ this.dialog.save = true; this.$nextTick(() => { if(type==='add'){ - this.$refs.saveDialog.open(type).setData({}) + this.$refs.saveDialog.open(type) }else{ this.$refs.saveDialog.open(type).setData(row) } diff --git a/src/views/sys/post.vue b/src/views/sys/post.vue index 27748045..032db408 100644 --- a/src/views/sys/post.vue +++ b/src/views/sys/post.vue @@ -4,21 +4,25 @@
+
岗位列表
-
- + + + - - + + - - + +
@@ -26,77 +30,86 @@
- - +
岗位关系
+ +
- + + + + + - - - - -
- + + + diff --git a/src/views/sys/post_role_form.vue b/src/views/sys/post_role_form.vue index 1aa8a692..8e1e4bf2 100644 --- a/src/views/sys/post_role_form.vue +++ b/src/views/sys/post_role_form.vue @@ -6,52 +6,66 @@ destroy-on-close @closed="$emit('closed')" > - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -69,68 +83,57 @@ export default { }, visible: false, isSaveing: false, - //表单数据 - form: { - speaker_on: true - }, - //验证规则 - rules: { - name: [{ required: true, message: "请输入" }], - }, - filter_area_level_options: [ - { - value: 10, - label: "办公生活区以上", - }, - { - value: 20, - label: "生产一般区以上", - }, - { - value: 30, - label: "生产重点区以上", - }, - ], - trigger_options: [ - { - value: 10, - label: "监控", - }, - { - value: 20, - label: "定位", - }, - ], - //所需数据选项 - groups: [], - groupsProps: { - value: "id", - emitPath: false, - checkStrictly: true, - }, + //表单数据 + form: { + data_range: 10, + post: "", + role: "", + }, + //验证规则 + rules: { + name: [{required: true, message: "请输入姓名"}], + }, + postProps: { + value: "id", + multiple: true, + checkStrictly: true, + }, + roleOptions:[], + postOptions:[], + rangeOptions: [ + {id: 10, value: "全部"}, + // {id:20,value: "全部"}, + {id: 30, value: "同级及以下"}, + {id: 40, value: "本级及以下"}, + {id: 50, value: "本级"}, + {id: 60, value: "仅本人"}, + ], }; }, - mounted() {}, + mounted() { + this.getPosts(); + this.getRole(); + }, methods: { //显示 - open(mode = "add") { + open(mode = "add"){ this.mode = mode; this.visible = true; return this; }, //表单提交方法 async submit() { - var valid = await this.$refs.dialogForm.validate().catch(() => {}); + var valid = await this.$refs.form.validate().catch(() => {}); if (!valid) { return false; } this.isSaveing = true; try { - var res; - if (this.mode == "add") { - res = await this.$API.ecm.event_cate.create.req(this.form); - } else if (this.mode == "edit") { - res = await this.$API.ecm.event_cate.update.req(this.form.id, this.form); + let res; + if (this.mode === "add") { + res = await this.$API.system.postrole.create.req(this.form); + } else if (this.mode === "edit") { + res = await this.$API.system.postrole.update.req(this.form.id, this.form); } this.isSaveing = false; this.$emit("success", this.form, this.mode); @@ -147,6 +150,24 @@ export default { setData(data) { Object.assign(this.form, data); }, + getPosts(){ + this.$API.system.post.list.req({page:0}).then(res=>{ + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + this.postOptions = res; + } + }) + }, + getRole(){ + this.$API.system.role.list.req({page:0}).then(res=>{ + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + this.roleOptions = res; + } + }) + }, }, }; diff --git a/src/views/sys/user.vue b/src/views/sys/user.vue index f663cbcf..829d0974 100644 --- a/src/views/sys/user.vue +++ b/src/views/sys/user.vue @@ -276,6 +276,7 @@ add() { this.type = "add"; this.limitedVisible = true; + this.addForm = {}; }, //编辑 formEdit(row,index) { diff --git a/src/views/wf/configuration.vue b/src/views/wf/configuration.vue new file mode 100644 index 00000000..d588d34f --- /dev/null +++ b/src/views/wf/configuration.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/src/views/wf/field.vue b/src/views/wf/field.vue new file mode 100644 index 00000000..13c215c6 --- /dev/null +++ b/src/views/wf/field.vue @@ -0,0 +1,275 @@ + + + + + diff --git a/src/views/wf/state.vue b/src/views/wf/state.vue new file mode 100644 index 00000000..d1346be9 --- /dev/null +++ b/src/views/wf/state.vue @@ -0,0 +1,372 @@ + + + + + diff --git a/src/views/wf/ticket.vue b/src/views/wf/ticket.vue index e69de29b..06c0c362 100644 --- a/src/views/wf/ticket.vue +++ b/src/views/wf/ticket.vue @@ -0,0 +1,326 @@ + diff --git a/src/views/wf/transform.vue b/src/views/wf/transform.vue new file mode 100644 index 00000000..c3aa717d --- /dev/null +++ b/src/views/wf/transform.vue @@ -0,0 +1,218 @@ + + + + + diff --git a/src/views/wf/workflow.vue b/src/views/wf/workflow.vue index e69de29b..88ae55ec 100644 --- a/src/views/wf/workflow.vue +++ b/src/views/wf/workflow.vue @@ -0,0 +1,243 @@ + + + +