jiazhengUserManager.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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" v-show="current ==3">
  17. </banzhengXinxi>
  18. <banzhengXinxiList :list="editInfo.kaozhengList" v-show="banzhengXinxiFlag" @editBanzheng="editBanzheng"
  19. ref="banzhengXinxiList"></banzhengXinxiList>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. ref
  25. } from "vue";
  26. import banzhengXinxi from './banzhengXinxi.vue';
  27. import banzhengXinxiList from './banzhengXinxiList.vue';
  28. import qiuzhiXinxi from './qiuzhiXinxi.vue';
  29. import zhaopianZiliao from './zhaopianZiliao.vue';
  30. import gerenZiliao from './gerenZiliao.vue';
  31. import {
  32. getJiazhengInfo,
  33. jiazhengAdd,
  34. jiazhengUpdate
  35. } from "@/api/jiazheng.js";
  36. export default {
  37. data() {
  38. return {
  39. current: 0,
  40. // tabs: ['个人资料', '求职信息', '照片资料', '办证信息']
  41. tabs: [],
  42. allData: {
  43. "birthday": "",
  44. "gender": '',
  45. "hujiDizhi": "",
  46. "hunyin": '',
  47. "icon": "",
  48. "idcard": "",
  49. "idcardUrl1": "",
  50. "idcardUrl2": "",
  51. "idtype": '',
  52. "jiankangDate": "",
  53. "jibiexinzi": "",
  54. "jiguanShengId": '',
  55. "jiguanShiId": '',
  56. "jineng": "",
  57. "jingli": "",
  58. "jingyan": "",
  59. "juzhuDizhi": "",
  60. "kaozhengList": [],
  61. "leixing": "",
  62. "minzu": '',
  63. "qiwangxinzi": "",
  64. "realName": "",
  65. "shenghuoUrls": "",
  66. "shuxiang": '',
  67. "tijianDate": "",
  68. "tijianUrl": "",
  69. "userId": '',
  70. "userName": "",
  71. "xingzuo": '',
  72. "xingzuoFlag": false,
  73. "xueli": '',
  74. "zhengshuUrls": "",
  75. "zhuangtai": ''
  76. },
  77. status: '',
  78. id: '',
  79. userId: '',
  80. banzhengXinxiFlag: false,
  81. editInfo: {}
  82. }
  83. },
  84. components: {
  85. banzhengXinxi,
  86. banzhengXinxiList,
  87. qiuzhiXinxi,
  88. gerenZiliao,
  89. zhaopianZiliao,
  90. },
  91. onLoad(options) {
  92. let pageInfo = JSON.parse(options.pageInfo)
  93. this.status = pageInfo.status
  94. this.dataHandle(pageInfo)
  95. },
  96. methods: {
  97. dataHandle(pageInfo) {
  98. if (this.status == 'add') {
  99. this.tabs = [{
  100. id: 1,
  101. name: '个人资料',
  102. disabled: false
  103. },
  104. {
  105. id: 2,
  106. name: '求职信息',
  107. disabled: true
  108. },
  109. {
  110. id: 3,
  111. name: '照片资料',
  112. disabled: true
  113. },
  114. {
  115. id: 4,
  116. name: '办证信息',
  117. disabled: true
  118. },
  119. ]
  120. } else {
  121. this.id = pageInfo.id
  122. this.userId = pageInfo.userId
  123. this.tabs = [{
  124. id: 1,
  125. name: '个人资料',
  126. disabled: false
  127. },
  128. {
  129. id: 2,
  130. name: '求职信息',
  131. disabled: false
  132. },
  133. {
  134. id: 3,
  135. name: '照片资料',
  136. disabled: false
  137. },
  138. {
  139. id: 4,
  140. name: '办证信息',
  141. disabled: false
  142. },
  143. ]
  144. }
  145. },
  146. finishDom() {
  147. let req = {
  148. id: this.id,
  149. userId: this.userId
  150. }
  151. getJiazhengInfo(req).then(res => {
  152. if (res.code == 0) {
  153. this.$refs.gerenZiliao.editinfo(res.data)
  154. this.editInfo = res.data
  155. this.allData = {
  156. ...res.data
  157. }
  158. this.allData.id = this.id
  159. console.log('this.allData this.allData ', this.allData);
  160. } else {
  161. uni.showToast({
  162. icon: 'none',
  163. title: '获取详情失败'
  164. })
  165. return false
  166. }
  167. })
  168. },
  169. changeTab(data) {
  170. console.log('data', data);
  171. if (this.status == 'edit' && data == 3 && this.editInfo.kaozhengList.length > 0) {
  172. this.banzhengXinxiFlag = true
  173. return false
  174. } else {
  175. this.banzhengXinxiFlag = false
  176. }
  177. this.current = data
  178. if (this.status != 'edit') {
  179. return false
  180. }
  181. switch (Number(data)) {
  182. case 0:
  183. this.$refs.gerenZiliao.editinfo(this.editInfo)
  184. break;
  185. case 1:
  186. this.$refs.qiuzhiXinxi.editinfo(this.editInfo)
  187. break;
  188. case 2:
  189. this.$refs.zhaopianZiliao.editinfo(this.editInfo)
  190. break;
  191. case 3:
  192. this.$refs.banzhengXinxi.editinfo(this.editInfo)
  193. break;
  194. default:
  195. break;
  196. }
  197. },
  198. gerenZiliaoDataHandle(data, flag) {
  199. console.log('gerenZiliaoDataHandle', data);
  200. console.log('gerenZiliaoDataHandle', data.hunyin.id);
  201. this.allData.userName = data.userName
  202. this.allData.realName = data.realName
  203. this.allData.idcard = data.idcard
  204. this.allData.idtype = data.idtype
  205. this.allData.jiguanShengId = data.jiguanObj.jiguanShengId
  206. this.allData.jiguanShiId = data.jiguanObj.jiguanShiId
  207. this.allData.juzhuDizhi = data.juzhuDizhi
  208. this.allData.birthday = data.birthday
  209. this.allData.minzu = data.minzu.id
  210. this.allData.gender = data.gender
  211. this.allData.xueli = data.xueli.id
  212. this.allData.hunyin = data.hunyin.id
  213. this.allData.hujiDizhi = data.hujiDizhi
  214. this.allData.xingzuo = data.xingzuo.id
  215. this.allData.shuxiang = data.shuxiang.id
  216. this.allData.xingzuoFlag = data.xingzuoFlag
  217. if (flag == 'edit') {
  218. jiazhengUpdate(this.allData).then(res => {
  219. uni.showToast({
  220. title: "保存成功!",
  221. icon: 'none',
  222. duration: 2000
  223. })
  224. })
  225. }
  226. },
  227. gerenziliaoNext(data, num) {
  228. this.gerenZiliaoDataHandle(data)
  229. this.current = num + 1
  230. this.tabs = this.tabs.map((item, i) => {
  231. if (i == this.current) item.disabled = false
  232. return item
  233. })
  234. },
  235. editSaveGerenziliao(data) {
  236. this.gerenZiliaoDataHandle(data, 'edit')
  237. },
  238. qiuzhiXinxiDataHandle(data,flag) {
  239. this.allData.leixing = data.leixing
  240. this.allData.jingyan = data.jingyan
  241. this.allData.jineng = data.jineng
  242. this.allData.zhuangtai = data.zhuangtai
  243. this.allData.jibiexinzi = data.jibiexinzi
  244. this.allData.qiwangxinzi = data.qiwangxinzi
  245. this.allData.jingli = data.jingli
  246. if (flag == 'edit') {
  247. jiazhengUpdate(this.allData).then(res => {
  248. uni.showToast({
  249. title: "保存成功!",
  250. icon: 'none',
  251. duration: 2000
  252. })
  253. })
  254. }
  255. },
  256. goNextQiuzhixinxi(data, num) {
  257. this.qiuzhiXinxiDataHandle(data)
  258. this.current = num + 1
  259. this.tabs = this.tabs.map((item, i) => {
  260. if (i == this.current) item.disabled = false
  261. return item
  262. })
  263. },
  264. editSaveQiuzhixinxi(data) {
  265. this.qiuzhiXinxiDataHandle(data,'edit')
  266. },
  267. goNextZhaopianZiliao(data, num) {
  268. this.zhaopianziliaoDataHandle(data)
  269. this.current = num + 1
  270. this.tabs = this.tabs.map((item, i) => {
  271. if (i == this.current) item.disabled = false
  272. return item
  273. })
  274. },
  275. zhaopianziliaoDataHandle(data,flag) {
  276. this.allData.icon = data.icon
  277. this.allData.idcardUrl1 = data.idcardUrl1
  278. this.allData.idcardUrl2 = data.idcardUrl2
  279. this.allData.shenghuoUrls = data.shenghuoUrls
  280. this.allData.zhengshuUrls = data.zhengshuUrls
  281. this.allData.tijianDate = data.tijianDate
  282. this.allData.jiankangDate = data.jiankangDate
  283. this.allData.tijianUrl = data.tijianUrl
  284. if (flag == 'edit') {
  285. jiazhengUpdate(this.allData).then(res => {
  286. uni.showToast({
  287. title: "保存成功!",
  288. icon: 'none',
  289. duration: 2000
  290. })
  291. })
  292. }
  293. },
  294. editSaveZhaopianziliao(data) {
  295. this.zhaopianziliaoDataHandle(data,'edit')
  296. },
  297. addSave(data) {
  298. if (data != '') {
  299. this.allData.kaozhengList.push(data)
  300. }
  301. this.submitJiazheng()
  302. },
  303. submitJiazheng() {
  304. console.log('this.allData', this.allData);
  305. jiazhengAdd(this.allData).then(res => {
  306. if (res.code == 0) {
  307. uni.navigateTo({
  308. url: `/pages/admin/Jiazheng/index`
  309. })
  310. } else {
  311. uni.showToast({
  312. title: "失败",
  313. icon: 'none',
  314. duration: 2000
  315. })
  316. return false
  317. }
  318. })
  319. },
  320. editBanzheng(data, index) {
  321. this.current = 3
  322. this.banzhengXinxiFlag = false
  323. this.$refs.banzhengXinxi.editinfo(data, index)
  324. },
  325. goUpPage() {
  326. uni.navigateTo({
  327. url: `/pages/admin/Jiazheng/index`
  328. })
  329. }
  330. }
  331. }
  332. </script>