疫情问卷完善

This commit is contained in:
shane 2021-08-27 20:26:29 +08:00
parent 243125d8f4
commit 856b3ff2ca
2 changed files with 37 additions and 25 deletions

View File

@ -41,7 +41,6 @@ export function querySetting(_data){
*/ */
export function querySettingTitle(_data) { export function querySettingTitle(_data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let moreRooms = [];
requestNoAuth({ requestNoAuth({
url: url.querySettingTitle, url: url.querySettingTitle,
method: "GET", method: "GET",
@ -66,7 +65,6 @@ export function querySettingTitle(_data) {
*/ */
export function saveReportInfoAnswerValue(_data){ export function saveReportInfoAnswerValue(_data){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let moreRooms = [];
requestNoAuth({ requestNoAuth({
url: url.saveReportInfoAnswerValue, url: url.saveReportInfoAnswerValue,
method: "POST", method: "POST",
@ -92,7 +90,6 @@ export function saveReportInfoAnswerValue(_data){
*/ */
export function saveReportInfoBackCity(_data){ export function saveReportInfoBackCity(_data){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let moreRooms = [];
requestNoAuth({ requestNoAuth({
url: url.saveReportInfoBackCity, url: url.saveReportInfoBackCity,
method: "POST", method: "POST",

View File

@ -3,7 +3,7 @@
<view style="background-color: white;padding: 40rpx 30rpx 10rpx;text-align: center; <view style="background-color: white;padding: 40rpx 30rpx 10rpx;text-align: center;
color: black;font-size: 20px;">{{setting.name}}</view> color: black;font-size: 20px;">{{setting.name}}</view>
<view class="" v-for="(item,index) in titles" :key="index"> <view class="" v-for="(item,index) in titles" :key="index">
<view class="block__title">{{item.title}}</view> <view class="block__title">{{index+1}}{{item.title}}</view>
<radio-group class="block" @change="radioChange($event,item)" v-if="item.titleType == '1001'"> <radio-group class="block" @change="radioChange($event,item)" v-if="item.titleType == '1001'">
<view class="cu-form-group" v-for="(valueItem,valueIndex) in item.reportInfoSettingTitleValueDtos" <view class="cu-form-group" v-for="(valueItem,valueIndex) in item.reportInfoSettingTitleValueDtos"
:key="valueIndex"> :key="valueIndex">
@ -130,7 +130,6 @@
_that[name] = value; // _that[name] = value; //
}, },
radioChange: function(e, item) { radioChange: function(e, item) {
console.log(e, item)
item.radio = e.detail.value; item.radio = e.detail.value;
}, },
checkboxChange: function(e, item) { checkboxChange: function(e, item) {
@ -151,7 +150,6 @@
}, },
submitQuestionAnswer: function(e) { submitQuestionAnswer: function(e) {
let obj = { let obj = {
"areaCode": this.areaCode,
"communityId": this.communityId, "communityId": this.communityId,
"communityName": this.communityName, "communityName": this.communityName,
"name": this.name, "name": this.name,
@ -166,7 +164,9 @@
"backTime":this.bindDate + " " + this.bindTime + ":00", "backTime":this.bindDate + " " + this.bindTime + ":00",
}; };
let msg = ""; let msg = "";
if(obj.name == "") { if(obj.communityId == "") {
msg = "请从新扫码";
}else if(obj.name == "") {
msg = "请填写姓名"; msg = "请填写姓名";
} else if (obj.idCard == "" || obj.idCard.length != 18) { } else if (obj.idCard == "" || obj.idCard.length != 18) {
msg = "请正确填写身份证号"; msg = "请正确填写身份证号";
@ -186,53 +186,68 @@
let _valueId = ''; let _valueId = '';
_titles.forEach(item => { _titles.forEach(item => {
if (item.titleType == '2002') { if (item.titleType == '2002') {
let _valueContent = [];
item.radio.forEach(_radio => { item.radio.forEach(_radio => {
if (_radio.selected == '1') { if (_radio.selected == '1') {
_valueContent.push(_radio.valueId)
}
})
_questionAnswerTitles.push({ _questionAnswerTitles.push({
valueContent: _radio.valueId, communityId: this.communityId,
valueContent: _valueContent,
titleId: item.titleId, titleId: item.titleId,
titleType: item.titleType titleType: item.titleType
}) })
}
})
} else { } else {
_valueId = item.radio; _valueId = item.radio;
_questionAnswerTitles.push({ _questionAnswerTitles.push({
communityId: this.communityId,
valueContent: _valueId, valueContent: _valueId,
titleId: item.titleId, titleId: item.titleId,
titleType: item.titleType titleType: item.titleType
}) })
} }
console.log(item);
}); });
let reflag = false;
_questionAnswerTitles.forEach(item => {
if(item.valueContent.toString().length == 0){
uni.showToast({
icon: 'none',
title: '保存成功'
});
reflag = true;
return false;
}
});
if(reflag){
uni.showToast({
icon: 'none',
title: '有未答项,请作答!'
});
return false;
}
obj = { obj = {
"settingId": this.settingId, "settingId": this.settingId,
"communityId":this.communityId, "communityId":this.communityId,
"questionAnswerTitles": _questionAnswerTitles "personName": this.name,
"idCard": this.idCard,
"tel": this.tel,
questionAnswerTitles: _questionAnswerTitles,
} }
console.log("提交数据", obj);
saveReportInfoAnswerValue(obj) saveReportInfoAnswerValue(obj)
.then(_data => { .then(_data => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '保存成功' title: '保存成功'
}); });
uni.navigateBack({ this.communityId = "";
delta: 1
})
}, err => { }, err => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: err title: err
}) })
}) })
}}
}
}
}; };
</script> </script>
<style> <style>