@@ -122,7 +156,7 @@
show,
index
} from "@/api/party/studyResource";
-
+import { index as menulist} from "@/api/index";
import tinymce from "@/components/Tinymce"
export default {
components: {
@@ -139,9 +173,11 @@
listParty: [],
isShow: false,
id: "",
- type: "add",
+ type: "add",
+ menuList:[],
detail: {
- activity_list_id: "",
+ activity_list_id: "",
+ study_column_id:'',
title: "",
text: "",
myindex: 1,
@@ -165,7 +201,7 @@
}],
activity_list_id: [{
required: true,
- message: "选择类型"
+ message: "选择所属项目"
}]
}
@@ -186,7 +222,55 @@
}
}
},
- methods: {
+ methods: {
+ // 获取栏目
+ changeMenu(e){
+ console.log(e,e.at(-1))
+ if(e){
+ this.detail.study_column_id = e.at(-1)
+ }
+ },
+ changeActive(e){
+ if(e){
+ this.detail.activity_list_id = e
+ this.loadMenu()
+ }
+ },
+ async loadMenu() {
+ if(!this.detail.activity_list_id){
+ this.$message({
+ type:'warning',
+ message:'请先选择项目'
+ })
+ return
+ }
+ const res = await menulist({
+ page: 1,
+ page_size: 999,
+ with_relations: ['cover'],
+ table_name: "study_columns",
+ activity_list_id: this.detail.activity_list_id,
+ filter: [],
+ });
+
+ this.menuList = this.arrayToTree(res.data);
+ console.log("list",this.menuList)
+ },
+ arrayToTree(arr, pid = 0) {
+ const result = [];
+
+ arr.forEach(item => {
+ if (item.pid === pid) {
+ const children = this.arrayToTree(arr, item.id);
+ if (children.length) {
+ item.children = children;
+ }
+ result.push(item);
+ }
+ });
+
+ return result;
+ },
//上传
uploadFailAuto(err) {
console.log(err)
@@ -236,10 +320,12 @@
id: this.id
})
Object.assign(this.detail, res);
-
+ this.loadMenu()
this.$refs['tinymce'].setContent(res.text ?? ' ')
},
- editor() {
+ editor() {
+ console.log("this.detail",this.detail)
+ // return
save(this.detail).then(res => {
this.isShow = false
this.$Message.success("操作成功");
diff --git a/src/views/party/studyResource.vue b/src/views/party/studyResource.vue
index c15b10d..7a5d8ab 100644
--- a/src/views/party/studyResource.vue
+++ b/src/views/party/studyResource.vue
@@ -68,6 +68,10 @@
total: 0,
list: [],
table: [{
+ prop: 'activity_list.name',
+ label: '项目',
+ align: 'left',
+ },{
prop: 'title',
label: '标题',
align: 'left',