Parcourir la source

feature_20250926_数字题型&单行文本题型

zhujindu il y a 1 mois
Parent
commit
1e079be52e
1 fichiers modifiés avec 427 ajouts et 8 suppressions
  1. 427 8
      src/views/deviceWithin/addStoreVisit.vue

+ 427 - 8
src/views/deviceWithin/addStoreVisit.vue

@@ -466,6 +466,48 @@
               :photoIdentifyType="photoIdentifyType"
               :imgs="item.fileInfoList"></delete-upload-img>
           </div>
+          <div v-if="item.answerType == 'xm'" class="formLabel z-cell">
+            <van-cell>
+              <template #title
+                ><span v-if="item.isMust == 0" class="van-f-red">*</span>
+                <span>{{ 1 + index + '.' }}</span>
+                {{ item.collectionName }}
+                <!-- 操作说明图片和电话 -->
+                <taskTips
+                  v-if="item.contactPhone || item.examplePhoto"
+                  :contactPhone="item.contactPhone"
+                  :examplePhoto="item.examplePhoto">
+                </taskTips
+              ></template>
+              <template #right-icon>
+                <span v-if="item.isMustPicture == '0'" class="van-f-red">*</span>
+                <van-icon
+                  v-if="item.isPicture == 0"
+                  color="#666"
+                  name="photograph"
+                  size="24"
+                  @click="imgClick(item, 'A', index)" />
+              </template>
+            </van-cell>
+            <van-field
+              v-model="item.answerValue"
+              :formatter="xmFormatter"
+              @blur="XMsizeComparison(item, 'A')"
+              :placeholder="item.collectionOptionList[0].collectionOption"
+              :error-message="item.ruleMessage"></van-field>
+            <p
+              style="color: #444; font-size: 12px; margin: 0; text-align: right; position: relative"
+              v-if="item.showHistory == 1">
+              <span
+                style="color: #00afff; position: absolute; top: 8px; right: 0px"
+                @click="getCollectionShowHistory(item)"
+                >回显历史</span
+              >
+            </p>
+            <delete-upload-img
+              :photoIdentifyType="photoIdentifyType"
+              :imgs="item.fileInfoList"></delete-upload-img>
+          </div>
           <div v-if="item.answerType == 'duox'" class="formLabel z-cell">
             <van-cell>
               <template #title
@@ -778,6 +820,55 @@
                         :photoIdentifyType="photoIdentifyType"
                         :imgs="childitem.fileInfoList"></delete-upload-img>
                     </div>
+                    <div v-if="childitem.answerType == 'xm'" class="formLabel z-cell">
+                      <van-cell>
+                        <template #title>
+                          <span v-if="childitem.isMust == 0" class="van-f-red">*</span>
+                          <span>{{ 1 + index + '.' }}</span>
+                          <span>{{ 1 + childIndex + '.' }}</span>
+                          {{ childitem.collectionName }}
+                          <!-- 操作说明图片和电话 -->
+                          <taskTips
+                            v-if="childitem.contactPhone || childitem.examplePhoto"
+                            :contactPhone="childitem.contactPhone"
+                            :examplePhoto="childitem.examplePhoto">
+                          </taskTips>
+                        </template>
+                        <template #right-icon>
+                          <span v-if="childitem.isMustPicture == '0'" class="van-f-red">*</span>
+                          <van-icon
+                            v-if="childitem.isPicture == 0"
+                            color="#666"
+                            name="photograph"
+                            size="24"
+                            @click="imgClick(childitem, 'B', index, childIndex)" />
+                        </template>
+                      </van-cell>
+                      <van-field
+                        v-model="childitem.collectionOptionList[0].answerValue"
+                        :formatter="xmFormatter"
+                        @blur="XMsizeComparison(childitem)"
+                        :placeholder="childitem.collectionOptionList[0].collectionOption"
+                        :error-message="childitem.collectionOptionList[0].ruleMessage"></van-field>
+                      <p
+                        style="
+                          color: #444;
+                          font-size: 12px;
+                          margin: 0;
+                          text-align: right;
+                          position: relative;
+                        "
+                        v-if="childitem.showHistory == 1">
+                        <span
+                          style="color: #00afff; position: absolute; top: 8px; right: 0px"
+                          @click="getCollectionShowHistory(childitem)"
+                          >回显历史</span
+                        >
+                      </p>
+                      <delete-upload-img
+                        :photoIdentifyType="photoIdentifyType"
+                        :imgs="childitem.fileInfoList"></delete-upload-img>
+                    </div>
                     <div v-if="childitem.answerType == 'sz'" class="formLabel z-cell">
                       <van-cell>
                         <template #title>
