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

1051 lines
35 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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>-->
<view>
<u-upload class="mt-10" :fileList="form.userCardIDPhotoFile" @afterRead="fnAttIdPhotoAdd"
@delete="fnAttIdPhotoDelete" multiple :maxCount="2" previewFullImage>
</u-upload>
<view class="tip">
温馨提示用户需上传身份证正反面身份证照片数量需≥2张才能进行人员培训
</view>
</view>
</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>
<view>
<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>
</view>
<view>
<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>
</view>
<view>
<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>
</view>
<view>
<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>
</view>
<view>
<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>
</view>
<view>
<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>
</view>
<view>
<u-form-item label="是否缴纳保险" prop="IS_BF_NAME" borderBottom required @click="fnShowBf">
<u--input v-model="form.IS_BF_NAME" border="none" disabled disabledColor="#ffffff"
inputAlign="right"></u--input>
</u-form-item>
</view>
<view>
<u-form-item label="是否签订劳动合同" prop="IS_SIGN_LABOR_NAME" borderBottom required
@click="fnShowIsSignLabor">
<u--input v-model="form.IS_SIGN_LABOR_NAME" border="none" disabled disabledColor="#ffffff"
inputAlign="right"></u--input>
</u-form-item>
</view>
<view>
<u-form-item v-if="form.IS_SIGN_LABOR==='1'" label="合同图片" prop="contractFile" borderBottom required
class="form-item-block">
<u-upload class="mt-10" :fileList="form.contractFile" @afterRead="fnIsSignLaborAdd"
@delete="fnIsSignLaborDelete" multiple :maxCount="4" previewFullImage></u-upload>
</u-form-item>
</view>
<view>
<u-form-item label="是否缴纳商业保险" prop="ISPAY_NAME" borderBottom required @click="fnShowIsPay">
<u--input v-model="form.ISPAY_NAME" border="none" disabled disabledColor="#ffffff"
inputAlign="right"></u--input>
</u-form-item>
</view>
<view>
<u-form-item v-if="form.ISPAY==='1'" label="商业保险单号" prop="ISPAY_NUMBER" borderBottom required>
<u--input border="none" v-model="form.ISPAY_NUMBER"></u--input>
</u-form-item>
</view>
<view>
<u-form-item v-if="form.ISPAY==='1'" label="保险图片" prop="insuranceFile" borderBottom required
class="form-item-block">
<u-upload class="mt-10" :fileList="form.insuranceFile" @afterRead="fnIsPayAdd" @delete="fnIsPayDelete"
multiple :maxCount="4" previewFullImage></u-upload>
</u-form-item>
</view>
<view>
<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>
</view>
<view>
<u-form-item label="工伤保险有效期" v-if="form.IS_INJURIES_PAY==='1'" prop="IS_INJURIES_PAY_TIME" 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>
</view>
<view>
<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>
</view>
<view>
<u-form-item label="岗位名称(工种)" prop="POST_ID" borderBottom required>
<u--textarea border="none" v-model="form.POST_ID" autoHeight></u--textarea>
</u-form-item>
</view>
<view>
<u-form-item label="是否参加三级安全培训" prop="IS_LEVEL_THREE_NAME" borderBottom required
@click="fnShowPhotosOfLevel">
<u--input v-model="form.IS_LEVEL_THREE_NAME" border="none" disabled disabledColor="#ffffff"
inputAlign="right"></u--input>
</u-form-item>
</view>
<view>
<u-form-item v-if="form.IS_LEVEL_THREE === '1'" label="三级安全培训照片" prop="photosOfLevel" borderBottom
required class="form-item-block">
<u-upload class="mt-10" :fileList="form.photosOfLevel" @afterRead="fnPhotosOfLevelAdd"
@delete="fnPhotosOfLevelDelete" multiple :maxCount="4" previewFullImage>
</u-upload>
</u-form-item>
</view>
<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-picker :show="showBf" :columns="[[{name: '是', id: '1'}, {name: '否', id: '0'}]]" keyName="name"
@confirm="fnBFConfirm" @cancel="fnShowBf"></u-picker>
<u-picker :show="showIsSignLabor" :columns="[[{name: '是', id: '1'}, {name: '否', id: '0'}]]" keyName="name"
@confirm="fnIsSignLaborConfirm" @cancel="fnShowIsSignLabor"></u-picker>
<u-picker :show="showPhotosOfLevel" :columns="[[{name: '是', id: '1'}, {name: '否', id: '0'}]]" keyName="name"
@confirm="fnShowPhotosOfLevelConfirm" @cancel="fnShowPhotosOfLevel"></u-picker>
<u-picker :show="showIsPay" :columns="[[{name: '是', id: '1'}, {name: '否', id: '0'}]]" keyName="name"
@confirm="fnShowIsPayConfirm" @cancel="fnShowIsPay"></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,
showBf: false,
showIsSignLabor: false,
showPhotosOfLevel: false,
showIsPay: false,
personWorkTypeColumns: [],
prePhotoId: [],
form: {
userPhoto: [],
userCardIDPhotoFile: [],
socialPhotoFile: [],
contractFile:[],
injuriesPayTiemFile: [],
photosOfLevel:[],
insuranceFile: [],
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:'',
IS_BF_NAME: '',
IS_BF: '',
IS_SIGN_LABOR: '',
IS_SIGN_LABOR_NAME: '',
POST_ID: '',
IS_LEVEL_THREE: '',
IS_LEVEL_THREE_NAME: '',
ISPAY: '',
ISPAY_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']
},
IS_BF_NAME:{
required: true,
message: '请选择是否是否缴纳保险',
trigger: ['change']
},
IS_SIGN_LABOR_NAME:{
required: true,
message: '请选择是否签订劳动合同',
trigger: ['change']
},
contractFile:{
type: 'array',
required: true,
message: '请上传劳动合同',
trigger: ['change']
},
insuranceFile:{
type: 'array',
required: true,
message: '请上传保险图片',
trigger: ['change']
},
POST_ID:{
required: true,
message: '请填写岗位',
trigger: ['change']
},
photosOfLevel:{
type: 'array',
required: true,
message: '请上传三级安全培训照片',
trigger: ['change']
},
IS_LEVEL_THREE_NAME:{
required: true,
message: '请选择是否为三级人员',
trigger: ['change']
},
ISPAY_NUMBER:{
required: true,
message: '请填写商业保单号',
trigger: ['change']
},
}
}
},
onLoad() {
this.fnGetData()
},
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)
}
uni.showToast({
title: '操作成功',
duration: 2000
});
this.form.userCardIDPhotoFile.splice(event.index, 1)
} else if (res.cancel) {
}
}
});
},
// 社保卡添加
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)
}
uni.showToast({
title: '操作成功',
duration: 2000
});
this.form.socialPhotoFile.splice(event.index, 1)
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
// 合同图片
fnIsSignLaborAdd(event) {
for (let i = 0; i < event.file.length; i++) {
this.form.contractFile.push(event.file[i])
}
},
// 合同图片删除
fnIsSignLaborDelete(event) {
uni.showModal({
title: '提示',
content: '确定删除吗',
success: async (res) => {
if (res.confirm) {
if (event.file.id) {
this.prePhotoId.push(event.file.id)
}
uni.showToast({
title: '操作成功',
duration: 2000
});
this.form.contractFile.splice(event.index, 1)
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
// 合同图片
fnIsPayAdd(event) {
for (let i = 0; i < event.file.length; i++) {
this.form.insuranceFile.push(event.file[i])
}
},
// 合同图片删除
fnIsPayDelete(event) {
uni.showModal({
title: '提示',
content: '确定删除吗',
success: async (res) => {
if (res.confirm) {
if (event.file.id) {
this.prePhotoId.push(event.file.id)
}
uni.showToast({
title: '操作成功',
duration: 2000
});
this.form.insuranceFile.splice(event.index, 1)
} else if (res.cancel) {
// console.log('用户点击取消');
}
}
});
},
// 三级教育培训新增
fnPhotosOfLevelAdd(event) {
for (let i = 0; i < event.file.length; i++) {
this.form.photosOfLevel.push(event.file[i])
}
},
// 三级教育培训删除
fnPhotosOfLevelDelete(event) {
uni.showModal({
title: '提示',
content: '确定删除吗',
success: async (res) => {
if (res.confirm) {
if (event.file.id) {
this.prePhotoId.push(event.file.id)
}
uni.showToast({
title: '操作成功',
duration: 2000
});
this.form.photosOfLevel.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
},
fnShowFloatingPersonnel() {
this.showFloatingPersonnel = !this.showFloatingPersonnel
},
fnShowBf(){
this.showBf = !this.showBf
},
fnShowIsSignLabor(){
this.showIsSignLabor = !this.showIsSignLabor
},
fnShowIsPay(){
this.showIsPay = !this.showIsPay
},
fnShowIsPayConfirm(e){
this.form.ISPAY = e.value[0].id
this.form.ISPAY_NAME = e.value[0].name
this.fnShowIsPay()
},
fnShowPhotosOfLevel(){
this.showPhotosOfLevel = !this.showPhotosOfLevel
},
fnShowPhotosOfLevelConfirm(e){
this.form.IS_LEVEL_THREE = e.value[0].id
this.form.IS_LEVEL_THREE_NAME = e.value[0].name
this.fnShowPhotosOfLevel()
},
fnFloatingPersonnelConfirm(e) {
this.form.ISFLOW = e.value[0].id
this.form.ISFLOW_NAME = e.value[0].name
this.fnShowFloatingPersonnel()
},
fnBFConfirm(e){
this.form.IS_BF = e.value[0].id
this.form.IS_BF_NAME = e.value[0].name
this.fnShowBf()
},
fnIsSignLaborConfirm(e){
this.form.IS_SIGN_LABOR = e.value[0].id
this.form.IS_SIGN_LABOR_NAME = e.value[0].name
this.fnShowIsSignLabor()
},
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)
}
uni.showToast({
title: '操作成功',
duration: 2000
});
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 === '1') {
this.form.IS_SOCIAL_NAME = '是'
} else {
this.form.IS_SOCIAL_NAME = '否'
}
if (this.form.IS_INJURIES_PAY === '1') {
this.form.IS_INJURIES_PAY_NAME = '是'
} else {
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 === '1') {
this.form.ISFLOW_NAME = '是'
} else {
this.form.ISFLOW_NAME = '否'
}
if (this.form.ISPAY === '1'){
this.form.ISPAY_NAME = '是'
}else {
this.form.ISPAY_NAME = '否'
}
if (this.form.IS_LEVEL_THREE === '1'){
this.form.IS_LEVEL_THREE_NAME = '是'
}else {
this.form.IS_LEVEL_THREE_NAME = '否'
}
if (this.form.IS_BF === '1'){
this.form.IS_BF_NAME = '是'
}else {
this.form.IS_BF_NAME = '否'
}
if (this.form.IS_SIGN_LABOR === '1'){
this.form.IS_SIGN_LABOR_NAME = '是'
}else {
this.form.IS_SIGN_LABOR_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)
})
}
if (resData.photosOfLevel.length > 0) {
resData.photosOfLevel.forEach(item => {
const obj = {
id: item.IMGFILES_ID,
url: this.$filePath + item.FILEPATH
}
this.form.photosOfLevel.push(obj)
})
}
if (resData.contractFile.length > 0) {
resData.contractFile.forEach(item => {
const obj = {
id: item.IMGFILES_ID,
url: this.$filePath + item.FILEPATH
}
this.form.contractFile.push(obj)
})
}
if (resData.insuranceFile.length > 0) {
resData.insuranceFile.forEach(item => {
const obj = {
id: item.IMGFILES_ID,
url: this.$filePath + item.FILEPATH
}
this.form.insuranceFile.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++) {
await setUploadAttachments({
filePath: this.form.injuriesPayTiemFile[i].url,
name: 'files',
formData: {
TYPE: '16',
FOREIGN_KEY: this.form.EMPLOYMENT_APPLY_MANAGEMENT_ID,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
}
})
}
for (let i = 0; i < this.form.photosOfLevel.length; i++) {
await setUploadAttachments({
filePath: this.form.photosOfLevel[i].url,
name: 'files',
formData: {
TYPE: '19',
FOREIGN_KEY: this.form.EMPLOYMENT_APPLY_MANAGEMENT_ID,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
}
})
}
for (let i = 0; i < this.form.contractFile.length; i++) {
await setUploadAttachments({
filePath: this.form.contractFile[i].url,
name: 'files',
formData: {
TYPE: '10',
FOREIGN_KEY: this.form.EMPLOYMENT_APPLY_MANAGEMENT_ID,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
}
})
}
for (let i = 0; i < this.form.insuranceFile.length; i++) {
await setUploadAttachments({
filePath: this.form.insuranceFile[i].url,
name: 'files',
formData: {
TYPE: '11',
FOREIGN_KEY: this.form.EMPLOYMENT_APPLY_MANAGEMENT_ID,
CORPINFO_ID: this.userInfo.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>
.tip {
color: red;
font-size: 12px;
margin-top: 5px;
}
</style>