|
@@ -79,6 +79,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { mapActions, mapState } from 'vuex';
|
|
|
+import _ from 'lodash';
|
|
|
export default {
|
|
|
name: 'list',
|
|
|
props: {},
|
|
@@ -89,23 +90,34 @@ export default {
|
|
|
currentPage: 1,
|
|
|
totalRow: 0,
|
|
|
list: [],
|
|
|
- type: '',
|
|
|
}),
|
|
|
created() {
|
|
|
- this.$set(this, `type`, this.$route.params.type);
|
|
|
- this.$set(this.searchInfo, `date`, this.$route.query.date);
|
|
|
this.search();
|
|
|
},
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+ type() {
|
|
|
+ return this.$route.params.type;
|
|
|
+ },
|
|
|
+ date() {
|
|
|
+ return this.$route.query.date;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ type: 'search',
|
|
|
+ date: 'search',
|
|
|
+ },
|
|
|
methods: {
|
|
|
...mapActions(['postTalksInfo']),
|
|
|
async search(page) {
|
|
|
let skip = 0;
|
|
|
- if (page) {
|
|
|
+ if (page && _.isNumber(page)) {
|
|
|
skip = (page - 1) * this.$limit;
|
|
|
}
|
|
|
+ if (this.date) {
|
|
|
+ this.searchInfo['date'] = this.date;
|
|
|
+ }
|
|
|
let newData = { skip: skip, limit: this.$limit, ...this.searchInfo };
|
|
|
- this.type === 'in' ? (newData['schid'] = 999991) : '';
|
|
|
+ this.type === 'in' ? (newData['schid'] = this.$site) : '';
|
|
|
let result = await this.postTalksInfo({ type: 'list', data: newData });
|
|
|
if (`${result.errcode}` === '0') {
|
|
|
//给this=>vue的实例下在中的list属性,赋予result。data的值
|
|
@@ -116,14 +128,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- beforeRouteUpdate(to, from, next) {
|
|
|
- console.log(`to`);
|
|
|
- console.log(to);
|
|
|
- this.$set(this.searchInfo, `date`, to.query.date);
|
|
|
- this.$set(this, `type`, to.params.type);
|
|
|
- this.search();
|
|
|
- next();
|
|
|
- },
|
|
|
};
|
|
|
</script>
|
|
|
|