Blame view

admin-web-master/src/components/change/zy.vue 6.6 KB
c3bca151   wesley88   1
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
  <template>
    <div class="policy-selector">
      <div class="policy-selector-content">
        <div style="border: 1px solid #E5E5E5;padding: 1px" id="huodong">
          <div
            style="padding: 10px 13px;font-size: 14px;border-bottom: 1px solid #E5E5E5;display: flex;justify-content: space-between;">
            <div style="line-height:200%">选择策略</div>
            <div style="display: flex">
              <el-select v-model="zytype" placeholder="请选择" style="width: 40%;margin-right: 15px" @change="changzytype">
                  <el-option label="商铺" :value="'1'"></el-option>
                  <el-option label="广告" :value="'2'"></el-option>
                  <el-option label="场地" :value="'3'"></el-option>
              </el-select>
              <el-input placeholder="请输入" suffix-icon="el-icon-search" style="margin-right:15px;width: 40%;"
                v-model="name">
              </el-input>
              <el-button @click="onSearch" style="background-color: #3F9B6A;color: #fff">查询
              </el-button>
              <el-button @click="resetting" class="buttonHover"
                style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">重置
              </el-button>
            </div>
          </div>
          <div style="padding: 15px;">
            <div style="padding: 0px 20px 0px 0px;max-height:40vh;overflow-y: auto;">
              <el-table ref="multipleTable" :data="listData" tooltip-effect="dark"
                @selection-change="handleSelectionChange"
                :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}">
                <el-table-column label="选择" type="selection" width="55">
                </el-table-column>
                <el-table-column label="序号">
                  <template slot-scope="scope">
                    {{scope.$index +1 }}
                  </template>
                </el-table-column>
                <el-table-column label="编号" prop="id"></el-table-column>
                <el-table-column label="资源名称">
                  <template slot-scope="scope">
                    {{scope.row.shopName ? scope.row.shopName :  scope.row.advertisingName?scope.row.advertisingName:scope.row.venueName}}
                  </template>
                </el-table-column>
                <el-table-column label="资源类型">
                  <template slot-scope="scope">
                    {{scope.row.shopName ? '商铺' : scope.row.advertisingType?scope.row.advertisingType:'场地'}}
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
      </div>
      <div style="display: flex;justify-content: space-between;margin: 20px 0;" class="bom">
        <div style="font-size: 14px;">共 <span style="color: #3F9B6A;">{{total}}</span> 项数据</div>
        <el-pagination :current-page="pageindex.pageNumber+1" :page-sizes="[5,10, 20, 50, 100]"
          :page-size="pageindex.pageSize" background small layout="prev, pager, next" :total="total"
          @size-change="handleSizeChange" @current-change="handleCurrentChange">
        </el-pagination>
      </div>
      <div class="policy-selector-footer" style="display: flex; justify-content: flex-end; align-items: center;">
        <el-button @click="confirm" style="background-color: #3F9B6A;color: #fff;">确定</el-button>
        <el-button @click="cancel" class="buttonHover"
          style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">取消</el-button>
      </div>
    </div>
  </template>
  
  <script>
      import {
      cereResourceStrategylist
    } from '@/api/newly.js'
    import {
      ceGetAll
    } from '@/api/sam.js'
    import {
      getAlls,
      changAlls
    } from '@/api/information.js'
    import {
      getAlls as map1
    } from '@/api/map1.js'
    export default {
      data() {
        return {
          name:'',
          zytype:'1',
          total: 0,
          pageindex: {
            pageNumber: 0,
            pageSize: 5,
6abe0316   wesley88   1
90
            // publishStatus:'0'
c3bca151   wesley88   1
91
92
93
94
95
96
97
98
99
100
          },
          selectedRows: [],
          listData: [],
        };
      },
      async created() {
  
        await this.getAll()
      },
      props: {
6abe0316   wesley88   1
101
        publishStatus: {
c3bca151   wesley88   1
102
103
          type: String,
          default: function () {
6abe0316   wesley88   1
104
            return '0'
c3bca151   wesley88   1
105
          }
6abe0316   wesley88   1
106
107
108
109
110
111
112
        },
        maxSelection: {
          type: Number,
          default: function () {
            return 20
          }
        },
c3bca151   wesley88   1
113
114
115
116
117
118
119
120
      },
      methods: {
        changzytype() {
          this.onSearch()
        },
        async getAll() {
          let list = []
          if(this.zytype == '1') {
6abe0316   wesley88   1
121
            list = await getAlls({shopName: this.name,...this.pageindex,publishStatus:this.publishStatus})
c3bca151   wesley88   1
122
          } else if(this.zytype == '2') {
6abe0316   wesley88   1
123
            list = await map1({advertisingName: this.name,...this.pageindex,publishStatus:this.publishStatus})
c3bca151   wesley88   1
124
          } else if(this.zytype == '3') {
6abe0316   wesley88   1
125
            list = await changAlls({venueName: this.name,...this.pageindex,publishStatus:this.publishStatus})
c3bca151   wesley88   1
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
          }
          this.listData = list.data.content
          this.total = list.data.totalElements
  
        },
        async handleCurrentChange(val) {
          this.pageindex.pageNumber = val - 1
          await this.getAll()
        },
        handleSizeChange(val) {
          this.pageindex.pageSize = val
          this.getAll()
        },
        onSearch() {
          this.pageindex.pageNumber = 0
          this.getAll()
        },
        resetting() {
          this.pageindex = {
            pageNumber: 0,
            pageSize: 5,
          }
          this.name = ''
          this.getAll()
        },
        handleSelectionChange(selection) {
6abe0316   wesley88   1
152
153
154
155
156
157
158
159
160
          if (selection.length > this.maxSelection) {
            this.$message.warning(`最多只能选择 ${this.maxSelection} 项`);
            this.$refs.multipleTable.clearSelection();
            selection.slice(0, this.maxSelection).forEach(row => {
              this.$refs.multipleTable.toggleRowSelection(row, true);
            });
          } else {
            this.selectedRows = selection;
          }
c3bca151   wesley88   1
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
        },
        confirm() {
  
          this.$emit('minSev',this.selectedRows);
        },
        cancel() {
          this.$emit('mingClose');
        }
      }
    };
  </script>
  
  <style scoped>
    .policy-selector {
      padding: 20px;
      /* padding: 20px;
      width: 100%;
      margin: 0 auto;
      border: 1px solid #ddd; */
      /* border-radius: 4px; */
      /* box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); */
    }
  
    .policy-selector-header {
      text-align: left;
      margin-bottom: 20px;
    }
  
    .policy-selector-header h3 {
      margin: 0;
      font-size: 18px;
      color: #303133;
    }
  
    .policy-selector-content {
      margin-bottom: 20px;
    }
  
    .policy-selector-footer {
      display: flex;
      justify-content: flex-end;
      align-items: center;
    }
    ::v-deep .el-dialog__body {
      padding: 0 0 !important;
    }
  </style>