addDuan.vue
9.87 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
<template>
<div class="app-container">
<el-card>
<div>
<br>
<div>
<el-form
ref="" :model="queryParams" size="small" label-position="top" :inline="true"
label-width="auto"
>
<el-form-item label="姓名" prop="name">
<el-input v-model="queryParams.name" style="width: 200px;" />
</el-form-item>
<el-form-item label="证件号码" prop="idcCode">
<el-input v-model="queryParams.idcCode" placeholder="请输入" style="width: 250px;" @change="IDchange" />
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="selectFN"> 查询</el-button>
<el-button type="" @click="reset"> 重置</el-button>
</el-form-item>
</el-form></div>
<div>
<el-button type="primary" icon="Plus" @click="addForm">添加</el-button>
<el-button type="warning" icon="Upload" @click="addDuanExcl">导入</el-button>
<el-button type="success" icon="Upload" @click="handelUp">上传附件</el-button>
<br>
<br>
<el-table border :data="list" style="width: 100%">
<el-table-column label="序号" align="center" type="index" width="55" />
<el-table-column
label="姓名"
align="center"
prop="name"
min-width="80"
/>
<el-table-column
label="证件类型"
align="center"
prop="personIdcType"
min-width="80"
>
<template #default="props">
<div>{{ idcFilter(props.row.idcType) }}</div>
</template>
</el-table-column>
<el-table-column
label="性别"
align="center"
prop="sex"
min-width="80"
>
<template #default="{row}">
{{ row.sex==1?'女':'男' }}
</template>
</el-table-column>
<el-table-column
label="证件号"
align="center"
prop="idcCode"
min-width="170"
/>
<el-table-column
label="出生日期"
align="center"
prop="originValidityDate"
min-width="100"
:show-overflow-tooltip="true"
>
<template #default="scope">
<div>{{ parseTime(scope.row.birth, '{y}-{m}-{d}') }}</div>
</template>
</el-table-column>
<el-table-column
label="段位"
align="center"
prop="level"
min-width="100"
:show-overflow-tooltip="true"
>
<template #default="{row}">
{{ szToHz(row.level) }}段
</template>
</el-table-column>
<el-table-column
label="添加时间"
align="center"
prop="originValidityDate"
min-width="100"
:show-overflow-tooltip="true"
>
<template #default="scope">
<div>{{ parseTime(scope.row.passDate, '{y}-{m}-{d}') }}</div>
</template>
</el-table-column>
<el-table-column
label="状态"
align="center"
prop="originValidityDate"
min-width="100"
:show-overflow-tooltip="true"
>
<template #default="{row}">
{{ row.status }}
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- label="附件"-->
<!-- align="center"-->
<!-- min-width="100"-->
<!-- :show-overflow-tooltip="true"-->
<!-- >-->
<!-- <template #default="{row}">-->
<!-- <el-button type="primary" link @click="handelUp(row)">{{ row.fileUrl?'编辑':'上传' }}</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
label="操作"
align="center"
fixed="right"
class-name="small-padding"
width="100"
>
<template #default="scope">
<el-button type="danger" @click="handleDel(scope.row)">删除</el-button>
<!-- <el-button v-if="scope.row.status=='生效中'" type="danger" @click="handleDelete(scope.row)">撤回</el-button>-->
<!-- <el-button v-else color="#13B5B1" style="--el-color-black:#fff;" @click="handleSubmit(scope.row)">再确认</el-button>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
<br>
<br>
<el-row justify="center">
<el-button type="primary" :disabled="list?.length<=0" @click="commitFN"> 保存并提交</el-button>
</el-row>
</div>
<addDialog ref="addDialogRef" @success="addSuccess" />
</el-card>
<importDuan ref="importDuanRef" @uploaded="uploadedFn" />
<upload ref="uploadRef" @success="successFN" />
<Error ref="errorRef" />
</div>
</template>
<script setup>
import { ref, toRefs, reactive, onMounted } from 'vue'
import addDialog from './addDialog.vue'
import { useRoute, useRouter } from 'vue-router'
import { getCurrentInstance } from '@vue/runtime-core'
import { listApi, confirm, duanInputDel } from '@/api/exam/addDuan'
import importDuan from './importDuan.vue'
import upload from './upload.vue'
import Error from './error.vue'
import { idcFilter, szToHz } from '@/utils/ruoyi'
const router = useRouter()
const route = useRoute()
const { proxy } = getCurrentInstance()
const dialogID = ref(false)
const fileUrl = ref(null)
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
rangeId: null
}
})
const form = ref({
})
const showDialog = ref(false)
const total = ref(0)
const list = ref([])
const ids = ref([])
const { queryParams } = toRefs(data)
onMounted(() => {
if (route.query.fileUrl) fileUrl.value = JSON.parse(route.query.fileUrl)
if (route.query.rangeId) {
queryParams.value.rangeId = route.query.rangeId
getList()
}
})
function uploadedFn(id) {
if (id) queryParams.value.rangeId = id
getList()
}
function addSuccess(rangeId) {
router.replace({ path: route.path, query: { rangeId: rangeId, fileUrl: route.query.fileUrl }})
queryParams.value.rangeId = rangeId
getList()
}
// 身份证校验
function IDchange(e) {
dialogID.value = true
}
function addForm() {
proxy.$refs['addDialogRef'].open(list.value.length > 0 ? queryParams.value.rangeId : null)
}
function addDuanExcl() {
proxy.$refs['importDuanRef'].open(queryParams.value.rangeId)
}
async function getList() {
if (!queryParams.value.rangeId) return
const res = await listApi(queryParams.value)
list.value = res.rows
total.value = res.total
ids.value = list.value.map((item) => item.id)
}
function selectFN() {
getList()
}
function reset() {
queryParams.value.name = null
queryParams.value.idcCode = null
getList()
}
// 提交审核
async function commitFN() {
if (!fileUrl.value) return proxy.$modal.msgError('请上传附件!')
const res = await confirm({ ids: queryParams.value.rangeId })
if (res.data.finishFlag) {
proxy.$modal.msgSuccess('操作成功!')
router.go(-1)
} else {
proxy.$refs['errorRef'].open(res.data)
// proxy.$modal.msgSuccess('操作成功!')
// router.go(-1)
// form.value = res.data
// showDialog.value = true
}
}
async function handleDel(row) {
await proxy.$modal.confirm('是否确认删除姓名为"' + row.name + '"的数据项?')
await duanInputDel({ ids: row.id })
if (list.value.length == 1 && queryParams.value.pageNum == 1) {
queryParams.value.rangeId = undefined
fileUrl.value = null
list.value = []
await router.replace({ path: route.path })
} else if (list.value.length == 1 && queryParams.value.pageNum > 1) {
queryParams.value.pageNum--
await getList()
} else {
await getList()
}
proxy.$modal.msgSuccess('操作成功!')
}
function handelUp() {
if (list.value.length <= 0) return proxy.$modal.msgError('请先添加人员,再上传文件!')
proxy.$refs['uploadRef'].open({ id: queryParams.value.rangeId, fileUrl: fileUrl.value })
}
function successFN(row) {
fileUrl.value = row
router.replace({ path: route.path, query: { rangeId: route.query.rangeId, fileUrl: JSON.stringify(row) }})
getList()
}
</script>
<style scoped lang="scss">
.box{
padding: 50px;
}
.tdFlex {
display: flex;
}
.w50 {
width: 50%;
}
.ml20 {
margin-left: 20px;
}
:deep(.el-button--info){
background-color: #920f20;
border: 1px solid #920f20;
}
// :deep(.el-button--info){
// background-color: #409eff;
// border: 1px solid #409eff;
// }
.idCode{
:deep(.el-upload--picture-card){
width: 380px;
height: 240px;
}
:deep(.fileItem ){
width: 380px;
height: 240px;
}
:deep(.el-upload__tip){
display: none;
}
:deep(.el-upload-list--picture-card){
// text-align: center;
display: flex;
justify-content: center;
}
}
.text-center{
display: flex;
margin-top: 30px;
margin-bottom: 40px;
}
.text-center>div{
margin-left: 20px;
}
.btn{
margin-left: 10px;
}
.a{
color:#0000ff;
border-bottom: 1px solid #0000ff;
}
.nav-box{
padding: 10px;
font-size: 16px;
background-color: #fff;
span{
font-weight: 600;
font-size: 18px;
margin: 0 10px;
}
}
</style>