zslq.vue
8.19 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
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-12-18 09:24:03
-->
<template>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item label="发证人姓名">
<el-input v-model="ruleForm.fzrmc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="发证时间">
<el-input v-model="ruleForm.fzsj" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="发证数量">
<el-input v-model="ruleForm.fzsl" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<lb-table :column="tableData.columns" @row-dblclick="handleRowClick" ref="table" @selection-change="handleSelectionChange"
:data="tableData.data"
:pagination="false"
:calcHeight="300">
</lb-table>
<el-row>
<el-col :span="3">
<el-form-item label="身份证读卡器">
<el-button type="text" icon="el-icon-tickets" @click="readClick">读取</el-button>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="领证人" prop="lzrxm" label-width="70px">
<el-input v-model="ruleForm.lzrxm"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="证件类型" prop="lzrzjlb" label-width="80px">
<el-select v-model="ruleForm.lzrzjlb" filterable clearable placeholder="请选择">
<el-option v-for="item in lzrzjlbData" :key="item.dcode" :label="item.dname" :value="item.dcode">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="证件号" prop="lzrzjh" label-width="70px">
<el-input v-model="ruleForm.lzrzjh"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="领证人电话" prop="lzrdh">
<el-input v-model="ruleForm.lzrdh"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item class="text-center">
<el-button @click="$popupCacel">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button>
</el-form-item>
</el-form>
</template>
<script>
const checkPhone = (rule, value, callback) => {
let regPone = null
let mobile = /^(1[3456789]\d{9})$/ //手机号
let tel = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/ // 座机
if (value && value[0] === '0') {// 检查 value 是否存在并且不是 null 或者 undefined
regPone = tel
} else if (value && value[0] !== '0') {
regPone = mobile
}
if (regPone === null) {
return callback(
new Error('请输入电话')
)
} else if (!regPone.test(value)) {
return callback(
new Error("请输入正确的电话格式,其中座机格式'区号-座机号码'")
)
} else {
callback()
}
};
import Vue from 'vue'
import store from '@/store/index.js'
import table from "@/utils/mixin/table";
import { getIdCardInfo } from '@/utils/operation.js'
import { getUnclaimedBdcqz, issueCertificate, getBdcqzQlr } from "@/api/bdcqz.js";
import { datas } from "../../javascript/fzxxdata";
export default {
props: {
formData: {
type: Object,
default: () => {
return {}
}
}
},
mixins: [table],
data () {
return {
lzrzjlbData: store.getters.dictData['A30'],
ruleForm: {
fzrmc: '',
fzsj: '',
fzsl: '',
bdcqzList: [],
lzrxm: '',
lzrzjlb: '',
lzrzjh: '',
lzrdh: ''
},
rules: {
lzrxm: [
{ required: true, message: '请输入领证人', trigger: 'blur' }
],
lzrzjlb: [
{ required: true, message: '请选择证件类型', trigger: 'change' }
],
lzrzjh: [
{ required: true, message: '请输入证件号', trigger: 'blur' }
],
lzrdh: [
{ required: true, validator: checkPhone, trigger: ["blur"] }
]
},
tableData: {
total: 0,
columns: datas.columns().lzgrid,
data: []
}
}
},
mounted () {
this.$nextTick(() => {
this.loadGrid()
})
},
methods: {
/**
* @description: 身份证打卡器
* @author: renchao
*/
readClick () {
function getObjectByValue (arrayOfObjects, value) {
var name = ''
arrayOfObjects.forEach(item => {
if (item.dname.includes(value)) name = item.dcode
})
return name
}
getIdCardInfo(this.BASE_API.gaopaiyi).then(res => {
if (this.BASE_API.gaopaiyi == 'jy') {
const {
Name,
IdNo,
} = JSON.parse(res)
if (Name) {
this.ruleForm.lzrxm = Name;
this.ruleForm.lzrzjlb = '1';
this.ruleForm.lzrzjh = IdNo;
this.$message({
message: '读取成功!',
type: 'success'
})
} else {
this.$message({
message: '请放置身份证',
type: 'warning'
})
}
} else {
if (res.data.code == 0) {
let data = res.data.IDCardInfo
this.ruleForm.lzrxm = data.name
this.ruleForm.lzrzjlb = '1'
this.ruleForm.lzrzjh = data.cardID
this.$message({
message: '读取成功!',
type: 'success'
})
} else {
this.$message({
message: res.data.message,
type: 'warning'
})
}
}
})
},
/**
* @description: 列表初始化
* @author: renchao
*/
loadGrid () {
let that = this
getUnclaimedBdcqz({ bsmSlsq: Vue.prototype.$currentRoute.query.bsmSlsq }).then(res => {
if (res.code === 200) {
this.tableData.data = res.result.list;
this.$nextTick(() => {
this.tableData.data.forEach(item => {
that.$refs.table.toggleRowSelection(item)
})
})
this.ruleForm.fzrmc = res.result.fzrmc
this.ruleForm.fzsj = res.result.fzsj
this.ruleForm.fzsl = res.result.fzsl
this.ruleForm.bdcqzList = res.result.list;
res.result.list.length && this.getQlr(res.result.list[0].bsmBdcqz)
}
})
},
/**
* @description: 获取权利人信息
* @author: renchao
*/
getQlr (bsmBdcqz) {
getBdcqzQlr(bsmBdcqz).then(res => {
if (res.code === 200) {
this.ruleForm.lzrxm = res.result.qlrmc;
this.ruleForm.lzrzjlb = res.result.zjzl;
this.ruleForm.lzrzjh = res.result.zjh;
this.ruleForm.lzrdh = res.result.dh;
}
})
},
/**
* @description: handleSelectionChange
* @param {*} val
* @author: renchao
*/
handleSelectionChange (val) {
this.ruleForm.bdcqzList = val
},
/**
* @description: handleRowClick
* @param {*} row
* @author: renchao
*/
handleRowClick (row) {
this.$refs.table.toggleRowSelection(row)
},
/**
* @description: handleSubmit
* @author: renchao
*/
handleSubmit () {
this.$refs.ruleForm.validate(valid => {
if (valid) {
issueCertificate(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success('保存成功');
//刷新列表
store.dispatch('user/reWorkFresh', true)
this.$popupCacel()
} else {
this.$message.error(res.message)
}
})
} else {
return false;
}
})
}
}
}
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
</style>