@@ -1194,6 +1285,70 @@
                                   :photoIdentifyType="photoIdentifyType"
                                   :imgs="childitem1.fileInfoList"></delete-upload-img>
                               </div>
+                              <div v-if="childitem1.answerType == 'xm'" class="formLabel z-cell">
+                                <van-cell>
+                                  <template #title
+                                    ><span v-if="childitem1.isMust == 0" class="van-f-red">*</span>
+                                    <span>{{ 1 + index + '.' }}</span>
+                                    <span>{{ 1 + childIndex + '.' }}</span>
+                                    <span>{{ 1 + childIndex1 + '.' }}</span>
+                                    {{ childitem1.collectionName }}
+                                    <!-- 操作说明图片和电话 -->
+                                    <taskTips
+                                      v-if="childitem1.contactPhone || childitem1.examplePhoto"
+                                      :contactPhone="childitem1.contactPhone"
+                                      :examplePhoto="childitem1.examplePhoto">
+                                    </taskTips
+                                  ></template>
+                                  <template #right-icon>
+                                    <span v-if="childitem1.isMustPicture == '0'" class="van-f-red"
+                                      >*</span
+                                    >
+                                    <van-icon
+                                      v-if="childitem1.isPicture == 0"
+                                      color="#666"
+                                      name="photograph"
+                                      size="24"
+                                      @click="
+                                        imgClick(
+                                          childitem1,
+                                          'C',
+                                          index,
+                                          childIndex,
+                                          indexc,
+                                          indexc1,
+                                          childIndex1
+                                        )
+                                      " />
+                                  </template>
+                                </van-cell>
+                                <van-field
+                                  v-model="childitem1.collectionOptionList[0].answerValue"
+                                  :formatter="xmFormatter"
+                                  @blur="XMsizeComparison(childitem1)"
+                                  :placeholder="childitem1.collectionOptionList[0].collectionOption"
+                                  :error-message="
+                                    childitem1.collectionOptionList[0].ruleMessage
+                                  "></van-field>
+                                <p
+                                  style="
+                                    color: #444;
+                                    font-size: 12px;
+                                    margin: 0;
+                                    text-align: right;
+                                    position: relative;
+                                  "
+                                  v-if="childitem1.showHistory == 1">
+                                  <span
+                                    style="color: #00afff; position: absolute; top: 8px; right: 0px"
+                                    @click="getCollectionShowHistory(childitem1)"
+                                    >回显历史</span
+                                  >
+                                </p>
+                                <delete-upload-img
+                                  :photoIdentifyType="photoIdentifyType"
+                                  :imgs="childitem1.fileInfoList"></delete-upload-img>
+                              </div>
                               <div v-if="childitem1.answerType == 'date'" class="formLabel z-cell">
                                 <van-cell>
                                   <template #title>
@@ -1626,6 +1781,94 @@
                                             :photoIdentifyType="photoIdentifyType"
                                             :imgs="child33item1.fileInfoList"></delete-upload-img>
                                         </div>
