|
|
|
@ -7,6 +7,7 @@
|
|
|
|
|
:show-create="true"
|
|
|
|
|
:show-delete="true"
|
|
|
|
|
:disabled-delete="selectedRow.length === 0"
|
|
|
|
|
:default-search="search"
|
|
|
|
|
@onSearch="onSearch"
|
|
|
|
|
@onCreate="onCreate"
|
|
|
|
|
@onDelete="batchDelete"
|
|
|
|
@ -160,13 +161,54 @@ export default {
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters('setting', ['settings']),
|
|
|
|
|
},
|
|
|
|
|
async created() {
|
|
|
|
|
this.initSearchForm()
|
|
|
|
|
this.initTableListFields()
|
|
|
|
|
watch: {
|
|
|
|
|
'$route.query': {
|
|
|
|
|
immediate: true,
|
|
|
|
|
async handler() {
|
|
|
|
|
this.search.page = parseInt(this.$route.query.page) || 1
|
|
|
|
|
this.search.size = parseInt(this.$route.query.size) || 10
|
|
|
|
|
this.search.wd = this.$route.query.wd || ''
|
|
|
|
|
|
|
|
|
|
if (typeof this.$route.query.category_id === 'object') {
|
|
|
|
|
this.search.category_id = (this.$route.query.category_id || []).map((item) =>
|
|
|
|
|
parseInt(item)
|
|
|
|
|
)
|
|
|
|
|
} else if (this.$route.query.category_id) {
|
|
|
|
|
this.search.category_id = [parseInt(this.$route.query.category_id) || 0]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof this.$route.query.status === 'object') {
|
|
|
|
|
this.search.status = (this.$route.query.status || []).map((item) =>
|
|
|
|
|
parseInt(item)
|
|
|
|
|
)
|
|
|
|
|
} else if (this.$route.query.status) {
|
|
|
|
|
this.search.status = [parseInt(this.$route.query.status) || 0]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof this.$route.query.is_recommend === 'object') {
|
|
|
|
|
this.search.is_recommend = (this.$route.query.is_recommend || []).map((item) =>
|
|
|
|
|
item=="true"
|
|
|
|
|
)
|
|
|
|
|
} else if (this.$route.query.is_recommend) {
|
|
|
|
|
this.search.is_recommend = [this.$route.query.is_recommend==="true" || false]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 需要先加载分类数据
|
|
|
|
|
if (this.trees.length === 0) {
|
|
|
|
|
await this.listCategory()
|
|
|
|
|
}
|
|
|
|
|
await this.listDocument()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
async created() {
|
|
|
|
|
this.initSearchForm()
|
|
|
|
|
this.initTableListFields()
|
|
|
|
|
// // 需要先加载分类数据
|
|
|
|
|
// await this.listCategory()
|
|
|
|
|
// await this.listDocument()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async listCategory() {
|
|
|
|
|
const res = await listCategory({ field: ['id', 'parent_id', 'title'] })
|
|
|
|
@ -217,15 +259,21 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
handleSizeChange(val) {
|
|
|
|
|
this.search.size = val
|
|
|
|
|
this.listDocument()
|
|
|
|
|
this.$router.push({
|
|
|
|
|
query: this.search,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handlePageChange(val) {
|
|
|
|
|
this.search.page = val
|
|
|
|
|
this.listDocument()
|
|
|
|
|
this.$router.push({
|
|
|
|
|
query: this.search,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onSearch(search) {
|
|
|
|
|
this.search = { ...this.search, page: 1, ...search }
|
|
|
|
|
this.listDocument()
|
|
|
|
|
this.search = { ...this.search, ...search, page: 1 }
|
|
|
|
|
this.$router.push({
|
|
|
|
|
query: this.search,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onCreate() {
|
|
|
|
|
// 新增,跳转到前台文档上传页面
|
|
|
|
|