|
@@ -389,19 +389,14 @@ export default {
|
|
parentData: {
|
|
parentData: {
|
|
checkStrictly: true,
|
|
checkStrictly: true,
|
|
lazy: true,
|
|
lazy: true,
|
|
- // Use an arrow function to maintain the correct `this` context
|
|
|
|
lazyLoad: async (node, resolve) => {
|
|
lazyLoad: async (node, resolve) => {
|
|
|
|
+ const { level, data } = node;
|
|
|
|
+ if (data && data.children && data.children.length !== 0) {
|
|
|
|
+ return resolve(node);
|
|
|
|
+ }
|
|
|
|
+ const parentId = level === 0 ? 0 : data.value;
|
|
try {
|
|
try {
|
|
- const { level, data } = node;
|
|
|
|
- if (data && data.children && data.children.length !== 0) {
|
|
|
|
- return resolve(node);
|
|
|
|
- }
|
|
|
|
- const parentId = level === 0 ? 0 : data.value;
|
|
|
|
- const parames = {
|
|
|
|
- pid: parentId
|
|
|
|
- };
|
|
|
|
- // Now `this` refers to the Vue instance
|
|
|
|
- const res = await this.$store.dispatch('pool/categoryList', parames);
|
|
|
|
|
|
+ const res = await this.$store.dispatch('pool/categoryList', { pid: parentId });
|
|
if (res.data) {
|
|
if (res.data) {
|
|
const nodes = res.data.map(item => ({
|
|
const nodes = res.data.map(item => ({
|
|
value: item.id,
|
|
value: item.id,
|
|
@@ -450,7 +445,7 @@ export default {
|
|
|
|
|
|
this.$store.dispatch('pool/getCategoryList', this.getApiData).then(res => {
|
|
this.$store.dispatch('pool/getCategoryList', this.getApiData).then(res => {
|
|
// console.log("=============:",res.data)
|
|
// console.log("=============:",res.data)
|
|
- this.tableData = res.data.rows; //��与内容
|
|
|
|
|
|
+ this.tableData = res.data.rows; //与内容
|
|
this.allCount = res.data.total
|
|
this.allCount = res.data.total
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
this.$message({
|
|
this.$message({
|
|
@@ -530,30 +525,41 @@ export default {
|
|
this.windowStatus = true;
|
|
this.windowStatus = true;
|
|
},
|
|
},
|
|
//2.1.1 添加栏目池
|
|
//2.1.1 添加栏目池
|
|
- addCategoryList(row) {
|
|
|
|
- this.form.pid_arr =[];
|
|
|
|
|
|
+ async addCategoryList(row) {
|
|
|
|
+ this.form.pid_arr = [];
|
|
this.show_url = false;
|
|
this.show_url = false;
|
|
- // this.form.is_url = 0;
|
|
|
|
this.editId = 0;
|
|
this.editId = 0;
|
|
this.editBtn = false;
|
|
this.editBtn = false;
|
|
- this.tags = []
|
|
|
|
- if(row){
|
|
|
|
- if(row.pid==0){
|
|
|
|
- console.log("ceshi:::",row.id)
|
|
|
|
- this.form.pid_arr.push(row.id)
|
|
|
|
- }else{
|
|
|
|
- let pidArr = [];
|
|
|
|
- // console.log("fuck:",row.pid_arr);
|
|
|
|
- pidArr = JSON.parse(row.pid_arr)
|
|
|
|
- console.log("ceshi:::###",pidArr,row.id)
|
|
|
|
- pidArr.push(row.id)
|
|
|
|
- this.form.pid_arr = pidArr
|
|
|
|
- // console.log('追加id:',this.form.pid_arr)
|
|
|
|
|
|
+ this.tags = [];
|
|
|
|
+
|
|
|
|
+ if(row) {
|
|
|
|
+ let pidArr = [];
|
|
|
|
+ if(row.pid == 0) {
|
|
|
|
+ pidArr = [row.id];
|
|
|
|
+ } else {
|
|
|
|
+ try {
|
|
|
|
+ pidArr = JSON.parse(row.pid_arr);
|
|
|
|
+ pidArr.push(row.id);
|
|
|
|
+ } catch(e) {
|
|
|
|
+ pidArr = [];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 先打开窗口
|
|
|
|
+ this.openWindow();
|
|
|
|
+
|
|
|
|
+ // 预加载数据
|
|
|
|
+ for(let i = 0; i < pidArr.length; i++) {
|
|
|
|
+ const parentId = i === 0 ? 0 : pidArr[i - 1];
|
|
|
|
+ await this.$store.dispatch('pool/categoryList', { pid: parentId });
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 设置值并更新 key
|
|
|
|
+ this.form.pid_arr = pidArr;
|
|
|
|
+ this.parentKey += 1;
|
|
|
|
+ } else {
|
|
|
|
+ this.openWindow();
|
|
}
|
|
}
|
|
- // console.log(this.form.pid_arr)
|
|
|
|
- console.log("=========:", this.form.pid_arr)
|
|
|
|
- this.openWindow();
|
|
|
|
},
|
|
},
|
|
//2.2 关闭弹出框
|
|
//2.2 关闭弹出框
|
|
closeWindow() {
|
|
closeWindow() {
|
|
@@ -774,7 +780,7 @@ export default {
|
|
|
|
|
|
::v-deep .custom-textarea .el-textarea__inner {
|
|
::v-deep .custom-textarea .el-textarea__inner {
|
|
resize: none;
|
|
resize: none;
|
|
- /* 禁止用���拖拽调整大小 */
|
|
|
|
|
|
+ /* 禁止用拖拽调整大小 */
|
|
}
|
|
}
|
|
|
|
|
|
::v-deep .custom-align-right .el-form-item__label {
|
|
::v-deep .custom-align-right .el-form-item__label {
|