+                                        <div
+                                          v-if="child33item1.answerType == 'xm'"
+                                          class="formLabel z-cell">
+                                          <van-cell>
+                                            <template #title>
+                                              <span
+                                                v-if="child33item1.isMust == 0"
+                                                class="van-f-red"
+                                                >*</span
+                                              >
+                                              <span>{{ 1 + index + '.' }}</span>
+                                              <span>{{ 1 + childIndex + '.' }}</span>
+                                              <span>{{ 1 + childIndex1 + '.' }}</span>
+                                              <span>{{ 1 + child33Index1 + '.' }}</span>
+                                              {{ child33item1.collectionName }}
+                                              <!-- 操作说明图片和电话 -->
+                                              <taskTips
+                                                v-if="
+                                                  child33item1.contactPhone ||
+                                                  child33item1.examplePhoto
+                                                "
+                                                :contactPhone="child33item1.contactPhone"
+                                                :examplePhoto="child33item1.examplePhoto">
+                                              </taskTips
+                                            ></template>
+                                            <template #right-icon>
+                                              <span
+                                                v-if="child33item1.isMustPicture == '0'"
+                                                class="van-f-red"
+                                                >*</span
+                                              >
+                                              <van-icon
+                                                v-if="child33item1.isPicture == 0"
+                                                color="#666"
+                                                name="photograph"
+                                                size="24"
+                                                @click="
+                                                  imgClick(
+                                                    child33item1,
+                                                    'D',
+                                                    index,
+                                                    childIndex,
+                                                    indexc,
+                                                    indexc1,
+                                                    childIndex1,
+                                                    indexc33,
+                                                    child33Index1
+                                                  )
+                                                " />
+                                            </template>
+                                          </van-cell>
+                                          <van-field
+                                            v-model="
+                                              child33item1.collectionOptionList[0].answerValue
+                                            "
+                                            :formatter="xmFormatter"
+                                            @blur="XMsizeComparison(child33item1)"
+                                            :placeholder="
+                                              child33item1.collectionOptionList[0].collectionOption
+                                            "
+                                            :error-message="
+                                              child33item1.collectionOptionList[0].ruleMessage
+                                            "></van-field>
+                                          <p
+                                            style="
+                                              color: #444;
+                                              font-size: 12px;
+                                              margin: 0;
+                                              text-align: right;
+                                              position: relative;
+                                            "
+                                            v-if="child33item1.showHistory == 1">
+                                            <span
+                                              style="
+                                                color: #00afff;
+                                                position: absolute;
+                                                top: 8px;
+                                                right: 0px;
+                                              "
+                                              v-if="child33item1.showHistory == 1"
+                                              @click="getCollectionShowHistory(child33item1)"
+                                              >回显历史</span
+                                            >
+                                          </p>
+                                          <delete-upload-img
+                                            :photoIdentifyType="photoIdentifyType"
+                                            :imgs="child33item1.fileInfoList"></delete-upload-img>
+                                        </div>
                                         <div
                                           v-if="child33item1.answerType == 'date'"
                                           class="formLabel z-cell">
@@ -2392,6 +2635,103 @@
                                                         child44item1.fileInfoList
                                                       "></delete-upload-img>
                                                   </div>
+                                                  <div
+                                                    v-if="child44item1.answerType == 'xm'"
+                                                    class="formLabel z-cell">
+                                                    <van-cell>
+                                                      <template #title
+                                                        ><span
+                                                          v-if="child44item1.isMust == 0"
+                                                          class="van-f-red"
+                                                          >*</span
+                                                        >
+                                                        <span>{{ 1 + index + '.' }}</span>
+                                                        <span>{{ 1 + childIndex + '.' }}</span>
+                                                        <span>{{ 1 + childIndex1 + '.' }}</span>
+                                                        <span>{{ 1 + child33Index1 + '.' }}</span>
+                                                        <span>{{ 1 + child44Index1 + '.' }}</span>
+                                                        {{ child44item1.collectionName }}
+                                                        <!-- 操作说明图片和电话 -->
+                                                        <taskTips
+                                                          v-if="
+                                                            child44item1.contactPhone ||
+                                                            child44item1.examplePhoto
+                                                          "
+                                                          :contactPhone="child44item1.contactPhone"
+                                                          :examplePhoto="child44item1.examplePhoto">
+                                                        </taskTips
+                                                      ></template>
+                                                      <template #right-icon>
+                                                        <span
+                                                          v-if="child44item1.isMustPicture == '0'"
+                                                          class="van-f-red"
+                                                          >*</span
+                                                        >
+                                                        <van-icon
+                                                          v-if="child44item1.isPicture == 0"
+                                                          color="#666"
+                                                          name="photograph"
+                                                          size="24"
+                                                          @click="
+                                                            imgClick(
+                                                              child44item1,
+                                                              'E',
+                                                              index,
+                                                              childIndex,
+                                                              indexc,
+                                                              indexc1,
+                                                              childIndex1,
+                                                              indexc33,
+                                                              child33Index1,
+                                                              indexc44,
+                                                              child44Index1
+                                                            )
+                                                          " />
+                                                      </template>
+                                                    </van-cell>
+                                                    <van-field
+                                                      v-model="
+                                                        child44item1.collectionOptionList[0]
+                                                          .answerValue
+                                                      "
+                                                      :formatter="xmFormatter"
+                                                      @blur="XMsizeComparison(child44item1)"
+                                                      :placeholder="
+                                                        child44item1.collectionOptionList[0]
+                                                          .collectionOption
+                                                      "
+                                                      :error-message="
+                                                        child44item1.collectionOptionList[0]
+                                                          .ruleMessage
+                                                      "></van-field>
+                                                    <p
+                                                      style="
+                                                        color: #444;
+                                                        font-size: 12px;
+                                                        margin: 0;
+                                                        text-align: right;
+                                                        position: relative;
+                                                      "
+                                                      v-if="child44item1.showHistory == 1">
+                                                      <span
+                                                        style="
+                                                          color: #00afff;
+                                                          position: absolute;
+                                                          top: 8px;
+                                                          right: 0px;
+                                                        "
+                                                        @click="
+                                                          getCollectionShowHistory(child44item1)
+                                                        "
+                                                        >回显历史</span
+                                                      >
+                                                    </p>
+                                                    <delete-upload-img
+                                                      :photoIdentifyType="photoIdentifyType"
+                                                      :imgs="
+                                                        child44item1.fileInfoList
+                                                      "></delete-upload-img>
+                                                  </div>
                                                   <div
                                                     v-if="child44item1.answerType == 'date'"
                                                     class="formLabel z-cell">
