mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 03:46:44 +08:00
案例和课程edit treeList
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
* 分类
|
* 分类
|
||||||
*/
|
*/
|
||||||
import ajax from '@/utils/xajax.js'
|
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) {
|
const tree = function(sysResType) {
|
||||||
return ajax.get(`/xboe/type/tree-list?sysResType=${sysResType}&status=1`);
|
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查询列表
|
* 按父ID查询列表
|
||||||
@@ -24,5 +35,6 @@ const list = function(sysResType, parentId) {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
tree,
|
tree,
|
||||||
list
|
list,
|
||||||
|
treeList
|
||||||
}
|
}
|
||||||
@@ -346,6 +346,7 @@ import apiUser from "@/api/system/user.js";
|
|||||||
import apiSearchterm from "@/api/modules/searchterm.js";
|
import apiSearchterm from "@/api/modules/searchterm.js";
|
||||||
import { deepClone } from "../../../utils";
|
import { deepClone } from "../../../utils";
|
||||||
import apiDict from "@/api/modules/dict.js";
|
import apiDict from "@/api/modules/dict.js";
|
||||||
|
import apiType from "@/api/modules/type.js";
|
||||||
import { cutFullName } from "@/utils/tools.js";
|
import { cutFullName } from "@/utils/tools.js";
|
||||||
import apiPlace from "@/api/phase2/place.js"
|
import apiPlace from "@/api/phase2/place.js"
|
||||||
export default {
|
export default {
|
||||||
@@ -507,26 +508,28 @@ export default {
|
|||||||
isBack = true;
|
isBack = true;
|
||||||
}
|
}
|
||||||
console.log(isBack, 'isBack');
|
console.log(isBack, 'isBack');
|
||||||
Promise.all([apiDict.items("org_domain"), apiCase.majorTypes()]).then(rs => {
|
// Promise.all([apiType.items("org_domain"), apiCase.majorTypes()]).then(rs => {
|
||||||
if (rs[0].status == 200) {
|
Promise.all([apiType.treeList(1,90,1), apiCase.majorTypes()]).then(rs => {
|
||||||
rs[0].result.forEach(item => {
|
if (rs[0].code == 200) {
|
||||||
|
const {records} = rs[0].data
|
||||||
|
records.forEach(item => {
|
||||||
item.fielclass = false;
|
item.fielclass = false;
|
||||||
item.type = 'org_domain';
|
item.type = 'org_domain';
|
||||||
item.list = item.list ? item.list : []
|
item.list = item.children ? item.children : []
|
||||||
if (Array.isArray(item.list)) {
|
if (Array.isArray(item.children)) {
|
||||||
item.list.forEach(sub => {
|
item.list.forEach(sub => {
|
||||||
sub.list = sub.list ? sub.list : []
|
sub.list = sub.children ? sub.children : []
|
||||||
sub.fielclass = false
|
sub.fielclass = false
|
||||||
if (Array.isArray(sub.list)) {
|
if (Array.isArray(sub.children)) {
|
||||||
sub.list.forEach(three => {
|
sub.list.forEach(three => {
|
||||||
three.list = three.list ? three.list : []
|
three.list = three.children ? three.children : []
|
||||||
three.fielclass = false
|
three.fielclass = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.domain = rs[0].result;
|
this.domain = records;
|
||||||
}
|
}
|
||||||
if (rs[1].status == 200) {
|
if (rs[1].status == 200) {
|
||||||
rs[1].result.forEach(item => {
|
rs[1].result.forEach(item => {
|
||||||
@@ -812,6 +815,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 无用
|
||||||
async getdomain() {
|
async getdomain() {
|
||||||
let key = "org_domain";
|
let key = "org_domain";
|
||||||
await apiDict.items("org_domain").then(res => {
|
await apiDict.items("org_domain").then(res => {
|
||||||
@@ -1179,6 +1183,9 @@ export default {
|
|||||||
let ids = caseList.map((item, index) => {
|
let ids = caseList.map((item, index) => {
|
||||||
return item.authorId;
|
return item.authorId;
|
||||||
});
|
});
|
||||||
|
//不能为空
|
||||||
|
if (!ids.length) return
|
||||||
|
|
||||||
const noReapetIds = [...new Set(ids)];
|
const noReapetIds = [...new Set(ids)];
|
||||||
apiUser.getByIds(noReapetIds).then(res => {
|
apiUser.getByIds(noReapetIds).then(res => {
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
|
|||||||
@@ -1013,10 +1013,12 @@ export default {
|
|||||||
async loadTypeData() {
|
async loadTypeData() {
|
||||||
let $this = this;
|
let $this = this;
|
||||||
try {
|
try {
|
||||||
const { result, status } = await apiType.tree(1);
|
const result= await apiType.treeList(1,28,1);
|
||||||
if (status === 200) {
|
const {data:{ records},code} = result
|
||||||
|
|
||||||
|
if (code === 200) {
|
||||||
let tree = [];
|
let tree = [];
|
||||||
result.forEach((item, index) => {
|
records.forEach((item, index) => {
|
||||||
let newItem = {
|
let newItem = {
|
||||||
type: 11,
|
type: 11,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@@ -1029,7 +1031,7 @@ export default {
|
|||||||
//增加死数据
|
//增加死数据
|
||||||
item.children.push({
|
item.children.push({
|
||||||
type: 12,
|
type: 12,
|
||||||
id: item.id + index,
|
id: item.id * (index + 200),
|
||||||
name: '线上品牌系列课程',
|
name: '线上品牌系列课程',
|
||||||
children: [],
|
children: [],
|
||||||
checked: false,
|
checked: false,
|
||||||
@@ -1061,6 +1063,8 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
$this.oneList.push(newItem);
|
$this.oneList.push(newItem);
|
||||||
|
console.log(newItem);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
this.loadLocalFilters();
|
this.loadLocalFilters();
|
||||||
|
|||||||
Reference in New Issue
Block a user