checkList.vue
7.55 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
<template>
<div class="system-container">
<div class="container">
<search-form
class="searchTop border-shadow testDrive"
:formModel="searchForm"
:formList="checkFormList"
>
<span
class="inline-b"
slot="form-slot"
>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="testDriveTableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</span>
</search-form>
<basic-table
ref="testDriveForm"
:tableParams="testDriveTableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
>
<span
class="dot"
:class="scope.scope.approvalStatus ? USERSTATUS[scope.scope.approvalStatus].split(',')[1] : ''"
></span>
<span class="statusText">{{ scope.scope.approvalStatus ? USERSTATUS[scope.scope.approvalStatus].split(',')[0] : '--'}}</span>
</span>
<span
slot="table-button"
slot-scope="scope"
>
<template v-for="(j, idx) in testDriveTableParams.tableOption.btnList">
<!-- approvalStatus为1也就是未审核状态展示全部按钮 -->
<template v-if="scope.scope.approvalStatus == 1">
<el-button
:key="idx"
:type="j.type || 'text'"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</template>
<template v-if="(j.pType !== 'pass' && j.pType !== 'reject') && scope.scope.approvalStatus != 1 && scope.scope.isAdd == 2">
<el-button
:key="idx"
:type="j.type || 'text'"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</template>
<!-- isAdd => 1: 只展示查看原围栏 2: 展示查看原围栏和修改后的围栏 -->
<template v-if="(j.remark == 'viewOrigin') && scope.scope.approvalStatus != 1 && scope.scope.isAdd == 1">
<el-button
:key="idx"
:type="j.type || 'text'"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</template>
</template>
</span>
</basic-table>
</div>
</div>
</template>
<script>
import { getList, updateFenceApproval } from 'services/testDrive'
export default {
data() {
return {
searchForm: {
keywords: ''
},
checkFormList: [
{
type: 'input',
inputType: 'text',
prop: 'keywords',
placeholder: '特约店编码|店名称',
},
{
type: 'select',
prop: 'approvalStatus',
placeholder: '请选择审核状态',
options: [{
value: '1',
label: '未审核'
}, {
value: '2',
label: '已通过'
}, {
value: '3',
label: '已驳回'
}]
}
],
testDriveTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '围栏名称',
prop: 'fenceName'
}, {
label: '围栏类型',
prop: 'fenceType'
}, {
label: '所属大区',
prop: 'area'
}, {
label: '所属省',
prop: 'province'
}, {
label: '所属市',
prop: 'city'
}, {
label: '特约店名称',
prop: 'shopName'
}, {
label: '特约店编码',
prop: 'shopCode'
}, {
label: '店级别',
prop: 'shopLevel'
}, {
label: '审核结果',
prop: 'approvalResult'
}, {
label: '审核结果备注',
prop: 'remark'
}
],
tableOption: {
width: 250,
btnList: [
{
name: '查看原围栏',
pType: 'view',
remark: 'viewOrigin'
},
{
name: '查看修改后围栏',
pType: 'view',
remark: 'viewUpdated'
},
{
name: '通过',
pType: 'pass',
remark: ''
},
{
name: '驳回',
pType: 'reject',
remark: ''
}
]
}
},
approvalParams: {
id: '',
status: 2,
remark: ''
},
getListApi: getList,
// 弹窗
testDriveVisible: false,
testDriveTitle: '',
testDriveForm: {},
testDriveData: [
{ label: '特约店名称:', prop: 'shopName', type: 'select', options: [{ label: '121', value: 'fdfa' }], clearable: true },
{ label: '车架号:', prop: 'vin', type: 'input', clearable: true },
{ label: '车型:', prop: 'modelId', type: 'select', options: [], clearable: true },
{ label: '配置:', prop: 'configDesc', type: 'input', clearable: true },
{ label: '车牌:', prop: 'licensePlate', type: 'input', clearable: true },
{ label: '外色:', prop: 'color', type: 'input', clearable: true },
{ label: '内色:', prop: 'innerColor', type: 'input', clearable: true },
{ label: '服役类型:', prop: 'serveType', type: 'select', options: [], clearable: true },
{ label: '设备号:', prop: 'sn', type: 'input', clearable: true }
],
}
},
methods: {
btnClick(pType, scope) {
const { approvalId } = scope;
this.approvalParams.id = approvalId;
switch (pType) {
case 'pass':
this.approvalParams.status = 2;
delete this.approvalParams.remark;
this.updateFenceApproval();
break
case 'reject':
this.approvalParams.status = 3;
this.showRejectRemarks();
break
case 'view':
let query = {
fenceId: scope.bizId,
readonlyStatus: true
};
const path = '/oEshield#/monitor/editFence';
history.pushState(query, path, path);
break
}
},
showRejectRemarks() {
this.$prompt('请输入驳回原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
this.approvalParams.remark = value;
this.updateFenceApproval();
}).catch(() => {
});
},
updateFenceApproval() {
updateFenceApproval(this.approvalParams).then(res => {
const { code, message } = res;
if (code == 200) {
this.$message({
type: 'success',
message: '操作成功!'
});
this.$refs.testDriveForm.refreshTable()
} else {
this.$message({
type: 'error',
message
});
}
})
},
refresh() {
this.searchForm = {
keywords: ''
}
this.$refs.testDriveForm.refreshTable()
}
},
}
</script>