diff --git a/pages/visit/addrecord.vue b/pages/visit/addrecord.vue index 43c5dc0..3fb4319 100644 --- a/pages/visit/addrecord.vue +++ b/pages/visit/addrecord.vue @@ -2,36 +2,44 @@ - + {{configInfo.name}} - + + + + + + + 确认 + + - - - - - - 前往区域 - - - - - - - - - - 数据加载中... - - - - - + + + + + + + 前往区域 + + + + + + + + + + 数据加载中... + + + + + @@ -80,31 +88,30 @@ - - - + + + - - - - - - - - - - - - 删除 - - + + + + + + + + + + + + 删除 + + @@ -116,8 +123,7 @@ style="margin-bottom:20rpx"> - 删除 + 删除 @@ -169,25 +175,25 @@ - - 被访人信息 - - - - 陪同人信息 - - - + + 被访人信息 + + + + 陪同人信息 + + + 收货人信息 - - + @@ -209,9 +215,9 @@ - - - + + + @@ -243,8 +249,8 @@ title: '完成' }], stepActive: 0, - configshow: false, - areaShow:false, + configshow: false, + areaShow: false, configInfo: {}, configKey: "ptfk", toadyStart: '', @@ -254,8 +260,8 @@ adminKeyword: '', acceptType: "", acceptName: "", - goodsName: '', - visitAreaText:'', + goodsName: '', + visitAreaText: '', form: { type: 1, date: "", @@ -267,21 +273,21 @@ name: "", mobile: "", credent: 1, - idcard: "", - passcard:"", + idcard: "", + passcard: "", company_name: "", cars: [], follw_people: [], long_time: 0, start_date: "", - end_date: "", - accompany_id:'', + end_date: "", + accompany_id: '', accpet_department_id: "", accept_admin_id: "", accept_goods_admin_id: "", acceptName: "", - goodsName: '', - accompanyName:'' + goodsName: '', + accompanyName: '' }, follw_people_obj: { name: "", @@ -344,45 +350,45 @@ pattern: '^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]', errorMessage: '身份证格式错误' }] - }, - passcard:{ - rules: [{ - required: true, - errorMessage: '护照号码不能为空' - }, { - pattern: '/^([a-zA-z]|[0-9]){5,17}$/', - errorMessage: '护照格式错误' - }] + }, + passcard: { + rules: [{ + required: true, + errorMessage: '护照号码不能为空' + }, { + pattern: '/^([a-zA-z]|[0-9]){5,17}$/', + errorMessage: '护照格式错误' + }] }, company_name: { rules: [{ required: true, errorMessage: '单位名称不能为空' }] - }, - cda: { - rules: [{ - required: true, - errorMessage: 'CDA编号不能为空' - }] - }, - cars:{ - rules: [{ - required: true, - errorMessage: '车牌号不能为空' - }] + }, + cda: { + rules: [{ + required: true, + errorMessage: 'CDA编号不能为空' + }] + }, + cars: { + rules: [{ + required: true, + errorMessage: '车牌号不能为空' + }] }, acceptName: { rules: [{ required: true, errorMessage: '请选择被访人' }] - }, - accompanyName: { - rules: [{ - required: true, - errorMessage: '请选择陪同人' - }] + }, + accompanyName: { + rules: [{ + required: true, + errorMessage: '请选择陪同人' + }] }, goodsName: { rules: [{ @@ -421,15 +427,15 @@ pattern: '^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]', errorMessage: '身份证格式错误' }] - }, - passcard:{ - rules: [{ - required: true, - errorMessage: '护照号码不能为空' - }, { - pattern: '/^([a-zA-z]|[0-9]){5,17}$/', - errorMessage: '护照格式错误' - }] + }, + passcard: { + rules: [{ + required: true, + errorMessage: '护照号码不能为空' + }, { + pattern: '/^([a-zA-z]|[0-9]){5,17}$/', + errorMessage: '护照格式错误' + }] } }, // 单选数据源 @@ -455,40 +461,40 @@ }], adminList: [], isCall: '', // 是否待邀约 - goStudy: '提交', - isStudy:false + goStudy: '提交', + isStudy: false } }, - onLoad(options) { - // uni.navigateTo({ - // url:'/pages/visit/testStudy?type=3' - // }) + onLoad(options) { + // uni.navigateTo({ + // url:'/pages/visit/testStudy?type=3' + // }) // return this.toadyStart = new Date() - this.form.type = options.type - this.areaShow = options.type == 1?true:false + this.form.type = options.type + this.areaShow = options.type == 1 ? true : false this.configKey = options.type == 1 ? 'ptfk' : (options.type == 2 ? 'sgfk' : 'wlcl') this.isCall = options.iscall ? options.iscall : '' // this.goStudy = this.isCall == 'call' ? '提交' : '' - this.form.audit_status = this.isCall == 'call' ? 1 : 0 - this.showStudy() - if(options.type==2||options.type==3){ - this.getConfig() + this.form.audit_status = this.isCall == 'call' ? 1 : 0 + this.showStudy() + if (options.type == 2 || options.type == 3) { + this.getConfig() } - this.init() - if(uni.getStorageSync('formdata')){ - this.form = uni.getStorageSync('formdata') + this.init() + if (uni.getStorageSync('formdata')) { + this.form = uni.getStorageSync('formdata') } // this.getAdminList() }, onReady() {}, methods: { - init(){ - this.getVisitArea() - this.getVisitTime() - this.getReason() - this.getPark() + init() { + this.getVisitArea() + this.getVisitTime() + this.getReason() + this.getPark() }, adminListShowOpen(type) { this.acceptType = type @@ -511,38 +517,38 @@ if (type == 'accept') { this.form.accept_admin_id = '' this.form.acceptName = '' - } else if(type=='goods') { + } else if (type == 'goods') { this.form.accept_goods_admin_id = '' this.form.goodsName = '' - }else{ - this.form.accompany_id='' - this.form.accompanyName='' + } else { + this.form.accompany_id = '' + this.form.accompanyName = '' } }, - submitAccept(e) { + submitAccept(e) { console.log(e) if (this.acceptType == 'accept') { - this.form.accept_admin_id = e.id + this.form.accept_admin_id = e.id this.form.accpet_department_id = e.department_id - this.form.acceptName = e.name - if(this.visitAreaText=='非生产区'){ - this.form.accompany_id = e.id - this.form.accompanyName = e.name + this.form.acceptName = e.name + if (this.visitAreaText == '非生产区') { + this.form.accompany_id = e.id + this.form.accompanyName = e.name } - } else if(this.acceptType == 'goods'){ - this.form.accept_goods_admin_id = e.id - this.form.accept_admin_id = e.id + } else if (this.acceptType == 'goods') { + this.form.accept_goods_admin_id = e.id + this.form.accept_admin_id = e.id this.form.accpet_department_id = e.department_id - this.form.goodsName = e.name - if(this.visitAreaText=='非生产区'){ - this.form.accompany_id = e.id - this.form.accompanyName = e.name + this.form.goodsName = e.name + if (this.visitAreaText == '非生产区') { + this.form.accompany_id = e.id + this.form.accompanyName = e.name } - }else{ - this.form.accompany_id = e.id - this.form.accompanyName = e.name - } - + } else { + this.form.accompany_id = e.id + this.form.accompanyName = e.name + } + this.adminListShow = false }, setCars(e) { @@ -553,21 +559,25 @@ closeConfig() { this.configshow = false - }, - closeArea(){ - if(!this.form.visit_area_id){ - this.util.alert("请先选择前往区域") - return - } - if(this.visitAreaText=="生产区"){ - this.configKey = 'cjfk' - this.getConfig() - this.areaShow = false - }else{ - this.configKey = 'ptfk' - this.getConfig() - this.areaShow = false - } + }, + closeArea() { + if (!this.form.visit_area_id) { + this.util.alert("请先选择前往区域") + return + } + if (this.visitAreaText == "生产区") { + this.configKey = 'cjfk' + this.getConfig() + this.areaShow = false + } else if (this.visitAreaText == "研发R&D") { + this.configKey = 'yffk' + this.getConfig() + this.areaShow = false + } else { + this.configKey = 'ptfk' + this.getConfig() + this.areaShow = false + } }, async getConfig() { let that = this @@ -586,23 +596,26 @@ if (k.key == that.configKey) { that.configInfo = k } - } + } that.configshow = true }, utilFail: function(res) {} }) }, - // 获取单选数据 - - - getVisitArea() { - let that = this - that.visitArea = [{ - name:'非生产区', - id:3 - },{ - name:'生产区', - id:4 + // 获取单选数据 + + + getVisitArea() { + let that = this + that.visitArea = [{ + name: '非生产区', + id: 3 + }, { + name: '生产区', + id: 4 + }, { + name: "研发R&D", + id: 5 }] // this.util.request({ // api: '/api/mobile/visit/visit-area', @@ -613,10 +626,10 @@ // }, // utilFail: function(res) {} // }) - }, - changeVisitArea(e){ - console.log(e) - this.visitAreaText = e.detail.data.name + }, + changeVisitArea(e) { + console.log(e) + this.visitAreaText = e.detail.data.name }, getVisitTime() { let that = this @@ -703,9 +716,9 @@ this.$refs.showRight.close() }, pushFollowPeople() { - console.log('this.follw_people_obj', this.follw_people_obj) - if(this.follw_people_obj.credent==2){ - this.follw_people_obj.idcard = this.follw_people_obj.passcard + console.log('this.follw_people_obj', this.follw_people_obj) + if (this.follw_people_obj.credent == 2) { + this.follw_people_obj.idcard = this.follw_people_obj.passcard } this.$refs['peopleform'].validate().then(res => { if (this.follow_people_index > -1) { @@ -722,110 +735,110 @@ }, - // 去学习 - // 获取访客学习状态 - async showStudy() { - this.util.alert("请确保每位访客都已通过学习培训,方可提交拜访") - // let that = this - // let id_arr = [] - // id_arr.push(this.form.idcard) - // for(var k of this.form.follw_people){ - // id_arr.push(k.idcard) - // } - // this.util.request({ - // api: '/api/mobile/visit/ask-log', - // method: "post", - // data:{ - // type:that.form.type - // }, - // utilSuccess: function(res) { - // console.log("res",res) - // if(res.msg=='学习有效中'){ - // uni.showToast({ - // title: '请确保随访人员都已通过学习培训方可提交拜访', - // duration: 2000, - // icon: 'none' - // }) - // that.isStudy = true - // that.goStudy = '提交' - - // } - // }, - // utilFail: function(res) { - // // console.log(res) - // // uni.showToast({ - // // title: res, - // // duration: 2000, - // // icon: 'none' - // // }) - // } - // }) - }, - // 获取随访人员的 学习记录 - async getStudy() { - let that = this - let id_arr = [] - id_arr.push(this.form.idcard) - for(var k of this.form.follw_people){ - id_arr.push(k.idcard) - } - this.$refs['formdata'].validate().then(res => { - this.util.request({ - api: '/api/mobile/visit/idcard-check', - method: "post", - data:{ - idcard:id_arr - }, - utilSuccess: function(res) { - if(res.length>0){ - let str = res.join(",")+'未完成学习培训' - that.util.alert(str) - uni.setStorageSync('formdata', that.form) - }else{ - // 邀约 - if (that.isCall === 'call') { - that.submitForm() - }else{ - // 访客 - that.submitNoStudy() - } - } - }, - utilFail: function(res) { - // console.log(res) - uni.showToast({ - title: res, - duration: 2000, - icon: 'none' - }) - } - }) - - }).catch(err => { - console.log('err', err); - }) - + // 去学习 + // 获取访客学习状态 + async showStudy() { + this.util.alert("请确保每位访客都已通过学习培训,方可提交拜访") + // let that = this + // let id_arr = [] + // id_arr.push(this.form.idcard) + // for(var k of this.form.follw_people){ + // id_arr.push(k.idcard) + // } + // this.util.request({ + // api: '/api/mobile/visit/ask-log', + // method: "post", + // data:{ + // type:that.form.type + // }, + // utilSuccess: function(res) { + // console.log("res",res) + // if(res.msg=='学习有效中'){ + // uni.showToast({ + // title: '请确保随访人员都已通过学习培训方可提交拜访', + // duration: 2000, + // icon: 'none' + // }) + // that.isStudy = true + // that.goStudy = '提交' + + // } + // }, + // utilFail: function(res) { + // // console.log(res) + // // uni.showToast({ + // // title: res, + // // duration: 2000, + // // icon: 'none' + // // }) + // } + // }) + }, + // 获取随访人员的 学习记录 + async getStudy() { + let that = this + let id_arr = [] + id_arr.push(this.form.idcard) + for (var k of this.form.follw_people) { + id_arr.push(k.idcard) + } + this.$refs['formdata'].validate().then(res => { + this.util.request({ + api: '/api/mobile/visit/idcard-check', + method: "post", + data: { + idcard: id_arr + }, + utilSuccess: function(res) { + if (res.length > 0) { + let str = res.join(",") + '未完成学习培训' + that.util.alert(str) + uni.setStorageSync('formdata', that.form) + } else { + // 邀约 + if (that.isCall === 'call') { + that.submitForm() + } else { + // 访客 + that.submitNoStudy() + } + } + }, + utilFail: function(res) { + // console.log(res) + uni.showToast({ + title: res, + duration: 2000, + icon: 'none' + }) + } + }) + + }).catch(err => { + console.log('err', err); + }) + }, saveFormgoStudy() { - if(this.form.credent==2){ - this.form.idcard = this.form.passcard + if (this.form.credent == 2) { + this.form.idcard = this.form.passcard } - this.$refs['formdata'].validate().then(res => { - console.log("form", this.form) + this.$refs['formdata'].validate().then(res => { + console.log("form", this.form) // return if (this.isCall === 'call') { this.submitForm() return - } - if(this.isStudy){ - this.submitNoStudy() - }else{ - uni.setStorageSync('formdata', this.form) - uni.redirectTo({ - url: '/pages/visit/study?type=' + this.form.type - }) } - + if (this.isStudy) { + this.submitNoStudy() + } else { + uni.setStorageSync('formdata', this.form) + uni.redirectTo({ + url: '/pages/visit/study?type=' + this.form.type + }) + } + }).catch(err => { console.log('err', err); }) @@ -856,57 +869,59 @@ }) } }) - }, - submitNoStudy(){ - let that = this - this.util.request({ - api: '/api/mobile/visit/visit-save', - method: "POST", - data: that.form, - utilSuccess: function(res) { - uni.showToast({ - title: res.msg, - duration: 2000, - icon: 'none' - }) - uni.removeStorageSync('formdata') - that.newsSubscription() - }, - utilFail: function(res) { - console.log(res) - uni.showToast({ - title: res, - duration: 2000, - icon: 'none' - }) - } - }) - }, - newsSubscription() { - uni.getSetting({ - withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回 - success(res) { - if (res.authSetting['scope.subscribeMessage']) { - uni.redirectTo({ - url: '/pages/visit/successform' - }) - } else { - // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息 - uni.requestSubscribeMessage({ - tmplIds: ['DmzNRREPFdZrMWconNDdbj_ebtVPRWufq27kRQ25eNg','IczaKkCmwf55tAAzCcxb_fbbf5L25SWrSKvaBrkIyk4'], - success(res) { - console.log("res", res) - uni.showToast({ - title:'订阅成功' - }) - uni.redirectTo({ - url: '/pages/visit/successform' - }) - } - }) - } - } - }); + }, + submitNoStudy() { + let that = this + this.util.request({ + api: '/api/mobile/visit/visit-save', + method: "POST", + data: that.form, + utilSuccess: function(res) { + uni.showToast({ + title: res.msg, + duration: 2000, + icon: 'none' + }) + uni.removeStorageSync('formdata') + that.newsSubscription() + }, + utilFail: function(res) { + console.log(res) + uni.showToast({ + title: res, + duration: 2000, + icon: 'none' + }) + } + }) + }, + newsSubscription() { + uni.getSetting({ + withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回 + success(res) { + if (res.authSetting['scope.subscribeMessage']) { + uni.redirectTo({ + url: '/pages/visit/successform' + }) + } else { + // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息 + uni.requestSubscribeMessage({ + tmplIds: ['DmzNRREPFdZrMWconNDdbj_ebtVPRWufq27kRQ25eNg', + 'IczaKkCmwf55tAAzCcxb_fbbf5L25SWrSKvaBrkIyk4' + ], + success(res) { + console.log("res", res) + uni.showToast({ + title: '订阅成功' + }) + uni.redirectTo({ + url: '/pages/visit/successform' + }) + } + }) + } + } + }); }, } } @@ -935,43 +950,60 @@ /deep/ .uni-drawer__content { padding: 40rpx } + .configtitle { font-size: 40rpx; - text-align: center; - margin-top:36rpx + text-align: center; + margin-top: 36rpx; + padding-bottom: 20rpx; } + .configvalue { padding: 40rpx; font-size: 36rpx; height: 600rpx; overflow-y: auto; - } - .configload{ - display: flex; - justify-content: center; - align-items: center; - font-size: 50rpx; - color: #ddd; - } - .configload text{ - margin-right:20rpx - } - /deep/ .u-popup__content__close .u-icon__icon{ - color:#fff!important - } - .areavalue{ - - } - .areabtn{ - background-color: #044ed7; - /* margin-left: 8px; */ - width: 100%; - position: fixed; - bottom: 0; - left: 0; - border-radius: 0; - } - /deep/ .areavalue .uni-data-checklist .checklist-group .checklist-box.is--button { - padding:30rpx + } + + .configbtn { + background: #044ed7; + padding: 20rpx; + /* display: inline-block; */ + text-align: center; + margin: 20rpx auto; + color: #fff; + border-radius: 20rpx; + } + + .configload { + display: flex; + justify-content: center; + align-items: center; + font-size: 50rpx; + color: #ddd; + } + + .configload text { + margin-right: 20rpx + } + + /deep/ .u-popup__content__close .u-icon__icon { + color: #fff !important + } + + .areavalue {} + + .areabtn { + background-color: #044ed7; + /* margin-left: 8px; */ + width: 100%; + position: fixed; + bottom: 0; + left: 0; + border-radius: 0; + } + + /deep/ .areavalue .uni-data-checklist .checklist-group .checklist-box.is--button { + padding: 30rpx } \ No newline at end of file