factory_mp_old/pages/workSpace/visit/vpeopleSelect.vue

396 lines
10 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="my-data">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="200rpx" leftText="人员选择"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="wrap-view" style="box-shadow: 0 0 15px 5px #eeeeee;padding-bottom: 20upx;">
<view class="item">
<view class="title">信息修改</view>
<view class="content"></view>
</view>
<view class="item item_bottom_border">
<view class="title"><text class="star">*</text>访客</view>
<view class="content">
<uni-data-select name="visitor" :localdata="userRange" v-model="formData.visitor">
</uni-data-select>
</view>
</view>
<!-- <view class="item item_bottom_border">
<view class="title"><text class="star">*</text>返乡时间</view>
<view class="content">
<uni-datetime-picker
v-model="formData.return_date"
type="date"
:hide-second="true"
/>
</view>
</view> -->
<view class="item item_bottom_border">
<view class="title"><text class="star">*</text>来源地</view>
<view class="content" @click="toggleMaskLocation">
<text class="cell-tip">
<text class="choose-text">{{addressByPcrs}}</text>
<text class="iconfont icon-xiangxia"></text>
</text>
</view>
<gk-city
:headtitle="headtitle"
:provincedata="provincedata"
:data="selfData"
mode="cityPicker"
ref="cityPicker"
@funcvalue="getpickerParentValue"
:pickerSize="4"></gk-city>
</view>
<view class="item item_bottom_border">
<view class="title"><text class="star">*</text>具体地址</view>
<view class="content">
<!-- <pickerAddress @change="cityChange"><i>{{cityTitle}}</i></pickerAddress> -->
<input type="text" v-model="formData.come_place" maxlength="20" placeholder="请输入来源地具体地址" />
</view>
</view>
<!-- <view class="item item_bottom_border">
<view class="title"><text class="star">*</text>行程轨迹</view>
<view class="content">
<input type="text" v-model="formData.trip_desc" maxlength="20" placeholder="请输入行程轨迹" />
</view>
</view> -->
<!-- <view class="item item_bottom_border">
<view class="title"><text class="star">*</text>管控措施</view>
<view class="content">
<uni-data-select name="measure" :localdata="measureRange" v-model="formData.measure">
</uni-data-select>
</view>
</view>
<view class="item item_bottom_border">
<view class="title"><text class="star">*</text>核酸日期</view>
<view class="content">
<uni-datetime-picker
v-model="formData.test_date"
type="date"
:hide-second="true"
/>
</view>
</view> -->
<!-- <view class="item item_bottom_border">
<view class="title"><text class="star">*</text>是否报备</view>
<view class="content">
<u-switch v-model="formData.is_reported"></u-switch>
</view>
</view> -->
<view class="item item_bottom_border">
<view class="title"><text class="star">*</text>是否主访客</view>
<view class="content">
<u-switch v-model="formData.is_main"></u-switch>
</view>
</view>
<!-- <view class="item item_bottom_border" style="height: fit-content;">
<view class="title"><text class="star">*</text>健康码</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload" max-count="1" @on-success="imgUpdataHealth"></u-upload>
//<imgUpload :count="1" :header="header" :url="vuex_apifile" @obtain_img="imgUpdataHealth" :list="healthFileList"></imgUpload>
</view>
</view> -->
<!-- <view class="item item_bottom_border" style="height: fit-content;">
<view class="title"><text class="star">*</text>行程码</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload" max-count="1" @on-success="imgUpdataTravel"></u-upload>
</view>
</view>
<view class="item item_bottom_border" style="height: fit-content;">
<view class="title"><text class="star">*</text>核酸报告</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload" max-count="1" @on-success="imgUpdataReport"></u-upload>
</view>
</view> -->
</view>
<view class="btn">
<button type="default" class="save-btn" @click="formSubmit">确定</button>
</view>
</view>
</template>
<script>
import imgUpload from '@/components/linzq-imgUpload/linzq-imgUpload.vue';
import nonNullCheck from '../../../utils/nonNullCheck.js';
import pickerAddress from '../../comm/city/city.vue';
import provinceData from '@/common/city.data.js';
export default {
components: {
imgUpload,
pickerAddress
},
data() {
return {
formData: {
visit: '',
visitor: '',
// return_date: '',
come_place: '',
// trip_desc: '',
// test_date:'',
// measure: '',
// health_code: '',
// travel_code: '',
// test_report: '',
is_main: false,
// is_reported: false,
},
selfData:provinceData,
headtitle:"请选择所在地",
addressByPcrs:"请选择所在地",
provincedata:[
{
text:'北京市',
value:''
}
],
// cityTitle: '请选择:省、市、区',
head: {
Authorization: "Bearer " + this.vuex_token
},
userRange: [],
measureRange: [
{value:'集中隔离',text:'集中隔离'},
{value:'居家隔离',text:'居家隔离'},
{value:'居家健康检测',text:'居家健康检测'},
{value:'排除风险',text:'排除风险'},
],
healthFileList:[],
travelFileList:[],
reportFileList:[],
hasPhoto:false,
header:'',
visitId:''
}
},
onLoad(params) {
// debugger;
if (params.visitId) {
this.formData.visit = params.visitId;
this.visitId = params.visitId;
}
},
onShow() {
this.getHeader();
this.getVisitorRange();
},
methods: {
getHeader() {
this.header = {
Authorization: "Bearer " + this.vuex_token
}
},
imgUpdataHealth(data){
this.formData.health_code = data.path;
},
imgUpdataTravel(data){
this.formData.travel_code = data.path;
},
imgUpdataReport(data){
this.formData.test_report = data.path;
},
//获取所有已注册游客
getVisitorRange() {
let that = this;
that.$u.api.vmVisitor({
page: 0
}).then(res => {
that.userRange = [];
let user = [];
let obj = {};
res.forEach(item => {
obj = item;
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
that.userRange = user
})
},
// cityChange(data) { //城市选择
// this.cityTitle = data.data.join('-')
// this.cityForm.province = this.cityTitle.split('-')[0] //省
// this.cityForm.city = this.cityTitle.split('-')[1] //市
// this.cityForm.district = this.cityTitle.split('-')[2] //区
// this.cityForm.city = this.cityTitle //把获取到的值赋值给 this.cityForm.city
// },
toggleMaskLocation(){
this.$nextTick(()=>{
this.$refs["cityPicker"].show();
})
},
getpickerParentValue(data){
console.log(data.map(o=>{return o.value})); //获取地址的value值
this.provincedata=data;
this.addressByPcrs=data.map(o=>{return o.text}).join(" ")
},
/* 参数验证 */
paramsCheck() {
if (!nonNullCheck(this.formData.visitor)) {
uni.showToast({
title: '请选择访客',
icon: "none"
})
return false;
}
// if (!nonNullCheck(this.formData.return_date)) {
// uni.showToast({
// title: '请选择返乡时间',
// icon: "none"
// })
// return false;
// }
if (this.addressByPcrs=="请选择所在地") {
uni.showToast({
title: '请选择所在地',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.come_place)) {
uni.showToast({
title: '请填写来源地具体地址',
icon: "none"
})
return false;
}
// if (!nonNullCheck(this.formData.trip_desc)) {
// uni.showToast({
// title: '请选择行程轨迹',
// icon: "none"
// })
// return false;
// }
// if (!nonNullCheck(this.formData.measure)) {
// uni.showToast({
// title: '请选择管控措施',
// icon: "none"
// })
// return false;
// }
// if (!nonNullCheck(this.formData.test_date)) {
// uni.showToast({
// title: '请选择核酸日期',
// icon: "none"
// })
// return false;
// }
// if (!nonNullCheck(this.formData.health_code)) {
// uni.showToast({
// title: '请上传健康码',
// icon: "none"
// })
// return false;
// }
// if (!nonNullCheck(this.formData.travel_code)) {
// uni.showToast({
// title: '请上传行程码',
// icon: "none"
// })
// return false;
// }
// if (!nonNullCheck(this.formData.test_report)) {
// uni.showToast({
// title: '请上传核酸报告',
// icon: "none"
// })
// return false;
// }
return true;
},
formSubmit(val) {
let that = this;
if (!that.paramsCheck()) {
return;
} else {
that.formData.come_place = that.addressByPcrs+that.formData.come_place;
that.$u.api.vpeopleCreate(that.formData).then(res => {
if (res.err_msg) {} else {
uni.navigateBack({
delta: 1
})
}
})
}
},
goBack() {
uni.navigateBack({
delta: 1
})
},
}
}
</script>
<style scoped lang="scss">
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
>>>uni-image{
height: 200upx;
width: 200upx;
}
.my-data {
background-color: #f3fbff;
padding-bottom: 227rpx;
}
.nav-bar>>>.uni-navbar-btn-text text {
font-size: 32rpx !important;
}
.wrap-view {
width: 720rpx;
margin: 0 auto;
background-color: #ffffff;
border-radius: 10rpx;
line-height: 94rpx;
font-family: PingFang-SC-Medium;
font-size: 30rpx;
}
.wrap-top{
padding: 20upx 0;
line-height: 60upx;
}
.item {
margin: 0rpx 32rpx;
display: flex;
margin-top: 20rpx;
}
.item_bottom_border{
border-bottom: 1rpx solid #eeeeee;
}
.title {
color: #212121;
flex: 1;
}
.content {
flex: 3;
color: #414141;
}
.content input {
height: 100%;
}
.save-btn {
width: 400rpx;
height: 80rpx;
background-color: #2c6fd9;
border-radius: 40rpx;
font-size: 30rpx;
line-height: 80rpx;
color: #f3fbff;
margin-top: 21rpx;
}
</style>