Files
ykb-h5/pages/index/post.vue
2025-11-19 12:51:13 +08:00

869 lines
30 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="content">
<view class="cc" v-if="type_code !== 'xwqs' && type_code !== 'myfw'">
<view class="layui-form-item form-item"
v-if="type_code !== 'xrfw' && type_code !== 'lsyljz' &&type_code !== 'lrbcybf' && type_code !== 'zqts'">
<text class="layui-form-text" v-if="type_code == 'zlzxqj'"><span class="clred">*</span>咨询问题</text>
<text class="layui-form-text" v-else-if="type_code == 'zyzfw'"><span class="clred">*</span>服务事项</text>
<text class="layui-form-text" v-else-if="type_code == 'knlkjz' || type_code == 'llqtryjz'"><span class="clred">*</span>救助事项</text>
<text class="layui-form-text" v-else><span class="clred">*</span>事件标题</text>
<view class="layui-input-block">
<input type="text" v-if="type_code == 'zlzxqj'" v-model="warningTitle" placeholder="请输入咨询问题" autocomplete="off">
<input type="text" v-else-if="type_code == 'zyzfw'" v-model="warningTitle" placeholder="请输入服务事项" autocomplete="off">
<input type="text"v-else-if="type_code == 'knlkjz' || type_code == 'llqtryjz'" v-model="warningTitle" placeholder="请输入救助事项" autocomplete="off">
<input type="text" v-else v-model="warningTitle" placeholder="请输入事件标题" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item"
v-if="type_code === 'xrfw' || type_code == 'lsyljz' || type_code == 'lrbcybf' || type_code == 'zyzfw'|| type_code == 'knlkjz' || type_code == 'llqtryjz'">
<text class="layui-form-text"><span class="clred">{{ type_code == 'llqtryjz' ? '' : '*'}}</span>{{ type_code == 'xrfw' ? '被寻人姓名' : (type_code === 'llqtryjz' ? '流浪人员姓名' : '旅客姓名')}}</text>
<view class="layui-input-block">
<input type="text" v-model="passengerName"
:placeholder="type_code == 'xrfw' ? '请输入被寻人姓名' : (type_code === 'llqtryjz' ? '请输入流浪人员姓名' : '请输入旅客姓名') " autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item" v-if="type_code === 'tslksjzfw'">
<text class="layui-form-text"><span class="clred">*</span>旅客姓名</text>
<view class="layui-input-block">
<input type="text" v-model="psgName" placeholder="请输入旅客姓名" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item"
v-if="type_code === 'xrfw' || type_code == 'lsyljz' || type_code == 'lrbcybf' || type_code == 'knlkjz' || type_code == 'llqtryjz'">
<text class="layui-form-text"><span class="clred"></span>{{type_code === 'xrfw' ? '被寻人性别' : (type_code === 'llqtryjz' ? '流浪人员性别' : '旅客性别')}} </text>
<view class="layui-input-block">
<picker @change="bindPickerChangePassengerSex" :value="passengerSexIndex"
:range="passengerSexArray">
<view class="uni-input">{{passengerSexIndex!== -1 ? passengerSexArray[passengerSexIndex] : '请选择被寻人性别'}}</view>
</picker>
</view>
</view>
<view class="layui-form-item form-item"
v-if="type_code === 'xrfw' || type_code == 'lsyljz' || type_code == 'lrbcybf' || type_code == 'tslksjzfw'|| type_code == 'zyzfw' || type_code == 'knlkjz' || type_code == 'llqtryjz'">
<text class="layui-form-text"><span
class="clred">{{ type_code == 'llqtryjz' ? '' : '*'}}</span>{{ type_code == 'xrfw' ? '联系人电话' : (type_code == 'llqtryjz' ? '流浪人员电话' : '旅客电话') }}</text>
<view class="layui-input-block">
<input type="number" v-model="contactPhone"
:placeholder="type_code == 'xrfw' ? '请输入联系人电话' : (type_code == 'llqtryjz' ? '请输入流浪人员电话' : '请输入旅客电话') " autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item"
v-if="type_code === 'xrfw' || type_code == 'lsyljz' || type_code == 'lrbcybf'|| type_code == 'knlkjz' || type_code == 'llqtryjz'">
<text class="layui-form-text"><span class="clred"></span>{{ type_code == 'llqtryjz' ? '联系人姓名' : '紧急联系人姓名'}}</text>
<view class="layui-input-block">
<input type="text" v-model="emergencyContact" :placeholder="type_code == 'llqtryjz' ? '请输入联系人姓名' : '请输入紧急联系人姓名' " autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item"
v-if="type_code === 'xrfw' || type_code == 'lsyljz' || type_code == 'lrbcybf' || type_code == 'knlkjz' || type_code == 'llqtryjz'">
<text class="layui-form-text" v-if="type_code === 'llqtryjz'"><span class="clred">*</span>联系人电话</text>
<text class="layui-form-text" v-else><span class="clred"></span>紧急联系人电话</text>
<view class="layui-input-block">
<input type="number" v-model="emergencyContactTel" :placeholder="type_code == 'llqtryjz' ? '请输入联系人电话' : '请输入紧急联系人电话'" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item" v-if="type_code == 'zyzfw'">
<text class="layui-form-text"><span class="clred">*</span>预约时间</text>
<view class="layui-input-block">
<u-datetime-picker :show="show" v-model="value1" mode="datetime" @confirm="onConfirm"
@cancel="onCancel"></u-datetime-picker>
<!-- <picker mode="date" :value="serviceTime" start="09:01" end="21:01" @change="bindServiceTimeChange"> -->
<view class="uni-input" @click="show = true">{{serviceTime ? serviceTime : '请选择日期' }}</view>
<!-- </picker> -->
</view>
</view>
<!-- 已废弃 -->
<!-- <view class="layui-form-item form-item"
v-if="type_code == 'lsyljz' || type_code == 'knlkjz' || type_code == 'llqtryjz'">
<text class="layui-form-text"><span class="clred">*</span>服务需求</text>
<view class="layui-input-block">
<input type="text" v-model="situationDescription" placeholder="请输入服务需求" autocomplete="off">
</view>
</view> -->
<!-- <view class="layui-form-item form-item" v-if="type_code === 'lrbcybf' || type_code === 'zyzfw'">
<text class="layui-form-text"> <span class="clred">*</span>服务需求</text>
<view class="layui-input-block">
<input type="text" v-model="serviceDesc" placeholder="请输入服务需求" autocomplete="off"> -->
<!-- 未提供 -->
<!-- <picker @change="bindPickerChangeServiceDesc" :value="serviceDescIndex"
:range="serviceDescArray">
<view class="uni-input">{{serviceDescArray[serviceDescIndex]}}</view>
</picker> -->
<!-- </view>
</view> -->
<view class="layui-form-item form-item-1" v-if="type_code === 'tslksjzfw'">
<text class="layui-form-text"><span class="clred">*</span>送站说明</text>
<view class="layui-input-block">
<textarea v-model="szComment" class="layui-textarea" id="" cols="30" rows="10"
placeholder="请输入送站说明"></textarea>
</view>
</view>
<view class="layui-form-item form-item" v-if="type_code === 'zlzxqj'">
<text class="layui-form-text"> <span class="clred">*</span>即时咨询分类</text>
<view class="layui-input-block">
<picker @change="bindPickerChangeRealtimeFlag" :value="realtimeFlagIndex"
:range="realtimeFlagArray">
<view class="uni-input">{{realtimeFlagArray[realtimeFlagIndex]}}</view>
</picker>
</view>
</view>
<view class="layui-form-item form-item" v-if="type_code === 'zlzxqj'">
<text class="layui-form-text"> <span class="clred">*</span>问题分类</text>
<view style="flex:1"></view>
<view class="layui-input-block">
<picker @change="bindPickerChangeQuestionType" :value="questionTypeIndex"
:range="questionTypeArray">
<view class="uni-input">{{questionTypeArray[questionTypeIndex]}}</view>
</picker>
</view>
</view>
<view class="layui-form-item form-item-1" v-if="type_code === 'zlzxqj' && false">
<text class="layui-form-text"><span class="clred">*</span>问题描述</text>
<view class="layui-input-block">
<textarea v-model="consultQuestion" class="layui-textarea textarea" id="" cols="30" rows="10"
placeholder="请输入问题描述"></textarea>
</view>
</view>
<view class="layui-form-item form-item" v-if="type_code === 'sssbwxwh_dk' ">
<text class="layui-form-text"><span class="clred"></span>设施设备名称</text>
<view class="layui-input-block">
<input type="text" v-model="deviceName" placeholder="请输入设施设备名称" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item-1" v-if="type_code === 'sssbwxwh_dk' ">
<text class="layui-form-text"><span class="clred"></span>设施设备位置描述</text>
<view class="layui-input-block">
<textarea v-model="deviceAreaDesc" class="layui-textarea" id="" cols="30" rows="10"
placeholder="请输入设施设备位置描述"></textarea>
</view>
</view>
<view class="layui-form-item form-item-1" v-if="type_code === 'sssbwxwh_dk' ">
<text class="layui-form-text"><span class="clred"></span>设施设备问题描述</text>
<view class="layui-input-block">
<textarea v-model="deviceMonitorInfo" class="layui-textarea" id="" cols="30" rows="10"
placeholder="请输入设施设备问题描述"></textarea>
</view>
</view>
<view class="layui-form-item form-item-1">
<text class="layui-form-text"><span class="clred">{{ type_code == 'llqtryjz' ? '' : '*'}}</span>{{type_code == 'zqts' ? '投诉建议' : '服务需求描述'}}</text>
<view class="layui-input-block">
<textarea v-model="warningRemark" class="layui-textarea" id="" cols="30" rows="10"
:placeholder="type_code == 'zqts' ? '请输入投诉建议' : '请输入服务需求描述'"></textarea>
</view>
</view>
</view>
<!--失物招领-->
<view class="cc" v-if="type_code == 'xwqs'">
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>物品名称</text>
<view class="layui-input-block">
<input type="text" v-model="propertyName" placeholder="请输入物品名称" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>物品特征</text>
<view class="layui-input-block">
<input type="text" v-model="propertyFeature" placeholder="请输入物品特征" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>物品类型</text>
<view class="layui-input-block">
<picker @change="bindPickerChangeTypeIndex" :value="typeIndex" :range="typeIndexArray">
<view class="uni-input">{{typeIndex !== -1 ? typeIndexArray[typeIndex] : '请选择物品类型'}}</view>
</picker>
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>遗失日期</text>
<view class="layui-input-block">
<picker mode="date" :value="lostTime" start="09:01" end="21:01" @change="bindTimeChange">
<view class="uni-input">{{lostTime ? lostTime : '请选择日期' }}</view>
</picker>
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>遗失地点</text>
<view class="layui-input-block">
<input type="text" v-model="lostRegion" placeholder="请输入遗失地点" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>联系人</text>
<view class="layui-input-block">
<input type="text" v-model="contactPeople" placeholder="请输入联系人" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>联系方式</text>
<view class="layui-input-block">
<input type="number" v-model="contactPhone" placeholder="请输入联系方式" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item-1">
<text class="layui-form-text"><span class="clred"></span>补充描述</text>
<view class="layui-input-block">
<textarea v-model="lostDesc" class="layui-textarea" id="" cols="30" rows="10"
placeholder="请输入补充描述"></textarea>
</view>
</view>
</view>
<!--母婴服务-->
<view class="cc" v-if="type_code == 'myfw'">
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>姓名</text>
<view class="layui-input-block">
<input type="text" v-model="passenger_name" placeholder="请输入姓名" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>是否本人</text>
<view class="layui-input-block">
<picker @change="bindPickerChangeSelfFlag" :value="selfFlagIndex" :range="selfFlagArray">
<view class="uni-input">{{selfFlagIndex !== -1 ? selfFlagArray[selfFlagIndex] : '请选择是否本人'}}</view>
</picker>
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred">*</span>联系方式</text>
<view class="layui-input-block">
<input type="number" v-model="contact_phone" placeholder="请输入联系方式" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred"></span>有无同行</text>
<view class="layui-input-block">
<picker @change="bindPickerChangeCompanionFlag" :value="companionFlagIndex"
:range="companionFlagArray">
<view class="uni-input">{{companionFlagIndex !== -1 ? companionFlagArray[companionFlagIndex] : '请选择有无同行'}}</view>
</picker>
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred"></span>预约时间</text>
<view class="layui-input-block">
<u-datetime-picker :show="show" v-model="value1" mode="datetime" @confirm="onConfirm"
@cancel="onCancel"></u-datetime-picker>
<!-- <picker mode="date" :value="serviceTime" start="09:01" end="21:01" @change="bindServiceTimeChange"> -->
<view class="uni-input" @click="show = true">{{serviceTime ? serviceTime : '请选择日期' }}</view>
<!-- </picker> -->
</view>
</view>
<view class="layui-form-item form-item">
<text class="layui-form-text"><span class="clred"></span>同行人姓名电话</text>
<view class="layui-input-block">
<input type="text" v-model="companion_info" placeholder="请输入同行人姓名电话" autocomplete="off">
</view>
</view>
<view class="layui-form-item form-item-1">
<text class="layui-form-text"><span class="clred"></span>具体描述</text>
<view class="layui-input-block">
<textarea v-model="situation_description" class="layui-textarea" id="" cols="30" rows="10"
placeholder="请输入具体描述(选填)"></textarea>
</view>
</view>
</view>
<view class="form-item-1 cc">
<text>
<text
class="clred">{{ ( type_code == 'llqtryjz' || type_code == 'xrfw' || type_code == 'lsyljz' || type_code == 'lrbcybf' || type_code == 'zyzfw') ? '*' : '' }}</text>
上传图片</text>
<view class="form-image" @click="chooseImage">
<image class="ii" id="clickableImage" model="aspectFit" :src="imagedefault" v-if="!image"></image>
<image clsaa="iii" :src="image" style="width: 180rpx; height: 180rpx;border-radius: 15rpx;" v-else>
</image>
<image :src="delimagedefault" model="aspectFit" class="del" v-show="delFalse" @click.stop="delImage">
</view>
</view>
<view class="tjsb">
<button type="primary" @click="submit">提交上报</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
show: false,
value1: Number(new Date()),
type_code: '',
title: '',
passenger_name: '',
contact_phone: '',
companion_info: '',
situation_description: '',
passengerSexIndex: -1,
passengerSex: '',
passengerSexArray: ['男', '女', '保密'],
realtimeFlagIndex: '',
realtimeFlag: '',
realtimeFlagArray: ['非即时类', '即时类'],
questionTypeIndex: '',
questionType: '',
questionTypeArray: ['铁路相关问题咨询', '轨道相关问题咨询', '长途客运相关问题咨询', '公交相关问题咨询', '站内问询', '旅客预约送站服务', '站内其他服务问题咨询'],
typeIndex: -1,
typeIndexArray: ['箱包', '电子产品', '日化', '公交相关问题咨询', '电器', '证件', '药品', '饰品', '衣物', '鞋', '其它'],
self_flag: '',
selfFlagIndex: -1,
selfFlagArray: ['是', '否'],
companion_flag: '',
companionFlagIndex: -1,
companionFlagArray: ['有', '无'],
lostTime: '',
imagedefault: '/static/tpsc.svg',
delFalse: false,
file: [],
image: '',
propertyName: '',
warningTitle: '',
warningRemark: '',
propertyFeature: '',
lostRegion: '',
contactPeople: '',
contactPhone: '',
lostDesc: '',
passengerName: '',
serviceTime: '',
serviceDesc: '',
delimagedefault: '/static/img_t/xxx.svg',
serviceDescIndex: '',
serviceDescArray: ['是', '否'],
emergencyContactTel: '',
emergencyContact: '',
filePath: '',
previewFilePath: ''
}
},
onLoad(query) {
this.type_code = query.code
uni.setNavigationBarTitle({
title: query.name
})
this.title = query.name
},
computed: {
},
methods: {
bindPickerChangePassengerSex: function(e) {
this.passengerSexIndex = Number(e.detail.value)
},
bindPickerChangeRealtimeFlag: function(e) {
this.realtimeFlagIndex = e.detail.value
},
bindPickerChangeQuestionType: function(e) {
this.questionTypeIndex = e.detail.value
},
bindPickerChangeTypeIndex: function(e) {
this.typeIndex = Number(e.detail.value)
},
bindPickerChangeSelfFlag: function(e) {
this.selfFlagIndex = Number(e.detail.value)
this.self_flag = this.selfFlagArray[this.selfFlagIndex]
},
bindPickerChangeCompanionFlag: function(e) {
this.companionFlagIndex = Number(e.detail.value)
this.companion_flag = this.companionFlagArray[this.companionFlagIndex]
},
bindPickerChangeServiceDesc: function(e) {
this.serviceDescIndex = e.detail.value
this.serviceDesc = this.serviceDescArray[this.serviceDescIndex]
},
bindTimeChange: function(e) {
this.lostTime = e.detail.value
},
bindServiceTimeChange: function(e) {
this.serviceTime = e.detail.value
console.log(this.serviceTime)
},
// 时间选择
onConfirm(e) {
this.serviceTime = this.currentTime(e.value)
this.show = false
},
onCancel(e) {
this.show = false
this.serviceTime = ''
},
currentTime(str) {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
if (str) {
return `${year}-${month}-${day} ${hours}:${minutes}`;
} else {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
},
delImage(e) {
// e.stopPropagation()
this.imagedefault = '/static/tpsc.svg'
this.delFalse = false
this.image = ''
this.file = []
this.filePath = ''
this.previewFilePath = ''
},
chooseImage() {
uni.chooseImage({
count: 1, // 默认9设置图片的最大选择数
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: (res) => {
uni.showLoading({
title: '上传中...'
});
// 返回选定照片的本地文件路径列表tempFilePath可以作为img标签的src属性显示图片
const tempFilePaths = res.tempFilePaths;
// uni.previewImage({
// current: tempFilePaths[0], // 当前显示图片的http链接
// urls: tempFilePaths // 需要预览的图片http链接列表
// });
console.log('res', res.tempFiles[0])
var filePath = res.tempFiles[0]
console.log('filePath.path', filePath.path)
uni.uploadFile({
url: 'https://lk.cqbzzgj.cn/api/Index/apppost',
filePath: filePath.path,
name: 'file',
formData: {
action: 'Home/new_event_pic',
fileType: 'image',
reName: 'true',
thumbnail: 'true'
},
success: (uploadFileRes) => {
console.log('222')
console.log('uploadFileRes', uploadFileRes.data)
var tem = JSON.parse(uploadFileRes.data)
if (tem.code != 200) {
uni.showToast({
title: '上传失败',
icon: 'none'
})
return
} else {
this.image = tempFilePaths[0]
this.delFalse = true
this.file = tem.data
uni.showLoading({
title: '上传成功'
});
}
setTimeout(function() {
uni.hideLoading();
}, 1000);
}
})
}
});
},
verifyFile() {
if (this.filePath == undefined || this.previewFilePath == undefined) {
uni.showToast({
title: '请上传图片',
icon: 'none'
})
return false
}
return true
},
submit() {
var type_code = this.type_code
var title = this.title
var incidentTime = this.currentTime()
this.filePath = this.file[0]
this.previewFilePath = this.file[1]
if (type_code == 'myfw') {
if (this.passenger_name == '' || this.contact_phone == '' || this.self_flag == '') {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return false;
}
var attr = {
"passenger_name": this.passenger_name,
"contact_phone": this.contact_phone,
"self_flag": this.self_flag == '' ? this.selfFlagArray[this.selfFlagIndex] : this.self_flag,
"service_type": '',
"passenger_type": '',
"companion_flag": this.companion_flag == '' ? this.companionFlagArray[this
.companionFlagIndex] : this.companion_flag,
"companion_info": this.companion_info == '' ? this.companionFlagArray[this
.companionFlagIndex] : this.companion_flag,
"serviceTime": this.serviceTime,
"situation_description": this.situation_description
}
var data = {
"action": 'Home/new_event_runadd',
"warningTitle": '母婴服务',
"warningType": 2,
"typeCode": 'myfw',
"warningLevel": 4,
"incidentTime": incidentTime,
"incidentAddress": "",
"warningRemark": '母婴服务',
"incidentLong": "106.547507",
"incidentLat": "29.609545",
"regionCode": "CQBZ_DM",
"filePath": this.filePath ? '/' + this.filePath : '',
"previewFilePath": this.previewFilePath ? '/' + this.previewFilePath : '',
"expandData": JSON.stringify(attr),
"reportPerson": this.contact_phone
}
return this.toServer(data)
} else if (type_code == 'xwqs') {
if (this.propertyName == '' || this.lostTime == '' || this.contactPeople == '' ||
this.propertyFeature == '' || this.lostRegion == '') {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return false
}
var attr = {
"propertyName": this.propertyName,
"propertyType": this.typeIndexArray[this.typeIndex],
"lostTime": this.lostTime + ' ' + '00:00:00',
"lostPlace": this.lostRegion,
"receiveType": "自领",
"contactPeople": this.contactPeople,
"contactPhone": this.contactPhone,
"propertyFeature": this.propertyFeature,
"propertyDesc": this.lostDesc
}
var data = {
"action": 'Home/new_event_runadd',
"warningTitle": "寻物启事" + '[' + this.propertyName + ']',
"warningType": 2,
"typeCode": "xwqs",
"warningLevel": 4,
"incidentTime": incidentTime,
"incidentAddress": "南广场",
"warningRemark": "寻物启事",
"incidentLong": "106.547507",
"incidentLat": "29.609545",
"regionCode": "CQBZ_NGC_B1",
"filePath": this.filePath ? '/' + this.filePath : '',
"previewFilePath": this.previewFilePath ? '/' + this.previewFilePath : '',
"expandData": JSON.stringify(attr),
"reportPerson": this.contactPhone
}
return this.toServer(data)
} else {
if (type_code == 'xrfw') {
if (!this.passengerName || !this.contactPhone || !this.warningRemark) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
if(!this.verifyFile()){
return false
}
attr = {
passengerName: this.passengerName,
passengerSex: this.passengerSexArray[this.passengerSexIndex],
contactPhone: this.contactPhone,
emergencyContact: this.emergencyContact,
emergencyContactTel: this.emergencyContactTel,
warningRemark: this.warningRemark
}
} else if (type_code == 'lsyljz') {
if (!this.passengerName || !this.contactPhone || !this
.warningRemark) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
if(!this.verifyFile()){
return false
}
attr = {
passengerName: this.passengerName,
passengerSex: this.passengerSexArray[this.passengerSexIndex],
contactPhone: this.contactPhone,
emergencyContact: this.emergencyContact,
emergencyContactTel: this.emergencyContactTel,
situationDescription: this.situationDescription,
warningRemark: this.warningRemark
}
} else if (type_code == 'lrbcybf') {
if (!this.passengerName || !this.contactPhone || !this
.warningRemark) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
if(!this.verifyFile()){
return false
}
attr = {
passengerName: this.passengerName,
passengerSex: this.passengerSexArray[this.passengerSexIndex],
contactPhone: this.contactPhone,
emergencyContact: this.emergencyContact,
emergencyContactTel: this.emergencyContactTel,
serviceDesc: this.serviceDesc,
warningRemark: this.warningRemark
}
} else if (type_code == 'zlzxqj') {
if (!this.warningTitle || !this.warningRemark) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
attr = {
realtimeFlag: this.realtimeFlagIndex + 1,
realtimeFlagName: this.realtimeFlagArray[this.realtimeFlagIndex],
questionType: this.questionTypeIndex + 1,
questionTypeName: this.questionTypeArray[this.questionTypeIndex],
warningRemark: this.warningRemark,
}
} else if (type_code == 'zyzfw') {
if (!this.warningTitle || !this.passengerName || !this.contactPhone || !this.serviceTime || !this.warningRemark) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
if(!this.verifyFile()){
return false
}
attr = {
warningTitle: this.warningTitle,
passengerName: this.passengerName,
contactPhone: this.contactPhone,
serviceTime: this.serviceTime,
serviceDesc: this.serviceDesc,
serviceAddress: '重庆北站',
warningRemark: this.warningRemark
}
} else if (type_code == 'knlkjz' ) {
if (!this.warningTitle || !this.passengerName || !this.contactPhone || !
this.warningRemark) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
attr = {
passengerName: this.passengerName,
passengerSex: this.passengerSexArray[this.passengerSexIndex],
contactPhone: this.contactPhone,
emergencyContact: this.emergencyContact,
emergencyContactTel: this.emergencyContactTel,
situationDescription: this.situationDescription,
}
}else if (type_code == 'llqtryjz') {
if (!this.warningTitle || !this.emergencyContactTel) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
if(!this.verifyFile()){
return false
}
attr = {
passengerName: this.passengerName,
passengerSex: this.passengerSexArray[this.passengerSexIndex],
contactPhone: this.contactPhone,
emergencyContact: this.emergencyContact,
emergencyContactTel: this.emergencyContactTel,
situationDescription: this.situationDescription,
}
} else if (type_code == 'zqts') {
if (!this.warningRemark) {
uni.showToast({
title: '请填写完整信息',
icon: 'none'
})
return
}
attr = {
warningRemark: this.warningRemark
}
} else {
uni.showToast({
title: '不存在服务类型',
icon: 'none'
})
return
}
var data = {
sourceTypeId: 4,
warningLevel: 4,
typeCode: type_code,
incidentAddress: '',
warningRemark: this.warningRemark ?? '',
influenceRange: '',
takeStep: '',
"action": 'Home/integrateAddEvent',
"warningTitle": this.warningTitle ? title + "" + '[' + this.warningTitle + ']' : title,
"incidentLong": "106.547507",
"incidentLat": "29.609545",
"regionCode": "CQBZ_NGC_B1",
"filePath": this.filePath ? '/' + this.filePath : '',
"previewFilePath": this.previewFilePath ? '/' + this.previewFilePath : '',
"expandData": JSON.stringify(attr),
"reportPerson": this.contactPhone
}
return this.toServer(data)
}
},
toServer(data) {
uni.showLoading({
title: '上报中...'
})
uni.request({
// url:'/myapi',
url: 'https://lk.cqbzzgj.cn/api/Index/apppost', //仅为示例,并非真实接口地址。
data: data,
method: "POST",
success: (res) => {
if (res.data.code == 200) {
uni.showLoading({
title: '上报成功'
})
setTimeout(function() {
uni.hideLoading();
uni.navigateBack()
}, 3000);
} else {
uni.navigateTo({
url: '/pages/index/msg'
})
}
}
});
}
}
}
</script>
<style>
@import '/static/css/default.css';
</style>