From 2f76010bd7f4e5047744795df6e3dbfedcd1585d Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Mon, 28 Aug 2023 17:31:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=AE=97=E5=85=B3=E8=81=94=E9=97=A8?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/flowable.js | 37 +++++++++++ src/api/system/fonds.js | 24 ++++++-- src/views/system/groupManage/index.vue | 85 +++++++++++++++----------- src/views/system/metadata/data.json | 19 ------ 4 files changed, 108 insertions(+), 57 deletions(-) create mode 100644 src/api/system/flowable.js delete mode 100644 src/views/system/metadata/data.json diff --git a/src/api/system/flowable.js b/src/api/system/flowable.js new file mode 100644 index 0000000..91c7789 --- /dev/null +++ b/src/api/system/flowable.js @@ -0,0 +1,37 @@ +import request from '@/utils/request' + +// 获取全部流程列表 +export function FetchInitFlowAll(params) { + return request({ + url: 'api/flowable/initFlowAll', + method: 'get', + params + }) +} + +// 获取全部流程列表 +export function FetchFlowList(params) { + return request({ + url: 'api/flowable/getFlowList', + method: 'get', + params + }) +} + +export function add(data) { + return request({ + url: 'api/fourTests/editFourTests', + method: 'post', + data + }) +} + +export function edit(data) { + return request({ + url: 'api/fourTests/editFourTests', + method: 'post', + data + }) +} + +export default { FetchInitFlowAll, add, edit } diff --git a/src/api/system/fonds.js b/src/api/system/fonds.js index 2a825a3..6a14374 100644 --- a/src/api/system/fonds.js +++ b/src/api/system/fonds.js @@ -34,7 +34,7 @@ export function del(data) { export function FetchUpdateFondsStatus(data) { return request({ - url: '/api/fonds/updateFondsStatus', + url: 'api/fonds/updateFondsStatus', method: 'post', data }) @@ -42,7 +42,7 @@ export function FetchUpdateFondsStatus(data) { export function FetchDownload(params) { return request({ - url: '/api/fonds/download', + url: 'api/fonds/download', method: 'get', params }) @@ -50,9 +50,25 @@ export function FetchDownload(params) { export function FetchFondsAll() { return request({ - url: '/api/fonds/getFondsAll', + url: 'api/fonds/getFondsAll', method: 'get' }) } -export default { add, edit, del, FetchInitFondsList, FetchUpdateFondsStatus, FetchDownload } +export function FetchFondsCategory(data) { + return request({ + url: 'api/fonds/fondsCategory', + method: 'post', + data + }) +} + +export function FetchFondsDetail(params) { + return request({ + url: 'api/fonds/getFondsDetail', + method: 'get', + params + }) +} + +export default { add, edit, del, FetchInitFondsList, FetchUpdateFondsStatus, FetchDownload, FetchFondsCategory, FetchFondsDetail } diff --git a/src/views/system/groupManage/index.vue b/src/views/system/groupManage/index.vue index 85533e4..ff2d050 100644 --- a/src/views/system/groupManage/index.vue +++ b/src/views/system/groupManage/index.vue @@ -122,6 +122,7 @@ node-key="id" highlight-current :props="defaultProps" + @check="categoryChange" /> @@ -161,6 +162,7 @@ export default { defaultProps: { children: 'children', label: 'cnName', isLeaf: 'leaf' }, currentId: 0, categoryLoading: false, showButton: false, categoryDatas: [], categoryIds: [], depts: [], deptDatas: [], // 多选时使用 + categoryAllData: [], permission: { add: ['admin', 'fonds:add'], edit: ['admin', 'fonds:edit'], @@ -233,16 +235,22 @@ export default { // 触发单选 handleCurrentChange(val) { if (val) { - // const _this = this + const _this = this // 清空菜单的选中 this.$refs.category.setCheckedKeys([]) // 保存当前的角色id - this.currentId = val.id - // 初始化默认选中的key - this.categoryIds = [] - // val.menus.forEach(function(data) { - // _this.categoryIds.push(data.id) - // }) + this.currentId = val.fondsId + crudfonds.FetchFondsDetail({ id: this.currentId }).then((res) => { + // 初始化默认选中的key + this.categoryIds = [] + if (res.categorys) { + res.categorys.forEach(function(data) { + _this.categoryIds.push(data.id) + }) + } + }).catch(err => { + console.log(err) + }) this.showButton = true } }, @@ -307,39 +315,48 @@ export default { }).catch(() => { }) }, - // menuChange(menu) { - // console.log(menu) - // // 获取该节点的所有子节点,id 包含自身 - // getChild(menu.id).then(childIds => { - // // 判断是否在 categoryIds 中,如果存在则删除,否则添加 - // if (this.categoryIds.indexOf(menu.id) !== -1) { - // for (let i = 0; i < childIds.length; i++) { - // const index = this.categoryIds.indexOf(childIds[i]) - // if (index !== -1) { - // this.categoryIds.splice(index, 1) - // } - // } - // } else { - // for (let i = 0; i < childIds.length; i++) { - // const index = this.categoryIds.indexOf(childIds[i]) - // if (index === -1) { - // this.categoryIds.push(childIds[i]) - // } - // } - // } - // this.$refs.category.setCheckedKeys(this.categoryIds) - // }) - // }, + categoryChange(categorys) { + console.log(categorys) + if (categorys.pid === 0) { + categorys.isChecked = !categorys.isChecked + this.categoryIds.push(categorys.id) + this.categoryAllData.forEach(childIds => { + if (categorys.isChecked) { + const index = this.categoryIds.indexOf(childIds.id) + if (index !== -1) { + this.categoryIds.splice(index, 1) + } + this.categoryIds.push(childIds.id) + } else { + this.categoryIds = [] + } + }) + } else { + if (this.categoryIds.indexOf(categorys.id) !== -1) { + const index = this.categoryIds.indexOf(categorys.id) + if (index !== -1) { + this.categoryIds.splice(index, 1) + } + } else { + const index = this.categoryIds.indexOf(categorys.id) + if (index === -1) { + this.categoryIds.push(categorys.id) + } + } + } + this.$refs.category.setCheckedKeys(this.categoryIds) + }, // 保存菜单 saveCategory() { this.categoryLoading = true - const fonds = { id: this.currentId, menus: [] } + const fonds = { id: this.currentId, categorys: [] } // 得到已选中的 key 值 this.categoryIds.forEach(function(id) { - const menu = { id: id } - fonds.menus.push(menu) + const categorys = { id: id } + fonds.categorys.push(categorys) }) - crudfonds.editMenu(fonds).then(() => { + console.log(fonds) + crudfonds.FetchFondsCategory(fonds).then(() => { this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS) this.categoryLoading = false this.update() diff --git a/src/views/system/metadata/data.json b/src/views/system/metadata/data.json deleted file mode 100644 index e0f16ad..0000000 --- a/src/views/system/metadata/data.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "id": 1, - "label": "元数据方案", - "isType": 1, - "children": [ - { - "id": 2, - "isType": 2, - "label": "精简方案" - }, - { - "id": 3, - "isType": 2, - "label": "完全方案" - } - ] - } -]