From 7cb325c38dc86a9bd32c16f3dbcc84e88a2bf131 Mon Sep 17 00:00:00 2001 From: "joshen@zcwytd.com" Date: Wed, 2 Aug 2023 18:29:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E5=92=8C=E8=AF=BE=E7=A8=8Bed?= =?UTF-8?q?it=20treeList?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/type.js | 16 ++++++++++++++-- src/views/portal/case/Index.vue | 25 ++++++++++++++++--------- src/views/portal/course/Index.vue | 12 ++++++++---- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/api/modules/type.js b/src/api/modules/type.js index 05b381aa..37abdd9a 100644 --- a/src/api/modules/type.js +++ b/src/api/modules/type.js @@ -2,6 +2,7 @@ * 分类 */ import ajax from '@/utils/xajax.js' +import request from '../unionAjax.js'; /** * 提取全量树形结构数据 @@ -11,6 +12,16 @@ import ajax from '@/utils/xajax.js' const tree = function(sysResType) { return ajax.get(`/xboe/type/tree-list?sysResType=${sysResType}&status=1`); } +/** + * + * @param {*} sysResType [1] + * @param {*} pid [字典类别码] + * @param {*} current [1当前页码] + * @returns + */ +const treeList = function(sysResType,pid,current) { + return request.get('/infrasApi',`/dict/page?type=${sysResType}&pid=${pid}¤t=${current}`); +} /** * 按父ID查询列表 @@ -24,5 +35,6 @@ const list = function(sysResType, parentId) { export default { tree, - list -} \ No newline at end of file + list, + treeList +} diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index 4cd2c8c3..96cc28dd 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -346,6 +346,7 @@ import apiUser from "@/api/system/user.js"; import apiSearchterm from "@/api/modules/searchterm.js"; import { deepClone } from "../../../utils"; import apiDict from "@/api/modules/dict.js"; +import apiType from "@/api/modules/type.js"; import { cutFullName } from "@/utils/tools.js"; import apiPlace from "@/api/phase2/place.js" export default { @@ -507,26 +508,28 @@ export default { isBack = true; } console.log(isBack, 'isBack'); - Promise.all([apiDict.items("org_domain"), apiCase.majorTypes()]).then(rs => { - if (rs[0].status == 200) { - rs[0].result.forEach(item => { + // Promise.all([apiType.items("org_domain"), apiCase.majorTypes()]).then(rs => { + Promise.all([apiType.treeList(1,90,1), apiCase.majorTypes()]).then(rs => { + if (rs[0].code == 200) { + const {records} = rs[0].data + records.forEach(item => { item.fielclass = false; item.type = 'org_domain'; - item.list = item.list ? item.list : [] - if (Array.isArray(item.list)) { + item.list = item.children ? item.children : [] + if (Array.isArray(item.children)) { item.list.forEach(sub => { - sub.list = sub.list ? sub.list : [] + sub.list = sub.children ? sub.children : [] sub.fielclass = false - if (Array.isArray(sub.list)) { + if (Array.isArray(sub.children)) { sub.list.forEach(three => { - three.list = three.list ? three.list : [] + three.list = three.children ? three.children : [] three.fielclass = false }) } }) } }) - this.domain = rs[0].result; + this.domain = records; } if (rs[1].status == 200) { rs[1].result.forEach(item => { @@ -812,6 +815,7 @@ export default { } }); }, + // 无用 async getdomain() { let key = "org_domain"; await apiDict.items("org_domain").then(res => { @@ -1179,6 +1183,9 @@ export default { let ids = caseList.map((item, index) => { return item.authorId; }); + //不能为空 + if (!ids.length) return + const noReapetIds = [...new Set(ids)]; apiUser.getByIds(noReapetIds).then(res => { if (res.status == 200) { diff --git a/src/views/portal/course/Index.vue b/src/views/portal/course/Index.vue index 42d52add..6caad287 100644 --- a/src/views/portal/course/Index.vue +++ b/src/views/portal/course/Index.vue @@ -1013,10 +1013,12 @@ export default { async loadTypeData() { let $this = this; try { - const { result, status } = await apiType.tree(1); - if (status === 200) { + const result= await apiType.treeList(1,28,1); + const {data:{ records},code} = result + + if (code === 200) { let tree = []; - result.forEach((item, index) => { + records.forEach((item, index) => { let newItem = { type: 11, id: item.id, @@ -1029,7 +1031,7 @@ export default { //增加死数据 item.children.push({ type: 12, - id: item.id + index, + id: item.id * (index + 200), name: '线上品牌系列课程', children: [], checked: false, @@ -1061,6 +1063,8 @@ export default { }) } $this.oneList.push(newItem); + console.log(newItem); + }); this.loadLocalFilters();