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
28
29
|
: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>
<el-table-column label="租金价格" prop="rentalPrice" show-overflow-tooltip></el-table-column>
<el-table-column label="付款周期" prop="leaseTerm" show-overflow-tooltip></el-table-column>
|
523cfe19
wesley88
1
|
30
|
<!-- <el-table-column label="付款日" prop="payDay" show-overflow-tooltip></el-table-column> -->
|
a182f238
wesley88
1
|
31
32
33
34
35
36
37
|
</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
|
38
39
40
|
<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
|
41
|
</el-pagination>
|
9d8bcb26
wesley88
2
|
42
43
44
|
</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
|
45
46
|
<el-button @click="cancel" class="buttonHover"
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">取消</el-button>
|
9d8bcb26
wesley88
2
|
47
48
49
50
51
|
</div>
</div>
</template>
<script>
|
ad921312
wesley88
1
|
52
53
54
|
import {
cereResourceStrategylist
} from '@/api/newly.js'
|
9d8bcb26
wesley88
2
|
55
56
57
|
import {
ceGetAll
} from '@/api/sam.js'
|
ad921312
wesley88
1
|
58
|
|
a182f238
wesley88
1
|
59
60
61
62
63
|
export default {
name: 'PolicySelector',
data() {
return {
total: 0,
|
9d8bcb26
wesley88
2
|
64
|
pageindex: {
|
9b392fc6
wesley88
1
|
65
|
isTemplate: "1",
|
a182f238
wesley88
1
|
66
67
68
|
pageNumber: 0,
pageSize: 5,
policyName: ''
|
9d8bcb26
wesley88
2
|
69
|
},
|
a182f238
wesley88
1
|
70
|
selectedRows: [],
|
ad921312
wesley88
1
|
71
72
73
74
75
76
77
|
celueData: [],
changelist: [],
yelist: [
], //页码处理数据
isone:false,
datalist:[]
|
a182f238
wesley88
1
|
78
|
};
|
9d8bcb26
wesley88
2
|
79
|
},
|
ad921312
wesley88
1
|
80
81
82
83
84
85
86
87
88
89
90
|
async created() {
await this.getAll()
this.intdatalist()
},
props: {
resourcesId: {
type: String,
default: function () {
return ''
}
|
e75fe4fe
wesley88
2
|
91
92
93
94
95
96
97
|
},
type: {
type: String,
default: function () {
return ''
}
},
|
9d8bcb26
wesley88
2
|
98
|
},
|
a182f238
wesley88
1
|
99
|
methods: {
|
ad921312
wesley88
1
|
100
101
102
103
104
105
106
107
108
109
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
|
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
|
169
|
async getAll() {
|
e75fe4fe
wesley88
2
|
170
|
const celue = await ceGetAll({...this.pageindex,applicableResources:this.type})
|
a182f238
wesley88
1
|
171
172
|
this.celueData = celue.data.content
this.total = celue.data.totalElements
|
ad921312
wesley88
1
|
173
|
|
a182f238
wesley88
1
|
174
|
},
|
ad921312
wesley88
1
|
175
176
177
178
179
180
181
|
async handleCurrentChange(val) {
this.isone = false
this.pageindex.pageNumber = val - 1
await this.getAll()
this.$nextTick(() => {
this.setchange()
})
|
a182f238
wesley88
1
|
182
183
184
185
186
187
188
189
190
|
},
handleSizeChange(val) {
this.pageindex.pageSize = val
},
onSearch() {
this.pageindex.pageNumber = 0
this.getAll()
},
resetting() {
|
ad921312
wesley88
1
|
191
|
this.pageindex = {
|
a182f238
wesley88
1
|
192
193
194
195
196
197
198
199
|
pageNumber: 0,
pageSize: 5,
policyName: ''
}
this.getAll()
},
handleSelectionChange(selection) {
this.selectedRows = selection;
|
ad921312
wesley88
1
|
200
201
202
203
204
205
206
|
// 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
|
207
208
|
},
confirm() {
|
ad921312
wesley88
1
|
209
210
211
212
213
214
215
216
217
218
219
|
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
|
220
221
222
223
|
},
cancel() {
this.$emit('mingClose');
}
|
9d8bcb26
wesley88
2
|
224
|
}
|
a182f238
wesley88
1
|
225
|
};
|
9d8bcb26
wesley88
2
|
226
227
228
|
</script>
<style scoped>
|
a182f238
wesley88
1
|
229
230
|
.policy-selector {
padding: 20px;
|
c3bca151
wesley88
1
|
231
|
/* padding: 20px;
|
a182f238
wesley88
1
|
232
233
|
width: 100%;
margin: 0 auto;
|
c3bca151
wesley88
1
|
234
|
border: 1px solid #ddd; */
|
a182f238
wesley88
1
|
235
236
237
|
/* border-radius: 4px; */
/* box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); */
}
|
9d8bcb26
wesley88
2
|
238
|
|
a182f238
wesley88
1
|
239
240
241
242
|
.policy-selector-header {
text-align: left;
margin-bottom: 20px;
}
|
9d8bcb26
wesley88
2
|
243
|
|
a182f238
wesley88
1
|
244
245
246
247
248
|
.policy-selector-header h3 {
margin: 0;
font-size: 18px;
color: #303133;
}
|
9d8bcb26
wesley88
2
|
249
|
|
a182f238
wesley88
1
|
250
251
252
|
.policy-selector-content {
margin-bottom: 20px;
}
|
9d8bcb26
wesley88
2
|
253
|
|
a182f238
wesley88
1
|
254
255
256
257
258
|
.policy-selector-footer {
display: flex;
justify-content: flex-end;
align-items: center;
}
|
c3bca151
wesley88
1
|
259
260
261
|
::v-deep .el-dialog__body {
padding: 0 0 !important;
}
|
a182f238
wesley88
1
|
262
|
</style>
|