123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530 |
- <template>
- <view class="admin-jiazheng-page">
- <view class="icon-title-navBar-box">
- <view @click="goUpPage" class="nav-bar-icon"></view>
- <text class="nav-bar-title">家政人员</text>
- </view>
- <v-tabs v-model="current" :tabs="tabs" :scroll="false" @change="changeTab" field="name"
- class="admin-tab-box"></v-tabs>
- <gerenZiliao ref="gerenZiliao" :status='status' @idCardBlur="idCardBlur" @finishDom='finishDom'
- @editSave="editSaveGerenziliao" @goNext="gerenziliaoNext" v-show="current ==0"></gerenZiliao>
- <qiuzhiXinxi ref="qiuzhiXinxi" :status='status' @editSave="editSaveQiuzhixinxi" @goNext="goNextQiuzhixinxi"
- v-show="current ==1">
- </qiuzhiXinxi>
- <zhaopianZiliao ref="zhaopianZiliao" :status='status' @editSave="editSaveZhaopianziliao"
- @goNext="goNextZhaopianZiliao" v-show="current ==2"></zhaopianZiliao>
- <banzhengXinxi ref="banzhengXinxi" :status='status' @goBack="goBack" @addSave="addSave" @editSave="editSave"
- v-show="current ==3">
- </banzhengXinxi>
- <banzhengXinxiList :list="editInfo.kaozhengList" v-show="banzhengXinxiFlag" @editBanzheng="editBanzheng"
- @addBanzheng="addBanzheng" @deleteBanzheng="deleteBanzheng" ref="banzhengXinxiList"></banzhengXinxiList>
- <common-dialog ref="commonDialogRef" :title="deleteTitle" :content="deleteConcent"
- @confirm-btn="deleteQuerenBtn"></common-dialog>
- </view>
- </template>
- <script>
- import {
- ref
- } from "vue";
- import banzhengXinxi from './banzhengXinxi.vue';
- import banzhengXinxiList from './banzhengXinxiList.vue';
- import qiuzhiXinxi from './qiuzhiXinxi.vue';
- import zhaopianZiliao from './zhaopianZiliao.vue';
- import commonDialog from '@/components/dialog/commonDialog.vue';
- import gerenZiliao from './gerenZiliao.vue';
- import {
- getJiazhengInfo,
- jiazhengAdd,
- jiazhengUpdate,
- jiazhengKaozhengAdd,
- jiazhengKaozhengDelete,
- jiazhengKaozhengUpdate
- } from "@/api/jiazheng.js";
- export default {
- data() {
- return {
- current: 0,
- // tabs: ['个人资料', '求职信息', '照片资料', '办证信息']
- tabs: [],
- allData: {
- "birthday": "",
- "gender": '',
- "hujiDizhi": "",
- "hunyin": '',
- "icon": "",
- "idcard": "",
- "idcardUrl1": "",
- "idcardUrl2": "",
- "idtype": '',
- "jiankangDate": "",
- "jibiexinzi": "",
- "jiguanShengId": '',
- "jiguanShiId": '',
- "jineng": "",
- "jingli": "",
- "jingyan": "",
- "juzhuDizhi": "",
- "kaozhengList": [],
- "leixing": "",
- "minzu": '',
- "qiwangxinzi": "",
- "realName": "",
- "shenghuoUrls": "",
- "shuxiang": '',
- "tijianDate": "",
- "tijianUrls": "",
- "userId": '',
- "userName": "",
- "xingzuo": '',
- "xingzuoFlag": false,
- "xueli": '',
- "zhengshuUrls": "",
- "zhuangtai": '',
- "jingdu": '',
- "weidu": ''
-
- },
- status: '',
- id: '',
- userId: '',
- banzhengXinxiFlag: false,
- editInfo: {},
- deleteConcent: '你确定要执行这个操作吗?',
- deleteTitle: '删除',
- deleteIndex: '',
- deleteId: '',
- }
- },
- components: {
- banzhengXinxi,
- banzhengXinxiList,
- qiuzhiXinxi,
- gerenZiliao,
- commonDialog,
- zhaopianZiliao
- },
- watch: {
- // 监听外部传入的selectedIds变化,更新selectedData
- current: {
- handler(newVal) {
- console.log('newValnewValnewVal',this.current);
- if(newVal==1 && this.status =='add'){
- console.log('this.$refs.qiuzhiXinxi',this.$refs.qiuzhiXinxi);
- this.$refs.qiuzhiXinxi.zhuangtai = 1
- }
-
- }
- },
-
- },
- onLoad(options) {
- let pageInfo = JSON.parse(options.pageInfo)
- this.status = pageInfo.status
- this.dataHandle(pageInfo)
- },
- methods: {
- goBack() {
- this.banzhengXinxiFlag = true
- },
- editBanzheng(data, index) {
- console.log('dataasdf',data);
- this.current = 3
- this.banzhengXinxiFlag = false
- this.$refs.banzhengXinxi.editinfo(data, index)
- this.$refs.banzhengXinxi.currentMove('edit')
- },
- addBanzheng(data, index) {
- this.banzhengXinxiFlag = false
- this.current = 3
- this.$refs.banzhengXinxi.resetFun()
- this.$refs.banzhengXinxi.currentMove('editAdd')
- },
- deleteBanzheng(data, index) {
- console.log('data', data);
- console.log('index', index);
- console.log('data.statusBanzheng', data.statusBanzheng);
- this.deleteId = data.id
- this.deleteIndex = index
- if (data.statusBanzheng == '办证完成') {
- uni.showToast({
- title: "办证状态为办证完成禁止删除",
- icon: 'none',
- duration: 2000
- })
- return false
- }
- this.$refs.commonDialogRef.handleShow()
- },
- deleteQuerenBtn() {
- jiazhengKaozhengDelete({
- ids: [this.deleteId]
- }).then(res => {
- if (res.code == 0) {
- uni.showToast({
- title: "成功",
- icon: 'none',
- duration: 2000
- })
- this.editInfo.kaozhengList.splice(this.deleteIndex, 1);
- if (this.editInfo.kaozhengList.length == 0) {
- this.banzhengXinxiFlag = true
- }
- }
- })
- },
- idCardBlur(data) {
- this.$refs.qiuzhiXinxi.editinfo(data)
- this.$refs.zhaopianZiliao.editinfo(data)
- },
- dataHandle(pageInfo) {
- if (this.status == 'add') {
- this.tabs = [{
- id: 1,
- name: '个人资料',
- disabled: false
- },
- {
- id: 2,
- name: '求职信息',
- disabled: true
- },
- {
- id: 3,
- name: '照片资料',
- disabled: true
- },
- {
- id: 4,
- name: '办证信息',
- disabled: true
- },
- ]
- } else {
- this.id = pageInfo.id
- this.userId = pageInfo.userId
- this.tabs = [{
- id: 1,
- name: '个人资料',
- disabled: false
- },
- {
- id: 2,
- name: '求职信息',
- disabled: false
- },
- {
- id: 3,
- name: '照片资料',
- disabled: false
- },
- {
- id: 4,
- name: '办证信息',
- disabled: false
- },
- ]
- }
- },
- finishDom() {
- let req = {
- id: this.id,
- userId: this.userId
- }
- getJiazhengInfo(req).then(res => {
- if (res.code == 0) {
- this.$refs.gerenZiliao.editinfo(res.data)
- this.editInfo = JSON.parse(JSON.stringify(res.data));
- this.allData = JSON.parse(JSON.stringify(res.data));
- this.allData.id = this.id
- console.log('this.allData this.allData ', this.allData);
- } else {
- uni.showToast({
- icon: 'none',
- title: '获取详情失败'
- })
- return false
- }
- })
- },
- changeTab(data) {
- console.log('data', data);
- if (this.status == 'edit' &&data ==3) {
- this.banzhengXinxiFlag = true
- return false
- } else {
- this.banzhengXinxiFlag = false
- }
- if (this.status == 'add') {
- if (this.current >= 0) {
- this.current--;
- this.updateTabs();
- }
- }
- this.current = data
- if (this.status != 'edit') {
- return false
- }
- switch (Number(data)) {
- case 0:
- this.$refs.gerenZiliao.editinfo(this.editInfo)
- break;
- case 1:
- this.$refs.qiuzhiXinxi.editinfo(this.editInfo)
- break;
- case 2:
- this.$refs.zhaopianZiliao.editinfo(this.editInfo)
- break;
- case 3:
- this.$refs.banzhengXinxi.editinfo()
- break;
- default:
- break;
- }
- },
- gerenZiliaoDataHandle(data, flag) {
- console.log('gerenZiliaoDataHandle', data);
- console.log('gerenZiliaoDataHandle', data.hunyin.id);
- this.allData.userName = data.userName
- this.allData.realName = data.realName
- this.allData.idcard = data.idcard
- this.allData.idtype = data.idtype
- this.allData.jiguanShengId = data.jiguanObj.jiguanShengId
- this.allData.jiguanShiId = data.jiguanObj.jiguanShiId
- this.allData.juzhuDizhi = data.juzhuDizhi
- this.allData.birthday = data.birthday
- this.allData.minzu = data.minzu.id
- this.allData.gender = data.gender
- this.allData.xueli = data.xueli.id
- this.allData.hunyin = data.hunyin.id
- this.allData.hujiDizhi = data.hujiDizhi
- this.allData.xingzuo = data.xingzuo.id
- this.allData.shuxiang = data.shuxiang.id
- this.allData.xingzuoFlag = data.xingzuoFlag
- this.allData.jingdu = data.jingdu
- this.allData.weidu = data.weidu
- if (flag == 'edit') {
- jiazhengUpdate(this.allData).then(res => {
- uni.showToast({
- title: "保存成功!",
- icon: 'none',
- duration: 2000
- })
- })
- }
- },
- gerenziliaoNext(data, num) {
- this.gerenZiliaoDataHandle(data)
- // this.current = num + 1
- // this.tabs = this.tabs.map((item, i) => {
- // if (i == this.current) item.disabled = false
- // return item
- // })
- if (this.current < this.tabs.length - 1) {
- this.current++;
- this.updateTabs();
- }
- },
- editSaveGerenziliao(data) {
- this.gerenZiliaoDataHandle(data, 'edit')
- },
- qiuzhiXinxiDataHandle(data, flag) {
- this.allData.leixing = data.leixing
- this.allData.jingyan = data.jingyan
- this.allData.jineng = data.jineng
- this.allData.zhuangtai = data.zhuangtai
- this.allData.jibiexinzi = data.jibiexinzi
- this.allData.qiwangxinzi = data.qiwangxinzi
- this.allData.jingli = data.jingli
- if (flag == 'edit') {
- jiazhengUpdate(this.allData).then(res => {
- uni.showToast({
- title: "保存成功!",
- icon: 'none',
- duration: 2000
- })
- })
- }
- },
- goNextQiuzhixinxi(data, num) {
- this.qiuzhiXinxiDataHandle(data)
- if (this.current < this.tabs.length - 1) {
- this.current++;
- this.updateTabs();
- }
- // this.current = num + 1
- // this.tabs = this.tabs.map((item, i) => {
- // if (i == this.current) item.disabled = false
- // return item
- // })
- },
- updateTabs() {
- console.log('this.tabsthis.tabs', this.tabs);
- console.log('this.current', this.tabs);
- this.tabs = this.tabs.map((item, i) => {
- // 当前页签及之前的页签 disabled 为 false,之后的页签 disabled 为 true
- item.disabled = i >= this.current;
- return item;
- });
- },
- editSaveQiuzhixinxi(data) {
- this.qiuzhiXinxiDataHandle(data, 'edit')
- },
- goNextZhaopianZiliao(data, num) {
- this.zhaopianziliaoDataHandle(data)
- // this.current = num + 1
- // this.tabs = this.tabs.map((item, i) => {
- // if (i == this.current) item.disabled = false
- // return item
- // })
- if (this.current < this.tabs.length - 1) {
- this.current++;
- this.updateTabs();
- }
- },
- zhaopianziliaoDataHandle(data, flag) {
- this.allData.icon = data.icon
- this.allData.idcardUrl1 = data.idcardUrl1
- this.allData.idcardUrl2 = data.idcardUrl2
- this.allData.shenghuoUrls = data.shenghuoUrls
- this.allData.zhengshuUrls = data.zhengshuUrls
- this.allData.tijianDate = data.tijianDate
- this.allData.jiankangDate = data.jiankangDate
- this.allData.tijianUrls = data.tijianUrls
- if (flag == 'edit') {
- jiazhengUpdate(this.allData).then(res => {
- uni.showToast({
- title: "保存成功!",
- icon: 'none',
- duration: 2000
- })
- })
- }
- },
- editSaveZhaopianziliao(data) {
- this.zhaopianziliaoDataHandle(data, 'edit')
- },
- addSave(data) {
- if (this.status == 'add') {
- this.submitJiazheng(data)
- } else {}
- },
- submitJiazheng(data) {
- console.log('this.allData', this.allData);
- if (this.allData.kaozhengList.length > 0 && this.allData.icon == '') {
- uni.showToast({
- title: "当录入办证信息时候,头像必填",
- icon: 'none',
- duration: 2000
- })
- return false
- }
- if (data != '') {
- this.allData.kaozhengList.push(data)
- }
- jiazhengAdd(this.allData).then(res => {
- if (res.code == 0) {
- uni.showToast({
- title: "成功",
- icon: 'none',
- duration: 2000
- })
- uni.navigateTo({
- url: `/pages/admin/Jiazheng/index`
- })
- } else {
- uni.showToast({
- title: "失败",
- icon: 'none',
- duration: 2000
- })
- return false
- }
- })
- },
- editSave(data, flag,index) {
- debugger
- console.log('this.allData', this.allData);
- console.log('this.editInfo', this.editInfo);
- if (flag == 'edit') {
- jiazhengKaozhengUpdate(data).then(res => {
- if(res.code ==0){
- uni.showToast({
- title: "保存成功!",
- icon: 'none',
- duration: 2000
- })
- this.banzhengXinxiFlag = true
- this.editInfo.kaozhengList[index].canxunshijian = data.canxunshijian
- this.editInfo.kaozhengList[index].jgId = data.jgId
- this.editInfo.kaozhengList[index].jgName = data.jgName
- this.editInfo.kaozhengList[index].jzId = data.jzId
- this.editInfo.kaozhengList[index].needKaoshi = data.needKaoshi
- this.editInfo.kaozhengList[index].needKecheng = data.needKecheng
- this.editInfo.kaozhengList[index].needKecheng = data.needKecheng
- this.editInfo.kaozhengList[index].shicaochengji = data.shicaochengji
- this.editInfo.kaozhengList[index].statusBanzheng = data.statusBanzheng
- this.editInfo.kaozhengList[index].statusKaoshi = data.statusKaoshi
- this.editInfo.kaozhengList[index].zongkeshi = data.zongkeshi
- this.editInfo.kaozhengList[index].id = data.id
- this.editInfo.kaozhengList[index].zyId = data.zyId
- this.editInfo.kaozhengList[index].zyLevel = data.zyLevel
- this.editInfo.kaozhengList[index].zyLevelName = data.zyLevelName
- this.editInfo.kaozhengList[index].zyName = data.zyName
- }
-
- })
- } else if (flag == 'editAdd') {
- data.userId = this.userId
- if (this.allData.icon == '') {
- uni.showToast({
- title: "当录入办证信息时候,头像必填",
- icon: 'none',
- duration: 2000
- })
- return false
- }
- jiazhengKaozhengAdd(data).then(res => {
- if (res.code == 0) {
- data.id = res.data
- this.allData.kaozhengList.push(data)
- this.editInfo.kaozhengList.push(data)
- console.log('this.editInfo.kaozhengList', this.editInfo.kaozhengList);
- this.banzhengXinxiFlag = true
- }
- })
- }
- // if (data != '') {
- // this.allData.kaozhengList.push(data)
- // }
- // if(this.status =='add'){
- // this.submitJiazheng()
- // }else{
- // }
- },
- goUpPage() {
- uni.navigateTo({
- url: `/pages/admin/Jiazheng/index`
- })
- }
- }
- }
- </script>
|