案例和课程edit treeList

This commit is contained in:
joshen@zcwytd.com
2023-08-02 18:29:20 +08:00
parent 8b6f366c6a
commit 7cb325c38d
3 changed files with 38 additions and 15 deletions

View File

@@ -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}&current=${current}`);
}
/**
* 按父ID查询列表
@@ -24,5 +35,6 @@ const list = function(sysResType, parentId) {
export default {
tree,
list
}
list,
treeList
}

View File

@@ -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) {

View File

@@ -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();