jiazhengUserManager.vue 15 KB

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