addAlteration.vue
8.27 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
<template>
<div class="app-container">
<el-card>
<div>
<br>
<el-button type="primary" @click="onLineFn">在线选择</el-button>
</div>
<br>
<div>
<el-table v-loading="loading" border :data="list" style="width: 100%">
<el-table-column label="序号" align="center" type="index" width="55" />
<el-table-column
label="会员编号"
align="center"
prop="memCode"
min-width="130"
:show-overflow-tooltip="true"
/>
<el-table-column
label="团体名称"
align="center"
prop=""
min-width="130"
>
<template #default="scope">
<div>{{ scope.row.oldName }}
<el-button class="btn" size="small" type="text" @click="handleChange(scope.row,'newName')">变更</el-button>
</div>
<div v-if="scope.row.oldName!=scope.row.newName" class="bg">
<span>{{ scope.row.newName }}</span>
</div>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- label="会员状态"-->
<!-- align="center"-->
<!-- prop=""-->
<!-- min-width="100"-->
<!-- >-->
<!-- <template #default="props">-->
<!-- <div v-if="props.row.personCertStage==0">-->
<!-- 新会员-->
<!-- </div>-->
<!-- <div v-if="props.row.personCertStage==1">-->
<!-- 待提交-->
<!-- </div>-->
<!-- <div v-if="props.row.personCertStage==2">-->
<!-- 缴费中-->
<!-- </div>-->
<!-- <div v-if="props.row.personCertStage==3">-->
<!-- 正常-->
<!-- </div>-->
<!-- <div v-if="props.row.personCertStage==4">-->
<!-- 过期-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="出生日期"-->
<!-- align="center"-->
<!-- prop=""-->
<!-- min-width="220"-->
<!-- >-->
<!-- <template #default="scope">-->
<!-- <div>{{ parseTime(scope.row.oldBirth, '{y}-{m}-{d}') }}-->
<!-- <el-button class="btn" size="small" :disabled="scope.row.generateFlag==1&&scope.row.newIdcType==0" type="text" @click="handleChange(scope.row,'newBirth')">变更</el-button>-->
<!-- </div>-->
<!-- <div v-if="scope.row.oldBirth!=scope.row.newBirth" class="bg">-->
<!-- <span> {{ parseTime(scope.row.newBirth, '{y}-{m}-{d}') }} </span>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
label="附件"
align="center"
prop=""
min-width="220"
>
<template #default="scope">
<el-button v-if="scope.row.fileUrl" size="small" type="text" @click="handleDownload(scope.row,'fileUrl')">下载</el-button>
<span v-else style="color: #d51515;font-size: 12px">需上传有效资料</span>
<el-button class="btn" size="small" type="text" @click="handleChange(scope.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="handleDelete(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 :disabled="list<=0" type="primary" @click="commitFN"> 保存并提交</el-button>
</el-row>
<updateMemberInfo ref="updateMemberInfoRef" @lastStep="getList" />
</el-card>
<onLine ref="onLineRef" @backFN="backFN" />
<el-link v-show="false" ref="linkRef" :href="fillImgUrl(url)" :underline="false" target="_blank" />
</div>
</template>
<script setup>
import { ref, toRefs, reactive, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { getCurrentInstance } from '@vue/runtime-core'
import onLine from './onLine.vue'
import { infoList, infoMod, commit } from '@/api/groupMember/addAlteration'
import updateMemberInfo from './updateMemberInfo.vue'
const router = useRouter()
const route = useRoute()
const { proxy } = getCurrentInstance()
const data = reactive({
form: {},
queryParams: {
rangeId: '',
pageSize: 10,
pageNum: 1
},
formData: {}
})
const total = ref(0)
const list = ref([])
const loading = ref(false)
const url = ref()
const { form, queryParams, formData } = toRefs(data)
onMounted(() => {
if (route.query.rangeId && route.query.rangeId != 0) {
form.value.rangeId = route.query.rangeId
queryParams.value.rangeId = route.query.rangeId
getList()
} else {
form.value.rangeId = ''
queryParams.value.rangeId = ''
}
})
// 窗口关闭
function backFN(rangeId) {
form.value.idcCode = null
form.value.idcType = null
if (rangeId && rangeId != -1) {
form.value.rangeId = rangeId
queryParams.value.rangeId = rangeId
getList()
}
}
async function getList() {
loading.value = true
const res = await infoList(queryParams.value)
if (res.code == 200) {
list.value = res.rows
list.value.forEach(item => {
item.fileUrl = JSON.parse(item.fileUrl)
})
total.value = res.total
}
loading.value = false
}
// 提交审核
async function commitFN() {
const flag = list.value.some(item => {
if (!item.fileUrl) {
proxy.$modal.msgError('会员编号为' + item.memCode + '信息不完整,请确认必填项!')
return !item.fileUrl
}
})
if (flag) return
if (form.value.rangeId == '') return
const res = await commit([queryParams.value.rangeId])
if (res.code == 200) {
proxy.$modal.msgSuccess('提交成功!')
router.go(-1)
} else {
proxy.$modal.msgError('提交失败!')
}
}
/** 删除按钮操作 */
function handleDelete(row) {
proxy.$modal.confirm('是否确认删除会员编号为"' + row.memCode + '"的数据项?').then(function() {
return infoMod([row.id])
}).then(() => {
proxy.$modal.msgSuccess('删除成功')
if (list.value.length == 1 && queryParams.value.pageNum === 1) {
formData.value.rangeName = ''
form.value.rangeId = ''
queryParams.value.rangeId = ''
list.value = list.value.filter(item => {
return item.id != row.id
})
} else if (list.value.length == 1 && queryParams.value.pageNum > 1) {
queryParams.value.pageNum--
getList()
} else {
getList()
}
}).catch(() => {
}).finally(() => {
})
}
// 在线选着
function onLineFn() {
console.log(queryParams.value.rangeId)
proxy.$refs['onLineRef'].open(queryParams.value.rangeId || '-1')
}
async function changeFN(row) {
const res = await editMod({
id: row.id,
newBeginTime: row.newBeginTime,
newBirth: row.newBirth,
newIdcCode: row.newIdcCode,
newIdcType: row.newIdcType,
newName: row.newName,
newSex: row.newSex,
newValiDate: row.newValiDate
})
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功!')
}
await getList()
}
function handleDownload(row) {
url.value = row.fileUrl?.[0]?.url
proxy.$refs['linkRef'].$el.click()
}
// 会员信息变更
function handleChange(row, val) {
proxy.$refs['updateMemberInfoRef'].open(row, val)
}
</script>
<style scoped lang="scss">
.bg{
color: #d51515;
}
.btn{
padding-right: 0;
}
</style>