|
@@ -6,10 +6,10 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="main">
|
|
|
<el-col :span="7" class="column">
|
|
|
- <column :columnInfo="columnInfo"></column>
|
|
|
+ <column :columnInfo="columnInfo" @delete="deleteData" @list="handleList"></column>
|
|
|
</el-col>
|
|
|
<el-col :span="17" class="message">
|
|
|
- <messageInfo :message="message"></messageInfo>
|
|
|
+ <messageInfo :message="message" :total="total" @delete="deleteMess"></messageInfo>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -20,7 +20,9 @@
|
|
|
import topInfo from '@/layout/public/top.vue';
|
|
|
import column from '@/layout/government/column.vue';
|
|
|
import messageInfo from '@/layout/government/messageInfo.vue';
|
|
|
-
|
|
|
+import { createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
+const { mapActions: mapColumn } = createNamespacedHelpers('column');
|
|
|
+const { mapActions: mapNews } = createNamespacedHelpers('news');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -31,27 +33,48 @@ export default {
|
|
|
},
|
|
|
data: () => ({
|
|
|
topTitle: '科技政务',
|
|
|
- columnInfo: [
|
|
|
- {
|
|
|
- title: '栏目标题',
|
|
|
- },
|
|
|
- ],
|
|
|
- message: [
|
|
|
- {
|
|
|
- title: '标题',
|
|
|
- column: '所属栏目',
|
|
|
- state: '未审核',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '十条数据',
|
|
|
- column: '所属栏目',
|
|
|
- state: '未审核',
|
|
|
- },
|
|
|
- ],
|
|
|
+ columnInfo: [],
|
|
|
+ message: [],
|
|
|
+ total: 0,
|
|
|
+ leftId: null,
|
|
|
}),
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
computed: {},
|
|
|
- methods: {},
|
|
|
+ methods: {
|
|
|
+ ...mapColumn(['query', 'delete', 'fetch']),
|
|
|
+ ...mapNews({ queryList: 'query', deleteList: 'delete' }),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.query({ skip, limit, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `columnInfo`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async deleteData(item) {
|
|
|
+ const res = await this.delete(item.id);
|
|
|
+ this.$checkRes(res, '删除成功', '删除失败');
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ handleList({ data }) {
|
|
|
+ this.$set(this, `leftId`, data.id);
|
|
|
+ this.searchRight();
|
|
|
+ },
|
|
|
+ async searchRight({ skip = 0, limit = 10, column_id } = {}) {
|
|
|
+ const res = await this.queryList({ skip, limit, column_id: this.leftId });
|
|
|
+ for (const val of res.data) {
|
|
|
+ const result = await this.fetch(val.column_id);
|
|
|
+ val.column_name = result.data.name;
|
|
|
+ }
|
|
|
+ this.$set(this, `message`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ },
|
|
|
+ async deleteMess(item) {
|
|
|
+ const res = await this.deleteList(item.id);
|
|
|
+ this.$checkRes(res, '删除成功', '删除失败');
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|