123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="main animate__animated animate__backInRight">
- <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> -->
- </el-col>
- <el-col :span="24" class="thr">
- <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
- </el-col>
- <el-col :span="24" class="four">
- <data-table
- :select="true"
- :selected="selected"
- @handleSelect="handleSelect"
- :fields="fields"
- :opera="opera"
- @query="search"
- :data="list"
- :total="total"
- @del="toDel"
- >
- </data-table>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- const _ = require('lodash');
- import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
- const { mapActions } = createNamespacedHelpers('goodsJoinAct');
- const { mapActions: dictData } = createNamespacedHelpers('dictData');
- export default {
- name: 'index',
- props: {},
- components: {
- // search1: () => import('./parts/search-1.vue'),
- },
- data: function () {
- const that = this;
- return {
- // 列表
- opera: [{ label: '删除', method: 'del', confirm: true, type: 'danger' }],
- fields: [
- { label: '活动标题', model: 'title' },
- { label: '活动时间', model: 'act_time.value' },
- ],
- list: [],
- total: 0,
- // 查询
- searchForm: {},
- // 多选值
- selected: [],
- };
- },
- async created() {
- await this.search();
- },
- methods: {
- ...dictData({ dictQuery: 'query' }),
- ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
- // 查询
- async search({ skip = 0, limit = 10, ...info } = {}) {
- const condition = _.cloneDeep(this.searchForm);
- let res = await this.query({ skip, limit, ...condition, ...info });
- if (this.$checkRes(res)) {
- this.$set(this, 'list', res.data);
- this.$set(this, 'total', res.total);
- }
- },
- // 新增
- toAdd() {
- this.$router.push({ path: '/platActivi/act/goosDetail' });
- },
- // 删除
- async toDel({ data }) {
- let res = await this.delete(data._id);
- if (this.$checkRes(res)) {
- this.$message({ type: `success`, message: `刪除信息成功` });
- this.search();
- }
- },
- // // 重置
- // toClose() {
- // this.searchForm = {};
- // this.search();
- // },
- // 多选
- handleSelect(data) {
- this.$set(this, `selected`, data);
- },
- },
- computed: {
- ...mapState(['user']),
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- watch: {
- test: {
- deep: true,
- immediate: true,
- handler(val) { },
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .main {
- .one {
- margin: 0 0 10px 0;
- span:nth-child(1) {
- font-size: 20px;
- font-weight: 700;
- margin-right: 10px;
- }
- }
- .two {
- margin: 0 0 10px 0;
- }
- .thr {
- margin: 0 0 10px 0;
- }
- }
- </style>
|