资源管理编辑 删除

This commit is contained in:
shijingjing
2022-10-12 09:22:59 +08:00
parent 2f42c353e4
commit 36f979a67a
3 changed files with 47 additions and 4 deletions

View File

@@ -124,12 +124,13 @@ export default {
created() {
this.areaId = this.user.info.areaId
this.getCategoryList()
this.getDetail()
},
methods: {
cancel() {
// currentPage: resourceManagement
this.$router.push({})
},
getCategoryList() {
this.instance.post(`/app/appresourcecategory/list`,null,{
params: {
@@ -147,16 +148,19 @@ export default {
}
})
},
handleAreaSelect(v) {
if(v.length) {
this.form.areaName = v[0]?.label
}
},
selectMap() {
this.form.lng = this.placeDetail.lng
this.form.lat = this.placeDetail.lat
this.showMap = false
},
getCorpLocation() {
this.instance.post('/app/appdvcpconfig/getCorpLocation').then((res) => {
if (res.code == 0) {
@@ -164,6 +168,7 @@ export default {
}
})
},
initMap({ lng, lat }) {
AMapLoader.load({
key: '54a02a43d9828a8f9cd4f26fe281e74e',
@@ -200,6 +205,7 @@ export default {
})
})
},
movePosition(center) {
if (this.map) {
this.map.clearMap()
@@ -214,6 +220,15 @@ export default {
}
},
getDetail() {
let {id} = this.$route.query
if (!id) return
this.instance.post(`/app/appresourceinfo/queryDetailById?id=${id}`).then(res=> {
if(res?.data) {
this.form = res.data
}
})
},
confirm() {
this.$refs.form.validate((valid) => {
@@ -222,13 +237,16 @@ export default {
...this.form
}).then(res => {
if (res.code == 0) {
this.$message.success('新增成功')
if(this.form.id) {
this.$message.success('修改成功')
} else {
this.$message.success('新增成功')
}
this.cancel()
}
})
}
})
},
},
}

View File

@@ -77,7 +77,7 @@ export default {
{prop: 'categoryName', label: '分类名称', width: '300px'},
{prop: 'resourceNum', label: '资源数量', align: 'center'},
{slot: "categoryIcon"},
{slot: 'option'},
{slot: 'options'},
]
},
rules() {

View File

@@ -15,6 +15,13 @@
</ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size"
@getList="getList()" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" label="状态" align="center">
<template slot-scope="{ row }">
<el-button type="text" title="详情" @click="toEdit(row.id)">编辑</el-button>
<el-button type="text" title="删除" @click="Delete(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
@@ -50,6 +57,7 @@ export default {
{prop: 'categoryName', label: '资源种类', align: 'center'},
{prop: 'areaName', label: '行政归属', align: 'center'},
{prop: 'createTime', label: '添加时间', align: 'center'},
{slot: 'options'}
]
}
},
@@ -71,9 +79,11 @@ export default {
}
})
},
addResource() {
this.$router.push({hash: "#addResource", query: {}})
},
getCategoryList() {
this.instance.post(`/app/appresourcecategory/list`,null,{
params: {
@@ -91,6 +101,21 @@ export default {
}
})
},
toEdit(id) {
this.$router.push({hash: "#addResource", query: {id}})
},
Delete(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appresourceinfo/delete?ids=${id}`).then(res=> {
if(res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
}
}
}
</script>