|
@@ -11,7 +11,7 @@
|
|
|
<span v-show="view === 'list'">
|
|
|
<el-col :span="24" class="one"> <span>活动标题</span> </el-col>
|
|
|
<el-col :span="24" class="two">
|
|
|
- <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
|
|
|
+ <search-1 :form="searchForm" @onSubmit="toSearch" @toReset="toClose"></search-1>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="thr">
|
|
|
<el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
|
|
@@ -91,22 +91,31 @@ export default {
|
|
|
id: '',
|
|
|
// type: '',
|
|
|
act_typeList: [],
|
|
|
+ // 查询条件
|
|
|
+ searchQuery: {},
|
|
|
};
|
|
|
},
|
|
|
- async created() {
|
|
|
- await this.searchOther();
|
|
|
- await this.search();
|
|
|
+ created() {
|
|
|
+ this.searchOther();
|
|
|
+ this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
...dictData({ dictQuery: 'query' }),
|
|
|
...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
|
|
|
+ toSearch() {
|
|
|
+ const res = this.$refs.dataTable.getPageConfig();
|
|
|
+ this.search(res);
|
|
|
+ },
|
|
|
// 查询
|
|
|
- async search({ skip = 0, limit = this.$limit, ...info } = {}) {
|
|
|
+ async search({ skip = 0, limit = this.$limit, ...others } = {}) {
|
|
|
const condition = _.cloneDeep(this.searchForm);
|
|
|
- let res = await this.query({ skip, limit, ...condition, ...info });
|
|
|
+ let query = { skip, limit, ...others };
|
|
|
+ if (Object.keys(condition).length > 0) query = { ...query, ...condition };
|
|
|
+ let res = await this.query(query);
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, 'list', res.data);
|
|
|
this.$set(this, 'total', res.total);
|
|
|
+ this.$set(this, `searchQuery`, query);
|
|
|
}
|
|
|
this.loadings = false;
|
|
|
},
|
|
@@ -123,6 +132,7 @@ export default {
|
|
|
},
|
|
|
toBack() {
|
|
|
this.view = 'list';
|
|
|
+ this.search(this.searchQuery);
|
|
|
},
|
|
|
// 商品管理
|
|
|
async toManage({ data }) {
|
|
@@ -133,7 +143,7 @@ export default {
|
|
|
let res = await this.delete(data._id);
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$message({ type: `success`, message: `刪除信息成功` });
|
|
|
- this.search();
|
|
|
+ this.search(this.searchQuery);
|
|
|
}
|
|
|
},
|
|
|
// 重置
|