Files
dvcp_v2_webapp/project/pengliuyang/apps/AppCommunityResource/components/resourceManagement.vue

100 lines
2.7 KiB
Vue
Raw Normal View History

2022-09-30 10:45:57 +08:00
<template>
2022-09-30 16:14:56 +08:00
<section class="resourceManagement">
<ai-list>
<template #content>
<ai-search-bar>
<template #left>
<el-button type="primary" size="small" icon="iconfont iconAdd" @click="addResource">&nbsp;添加资源</el-button>
2022-10-08 15:31:25 +08:00
<ai-select v-model="search.categoryId" @change="search.current = 1, getList()" placeholder="资源种类" :selectList="categoryList" />
2022-09-30 16:14:56 +08:00
</template>
<template #right>
<el-input size="small" placeholder="资源姓名" v-model="search.resourceName" clearable
@clear="current = 1, search.resourceName = '', getList()" suffix-icon="iconfont iconSearch"
v-throttle="() => {(current = 1), getList();}"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size"
2022-09-30 18:01:15 +08:00
@getList="getList()" :col-configs="colConfigs" :dict="dict">
2022-09-30 16:14:56 +08:00
</ai-table>
</template>
</ai-list>
</section>
2022-09-30 10:45:57 +08:00
</template>
<script>
export default {
2022-09-30 13:47:38 +08:00
name: "resourceManagement",
2022-09-30 16:14:56 +08:00
props: {
instance: Function,
dict: Object,
areaId: String,
permissions: Function,
},
data() {
return {
search: {
current: 1,
categoryId: '',
size: 10,
resourceName: ''
},
total: 0,
tableData: [],
2022-10-08 15:31:25 +08:00
categoryList: [],
2022-09-30 16:14:56 +08:00
}
},
computed: {
colConfigs() {
return [
{prop: 'resourceName', label: '资源名称', width: '300px'},
{prop: 'categoryName', label: '资源种类', align: 'center'},
{prop: 'areaName', label: '行政归属', align: 'center'},
{prop: 'createTime', label: '添加时间', align: 'center'},
]
}
},
created() {
this.getList()
2022-10-08 15:31:25 +08:00
this.getCategoryList()
2022-09-30 16:14:56 +08:00
},
methods: {
getList() {
this.instance.post(`/app/appresourceinfo/list`,null,{
params: {
...this.search,
2022-10-08 17:15:54 +08:00
areaId: this.areaId,
2022-09-30 16:14:56 +08:00
}
}).then(res=> {
if(res?.data) {
this.tableData = res.data.records
2022-10-08 11:33:13 +08:00
this.total = res.data.total
2022-09-30 16:14:56 +08:00
}
})
},
addResource() {
this.$router.push({hash: "#addResource", query: {}})
2022-10-08 15:31:25 +08:00
},
getCategoryList() {
this.instance.post(`/app/appresourcecategory/list`,null,{
params: {
current: 1,
size: 3000,
}
}).then(res=> {
if(res?.data) {
this.categoryList = res.data.records.map(item=> {
return {
dictName: item.categoryName,
dictValue: item.id
}
})
}
})
},
2022-09-30 16:14:56 +08:00
}
2022-09-30 10:45:57 +08:00
}
</script>
2022-09-30 13:47:38 +08:00
<style lang="scss" scope>
2022-10-08 15:31:25 +08:00
.resourceManagement {}
2022-09-30 10:45:57 +08:00
</style>