From a0c61a83da0b95baf9d1e05fee5ef8d603b6ac98 Mon Sep 17 00:00:00 2001 From: shijing Date: Tue, 21 Jun 2022 18:22:18 +0800 Subject: [PATCH 1/2] 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 @@ + + + + From 1ac0d23016229107a496c211ceeb63a4d0481ee5 Mon Sep 17 00:00:00 2001 From: shijing Date: Wed, 22 Jun 2022 16:02:49 +0800 Subject: [PATCH 2/2] 06222 --- .env.development | 2 +- src/api/model/system.js | 100 ++++++- src/api/model/wf.js | 2 +- src/config/route.js | 14 +- src/views/hrm/ep_form.vue | 211 +++++++++++++- src/views/ops/menu.vue | 67 ++--- src/views/setting/role/permission.vue | 2 +- src/views/sys/dept.vue | 25 +- src/views/sys/dict.vue | 6 +- src/views/sys/post.vue | 68 ++++- src/views/sys/post_role_form.vue | 15 +- src/views/sys/role.vue | 25 +- src/views/sys/task.vue | 220 ++++++++++++++ src/views/sys/taskLogs.vue | 99 +++++++ src/views/sys/user.vue | 49 +--- src/views/wf/field.vue | 279 +++++++++--------- src/views/wf/state.vue | 397 +++++++++++++------------- src/views/wf/workflow.vue | 2 +- 18 files changed, 1110 insertions(+), 473 deletions(-) create mode 100644 src/views/sys/taskLogs.vue diff --git a/.env.development b/.env.development index 05e1a6f2..19ce6d37 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,7 @@ NODE_ENV = development VUE_APP_TITLE = '曲阳金隅安全智能管控平台' # 接口地址 -VUE_APP_API_BASEURL = http://49.232.14.174:2226/api +VUE_APP_API_BASEURL = http://1.203.161.103:2800/api #VUE_APP_API_BASEURL = http://127.0.0.1:8000/api # 本地端口 diff --git a/src/api/model/system.js b/src/api/model/system.js index c4be44c4..4237d33c 100644 --- a/src/api/model/system.js +++ b/src/api/model/system.js @@ -173,12 +173,13 @@ export default { }, user: { list: { - url: `${config.API_URL}/system/user`, + url: `${config.API_URL}/system/user/`, name: "获取用户列表", req: async function(params){ return await http.get(this.url, params); } }, + create: { url: `${config.API_URL}/system/user/`, name: "新增用户", @@ -200,7 +201,7 @@ export default { req: async function(id){ return await http.delete(`${config.API_URL}/system/user/${id}/`); } - }, + } }, post: { list: { @@ -264,5 +265,98 @@ export default { } } }, - + task: { + list: { + url: `${config.API_URL}/system/ptask/`, + 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}/system/ptask/${id}/`); + } + }, + create: { + url: `${config.API_URL}/system/ptask/`, + 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/ptask/${id}/`, + data + ); + } + }, + updateToggle: { + name: "修改启用禁用状态", + req: async function(id, data){ + return await http.put( + `${config.API_URL}/system/ptask/${id}/toggle/`, + data + ); + } + }, + delete: { + name: "删除定时任务", + req: async function(id){ + return await http.delete(`${config.API_URL}/system/ptask/${id}/`); + } + }, + deletes: { + url: `${config.API_URL}/system/ptask/deletes/`, + name: "批量删除定时任务", + req: async function(data){ + return await http.post(this.url,data); + } + }, + runOnce: { + name: "执行一次", + req: async function(data){ + return await http.post(`${config.API_URL}/system/ptask/${id}/run_once/`,data); + } + }, + result: { + url: `${config.API_URL}/system/ptask_result/`, + name: "任务执行结果列表", + req: async function(data){ + return await http.get(this.url, data); + } + }, + resultItem: { + name: "任务执行结果详情", + req: async function(id){ + return await http.get( `${config.API_URL}/system/ptask_result/${id}/`); + } + }, + }, + userPost:{ + list: { + url: `${config.API_URL}/system/user_post/`, + name: "用户/岗位关系", + req: async function(params){ + return await http.get(this.url, params); + } + }, + create: { + url: `${config.API_URL}/system/user_post/`, + name: "新增用户/岗位关系", + req: async function(data){ + return await http.post(this.url,data); + } + }, + delete: { + name: "删除用户/岗位关系", + req: async function(id){ + return await http.delete(`${config.API_URL}/system/user_post/${id}/`); + } + } + } } diff --git a/src/api/model/wf.js b/src/api/model/wf.js index d936b9ce..a96f3b8f 100644 --- a/src/api/model/wf.js +++ b/src/api/model/wf.js @@ -172,7 +172,7 @@ export default { } } }, - customfield:{ + field:{ list: { url: `${config.API_URL}/wf/customfield/`, name: "字段列表", diff --git a/src/config/route.js b/src/config/route.js index 4d4b6681..58161793 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -122,6 +122,16 @@ const routes = [ "icon": "el-icon-menu", }, "component": "wf/ticket" + }, + { + "name": "configuration", + "path": "/wf/configuration", + "meta": { + "title": "工单", + "icon": "el-icon-menu", + "hidden":true + }, + "component": "wf/configuration" }, ] }, @@ -359,7 +369,7 @@ const routes = [ }, "component": "ops/log_request" }, - { + /*{ "name": "monitor", "path": "/ops/monitor", "meta": { @@ -367,7 +377,7 @@ const routes = [ "icon": "el-icon-fold", }, "component": "ops/monitor" - }, + },*/ ] }, ] diff --git a/src/views/hrm/ep_form.vue b/src/views/hrm/ep_form.vue index 19713e1e..5fdb0a1d 100644 --- a/src/views/hrm/ep_form.vue +++ b/src/views/hrm/ep_form.vue @@ -93,7 +93,7 @@ - + @@ -110,6 +110,50 @@ + + + + + + + + + + + + + + + + + + { + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + this.postOptions = res; + } + }) + }, + //加载树数据 + async getGroup() { + let res = await this.$API.system.dept.list.req({page: 0}); + let postList = res; + this.group = res; + let posts = []; + postList.forEach(item => { + let obj = new Object(); + obj.id = item.id; + obj.sort = item.sort; + obj.label = item.name; + obj.type = item.type; + obj.parent = item.parent; + obj.create_time = item.create_time; + posts.push(obj) + }); + let obj = posts.reduce((res, v) => (res[v.id] = v , res), {});//Object + let arr = []; + for (let item of posts) { + // debugger; + if (item.parent == null) { + arr.push(item); + continue + } + let parent = obj[item.parent]; + parent.children = parent.children ? parent.children : []; + parent.children.push(item); + } + this.group = arr; + }, //显示 open(mode) { this.mode = mode; this.visible = true; return this; }, - closeDrawer(){ + closeDrawer() { this.visible = false; this.$emit('closed'); }, + handleChange(value) { + debugger; + console.log(value); + console.log(this.addForm.parent); + }, //表单提交方法 submit() { debugger; @@ -232,6 +362,7 @@ if (valid) { debugger; this.isSaveing = true; + this.addForm.dept = this.addForm.dept[1]; if (this.mode === 'add') { debugger; this.$API.hrm.employee.create.req(this.form) @@ -257,6 +388,17 @@ this.isSaveing = false; return err }) + this.$API.hrm.employee.update.req(this.form.id, this.form) + .then(res => { + this.isSaveing = false; + this.visible = false; + this.$emit("success", this.form, this.mode); + this.$message.success("操作成功"); + return res + }).catch(err => { + this.isSaveing = false; + return err + }) } } @@ -274,6 +416,49 @@ this.selectionFilters = filters; this.setFiltersVisible = true; }, + ///// + //用户岗位关系列表 + getUserPostList(){ + this.$API.system.userPost.list.req().then(res=>{ + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + this.userPostForm.list=res.results; + } + }) + }, + //新增用户岗位关系 + createUserPost(row){ + debugger; + console.log(row); + this.isSaveing = true; + row.dept = row.dept.slice(-1)[0]; + row.user = this.form.id; + this.$API.system.userPost.create.req(row).then(res=>{ + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + this.userPostForm.list=res.results; + } + }) + }, + //用户岗位关系删除 + userPostDel(id){ + this.$confirm(`确定删除该岗位关系吗?`, '提示', { + type: 'warning', + confirmButtonText: '删除', + confirmButtonClass: 'el-button--danger' + }).then(() => { + this.$API.system.userPost.delete.req(id).then(res=>{ + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + this.$message.success("操作成功"); + } + }) + }) + }, + }, }; diff --git a/src/views/ops/menu.vue b/src/views/ops/menu.vue index 6a0537b5..126b7241 100644 --- a/src/views/ops/menu.vue +++ b/src/views/ops/menu.vue @@ -27,13 +27,14 @@ @@ -53,15 +54,6 @@ - - - + @@ -192,20 +192,17 @@ }, //删除 delDept(row){ - var id = row.id; - var res = this.$API.system.dept.delete.req(id); - if(res.code == 200){ + let id = row.id; + let res = this.$API.system.dept.delete.req(id); + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ this.$refs.table.refresh(); this.$message.success("删除成功") - }else{ - this.$alert(res.message, "提示", {type: 'error'}) } }, submitHandle(){ let that = this; - debugger; - console.log(this.addForm.parent); - debugger; this.addForm.parent = this.addForm.parent!==null?this.addForm.parent[0]?this.addForm.parent[0]:'':''; this.$refs.addForm.validate( (valid) => { debugger; @@ -217,11 +214,15 @@ }else{ res = this.$API.system.dept.update.req(that.addForm.id,that.addForm); } - this.isSaveing = false; - this.limitedVisible = false; - this.$refs.table.refresh(); console.log(res); debugger; + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + this.isSaveing = false; + this.limitedVisible = false; + this.$refs.table.refresh(); + } } }) }, diff --git a/src/views/sys/dict.vue b/src/views/sys/dict.vue index d0bbb3a4..ca286e40 100644 --- a/src/views/sys/dict.vue +++ b/src/views/sys/dict.vue @@ -384,11 +384,11 @@ async delDic(row,index){ var delId = row.id; var res = await this.$API.system.dict.delete.req(delId); - if(res.code == 200){ + if(res.err.msg){ + this.$message.error(res.err.msg) + }else{ this.$refs.table.tableData.splice(index, 1); this.$message.success("删除成功") - }else{ - this.$alert(res.message, "提示", {type: 'error'}) } }, diff --git a/src/views/sys/post.vue b/src/views/sys/post.vue index 032db408..628ecc40 100644 --- a/src/views/sys/post.vue +++ b/src/views/sys/post.vue @@ -39,11 +39,22 @@ - - - + + + + + + + + + + + + @@ -54,7 +65,7 @@ - @@ -77,13 +88,23 @@ roleSave: false, }, selection: [], + postId:'', + options: { + 10: "全部", + 20: "自定义", + 30: "同级及以下", + 40: "本级及以下", + 50: "本级", + 60: "仅本人" + }, } }, methods: { rowClick(row) { - var params = { - event_cate: row.id + let params = { + post: row.id }; + this.postId = row.id; this.$refs.table2.reload(params) }, //窗口新增 @@ -118,7 +139,7 @@ this.$message.success("操作成功") }, - //本地更新数据 + //新增岗位后更新数据 handleSaveSuccess(data, mode) { //为了减少网络请求,直接变更表格内存数据 if (mode == 'add') { @@ -130,10 +151,20 @@ //当然也可以暴力的直接刷新表格 // this.$refs.table.refresh() }, + //新增岗位关系后更新数据 + handleSaveRoleSuccess() { + this.$refs.table2.refresh() + }, addPostRole(){ this.dialog.roleSave = true; this.$nextTick(() => { - this.$refs.saveDialog.open() + this.$refs.saveRoleDialog.open("add").setData({postId:this.postId}) + }) + }, + postRoleEdit(row){ + this.dialog.roleSave = true; + this.$nextTick(() => { + this.$refs.saveRoleDialog.open("edit").setData(row) }) }, delPostRole(){ @@ -142,15 +173,24 @@ closed(){ this.dialog.save = false; this.dialog.roleSave = false; + this.postId = ''; + this.$refs.table2.refresh(); }, - postRoleDel(){ - this.$confirm(`确定删除选中的岗位关系吗?如果删除项中含有子集将会被一并删除`, '提示', { + postRoleDel(row){ + this.$confirm(`确定删除选中的岗位关系吗?`, '提示', { type: 'warning' }).then(() => { - const loading = this.$loading(); - this.$refs.table.refresh(); - loading.close(); - this.$message.success("操作成功") + this.$API.system.postrole.delete.req(row.id).then(res=>{ + if(res.err_msg){ + this.$message.error(res.err_msg) + }else{ + const loading = this.$loading(); + this.$refs.table2.refresh(); + loading.close(); + this.$message.success("操作成功") + } + }) + }).catch(() => { }) diff --git a/src/views/sys/post_role_form.vue b/src/views/sys/post_role_form.vue index 8e1e4bf2..5de6bf59 100644 --- a/src/views/sys/post_role_form.vue +++ b/src/views/sys/post_role_form.vue @@ -117,10 +117,20 @@ export default { methods: { //显示 open(mode = "add"){ + debugger; this.mode = mode; this.visible = true; return this; }, + //表单注入数据 + setData(data) { + debugger; + if(data.postId){ + this.form.post=data.postId; + }else{ + Object.assign(this.form, data); + } + }, //表单提交方法 async submit() { var valid = await this.$refs.form.validate().catch(() => {}); @@ -146,10 +156,7 @@ export default { return err; } }, - //表单注入数据 - setData(data) { - Object.assign(this.form, data); - }, + getPosts(){ this.$API.system.post.list.req({page:0}).then(res=>{ if(res.err_msg){ diff --git a/src/views/sys/role.vue b/src/views/sys/role.vue index 07e97659..8d4cd0c8 100644 --- a/src/views/sys/role.vue +++ b/src/views/sys/role.vue @@ -126,7 +126,7 @@ }, //加载树数据 async getGroup() { - var res = await this.$API.system.dept.list.req({page: 0}); + let res = await this.$API.system.permission.list.req({page: 0}); let postList = res; let posts = []; postList.forEach(item => { @@ -169,25 +169,28 @@ console.log(this.menu.list); },*/ submitHandle(){ - debugger; let that = this; - debugger; this.addForm.perms = this.menu.checked; this.$refs.addForm.validate( (valid) => { - debugger; if (valid) { this.isSaveing = true; - var res; + let res; if(this.type==='add'){ res = this.$API.system.role.create.req(that.addForm); }else{ res = this.$API.system.role.update.req(that.addForm.id,that.addForm); } - this.isSaveing = false; - this.limitedVisible = false; - this.$refs.table.refresh(); console.log(res); debugger; + if(res.err_msg){ + this.$message.error(res.err_msg); + }else{ + this.isSaveing = false; + this.limitedVisible = false; + this.$refs.table.refresh(); + } + + } }) }, @@ -195,11 +198,13 @@ //编辑角色 roleEdit(row){ this.type='edit'; - this.limitedVisible = true; + this.menu.checked = '[]'; this.addForm.id=row.id; this.addForm.name=row.name; this.addForm.code=row.code; + this.menu.checked = row.perms; this.addForm.description=row.description; + this.limitedVisible = true; }, //删除角色 @@ -250,5 +255,5 @@ } diff --git a/src/views/sys/task.vue b/src/views/sys/task.vue index e69de29b..de41d813 100644 --- a/src/views/sys/task.vue +++ b/src/views/sys/task.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/src/views/sys/taskLogs.vue b/src/views/sys/taskLogs.vue new file mode 100644 index 00000000..7c4b9c73 --- /dev/null +++ b/src/views/sys/taskLogs.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/views/sys/user.vue b/src/views/sys/user.vue index 829d0974..085cf96d 100644 --- a/src/views/sys/user.vue +++ b/src/views/sys/user.vue @@ -39,12 +39,6 @@ :disabled="selection.length == 0" @click="batch_del" > - - @@ -178,16 +156,6 @@ clearable > - @@ -321,8 +289,8 @@ //删除 async table_del(row) { let res = await this.$API.system.user.delete.req(row.id); - if (res.err.msg) { - this.$alert(res.message, "提示", {type: "error"}); + if (res.err_msg) { + this.$message.error(res.err_msg); } else { this.$refs.table.refresh(); this.$message.success("删除成功"); @@ -384,9 +352,7 @@ debugger; this.$refs.addForm.validate(async (valid) => { if (valid) { - debugger; this.isSaveing = true; - // this.addForm.belong_dept = this.addForm.belong_dept[this.addForm.belong_dept.length - 1]; let res; if(this.type==='add'){ res = await this.$API.system.user.create.req(this.addForm); @@ -394,12 +360,11 @@ res = await this.$API.system.user.update.req(this.addForm.id,this.addForm); } this.isSaveing = false; - if(res.code == 200){ - this.visible = false; - this.$message.success("操作成功") + if(res.err_msg){ + this.$message(res.err_msg); }else{ - this.visible = false; - this.$alert(res.message, "提示", {type: 'error'}); + this.limitedVisible = false; + this.$message.success("操作成功") } }else{ return false; diff --git a/src/views/wf/field.vue b/src/views/wf/field.vue index 13c215c6..24872024 100644 --- a/src/views/wf/field.vue +++ b/src/views/wf/field.vue @@ -1,120 +1,129 @@