9d8bcb26
wesley88
2
|
1
2
|
<template>
<div class="policy-selector">
|
a182f238
wesley88
1
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<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-input placeholder="请输入" suffix-icon="el-icon-search" style="margin-right:15px;width: 40%;"
v-model="pageindex.policyName">
</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;">
|
ad921312
wesley88
1
|
21
22
|
<el-table ref="multipleTable" :data="celueData" tooltip-effect="dark"
@selection-change="handleSelectionChange"
|
a182f238
wesley88
1
|
23
24
25
26
27
|
: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="策略名称" prop="policyName" show-overflow-tooltip></el-table-column>
<el-table-column label="适用资源" prop="applicableResources" show-overflow-tooltip></el-table-column>
|
249d13ce
杨鑫
最新
|
28
|
<el-table-column :label="type=='广告位'?'租金价格':'租金价格(元/m²)'" prop="rentalPrice" show-overflow-tooltip>
|
2210df30
wesley88
1
|
29
|
<template slot-scope="scope" >
|
02c2ca01
杨鑫
最新2
|
30
31
|
<span v-if="scope.row.rentalPrice!='' ">{{scope.row.rentalPrice}}元<span v-if="type!='广告位'">/m²</span></span>
<span v-else>-</span>
|
2210df30
wesley88
1
|
32
33
|
</template>
</el-table-column>
|
02c2ca01
杨鑫
最新2
|
34
35
36
37
38
39
|
<el-table-column label="付款周期" prop="leaseTerm" show-overflow-tooltip>
<template slot-scope="scope" >
<span v-if="scope.row.leaseTerm!=''">{{scope.row.leaseTerm}}</span>
<span v-else>-</span>
</template>
</el-table-column>
|
523cfe19
wesley88
1
|
40
|
<!-- <el-table-column label="付款日" prop="payDay" show-overflow-tooltip></el-table-column> -->
|
a182f238
wesley88
1
|
41
42
43
44
45
46
47
|
</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>
|
ad921312
wesley88
1
|
48
49
50
|
<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">
|
a182f238
wesley88
1
|
51
|
</el-pagination>
|
9d8bcb26
wesley88
2
|
52
53
54
|
</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>
|
a182f238
wesley88
1
|
55
56
|
<el-button @click="cancel" class="buttonHover"
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">取消</el-button>
|
9d8bcb26
wesley88
2
|
57
58
59
60
61
|
</div>
</div>
</template>
<script>
|
ad921312
wesley88
1
|
62
63
64
|
import {
cereResourceStrategylist
} from '@/api/newly.js'
|
9d8bcb26
wesley88
2
|
65
66
67
|
import {
ceGetAll
} from '@/api/sam.js'
|
ad921312
wesley88
1
|
68
|
|
a182f238
wesley88
1
|
69
70
71
72
73
|
export default {
name: 'PolicySelector',
data() {
return {
total: 0,
|
9d8bcb26
wesley88
2
|
74
|
pageindex: {
|
9b392fc6
wesley88
1
|
75
|
isTemplate: "1",
|
a182f238
wesley88
1
|
76
77
78
|
pageNumber: 0,
pageSize: 5,
policyName: ''
|
9d8bcb26
wesley88
2
|
79
|
},
|
a182f238
wesley88
1
|
80
|
selectedRows: [],
|
ad921312
wesley88
1
|
81
82
83
84
85
86
87
|
celueData: [],
changelist: [],
yelist: [
], //页码处理数据
isone:false,
datalist:[]
|
a182f238
wesley88
1
|
88
|
};
|
9d8bcb26
wesley88
2
|
89
|
},
|
ad921312
wesley88
1
|
90
91
92
93
94
95
96
97
98
99
100
|
async created() {
await this.getAll()
this.intdatalist()
},
props: {
resourcesId: {
type: String,
default: function () {
return ''
}
|
e75fe4fe
wesley88
2
|
101
102
103
104
105
106
107
|
},
type: {
type: String,
default: function () {
return ''
}
},
|
9d8bcb26
wesley88
2
|
108
|
},
|
a182f238
wesley88
1
|
109
|
methods: {
|
ad921312
wesley88
1
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
async intdatalist() {
let c1 = {
pageNumber: 0,
pageSize: 10,
resourcesId: this.resourcesId
}
await cereResourceStrategylist(c1).then(res => {
console.error(res)
if (!Array.isArray(res.data)) {
this.datalist = [];
return;
}
this.datalist = res.data
})
let listfy = []
const celue = await ceGetAll({
pageNumber: 0,
pageSize: 100
})
const total = celue.data.totalElements > 0 ? Math.ceil(celue.data.totalElements / this.pageindex.pageSize) : 0
for (let index = 0; index < total; index++) {
const element = {
num: index,
list: []
}
for (let i = 0; i < this.pageindex.pageSize; i++) {
if ((index * (this.pageindex.pageSize)) + i < celue.data.totalElements) {
const element1 = celue.data.content[(index * (this.pageindex.pageSize)) + i];
var iscz = this.datalist.findIndex(item => item.id === element1.id)
if (iscz == -1) { //说明arr中不存在id为objid的对象
} else {
element.list.push(element1)
}
}
}
listfy.push(element)
}
console.log(listfy)
this.yelist = listfy
if (this.yelist.length > 0) {
this.setchange()
}
},
toggleSelection(rows) {
// console.error(rows)
for (let index = 0; index < rows.length; index++) {
const element = rows[index];
this.changelist.push(element)
}
},
setchange() {
// console.error('改变已选中')
// console.error(this.yelist[this.pageindex.pageNumber])
for (let index = 0; index < this.yelist[this.pageindex.pageNumber].list.length; index++) {
const element = this.yelist[this.pageindex.pageNumber].list[index];
// console.error(element)
for (let i = 0; i < this.celueData.length; i++) {
const element1 = this.celueData[i];
if (element.id == element1.id) {
// console.error(element1.id)
this.$refs.multipleTable.toggleRowSelection(element1);
}
}
}
this.isone = true
},
|
a182f238
wesley88
1
|
179
|
async getAll() {
|
e75fe4fe
wesley88
2
|
180
|
const celue = await ceGetAll({...this.pageindex,applicableResources:this.type})
|
a182f238
wesley88
1
|
181
182
|
this.celueData = celue.data.content
this.total = celue.data.totalElements
|
ad921312
wesley88
1
|
183
|
|
a182f238
wesley88
1
|
184
|
},
|
ad921312
wesley88
1
|
185
186
187
188
189
190
191
|
async handleCurrentChange(val) {
this.isone = false
this.pageindex.pageNumber = val - 1
await this.getAll()
this.$nextTick(() => {
this.setchange()
})
|
a182f238
wesley88
1
|
192
193
194
195
196
197
198
199
200
|
},
handleSizeChange(val) {
this.pageindex.pageSize = val
},
onSearch() {
this.pageindex.pageNumber = 0
this.getAll()
},
resetting() {
|
ad921312
wesley88
1
|
201
|
this.pageindex = {
|
a182f238
wesley88
1
|
202
203
204
205
206
207
208
209
|
pageNumber: 0,
pageSize: 5,
policyName: ''
}
this.getAll()
},
handleSelectionChange(selection) {
this.selectedRows = selection;
|
ad921312
wesley88
1
|
210
211
212
213
214
215
216
|
// console.error('改变')
// console.error(this.selectedRows)
if(this.isone) {
// console.error('--------')
this.yelist[this.pageindex.pageNumber].list = JSON.parse(JSON.stringify(this.selectedRows))
}
|
a182f238
wesley88
1
|
217
218
|
},
confirm() {
|
ad921312
wesley88
1
|
219
220
221
222
223
224
225
226
227
228
229
|
var list = []
for (let i = 0; i < this.yelist.length; i++) {
let item = this.yelist[i]
if(item.list) {
for (let index = 0; index < item.list.length; index++) {
const element = item.list[index];
list.push(element)
}
}
}
this.$emit('minSev',list);
|
a182f238
wesley88
1
|
230
231
232
233
|
},
cancel() {
this.$emit('mingClose');
}
|
9d8bcb26
wesley88
2
|
234
|
}
|
a182f238
wesley88
1
|
235
|
};
|
9d8bcb26
wesley88
2
|
236
237
238
|
</script>
<style scoped>
|
a182f238
wesley88
1
|
239
240
|
.policy-selector {
padding: 20px;
|
c3bca151
wesley88
1
|
241
|
/* padding: 20px;
|
a182f238
wesley88
1
|
242
243
|
width: 100%;
margin: 0 auto;
|
c3bca151
wesley88
1
|
244
|
border: 1px solid #ddd; */
|
a182f238
wesley88
1
|
245
246
247
|
/* border-radius: 4px; */
/* box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); */
}
|
9d8bcb26
wesley88
2
|
248
|
|
a182f238
wesley88
1
|
249
250
251
252
|
.policy-selector-header {
text-align: left;
margin-bottom: 20px;
}
|
9d8bcb26
wesley88
2
|
253
|
|
a182f238
wesley88
1
|
254
255
256
257
258
|
.policy-selector-header h3 {
margin: 0;
font-size: 18px;
color: #303133;
}
|
9d8bcb26
wesley88
2
|
259
|
|
a182f238
wesley88
1
|
260
261
262
|
.policy-selector-content {
margin-bottom: 20px;
}
|
9d8bcb26
wesley88
2
|
263
|
|
a182f238
wesley88
1
|
264
265
266
267
268
|
.policy-selector-footer {
display: flex;
justify-content: flex-end;
align-items: center;
}
|
c3bca151
wesley88
1
|
269
270
271
|
::v-deep .el-dialog__body {
padding: 0 0 !important;
}
|
a182f238
wesley88
1
|
272
|
</style>
|