Blame view

admin-web-master/canvas-container/components/toolBar/toolModule/notice-select.vue 2.99 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  <template>
    <div class="product-select">
      <el-form :inline="true" :model="formData" class="demo-form-inline">
        <el-form-item label="">
          <el-input v-model="formData.keyword" placeholder="店铺名称"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :data="tableData"
        max-height="500"
        border
        style="width: 100%">
        <el-table-column label="" width="35" align="center">
          <template slot-scope="scope">
            <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
          </template>
        </el-table-column>
        <el-table-column prop="noticeTitle" label="标题" />
        <el-table-column label="内容" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span v-html="scope.row.noticeContent" />
          </template>
        </el-table-column>
        <el-table-column prop="createTime" label="发送时间" />
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </template>
  
  <script>
  import api from '@@/components/canvasShow/config/api'
  import {sendReqMixin} from '@@/components/canvasShow/config/mixin'
    export default {
      name: 'notice-select',
      mixins: [sendReqMixin],
      data () {
        return {
          tableRadio: '',
          currentPage: 1,
          total: 0,
          pageSize: 10,
          formData: {
            keyword: ''
          },
          tableData: []
        }
      },
      mounted () {
        this.getTableData()
      },
      methods: {
        // 获取公告信息
        getTableData () {
          var _this = this
          var paramsUrl = `${api.getNoticesAll}?page=${this.currentPage}&pageSize=${this.pageSize}`
          if (this.formData.keyword) {
            paramsUrl += `&noticeTitle=${this.formData.keyword}`
          }
          var data = {
            page: this.currentPage,
            pageSize: this.pageSize,
            noticeType: 2
          }
          if (this.formData.keyword) {
            data.noticeTitle = this.formData.keyword
          }
          let params = {
            url: paramsUrl,
            method: 'POST',
            data
          }
          this.sendReq(params, (res) => {
            _this.tableData = res.data.list
            _this.total = res.data.total
          })
        },
        // 搜索
        onSubmit () {
          this.getTableData()
        },
        // 每页条数改变
        handleSizeChange (val) {
          this.pageSize = val
          this.getTableData()
        },
        // 当前页改变
        handleCurrentChange (val) {
          this.currentPage = val
          this.getTableData()
        }
      }
    }
  </script>
  
  <style lang="scss" scoped>
    .product-select{
      .el-pagination{
        padding: 0px;
        margin-top: 30px;
      }
    }
  </style>