jiazhengUserManager.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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' @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. </view>
  22. </template>
  23. <script>
  24. import {
  25. ref
  26. } from "vue";
  27. import banzhengXinxi from './banzhengXinxi.vue';
  28. import banzhengXinxiList from './banzhengXinxiList.vue';
  29. import qiuzhiXinxi from './qiuzhiXinxi.vue';
  30. import zhaopianZiliao from './zhaopianZiliao.vue';
  31. import gerenZiliao from './gerenZiliao.vue';
  32. import {
  33. getJiazhengInfo,
  34. jiazhengAdd,
  35. jiazhengUpdate,
  36. jiazhengKaozhengAdd,
  37. jiazhengKaozhengDelete
  38. } from "@/api/jiazheng.js";
  39. export default {
  40. data() {
  41. return {
  42. current: 0,
  43. // tabs: ['个人资料', '求职信息', '照片资料', '办证信息']
  44. tabs: [],
  45. allData: {
  46. "birthday": "",
  47. "gender": '',
  48. "hujiDizhi": "",
  49. "hunyin": '',
  50. "icon": "",
  51. "idcard": "",
  52. "idcardUrl1": "",
  53. "idcardUrl2": "",
  54. "idtype": '',
  55. "jiankangDate": "",
  56. "jibiexinzi": "",
  57. "jiguanShengId": '',
  58. "jiguanShiId": '',
  59. "jineng": "",
  60. "jingli": "",
  61. "jingyan": "",
  62. "juzhuDizhi": "",
  63. "kaozhengList": [],
  64. "leixing": "",
  65. "minzu": '',
  66. "qiwangxinzi": "",
  67. "realName": "",
  68. "shenghuoUrls": "",
  69. "shuxiang": '',
  70. "tijianDate": "",
  71. "tijianUrls": "",
  72. "userId": '',
  73. "userName": "",
  74. "xingzuo": '',
  75. "xingzuoFlag": false,
  76. "xueli": '',
  77. "zhengshuUrls": "",
  78. "zhuangtai": ''
  79. },
  80. status: '',
  81. id: '',
  82. userId: '',
  83. banzhengXinxiFlag: false,
  84. editInfo: {}
  85. }
  86. },
  87. components: {
  88. banzhengXinxi,
  89. banzhengXinxiList,
  90. qiuzhiXinxi,
  91. gerenZiliao,
  92. zhaopianZiliao,
  93. },
  94. onLoad(options) {
  95. let pageInfo = JSON.parse(options.pageInfo)
  96. this.status = pageInfo.status
  97. this.dataHandle(pageInfo)
  98. },
  99. methods: {
  100. editBanzheng(data, index) {
  101. this.current = 3
  102. this.banzhengXinxiFlag = false
  103. this.$refs.banzhengXinxi.editinfo(data, index)
  104. },
  105. addBanzheng(data, index) {
  106. this.banzhengXinxiFlag = false
  107. this.current = 3
  108. this.$refs.banzhengXinxi.resetFun()
  109. },
  110. deleteBanzheng(data, index) {
  111. console.log('data', data);
  112. console.log('index', index);
  113. jiazhengKaozhengDelete({
  114. ids: [data.id]
  115. }).then(res => {
  116. if (res.code == 0) {
  117. uni.showToast({
  118. title: "成功",
  119. icon: 'none',
  120. duration: 2000
  121. })
  122. this.editInfo.kaozhengList.splice(index, 1);
  123. if (this.editInfo.kaozhengList.length == 0) {
  124. this.banzhengXinxiFlag = false
  125. this.current = 3
  126. }
  127. }
  128. })
  129. },
  130. idCardBlur(data) {
  131. this.$refs.qiuzhiXinxi.editinfo(data)
  132. this.$refs.zhaopianZiliao.editinfo(data)
  133. },
  134. dataHandle(pageInfo) {
  135. if (this.status == 'add') {
  136. this.tabs = [{
  137. id: 1,
  138. name: '个人资料',
  139. disabled: false
  140. },
  141. {
  142. id: 2,
  143. name: '求职信息',
  144. disabled: true
  145. },
  146. {
  147. id: 3,
  148. name: '照片资料',
  149. disabled: true
  150. },
  151. {
  152. id: 4,
  153. name: '办证信息',
  154. disabled: true
  155. },
  156. ]
  157. } else {
  158. this.id = pageInfo.id
  159. this.userId = pageInfo.userId
  160. this.tabs = [{
  161. id: 1,
  162. name: '个人资料',
  163. disabled: false
  164. },
  165. {
  166. id: 2,
  167. name: '求职信息',
  168. disabled: false
  169. },
  170. {
  171. id: 3,
  172. name: '照片资料',
  173. disabled: false
  174. },
  175. {
  176. id: 4,
  177. name: '办证信息',
  178. disabled: false
  179. },
  180. ]
  181. }
  182. },
  183. finishDom() {
  184. let req = {
  185. id: this.id,
  186. userId: this.userId
  187. }
  188. getJiazhengInfo(req).then(res => {
  189. if (res.code == 0) {
  190. this.$refs.gerenZiliao.editinfo(res.data)
  191. this.editInfo = JSON.parse(JSON.stringify(res.data));
  192. this.allData = JSON.parse(JSON.stringify(res.data));
  193. this.allData.id = this.id
  194. console.log('this.allData this.allData ', this.allData);
  195. } else {
  196. uni.showToast({
  197. icon: 'none',
  198. title: '获取详情失败'
  199. })
  200. return false
  201. }
  202. })
  203. },
  204. changeTab(data) {
  205. console.log('data', data);
  206. if (this.status == 'edit' && data == 3 && this.editInfo.kaozhengList.length > 0) {
  207. this.banzhengXinxiFlag = true
  208. return false
  209. } else {
  210. this.banzhengXinxiFlag = false
  211. }
  212. if (this.status == 'add') {
  213. if (this.current >= 0) {
  214. this.current--;
  215. this.updateTabs();
  216. }
  217. }
  218. this.current = data
  219. if (this.status != 'edit') {
  220. return false
  221. }
  222. switch (Number(data)) {
  223. case 0:
  224. this.$refs.gerenZiliao.editinfo(this.editInfo)
  225. break;
  226. case 1:
  227. this.$refs.qiuzhiXinxi.editinfo(this.editInfo)
  228. break;
  229. case 2:
  230. this.$refs.zhaopianZiliao.editinfo(this.editInfo)
  231. break;
  232. case 3:
  233. this.$refs.banzhengXinxi.editinfo()
  234. break;
  235. default:
  236. break;
  237. }
  238. },
  239. gerenZiliaoDataHandle(data, flag) {
  240. console.log('gerenZiliaoDataHandle', data);
  241. console.log('gerenZiliaoDataHandle', data.hunyin.id);
  242. this.allData.userName = data.userName
  243. this.allData.realName = data.realName
  244. this.allData.idcard = data.idcard
  245. this.allData.idtype = data.idtype
  246. this.allData.jiguanShengId = data.jiguanObj.jiguanShengId
  247. this.allData.jiguanShiId = data.jiguanObj.jiguanShiId
  248. this.allData.juzhuDizhi = data.juzhuDizhi
  249. this.allData.birthday = data.birthday
  250. this.allData.minzu = data.minzu.id
  251. this.allData.gender = data.gender
  252. this.allData.xueli = data.xueli.id
  253. this.allData.hunyin = data.hunyin.id
  254. this.allData.hujiDizhi = data.hujiDizhi
  255. this.allData.xingzuo = data.xingzuo.id
  256. this.allData.shuxiang = data.shuxiang.id
  257. this.allData.xingzuoFlag = data.xingzuoFlag
  258. if (flag == 'edit') {
  259. jiazhengUpdate(this.allData).then(res => {
  260. uni.showToast({
  261. title: "保存成功!",
  262. icon: 'none',
  263. duration: 2000
  264. })
  265. })
  266. }
  267. },
  268. gerenziliaoNext(data, num) {
  269. this.gerenZiliaoDataHandle(data)
  270. // this.current = num + 1
  271. // this.tabs = this.tabs.map((item, i) => {
  272. // if (i == this.current) item.disabled = false
  273. // return item
  274. // })
  275. if (this.current < this.tabs.length - 1) {
  276. this.current++;
  277. this.updateTabs();
  278. }
  279. },
  280. editSaveGerenziliao(data) {
  281. this.gerenZiliaoDataHandle(data, 'edit')
  282. },
  283. qiuzhiXinxiDataHandle(data, flag) {
  284. this.allData.leixing = data.leixing
  285. this.allData.jingyan = data.jingyan
  286. this.allData.jineng = data.jineng
  287. this.allData.zhuangtai = data.zhuangtai
  288. this.allData.jibiexinzi = data.jibiexinzi
  289. this.allData.qiwangxinzi = data.qiwangxinzi
  290. this.allData.jingli = data.jingli
  291. if (flag == 'edit') {
  292. jiazhengUpdate(this.allData).then(res => {
  293. uni.showToast({
  294. title: "保存成功!",
  295. icon: 'none',
  296. duration: 2000
  297. })
  298. })
  299. }
  300. },
  301. goNextQiuzhixinxi(data, num) {
  302. this.qiuzhiXinxiDataHandle(data)
  303. if (this.current < this.tabs.length - 1) {
  304. this.current++;
  305. this.updateTabs();
  306. }
  307. // this.current = num + 1
  308. // this.tabs = this.tabs.map((item, i) => {
  309. // if (i == this.current) item.disabled = false
  310. // return item
  311. // })
  312. },
  313. updateTabs() {
  314. console.log('this.tabsthis.tabs', this.tabs);
  315. console.log('this.current', this.tabs);
  316. this.tabs = this.tabs.map((item, i) => {
  317. // 当前页签及之前的页签 disabled 为 false,之后的页签 disabled 为 true
  318. item.disabled = i >= this.current;
  319. return item;
  320. });
  321. },
  322. editSaveQiuzhixinxi(data) {
  323. this.qiuzhiXinxiDataHandle(data, 'edit')
  324. },
  325. goNextZhaopianZiliao(data, num) {
  326. this.zhaopianziliaoDataHandle(data)
  327. // this.current = num + 1
  328. // this.tabs = this.tabs.map((item, i) => {
  329. // if (i == this.current) item.disabled = false
  330. // return item
  331. // })
  332. if (this.current < this.tabs.length - 1) {
  333. this.current++;
  334. this.updateTabs();
  335. }
  336. },
  337. zhaopianziliaoDataHandle(data, flag) {
  338. this.allData.icon = data.icon
  339. this.allData.idcardUrl1 = data.idcardUrl1
  340. this.allData.idcardUrl2 = data.idcardUrl2
  341. this.allData.shenghuoUrls = data.shenghuoUrls
  342. this.allData.zhengshuUrls = data.zhengshuUrls
  343. this.allData.tijianDate = data.tijianDate
  344. this.allData.jiankangDate = data.jiankangDate
  345. this.allData.tijianUrls = data.tijianUrls
  346. if (flag == 'edit') {
  347. jiazhengUpdate(this.allData).then(res => {
  348. uni.showToast({
  349. title: "保存成功!",
  350. icon: 'none',
  351. duration: 2000
  352. })
  353. })
  354. }
  355. },
  356. editSaveZhaopianziliao(data) {
  357. this.zhaopianziliaoDataHandle(data, 'edit')
  358. },
  359. addSave(data) {
  360. if (data != '') {
  361. this.allData.kaozhengList.push(data)
  362. }
  363. if (this.status == 'add') {
  364. this.submitJiazheng()
  365. } else {
  366. }
  367. },
  368. submitJiazheng() {
  369. console.log('this.allData', this.allData);
  370. if (this.allData.kaozhengList.length > 0 && this.allData.icon == '') {
  371. uni.showToast({
  372. title: "当录入办证信息时候,头像必填",
  373. icon: 'none',
  374. duration: 2000
  375. })
  376. return false
  377. }
  378. jiazhengAdd(this.allData).then(res => {
  379. if (res.code == 0) {
  380. uni.showToast({
  381. title: "成功",
  382. icon: 'none',
  383. duration: 2000
  384. })
  385. uni.navigateTo({
  386. url: `/pages/admin/Jiazheng/index`
  387. })
  388. } else {
  389. uni.showToast({
  390. title: "失败",
  391. icon: 'none',
  392. duration: 2000
  393. })
  394. return false
  395. }
  396. })
  397. },
  398. editSave(data) {
  399. debugger
  400. console.log('this.allData', this.allData);
  401. console.log('this.editInfo', this.editInfo);
  402. if (data == '' && this.status == 'edit') {
  403. jiazhengUpdate(this.allData).then(res => {
  404. uni.showToast({
  405. title: "保存成功!",
  406. icon: 'none',
  407. duration: 2000
  408. })
  409. })
  410. } else if (data && this.status == 'edit') {
  411. data.userId = this.userId
  412. if (this.allData.icon == '') {
  413. uni.showToast({
  414. title: "当录入办证信息时候,头像必填",
  415. icon: 'none',
  416. duration: 2000
  417. })
  418. return false
  419. }
  420. jiazhengKaozhengAdd(data).then(res => {
  421. if (res.code == 0) {
  422. data.id = res.data
  423. this.allData.kaozhengList.push(data)
  424. this.editInfo.kaozhengList.push(data)
  425. console.log('this.editInfo.kaozhengList', this.editInfo.kaozhengList);
  426. this.banzhengXinxiFlag = true
  427. }
  428. })
  429. }
  430. // if (data != '') {
  431. // this.allData.kaozhengList.push(data)
  432. // }
  433. // if(this.status =='add'){
  434. // this.submitJiazheng()
  435. // }else{
  436. // }
  437. },
  438. goUpPage() {
  439. uni.navigateTo({
  440. url: `/pages/admin/Jiazheng/index`
  441. })
  442. }
  443. }
  444. }
  445. </script>