feat: 特殊慰问-职工慰问优化
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="慰问金额" :span="2">
|
||||
<el-form-item label="慰问金额" prop="perMoney" :rules="recipientRules.money">
|
||||
<el-input-number v-model="formData.perMoney" :precision="2" :min="0" :max="10000" :controls="false" style="width:100%" placeholder="每人慰问金额(元)"></el-input-number>
|
||||
<el-input v-model="formData.perMoney" readonly style="width:100%" placeholder="根据慰问类型自动带出"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="慰问时间" :span="2">
|
||||
|
||||
+18
-9
@@ -51,7 +51,7 @@ layout("/layouts/platform.html"){
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="签字" :span="6">
|
||||
<el-form-item prop="signature" label="签字">
|
||||
<el-form-item prop="signature" label="签字" class="special-condolence-signature-item">
|
||||
<pc-signature v-model="formData.signature"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
@@ -205,8 +205,6 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
onSave() {
|
||||
this.$refs.formRef.validate((valid, invalidFields) => {
|
||||
if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
|
||||
this.$confirm("您确定保存吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
@@ -219,11 +217,23 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
async validateApplication(callback) {
|
||||
const form = this.$refs.formRef
|
||||
const fields = form.fields.filter(field => field.prop && !field.prop.startsWith('recipients'))
|
||||
const results = await Promise.all(fields.map(field => new Promise(resolve => {
|
||||
field.validate('', message => resolve(!message))
|
||||
})))
|
||||
if (results.some(valid => !valid)) {
|
||||
this.activeApplicationTab = 'form'
|
||||
this.$message.error('请完善基础信息的必填信息')
|
||||
return
|
||||
}
|
||||
if (!this.ensureApplicationRecipients()) return
|
||||
form.validate(callback)
|
||||
},
|
||||
onSubmit() {
|
||||
if (!this.ensureApplicationRecipients()) return
|
||||
this.$refs.formRef.validate((valid, invalidFields) => {
|
||||
this.validateApplication((valid, invalidFields) => {
|
||||
if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
@@ -244,8 +254,7 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
},
|
||||
onFinishTask() {
|
||||
if (!this.ensureApplicationRecipients()) return
|
||||
this.$refs.formRef.validate((valid, invalidFields) => {
|
||||
this.validateApplication((valid, invalidFields) => {
|
||||
if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
@@ -275,7 +284,7 @@ layout("/layouts/platform.html"){
|
||||
this.selectQueryUser(this.formData.helpLoginName, this.helpUserOptions)
|
||||
this.selectQueryUser(this.formData.certifierLoginName, this.certifierUserOptions)
|
||||
this.selectQueryUser(this.formData.handlerLoginName, this.handlerUserOptions)
|
||||
this.chooseType = this.typeOptions.find(o => o.id === this.formData.type)
|
||||
this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) || {}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
+2
@@ -65,3 +65,5 @@
|
||||
.special-condolence-apply .flow-task-form .el-form-item__error { color: #f56c6c !important; }
|
||||
.special-condolence-apply .el-form-item.is-error .el-input__inner,
|
||||
.special-condolence-apply .el-form-item.is-error .el-textarea__inner { border-color: #f56c6c; }
|
||||
|
||||
.special-condolence-apply .flow-task-form .special-condolence-signature-item .el-form-item__error { position: static; padding-top: 6px; line-height: 20px; white-space: normal; }
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
<el-form-item prop="recipients" label-width="0" class="special-condolence-table-item">
|
||||
<el-table ref="recipientTableRef" :data="formData.recipients" border stripe size="small" max-height="520" empty-text="暂无慰问对象,点击新增或从 Excel 导入">
|
||||
<el-table-column type="index" label="序号" width="55" align="center" fixed="left"></el-table-column>
|
||||
<el-table-column label="慰问对象" width="200" fixed="left"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.helpUserId'" :rules="recipientRules.helpUserId"><user-select size="small" v-model="s.row.helpUserId" api="/platform/special_condolence/apply/listUser" api_input_key_name="keyword" :option_list="recipientOptions(s.row)" :option_label_func="item => item.userName + '(' + (item.loginName || '') + ')'" @selected="(user, id) => recipientUserChange(s.row, s.$index, id, user)"></user-select></el-form-item></template></el-table-column>
|
||||
<el-table-column label="工号" min-width="150"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.helpLoginName'" :rules="[{ validator: (rule, value, cb) => cb(s.row.personType === '劳务派遣人员' || value ? undefined : new Error('普通人员工号不能为空')), trigger: 'change' }]"><el-input size="small" v-model="s.row.helpLoginName" readonly placeholder="选人后带出,劳务派遣可空"></el-input></el-form-item></template></el-table-column>
|
||||
<el-table-column label="慰问对象" width="200" fixed="left"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + (s.row.helpUserId ? '.helpUserId' : '.helpUserName')" :rules="recipientRules.helpUserId"><el-input v-if="!s.row.helpUserId && s.row.helpUserName" size="small" :value="s.row.helpUserName" readonly></el-input><user-select v-else size="small" v-model="s.row.helpUserId" api="/platform/special_condolence/apply/listUser" api_input_key_name="keyword" :option_list="recipientOptions(s.row)" :option_label_func="item => item.userName + '(' + (item.loginName || '') + ')'" @selected="(user, id) => recipientUserChange(s.row, s.$index, id, user)"></user-select></el-form-item></template></el-table-column>
|
||||
<el-table-column label="工号" min-width="150"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.helpLoginName'" :rules="[{ validator: (rule, value, cb) => cb(!s.row.helpUserId || s.row.personType === '劳务派遣人员' || value ? undefined : new Error('普通人员工号不能为空')), trigger: 'change' }]"><el-input size="small" v-model="s.row.helpLoginName" readonly placeholder="选人后带出,劳务派遣可空"></el-input></el-form-item></template></el-table-column>
|
||||
<el-table-column label="身份证号码" min-width="205"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.idCard'" :rules="recipientRules.idCard"><el-input size="small" v-model="s.row.idCard" maxlength="18" placeholder="请输入18位身份证号"></el-input></el-form-item></template></el-table-column>
|
||||
<el-table-column label="开户行" min-width="190"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.bankOfDeposit'" :rules="recipientRules.bankOfDeposit"><el-input size="small" v-model="s.row.bankOfDeposit" maxlength="100" placeholder="请输入开户银行及支行"></el-input></el-form-item></template></el-table-column>
|
||||
<el-table-column label="户名" min-width="140"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.bankUserName'" :rules="recipientRules.bankUserName"><el-input size="small" v-model="s.row.bankUserName" maxlength="100" placeholder="请输入账户户名"></el-input></el-form-item></template></el-table-column>
|
||||
|
||||
+7
-4
@@ -34,7 +34,7 @@ const specialCondolenceRecipients = {
|
||||
},
|
||||
ensureApplicationRecipients() {
|
||||
const rows = this.formData.recipients
|
||||
if (!Array.isArray(rows) || rows.length === 0 || rows.some(row => !row || !String(row.helpUserId || '').trim())) {
|
||||
if (!Array.isArray(rows) || rows.length === 0 || rows.some(row => !row || !String(row.helpUserId || row.helpUserName || '').trim())) {
|
||||
this.activeApplicationTab = 'recipients'
|
||||
this.notifyRecipientError('请先选择慰问对象,并填写完整信息')
|
||||
return false
|
||||
@@ -95,15 +95,18 @@ const specialCondolenceRecipients = {
|
||||
try {
|
||||
const data = new FormData()
|
||||
data.append('file', request.file)
|
||||
const result = await this.$axios.post('/platform/special_condolence/apply/importRecipients', data)
|
||||
const response = await axios.post('/platform/special_condolence/apply/importRecipients', data, {
|
||||
headers: { 'x-requested-with': 'XMLHttpRequest' }
|
||||
})
|
||||
const result = response.data
|
||||
if (result.code === 0) {
|
||||
const rows = this.formData.recipients.filter(r => r.helpUserName || r.type || r.idCard || r.bankCardNumber || r.bankUserName || r.bankOfDeposit || r.money)
|
||||
this.$set(this.formData, 'recipients', rows.concat(result.data))
|
||||
this.importVisible = false
|
||||
this.$message.success('导入成功,共' + result.data.length + '人')
|
||||
} else this.$message.error(result.msg || '导入失败')
|
||||
} else this.$message.error('导入失败:' + (result.msg || '请检查文件内容后重试'))
|
||||
} catch (error) {
|
||||
this.$message.error('导入失败,请检查文件内容后重试')
|
||||
this.$message.error('导入失败:' + (error.response?.data?.msg || error.msg || '请检查文件内容后重试'))
|
||||
} finally {
|
||||
this.importLoading = false
|
||||
}
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ layout("/layouts/platform.html"){
|
||||
{prop: 'applyUnionName', label: '所属工会'},
|
||||
{prop: 'applyUnitName', label: '所属单位'},
|
||||
{prop: 'typeName', label: '慰问类型'},
|
||||
{prop: 'taskName', label: '当前节点'},
|
||||
{prop: 'recipientCount', label: '慰问人数'},
|
||||
{prop: 'instanceState', label: '流程状态'},
|
||||
],
|
||||
unionList: [],
|
||||
|
||||
+4
-6
@@ -197,7 +197,7 @@ layout("/layouts/platform_h5.html"){
|
||||
|
||||
<van-field :value="chooseType.name || formData.typeName" name="type" label="慰问类型" readonly clickable is-link required placeholder="请选择慰问类型" :rules="[{ validator: () => !!formData.type, message: '请选择慰问类型' }]" @click="showTypePickerClick"></van-field>
|
||||
<van-popup v-model="showTypePicker" position="bottom" round get-container="body"><van-picker :columns="typeColumns" :default-index="typeDefaultIndex" show-toolbar @confirm="onTypeConfirm" @cancel="showTypePicker = false"></van-picker></van-popup>
|
||||
<van-field v-model="formData.perMoney" name="perMoney" label="每人金额" type="number" required :rules="[{ validator: validateMoney, message: '金额须大于0且不超过10000元,最多两位小数' }]"></van-field>
|
||||
<van-field v-model="formData.perMoney" name="perMoney" label="慰问金额" type="number" readonly required :rules="[{ validator: validateMoney, message: '金额须大于0且不超过10000元,最多两位小数' }]"></van-field>
|
||||
<van-field v-model="formData.occurTime" name="occurTime" label="慰问时间" readonly clickable is-link placeholder="请选择慰问时间" required :rules="[{ validator: value => $moment(value, 'YYYY-MM-DD', true).isValid(), message: '请选择有效慰问时间' }]" @click="showTimePickerClick"></van-field>
|
||||
<van-popup v-model="showTimePicker" position="bottom" round get-container="body"><van-datetime-picker v-if="showTimePicker" v-model="formData.occurDate" type="date" :min-date="minDate" :max-date="maxDate" title="请选择慰问时间" @confirm="confirmOccurTime" @cancel="showTimePicker = false"></van-datetime-picker></van-popup>
|
||||
<van-field
|
||||
@@ -258,7 +258,7 @@ layout("/layouts/platform_h5.html"){
|
||||
<div v-for="(person, index) in formData.recipients" :key="index">
|
||||
<van-cell :title="'慰问对象 ' + (index + 1)" :title-style="{ fontWeight: 'bold' }"><van-button native-type="button" size="mini" @click="formData.recipients.splice(index, 1)">删除</van-button></van-cell>
|
||||
<h5-user-select v-model="person.helpUserId" :display-name="person.helpUserName" api="/platform/special_condolence/apply/listUser" label="慰问对象" placeholder="点击选择本工会人员" required :name="'recipients.' + index + '.helpUserId'" :rules="mobileRecipientRules('helpUserId', person)" @selected="(user, id) => recipientUserChange(person, index, id, user)"></h5-user-select>
|
||||
<van-field v-model="person.helpLoginName" label="工号" readonly placeholder="选人后带出,劳务派遣可空" :required="person.personType !== '劳务派遣人员'" :name="'recipients.' + index + '.helpLoginName'" :rules="mobileRecipientRules('helpLoginName', person)"></van-field>
|
||||
<van-field v-model="person.helpLoginName" label="工号" readonly placeholder="选人后带出,劳务派遣可空" :required="!!person.helpUserId && person.personType !== '劳务派遣人员'" :name="'recipients.' + index + '.helpLoginName'" :rules="mobileRecipientRules('helpLoginName', person)"></van-field>
|
||||
<van-field v-model="person.idCard" label="身份证号码" maxlength="18" required :name="'recipients.' + index + '.idCard'" :rules="mobileRecipientRules('idCard', person)"></van-field>
|
||||
<van-field v-model="person.bankOfDeposit" label="开户行" maxlength="100" required :name="'recipients.' + index + '.bankOfDeposit'" :rules="mobileRecipientRules('bankOfDeposit', person)"></van-field>
|
||||
<van-field v-model="person.bankUserName" label="户名" maxlength="100" required :name="'recipients.' + index + '.bankUserName'" :rules="mobileRecipientRules('bankUserName', person)"></van-field>
|
||||
@@ -340,8 +340,8 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
mobileRecipientRules(field, person) {
|
||||
const names = { helpUserId: '慰问对象', helpLoginName: '工号', idCard: '身份证号码', bankOfDeposit: '开户行', bankUserName: '户名', bankCardNumber: '收款账户' }
|
||||
if (field === 'helpLoginName') return [{ validator: value => person.personType === '劳务派遣人员' || !!String(value || '').trim(), message: '普通人员工号不能为空' }]
|
||||
if (field === 'helpUserId') return [{ validator: () => !!person.helpUserId, message: '请选择慰问对象' }]
|
||||
if (field === 'helpLoginName') return [{ validator: value => !person.helpUserId || person.personType === '劳务派遣人员' || !!String(value || '').trim(), message: '请完善慰问对象信息(工号不能为空)' }]
|
||||
if (field === 'helpUserId') return [{ validator: () => !!(person.helpUserId || person.helpUserName), message: '请选择慰问对象' }]
|
||||
const rules = [{ validator: value => !!String(value || '').trim(), message: '请填写' + names[field] }]
|
||||
if (field === 'idCard') rules.push({ validator: value => this.validRecipientIdCard(value), message: '身份证号码不正确' })
|
||||
if (field === 'bankCardNumber') rules.push({ pattern: /^[0-9]{6,30}$/, message: '收款账户须为6至30位数字' })
|
||||
@@ -464,7 +464,6 @@ layout("/layouts/platform_h5.html"){
|
||||
this.showTypePicker = false
|
||||
},
|
||||
onSave() {
|
||||
this.$refs.formRef.validate().then(() => {
|
||||
this.$dialog.confirm({
|
||||
title: "提示",
|
||||
message: "您确定保存吗?"
|
||||
@@ -476,7 +475,6 @@ layout("/layouts/platform_h5.html"){
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(errors => this.showInvalidApplicationTab(errors))
|
||||
},
|
||||
async onSubmit() {
|
||||
this.$refs.formRef.validate().then(() => {
|
||||
|
||||
Reference in New Issue
Block a user