jiazhengUserManager.vue 14 KB

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