jiazhengUserManager.vue 14 KB

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