UserModal.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  1. <template>
  2. <a-modal :width="1150" :dialogStyle="dialogStyle" title="员工信息" :visible="visible" @ok="handleSubmit()"
  3. @cancel="handleCancel" cancelText="关闭">
  4. <template slot="title">
  5. <div style="width: 100%;">
  6. <span>{{ title }}</span>
  7. <span style="display:inline-block;width:calc(100% - 51px);padding-right:10px;text-align: right">
  8. <a-button @click="toggleScreen" icon="appstore" style="height:20px;width:20px;border:0px"></a-button>
  9. </span>
  10. </div>
  11. </template>
  12. <a-spin :spinning="confirmLoading">
  13. <a-form :form="form" style="overflow-y: auto;height: 650px;">
  14. <a-row>
  15. <a-col :md="4" :sm="4" :lg="8">
  16. <a-form-model-item label="头像" :labelCol="labelCol" :wrapperCol="wrapperCol">
  17. <j-image-upload style="width: 70%;height: 50px;" class="avatar-uploader" text="上传" v-model="model.avatar"></j-image-upload>
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8" :lg="8">
  21. <a-form-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
  22. <a-input :maxLength="10" style="width: 70%" placeholder="请输入员工姓名" v-decorator="[ 'realname', validatorRules.realname]" />
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="8" :lg="8">
  26. <a-form-item label="英文名" :labelCol="labelCol" :wrapperCol="wrapperCol">
  27. <a-input :maxLength="10" style="width: 70%" placeholder="请输入英文名" v-decorator="[ 'egName', validatorRules.egName]" />
  28. </a-form-item>
  29. </a-col>
  30. <a-col :md="6" :sm="8" :lg="8">
  31. <a-form-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
  32. <a-input :disabled="isEdit" style="width: 70%" :maxLength="30" placeholder="请输入邮箱" v-decorator="[ 'email', validatorRules.email]" />
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="6" :sm="8" :lg="8">
  36. <a-form-item label="人员类别" :labelCol="labelCol" :wrapperCol="wrapperCol">
  37. <j-dict-select-tag style="width: 70%" v-decorator="[ 'category', {initialValue:101,rules: [{ required: true, message: '请选择人员类别'}]}]" placeholder="请选择人员类别"
  38. :triggerChange="true" @change="handleChangeStatus" dictCode="category"/>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="6" :sm="8" :lg="8">
  42. <a-form-item label="证件类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
  43. <a-select style="width: 70%" v-model="sfzType" placeholder="请选择证件类型">
  44. <a-select-option value="0">中国身份证</a-select-option>
  45. <a-select-option value="1">其他</a-select-option>
  46. </a-select>
  47. </a-form-item>
  48. </a-col>
  49. <a-col :md="6" :sm="8" :lg="8">
  50. <a-form-item label="身份证" :labelCol="labelCol" :wrapperCol="wrapperCol">
  51. <a-input style="width: 70%" :maxLength="40" placeholder="请输入身份证号码" v-decorator="[ 'sfzCode', validatorRules.sfzCode]" />
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="6" :sm="8" :lg="8">
  55. <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
  56. <a-select style="width: 70%" v-decorator="[ 'sex',validatorRules.sex]" placeholder="请选择性别"
  57. :getPopupContainer="(target) => target.parentNode">
  58. <a-select-option :value="1">男</a-select-option>
  59. <a-select-option :value="2">女</a-select-option>
  60. </a-select>
  61. </a-form-item>
  62. </a-col>
  63. </a-row>
  64. <a-row>
  65. <a-col :md="6" :sm="8" :lg="8">
  66. <a-form-item label="生日" :labelCol="labelCol" :wrapperCol="wrapperCol">
  67. <a-date-picker style="width: 70%" placeholder="请选择生日"
  68. v-decorator="['birthday', {initialValue:!model.birthday?null:moment(model.birthday,dateFormat)}]"
  69. :getCalendarContainer="node => node.parentNode" />
  70. </a-form-item>
  71. </a-col>
  72. <a-col :md="6" :sm="8" :lg="8">
  73. <a-form-item label="年龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
  74. <a-input style="width: 70%" :maxLength="3" placeholder="请输入年龄" v-model="age" />
  75. </a-form-item>
  76. </a-col>
  77. <a-col :md="6" :sm="8" :lg="8">
  78. <a-form-item label="部门" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
  79. <a-input-search style="width: 70%" placeholder="点击选择部门" v-decorator="['checkedDepartNameString', validatorRules.deptName]"
  80. readOnly @search="onSearch">
  81. <a-button slot="enterButton" icon="search">选择</a-button>
  82. </a-input-search>
  83. </a-form-item>
  84. </a-col>
  85. </a-row>
  86. <a-row>
  87. <a-col :md="6" :sm="8" :lg="8">
  88. <a-form-item label="学历" :labelCol="labelCol" :wrapperCol="wrapperCol">
  89. <j-dict-select-tag style="width: 70%" v-decorator="['education', {}]" :triggerChange="true" placeholder="请选择学历"
  90. dictCode="education" />
  91. </a-form-item>
  92. </a-col>
  93. <a-col :md="6" :sm="8" :lg="8">
  94. <a-form-item label="毕业学校" :labelCol="labelCol" :wrapperCol="wrapperCol">
  95. <a-input style="width: 70%" :maxLength="30" placeholder="请输入毕业学校" v-decorator="['school']" />
  96. </a-form-item>
  97. </a-col>
  98. <a-col :md="6" :sm="8" :lg="8">
  99. <a-form-item label="国籍" :labelCol="labelCol" :wrapperCol="wrapperCol">
  100. <j-dict-select-tag style="width: 70%" v-decorator="['nationality', {initialValue:101}]" :triggerChange="true"
  101. placeholder="请选择国籍" dictCode="nationality" />
  102. </a-form-item>
  103. </a-form-item>
  104. </a-col>
  105. </a-row>
  106. <a-row>
  107. <a-col :md="6" :sm="8" :lg="8">
  108. <a-form-item label="银行卡" :labelCol="labelCol" :wrapperCol="wrapperCol">
  109. <a-input style="width: 70%" :maxLength="19" placeholder="请输入银行卡号" v-decorator="['bankCard', validatorRules.bankCard]" />
  110. </a-form-item>
  111. </a-col>
  112. <a-col :md="6" :sm="8" :lg="8">
  113. <a-form-item label="开户行" :labelCol="labelCol" :wrapperCol="wrapperCol">
  114. <a-input style="width: 70%" :maxLength="30" placeholder="请输入开户行" v-decorator="['bankAddr', {initialValue:'招商银行'}]" />
  115. </a-form-item>
  116. </a-col>
  117. <a-col :md="6" :sm="8" :lg="8">
  118. <a-form-item label="雇佣状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
  119. <j-dict-select-tag style="width: 70%" v-decorator="[ 'employmentStatus', {initialValue:40,rules: [{ required: true, message: '请选择状态'}]}]" placeholder="请选择人员类别"
  120. dictCode="employmentStatus" :triggerChange="true"/>
  121. </a-form-item>
  122. </a-col>
  123. </a-row>
  124. <a-row>
  125. <a-col :md="6" :sm="8" :lg="8">
  126. <a-form-item label="工资" :labelCol="labelCol" :wrapperCol="wrapperCol">
  127. <a-input style="width: 70%" :maxLength="8" placeholder="请输入基本工资" v-decorator="['wagesOne',validatorRules.wagesOne]" />
  128. </a-form-item>
  129. </a-col>
  130. <a-col :md="6" :sm="8" :lg="8">
  131. <a-form-item label="手机号" :labelCol="labelCol" :wrapperCol="wrapperCol">
  132. <a-input style="width: 70%" :maxLength="11" placeholder="请输入手机号码" v-decorator="[ 'phone', validatorRules.phone]" />
  133. </a-form-item>
  134. </a-col>
  135. <!-- <a-col :md="6" :sm="8" :lg="8">
  136. <a-form-item label="社保基数" :labelCol="labelCol" :wrapperCol="wrapperCol">
  137. <a-input-number placeholder="请输入社保基数" style="width: 210px;" v-decorator="['security', {}]" />
  138. </a-form-item>
  139. </a-col> -->
  140. <a-col :md="6" :sm="8" :lg="8">
  141. <a-form-item label="职位" :labelCol="labelCol" :wrapperCol="wrapperCol">
  142. <a-input-search style="width: 70%" placeholder="点击选择职位" v-model="zwName" readOnly @search="onSearchs">
  143. <a-button slot="enterButton" icon="search">选择</a-button>
  144. </a-input-search>
  145. <!-- <j-select-position placeholder="请选择职位" :multiple="false" v-model="model.post"/> -->
  146. </a-form-item>
  147. </a-col>
  148. </a-row>
  149. <a-row>
  150. <a-col :md="6" :sm="8" :lg="8">
  151. <a-form-item label="公积金" :labelCol="labelCol" :wrapperCol="wrapperCol">
  152. <a-input style="width: 70%" :maxLength="20" placeholder="请输入公积金账号" v-model="syFund"/>
  153. </a-form-item>
  154. </a-col>
  155. <a-col :md="6" :sm="8" :lg="8">
  156. <a-form-item label="缴交基数" :labelCol="labelCol" :wrapperCol="wrapperCol">
  157. <a-input style="width: 70%" :maxLength="8" :disabled="personType" v-model="wagesBase" placeholder="请输入缴交基数" />
  158. </a-form-item>
  159. </a-col>
  160. <a-col :md="6" :sm="8" :lg="8">
  161. <a-form-item label="入职日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  162. <a-date-picker style="width: 70%" placeholder="请选择入职日期"
  163. v-decorator="['entryDate',{initialValue:!model.entryDate?moment(new Date(),dateFormat):moment(model.entryDate,dateFormat),rules: [{ required: true, message: '请选择入职时间'},{validator: this.validateentryDate}]}]"
  164. :getCalendarContainer="node => node.parentNode" />
  165. </a-form-item>
  166. </a-col>
  167. </a-row>
  168. <a-row>
  169. <a-col :md="6" :sm="8" :lg="8">
  170. <a-form-item label="试用期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  171. <a-input style="width: 70%" :maxLength="5" placeholder="请输入试用期" suffix="月"
  172. v-decorator="['trialMoth',{initialValue:6,rules: [{ required: true, message: '请输入试用期'},{validator: this.validatetrialMoth}]}]" />
  173. </a-form-item>
  174. </a-col>
  175. <a-col :md="6" :sm="8" :lg="8">
  176. <a-form-item label="结束日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  177. <a-date-picker style="width: 70%" placeholder="请选择试用结束日期"
  178. v-decorator="['trialEndDate',{initialValue:moment(wkEndDate,dateFormat)}]"
  179. :getCalendarContainer="node => node.parentNode" />
  180. </a-form-item>
  181. </a-col>
  182. <a-col :md="6" :sm="8" :lg="8">
  183. <a-form-item label="工龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
  184. <a-input :disabled="workMothis" :style="userId!=''&&userId!=null?'width: 40%':'width: 70%'" :maxLength="5" placeholder="请输入工龄" suffix="月" v-model="workMoth" />
  185. <a-button style="margin-left: 5px;" icon="search" @click="onEdit()" v-if="userId!=null&&userId!=''">变更</a-button>
  186. </a-form-item>
  187. </a-col>
  188. </a-row>
  189. <a-row>
  190. <a-col :md="6" :sm="8" :lg="8">
  191. <a-form-item label="司龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
  192. <a-input style="width: 70%" :maxLength="5" placeholder="请输入司龄" suffix="月" v-model="moth" />
  193. </a-form-item>
  194. </a-col>
  195. <a-col :md="6" :sm="8" :lg="8">
  196. <a-form-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">
  197. <a-input style="width: 70%" :maxLength="10" placeholder="请输入紧急联系人" v-decorator="[ 'urgentName',{}]" />
  198. </a-form-item>
  199. </a-col>
  200. <a-col :md="6" :sm="8" :lg="8">
  201. <a-form-item label="电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
  202. <a-input style="width: 70%" :maxLength="11" placeholder="请输入紧急联系人电话" v-model="urgentPhone" />
  203. </a-form-item>
  204. </a-col>
  205. </a-row>
  206. <a-row>
  207. <a-col :md="6" :sm="8" :lg="8">
  208. <a-form-item label="户口地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
  209. <a-input style="width: 70%" :maxLength="100" placeholder="请输入户口地址" v-decorator="[ 'homeAddr', {}]" />
  210. </a-form-item>
  211. </a-col>
  212. <a-col :md="6" :sm="8" :lg="8">
  213. <a-form-item label="家庭住址" :labelCol="labelCol" :wrapperCol="wrapperCol">
  214. <a-input style="width: 70%" :maxLength="50" placeholder="请输入家庭住址" v-decorator="[ 'addr', {}]" />
  215. </a-form-item>
  216. </a-col>
  217. <a-col :md="6" :sm="8" :lg="8">
  218. <a-form-item label="分摊部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
  219. <j-dict-select-tag style="width: 70%" v-decorator="['shareDept', {}]" :triggerChange="true" placeholder="请选择分摊部门"
  220. dictCode="share_dept" />
  221. </a-form-item>
  222. </a-col>
  223. </a-row>
  224. <a-row>
  225. <a-col :md="6" :sm="8" :lg="8">
  226. <a-form-item label="是否打卡" :labelCol="labelCol" :wrapperCol="wrapperCol">
  227. <a-select style="width: 70%" @change="isAttes" v-decorator="['isAttendance',{initialValue:'0'}]" placeholder="请选择"
  228. :getPopupContainer="(target) => target.parentNode" >
  229. <a-select-option value="0">是</a-select-option>
  230. <a-select-option value="1">否</a-select-option>
  231. </a-select>
  232. </a-form-item>
  233. </a-col>
  234. <a-col :md="6" :sm="8" :lg="8" v-if="isatt=='0'||isatt==0">
  235. <a-form-item label="上班类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
  236. <j-dict-select-tag style="width: 70%" v-decorator="['type', {initialValue:2,rules: [{ required: true, message: '请选择类型'}]}]" :triggerChange="true" placeholder="请选择上班类型"
  237. dictCode="type" />
  238. </a-form-item>
  239. </a-col>
  240. <a-col :md="6" :sm="8" :lg="8">
  241. <a-form-item label="附件上传" :labelCol="labelCol" :wrapperCol="wrapperCol">
  242. <a-badge :count="fileLists.length" show-zero :number-style="{ backgroundColor: '#52c41a' }">
  243. <a-button icon="search" @click="uploads()" >选择</a-button>
  244. </a-badge>
  245. </a-form-item>
  246. </a-col>
  247. </a-row>
  248. <a-row>
  249. <a-col :md="6" :sm="8" :lg="8">
  250. <a-form-item v-if="!isEdit" label="合同类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
  251. <j-dict-select-tag :disabled="isEdit" style="width: 70%" v-decorator="['contractType',validatorRules.contractType]" :triggerChange="true" placeholder="请选择合同类型"
  252. dictCode="contract_type" />
  253. </a-form-item>
  254. </a-col>
  255. <a-col :md="6" :sm="8" :lg="8">
  256. <a-form-item v-if="!isEdit" label="合同结束日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  257. <a-date-picker style="width: 70%" placeholder="请选择试合同结束日期"
  258. v-model="cEndDate"
  259. />
  260. </a-form-item>
  261. </a-col>
  262. </a-row>
  263. <a-row>
  264. <a-col :lg="24">
  265. <a-form-item style="margin-left: -245px;" label="同步信息" :labelCol="labelCol" :wrapperCol="wrapperCol">
  266. <j-dict-select-tag v-decorator="['infoSy', {initialValue:3}]" placeholder="请选择同步" :type="'radio'"
  267. :triggerChange="true" dictCode="info_sy" />
  268. </a-form-item>
  269. </a-col>
  270. </a-row>
  271. <a-row>
  272. <a-col :md="6" :sm="8" :lg="24">
  273. <a-form-item style="margin-left: -250px;" label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
  274. <a-textarea :maxLength="255" placeholder="请输备注" v-decorator="[ 'remarks', {}]" style="height: 100px;"/>
  275. </a-form-item>
  276. </a-col>
  277. </a-row>
  278. </a-form>
  279. </a-spin>
  280. <depart-windows ref="departWindows" @ok="modalFormOk"></depart-windows>
  281. <a-modal title="附件" :visible="visiblet" @ok="saveUpload()" @cancel="handleCancelts()" footer="">
  282. <a-upload :action="url.fileUpload" list-type="picture"
  283. :file-list="fileLists" @change="t" method="post" @download="handleDownload" :showUploadList="{
  284. showRemoveIcon: true,
  285. showDownloadIcon: true
  286. }" :remove="handleRemove">
  287. <a-button>
  288. <a-icon type="upload" />上传
  289. </a-button>
  290. </a-upload>
  291. </a-modal>
  292. <a-modal v-model="visibles" title="职位" @ok="zwOk()">
  293. <a-table rowKey="code" bordered :data-source="dataSources" :columns="columnst" :pagination="ipaginations"
  294. @change="handleTableChanges"
  295. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChanges,type: 'radio'}">
  296. </a-table>
  297. </a-modal>
  298. <a-modal v-model="visloading" title="工龄" @ok="EditWorkMoth()">
  299. <a-input :maxLength="5" placeholder="请输入工龄" suffix="月" v-model="workMoths" />
  300. </a-modal>
  301. </a-modal>
  302. </template>
  303. <script>
  304. import pick from 'lodash.pick'
  305. import moment from 'moment'
  306. import Vue from 'vue'
  307. // 引入搜索部门弹出框的组件
  308. import departWindows from './DepartWindows'
  309. import JSelectPosition from '@/components/jeecgbiz/JSelectPosition'
  310. import {
  311. ACCESS_TOKEN
  312. } from "@/store/mutation-types"
  313. import {
  314. getAction,
  315. httpAction,
  316. deleteAction,
  317. putAction
  318. } from '@/api/manage'
  319. import {
  320. addUser,
  321. editUser,
  322. queryUserRole,
  323. queryall
  324. } from '@/api/api'
  325. import {
  326. disabledAuthFilter
  327. } from "@/utils/authFilter"
  328. import {
  329. duplicateCheck
  330. } from '@/api/api'
  331. import JImageUpload from '../../../components/jeecg/JImageUpload'
  332. import py from '../../../mixins/vue-py.js'
  333. export default {
  334. name: "UserModal",
  335. components: {
  336. JImageUpload,
  337. departWindows,
  338. JSelectPosition
  339. },
  340. data() {
  341. return {
  342. selectedRowKeys: [],
  343. selectionRows: [],
  344. departDisabled: false, //是否是我的部门调用该页面
  345. roleDisabled: false, //是否是角色维护调用该页面
  346. modalWidth: 800,
  347. drawerWidth: 700,
  348. statet:true,
  349. titles: "新增员工",
  350. isatt:'0',
  351. workMoths:0,
  352. visibles: false,
  353. isEdit:false,
  354. worMoth:0,
  355. workMothis:false,
  356. personType: false,
  357. cEndDate:null,
  358. dataSources: [],
  359. modaltoggleFlag: true,
  360. moth: 0,
  361. age:"",
  362. sfzCode: "",
  363. bankCard: "",
  364. bankAddr: "",
  365. syFund: "",
  366. visiblet: false,
  367. phone: "",
  368. isSalary: "0",
  369. wagesBase:"",
  370. workMoth:0,
  371. email: "",
  372. isAttendance:"0",
  373. zwName: "",
  374. zwCode: "",
  375. urgentPhone:"",
  376. count:0,
  377. sfzType: "0",
  378. ipaginations: {
  379. current: 1,
  380. pageSize: 10,
  381. pageSizeOptions: ['10', '20', '30'],
  382. showTotal: (total, range) => {
  383. return range[0] + "-" + range[1] + " 共" + total + "条"
  384. },
  385. showQuickJumper: true,
  386. showSizeChanger: true,
  387. total: 0
  388. },
  389. fileLists: [],
  390. confirmDirty: false,
  391. files: [],
  392. selectedDepartKeys: [], //保存用户选择部门id
  393. checkedDepartKeys: [],
  394. checkedDepartNames: [], // 保存部门的名称 =>title
  395. checkedDepartNameString: "", // 保存部门的名称 =>title
  396. resultDepartOptions: [],
  397. wkDate: new Date(),
  398. wkMoth: 6,
  399. wkEndDate: null,
  400. userId: "", //保存用户id
  401. disableSubmit: false,
  402. userDepartModel: {
  403. userId: '',
  404. departIdList: []
  405. }, // 保存SysUserDepart的用户部门中间表数据需要的对象
  406. dateFormat: "YYYY-MM-DD",
  407. validatorRules: {
  408. phone: {
  409. rules: [{
  410. required: true,
  411. message: '请输入手机号!'
  412. }, {
  413. validator: this.validatePhone
  414. }]
  415. },
  416. email: {
  417. rules: [{
  418. required: true,
  419. message: '请输入邮箱'
  420. }, {
  421. validator: this.validateEmail
  422. }]
  423. },
  424. deptName: {
  425. rules: [{
  426. required: true,
  427. message: '请选择部门'
  428. }]
  429. },
  430. contractType: {
  431. rules: [{
  432. required: true,
  433. message: '请选择合同类型'
  434. }, {
  435. validator: this.contractType
  436. }]
  437. },
  438. realname: {
  439. rules: [{
  440. required: true,
  441. message: '请输入姓名'
  442. }, {
  443. validator: this.validateRealname
  444. }]
  445. },
  446. egName: {
  447. rules: [{
  448. required: true,
  449. message: '请输入英文名'
  450. }, {
  451. validator: this.validateEgname
  452. }]
  453. },
  454. sfzCode: {
  455. rules: [{
  456. required: true,
  457. message: '请输入身份证号'
  458. }, {
  459. validator: this.validateSfzCode
  460. }]
  461. },
  462. sex: {
  463. rules: [{
  464. required: true,
  465. message: '请选择性别'
  466. }]
  467. },
  468. bankCard: {
  469. rules: [{
  470. required: true,
  471. message: '请输入银行账号'
  472. },
  473. {
  474. validator: this.validatebankCard
  475. }
  476. ]
  477. },
  478. syFund: {
  479. rules: [{
  480. required: true,
  481. message: '请输入公积金账号'
  482. },
  483. {
  484. validator: this.validatesyFund
  485. }
  486. ]
  487. },
  488. wagesOne: {
  489. rules: [{
  490. required: true,
  491. message: '请输入基本工资'
  492. },
  493. {
  494. validator: this.validatewages
  495. }
  496. ]
  497. },
  498. },
  499. columnst: [{
  500. title: '职位编码',
  501. dataIndex: 'code',
  502. }, {
  503. title: '职位名称',
  504. dataIndex: 'name',
  505. }],
  506. departIdShow: false,
  507. departIds: [], //负责部门id
  508. title: "操作",
  509. visible: false,
  510. dialogStyle: {
  511. top: "15px"
  512. },
  513. model: {},
  514. roleList: [],
  515. selectedRole: [],
  516. realname: "",
  517. egName: "",
  518. labelCol: {
  519. xs: {
  520. span: 24
  521. },
  522. sm: {
  523. span: 6
  524. },
  525. },
  526. wrapperCol: {
  527. xs: {
  528. span: 24
  529. },
  530. sm: {
  531. span: 18
  532. },
  533. },
  534. uploadLoading: false,
  535. visloading:false,
  536. confirmLoading: false,
  537. headers: {},
  538. form: this.$form.createForm(this),
  539. picUrl: "",
  540. url: {
  541. fileUpload: window._CONFIG['domianURL'] + "/sys/common/upload",
  542. dowfile:window._CONFIG['domianURL'] +"/sys/common/static/",
  543. userWithDepart: "/sys/user/userDepartList", // 引入为指定用户查看部门信息需要的url
  544. userId: "/sys/user/generateUserId", // 引入生成添加用户情况下的url
  545. syncUserByUserName: "/act/process/extActProcess/doSyncUserByUserName", //同步用户到工作流
  546. queryTenantList: '/sys/tenant/queryList',
  547. xzupload: '/sys/common/static',
  548. sysFile: '/sysFile/sysFile/queryByUserId',
  549. delSysFile: '/sysFile/sysFile/deleteById',
  550. post: '/sys/position/listByDept',
  551. emails:'/sys/user/emails',
  552. editWorkMoth:'/sys/user/editWorkMoth'
  553. },
  554. identity: "1",
  555. fileList: [],
  556. tenantList: [],
  557. currentTenant: []
  558. }
  559. },
  560. created() {
  561. const token = Vue.ls.get(ACCESS_TOKEN);
  562. this.headers = {
  563. "X-Access-Token": token
  564. }
  565. this.initTenantList()
  566. },
  567. watch:{
  568. syFund(newVal,oldVal){
  569. this.syFund=newVal.replace(/[^0-9]/ig,"");
  570. },
  571. workMoth(newVal,oldVal){
  572. this.workMoth=newVal.replace(/[^0-9]/ig,"");
  573. },
  574. workMoths(newVal,oldVal){
  575. this.workMoths=newVal.replace(/[^0-9]/ig,"");
  576. },
  577. moth(newVal,oldVal){
  578. this.moth=newVal.replace(/[^0-9]/ig,"");
  579. },
  580. urgentPhone(newVal,oldVal){
  581. this.urgentPhone=newVal.replace(/[^0-9]/ig,"");
  582. },
  583. wagesBase(newVal,oldVal){
  584. this.wagesBase=newVal.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '');
  585. },
  586. age(newVal,oldVal){
  587. this.age=newVal.replace(/[^0-9]/ig,"");
  588. }
  589. },
  590. computed: {
  591. uploadAction: function() {
  592. return this.url.fileUpload;
  593. }
  594. },
  595. methods: {
  596. EditWorkMoth(){
  597. putAction(this.url.editWorkMoth, {
  598. id: this.userId,
  599. workMoth:this.workMoths
  600. }).then(res => {
  601. if (res.success) {
  602. this.$message.success(res.message);
  603. this.workMoth=this.workMoths - 0+this.moth - 0;
  604. this.visloading=false;
  605. } else {
  606. this.$message.warning(res.message);
  607. }
  608. })
  609. },
  610. onEdit(){
  611. this.workMoths=this.workMoth;
  612. this.visloading=true;
  613. },
  614. zwOk() {
  615. if (this.selectionRows != null && this.selectionRows.length > 0) {
  616. this.zwName = this.selectionRows[0].name;
  617. this.zwCode = this.selectionRows[0].code;
  618. } else {
  619. this.zwCode = "";
  620. this.zwName = "";
  621. }
  622. this.visibles = false;
  623. },
  624. onSelectChanges(selectedRowKeys, selectionRows) {
  625. this.selectedRowKeys = selectedRowKeys;
  626. this.selectionRows = selectionRows;
  627. },
  628. handleTableChanges(pagination, filters, sorter) {
  629. //分页、排序、筛选变化时触发
  630. //TODO 筛选
  631. if (Object.keys(sorter).length > 0) {
  632. this.isorter.column = sorter.field;
  633. this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
  634. }
  635. this.ipaginations = pagination;
  636. this.queryzw();
  637. },
  638. onSearchs() {
  639. if (this.userDepartModel.departIdList == null || this.userDepartModel.departIdList.length < 1) {
  640. this.$message.warning('请先选择部门!');
  641. return;
  642. }
  643. this.selectedRowKeys.push(this.zwCode);
  644. this.visibles = true;
  645. this.queryzw();
  646. },
  647. queryzw() {
  648. getAction(this.url.post, {
  649. pageNo: this.ipaginations.current,
  650. pageSize: this.ipaginations.pageSize,
  651. deptId: this.userDepartModel.departIdList.join(",")
  652. }).then((res) => {
  653. if (res.success) {
  654. this.dataSources = res.result.records || res.result;
  655. if (res.result.total) {
  656. this.ipaginations.total = res.result.total;
  657. } else {
  658. this.ipaginations.total = 0;
  659. this.selectionRows = [];
  660. this.selectedRowKeys = [];
  661. }
  662. }
  663. }).finally(() => {});
  664. },
  665. handleRemove(file) {
  666. if (this.userId != null && this.userId != "") {
  667. deleteAction(this.url.delSysFile, {
  668. userid: this.userId,
  669. name: file.name
  670. }).then((res) => {
  671. if (res.success) {}
  672. }).finally(() => {});
  673. }
  674. },
  675. handleCancelts() {
  676. // this.fileList = [];
  677. this.visiblet = false;
  678. },
  679. // 文件下载
  680. handleDownload(file) {
  681. window.location.href =this.url.dowfile + file.response.message;
  682. },
  683. t(info) {
  684. // this.files = [];
  685. // let {
  686. // fileList
  687. // } = info
  688. // const status = info.file.status
  689. // if (status !== 'uploading') {}
  690. // if (status === 'done') {
  691. // var list = fileList.fileList;
  692. // for (var i = 0; i < list.length; i++) {
  693. // this.files.push(list[i].response.message);
  694. // }
  695. // }
  696. this.fileLists = info.fileList //重点
  697. //console.log(info)
  698. },
  699. saveUpload() {
  700. this.visiblet = false;
  701. },
  702. uploads() {
  703. this.visiblet = true;
  704. },
  705. isDisabledAuth(code) {
  706. return disabledAuthFilter(code);
  707. },
  708. ages(e){
  709. let birthdays = new Date(e);
  710. let d = new Date();
  711. let age = d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || (d.getMonth() ==
  712. birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? 1 : 0);
  713. return age;
  714. },
  715. getBirth(idCard) {
  716. var birthday = "";
  717. if (idCard != null && idCard != "") {
  718. if (idCard.length == 15) {
  719. birthday = "19" + idCard.slice(6, 12);
  720. } else if (idCard.length == 18) {
  721. birthday = idCard.slice(6, 14);
  722. }
  723. //通过正则表达式来指定输出格式为:1990-01-01
  724. }
  725. if (birthday != "" && birthday != null) {
  726. let birthdays = new Date(birthday.replace(/(.{4})(.{2})/, "$1-$2-"));
  727. let d = new Date();
  728. let age = d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || (d.getMonth() ==
  729. birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? 1 : 0);
  730. this.age=age;
  731. this.form.setFieldsValue({
  732. birthday: birthday.replace(/(.{4})(.{2})/, "$1-$2-")
  733. })
  734. if (parseInt(idCard.slice(-2, -1)) % 2 == 1) {
  735. this.form.setFieldsValue({
  736. sex: 1
  737. })
  738. } else {
  739. this.form.setFieldsValue({
  740. sex: 2
  741. })
  742. }
  743. }
  744. },
  745. handleChangeStatus(e) {
  746. if (e == 101) {
  747. this.personType = false;
  748. } else {
  749. this.personType = true;
  750. this.form.setFieldsValue({
  751. wagesBase: null
  752. })
  753. }
  754. },
  755. isAttes(e){
  756. this.isatt=e;
  757. },
  758. queryFiles(e) {
  759. getAction(this.url.sysFile, {
  760. userid: e
  761. }).then(res => {
  762. if (res.success) {
  763. if (res.result.length > 0) {
  764. this.fileLists = [];
  765. for (var i = 0; i < res.result.length; i++) {
  766. const rs = {
  767. message: res.result[i].txtName
  768. };
  769. const fileInfo = {
  770. uid: res.result[i].id,
  771. name: res.result[i].txtName,
  772. status: "done",
  773. response: rs,
  774. url:this.url.fileUpload + res.result[i].txtName,
  775. };
  776. this.fileLists.push(fileInfo)
  777. }
  778. }
  779. }
  780. })
  781. },
  782. initTenantList() {
  783. getAction(this.url.queryTenantList).then(res => {
  784. if (res.success) {
  785. this.tenantList = res.result
  786. }
  787. })
  788. },
  789. //窗口最大化切换
  790. toggleScreen() {
  791. if (this.modaltoggleFlag) {
  792. this.modalWidth = window.innerWidth;
  793. } else {
  794. this.modalWidth = 800;
  795. }
  796. this.modaltoggleFlag = !this.modaltoggleFlag;
  797. },
  798. initialRoleList() {
  799. queryall().then((res) => {
  800. if (res.success) {
  801. this.roleList = res.result;
  802. } else {
  803. }
  804. });
  805. },
  806. loadUserRoles(userid) {
  807. queryUserRole({
  808. userid: userid
  809. }).then((res) => {
  810. if (res.success) {
  811. this.selectedRole = res.result;
  812. } else {
  813. }
  814. });
  815. },
  816. refresh() {
  817. this.selectedDepartKeys = [];
  818. this.checkedDepartKeys = [];
  819. this.checkedDepartNames = [];
  820. this.checkedDepartNameString = "";
  821. this.userId = ""
  822. this.resultDepartOptions = [];
  823. this.departId = [];
  824. this.departIdShow = false;
  825. this.currentTenant = []
  826. this.sfzCode = "";
  827. this.realname = "";
  828. this.egName = "";
  829. this.syFund = "";
  830. this.isAttendance = 0;
  831. this.isSalary = 0;
  832. this.bankAddr = "";
  833. this.bankCard = "";
  834. this.phone = "";
  835. this.email = "";
  836. this.zwCode = "";
  837. this.zwName = "";
  838. this.selectedRowKeys = [];
  839. this.selectionRows = [];
  840. this.isEdit=false;
  841. this.workMothis=false;
  842. },
  843. add() {
  844. this.picUrl = "";
  845. this.refresh();
  846. this.edit({
  847. activitiSync: '1'
  848. });
  849. var date = new Date();
  850. date.setMonth(date.getMonth() + 6)
  851. this.wkEndDate = moment(date).subtract(1, "days");
  852. this.wkMoth = 6;
  853. this.wkDate = new Date();
  854. },
  855. edit(record) {
  856. this.realname = record.realname;
  857. this.egName = record.egName;
  858. this.syFund=record.syFund;
  859. this.urgentPhone=record.urgentPhone;
  860. this.wagesBase=record.wagesBase;
  861. this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
  862. let that = this;
  863. if(record.birthday!=null&&record.birthday!=""){
  864. var age=this.ages(record.birthday)
  865. record.age=age;
  866. this.age=age;
  867. }
  868. //that.initialRoleList();
  869. that.checkedDepartNameString = "";
  870. that.form.resetFields();
  871. if (record.hasOwnProperty("id")) {
  872. that.loadUserRoles(record.id);
  873. setTimeout(() => {
  874. this.fileList = record.avatar;
  875. }, 5)
  876. }
  877. if (record.sfzType != null && record.sfzType != "") {
  878. this.sfzType = record.sfzType;
  879. }
  880. if (record.entryDate != null) {
  881. this.moth = this.countMoth(record.entryDate)
  882. }if(record.cendDate!=null){
  883. var d=new Date(record.cendDate)
  884. this.cEndDate=moment(d).format('YYYY-MM-DD');
  885. }if(record.isAttendance!=null&& record.isAttendance != ""){
  886. this.isAttendance=record.isAttendance;
  887. this.isatt=record.isAttendance;
  888. }if(record.workMoth!=null&&record.workMoth!=""){
  889. this.worMoth=record.workMoth;
  890. this.workMoth=record.workMoth - 0+this.moth - 0;
  891. }
  892. that.visible = true;
  893. that.model = Object.assign({}, record);
  894. this.zwCode = record.post;
  895. this.zwName = record.post_dictText;
  896. this.wkDate = record.entryDate;
  897. this.wkMoth = record.trialMoth - 0;
  898. that.$nextTick(() => {
  899. that.form.setFieldsValue(pick(this.model, 'sex', 'email', 'phone', 'urgentName', 'urgentPhone',
  900. 'bankAddr', 'bankCard', 'realname', 'egName', 'age', 'sfzCode', 'isAttendance', 'remarks', 'addr',
  901. 'nationality', 'trialMoth', 'entryDate', 'trialEndDate', 'workMoth', 'divisionMoth',
  902. 'infoSy', 'syFund', 'category', 'employmentStatus', 'wagesOne', 'wagesTwo', 'security', 'wagesBase',
  903. 'homeAddr', 'education', 'school', 'contractDate', 'contractDate2', 'type', 'contractDate3',
  904. 'shareDept','contractType'))
  905. });
  906. //身份为上级显示负责部门,否则不显示
  907. if (this.model.userIdentity == "2") {
  908. this.identity = "2";
  909. this.departIdShow = true;
  910. } else {
  911. this.identity = "1";
  912. this.departIdShow = false;
  913. }
  914. //update-begin-author:taoyan date:2020710 for:多租户配置
  915. if (!record.relTenantIds || record.relTenantIds.length == 0) {
  916. this.currentTenant = []
  917. } else {
  918. this.currentTenant = record.relTenantIds.split(',').map(Number);
  919. }
  920. if (record.id != null && record.id != "") {
  921. this.userId = record.id;
  922. this.workMothis=true;
  923. this.isEdit=true;
  924. this.queryFiles(record.id)
  925. }
  926. // 调用查询用户对应的部门信息的方法
  927. that.checkedDepartKeys = [];
  928. that.loadCheckedDeparts();
  929. if (this.userId != null && this.userId != "") {
  930. this.queryFiles(this.userId)
  931. }
  932. },
  933. //
  934. loadCheckedDeparts() {
  935. var id = this.userId
  936. let that = this;
  937. if (!that.userId) {
  938. return
  939. }
  940. getAction(that.url.userWithDepart, {
  941. userId: that.userId
  942. }).then((res) => {
  943. that.checkedDepartNames = [];
  944. if (res.success) {
  945. var depart = [];
  946. var departId = [];
  947. for (let i = 0; i < res.result.length; i++) {
  948. that.checkedDepartNames.push(res.result[i].title);
  949. this.form.setFieldsValue({
  950. checkedDepartNameString: this.checkedDepartNames.join(",")
  951. })
  952. //this.checkedDepartNameString = this.checkedDepartNames.join(",");
  953. that.checkedDepartKeys.push(res.result[i].key);
  954. //新增负责部门选择下拉框
  955. depart.push({
  956. key: res.result[i].key,
  957. title: res.result[i].title
  958. })
  959. departId.push(res.result[i].key)
  960. }
  961. that.resultDepartOptions = depart;
  962. //判断部门id是否存在,不存在择直接默认当前所在部门
  963. if (this.model.departIds) {
  964. this.departIds = this.model.departIds.split(",");
  965. } else {
  966. this.departIds = departId;
  967. }
  968. that.userDepartModel.departIdList = that.checkedDepartKeys
  969. } else {
  970. }
  971. })
  972. },
  973. close() {
  974. this.$emit('close');
  975. this.visible = false;
  976. this.disableSubmit = false;
  977. this.selectedRole = [];
  978. this.userDepartModel = {
  979. userId: '',
  980. departIdList: []
  981. };
  982. this.checkedDepartNames = [];
  983. this.checkedDepartNameString = '';
  984. this.checkedDepartKeys = [];
  985. this.selectedDepartKeys = [];
  986. this.resultDepartOptions = [];
  987. this.departIds = [];
  988. this.departIdShow = false;
  989. this.fileLists = [];
  990. this.identity = "1";
  991. this.bankAddr = "";
  992. this.bankCard = "";
  993. this.syFund = "";
  994. this.zwCode = "";
  995. this.zwName = "";
  996. this.selectedRowKeys = [];
  997. this.selectionRows = [];
  998. this.syFund="";
  999. this.urgentPhone="";
  1000. this.wagesBase="";
  1001. this.age="";
  1002. this.workMoth=0;
  1003. this.moth=0;
  1004. this.cEndDate=null;
  1005. this.statet=true;
  1006. this.isatt='0';
  1007. },
  1008. moment,
  1009. handleSubmit() {
  1010. // if (this.userDepartModel.departIdList.join(",") == "" || this.userDepartModel.departIdList.join(",") == null) {
  1011. // this.$message.warning('请选择部门!');
  1012. // return;
  1013. // }
  1014. this.statet=false;
  1015. const that = this;
  1016. // 触发表单验证
  1017. this.form.validateFields((err, values) => {
  1018. if (!err) {
  1019. that.confirmLoading = true;
  1020. if (!values.birthday) {
  1021. values.birthday = '';
  1022. } else {
  1023. values.birthday = values.birthday;
  1024. }
  1025. let formData = Object.assign(this.model, values);
  1026. // if (that.fileList != '') {
  1027. // formData.avatar = that.fileList;
  1028. // } else {
  1029. // formData.avatar = null;
  1030. // }
  1031. formData.sfzType = this.sfzType;
  1032. formData.workMoth=this.workMoth;
  1033. var a = this.fileLists;
  1034. var txt = [];
  1035. if (this.fileLists != null && this.fileLists.length > 0) {
  1036. for (var i = 0; i < this.fileLists.length; i++) {
  1037. txt.push(this.fileLists[i].response.message)
  1038. }
  1039. formData.txt = txt.join(",");
  1040. }
  1041. if (formData.trialEndDate != null) {
  1042. formData.trialEndDate = moment(formData.trialEndDate).format('YYYY-MM-DD');
  1043. }if(this.isEdit){
  1044. formData.workMoth=this.worMoth;
  1045. }
  1046. formData.post = this.zwCode;
  1047. //formData.selectedroles = this.selectedRole.length>0?this.selectedRole.join(","):'';
  1048. formData.selecteddeparts = this.userDepartModel.departIdList.length > 0 ? this.userDepartModel
  1049. .departIdList.join(",") : '';
  1050. formData.userIdentity = this.identity;
  1051. formData.departIds = this.userDepartModel.departIdList.join(",");
  1052. formData.syFund=this.syFund;
  1053. formData.urgentPhone=this.urgentPhone;
  1054. formData.wagesBase=this.wagesBase;
  1055. formData.age=this.age;
  1056. formData.cEndDate=this.cEndDate;
  1057. //如果是上级择传入departIds,否则为空
  1058. // if (this.identity === "2") {
  1059. // formData.departIds = this.departIds.join(",");
  1060. // } else {
  1061. // formData.departIds = "";
  1062. // }
  1063. // that.addDepartsToUser(that,formData); // 调用根据当前用户添加部门信息的方法
  1064. let obj;
  1065. if (!this.model.id) {
  1066. formData.id = this.userId;
  1067. obj = addUser(formData);
  1068. } else {
  1069. obj = editUser(formData);
  1070. }
  1071. obj.then((res) => {
  1072. if (res.success) {
  1073. that.$message.success(res.message);
  1074. that.$emit('ok');
  1075. } else {
  1076. that.$message.warning(res.message);
  1077. }
  1078. }).finally(() => {
  1079. that.confirmLoading = false;
  1080. that.checkedDepartNames = [];
  1081. that.userDepartModel.departIdList = {
  1082. userId: '',
  1083. departIdList: []
  1084. };
  1085. that.close();
  1086. })
  1087. } else {
  1088. }
  1089. })
  1090. },
  1091. handleCancel() {
  1092. this.close()
  1093. },
  1094. validateRealname(rule, value, callback) {
  1095. if (!value) {
  1096. callback()
  1097. } else {
  1098. this.realname = value;
  1099. if (this.egName != null && this.egName != "") {
  1100. var emil = "@gksports.com.cn";
  1101. var name = py.chineseToPinYin(value.substr(0, 1))
  1102. var emils=this.egName + "." + name + emil;
  1103. getAction(this.url.emails, {
  1104. email:emils,
  1105. userid:this.userId
  1106. }).then((res) => {
  1107. if(res!=null&&res!=""){
  1108. this.form.setFieldsValue({
  1109. email: res
  1110. })
  1111. }else{
  1112. this.form.setFieldsValue({
  1113. email: emils
  1114. })
  1115. }
  1116. })
  1117. }
  1118. callback()
  1119. }
  1120. },
  1121. validatetrialMoth(rule, value, callback) {
  1122. if (!value) {
  1123. callback()
  1124. } else {
  1125. if (!RegExp(/^[0-9]*$/).test(value)) {
  1126. this.form.setFieldsValue({
  1127. trialMoth: value.replace(/[^0-9]/ig,"")
  1128. })
  1129. } else {
  1130. this.wkMoth = value - 0;
  1131. /* var moth=value - 0;
  1132. if(moth<1){
  1133. this.wkMoth=1;
  1134. this.form.setFieldsValue({
  1135. trialMoth:1
  1136. })
  1137. }else{
  1138. this.wkMoth = value - 0;
  1139. } */
  1140. //console.log(this.wkDate)
  1141. if (this.wkDate != null && this.wkDate != "") {
  1142. var date = new Date(this.wkDate)
  1143. var num = this.wkMoth;
  1144. var d =moment(new Date());
  1145. if(num!=0&&num!='0'){
  1146. date.setMonth(date.getMonth() + num)
  1147. d=moment(date).subtract(1, "days");
  1148. }
  1149. this.form.setFieldsValue({
  1150. trialEndDate: d
  1151. })
  1152. }
  1153. }
  1154. callback()
  1155. }
  1156. },
  1157. countMoth(e) {
  1158. var date = new Date(e)
  1159. var newDate = new Date();
  1160. var seconds = Math.floor((newDate.getTime() - date.getTime()) / 1000);
  1161. var minutes = Math.floor(seconds / 60);
  1162. var hours = Math.floor(minutes / 60);
  1163. var days = Math.floor(hours / 24);
  1164. var months = Math.floor(days / 30);
  1165. var diffValue = 0;
  1166. if (months > 0) {
  1167. diffValue = months;
  1168. }
  1169. return diffValue;
  1170. },
  1171. validateentryDate(rule, value, callback) {
  1172. if (!value) {
  1173. callback()
  1174. } else {
  1175. var date = new Date(value);
  1176. var da=new Date(value);
  1177. var type= this.form.getFieldValue('contractType');
  1178. if(type!=null&&this.statet==true){
  1179. if(type==1){
  1180. da.setFullYear(da.getFullYear()+3)
  1181. this.cEndDate=moment(da).subtract(1, "days");
  1182. }else if(type==2){
  1183. da.setMonth(da.getMonth()+6)
  1184. this.cEndDate=moment(da).subtract(1, "days");
  1185. }else{
  1186. da.setFullYear(da.getFullYear()+1)
  1187. this.cEndDate=moment(da).subtract(1, "days");
  1188. }
  1189. }
  1190. this.wkDate = value;
  1191. this.moth = this.countMoth(value);
  1192. if (this.wkMoth != null && this.wkMoth != "") {
  1193. date.setMonth(date.getMonth() + this.wkMoth)
  1194. var d = moment(date).subtract(1, "days");
  1195. this.form.setFieldsValue({
  1196. trialEndDate: d
  1197. })
  1198. }
  1199. callback()
  1200. }
  1201. },
  1202. validateSfzCode(rule, value, callback) {
  1203. if (!value) {
  1204. callback()
  1205. } else {
  1206. if (this.sfzType == "0") {
  1207. 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)) {
  1208. this.getBirth(value)
  1209. } else if (value.length == 18 && RegExp(
  1210. /^[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)) {
  1211. this.getBirth(value)
  1212. } else {
  1213. callback("请输入正确格式的身份证号码!");
  1214. }
  1215. }
  1216. callback()
  1217. }
  1218. },
  1219. contractType(rule, value, callback) {
  1220. if (!value) {
  1221. callback()
  1222. } else {
  1223. var date= this.form.getFieldValue('entryDate');
  1224. if(date!=null&&this.statet==true){
  1225. var da=new Date(date);
  1226. if(value==1){
  1227. da.setFullYear(da.getFullYear()+3)
  1228. this.cEndDate=moment(da).subtract(1, "days");
  1229. }else if(value==2){
  1230. da.setMonth(da.getMonth()+6)
  1231. this.cEndDate=moment(da).subtract(1, "days");
  1232. }else {
  1233. da.setFullYear(da.getFullYear()+1)
  1234. this.cEndDate=moment(da).subtract(1, "days");
  1235. }
  1236. }else if(date==null){
  1237. callback("请输入入职日期!")
  1238. }
  1239. callback()
  1240. }
  1241. },
  1242. validatewages(rule, value, callback) {
  1243. if (!value) {
  1244. callback()
  1245. } else {
  1246. if (!RegExp(/^[0-9]*$/).test(value)) {
  1247. this.form.setFieldsValue({
  1248. wagesOne: value.replace(/[^0-9]/ig,"")
  1249. })
  1250. }
  1251. callback()
  1252. }
  1253. },
  1254. validateEgname(rule, value, callback) {
  1255. if (!value) {
  1256. callback()
  1257. } else {
  1258. this.egName = value.substr(0, 1).toLowerCase() + value.substr(1, value.length);
  1259. this.form.setFieldsValue({
  1260. egName: value.substr(0, 1).toUpperCase()+ value.substr(1, value.length)
  1261. })
  1262. if (this.realname != null && this.realname != "") {
  1263. var emil = "@gksports.com.cn";
  1264. var name = py.chineseToPinYin(this.realname.substr(0, 1))
  1265. var emils=this.egName + "." + name + emil;
  1266. getAction(this.url.emails, {
  1267. email:emils,
  1268. userid:this.userId
  1269. }).then((res) => {
  1270. if(res!=null&&res!=""){
  1271. this.form.setFieldsValue({
  1272. email: res
  1273. })
  1274. }else{
  1275. this.form.setFieldsValue({
  1276. email: emils
  1277. })
  1278. }
  1279. })
  1280. }
  1281. callback()
  1282. }
  1283. },
  1284. validatesyFund(rule, value, callback) {
  1285. if (!value) {
  1286. callback()
  1287. } else {
  1288. this.form.setFieldsValue({
  1289. syFund: value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')
  1290. })
  1291. callback()
  1292. }
  1293. },
  1294. validatePhone(rule, value, callback) {
  1295. if (!value) {
  1296. callback()
  1297. } else {
  1298. if (!RegExp(/^[0-9]*$/).test(value)) {
  1299. this.form.setFieldsValue({
  1300. phone: value.replace(/[^0-9]/ig,"")
  1301. })
  1302. }else{
  1303. //update-begin--Author:kangxiaolin Date:20190826 for:[05] 手机号不支持199号码段--------------------
  1304. if (new RegExp(/^1[3|4|5|6|7|8|9][0-9]\d{8}$/).test(value)) {
  1305. //update-end--Author:kangxiaolin Date:20190826 for:[05] 手机号不支持199号码段--------------------
  1306. var params = {
  1307. tableName: 'sys_user',
  1308. fieldName: 'phone',
  1309. fieldVal: value,
  1310. dataId: this.userId
  1311. };
  1312. duplicateCheck(params).then((res) => {
  1313. if (res.success) {
  1314. callback()
  1315. } else {
  1316. callback("手机号已存在!")
  1317. }
  1318. })
  1319. } else {
  1320. callback("请输入正确格式的手机号码!");
  1321. }
  1322. }
  1323. }
  1324. },
  1325. validatebankCard(rule, value, callback) {
  1326. if (!value) {
  1327. callback()
  1328. } else {
  1329. if (!RegExp(/^[0-9]*$/).test(value)) {
  1330. this.form.setFieldsValue({
  1331. bankCard: value.replace(/[^0-9]/ig,"")
  1332. })
  1333. }else{
  1334. if (value.length != 19 && value.length != 16) {
  1335. callback('请输入16位或19位银行卡账号');
  1336. }
  1337. }
  1338. callback()
  1339. }
  1340. },
  1341. validateEmail(rule, value, callback) {
  1342. if (!value) {
  1343. callback()
  1344. } else {
  1345. if (new RegExp(
  1346. /^(([^<>()\[\]\\.,;:\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,}))$/
  1347. ).test(value)) {
  1348. /* getAction(this.url.emails, {
  1349. email:value,
  1350. userid:this.userId
  1351. }).then((res) => {
  1352. if(res!=null&&res!=""){
  1353. this.form.setFieldsValue({
  1354. email: res
  1355. })
  1356. }
  1357. }) */
  1358. callback()
  1359. } else {
  1360. callback("请输入正确格式的邮箱!")
  1361. }
  1362. }
  1363. },
  1364. handleConfirmBlur(e) {
  1365. const value = e.target.value;
  1366. this.confirmDirty = this.confirmDirty || !!value
  1367. },
  1368. normFile(e) {
  1369. if (Array.isArray(e)) {
  1370. return e
  1371. }
  1372. return e && e.fileList
  1373. },
  1374. beforeUpload: function(file) {
  1375. var fileType = file.type;
  1376. if (fileType.indexOf('image') < 0) {
  1377. this.$message.warning('请上传图片');
  1378. return false;
  1379. }
  1380. //TODO 验证文件大小
  1381. },
  1382. handleChange(info) {
  1383. this.picUrl = "";
  1384. if (info.file.status === 'uploading') {
  1385. this.uploadLoading = true;
  1386. return
  1387. }
  1388. if (info.file.status === 'done') {
  1389. var response = info.file.response;
  1390. this.uploadLoading = false;
  1391. if (response.success) {
  1392. this.model.avatar = response.message;
  1393. this.picUrl = "Has no pic url yet";
  1394. } else {
  1395. this.$message.warning(response.message);
  1396. }
  1397. }
  1398. },
  1399. // 搜索用户对应的部门API
  1400. onSearch() {
  1401. //console.log(this.$refs.departWindow)
  1402. this.$refs.departWindows.add(this.checkedDepartKeys, this.userId);
  1403. },
  1404. // 获取用户对应部门弹出框提交给返回的数据
  1405. modalFormOk(formData) {
  1406. this.checkedDepartNames = [];
  1407. this.selectedDepartKeys = [];
  1408. this.checkedDepartNameString = '';
  1409. this.userId = formData.userId;
  1410. this.userDepartModel.userId = formData.userId;
  1411. this.departIds = [];
  1412. this.resultDepartOptions = [];
  1413. this.selectionRows = [];
  1414. this.selectedRowKeys = [];
  1415. var depart = [];
  1416. var depName = "";
  1417. if (formData.departIdList != null && formData.departIdList.length > 0) {
  1418. for (let i = 0; i < formData.departIdList.length; i++) {
  1419. this.selectedDepartKeys.push(formData.departIdList[i].key);
  1420. this.checkedDepartNames.push(formData.departIdList[i].title);
  1421. this.form.setFieldsValue({
  1422. checkedDepartNameString: this.checkedDepartNames.join(",")
  1423. })
  1424. depart.push({
  1425. key: formData.departIdList[i].key,
  1426. title: formData.departIdList[i].title
  1427. })
  1428. this.departIds.push(formData.departIdList[i].key)
  1429. }
  1430. this.resultDepartOptions = depart;
  1431. this.userDepartModel.departIdList = this.selectedDepartKeys;
  1432. this.checkedDepartKeys = this.selectedDepartKeys //更新当前的选择keys
  1433. this.zwCode = "";
  1434. this.zwName = "";
  1435. }
  1436. },
  1437. // 根据屏幕变化,设置抽屉尺寸
  1438. resetScreenSize() {
  1439. let screenWidth = document.body.clientWidth;
  1440. if (screenWidth < 500) {
  1441. this.drawerWidth = screenWidth;
  1442. } else {
  1443. this.drawerWidth = 700;
  1444. }
  1445. },
  1446. identityChange(e) {
  1447. if (e.target.value === "1") {
  1448. this.departIdShow = false;
  1449. } else {
  1450. this.departIdShow = true;
  1451. }
  1452. }
  1453. }
  1454. }
  1455. </script>
  1456. <style scoped>
  1457. .avatar-uploader>.ant-upload {
  1458. width: 104px;
  1459. height: 104px;
  1460. }
  1461. .ant-upload-select-picture-card i {
  1462. font-size: 49px;
  1463. color: #999;
  1464. }
  1465. .ant-upload-select-picture-card .ant-upload-text {
  1466. margin-top: 8px;
  1467. color: #666;
  1468. }
  1469. .ant-table-tbody .ant-table-row td {
  1470. padding-top: 10px;
  1471. padding-bottom: 10px;
  1472. }
  1473. .drawer-bootom-button {
  1474. position: absolute;
  1475. bottom: -8px;
  1476. width: 100%;
  1477. border-top: 1px solid #e8e8e8;
  1478. padding: 10px 16px;
  1479. text-align: right;
  1480. left: 0;
  1481. background: #fff;
  1482. border-radius: 0 0 2px 2px;
  1483. }
  1484. </style>