123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563 |
- <template>
- <a-modal :width="1150" :dialogStyle="dialogStyle" title="员工信息" :visible="visible" @ok="handleSubmit()"
- @cancel="handleCancel" cancelText="关闭">
- <template slot="title">
- <div style="width: 100%;">
- <span>{{ title }}</span>
- <span style="display:inline-block;width:calc(100% - 51px);padding-right:10px;text-align: right">
- <a-button @click="toggleScreen" icon="appstore" style="height:20px;width:20px;border:0px"></a-button>
- </span>
- </div>
- </template>
- <a-spin :spinning="confirmLoading">
- <a-form :form="form" style="overflow-y: auto;height: 650px;">
- <a-row>
- <a-col :md="4" :sm="4" :lg="8">
- <a-form-model-item label="头像" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-image-upload style="width: 70%;height: 50px;" class="avatar-uploader" text="上传" v-model="model.avatar"></j-image-upload>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input :maxLength="10" style="width: 70%" placeholder="请输入员工姓名" v-decorator="[ 'realname', validatorRules.realname]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="英文名" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input :maxLength="10" style="width: 70%" placeholder="请输入英文名" v-decorator="[ 'egName', validatorRules.egName]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input :disabled="isEdit" style="width: 70%" :maxLength="30" placeholder="请输入邮箱" v-decorator="[ 'email', validatorRules.email]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="人员类别" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag style="width: 70%" v-decorator="[ 'category', {initialValue:101,rules: [{ required: true, message: '请选择人员类别'}]}]" placeholder="请选择人员类别"
- :triggerChange="true" @change="handleChangeStatus" dictCode="category"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="证件类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-select style="width: 70%" v-model="sfzType" placeholder="请选择证件类型">
- <a-select-option value="0">中国身份证</a-select-option>
- <a-select-option value="1">其他</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
-
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="身份证" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="40" placeholder="请输入身份证号码" v-decorator="[ 'sfzCode', validatorRules.sfzCode]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-select style="width: 70%" v-decorator="[ 'sex',validatorRules.sex]" placeholder="请选择性别"
- :getPopupContainer="(target) => target.parentNode">
- <a-select-option :value="1">男</a-select-option>
- <a-select-option :value="2">女</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
-
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="生日" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-date-picker style="width: 70%" placeholder="请选择生日"
- v-decorator="['birthday', {initialValue:!model.birthday?null:moment(model.birthday,dateFormat)}]"
- :getCalendarContainer="node => node.parentNode" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="年龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="3" placeholder="请输入年龄" v-model="age" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="部门" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
- <a-input-search style="width: 70%" placeholder="点击选择部门" v-decorator="['checkedDepartNameString', validatorRules.deptName]"
- readOnly @search="onSearch">
- <a-button slot="enterButton" icon="search">选择</a-button>
- </a-input-search>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="学历" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag style="width: 70%" v-decorator="['education', {}]" :triggerChange="true" placeholder="请选择学历"
- dictCode="education" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="毕业学校" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="30" placeholder="请输入毕业学校" v-decorator="['school']" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="国籍" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag style="width: 70%" v-decorator="['nationality', {initialValue:101}]" :triggerChange="true"
- placeholder="请选择国籍" dictCode="nationality" />
- </a-form-item>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="银行卡" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="19" placeholder="请输入银行卡号" v-decorator="['bankCard', validatorRules.bankCard]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="开户行" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="30" placeholder="请输入开户行" v-decorator="['bankAddr', {initialValue:'招商银行'}]" />
- </a-form-item>
- </a-col>
-
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="雇佣状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag style="width: 70%" v-decorator="[ 'employmentStatus', {initialValue:40,rules: [{ required: true, message: '请选择状态'}]}]" placeholder="请选择人员类别"
- dictCode="employmentStatus" :triggerChange="true"/>
-
- </a-form-item>
- </a-col>
-
-
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="工资" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="8" placeholder="请输入基本工资" v-decorator="['wagesOne',validatorRules.wagesOne]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="手机号" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="11" placeholder="请输入手机号码" v-decorator="[ 'phone', validatorRules.phone]" />
- </a-form-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="社保基数" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input-number placeholder="请输入社保基数" style="width: 210px;" v-decorator="['security', {}]" />
- </a-form-item>
- </a-col> -->
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="职位" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input-search style="width: 70%" placeholder="点击选择职位" v-model="zwName" readOnly @search="onSearchs">
- <a-button slot="enterButton" icon="search">选择</a-button>
- </a-input-search>
- <!-- <j-select-position placeholder="请选择职位" :multiple="false" v-model="model.post"/> -->
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="公积金" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="20" placeholder="请输入公积金账号" v-model="syFund"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="缴交基数" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="8" :disabled="personType" v-model="wagesBase" placeholder="请输入缴交基数" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="入职日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-date-picker style="width: 70%" placeholder="请选择入职日期"
- v-decorator="['entryDate',{initialValue:!model.entryDate?moment(new Date(),dateFormat):moment(model.entryDate,dateFormat),rules: [{ required: true, message: '请选择入职时间'},{validator: this.validateentryDate}]}]"
- :getCalendarContainer="node => node.parentNode" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="试用期" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="5" placeholder="请输入试用期" suffix="月"
- v-decorator="['trialMoth',{initialValue:6,rules: [{ required: true, message: '请输入试用期'},{validator: this.validatetrialMoth}]}]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="结束日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-date-picker style="width: 70%" placeholder="请选择试用结束日期"
- v-decorator="['trialEndDate',{initialValue:moment(wkEndDate,dateFormat)}]"
- :getCalendarContainer="node => node.parentNode" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="工龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input :disabled="workMothis" :style="userId!=''&&userId!=null?'width: 40%':'width: 70%'" :maxLength="5" placeholder="请输入工龄" suffix="月" v-model="workMoth" />
- <a-button style="margin-left: 5px;" icon="search" @click="onEdit()" v-if="userId!=null&&userId!=''">变更</a-button>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="司龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="5" placeholder="请输入司龄" suffix="月" v-model="moth" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="10" placeholder="请输入紧急联系人" v-decorator="[ 'urgentName',{}]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="11" placeholder="请输入紧急联系人电话" v-model="urgentPhone" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="户口地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="100" placeholder="请输入户口地址" v-decorator="[ 'homeAddr', {}]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="家庭住址" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input style="width: 70%" :maxLength="50" placeholder="请输入家庭住址" v-decorator="[ 'addr', {}]" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="分摊部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag style="width: 70%" v-decorator="['shareDept', {}]" :triggerChange="true" placeholder="请选择分摊部门"
- dictCode="share_dept" />
- </a-form-item>
- </a-col>
- </a-row>
-
- <a-row>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="是否打卡" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-select style="width: 70%" @change="isAttes" v-decorator="['isAttendance',{initialValue:'0'}]" placeholder="请选择"
- :getPopupContainer="(target) => target.parentNode" >
- <a-select-option value="0">是</a-select-option>
- <a-select-option value="1">否</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8" v-if="isatt=='0'||isatt==0">
- <a-form-item label="上班类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag style="width: 70%" v-decorator="['type', {initialValue:2,rules: [{ required: true, message: '请选择类型'}]}]" :triggerChange="true" placeholder="请选择上班类型"
- dictCode="type" />
- </a-form-item>
-
- </a-col>
-
-
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item label="附件上传" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-badge :count="fileLists.length" show-zero :number-style="{ backgroundColor: '#52c41a' }">
- <a-button icon="search" @click="uploads()" >选择</a-button>
- </a-badge>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
-
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item v-if="!isEdit" label="合同类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag :disabled="isEdit" style="width: 70%" v-decorator="['contractType',validatorRules.contractType]" :triggerChange="true" placeholder="请选择合同类型"
- dictCode="contract_type" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8" :lg="8">
- <a-form-item v-if="!isEdit" label="合同结束日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-date-picker style="width: 70%" placeholder="请选择试合同结束日期"
- v-model="cEndDate"
- />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :lg="24">
- <a-form-item style="margin-left: -245px;" label="同步信息" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-dict-select-tag v-decorator="['infoSy', {initialValue:3}]" placeholder="请选择同步" :type="'radio'"
- :triggerChange="true" dictCode="info_sy" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row>
- <a-col :md="6" :sm="8" :lg="24">
- <a-form-item style="margin-left: -250px;" label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-textarea :maxLength="255" placeholder="请输备注" v-decorator="[ 'remarks', {}]" style="height: 100px;"/>
- </a-form-item>
- </a-col>
- </a-row>
-
- </a-form>
- </a-spin>
- <depart-windows ref="departWindows" @ok="modalFormOk"></depart-windows>
- <a-modal title="附件" :visible="visiblet" @ok="saveUpload()" @cancel="handleCancelts()" footer="">
- <a-upload :action="url.fileUpload" list-type="picture"
- :file-list="fileLists" @change="t" method="post" @download="handleDownload" :showUploadList="{
- showRemoveIcon: true,
- showDownloadIcon: true
- }" :remove="handleRemove">
- <a-button>
- <a-icon type="upload" />上传
- </a-button>
- </a-upload>
- </a-modal>
- <a-modal v-model="visibles" title="职位" @ok="zwOk()">
- <a-table rowKey="code" bordered :data-source="dataSources" :columns="columnst" :pagination="ipaginations"
- @change="handleTableChanges"
- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChanges,type: 'radio'}">
- </a-table>
- </a-modal>
-
- <a-modal v-model="visloading" title="工龄" @ok="EditWorkMoth()">
- <a-input :maxLength="5" placeholder="请输入工龄" suffix="月" v-model="workMoths" />
- </a-modal>
- </a-modal>
- </template>
- <script>
- import pick from 'lodash.pick'
- import moment from 'moment'
- import Vue from 'vue'
- // 引入搜索部门弹出框的组件
- import departWindows from './DepartWindows'
- import JSelectPosition from '@/components/jeecgbiz/JSelectPosition'
- import {
- ACCESS_TOKEN
- } from "@/store/mutation-types"
- import {
- getAction,
- httpAction,
- deleteAction,
- putAction
- } from '@/api/manage'
- import {
- addUser,
- editUser,
- queryUserRole,
- queryall
- } from '@/api/api'
- import {
- disabledAuthFilter
- } from "@/utils/authFilter"
- import {
- duplicateCheck
- } from '@/api/api'
- import JImageUpload from '../../../components/jeecg/JImageUpload'
- import py from '../../../mixins/vue-py.js'
- export default {
- name: "UserModal",
- components: {
- JImageUpload,
- departWindows,
- JSelectPosition
- },
- data() {
- return {
- selectedRowKeys: [],
- selectionRows: [],
- departDisabled: false, //是否是我的部门调用该页面
- roleDisabled: false, //是否是角色维护调用该页面
- modalWidth: 800,
- drawerWidth: 700,
- statet:true,
- titles: "新增员工",
- isatt:'0',
- workMoths:0,
- visibles: false,
- isEdit:false,
- worMoth:0,
- workMothis:false,
- personType: false,
- cEndDate:null,
- dataSources: [],
- modaltoggleFlag: true,
- moth: 0,
- age:"",
- sfzCode: "",
- bankCard: "",
- bankAddr: "",
- syFund: "",
- visiblet: false,
- phone: "",
- isSalary: "0",
- wagesBase:"",
- workMoth:0,
- email: "",
- isAttendance:"0",
- zwName: "",
- zwCode: "",
- urgentPhone:"",
- count:0,
- sfzType: "0",
- ipaginations: {
- current: 1,
- pageSize: 10,
- pageSizeOptions: ['10', '20', '30'],
- showTotal: (total, range) => {
- return range[0] + "-" + range[1] + " 共" + total + "条"
- },
- showQuickJumper: true,
- showSizeChanger: true,
- total: 0
- },
- fileLists: [],
- confirmDirty: false,
- files: [],
- selectedDepartKeys: [], //保存用户选择部门id
- checkedDepartKeys: [],
- checkedDepartNames: [], // 保存部门的名称 =>title
- checkedDepartNameString: "", // 保存部门的名称 =>title
- resultDepartOptions: [],
- wkDate: new Date(),
- wkMoth: 6,
- wkEndDate: null,
- userId: "", //保存用户id
- disableSubmit: false,
- userDepartModel: {
- userId: '',
- departIdList: []
- }, // 保存SysUserDepart的用户部门中间表数据需要的对象
- dateFormat: "YYYY-MM-DD",
- validatorRules: {
- phone: {
- rules: [{
- required: true,
- message: '请输入手机号!'
- }, {
- validator: this.validatePhone
- }]
- },
- email: {
- rules: [{
- required: true,
- message: '请输入邮箱'
- }, {
- validator: this.validateEmail
- }]
- },
- deptName: {
- rules: [{
- required: true,
- message: '请选择部门'
- }]
- },
- contractType: {
- rules: [{
- required: true,
- message: '请选择合同类型'
- }, {
- validator: this.contractType
- }]
- },
- realname: {
- rules: [{
- required: true,
- message: '请输入姓名'
- }, {
- validator: this.validateRealname
- }]
- },
- egName: {
- rules: [{
- required: true,
- message: '请输入英文名'
- }, {
- validator: this.validateEgname
- }]
- },
- sfzCode: {
- rules: [{
- required: true,
- message: '请输入身份证号'
- }, {
- validator: this.validateSfzCode
- }]
- },
- sex: {
- rules: [{
- required: true,
- message: '请选择性别'
- }]
- },
- bankCard: {
- rules: [{
- required: true,
- message: '请输入银行账号'
- },
- {
- validator: this.validatebankCard
- }
- ]
- },
- syFund: {
- rules: [{
- required: true,
- message: '请输入公积金账号'
- },
- {
- validator: this.validatesyFund
- }
- ]
- },
- wagesOne: {
- rules: [{
- required: true,
- message: '请输入基本工资'
- },
- {
- validator: this.validatewages
- }
- ]
- },
- },
- columnst: [{
- title: '职位编码',
- dataIndex: 'code',
- }, {
- title: '职位名称',
- dataIndex: 'name',
- }],
- departIdShow: false,
- departIds: [], //负责部门id
- title: "操作",
- visible: false,
- dialogStyle: {
- top: "15px"
- },
- model: {},
- roleList: [],
- selectedRole: [],
- realname: "",
- egName: "",
- labelCol: {
- xs: {
- span: 24
- },
- sm: {
- span: 6
- },
- },
- wrapperCol: {
- xs: {
- span: 24
- },
- sm: {
- span: 18
- },
- },
- uploadLoading: false,
- visloading:false,
- confirmLoading: false,
- headers: {},
- form: this.$form.createForm(this),
- picUrl: "",
- url: {
- fileUpload: window._CONFIG['domianURL'] + "/sys/common/upload",
- dowfile:window._CONFIG['domianURL'] +"/sys/common/static/",
- userWithDepart: "/sys/user/userDepartList", // 引入为指定用户查看部门信息需要的url
- userId: "/sys/user/generateUserId", // 引入生成添加用户情况下的url
- syncUserByUserName: "/act/process/extActProcess/doSyncUserByUserName", //同步用户到工作流
- queryTenantList: '/sys/tenant/queryList',
- xzupload: '/sys/common/static',
- sysFile: '/sysFile/sysFile/queryByUserId',
- delSysFile: '/sysFile/sysFile/deleteById',
- post: '/sys/position/listByDept',
- emails:'/sys/user/emails',
- editWorkMoth:'/sys/user/editWorkMoth'
- },
- identity: "1",
- fileList: [],
- tenantList: [],
- currentTenant: []
- }
- },
- created() {
- const token = Vue.ls.get(ACCESS_TOKEN);
- this.headers = {
- "X-Access-Token": token
- }
- this.initTenantList()
- },
- watch:{
- syFund(newVal,oldVal){
- this.syFund=newVal.replace(/[^0-9]/ig,"");
- },
- workMoth(newVal,oldVal){
- this.workMoth=newVal.replace(/[^0-9]/ig,"");
- },
- workMoths(newVal,oldVal){
- this.workMoths=newVal.replace(/[^0-9]/ig,"");
- },
- moth(newVal,oldVal){
- this.moth=newVal.replace(/[^0-9]/ig,"");
- },
- urgentPhone(newVal,oldVal){
- this.urgentPhone=newVal.replace(/[^0-9]/ig,"");
- },
- wagesBase(newVal,oldVal){
- this.wagesBase=newVal.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '');
- },
- age(newVal,oldVal){
- this.age=newVal.replace(/[^0-9]/ig,"");
- }
- },
- computed: {
- uploadAction: function() {
- return this.url.fileUpload;
- }
- },
- methods: {
- EditWorkMoth(){
- putAction(this.url.editWorkMoth, {
- id: this.userId,
- workMoth:this.workMoths
- }).then(res => {
- if (res.success) {
- this.$message.success(res.message);
- this.workMoth=this.workMoths - 0+this.moth - 0;
- this.visloading=false;
- } else {
- this.$message.warning(res.message);
- }
- })
- },
- onEdit(){
- this.workMoths=this.workMoth;
- this.visloading=true;
- },
- zwOk() {
- if (this.selectionRows != null && this.selectionRows.length > 0) {
- this.zwName = this.selectionRows[0].name;
- this.zwCode = this.selectionRows[0].code;
- } else {
- this.zwCode = "";
- this.zwName = "";
- }
- this.visibles = false;
- },
- onSelectChanges(selectedRowKeys, selectionRows) {
- this.selectedRowKeys = selectedRowKeys;
- this.selectionRows = selectionRows;
- },
- handleTableChanges(pagination, filters, sorter) {
- //分页、排序、筛选变化时触发
- //TODO 筛选
- if (Object.keys(sorter).length > 0) {
- this.isorter.column = sorter.field;
- this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
- }
- this.ipaginations = pagination;
- this.queryzw();
- },
- onSearchs() {
- if (this.userDepartModel.departIdList == null || this.userDepartModel.departIdList.length < 1) {
- this.$message.warning('请先选择部门!');
- return;
- }
- this.selectedRowKeys.push(this.zwCode);
- this.visibles = true;
- this.queryzw();
- },
- queryzw() {
- getAction(this.url.post, {
- pageNo: this.ipaginations.current,
- pageSize: this.ipaginations.pageSize,
- deptId: this.userDepartModel.departIdList.join(",")
- }).then((res) => {
- if (res.success) {
- this.dataSources = res.result.records || res.result;
- if (res.result.total) {
- this.ipaginations.total = res.result.total;
- } else {
- this.ipaginations.total = 0;
- this.selectionRows = [];
- this.selectedRowKeys = [];
- }
- }
- }).finally(() => {});
- },
- handleRemove(file) {
- if (this.userId != null && this.userId != "") {
- deleteAction(this.url.delSysFile, {
- userid: this.userId,
- name: file.name
- }).then((res) => {
- if (res.success) {}
- }).finally(() => {});
- }
- },
- handleCancelts() {
- // this.fileList = [];
- this.visiblet = false;
- },
- // 文件下载
- handleDownload(file) {
- window.location.href =this.url.dowfile + file.response.message;
- },
- t(info) {
- // this.files = [];
- // let {
- // fileList
- // } = info
- // const status = info.file.status
- // if (status !== 'uploading') {}
- // if (status === 'done') {
- // var list = fileList.fileList;
- // for (var i = 0; i < list.length; i++) {
- // this.files.push(list[i].response.message);
- // }
- // }
- this.fileLists = info.fileList //重点
- //console.log(info)
- },
- saveUpload() {
- this.visiblet = false;
- },
- uploads() {
- this.visiblet = true;
- },
- isDisabledAuth(code) {
- return disabledAuthFilter(code);
- },
- ages(e){
- let birthdays = new Date(e);
- let d = new Date();
- let age = d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || (d.getMonth() ==
- birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? 1 : 0);
- return age;
- },
- getBirth(idCard) {
- var birthday = "";
- if (idCard != null && idCard != "") {
- if (idCard.length == 15) {
- birthday = "19" + idCard.slice(6, 12);
- } else if (idCard.length == 18) {
- birthday = idCard.slice(6, 14);
- }
- //通过正则表达式来指定输出格式为:1990-01-01
- }
- if (birthday != "" && birthday != null) {
- let birthdays = new Date(birthday.replace(/(.{4})(.{2})/, "$1-$2-"));
- let d = new Date();
- let age = d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || (d.getMonth() ==
- birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? 1 : 0);
- this.age=age;
-
- this.form.setFieldsValue({
- birthday: birthday.replace(/(.{4})(.{2})/, "$1-$2-")
- })
- if (parseInt(idCard.slice(-2, -1)) % 2 == 1) {
- this.form.setFieldsValue({
- sex: 1
- })
- } else {
- this.form.setFieldsValue({
- sex: 2
- })
- }
- }
- },
- handleChangeStatus(e) {
- if (e == 101) {
- this.personType = false;
- } else {
- this.personType = true;
- this.form.setFieldsValue({
- wagesBase: null
- })
- }
- },
- isAttes(e){
- this.isatt=e;
- },
- queryFiles(e) {
- getAction(this.url.sysFile, {
- userid: e
- }).then(res => {
- if (res.success) {
- if (res.result.length > 0) {
- this.fileLists = [];
- for (var i = 0; i < res.result.length; i++) {
- const rs = {
- message: res.result[i].txtName
- };
- const fileInfo = {
- uid: res.result[i].id,
- name: res.result[i].txtName,
- status: "done",
- response: rs,
- url:this.url.fileUpload + res.result[i].txtName,
- };
- this.fileLists.push(fileInfo)
- }
- }
- }
- })
- },
- initTenantList() {
- getAction(this.url.queryTenantList).then(res => {
- if (res.success) {
- this.tenantList = res.result
- }
- })
- },
- //窗口最大化切换
- toggleScreen() {
- if (this.modaltoggleFlag) {
- this.modalWidth = window.innerWidth;
- } else {
- this.modalWidth = 800;
- }
- this.modaltoggleFlag = !this.modaltoggleFlag;
- },
- initialRoleList() {
- queryall().then((res) => {
- if (res.success) {
- this.roleList = res.result;
- } else {
-
- }
- });
- },
- loadUserRoles(userid) {
- queryUserRole({
- userid: userid
- }).then((res) => {
- if (res.success) {
- this.selectedRole = res.result;
- } else {
-
- }
- });
- },
- refresh() {
- this.selectedDepartKeys = [];
- this.checkedDepartKeys = [];
- this.checkedDepartNames = [];
- this.checkedDepartNameString = "";
- this.userId = ""
- this.resultDepartOptions = [];
- this.departId = [];
- this.departIdShow = false;
- this.currentTenant = []
- this.sfzCode = "";
- this.realname = "";
- this.egName = "";
- this.syFund = "";
- this.isAttendance = 0;
- this.isSalary = 0;
- this.bankAddr = "";
- this.bankCard = "";
- this.phone = "";
- this.email = "";
- this.zwCode = "";
- this.zwName = "";
- this.selectedRowKeys = [];
- this.selectionRows = [];
- this.isEdit=false;
- this.workMothis=false;
- },
- add() {
- this.picUrl = "";
- this.refresh();
- this.edit({
- activitiSync: '1'
- });
- var date = new Date();
- date.setMonth(date.getMonth() + 6)
- this.wkEndDate = moment(date).subtract(1, "days");
- this.wkMoth = 6;
- this.wkDate = new Date();
- },
- edit(record) {
- this.realname = record.realname;
- this.egName = record.egName;
- this.syFund=record.syFund;
- this.urgentPhone=record.urgentPhone;
- this.wagesBase=record.wagesBase;
- this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
- let that = this;
- if(record.birthday!=null&&record.birthday!=""){
- var age=this.ages(record.birthday)
- record.age=age;
- this.age=age;
- }
- //that.initialRoleList();
- that.checkedDepartNameString = "";
- that.form.resetFields();
- if (record.hasOwnProperty("id")) {
- that.loadUserRoles(record.id);
- setTimeout(() => {
- this.fileList = record.avatar;
- }, 5)
- }
- if (record.sfzType != null && record.sfzType != "") {
- this.sfzType = record.sfzType;
- }
- if (record.entryDate != null) {
- this.moth = this.countMoth(record.entryDate)
- }if(record.cendDate!=null){
- var d=new Date(record.cendDate)
- this.cEndDate=moment(d).format('YYYY-MM-DD');
- }if(record.isAttendance!=null&& record.isAttendance != ""){
- this.isAttendance=record.isAttendance;
- this.isatt=record.isAttendance;
- }if(record.workMoth!=null&&record.workMoth!=""){
- this.worMoth=record.workMoth;
- this.workMoth=record.workMoth - 0+this.moth - 0;
- }
-
- that.visible = true;
- that.model = Object.assign({}, record);
- this.zwCode = record.post;
- this.zwName = record.post_dictText;
- this.wkDate = record.entryDate;
- this.wkMoth = record.trialMoth - 0;
-
- that.$nextTick(() => {
- that.form.setFieldsValue(pick(this.model, 'sex', 'email', 'phone', 'urgentName', 'urgentPhone',
- 'bankAddr', 'bankCard', 'realname', 'egName', 'age', 'sfzCode', 'isAttendance', 'remarks', 'addr',
- 'nationality', 'trialMoth', 'entryDate', 'trialEndDate', 'workMoth', 'divisionMoth',
- 'infoSy', 'syFund', 'category', 'employmentStatus', 'wagesOne', 'wagesTwo', 'security', 'wagesBase',
- 'homeAddr', 'education', 'school', 'contractDate', 'contractDate2', 'type', 'contractDate3',
- 'shareDept','contractType'))
- });
- //身份为上级显示负责部门,否则不显示
- if (this.model.userIdentity == "2") {
- this.identity = "2";
- this.departIdShow = true;
- } else {
- this.identity = "1";
- this.departIdShow = false;
- }
- //update-begin-author:taoyan date:2020710 for:多租户配置
- if (!record.relTenantIds || record.relTenantIds.length == 0) {
- this.currentTenant = []
- } else {
- this.currentTenant = record.relTenantIds.split(',').map(Number);
- }
- if (record.id != null && record.id != "") {
- this.userId = record.id;
- this.workMothis=true;
- this.isEdit=true;
- this.queryFiles(record.id)
- }
- // 调用查询用户对应的部门信息的方法
- that.checkedDepartKeys = [];
- that.loadCheckedDeparts();
- if (this.userId != null && this.userId != "") {
- this.queryFiles(this.userId)
- }
- },
- //
- loadCheckedDeparts() {
- var id = this.userId
- let that = this;
- if (!that.userId) {
- return
- }
- getAction(that.url.userWithDepart, {
- userId: that.userId
- }).then((res) => {
- that.checkedDepartNames = [];
- if (res.success) {
- var depart = [];
- var departId = [];
- for (let i = 0; i < res.result.length; i++) {
- that.checkedDepartNames.push(res.result[i].title);
- this.form.setFieldsValue({
- checkedDepartNameString: this.checkedDepartNames.join(",")
- })
- //this.checkedDepartNameString = this.checkedDepartNames.join(",");
- that.checkedDepartKeys.push(res.result[i].key);
- //新增负责部门选择下拉框
- depart.push({
- key: res.result[i].key,
- title: res.result[i].title
- })
- departId.push(res.result[i].key)
- }
- that.resultDepartOptions = depart;
- //判断部门id是否存在,不存在择直接默认当前所在部门
- if (this.model.departIds) {
- this.departIds = this.model.departIds.split(",");
- } else {
- this.departIds = departId;
- }
- that.userDepartModel.departIdList = that.checkedDepartKeys
- } else {
-
- }
- })
- },
- close() {
- this.$emit('close');
- this.visible = false;
- this.disableSubmit = false;
- this.selectedRole = [];
- this.userDepartModel = {
- userId: '',
- departIdList: []
- };
- this.checkedDepartNames = [];
- this.checkedDepartNameString = '';
- this.checkedDepartKeys = [];
- this.selectedDepartKeys = [];
- this.resultDepartOptions = [];
- this.departIds = [];
- this.departIdShow = false;
- this.fileLists = [];
- this.identity = "1";
- this.bankAddr = "";
- this.bankCard = "";
- this.syFund = "";
- this.zwCode = "";
- this.zwName = "";
- this.selectedRowKeys = [];
- this.selectionRows = [];
- this.syFund="";
- this.urgentPhone="";
- this.wagesBase="";
- this.age="";
- this.workMoth=0;
- this.moth=0;
- this.cEndDate=null;
- this.statet=true;
- this.isatt='0';
- },
- moment,
- handleSubmit() {
- // if (this.userDepartModel.departIdList.join(",") == "" || this.userDepartModel.departIdList.join(",") == null) {
- // this.$message.warning('请选择部门!');
- // return;
- // }
- this.statet=false;
- const that = this;
- // 触发表单验证
-
- this.form.validateFields((err, values) => {
- if (!err) {
- that.confirmLoading = true;
- if (!values.birthday) {
- values.birthday = '';
- } else {
- values.birthday = values.birthday;
- }
- let formData = Object.assign(this.model, values);
- // if (that.fileList != '') {
- // formData.avatar = that.fileList;
- // } else {
- // formData.avatar = null;
- // }
- formData.sfzType = this.sfzType;
- formData.workMoth=this.workMoth;
- var a = this.fileLists;
- var txt = [];
- if (this.fileLists != null && this.fileLists.length > 0) {
- for (var i = 0; i < this.fileLists.length; i++) {
- txt.push(this.fileLists[i].response.message)
- }
- formData.txt = txt.join(",");
- }
- if (formData.trialEndDate != null) {
- formData.trialEndDate = moment(formData.trialEndDate).format('YYYY-MM-DD');
- }if(this.isEdit){
- formData.workMoth=this.worMoth;
- }
- formData.post = this.zwCode;
- //formData.selectedroles = this.selectedRole.length>0?this.selectedRole.join(","):'';
- formData.selecteddeparts = this.userDepartModel.departIdList.length > 0 ? this.userDepartModel
- .departIdList.join(",") : '';
- formData.userIdentity = this.identity;
- formData.departIds = this.userDepartModel.departIdList.join(",");
- formData.syFund=this.syFund;
-
- formData.urgentPhone=this.urgentPhone;
- formData.wagesBase=this.wagesBase;
- formData.age=this.age;
- formData.cEndDate=this.cEndDate;
-
- //如果是上级择传入departIds,否则为空
- // if (this.identity === "2") {
- // formData.departIds = this.departIds.join(",");
- // } else {
- // formData.departIds = "";
- // }
- // that.addDepartsToUser(that,formData); // 调用根据当前用户添加部门信息的方法
- let obj;
- if (!this.model.id) {
- formData.id = this.userId;
- obj = addUser(formData);
- } else {
- obj = editUser(formData);
- }
- obj.then((res) => {
- if (res.success) {
- that.$message.success(res.message);
- that.$emit('ok');
- } else {
- that.$message.warning(res.message);
- }
- }).finally(() => {
- that.confirmLoading = false;
- that.checkedDepartNames = [];
- that.userDepartModel.departIdList = {
- userId: '',
- departIdList: []
- };
- that.close();
- })
- } else {
- }
- })
- },
- handleCancel() {
- this.close()
- },
- validateRealname(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- this.realname = value;
- if (this.egName != null && this.egName != "") {
- var emil = "@gksports.com.cn";
- var name = py.chineseToPinYin(value.substr(0, 1))
- var emils=this.egName + "." + name + emil;
- getAction(this.url.emails, {
- email:emils,
- userid:this.userId
- }).then((res) => {
- if(res!=null&&res!=""){
- this.form.setFieldsValue({
- email: res
- })
- }else{
- this.form.setFieldsValue({
- email: emils
- })
- }
- })
-
- }
- callback()
- }
- },
- validatetrialMoth(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- if (!RegExp(/^[0-9]*$/).test(value)) {
- this.form.setFieldsValue({
- trialMoth: value.replace(/[^0-9]/ig,"")
- })
- } else {
- this.wkMoth = value - 0;
- /* var moth=value - 0;
- if(moth<1){
- this.wkMoth=1;
- this.form.setFieldsValue({
- trialMoth:1
- })
- }else{
- this.wkMoth = value - 0;
- } */
- //console.log(this.wkDate)
-
- if (this.wkDate != null && this.wkDate != "") {
- var date = new Date(this.wkDate)
- var num = this.wkMoth;
- var d =moment(new Date());
- if(num!=0&&num!='0'){
- date.setMonth(date.getMonth() + num)
- d=moment(date).subtract(1, "days");
- }
- this.form.setFieldsValue({
- trialEndDate: d
- })
- }
- }
- callback()
- }
- },
- countMoth(e) {
- var date = new Date(e)
- var newDate = new Date();
- var seconds = Math.floor((newDate.getTime() - date.getTime()) / 1000);
- var minutes = Math.floor(seconds / 60);
- var hours = Math.floor(minutes / 60);
- var days = Math.floor(hours / 24);
- var months = Math.floor(days / 30);
- var diffValue = 0;
- if (months > 0) {
- diffValue = months;
- }
- return diffValue;
- },
- validateentryDate(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- var date = new Date(value);
- var da=new Date(value);
- var type= this.form.getFieldValue('contractType');
- if(type!=null&&this.statet==true){
- if(type==1){
- da.setFullYear(da.getFullYear()+3)
- this.cEndDate=moment(da).subtract(1, "days");
- }else if(type==2){
- da.setMonth(da.getMonth()+6)
- this.cEndDate=moment(da).subtract(1, "days");
- }else{
- da.setFullYear(da.getFullYear()+1)
- this.cEndDate=moment(da).subtract(1, "days");
- }
- }
- this.wkDate = value;
- this.moth = this.countMoth(value);
- if (this.wkMoth != null && this.wkMoth != "") {
- date.setMonth(date.getMonth() + this.wkMoth)
- var d = moment(date).subtract(1, "days");
- this.form.setFieldsValue({
- trialEndDate: d
- })
- }
- callback()
- }
- },
- validateSfzCode(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- if (this.sfzType == "0") {
- if (value.length == 15 && RegExp(/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/).test(value)) {
- this.getBirth(value)
- } else if (value.length == 18 && RegExp(
- /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/).test(value)) {
- this.getBirth(value)
- } else {
- callback("请输入正确格式的身份证号码!");
- }
- }
- callback()
- }
- },
- contractType(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- var date= this.form.getFieldValue('entryDate');
- if(date!=null&&this.statet==true){
- var da=new Date(date);
- if(value==1){
- da.setFullYear(da.getFullYear()+3)
- this.cEndDate=moment(da).subtract(1, "days");
- }else if(value==2){
- da.setMonth(da.getMonth()+6)
- this.cEndDate=moment(da).subtract(1, "days");
- }else {
- da.setFullYear(da.getFullYear()+1)
- this.cEndDate=moment(da).subtract(1, "days");
- }
-
- }else if(date==null){
- callback("请输入入职日期!")
- }
- callback()
- }
- },
- validatewages(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- if (!RegExp(/^[0-9]*$/).test(value)) {
- this.form.setFieldsValue({
- wagesOne: value.replace(/[^0-9]/ig,"")
- })
-
- }
- callback()
- }
- },
- validateEgname(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- this.egName = value.substr(0, 1).toLowerCase() + value.substr(1, value.length);
- this.form.setFieldsValue({
- egName: value.substr(0, 1).toUpperCase()+ value.substr(1, value.length)
- })
-
- if (this.realname != null && this.realname != "") {
- var emil = "@gksports.com.cn";
- var name = py.chineseToPinYin(this.realname.substr(0, 1))
- var emils=this.egName + "." + name + emil;
- getAction(this.url.emails, {
- email:emils,
- userid:this.userId
- }).then((res) => {
- if(res!=null&&res!=""){
- this.form.setFieldsValue({
- email: res
- })
- }else{
- this.form.setFieldsValue({
- email: emils
- })
- }
-
- })
-
- }
- callback()
- }
- },
- validatesyFund(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- this.form.setFieldsValue({
- syFund: value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')
- })
- callback()
- }
- },
- validatePhone(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- if (!RegExp(/^[0-9]*$/).test(value)) {
- this.form.setFieldsValue({
- phone: value.replace(/[^0-9]/ig,"")
- })
- }else{
- //update-begin--Author:kangxiaolin Date:20190826 for:[05] 手机号不支持199号码段--------------------
- if (new RegExp(/^1[3|4|5|6|7|8|9][0-9]\d{8}$/).test(value)) {
- //update-end--Author:kangxiaolin Date:20190826 for:[05] 手机号不支持199号码段--------------------
- var params = {
- tableName: 'sys_user',
- fieldName: 'phone',
- fieldVal: value,
- dataId: this.userId
- };
- duplicateCheck(params).then((res) => {
- if (res.success) {
- callback()
- } else {
- callback("手机号已存在!")
- }
- })
- } else {
- callback("请输入正确格式的手机号码!");
- }
- }
- }
- },
- validatebankCard(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- if (!RegExp(/^[0-9]*$/).test(value)) {
- this.form.setFieldsValue({
- bankCard: value.replace(/[^0-9]/ig,"")
- })
- }else{
- if (value.length != 19 && value.length != 16) {
- callback('请输入16位或19位银行卡账号');
- }
- }
- callback()
- }
- },
- validateEmail(rule, value, callback) {
- if (!value) {
- callback()
- } else {
- if (new RegExp(
- /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
- ).test(value)) {
- /* getAction(this.url.emails, {
- email:value,
- userid:this.userId
- }).then((res) => {
- if(res!=null&&res!=""){
- this.form.setFieldsValue({
- email: res
- })
- }
- }) */
- callback()
- } else {
- callback("请输入正确格式的邮箱!")
- }
- }
- },
- handleConfirmBlur(e) {
- const value = e.target.value;
- this.confirmDirty = this.confirmDirty || !!value
- },
- normFile(e) {
- if (Array.isArray(e)) {
- return e
- }
- return e && e.fileList
- },
- beforeUpload: function(file) {
- var fileType = file.type;
- if (fileType.indexOf('image') < 0) {
- this.$message.warning('请上传图片');
- return false;
- }
- //TODO 验证文件大小
- },
- handleChange(info) {
- this.picUrl = "";
- if (info.file.status === 'uploading') {
- this.uploadLoading = true;
- return
- }
- if (info.file.status === 'done') {
- var response = info.file.response;
- this.uploadLoading = false;
- if (response.success) {
- this.model.avatar = response.message;
- this.picUrl = "Has no pic url yet";
- } else {
- this.$message.warning(response.message);
- }
- }
- },
- // 搜索用户对应的部门API
- onSearch() {
- //console.log(this.$refs.departWindow)
- this.$refs.departWindows.add(this.checkedDepartKeys, this.userId);
- },
- // 获取用户对应部门弹出框提交给返回的数据
- modalFormOk(formData) {
- this.checkedDepartNames = [];
- this.selectedDepartKeys = [];
- this.checkedDepartNameString = '';
- this.userId = formData.userId;
- this.userDepartModel.userId = formData.userId;
- this.departIds = [];
- this.resultDepartOptions = [];
- this.selectionRows = [];
- this.selectedRowKeys = [];
- var depart = [];
- var depName = "";
- if (formData.departIdList != null && formData.departIdList.length > 0) {
- for (let i = 0; i < formData.departIdList.length; i++) {
- this.selectedDepartKeys.push(formData.departIdList[i].key);
- this.checkedDepartNames.push(formData.departIdList[i].title);
- this.form.setFieldsValue({
- checkedDepartNameString: this.checkedDepartNames.join(",")
- })
- depart.push({
- key: formData.departIdList[i].key,
- title: formData.departIdList[i].title
- })
- this.departIds.push(formData.departIdList[i].key)
- }
- this.resultDepartOptions = depart;
- this.userDepartModel.departIdList = this.selectedDepartKeys;
- this.checkedDepartKeys = this.selectedDepartKeys //更新当前的选择keys
- this.zwCode = "";
- this.zwName = "";
- }
- },
- // 根据屏幕变化,设置抽屉尺寸
- resetScreenSize() {
- let screenWidth = document.body.clientWidth;
- if (screenWidth < 500) {
- this.drawerWidth = screenWidth;
- } else {
- this.drawerWidth = 700;
- }
- },
- identityChange(e) {
- if (e.target.value === "1") {
- this.departIdShow = false;
- } else {
- this.departIdShow = true;
- }
- }
- }
- }
- </script>
- <style scoped>
- .avatar-uploader>.ant-upload {
- width: 104px;
- height: 104px;
- }
- .ant-upload-select-picture-card i {
- font-size: 49px;
- color: #999;
- }
- .ant-upload-select-picture-card .ant-upload-text {
- margin-top: 8px;
- color: #666;
- }
- .ant-table-tbody .ant-table-row td {
- padding-top: 10px;
- padding-bottom: 10px;
- }
- .drawer-bootom-button {
- position: absolute;
- bottom: -8px;
- width: 100%;
- border-top: 1px solid #e8e8e8;
- padding: 10px 16px;
- text-align: right;
- left: 0;
- background: #fff;
- border-radius: 0 0 2px 2px;
- }
- </style>
|