qa-prevention-xgf-app/pages/mine/information/update.vue

728 lines
24 KiB
Vue
Raw Normal View History

2023-11-07 10:24:08 +08:00
<template>
<view class="content">
<view class="card">
<u--form labelPosition="left" :model="form" :rules="rules" ref="form" labelWidth="120px">
<u-form-item label="照片" prop="userPhoto" borderBottom required>
<u-upload :fileList="form.userPhoto" @afterRead="fnAfterRead" @delete="fnDeletePic" :maxCount="1"
previewFullImage></u-upload>
</u-form-item>
<u-form-item label="姓名" prop="NAME" borderBottom required>
<u--input border="none" v-model="form.NAME"></u--input>
</u-form-item>
<u-form-item label="性别" prop="SEX_NAME" borderBottom required>
<u--input border="none" v-model="form.SEX_NAME" disabled disabledColor="#ffffff"></u--input>
</u-form-item>
<u-form-item label="出生年月" prop="DATE_OF_BIRTH" borderBottom required>
<u--input border="none" v-model="form.DATE_OF_BIRTH" disabled disabledColor="#ffffff"></u--input>
</u-form-item>
<u-form-item label="年龄" prop="AGE" borderBottom required>
<u--input border="none" v-model="form.AGE" disabled disabledColor="#ffffff"></u--input>
</u-form-item>
<u-form-item label="身份证" prop="CARD_ID" borderBottom required>
<u--input border="none" v-model="form.CARD_ID" @blur="fnCardIdDisassembly"></u--input>
</u-form-item>
<u-form-item label="身份证照片(正反面)" prop="userCardIDPhotoFile" borderBottom required
class="form-item-block">
<u-upload class="mt-10" :fileList="form.userCardIDPhotoFile" @afterRead="fnAttIdPhotoAdd"
@delete="fnAttIdPhotoDelete" multiple :maxCount="2" previewFullImage>
</u-upload>
</u-form-item>
<u-form-item label="民族" prop="NATIONALITY" borderBottom required
@click="singleChoiceClick('NATIONALITY')">
<u--input v-model="form.NATIONALITY_NAME" border="none" disabled disabledColor="#ffffff">
</u--input>
</u-form-item>
<u-form-item label="户口所在地" prop="HKLOCAL" borderBottom required>
<u--textarea border="none" v-model="form.HKLOCAL" autoHeight></u--textarea>
</u-form-item>
<u-form-item label="现住址" prop="ADDRESS" borderBottom required>
<u--textarea border="none" v-model="form.ADDRESS" autoHeight></u--textarea>
</u-form-item>
<u-form-item label="联系电话" prop="PHONE" borderBottom required>
<u--input border="none" v-model="form.PHONE" :disabled="true"></u--input>
</u-form-item>
<u-form-item label="文化程度" prop="DEGREE_OF_EDUCATION" borderBottom required
@click="singleChoiceClick('DEGREE_OF_EDUCATION')">
<u--input v-model="form.DEGREE_OF_EDUCATION_NAME" border="none" disabled disabledColor="#ffffff">
</u--input>
</u-form-item>
<u-form-item label="婚姻状况" prop="MARITALSTATUS" borderBottom required
@click="singleChoiceClick('MARITALSTATUS')">
<u--input v-model="form.MARITALSTATUS_NAME" border="none" disabled disabledColor="#ffffff">
</u--input>
</u-form-item>
<u-form-item label="政治面貌" prop="POLITICAL_STATUS" borderBottom required
@click="singleChoiceClick('POLITICAL_STATUS')">
<u--input v-model="form.POLITICAL_STATUS_NAME" border="none" disabled disabledColor="#ffffff">
</u--input>
</u-form-item>
<u-form-item v-if="form.POLITICAL_STATUS == 'zhonggongdangyuan'" label="入党时间" prop="POLITICAL_STATUS" borderBottom required
@click="fnShowDatePicke('POLITICAL_TIME')">
<u--input v-model="form.POLITICAL_TIME" border="none" disabled disabledColor="#ffffff">
</u--input>
</u-form-item>
<u-form-item label="是否缴纳社保" prop="IS_SOCIAL_NAME" borderBottom required
@click="fnShowIsSocial">
<u--input v-model="form.IS_SOCIAL_NAME" border="none" disabled disabledColor="#ffffff"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item v-if="form.IS_SOCIAL=='1'" label="社会保障号" prop="SOCIAL_NUMBER" borderBottom required>
<u--input border="none" v-model="form.SOCIAL_NUMBER"></u--input>
</u-form-item>
<u-form-item v-if="form.IS_SOCIAL=='1'" label="社会保障卡(正反面)" prop="socialPhotoFile" borderBottom required class="form-item-block">
<u-upload class="mt-10" :fileList="form.socialPhotoFile" @afterRead="fnAttSocialAdd"
@delete="fnAttSocialDelete" multiple :maxCount="2" previewFullImage>
</u-upload>
</u-form-item>
<u-form-item label="是否按期缴纳工伤保险" prop="IS_INJURIES_PAY_NAME" borderBottom required
@click="fnShowEmploymentInjuryInsurance">
<u--input v-model="form.IS_INJURIES_PAY_NAME" border="none" disabled disabledColor="#ffffff"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="工伤保险有效期" v-if="form.IS_INJURIES_PAY==='1'" prop="<strong>IS_INJURIES_PAY_TIME</strong>" borderBottom
required @click="fnShowInjuriesPayTiemEducation">
<u--input v-model="form.IS_INJURIES_PAY_TIME" border="none" disabled disabledColor="#ffffff"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="上传工伤保险凭证" prop="injuriesPayTiemFile" borderBottom required
v-if="form.IS_INJURIES_PAY==='1'" class="form-item-block">
<u-upload class="mt-10" :fileList="form.injuriesPayTiemFile"
@afterRead="fnInjuriesPayTiemAttachmentsAfterRead" @delete="fnInjuriesPayTiemAttachmentsDelete"
multiple :maxCount="4" previewFullImage></u-upload>
</u-form-item>
<u-form-item label="是否流动人员" prop="ISFLOW_NAME" borderBottom required
@click="fnShowFloatingPersonnel">
<u--input v-model="form.ISFLOW_NAME" border="none" disabled disabledColor="#ffffff" inputAlign="right"></u--input>
</u-form-item>
</u--form>
<u-picker ref="uPicker" :show="singleChoice" :columns="singleChoiceColumns" keyName="NAME"
@confirm="fnSingleChoiceConfirm" @cancel="fnSingleChoiceCancel"></u-picker>
<u-datetime-picker :show="datePicker" v-model="dateValue" mode="date" @confirm="fnDateConfirm"
@cancel="fnDateCancel"></u-datetime-picker>
<u-picker :show="showIsSocial" :columns="[[{name: '是', id: '1'}, {name: '否', id: '0'}]]" keyName="name"
@confirm="fnIsSocialConfirm" @cancel="fnShowIsSocial"></u-picker>
<u-picker :show="showEmploymentInjuryInsurance" :columns="[[{name: '是', id: '1'}, {name: '否', id: '0'}]]"
keyName="name" @confirm="fnEmploymentInjuryInsuranceConfirm" @cancel="fnShowEmploymentInjuryInsurance">
</u-picker>
<u-picker :show="showFloatingPersonnel" :columns="[[{name: '是', id: '1'}, {name: '否', id: '0'}]]" keyName="name"
@confirm="fnFloatingPersonnelConfirm" @cancel="fnShowFloatingPersonnel"></u-picker>
<u-datetime-picker :show="showInjuriesPayTiem" v-model="IS_INJURIES_PAY_TIME" mode="date"
@confirm="fnShowInjuriesPayTiemConfirm" @cancel="fnShowInjuriesPayTiemEducation"></u-datetime-picker>
<u-button type="primary" text="保 存" class="mt-10" @click="$u.debounce(fnSubmit, 1000,true)"></u-button>
</view>
</view>
</template>
<script>
import {
getDataDictionary,
getIDCardDeduplication,
getPhoneNumberDeduplication,
getUserInfo,
removeUploadAttachments,
setUploadAttachments,
setUserInfo,
getEmployedBy
} from "../../../api";
export default {
data() {
return {
showDegreeOfEducation: false,
singleChoice: false,
singleChoiceColumns: [],
changeFrom: '',
datePicker: false,
dateValue: new Date().toString(),
showIsSocial: false,
showEmploymentInjuryInsurance: false,
injuriesPayTiemFile: [], //工伤保险有效凭证
showInjuriesPayTiem: false, //工伤保险有效期
IS_INJURIES_PAY_TIME: new Date().toString(),
EMPLOYMENT_APPLY_MANAGEMENT_ID:'',
degreeOfEducationColumns: [],
showPersonWorkType: false,
showFloatingPersonnel: false,
personWorkTypeColumns: [],
prePhotoId: [],
form: {
userPhoto: [],
userCardIDPhotoFile: [],
socialPhotoFile: [],
injuriesPayTiemFile: [], //工伤保险有效凭证
IS_INJURIES_PAY_TIME:'',
NAME: '',
USERNAME: '',
SEX: '',
SEX_NAME: '',
DATE_OF_BIRTH: '',
AGE: '',
CARD_ID: '',
HKLOCAL: '',
ADDRESS: '',
PHONE: '',
DEGREE_OF_EDUCATION: '',
DEGREE_OF_EDUCATION_NAME: '',
SOCIAL_NUMBER: '',
ISFLOW: '',
ISFLOW_NAME: '',
IS_SOCIAL:'',
IS_SOCIAL_NAME:'',
},
rules: {
userPhoto: {
type: 'array',
required: true,
message: '请上传照片',
trigger: ['change']
},
NAME: {
required: true,
message: '请填写姓名',
trigger: ['blur']
},
userCardIDPhotoFile: {
type: 'array',
required: true,
message: '请上传身份证正反照',
trigger: ['change']
},
injuriesPayTiemFile: {
type: 'array',
required: true,
message: '请上传工伤保险凭证',
trigger: ['change']
},
socialPhotoFile: {
type: 'array',
required: true,
message: '请上传设保卡正反照',
trigger: ['change']
},
CARD_ID: [{
required: true,
message: '请填写身份证号',
trigger: ['blur']
},
{
validator: (rule, value, callback) => {
return uni.$u.test.idCard(value);
},
message: '身份证号格式不正确',
trigger: ['blur'],
},
],
HKLOCAL: {
required: true,
message: '请填写户口所在地',
trigger: ['blur']
},
ADDRESS: {
required: true,
message: '请填写现住址',
trigger: ['blur']
},
PHONE: [{
required: true,
message: '请填写联系电话',
trigger: ['blur']
},
{
validator: (rule, value, callback) => {
return uni.$u.test.mobile(value);
},
message: '联系电话格式不正确',
trigger: ['blur'],
},
],
DEGREE_OF_EDUCATION_NAME: {
required: true,
message: '请选择文化程度',
trigger: ['change']
},
PERSON_WORK_TYPE: {
required: false,
message: '请选择工种',
trigger: ['change']
},
ISFLOW_NAME: {
required: true,
message: '请选择是否为流动人员',
trigger: ['change']
},
IS_SOCIAL_NAME:{
required: true,
message: '请选择是否缴纳社保',
trigger: ['change']
},
IS_INJURIES_PAY_NAME: {
required: true,
message: '请选择是否按期缴纳工伤保险',
trigger: ['change']
},
IS_INJURIES_PAY_TIME: {
required: true,
message: '请选择工伤保险有效期',
trigger: ['change']
},
}
}
},
onLoad() {
this.fnGetData()
// this.fnGetDataDictionary('d7d80f08d73a4accbccf4fd3d8d1d867', 'degreeOfEducationColumns')
// this.fnGetDataDictionary('55484e491a5e442d839c4595380713ec', 'personWorkTypeColumns')
},
computed: {
userInfo() {
return this.$store.getters.getUserInfo
}
},
methods: {
singleChoiceClick(changeFrom) {
// 设置选中的就是第一个元素
this.$refs.uPicker.setIndexs([0])
this.changeFrom = changeFrom
if (changeFrom == 'NATIONALITY') this.fnGetDataDictionary('0a0e406f27f74ee698fe9979d25f62dd')
if (changeFrom == 'DEGREE_OF_EDUCATION') this.fnGetDataDictionary('d7d80f08d73a4accbccf4fd3d8d1d867')
if (changeFrom == 'MARITALSTATUS') this.singleChoiceColumns = [[{NAME: '已婚', BIANMA: '1'}, {NAME: '未婚', BIANMA: '0'}]]
if (changeFrom == 'POLITICAL_STATUS') this.fnGetDataDictionary('6351efdd12dc4730952e5d195718e252')
this.singleChoice = true
},
// 日期确认
fnDateConfirm(event) {
this.$set(this.form, this.changeFrom, uni.$u.timeFormat(event.value, 'yyyy-mm-dd'))
this.datePicker = false
},
// 日期选择器取消
fnDateCancel() {
this.datePicker = false
},
fnShowDatePicke(changeFrom) {
this.changeFrom = changeFrom
this.datePicker = true
},
fnSingleChoiceConfirm(event) {
this.$set(this.form, this.changeFrom, event.value[0].BIANMA)
this.$set(this.form, this.changeFrom+ '_NAME', event.value[0].NAME)
this.singleChoice = false
},
fnSingleChoiceCancel() {
this.singleChoice = false
},
// 身份证添加
fnAttIdPhotoAdd(event) {
for (let i = 0; i < event.file.length; i++) {
this.form.userCardIDPhotoFile.push(event.file[i])
}
},
// 身份证删除
fnAttIdPhotoDelete(event) {
uni.showModal({
title: '提示',
content: '确定删除吗',
success: async (res) => {
if (res.confirm) {
if (event.file.id) {
// 准备删除的数据
this.prePhotoId.push(event.file.id)
// await removeUploadAttachments({
// IMGFILES_ID: event.file.id
// })
}
uni.showToast({
title: '操作成功',
duration: 2000
});
// var pages = getCurrentPages(); // 获取当前页面栈
// var prePage = pages[pages.length - 2]; // 上级页面
// prePage.$vm.reloadx();
this.form.userCardIDPhotoFile.splice(event.index, 1)
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
// 社保卡添加
fnAttSocialAdd(event) {
for (let i = 0; i < event.file.length; i++) {
this.form.socialPhotoFile.push(event.file[i])
}
},
// 社保卡删除
fnAttSocialDelete(event) {
uni.showModal({
title: '提示',
content: '确定删除吗',
success: async (res) => {
if (res.confirm) {
if (event.file.id) {
this.prePhotoId.push(event.file.id)
// await removeUploadAttachments({
// IMGFILES_ID: event.file.id
// })
}
uni.showToast({
title: '操作成功',
duration: 2000
});
// var pages = getCurrentPages(); // 获取当前页面栈
// var prePage = pages[pages.length - 2]; // 上级页面
// prePage.$vm.reloadx();
this.form.socialPhotoFile.splice(event.index, 1)
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
async fnGetDataDictionary(DICTIONARIES_ID) {
let resData = await getDataDictionary({
DICTIONARIES_ID
})
this.singleChoiceColumns = [resData.list]
},
fnShowDegreeOfEducation() {
this.showDegreeOfEducation = !this.showDegreeOfEducation
},
fnDegreeOfEducationConfirm(e) {
this.form.DEGREE_OF_EDUCATION = e.value[0].BIANMA
this.form.DEGREE_OF_EDUCATION_NAME = e.value[0].NAME
this.fnShowDegreeOfEducation()
},
fnShowPersonWorkType() {
this.showPersonWorkType = !this.showPersonWorkType
},
// fnPersonWorkTypeConfirm(e) {
// this.form.PERSON_WORK_TYPE = e.value[0].BIANMA
// this.form.PERSON_WORK_TYPE_NAME = e.value[0].NAME
// this.fnShowPersonWorkType()
// },
fnShowFloatingPersonnel() {
this.showFloatingPersonnel = !this.showFloatingPersonnel
},
fnFloatingPersonnelConfirm(e) {
this.form.ISFLOW = e.value[0].id
this.form.ISFLOW_NAME = e.value[0].name
this.fnShowFloatingPersonnel()
},
fnShowIsSocial() {
this.showIsSocial = !this.showIsSocial
},
fnIsSocialConfirm(e) {
this.form.IS_SOCIAL = e.value[0].id
this.form.IS_SOCIAL_NAME = e.value[0].name
this.fnShowIsSocial()
},
fnShowEmploymentInjuryInsurance() {
this.showEmploymentInjuryInsurance = !this.showEmploymentInjuryInsurance
},
fnEmploymentInjuryInsuranceConfirm(e) {
this.form.IS_INJURIES_PAY = e.value[0].id
this.form.IS_INJURIES_PAY_NAME = e.value[0].name
this.fnShowEmploymentInjuryInsurance()
},
//工伤保险有效 凭证
fnInjuriesPayTiemAttachmentsAfterRead(event) {
for (let i = 0; i < event.file.length; i++) {
this.form.injuriesPayTiemFile.push(event.file[i])
}
},
fnInjuriesPayTiemAttachmentsDelete(event) {
uni.showModal({
title: '提示',
content: '确定删除吗',
success: async (res) => {
if (res.confirm) {
if (event.file.id) {
this.prePhotoId.push(event.file.id)
// await removeUploadAttachments({
// IMGFILES_ID: event.file.id
// })
}
uni.showToast({
title: '操作成功',
duration: 2000
});
// var pages = getCurrentPages(); // 获取当前页面栈
// var prePage = pages[pages.length - 2]; // 上级页面
// prePage.$vm.reloadx();
this.form.injuriesPayTiemFile.splice(event.index, 1)
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
//工伤保险有效期 IS_INJURIES_PAY_TIME InjuriesPayTiem
fnShowInjuriesPayTiemEducation() {
this.showInjuriesPayTiem = !this.showInjuriesPayTiem
},
fnShowInjuriesPayTiemConfirm(event) {
this.IS_INJURIES_PAY_TIME = event.value
this.fnShowInjuriesPayTiemEducation()
this.form.IS_INJURIES_PAY_TIME = uni.$u.timeFormat(event.value, 'yyyy-mm-dd')
},
async fnIDCardDeduplication(CARD_ID = this.form.CARD_ID) {
let resData = await getIDCardDeduplication({
CARD_ID
})
if (resData.pd) {
uni.$u.toast('身份证号重复')
return true
}
return false
},
async fnPhoneNumberDeduplication(PHONE = this.form.PHONE) {
if (uni.$u.test.mobile(PHONE)) {
let resData = await getPhoneNumberDeduplication({
PHONE
})
if (resData.pd) {
uni.$u.toast('联系电话重复')
return true
}
return false
}
},
async fnCardIdDisassembly(event) {
if (uni.$u.test.idCard(event)) {
await this.fnIDCardDeduplication()
this.form.DATE_OF_BIRTH = event.substring(6, 10) + "-" + event.substring(10, 12) + "-" + event
.substring(12, 14);
if (parseInt(event.substring(17, 1)) % 2 === 1) {
this.form.SEX = "0";
this.form.SEX_NAME = "男";
} else {
this.form.SEX = "1";
this.form.SEX_NAME = "女";
}
this.$forceUpdate()
let myDate = new Date();
let month = myDate.getMonth() + 1;
let day = myDate.getDate();
let age = myDate.getFullYear() - event.substring(6, 10) - 1;
if (event.substring(10, 12) < month || event.substring(10, 12) === month && event.substring(12,
14) <= day) {
age++;
}
this.form.AGE = age;
}
},
async fnGetData() {
//根据userId获取
let Employed = await getEmployedBy({
showCount: 10,
currentPage: 1,
DEPART_STATE:'0'
})
if(Employed.varList.length>0){
Employed.varList.forEach(item => {
console.log(item.EMPLOYMENT_APPLY_MANAGEMENT_ID);
this.EMPLOYMENT_APPLY_MANAGEMENT_ID = item.EMPLOYMENT_APPLY_MANAGEMENT_ID
})
}
console.log(this.EMPLOYMENT_APPLY_MANAGEMENT_ID);
let resData = await getUserInfo({
CORPINFO_ID: this.userInfo.CORPINFO_ID,
EMPLOYMENT_APPLY_MANAGEMENT_ID:this.EMPLOYMENT_APPLY_MANAGEMENT_ID
})
console.log(resData);
this.form = {
...this.form,
...resData.pd
}
this.form.PHONE = this.form.USERNAME
this.fnCardIdDisassembly(this.form.CARD_ID)
if (this.form.IS_SOCIAL === '0') {
this.form.IS_SOCIAL_NAME = '否'
} else if (this.form.IS_SOCIAL === '1') {
this.form.IS_SOCIAL_NAME = '是'
}
if (this.form.IS_INJURIES_PAY === '0') {
this.form.IS_INJURIES_PAY_NAME = '否'
} else if (this.form.IS_INJURIES_PAY === '1') {
this.form.IS_INJURIES_PAY_NAME = '是'
}
if (this.form.SEX_NAME == '0') {
this.form.SEX_NAME = '男'
} else if (this.form.SEX_NAME == '1') {
this.form.SEX_NAME = '女'
}
if (this.form.ISFLOW == '0') {
this.form.ISFLOW_NAME = '否'
} else if (this.form.ISFLOW == '1') {
this.form.ISFLOW_NAME = '是'
}
if (resData.userPhotoFile.length > 0) {
this.$set(this.form, 'userPhoto', [{
url: this.$filePath + resData.userPhotoFile[0].FILEPATH,
FILEPATH: this.$filePath + resData.userPhotoFile[0].FILEPATH
}])
}
if (resData.userCardIDPhotoFile.length > 0) {
resData.userCardIDPhotoFile.forEach(item => {
const obj = {
id: item.IMGFILES_ID,
url: this.$filePath + item.FILEPATH
}
this.form.userCardIDPhotoFile.push(obj)
})
}
if (resData.socialPhotoFile.length > 0) {
resData.socialPhotoFile.forEach(item => {
const obj = {
id: item.IMGFILES_ID,
url: this.$filePath + item.FILEPATH
}
this.form.socialPhotoFile.push(obj)
})
}
if (resData.workInsurancePhotoFile.length > 0) {
resData.workInsurancePhotoFile.forEach(item => {
const obj = {
id: item.IMGFILES_ID,
url: this.$filePath + item.FILEPATH
}
this.form.injuriesPayTiemFile.push(obj)
})
}
},
fnAfterRead(event) {
this.form.userPhoto.push(event.file)
},
fnDeletePic(event) {
this.form.userPhoto.splice(event.index, 1)
},
fnSubmit() {
this.$refs.form.validate().then(async () => {
//校验社保和工伤保险必须有一个选是
if (this.form.IS_INJURIES_PAY === '0'&& this.form.IS_SOCIAL === '0') {
uni.$u.toast('工商或社保全无人员,不可进入本系统相关方人员管理!');
return;
}
if (await this.fnIDCardDeduplication()) return
if (await this.fnPhoneNumberDeduplication()) return
if (this.form.userCardIDPhotoFile.length != 2) {
uni.$u.toast('身份证照片需要两张')
return
}
if(this.form.IS_SOCIAL==='1'){
if (this.form.socialPhotoFile.length != 2) {
uni.$u.toast('社保卡照片需要两张')
return
}
}
let fileUrl = ''
// 删除点击删除的图片
for (let i = 0; i < this.prePhotoId.length; i++) {
await removeUploadAttachments({
IMGFILES_ID: this.prePhotoId[i]
})
}
for (let i = 0; i < this.form.userPhoto.length; i++) {
if (!this.form.userPhoto[i].FILEPATH) {
let resData = await setUploadAttachments({
filePath: this.form.userPhoto[i].url,
name: 'files',
formData: {
TYPE: '13',
FOREIGN_KEY: this.userInfo.USER_ID,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
}
})
fileUrl = resData.filePath
}
}
for (let i = 0; i < this.form.userCardIDPhotoFile.length; i++) {
await setUploadAttachments({
filePath: this.form.userCardIDPhotoFile[i].url,
name: 'files',
formData: {
TYPE: '14',
FOREIGN_KEY: this.userInfo.USER_ID,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
}
})
}
for (let i = 0; i < this.form.socialPhotoFile.length; i++) {
await setUploadAttachments({
filePath: this.form.socialPhotoFile[i].url,
name: 'files',
formData: {
TYPE: '15',
FOREIGN_KEY: this.userInfo.USER_ID,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
}
})
}
for (let i = 0; i < this.form.injuriesPayTiemFile.length; i++) { // 16上传工伤保险凭证
await setUploadAttachments({
filePath: this.form.injuriesPayTiemFile[i].url,
name: 'files',
formData: {
TYPE: '16',
FOREIGN_KEY: this.userInfo.USER_ID,
CORPINFO_ID: this.CORPINFO_ID,
}
})
}
await setUserInfo({
...this.form,
PHOTO: fileUrl
})
let result = await getUserInfo({
CORPINFO_ID: this.userInfo.CORPINFO_ID,
USER_ID: this.userInfo.USER_ID,
})
await this.$store.dispatch('setUserInfo', {
CORPINFO_ID: result.pd.CORPINFO_ID,
DEPARTMENT_ID: result.pd.DEPARTMENT_ID,
NAME: result.pd.NAME,
USERNAME: result.pd.USERNAME,
USER_ID: result.pd.USER_ID,
PHOTO: this.$filePath + result.pd.PHOTO,
userPhoto: this.$filePath + result.pd.PHOTO,
})
uni.$u.toast('保存成功')
setTimeout(() => {
var pages = getCurrentPages(); // 获取当前页面栈
var prePage = pages[pages.length - 2]; // 上级页面
if (prePage.route == 'pages/related_party_units/view') {
prePage.$vm.reloadx();
}
uni.navigateBack()
}, 2000)
}).catch((e) => {
if (e.result == 'out') {
uni.$u.toast(e.msg)
} else {
console.log(e)
uni.$u.toast('请补全必填项')
}
})
}
},
}
</script>
<style scoped>
</style>