jiazhengUserManager.vue 14 KB

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