|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
- <list-frame title="地点管理" @query="search" :needFilter="false" @add="$router.push({ path: '/place/detail' })">
|
|
|
+ <list-frame title="地点管理" @query="search" :total="total" :needFilter="false" @add="$router.push({ path: '/location/detail' })">
|
|
|
<data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @deltet="toDelete"></data-table>
|
|
|
</list-frame>
|
|
|
</div>
|
|
@@ -9,6 +9,8 @@
|
|
|
<script>
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
+import { createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('location');
|
|
|
export default {
|
|
|
metaInfo: { title: '地点管理' },
|
|
|
name: 'index',
|
|
@@ -30,22 +32,26 @@ export default {
|
|
|
method: 'delete',
|
|
|
},
|
|
|
],
|
|
|
- fields: [{ label: '地点', prop: 'placename' }],
|
|
|
- list: [
|
|
|
- { id: 1, placename: '501' },
|
|
|
- { id: 2, placename: '502' },
|
|
|
- ],
|
|
|
+ fields: [{ label: '地点', prop: 'name' }],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
}),
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
- search({ skip = 0, limit = 15, ...info } = {}) {
|
|
|
- console.log(`in search`);
|
|
|
+ ...mapActions(['query', 'delete']),
|
|
|
+ async search({ skip = 0, limit = 15, ...info } = {}) {
|
|
|
+ const res = await this.query({ skip, limit, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ console.log(res);
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
},
|
|
|
toEdit(data) {
|
|
|
- console.log(`in toEdit`);
|
|
|
- console.log(data);
|
|
|
- this.$router.push({ path: '/place/detail', query: { id: data.id } });
|
|
|
+ this.$router.push({ path: '/location/detail', query: { id: data.id } });
|
|
|
},
|
|
|
toDelete(data) {
|
|
|
console.log(`in toDelete`);
|