This commit is contained in:
SelfRidicule 2024-03-09 19:02:53 +08:00
parent 0884427986
commit 1ba11dbd7a
2 changed files with 73 additions and 6 deletions

View File

@ -74,11 +74,8 @@ Page({
let title = e.currentTarget.dataset.title let title = e.currentTarget.dataset.title
// 校验是否选择“被访单位” 后 ,再选择被访人信息 // 校验是否选择“被访单位” 后 ,再选择被访人信息
if (title == '人员' && !_this.data.detail.customerId) { if (title == '人员' && !_this.data.detail.customerId) {
// 危险通知 // 错误消息提示
Notify({ _this.showErrMsg('请先选择被访单位!')
type: 'danger',
message: '请先选择被访单位!'
});
return; return;
} }
// url 参数 // url 参数
@ -239,6 +236,76 @@ Page({
}) })
}, },
// 提交数据
submitData() {
let _this = this;
// 上传文件列表
let fileList = _this.data.fileList;
// 数据
let detail = _this.data.detail;
//
// 校验数据
//
// 被访单位
if (!detail.customerId) {
_this.showErrMsg('请选择被访单位!')
return;
}
// 被访人姓名、电话
if (!detail.userId) {
_this.showErrMsg('请选择被访人姓名、电话!')
return;
}
// 访客姓名
if (!detail.name) {
_this.showErrMsg('请填写访客姓名!')
return;
}
// 访客手机号
if (!detail.phone) {
_this.showErrMsg('请填写访客手机号!')
return;
}
// 证件号
if (!detail.cardNo) {
_this.showErrMsg('请填写证件号!')
return;
}
// 到访时间
if (!detail.visitTime) {
_this.showErrMsg('请选择到访时间!')
return;
}
// 离开时间
if (!detail.leaveTime) {
_this.showErrMsg('请选择离开时间!')
return;
}
// 来访事由
if (!detail.visitContent) {
_this.showErrMsg('请填写来访事由!')
return;
}
// 图片上传
if (fileList && fileList.length > 0) {
detail.photo = fileList[0].relativeUrl // 头像-相对路径
detail.url = fileList[0].url // 人脸设备图片-全路径
} else {
_this.showErrMsg('请上传照片!')
return;
}
},
// 显示错误消息
showErrMsg(msg) {
Notify({
type: 'danger',
message: msg
});
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -58,7 +58,7 @@
</view> </view>
<!-- 提交 --> <!-- 提交 -->
<view class="submitBtnView" bind:click="submitFormFn">提交</view> <view class="submitBtnView" bind:tap="submitData">提交</view>
</view> </view>