UserDetailModal.vue 50 KB

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