jiazhengUserManager.vue 14 KB

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