宣传资讯

This commit is contained in:
liuye
2022-04-25 14:37:24 +08:00
parent ac99e83459
commit 9521730bae
4 changed files with 66 additions and 40 deletions

View File

@@ -12,7 +12,7 @@
<el-form-item label="发布地区" prop="areaId">
<ai-area-get :instance="instance" v-model="form.areaId" :root="rootArea" />
</el-form-item>
<el-form-item label="文章类型" prop="moduleId" style="width:50%;">
<el-form-item label="文章类型" prop="moduleId" style="width:50%;" v-if="miniTypeList.length">
<ai-select v-model="form.moduleId" :selectList="miniTypeList" @change="getNewTypeList"/>
</el-form-item>
<el-form-item label="分类" prop="categoryId" style="width:50%;">
@@ -106,7 +106,7 @@ export default {
files: []
},
miniTypeList: [],
newTypeList: []
newTypeList: [],
}
},
methods: {
@@ -161,17 +161,14 @@ export default {
},
getDetail() {
let {id} = this.$route.query
if(!id) {
return
}
id && this.instance.post("/app/apppreventionreturntopoverty/queryDetailById", null, {
id && this.instance.post("/app/apppublicityinfo/queryDetailById", null, {
params: {id}
}).then(res => {
if (res?.data) {
if(res.data.pictureUrl) {
res.data.pictureUrlList = [{url: res.data.pictureUrl}]
}
this.form = res.data
this.form = {...res.data}
this.getNewTypeList()
}
})
@@ -180,29 +177,35 @@ export default {
let {parentId} = this.$route.query
this.instance.post(`/app/apppublicitycategory/list?categoryType=1&size=100&parentId=${parentId}`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.dictName = item.categoryName
item.dictValue = item.id
this.miniTypeList = res.data.records.map((item) => {
return {
dictName: item.categoryName,
dictValue: item.id
}
})
this.miniTypeList = res.data.records
console.log(this.miniTypeList)
if(this.$route.query.id) {
this.getDetail()
}
}
})
},
getNewTypeList() {
this.instance.post(`/app/apppublicitycategory/list?categoryType=2&size=100&parentId=${this.form.moduleId}`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.dictName = item.categoryName
item.dictValue = item.id
res.data.records
this.newTypeList = res.data.records.map((item) => {
return {
dictName: item.categoryName,
dictValue: item.id
}
})
this.newTypeList = res.data.records
}
})
},
},
created() {
this.getTypeList()
this.getDetail()
}
}
</script>

View File

@@ -46,7 +46,7 @@
@selection-change="v=>ids=v.map(e=>e.id)">
<el-table-column slot="options" label="操作" fixed="right" align="center" width='150px'>
<template slot-scope="{row}">
<el-button type="text" @click="showDetail(row.id)">编辑</el-button>
<el-button type="text" @click="showEdit(row.id)">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
@@ -130,7 +130,7 @@ export default {
methods: {
getTableData() {
this.instance.post("/app/apppublicityinfo/list", null, {
params: {...this.page, ...this.search}
params: {...this.page, ...this.search, moduleId: this.miniTypeList[this.miniTypeIndex].id || ''}
}).then(res => {
if (res?.data) {
this.tableData = res.data?.records
@@ -139,7 +139,7 @@ export default {
})
},
showEdit(id) {
this.$router.push({query: {id: id, parentId: this.typeList[this.typeIndex].id}, hash: "#add"})
this.$router.push({query: {id: id, parentId: this.typeList[this.typeIndex].id, moduleId: this.miniTypeList[this.miniTypeIndex].id}, hash: "#add"})
},
handleDelete(ids) {
this.$confirm("是否删除该条宣传资讯信息").then(() => {
@@ -197,6 +197,10 @@ export default {
this.instance.post(`/app/apppublicitycategory/list?categoryType=1&size=100&parentId=${parentId}`).then(res => {
if (res.code == 0) {
this.miniTypeList = res.data.records
if(res.data.records && res.data.records.length) {
this.miniTypeClick(0)
}
}
})
},
@@ -214,6 +218,9 @@ export default {
},
miniTypeClick(e) {
this.miniTypeIndex = e
this.current = 1
this.tableData = []
this.getTableData()
},
editMini(index) {
this.form = {...this.miniTypeList[index]}