@@ -4035,7 +4375,64 @@ export default {
     // 且只可输入:汉字、数字、字母、标点符号, 特殊字符:空格、换行、表情等不可输入
     dhwbFormatter(value) {
       return value.replace(
-        /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030|\s*/gi,
+        /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030|\s*/gi,
+        ''
+      );
+    },
+    XMsizeComparison(item, type) {
+      // type == A 是一级,answerValue 在当前层级,否则在子集collectionOptionList
+      let answerValue = null;
+      let itemData = null;
+      if (type == 'A') {
+        answerValue = item.answerValue;
+        itemData = item;
+      } else {
+        answerValue = item.collectionOptionList[0].answerValue;
+        itemData = item.collectionOptionList[0];
+      }
+      let value = answerValue;
+      if (value) {
+        // 最大值
+        let maxValue = item.collectionOptionList[0].maxValue;
+        if (maxValue && maxValue != '') {
+          if (value.length > Number(maxValue)) {
+            // this.$set(itemData, 'answerValue', '');
+            this.$set(itemData, 'ruleMessage', '最大字数为:' + maxValue);
+            // this.$toast('输入内容不合法');
+            this.validatorFlag = false;
+            return;
+          }
+        }
+        //最小值
+        let minValue = item.collectionOptionList[0].minValue;
+        if (minValue && minValue != '') {
+          if (value.length < Number(minValue)) {
+            // this.$set(itemData, 'answerValue', '');
+            this.$set(itemData, 'ruleMessage', '最小字数为:' + minValue);
+            // this.$toast('输入内容不合法');
+            this.validatorFlag = false;
+            return;
+          }
+        }
+        // 至少一个汉字
+        let leastOneChinese = item.collectionOptionList[0].leastOneChinese;
+        if (leastOneChinese == '1') {
+          if (!/[\u4e00-\u9fa5]/.test(value)) {
+            // this.$set(itemData, 'answerValue', '');
+            this.$set(itemData, 'ruleMessage', '至少有一个汉字');
+            // this.$toast('输入内容不合法,至少有一个汉字');
+            this.validatorFlag = false;
+            return;
+          }
+        }
+        this.$set(itemData, 'ruleMessage', '');
+      } else {
+        // this.$set(itemData, 'ruleMessage', '请输入至少有一个汉字');
+      }
+    },
+    xmFormatter(value) {
+      return value.replace(
+        /[0-9]|[a-zA-Z]|[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030|\s*/gi,
         ''
       );
     },
@@ -4149,7 +4546,8 @@ export default {
               collectionItemLists[q].answerType == 'tel_send_code' ||
               collectionItemLists[q].answerType == 'check_code' ||
               collectionItemLists[q].answerType == 'nyr' ||
-              collectionItemLists[q].answerType == 'dhwb'
+              collectionItemLists[q].answerType == 'dhwb' ||
+              collectionItemLists[q].answerType == 'xm'
             ) {
               collectionItemLists[q].answerValue =
                 collectionItemLists[q].collectionOptionList[0].answerValue;
@@ -4177,6 +4575,10 @@ export default {
             if (collectionItemLists[q].answerType == 'sz') {
               this.SZsizeComparison(collectionItemLists[q], 'A');
             }
+            // xm 初始化内容校验
+            if (collectionItemLists[q].answerType == 'xm') {
+              this.XMsizeComparison(collectionItemLists[q], 'A');
+            }
             if (
               collectionItemLists[q].answerType == 'duox' ||
               collectionItemLists[q].answerType == 'dx'
@@ -4204,7 +4606,8 @@ export default {
                       }
                       if (
                         listchild[qq1].answerType == 'wb' ||
-                        listchild[qq1].answerType == 'dhwb'
+                        listchild[qq1].answerType == 'dhwb' ||
+                        listchild[qq1].answerType == 'xm'
                       ) {
                         if (listchild[qq1].collectionOptionList[0].answerValue != null) {
                           listchild[qq1].answerValue =
@@ -4221,6 +4624,10 @@ export default {
                       if (listchild[qq1].answerType == 'sz') {
                         this.SZsizeComparison(listchild[qq1]);
                       }
+                      // xm 初始化内容校验
+                      if (listchild[qq1].answerType == 'xm') {
+                        this.XMsizeComparison(listchild[qq1]);
+                      }
                       if (listchild[qq1].answerType == 'sm') {
                         listchild[qq1].success = false;
                         if (listchild[qq1].collectionOptionList[0].answerValue != null) {
@@ -4369,6 +4776,10 @@ export default {
                               if (list3[l3].collectionItems[l3q].answerType == 'sz') {
                                 this.SZsizeComparison(list3[l3].collectionItems[l3q]);
                               }
+                              // xm 初始化内容校验
+                              if (list3[l3].collectionItems[l3q].answerType == 'xm') {
+                                this.XMsizeComparison(list3[l3].collectionItems[l3q]);
+                              }
                             }
                           }
                           // console.log(list3[l3])
@@ -5100,6 +5511,9 @@ export default {
         if (collectionItemList.answerType == 'sz') {
           this.SZsizeComparison(collectionItemList, type);
         }
+        if (collectionItemList.answerType == 'xm') {
+          this.XMsizeComparison(collectionItemList, type);
+        }
       }
     },
     onSubmit() {
@@ -5151,7 +5565,8 @@ export default {
             this.collectionItemList[b].answerType == 'tel_send_code' ||
             this.collectionItemList[b].answerType == 'check_code' ||
             this.collectionItemList[b].answerType == 'nyr' ||
-            this.collectionItemList[b].answerType == 'dhwb'
+            this.collectionItemList[b].answerType == 'dhwb' ||
+            this.collectionItemList[b].answerType == 'xm'
           ) {
             formData.collectionAnswers.push({
               collectionId: this.collectionItemList[b].collectionId,
@@ -5208,7 +5623,8 @@ export default {
                     listDatas[f2].answerType == 'tel_send_code' ||
                     listDatas[f2].answerType == 'check_code' ||
                     listDatas[f2].answerType == 'nyr' ||
-                    listDatas[f2].answerType == 'dhwb'
+                    listDatas[f2].answerType == 'dhwb' ||
+                    listDatas[f2].answerType == 'xm'
                   ) {
                     formData.collectionAnswers.push({
                       collectionId: listDatas[f2].collectionId,
@@ -5279,7 +5695,8 @@ export default {
                             listDatas2[f10].answerType == 'tel_send_code' ||
                             listDatas2[f10].answerType == 'check_code' ||
                             listDatas2[f10].answerType == 'nyr' ||
-                            listDatas2[f10].answerType == 'dhwb'
+                            listDatas2[f10].answerType == 'dhwb' ||
+                            listDatas2[f10].answerType == 'xm'
                           ) {
                             formData.collectionAnswers.push({
                               collectionId: listDatas2[f10].collectionId,
@@ -5369,7 +5786,8 @@ export default {
                                     listc4[fc4].answerType == 'tel_send_code' ||
                                     listc4[fc4].answerType == 'check_code' ||
                                     listc4[fc4].answerType == 'nyr' ||
-                                    listc4[fc4].answerType == 'dhwb'
+                                    listc4[fc4].answerType == 'dhwb' ||
+                                    listc4[fc4].answerType == 'xm'
                                   ) {
                                     formData.collectionAnswers.push({
                                       collectionId: listc4[fc4].collectionId,
@@ -5474,7 +5892,8 @@ export default {
                                             listc5[fc5].answerType == 'tel_send_code' ||
                                             listc5[fc5].answerType == 'check_code' ||
                                             listc5[fc5].answerType == 'nyr' ||
-                                            listc5[fc5].answerType == 'dhwb'
+                                            listc5[fc5].answerType == 'dhwb' ||
+                                            listc5[fc5].answerType == 'xm'
                                           ) {
                                             formData.collectionAnswers.push({
                                               collectionId: listc5[fc5].collectionId,