gerenZiliao.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. <template>
  2. <view class="jz-content-box">
  3. <!-- 涂层 子家政公司使用 -->
  4. <view :class="isZijiazheng=='true'?'mask-view':''">
  5. <view class="upload-img-box">
  6. <jiazhengUpload @getFileUrl="getFileUrl" changjingType="shenfenzheng"></jiazhengUpload>
  7. </view>
  8. <view class="form-label-input">
  9. <view class="phone-form-label"><text class="form-label-require">*</text>手机号</view>
  10. <uni-easyinput :disabled="!statusFlag && status=='edit'" type="number" v-model="formData.userName"
  11. placeholder="请输入手机号" maxlength="11" />
  12. </view>
  13. <view class="form-label-input">
  14. <view class="phone-form-label"><text class="form-label-require">*</text>姓名</view>
  15. <uni-easyinput :disabled="!statusFlag && status=='edit'" v-model="formData.realName"
  16. placeholder="请输入姓名" />
  17. </view>
  18. <view class="form-label-input">
  19. <view class="phone-form-label">
  20. <text class="form-label-require">*</text>
  21. <text v-if="formData.idtype ==1">身份证号</text>
  22. <text v-if="formData.idtype ==2">护照号</text>
  23. <icon @click="idCardChange" class="change-icon">切换</icon>
  24. </view>
  25. <uni-easyinput :disabled="!statusFlag && status=='edit'" @blur="idCardBlur" v-model="formData.idcard"
  26. placeholder="请输入身份证号或护照号" maxlength="18" />
  27. </view>
  28. <view class="form-label-select">
  29. <view class="phone-form-label"><text class="form-label-require">*</text>生日</view>
  30. <uni-datetime-picker type="line" v-model="formData.birthday">
  31. <view class="form-radio-select">
  32. <view>{{formData.birthday}}</view>
  33. <icon></icon>
  34. </view>
  35. </uni-datetime-picker>
  36. </view>
  37. <view class="form-label-select">
  38. <view class="phone-form-label"><text class="form-label-require">*</text>籍贯</view>
  39. <picker mode="multiSelector" :range="multiArray" :range-key="'label'" :value="multiIndex"
  40. @columnchange="bindMultiPickerColumnChange" @change="onPickerConfirm" class="select-picker-box">
  41. <view class="form-radio-select">
  42. <view>
  43. {{formData.jiguanShengName === formData.jiguanShiName ? formData.jiguanShengName : `${formData.jiguanShengName} ${formData.jiguanShiName}`}}
  44. </view>
  45. <icon></icon>
  46. </view>
  47. </picker>
  48. </view>
  49. <view class="form-label-input">
  50. <view class="phone-form-label"><text class="form-label-require">*</text>身份证地址</view>
  51. <uni-easyinput v-model="formData.hujiDizhi" placeholder="请输入身份证地址" />
  52. </view>
  53. <view class="form-label-select">
  54. <view class="phone-form-label"><text class="form-label-require">*</text>民族</view>
  55. <picker :range="minzuList" mode='selector' :value="formData.minzuIndex" range-key="name"
  56. @change="minzuChange" @cancel="minzuCancel" class="select-picker-box">
  57. <view class="form-radio-select">
  58. <view>{{ formData.minzu.name }}</view>
  59. <icon></icon>
  60. </view>
  61. </picker>
  62. </view>
  63. <view class="form-label-radio">
  64. <view class="phone-form-label"><text class="form-label-require">*</text>性别</view>
  65. <view class="form-radio-group">
  66. <view class="form-radio-item" :class="{genderActive: formData.gender==1}" @click="genderSelect(1)">
  67. 男</view>
  68. <view class="form-radio-item" :class="{genderActive: formData.gender==2}" @click="genderSelect(2)">
  69. 女</view>
  70. </view>
  71. </view>
  72. <view class="form-label-radio form-top-margin flex-start-row">
  73. <view class="phone-form-label"><text class="form-label-require">*</text>学历</view>
  74. <dataChecked :list="xueliList" :selectedIds='formData.xueli.id' mode="single" :showAdd="false"
  75. @change="selectChangeXueliList" />
  76. </view>
  77. <view class="form-label-radio flex-start-row">
  78. <view class="phone-form-label"><text class="form-label-require"></text>婚姻 </view>
  79. <dataChecked :list="hunyinList" mode="single" :selectedIds='formData.hunyin.id' :showAdd="false"
  80. @change="selectChangeHunyinList" />
  81. </view>
  82. <view class="form-label-input">
  83. <view class="phone-form-label"><text class="form-label-require"></text>通讯地址</view>
  84. <view @click="openMap" class="input-text-row">
  85. <view v-if="formData.jingdu&&formData.weidu">{{formData.juzhuDizhi}}</view>
  86. <view v-if="formData.jingdu ==''&&formData.weidu ==''">{{formData.juzhuDizhi}} <text
  87. v-if="formData.juzhuDizhi" style="color: #3fd2a1;">(无经纬度)</text></view>
  88. <icon></icon>
  89. </view>
  90. </view>
  91. <view class="form-label-select">
  92. <view class="phone-form-label"><text class="form-label-require"></text>星座</view>
  93. <picker :range="xingzuoList" mode='selector' :value="formData.xingzuoIndex" range-key="name"
  94. @change="xingzuoChange" @cancel="xingzuoCancel" class="select-picker-box">
  95. <view class="form-radio-select">
  96. <view>{{ formData.xingzuo.name }}</view>
  97. <icon></icon>
  98. </view>
  99. </picker>
  100. </view>
  101. <view class="form-label-select">
  102. <view class="phone-form-label"><text class="form-label-require"></text>属相</view>
  103. <picker :range="shuxiangList" mode='selector' :value="formData.shuxiangIndex" range-key="name"
  104. @change="shuxiangChange" @cancel="shuxiangCancel" class="select-picker-box">
  105. <view class="form-radio-select">
  106. <view>{{ formData.shuxiang.name }}</view>
  107. <icon></icon>
  108. </view>
  109. </picker>
  110. </view>
  111. <view class="form-label-switch">
  112. <view class="phone-form-label"> <text class="form-label-require"></text>星座属相展示到简历 </view>
  113. <view>展示
  114. <switch @change="switchXingzuoChange" :checked="formData.xingzuoFlag" color="#3fd2a1"
  115. style="transform:scale(0.7)" />
  116. </view>
  117. </view>
  118. <view class="agree-section-box form-top-margin">
  119. <checkbox-group @change="handleAgree">
  120. <label class="checkbox">
  121. <checkbox :checked="formData.agree" color="#3fd2a1" style="transform:scale(0.65)" />
  122. <text>已征得本人同意,将其个人资料信息录入平台</text>
  123. </label>
  124. </checkbox-group>
  125. <button type="default" v-if="status =='add'&&isZijiazheng !='true'" @click="goNext"
  126. class="phone-green-btn">下一步</button>
  127. <button type="default" v-if="status =='edit' &&isZijiazheng !='true'" @click="editSave"
  128. class="phone-green-btn">保存</button>
  129. </view>
  130. <uni-popup ref="popupMap" background-color="#fff" :is-mask-click="false" :mask-click="false">
  131. <customMap style="100vh" @xuanzeAdress="xuanzeAdress" @currentWeizhi="currentWeizhi" @close="mapClose">
  132. </customMap>
  133. </uni-popup>
  134. </view>
  135. </view>
  136. </template>
  137. <script>
  138. import dataChecked from './common/dataChecked.vue';
  139. import jiazhengUpload from "./common/jiazhengUpload.vue"
  140. import customMap from "@/components/customMap/customMap.vue"
  141. import {
  142. toast
  143. } from "@/utils/common";
  144. import {
  145. getJiazhengXueli,
  146. getJiazhengHunyin,
  147. getJiazhengMinzu,
  148. getJiazhengShuxiang,
  149. getJiazhengXingzuo,
  150. getJiazhengJiguan,
  151. jiazhengIdcard,
  152. jiazhengCheck
  153. } from "@/api/jiazheng.js";
  154. export default {
  155. components: {
  156. dataChecked,
  157. jiazhengUpload,
  158. customMap
  159. },
  160. props: {
  161. status: {
  162. type: String,
  163. },
  164. statusFlag: {
  165. type: Boolean,
  166. },
  167. isZijiazheng: {
  168. type: String,
  169. }
  170. },
  171. data() {
  172. return {
  173. formData: {
  174. userName: '',
  175. realName: '',
  176. idcard: '',
  177. icon: '',
  178. birthday: '',
  179. hujiDizhi: '',
  180. idtype: '1',
  181. gender: '',
  182. juzhuDizhi: '',
  183. jingdu: '',
  184. weidu: '',
  185. shenfenzhengUrl: '',
  186. minzu: {},
  187. shuxiang: {
  188. },
  189. xingzuo: {
  190. },
  191. hunyin: {
  192. name: '',
  193. },
  194. xueli: {
  195. },
  196. jiguanObj: {},
  197. jiguanShengId: '',
  198. jiguanShiId: '',
  199. jiguanShiName: '',
  200. jiguanShengName: '',
  201. agree: false,
  202. xingzuoIndex: 0,
  203. minzuIndex: 0,
  204. shuxiangIndex: 0,
  205. xingzuoFlag: false
  206. },
  207. selectedIds: [],
  208. ceshidata: '',
  209. xueliList: [],
  210. hunyinList: [],
  211. shuxiangList: [],
  212. xingzuoList: [],
  213. minzuList: [],
  214. // areaTree: [],
  215. multiArray: [
  216. [],
  217. []
  218. ], // 初始化两列数据
  219. multiIndex: [0, 0], // 初始化选中索引
  220. allData: [], // 存储后端返回的完整数据
  221. }
  222. },
  223. created() {
  224. console.log('statusFlag', this.statusFlag);
  225. uni.showLoading({
  226. title: '加载中'
  227. });
  228. this.initRequests()
  229. },
  230. methods: {
  231. xuanzeAdress(data) {
  232. console.log('data', data);
  233. this.formData.juzhuDizhi = data
  234. this.mapClose()
  235. },
  236. currentWeizhi(data) {
  237. console.log('data', data);
  238. this.formData.jingdu = data.lng
  239. this.formData.weidu = data.lat
  240. this.mapClose()
  241. },
  242. openMap() {
  243. this.$refs.popupMap.open('top')
  244. },
  245. mapClose() {
  246. this.$refs.popupMap.close()
  247. },
  248. idCardBlur() {
  249. let req = {
  250. idcard: this.formData.idcard,
  251. };
  252. jiazhengCheck(req).then(res => {
  253. if (res.code == 0) {
  254. console.log(res);
  255. if (res.data.userId != 0) {
  256. this.$nextTick(() => {
  257. this.formData.userName = res.data.userName
  258. this.formData.realName = res.data.realName
  259. this.formData.idcard = res.data.idcard
  260. this.formData.idtype = res.data.idtype
  261. this.formData.jiguanObj.jiguanShengId = res.data.jiguanShengId
  262. this.formData.jiguanShengName = res.data.jiguanShengName
  263. this.formData.jiguanObj.jiguanShiId = res.data.jiguanShiId
  264. this.formData.jiguanShiName = res.data.jiguanShiName
  265. this.formData.juzhuDizhi = res.data.juzhuDizhi
  266. this.formData.birthday = res.data.birthday
  267. this.formData.minzu = this.dataForId(this.minzuList, res.data.minzu) || ''
  268. this.formData.gender = res.data.gender
  269. this.formData.xueli = this.dataForId(this.xueliList, res.data.xueli) || ''
  270. this.formData.hunyin = this.dataForId(this.hunyinList, res.data.hunyin) ||
  271. ''
  272. this.formData.hujiDizhi = res.data.hujiDizhi
  273. this.formData.juzhuDizhi = res.data.juzhuDizhi
  274. this.formData.xingzuo = this.dataForId(this.xingzuoList, res.data
  275. .xingzuo) || ''
  276. this.formData.shuxiang = this.dataForId(this.shuxiangList, res.data
  277. .xingzuo) || ''
  278. this.formData.xingzuoFlag = res.data.xingzuoFlag
  279. this.$emit('idCardBlur', res.data);
  280. });
  281. } else {
  282. if(this.formData.idcard.length ==18){
  283. const year = this.formData.idcard.substring(6, 10);
  284. const month = this.formData.idcard.substring(10, 12);
  285. const day = this.formData.idcard.substring(12, 14);
  286. this.formData.birthday = `${year}-${month}-${day}`;
  287. // 判断性别
  288. const genderDigit = this.formData.idcard.charAt(16);
  289. this.formData.gender = (parseInt(genderDigit) % 2 === 0) ? 2 : 1;
  290. }
  291. if(this.formData.idtype ==2){
  292. this.formData.birthday = ''
  293. this.formData.gender = ''
  294. }
  295. }
  296. } else {
  297. this.$message.error('');
  298. return false;
  299. }
  300. });
  301. },
  302. async initRequests() {
  303. try {
  304. await Promise.all([
  305. this.getXueli(),
  306. this.getHunyin(),
  307. this.getMinzu(),
  308. this.getXingzuo(),
  309. this.getShuxiang(),
  310. this.getJiguan(),
  311. ]);
  312. uni.hideLoading();
  313. if (this.status == 'edit') {
  314. this.$emit('finishDom', 'gerenZiliao');
  315. }
  316. } catch (e) {
  317. uni.hideLoading();
  318. uni.showToast({
  319. title: `请求失败!`,
  320. icon: 'none',
  321. duration: 2000
  322. })
  323. }
  324. },
  325. editinfo(data) {
  326. this.$nextTick(() => {
  327. this.formData.userName = data.userName
  328. this.formData.realName = data.realName
  329. this.formData.idcard = data.idcard
  330. this.formData.jingdu = data.jingdu
  331. this.formData.weidu = data.weidu
  332. this.formData.idtype = data.idtype
  333. this.formData.jiguanObj.jiguanShengId = data.jiguanShengId
  334. this.formData.jiguanShengName = data.jiguanShengName
  335. this.formData.jiguanObj.jiguanShiId = data.jiguanShiId
  336. this.formData.jiguanShiName = data.jiguanShiName
  337. this.formData.juzhuDizhi = data.juzhuDizhi
  338. this.formData.birthday = data.birthday
  339. this.formData.minzu = this.dataForId(this.minzuList, data.minzu) || ''
  340. this.formData.gender = data.gender
  341. this.formData.xueli = this.dataForId(this.xueliList, data.xueli) || ''
  342. this.formData.hunyin = this.dataForId(this.hunyinList, data.hunyin) || ''
  343. this.formData.hujiDizhi = data.hujiDizhi
  344. this.formData.juzhuDizhi = data.juzhuDizhi
  345. this.formData.xingzuo = this.dataForId(this.xingzuoList, data.xingzuo) || ''
  346. this.formData.shuxiang = this.dataForId(this.shuxiangList, data.xingzuo) || ''
  347. this.formData.xingzuoFlag = data.xingzuoFlag
  348. })
  349. },
  350. dataForId(list, id) {
  351. return list.find(item => item.id == id);
  352. },
  353. idCardChange(data) {
  354. this.formData.idtype = this.formData.idtype == 1 ? 2 : 1;
  355. },
  356. getJiguan() {
  357. getJiazhengJiguan({}).then(res => {
  358. // this.areaTree = res.data
  359. // this.pickerData = this.formatData(res.data);
  360. this.allData = res.data;
  361. const provinces = this.allData.map(province => ({
  362. label: province.lable,
  363. value: province.id,
  364. children: province.children,
  365. }));
  366. const cities = this.allData[0].children.map(city => ({
  367. label: city.lable,
  368. value: city.id,
  369. }));
  370. // 回显已选中的城市(假设已选中的城市 id 是 1301)
  371. //this.setSelectedCity(1301);
  372. this.multiArray = [provinces, cities];
  373. //console.log('this.pickerData', this.pickerData);
  374. }).catch(error => {
  375. console.error('获取技能类型失败:', error);
  376. });
  377. },
  378. bindMultiPickerColumnChange(e) {
  379. const {
  380. column,
  381. value
  382. } = e.detail;
  383. // 更新 multiIndex
  384. this.multiIndex[column] = value;
  385. // 如果是第一列(省份)发生变化,更新第二列(城市)
  386. if (column === 0) {
  387. const selectedProvince = this.multiArray[0][value];
  388. const cities = selectedProvince.children.map(city => ({
  389. label: city.lable,
  390. value: city.id,
  391. }));
  392. // 更新 multiArray 和 multiIndex
  393. this.multiArray[1] = cities;
  394. this.multiIndex[1] = 0; // 重置城市列为第一个选项
  395. }
  396. // 强制更新视图
  397. //this.$forceUpdate();
  398. },
  399. // 确认选择时获取完整数据
  400. onPickerConfirm() {
  401. const [provinceIndex, cityIndex] = this.multiIndex;
  402. const selectedProvince = this.multiArray[0][provinceIndex];
  403. const selectedCity = this.multiArray[1][cityIndex];
  404. console.log("选中的省份完整数据:", selectedProvince);
  405. console.log("选中的城市完整数据:", selectedCity);
  406. this.formData.jiguanShengId = selectedProvince ? selectedProvince.value : ''
  407. this.formData.jiguanShiId = selectedCity ? selectedCity.value : ''
  408. this.formData.jiguanShiName = selectedCity ? selectedCity.label : ''
  409. this.formData.jiguanShengName = selectedProvince ? selectedProvince.label : ''
  410. this.formData.jiguanObj.jiguanShengId = selectedProvince ? selectedProvince.value : ''
  411. this.formData.jiguanObj.jiguanShiId = selectedCity ? selectedCity.value : ''
  412. },
  413. setSelectedCity(cityId) {
  414. for (let i = 0; i < this.allData.length; i++) {
  415. const province = this.allData[i];
  416. for (let j = 0; j < province.children.length; j++) {
  417. const city = province.children[j];
  418. if (city.id === cityId) {
  419. // 设置选中的省份和城市索引
  420. this.multiIndex = [i, j];
  421. // 更新 multiArray 的第二列(城市)
  422. const cities = province.children.map(city => ({
  423. label: city.lable,
  424. value: city.id,
  425. }));
  426. this.multiArray[1] = cities;
  427. // 强制更新视图
  428. this.$forceUpdate();
  429. return;
  430. }
  431. }
  432. }
  433. },
  434. checkAllFields() {
  435. const requiredFields = [{
  436. key: 'userName',
  437. name: '手机号'
  438. },
  439. {
  440. key: 'realName',
  441. name: '姓名'
  442. },
  443. {
  444. key: 'idcard',
  445. name: '身份证号'
  446. },
  447. {
  448. key: 'birthday',
  449. name: '生日'
  450. },
  451. // {
  452. // key: 'hometown',
  453. // name: '家乡',
  454. // type: 'array'
  455. // },
  456. // {
  457. // key: 'hujiDizhi',
  458. // name: '身份证地址'
  459. // },
  460. {
  461. key: 'gender',
  462. name: '性别'
  463. },
  464. // {
  465. // key: 'juzhuDizhi',
  466. // name: '通讯地址'
  467. // },
  468. {
  469. key: 'minzu',
  470. name: '民族',
  471. type: 'object'
  472. },
  473. {
  474. key: 'jiguanObj',
  475. name: '籍贯',
  476. type: 'object'
  477. },
  478. {
  479. key: 'xueli',
  480. name: '学历',
  481. type: 'object'
  482. },
  483. // {
  484. // key: 'shuxiang',
  485. // name: '属相',
  486. // type: 'object'
  487. // },
  488. // {
  489. // key: 'xingzuo',
  490. // name: '星座',
  491. // type: 'object'
  492. // },
  493. ]
  494. for (const field of requiredFields) {
  495. const value = this.formData[field.key]
  496. // 根据不同类型进行存在验证
  497. if (field.type === 'array' && !value?.length) {
  498. this.showAlert(field.name)
  499. return false
  500. }
  501. if (field.type === 'object' && !Object.keys(value).length) {
  502. this.showAlert(field.name)
  503. return false
  504. }
  505. if (field.type === 'boolean' && value !== true) {
  506. this.showAlert(field.name)
  507. return false
  508. }
  509. if (!field.type && !value?.toString().trim()) {
  510. this.showAlert(field.name)
  511. return false
  512. }
  513. }
  514. return true
  515. },
  516. showAlert(fieldName) {
  517. uni.showToast({
  518. title: `${fieldName}不能为空`,
  519. icon: 'none',
  520. duration: 2000
  521. })
  522. },
  523. getXueli() {
  524. getJiazhengXueli({}).then(res => {
  525. this.xueliList = res.data
  526. // console.log('xueliList', this.xueliList);
  527. }).catch(error => {
  528. console.error('获取技能类型失败:', error);
  529. });
  530. },
  531. getXingzuo() {
  532. getJiazhengXingzuo({}).then(res => {
  533. this.xingzuoList = res.data
  534. // console.log('xingzuoList', this.xingzuoList);
  535. }).catch(error => {
  536. console.error('获取技能类型失败:', error);
  537. });
  538. },
  539. getShuxiang() {
  540. getJiazhengShuxiang({}).then(res => {
  541. this.shuxiangList = res.data
  542. // console.log('shuxiangList', this.shuxiangList);
  543. }).catch(error => {
  544. console.error('获取技能类型失败:', error);
  545. });
  546. },
  547. getHunyin() {
  548. getJiazhengHunyin({}).then(res => {
  549. this.hunyinList = res.data
  550. // console.log('hunyinList', this.hunyinList);
  551. }).catch(error => {
  552. console.error('获取技能类型失败:', error);
  553. });
  554. },
  555. getMinzu() {
  556. getJiazhengMinzu({}).then(res => {
  557. this.minzuList = res.data
  558. // console.log('minzuList', this.minzuList);
  559. }).catch(error => {
  560. console.error('获取技能类型失败:', error);
  561. });
  562. },
  563. getFileUrl(data) {
  564. this.formData.shenfenzhengUrl = data
  565. console.log('data', data);
  566. jiazhengIdcard({
  567. url: this.formData.shenfenzhengUrl
  568. }).then(res => {
  569. console.log('res', res);
  570. if (res.code == 0) {
  571. this.formData.realName = res.data.name
  572. this.formData.idtype = '1'
  573. this.formData.gender = res.data.genderId
  574. this.formData.minzu.name = res.data.minzuName
  575. this.formData.minzu.id = res.data.minzuId
  576. this.formData.birthday = res.data.birthDate
  577. this.formData.hujiDizhi = res.data.address
  578. this.formData.idcard = res.data.idNumber
  579. this.formData.shuxiang.id = res.data.shuxiangId
  580. this.formData.shuxiang.name = res.data.shuxiangName
  581. this.formData.xingzuo.id = res.data.xingzuoId
  582. this.formData.xingzuo.name = res.data.xingzuoName
  583. this.formData.jiguanShengId = res.data.jiguanShengId
  584. this.formData.jiguanShiId = res.data.jiguanShiId
  585. this.formData.jiguanShengName = res.data.jiguanShengName
  586. this.formData.jiguanShiName = res.data.jiguanShiName
  587. this.formData.jiguanObj.jiguanShengId = res.data.jiguanShengId
  588. this.formData.jiguanObj.jiguanShiId = res.data.jiguanShiId
  589. }
  590. })
  591. },
  592. minzuChange(e) {
  593. const index = e.detail.value
  594. this.formData.minzu = this.minzuList[index]
  595. //console.log('this.formData.minzu', this.formData.minzu);
  596. },
  597. minzuCancel() {
  598. this.formData.minzuIndex = 0
  599. },
  600. xingzuoChange(e) {
  601. const index = e.detail.value
  602. this.formData.xingzuo = this.xingzuoList[index]
  603. // console.log('this.formData.xingzuo', this.formData.xingzuo);
  604. },
  605. xingzuoCancel() {
  606. this.formData.xingzuoIndex = 0
  607. },
  608. shuxiangChange(e) {
  609. const index = e.detail.value
  610. this.formData.shuxiang = this.shuxiangList[index]
  611. //console.log('this.formData.shuxiang', this.formData.shuxiang);
  612. },
  613. shuxiangCancel() {
  614. this.formData.shuxiangIndex = 0
  615. },
  616. selectChangeXueliList(data) {
  617. if (data.length > 0) {
  618. this.formData.xueli = data[0]
  619. } else {
  620. this.formData.xueli = {}
  621. }
  622. },
  623. genderSelect(data) {
  624. if (!this.statusFlag && this.status == 'edit ') {
  625. toast("非未办证状态,禁止修改")
  626. return false
  627. }
  628. this.formData.gender = data
  629. },
  630. selectChangeHunyinList(data) {
  631. console.log('data', data[0]);
  632. if (data.length > 0) {
  633. this.formData.hunyin = data[0]
  634. } else {
  635. this.formData.hunyin = {}
  636. }
  637. },
  638. switchXingzuoChange(e) {
  639. this.formData.xingzuoFlag = e.detail.value
  640. },
  641. goNext() {
  642. console.log('formData', this.formData);
  643. if (!this.checkAllFields()) {
  644. return false
  645. }
  646. if (this.formData.gender == 0) {
  647. uni.showToast({
  648. title: "请选择性别",
  649. icon: 'none',
  650. duration: 2000
  651. })
  652. return false
  653. }
  654. if (!this.formData.agree) {
  655. uni.showToast({
  656. title: "请勾选本人同意!",
  657. icon: 'none',
  658. duration: 2000
  659. })
  660. return false
  661. }
  662. this.$emit('goNext', this.formData, 0);
  663. },
  664. editSave() {
  665. console.log('formData', this.formData);
  666. if (!this.checkAllFields()) {
  667. return false
  668. }
  669. if (!this.formData.agree) {
  670. uni.showToast({
  671. title: "请勾选本人同意!",
  672. icon: 'none',
  673. duration: 2000
  674. })
  675. return false
  676. }
  677. this.$emit('editSave', this.formData);
  678. },
  679. handleAgree(e) {
  680. this.formData.agree = e.detail.value.length > 0
  681. },
  682. }
  683. }
  684. </script>