|
|
@@ -391,27 +391,33 @@ export default {
|
|
|
isRequiredFlag(optionList) {
|
|
|
// console.log(optionList);
|
|
|
for (let i = 0; i < optionList.length; i++) {
|
|
|
- if (
|
|
|
- (optionList[i].answerType == 'wb' ||
|
|
|
- optionList[i].answerType == 'sz' ||
|
|
|
- optionList[i].answerType == 'zp') &&
|
|
|
- optionList[i].isMust == 0
|
|
|
- ) {
|
|
|
- if (!optionList[i].answerValue) {
|
|
|
- // 必填类型
|
|
|
- this.requiredFlag = false;
|
|
|
- this.requiredMessage = optionList[i].remark;
|
|
|
- return;
|
|
|
- } else {
|
|
|
- // 条件校验
|
|
|
- if (optionList[i].minTextLength) {
|
|
|
- // 输入内容长度校验
|
|
|
- if (optionList[i].answerValue.length < optionList[i].minTextLength) {
|
|
|
- this.requiredFlag = false;
|
|
|
- this.requiredMessage = optionList[i].remark;
|
|
|
- return;
|
|
|
+ // 是否必填
|
|
|
+ if (optionList[i].isMust == 0) {
|
|
|
+ // 输入框
|
|
|
+ if (optionList[i].answerType == 'wb' || optionList[i].answerType == 'sz') {
|
|
|
+ if (!optionList[i].answerValue) {
|
|
|
+ // 必填类型
|
|
|
+ this.requiredFlag = false;
|
|
|
+ this.requiredMessage = optionList[i].remark;
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ // 条件校验
|
|
|
+ if (optionList[i].minTextLength) {
|
|
|
+ // 输入内容长度校验
|
|
|
+ if (optionList[i].answerValue.length < optionList[i].minTextLength) {
|
|
|
+ this.requiredFlag = false;
|
|
|
+ this.requiredMessage = optionList[i].remark;
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } else if (optionList[i].answerType == 'zp') {
|
|
|
+ // 照片
|
|
|
+ if (!optionList[i].fileInfoList || !optionList[i].fileInfoList.length) {
|
|
|
+ this.requiredFlag = false;
|
|
|
+ this.requiredMessage = optionList[i].remark;
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|