资源管理编辑 删除

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

View File

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

View File

@@ -15,6 +15,13 @@
</ai-search-bar> </ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size" <ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size"
@getList="getList()" :col-configs="colConfigs" :dict="dict"> @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> </ai-table>
</template> </template>
</ai-list> </ai-list>
@@ -50,6 +57,7 @@ export default {
{prop: 'categoryName', label: '资源种类', align: 'center'}, {prop: 'categoryName', label: '资源种类', align: 'center'},
{prop: 'areaName', label: '行政归属', align: 'center'}, {prop: 'areaName', label: '行政归属', align: 'center'},
{prop: 'createTime', label: '添加时间', align: 'center'}, {prop: 'createTime', label: '添加时间', align: 'center'},
{slot: 'options'}
] ]
} }
}, },
@@ -71,9 +79,11 @@ export default {
} }
}) })
}, },
addResource() { addResource() {
this.$router.push({hash: "#addResource", query: {}}) this.$router.push({hash: "#addResource", query: {}})
}, },
getCategoryList() { getCategoryList() {
this.instance.post(`/app/appresourcecategory/list`,null,{ this.instance.post(`/app/appresourcecategory/list`,null,{
params: { 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> </script>