rules.vue
10.6 KB
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
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
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<template>
<d2-container>
<el-card shadow="never">
<el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
<el-form-item label="设备类型:">
<el-select v-model="formInline.deviceType" placeholder="请选择">
<el-option value="" label="全部">全部</el-option>
<el-option v-for="item in deviceList" :key="item.id" :value="item.id" :label="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备型号:">
<el-input v-model="formInline.mnumName" placeholder="设备型号" />
</el-form-item>
<el-form-item label="设备号开头编码:">
<el-input v-model="formInline.snHead" placeholder="设备号开头编码" />
</el-form-item>
<el-form-item label="项目:">
<el-select v-model="formInline.subject" placeholder="请选择">
<el-option value="" label="全部">全部</el-option>
<el-option v-for="item in projectList" :key="item.id" :value="item.id" :label="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否投保:">
<el-select v-model="formInline.issure" placeholder="请选择">
<el-option value="" label="全部">全部</el-option>
<el-option value="Y" label="是"></el-option>
<el-option value="N" label="否"></el-option>
</el-select>
</el-form-item>
<el-form-item label="入库平台:">
<el-select v-model="formInline.moduleFlag" placeholder="请选择">
<el-option value="" label="全部">全部</el-option>
<el-option v-for="item in modulesList" :key="item.moduleFlag" :value="item.moduleFlag" :label="item.moduleFlagName"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" :loading="tableLoading" plain @click="getList()">搜索</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- 按钮操作区域 开始 -->
<div class="links_group">
<div class="left">
<el-button type="success" plain icon="el-icon-plus" size="small" @click="openAddPopup">新增</el-button>
</div>
<div class="right">
<el-button type="primary" plain icon="el-icon-download" size="small" :loading="eloading" @click="downloadExcel">导出</el-button>
</div>
</div>
<!-- 按钮操作区域 开始 -->
<!-- 表格区域 开始 -->
<div class="table_box">
<el-table class="el_table" v-loading="tableLoading" :data="tableData" stripe style="width: 100%" size="small" border>
<el-table-column prop="deviceTypeName" label="设备类型" />
<el-table-column prop="mnumName" label="设备型号" />
<el-table-column prop="snHead" label="设备SN开头编码" />
<el-table-column prop="subjectName" label="项目" />
<el-table-column prop="issureName" label="是否投保" />
<el-table-column prop="dvIccid" label="入库平台">
<template slot-scope="{row}">
<div class="flag_list">
<p v-for="(item,idx) in (row.listVo||[])" :key="idx">{{item.moduleFlagName}}</p>
</div>
</template>
</el-table-column>
<el-table-column prop="" label="操作">
<template slot-scope="scope">
<el-link type="danger" @click="openDialog(scope.row)">删除</el-link>
</template>
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination background layout="sizes, total,prev, pager, next, jumper" :total="pageTotal" :page-size="pageSize" :page-sizes="pageSizes" @current-change="getList" @size-change="changePageSize" />
</div>
</div>
<!-- 表格区域 end -->
<!-- 弹框 开始 -->
<glsx-dialog :show="showDialog" title="确认删除" width="50%" usefooter @closed="closeDialog">
<div class="remove_box" v-loading="rloading">
<h2 class="tips">请确认是否删除,删除后,设备不再自动分发到指定的业务系统,请谨慎操作!</h2>
<div class="row_form">
<div class="cell">
<span class="name">设备类型:</span>
<div class="txt_box">{{ruleInfo.deviceTypeName}}</div>
</div>
<div class="cell">
<span class="name">设备型号:</span>
<div class="txt_box">{{ruleInfo.mnumName}}</div>
</div>
<div class="cell">
<span class="name">设备号开头编码:</span>
<div class="txt_box">{{ruleInfo.snHead}}</div>
</div>
<div class="cell">
<span class="name">项目:</span>
<div class="txt_box">{{ruleInfo.subjectName}}</div>
</div>
<div class="cell">
<span class="name">是否投保:</span>
<div class="txt_box">{{ruleInfo.issureName}}</div>
</div>
<div class="cell">
<span class="name">入库平台:</span>
<div class="txt_box">
<div class="" v-for="(item,index) in (ruleInfo.listVo||[])" :key="index">{{item.moduleFlagName}}</div>
</div>
</div>
</div>
</div>
<div slot="footer" class="btn_group">
<el-button type="danger" plain size="small" :loading="dloading" @click="removeRules">确认删除</el-button>
<el-button size="small" @click="closeDialog">取消删除</el-button>
</div>
</glsx-dialog>
<!-- 弹框 end -->
<!-- 新增弹框 开始 -->
<glsx-dialog :show="addPopup" width="60%" title="新建设备分发规则" @close="closeAddPopup">
<div>
<add-rules ref="addRulesComponent" @change="onChange" v-if="addPopup"></add-rules>
</div>
<div slot="footer" class="btn_group">
<el-button type="success" plain size="small" :loading="aloading" @click="saveInfo">提交</el-button>
<el-button size="small" @click="closeAddPopup">取消</el-button>
</div>
</glsx-dialog>
<!-- 新增弹框 end -->
</d2-container>
</template>
<script>
import {
PAGEEXSYSDISPATCHRULE,
GETLISTSUBJECT,
GETLISTDEVICETYPE,
GETLISTMODULES,
EXPORTEXSYSDISPATCHRULE,
DELEXSYSDISPATCHRULE,
GETEXSYSDISPATCHRULE,
} from '@/http/order'
import GlsxDialog from '@/components/dialog/index'
import { deepClone, showToast } from '@/common/util'
import AddRules from './addRules.vue'
export default {
components: {
GlsxDialog,
AddRules,
},
data() {
return {
formInline: {},
tableData: [],
tableLoading: false,
pageTotal: 0,
currentPage: 1,
pageSizes: [10, 20, 30, 40],
pageSize: 10,
tdWidth: 170,
showDialog: false,
deviceList: [],
projectList: [],
modulesList: [],
eloading: false,
current: {},
dloading: false,
addPopup: false,
aloading: false,
ruleInfo: {},
rloading: false,
}
},
created() {},
mounted: function () {
this.getProject()
this.getDevice()
this.getModules()
this.getList()
},
methods: {
/**
* 查询列表
*/
getList: function (current) {
const _this = this
const oParams = _this.getParams()
console.log(current)
oParams.pageNum = current || _this.currentPage
_this.tableLoading = true
PAGEEXSYSDISPATCHRULE(oParams).then((res) => {
console.log(res)
_this.tableLoading = false
if (res.returnCode == 0) {
const { data } = res
const { total, listVo } = data
_this.tableData = listVo || []
_this.pageTotal = total
}
})
},
/**
* 获取查询参数
*/
getParams: function () {
let oParams = deepClone(this.formInline)
oParams.pageSize = this.pageSize
return oParams
},
/**
* 每页展示
*/
changePageSize: function (e) {
this.pageSize = e
this.getList()
},
// 打开弹框
openDialog(row) {
this.current = row
this.showDialog = true
this.getInfo(row)
},
/**关闭弹框 */
closeDialog: function () {
this.showDialog = false
},
// 获取项目列表
getProject() {
GETLISTSUBJECT().then((res) => {
this.projectList = res.data || []
})
},
// 获取设备大类列表
getDevice() {
GETLISTDEVICETYPE().then((res) => {
this.deviceList = res.data || []
})
},
// 获取入库平台
getModules() {
GETLISTMODULES().then((res) => {
this.modulesList = res.data || []
})
},
// 导出excel
downloadExcel() {
let _this = this
let oParams = this.getParams()
delete oParams.pageSize
_this.eloading = true
EXPORTEXSYSDISPATCHRULE(oParams)
.then((res) => {
_this.eloading = false
})
.catch((error) => {
_this.eloading = false
})
},
// 删除分发规则
removeRules() {
let _this = this
let oParams = {}
oParams.ruleCode = _this.current.ruleCode
console.log(_this.current)
_this.dloading = true
DELEXSYSDISPATCHRULE(oParams).then((res) => {
_this.dloading = false
if (res.returnCode == 0) {
showToast({
message: '删除成功',
type: 'success',
})
_this.getList()
_this.closeDialog()
}
})
},
// 保存数据
saveInfo() {
this.aloading = true
this.$refs.addRulesComponent.saveInfo()
},
// 打开新增弹框
openAddPopup() {
this.addPopup = true
},
// 关闭新增弹框
closeAddPopup() {
this.addPopup = false
},
// 监听组件变化
onChange(e) {
this.aloading = false
if (e) {
this.addPopup = false
this.getList()
}
},
// 获取规则详情
getInfo(row) {
this.rloading = true
GETEXSYSDISPATCHRULE({ ruleCode: row.ruleCode }).then((res) => {
this.rloading = false
this.ruleInfo = res.data.dto
})
},
},
}
</script>
<style lang="scss" scoped>
.table_box {
margin: 10px 0;
}
.remove_box {
width: 80%;
margin: 0 auto;
.tips {
font-size: 14px;
color: #f00;
font-weight: normal;
}
.row_form {
display: flex;
flex-wrap: wrap;
.cell {
flex: 0 0 50%;
display: flex;
padding: 10px 0;
.name {
width: 120px;
text-align: right;
flex-shrink: 0;
}
.txt_box {
flex: 0 0 1;
}
}
}
}
.flag_list {
p {
margin: 0;
padding: 0;
}
}
</style>