jiazhengUserManager.vue 11 KB

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