jiazhengUserManager.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <view class="admin-jiazheng-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">家政人员</text>
  6. </view>
  7. <v-tabs v-model="current" :tabs="tabs" :scroll="false" @change="changeTab" field="name"
  8. class="admin-tab-box"></v-tabs>
  9. <gerenZiliao ref="gerenZiliao" :status='status' @idCardBlur="idCardBlur" @finishDom='finishDom'
  10. @editSave="editSaveGerenziliao" @goNext="gerenziliaoNext" v-show="current ==0"></gerenZiliao>
  11. <qiuzhiXinxi ref="qiuzhiXinxi" :status='status' @editSave="editSaveQiuzhixinxi" @goNext="goNextQiuzhixinxi"
  12. v-show="current ==1">
  13. </qiuzhiXinxi>
  14. <zhaopianZiliao ref="zhaopianZiliao" :status='status' @editSave="editSaveZhaopianziliao"
  15. @goNext="goNextZhaopianZiliao" v-show="current ==2"></zhaopianZiliao>
  16. <banzhengXinxi ref="banzhengXinxi" :status='status' @goBack="goBack" @addSave="addSave" @editSave="editSave"
  17. v-show="current ==3">
  18. </banzhengXinxi>
  19. <banzhengXinxiList :list="editInfo.kaozhengList" v-show="banzhengXinxiFlag" @editBanzheng="editBanzheng"
  20. @addBanzheng="addBanzheng" @deleteBanzheng="deleteBanzheng" ref="banzhengXinxiList"></banzhengXinxiList>
  21. <common-dialog ref="commonDialogRef" :title="deleteTitle" :content="deleteConcent"
  22. @confirm-btn="deleteQuerenBtn"></common-dialog>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. ref
  28. } from "vue";
  29. import banzhengXinxi from './banzhengXinxi.vue';
  30. import banzhengXinxiList from './banzhengXinxiList.vue';
  31. import qiuzhiXinxi from './qiuzhiXinxi.vue';
  32. import zhaopianZiliao from './zhaopianZiliao.vue';
  33. import commonDialog from '@/components/dialog/commonDialog.vue';
  34. import gerenZiliao from './gerenZiliao.vue';
  35. import {
  36. getJiazhengInfo,
  37. jiazhengAdd,
  38. jiazhengUpdate,
  39. jiazhengKaozhengAdd,
  40. jiazhengKaozhengDelete,
  41. jiazhengKaozhengUpdate
  42. } from "@/api/jiazheng.js";
  43. export default {
  44. data() {
  45. return {
  46. current: 0,
  47. // tabs: ['个人资料', '求职信息', '照片资料', '办证信息']
  48. tabs: [],
  49. allData: {
  50. "birthday": "",
  51. "gender": '',
  52. "hujiDizhi": "",
  53. "hunyin": '',
  54. "icon": "",
  55. "idcard": "",
  56. "idcardUrl1": "",
  57. "idcardUrl2": "",
  58. "idtype": '',
  59. "jiankangDate": "",
  60. "jibiexinzi": "",
  61. "jiguanShengId": '',
  62. "jiguanShiId": '',
  63. "jineng": "",
  64. "jingli": "",
  65. "jingyan": "",
  66. "juzhuDizhi": "",
  67. "kaozhengList": [],
  68. "leixing": "",
  69. "minzu": '',
  70. "qiwangxinzi": "",
  71. "realName": "",
  72. "shenghuoUrls": "",
  73. "shuxiang": '',
  74. "tijianDate": "",
  75. "tijianUrls": "",
  76. "userId": '',
  77. "userName": "",
  78. "xingzuo": '',
  79. "xingzuoFlag": false,
  80. "xueli": '',
  81. "zhengshuUrls": "",
  82. "zhuangtai": '',
  83. "jingdu": '',
  84. "weidu": ''
  85. },
  86. status: '',
  87. id: '',
  88. userId: '',
  89. banzhengXinxiFlag: false,
  90. editInfo: {},
  91. deleteConcent: '你确定要执行这个操作吗?',
  92. deleteTitle: '删除',
  93. deleteIndex: '',
  94. deleteId: '',
  95. }
  96. },
  97. components: {
  98. banzhengXinxi,
  99. banzhengXinxiList,
  100. qiuzhiXinxi,
  101. gerenZiliao,
  102. commonDialog,
  103. zhaopianZiliao
  104. },
  105. onLoad(options) {
  106. let pageInfo = JSON.parse(options.pageInfo)
  107. this.status = pageInfo.status
  108. this.dataHandle(pageInfo)
  109. },
  110. methods: {
  111. goBack() {
  112. this.banzhengXinxiFlag = true
  113. },
  114. editBanzheng(data, index) {
  115. console.log('dataasdf',data);
  116. this.current = 3
  117. this.banzhengXinxiFlag = false
  118. this.$refs.banzhengXinxi.editinfo(data, index)
  119. this.$refs.banzhengXinxi.currentMove('edit')
  120. },
  121. addBanzheng(data, index) {
  122. this.banzhengXinxiFlag = false
  123. this.current = 3
  124. this.$refs.banzhengXinxi.resetFun()
  125. this.$refs.banzhengXinxi.currentMove('editAdd')
  126. },
  127. deleteBanzheng(data, index) {
  128. console.log('data', data);
  129. console.log('index', index);
  130. console.log('data.statusBanzheng', data.statusBanzheng);
  131. this.deleteId = data.id
  132. this.deleteIndex = index
  133. if (data.statusBanzheng == '办证完成') {
  134. uni.showToast({
  135. title: "办证状态为办证完成禁止删除",
  136. icon: 'none',
  137. duration: 2000
  138. })
  139. return false
  140. }
  141. this.$refs.commonDialogRef.handleShow()
  142. },
  143. deleteQuerenBtn() {
  144. jiazhengKaozhengDelete({
  145. ids: [this.deleteId]
  146. }).then(res => {
  147. if (res.code == 0) {
  148. uni.showToast({
  149. title: "成功",
  150. icon: 'none',
  151. duration: 2000
  152. })
  153. this.editInfo.kaozhengList.splice(this.deleteIndex, 1);
  154. if (this.editInfo.kaozhengList.length == 0) {
  155. this.banzhengXinxiFlag = true
  156. }
  157. }
  158. })
  159. },
  160. idCardBlur(data) {
  161. this.$refs.qiuzhiXinxi.editinfo(data)
  162. this.$refs.zhaopianZiliao.editinfo(data)
  163. },
  164. dataHandle(pageInfo) {
  165. if (this.status == 'add') {
  166. this.tabs = [{
  167. id: 1,
  168. name: '个人资料',
  169. disabled: false
  170. },
  171. {
  172. id: 2,
  173. name: '求职信息',
  174. disabled: true
  175. },
  176. {
  177. id: 3,
  178. name: '照片资料',
  179. disabled: true
  180. },
  181. {
  182. id: 4,
  183. name: '办证信息',
  184. disabled: true
  185. },
  186. ]
  187. } else {
  188. this.id = pageInfo.id
  189. this.userId = pageInfo.userId
  190. this.tabs = [{
  191. id: 1,
  192. name: '个人资料',
  193. disabled: false
  194. },
  195. {
  196. id: 2,
  197. name: '求职信息',
  198. disabled: false
  199. },
  200. {
  201. id: 3,
  202. name: '照片资料',
  203. disabled: false
  204. },
  205. {
  206. id: 4,
  207. name: '办证信息',
  208. disabled: false
  209. },
  210. ]
  211. }
  212. },
  213. finishDom() {
  214. let req = {
  215. id: this.id,
  216. userId: this.userId
  217. }
  218. getJiazhengInfo(req).then(res => {
  219. if (res.code == 0) {
  220. this.$refs.gerenZiliao.editinfo(res.data)
  221. this.editInfo = JSON.parse(JSON.stringify(res.data));
  222. this.allData = JSON.parse(JSON.stringify(res.data));
  223. this.allData.id = this.id
  224. console.log('this.allData this.allData ', this.allData);
  225. } else {
  226. uni.showToast({
  227. icon: 'none',
  228. title: '获取详情失败'
  229. })
  230. return false
  231. }
  232. })
  233. },
  234. changeTab(data) {
  235. console.log('data', data);
  236. if (this.status == 'edit' &&data ==3) {
  237. this.banzhengXinxiFlag = true
  238. return false
  239. } else {
  240. this.banzhengXinxiFlag = false
  241. }
  242. if (this.status == 'add') {
  243. if (this.current >= 0) {
  244. this.current--;
  245. this.updateTabs();
  246. }
  247. }
  248. this.current = data
  249. if (this.status != 'edit') {
  250. return false
  251. }
  252. switch (Number(data)) {
  253. case 0:
  254. this.$refs.gerenZiliao.editinfo(this.editInfo)
  255. break;
  256. case 1:
  257. this.$refs.qiuzhiXinxi.editinfo(this.editInfo)
  258. break;
  259. case 2:
  260. this.$refs.zhaopianZiliao.editinfo(this.editInfo)
  261. break;
  262. case 3:
  263. this.$refs.banzhengXinxi.editinfo()
  264. break;
  265. default:
  266. break;
  267. }
  268. },
  269. gerenZiliaoDataHandle(data, flag) {
  270. console.log('gerenZiliaoDataHandle', data);
  271. console.log('gerenZiliaoDataHandle', data.hunyin.id);
  272. this.allData.userName = data.userName
  273. this.allData.realName = data.realName
  274. this.allData.idcard = data.idcard
  275. this.allData.idtype = data.idtype
  276. this.allData.jiguanShengId = data.jiguanObj.jiguanShengId
  277. this.allData.jiguanShiId = data.jiguanObj.jiguanShiId
  278. this.allData.juzhuDizhi = data.juzhuDizhi
  279. this.allData.birthday = data.birthday
  280. this.allData.minzu = data.minzu.id
  281. this.allData.gender = data.gender
  282. this.allData.xueli = data.xueli.id
  283. this.allData.hunyin = data.hunyin.id
  284. this.allData.hujiDizhi = data.hujiDizhi
  285. this.allData.xingzuo = data.xingzuo.id
  286. this.allData.shuxiang = data.shuxiang.id
  287. this.allData.xingzuoFlag = data.xingzuoFlag
  288. this.allData.jingdu = data.jingdu
  289. this.allData.weidu = data.weidu
  290. if (flag == 'edit') {
  291. jiazhengUpdate(this.allData).then(res => {
  292. uni.showToast({
  293. title: "保存成功!",
  294. icon: 'none',
  295. duration: 2000
  296. })
  297. })
  298. }
  299. },
  300. gerenziliaoNext(data, num) {
  301. this.gerenZiliaoDataHandle(data)
  302. // this.current = num + 1
  303. // this.tabs = this.tabs.map((item, i) => {
  304. // if (i == this.current) item.disabled = false
  305. // return item
  306. // })
  307. if (this.current < this.tabs.length - 1) {
  308. this.current++;
  309. this.updateTabs();
  310. }
  311. },
  312. editSaveGerenziliao(data) {
  313. this.gerenZiliaoDataHandle(data, 'edit')
  314. },
  315. qiuzhiXinxiDataHandle(data, flag) {
  316. this.allData.leixing = data.leixing
  317. this.allData.jingyan = data.jingyan
  318. this.allData.jineng = data.jineng
  319. this.allData.zhuangtai = data.zhuangtai
  320. this.allData.jibiexinzi = data.jibiexinzi
  321. this.allData.qiwangxinzi = data.qiwangxinzi
  322. this.allData.jingli = data.jingli
  323. if (flag == 'edit') {
  324. jiazhengUpdate(this.allData).then(res => {
  325. uni.showToast({
  326. title: "保存成功!",
  327. icon: 'none',
  328. duration: 2000
  329. })
  330. })
  331. }
  332. },
  333. goNextQiuzhixinxi(data, num) {
  334. this.qiuzhiXinxiDataHandle(data)
  335. if (this.current < this.tabs.length - 1) {
  336. this.current++;
  337. this.updateTabs();
  338. }
  339. // this.current = num + 1
  340. // this.tabs = this.tabs.map((item, i) => {
  341. // if (i == this.current) item.disabled = false
  342. // return item
  343. // })
  344. },
  345. updateTabs() {
  346. console.log('this.tabsthis.tabs', this.tabs);
  347. console.log('this.current', this.tabs);
  348. this.tabs = this.tabs.map((item, i) => {
  349. // 当前页签及之前的页签 disabled 为 false,之后的页签 disabled 为 true
  350. item.disabled = i >= this.current;
  351. return item;
  352. });
  353. },
  354. editSaveQiuzhixinxi(data) {
  355. this.qiuzhiXinxiDataHandle(data, 'edit')
  356. },
  357. goNextZhaopianZiliao(data, num) {
  358. this.zhaopianziliaoDataHandle(data)
  359. // this.current = num + 1
  360. // this.tabs = this.tabs.map((item, i) => {
  361. // if (i == this.current) item.disabled = false
  362. // return item
  363. // })
  364. if (this.current < this.tabs.length - 1) {
  365. this.current++;
  366. this.updateTabs();
  367. }
  368. },
  369. zhaopianziliaoDataHandle(data, flag) {
  370. this.allData.icon = data.icon
  371. this.allData.idcardUrl1 = data.idcardUrl1
  372. this.allData.idcardUrl2 = data.idcardUrl2
  373. this.allData.shenghuoUrls = data.shenghuoUrls
  374. this.allData.zhengshuUrls = data.zhengshuUrls
  375. this.allData.tijianDate = data.tijianDate
  376. this.allData.jiankangDate = data.jiankangDate
  377. this.allData.tijianUrls = data.tijianUrls
  378. if (flag == 'edit') {
  379. jiazhengUpdate(this.allData).then(res => {
  380. uni.showToast({
  381. title: "保存成功!",
  382. icon: 'none',
  383. duration: 2000
  384. })
  385. })
  386. }
  387. },
  388. editSaveZhaopianziliao(data) {
  389. this.zhaopianziliaoDataHandle(data, 'edit')
  390. },
  391. addSave(data) {
  392. if (this.status == 'add') {
  393. this.submitJiazheng(data)
  394. } else {}
  395. },
  396. submitJiazheng(data) {
  397. console.log('this.allData', this.allData);
  398. if (this.allData.kaozhengList.length > 0 && this.allData.icon == '') {
  399. uni.showToast({
  400. title: "当录入办证信息时候,头像必填",
  401. icon: 'none',
  402. duration: 2000
  403. })
  404. return false
  405. }
  406. if (data != '') {
  407. this.allData.kaozhengList.push(data)
  408. }
  409. jiazhengAdd(this.allData).then(res => {
  410. if (res.code == 0) {
  411. uni.showToast({
  412. title: "成功",
  413. icon: 'none',
  414. duration: 2000
  415. })
  416. uni.navigateTo({
  417. url: `/pages/admin/Jiazheng/index`
  418. })
  419. } else {
  420. uni.showToast({
  421. title: "失败",
  422. icon: 'none',
  423. duration: 2000
  424. })
  425. return false
  426. }
  427. })
  428. },
  429. editSave(data, flag,index) {
  430. debugger
  431. console.log('this.allData', this.allData);
  432. console.log('this.editInfo', this.editInfo);
  433. if (flag == 'edit') {
  434. jiazhengKaozhengUpdate(data).then(res => {
  435. if(res.code ==0){
  436. uni.showToast({
  437. title: "保存成功!",
  438. icon: 'none',
  439. duration: 2000
  440. })
  441. this.banzhengXinxiFlag = true
  442. this.editInfo.kaozhengList[index].canxunshijian = data.canxunshijian
  443. this.editInfo.kaozhengList[index].jgId = data.jgId
  444. this.editInfo.kaozhengList[index].jgName = data.jgName
  445. this.editInfo.kaozhengList[index].jzId = data.jzId
  446. this.editInfo.kaozhengList[index].needKaoshi = data.needKaoshi
  447. this.editInfo.kaozhengList[index].needKecheng = data.needKecheng
  448. this.editInfo.kaozhengList[index].needKecheng = data.needKecheng
  449. this.editInfo.kaozhengList[index].shicaochengji = data.shicaochengji
  450. this.editInfo.kaozhengList[index].statusBanzheng = data.statusBanzheng
  451. this.editInfo.kaozhengList[index].statusKaoshi = data.statusKaoshi
  452. this.editInfo.kaozhengList[index].zongkeshi = data.zongkeshi
  453. this.editInfo.kaozhengList[index].id = data.id
  454. this.editInfo.kaozhengList[index].zyId = data.zyId
  455. this.editInfo.kaozhengList[index].zyLevel = data.zyLevel
  456. this.editInfo.kaozhengList[index].zyLevelName = data.zyLevelName
  457. this.editInfo.kaozhengList[index].zyName = data.zyName
  458. }
  459. })
  460. } else if (flag == 'editAdd') {
  461. data.userId = this.userId
  462. if (this.allData.icon == '') {
  463. uni.showToast({
  464. title: "当录入办证信息时候,头像必填",
  465. icon: 'none',
  466. duration: 2000
  467. })
  468. return false
  469. }
  470. jiazhengKaozhengAdd(data).then(res => {
  471. if (res.code == 0) {
  472. data.id = res.data
  473. this.allData.kaozhengList.push(data)
  474. this.editInfo.kaozhengList.push(data)
  475. console.log('this.editInfo.kaozhengList', this.editInfo.kaozhengList);
  476. this.banzhengXinxiFlag = true
  477. }
  478. })
  479. }
  480. // if (data != '') {
  481. // this.allData.kaozhengList.push(data)
  482. // }
  483. // if(this.status =='add'){
  484. // this.submitJiazheng()
  485. // }else{
  486. // }
  487. },
  488. goUpPage() {
  489. uni.navigateTo({
  490. url: `/pages/admin/Jiazheng/index`
  491. })
  492. }
  493. }
  494. }
  495. </script>