Explorar o código

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

zhujindu hai 2 meses
pai
achega
ca9e0706df
Modificáronse 1 ficheiros con 462 adicións e 18 borrados
  1. 462 18
      src/views/agentList/visitTask.vue

+ 462 - 18
src/views/agentList/visitTask.vue

@@ -153,8 +153,7 @@
               <van-field
                 v-model="item.answerValue"
                 :placeholder="item.text"
-                type="number"
-                @input="numberFn(item, index, 'A')"></van-field>
+                @blur="SZsizeComparison(item)"></van-field>
               <p
                 style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
                 <van-field
@@ -323,6 +322,57 @@
                 :photoIdentifyType="photoIdentifyType"
                 :imgs="item.fileInfoList"></delete-upload-img>
             </div>
+            <div v-if="item.answerType == 'dhwb'" class="formLabel z-cell">
+              <van-cell>
+                <template #title
+                  ><span v-if="item.isMust == 0" class="van-f-red">*</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'" style="color: 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="dhwbFormatter"
+                @blur="DHWBsizeComparison(item, index)"
+                :placeholder="item.text"></van-field>
+              <p
+                style="
+                  color: #444;
+                  font-size: 12px;
+                  margin: 0;
+                  text-align: right;
+                  position: relative;
+                ">
+                <van-field
+                  class="mobile-input"
+                  v-model="item.collectionOptionList[0].collectionOption"
+                  autosize
+                  readonly
+                  type="textarea" />
+                <span
+                  style="color: #00afff; position: absolute; top: 8px; right: 0px"
+                  v-if="item.showHistory == 1"
+                  @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
@@ -504,6 +554,60 @@
                           :photoIdentifyType="photoIdentifyType"
                           :imgs="childitem.fileInfoList"></delete-upload-img>
                       </div>
+                      <div v-if="childitem.answerType == 'dhwb'" class="formLabel z-cell">
+                        <van-cell>
+                          <template #title>
+                            <span v-if="childitem.isMust == 0" class="van-f-red">*</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'" style="color: 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="dhwbFormatter"
+                          @blur="DHWBsizeComparison(childitem)"
+                          :placeholder="childitem.text"></van-field>
+                        <p
+                          style="
+                            color: #444;
+                            font-size: 12px;
+                            margin: 0;
+                            text-align: right;
+                            position: relative;
+                          ">
+                          <van-field
+                            class="mobile-input"
+                            v-model="childitem.collectionOptionList[0].collectionOption"
+                            autosize
+                            readonly
+                            type="textarea" />
+                          <span
+                            style="color: #00afff; position: absolute; top: 8px; right: 0px"
+                            v-if="childitem.showHistory == 1"
+                            @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
@@ -531,8 +635,7 @@
                         <van-field
                           v-model="childitem.collectionOptionList[0].answerValue"
                           :placeholder="item.text"
-                          type="number"
-                          @input="numberFn(childitem, index)"></van-field>
+                          @blur="SZsizeComparison(childitem)"></van-field>
                         <p
                           style="
                             color: #444;
@@ -888,6 +991,77 @@
                                     :photoIdentifyType="photoIdentifyType"
                                     :imgs="childitem1.fileInfoList"></delete-upload-img>
                                 </div>
+                                <div
+                                  v-if="childitem1.answerType == 'dhwb'"
+                                  class="formLabel z-cell">
+                                  <van-cell>
+                                    <template #title
+                                      ><span v-if="childitem1.isMust == 0" class="van-f-red">*</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'" style="color: 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="dhwbFormatter"
+                                    @blur="DHWBsizeComparison(childitem1)"
+                                    :placeholder="childitem1.text"></van-field>
+                                  <p
+                                    style="
+                                      color: #444;
+                                      font-size: 12px;
+                                      margin: 0;
+                                      text-align: right;
+                                      position: relative;
+                                    ">
+                                    <van-field
+                                      class="mobile-input"
+                                      v-model="childitem1.collectionOptionList[0].collectionOption"
+                                      autosize
+                                      readonly
+                                      type="textarea" />
+                                    <span
+                                      style="
+                                        color: #00afff;
+                                        position: absolute;
+                                        top: 8px;
+                                        right: 0px;
+                                      "
+                                      v-if="childitem1.showHistory == 1"
+                                      @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">
@@ -1235,6 +1409,92 @@
                                               :photoIdentifyType="photoIdentifyType"
                                               :imgs="child33item1.fileInfoList"></delete-upload-img>
                                           </div>
+                                          <div
+                                            v-if="child33item1.answerType == 'dhwb'"
+                                            class="formLabel z-cell">
+                                            <van-cell>
+                                              <template #title
+                                                ><span
+                                                  v-if="child33item1.isMust == 0"
+                                                  class="van-f-red"
+                                                  >*</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'"
+                                                  style="color: 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="dhwbFormatter"
+                                              @blur="DHWBsizeComparison(child33item1)"
+                                              :placeholder="child33item1.text"></van-field>
+                                            <p
+                                              style="
+                                                color: #444;
+                                                font-size: 12px;
+                                                margin: 0;
+                                                text-align: right;
+                                                position: relative;
+                                              ">
+                                              <van-field
+                                                class="mobile-input"
+                                                v-model="
+                                                  child33item1.collectionOptionList[0]
+                                                    .collectionOption
+                                                "
+                                                autosize
+                                                readonly
+                                                type="textarea" />
+                                              <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">
@@ -1449,8 +1709,7 @@
                                                 child33item1.collectionOptionList[0].answerValue
                                               "
                                               :placeholder="child33item1.text"
-                                              type="number"
-                                              @input="numberFn(child33item1, index)"></van-field>
+                                              @blur="SZsizeComparison(child33item1)"></van-field>
                                             <p
                                               style="
                                                 color: #444;
@@ -1863,6 +2122,105 @@
                                                           child44item1.fileInfoList
                                                         "></delete-upload-img>
                                                     </div>
+                                                    <div
+                                                      v-if="child44item1.answerType == 'dhwb'"
+                                                      class="formLabel z-cell">
+                                                      <van-cell>
+                                                        <template #title
+                                                          ><span
+                                                            v-if="child44item1.isMust == 0"
+                                                            class="van-f-red"
+                                                            >*</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'"
+                                                            style="color: 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="dhwbFormatter"
+                                                        @blur="DHWBsizeComparison(child44item1)"
+                                                        :placeholder="
+                                                          child44item1.text
+                                                        "></van-field>
+                                                      <p
+                                                        style="
+                                                          color: #444;
+                                                          font-size: 12px;
+                                                          margin: 0;
+                                                          text-align: right;
+                                                          position: relative;
+                                                        ">
+                                                        <van-field
+                                                          class="mobile-input"
+                                                          v-model="
+                                                            child44item1.collectionOptionList[0]
+                                                              .collectionOption
+                                                          "
+                                                          autosize
+                                                          readonly
+                                                          type="textarea" />
+                                                        <span
+                                                          style="
+                                                            color: #00afff;
+                                                            position: absolute;
+                                                            top: 8px;
+                                                            right: 0px;
+                                                          "
+                                                          v-if="child44item1.showHistory == 1"
+                                                          @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">
@@ -2111,9 +2469,8 @@
                                                             .answerValue
                                                         "
                                                         :placeholder="child44item1.text"
-                                                        type="number"
-                                                        @input="
-                                                          numberFn(child44item1, child44Index1)
+                                                        @blur="
+                                                          SZsizeComparison(child44item1)
                                                         "></van-field>
                                                       <p
                                                         style="
@@ -2508,8 +2865,7 @@
                                   <van-field
                                     v-model="childitem1.collectionOptionList[0].answerValue"
                                     :placeholder="item.text"
-                                    type="number"
-                                    @input="numberFn(childitem1, index)"></van-field>
+                                    @blur="SZsizeComparison(childitem1)"></van-field>
                                   <p
                                     style="
                                       color: #444;
@@ -3260,6 +3616,85 @@ export default {
         }
       }
     },
+    // 数字类型最大值最小值校验
+    SZsizeComparison(item, index) {
+      let value = item.answerValue.replace(
+        /[^-\d.]|(?<!\d)\.|\.(?!\d)|^[.]$|^[+-]$|^[+-]\.$|(?<=\.\d*)\.|(?<=\d\.\d*)\.(?=\d)/g,
+        ''
+      );
+      this.$set(item, 'answerValue', value);
+      if (value) {
+        // 最大值
+        let maxValue = item.collectionOptionList[0].maxValue;
+        if (maxValue && maxValue != '') {
+          if (value > Number(maxValue)) {
+            // this.collectionItemList[index].answerValue = value.slice(0, -1);
+            // this.$toast(
+            //   this.collectionItemList[index].collectionName + '最大输入值为:' + maxValue
+            // );
+            this.$set(item, 'answerValue', '');
+            this.$toast('输入内容不合法');
+          }
+        }
+        //最小值
+        let minValue = item.collectionOptionList[0].minValue;
+        if (minValue && minValue != '') {
+          if (value < Number(minValue)) {
+            // this.collectionItemList[index].answerValue = minValue;
+            // this.$toast(
+            //   this.collectionItemList[index].collectionName + '最小输入值为:' + minValue
+            // );
+            this.$set(item, 'answerValue', '');
+            this.$toast('输入内容不合法');
+          }
+        }
+      }
+    },
+    // dhwb 单行文本校验
+    DHWBsizeComparison(item, index) {
+      let value = item.answerValue;
+      if (value) {
+        // 最大值
+        let maxValue = item.collectionOptionList[0].maxValue;
+        if (maxValue && maxValue != '') {
+          if (value.length > Number(maxValue)) {
+            // this.collectionItemList[index].answerValue = value.slice(0, -1);
+            // this.$toast(
+            //   this.collectionItemList[index].collectionName + '最大输入值为:' + maxValue
+            // );
+            this.$set(item, 'answerValue', '');
+            this.$toast('输入内容不合法');
+          }
+        }
+        //最小值
+        let minValue = item.collectionOptionList[0].minValue;
+        if (minValue && minValue != '') {
+          if (value.length < Number(minValue)) {
+            // this.collectionItemList[index].answerValue = minValue;
+            // this.$toast(
+            //   this.collectionItemList[index].collectionName + '最小输入值为:' + minValue
+            // );
+            this.$set(item, 'answerValue', '');
+            this.$toast('输入内容不合法');
+          }
+        }
+        // 至少一个汉字
+        let leastOneChinese = item.collectionOptionList[0].leastOneChinese;
+        if (leastOneChinese == '1') {
+          if (!/[\u4e00-\u9fa5]/.test(value)) {
+            this.$set(item, 'answerValue', '');
+            this.$toast('输入内容不合法,至少有一个汉字');
+          }
+        }
+      }
+    },
+    // 且只可输入:汉字、数字、字母、标点符号, 特殊字符:空格、换行、表情等不可输入
+    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,
+        ''
+      );
+    },
     logshowFN() {
       this.logshow = true;
     },
@@ -3359,7 +3794,8 @@ export default {
               collectionItemLists[q].answerType == 'wb' ||
               collectionItemLists[q].answerType == 'sm' ||
               collectionItemLists[q].answerType == 'tel' ||
-              collectionItemLists[q].answerType == 'date'
+              collectionItemLists[q].answerType == 'date' ||
+              collectionItemLists[q].answerType == 'dhwb'
             ) {
               collectionItemLists[q].answerValue =
                 collectionItemLists[q].collectionOptionList[0].answerValue;
@@ -3404,7 +3840,10 @@ export default {
                             listchild[qq1].collectionOptionList[0].answerValue;
                         }
                       }
-                      if (listchild[qq1].answerType == 'wb') {
+                      if (
+                        listchild[qq1].answerType == 'wb' ||
+                        listchild[qq1].answerType == 'dhwb'
+                      ) {
                         if (listchild[qq1].collectionOptionList[0].answerValue != null) {
                           listchild[qq1].answerValue =
                             listchild[qq1].collectionOptionList[0].answerValue;
@@ -4223,7 +4662,8 @@ export default {
             this.collectionItemList[b].answerType == 'sm' ||
             this.collectionItemList[b].answerType == 'wb' ||
             this.collectionItemList[b].answerType == 'tel' ||
-            this.collectionItemList[b].answerType == 'date'
+            this.collectionItemList[b].answerType == 'date' ||
+            this.collectionItemList[b].answerType == 'dhwb'
           ) {
             formData.collectionAnswers.push({
               collectionId: this.collectionItemList[b].collectionId,
@@ -4276,7 +4716,8 @@ export default {
                     listDatas[f2].answerType == 'wb' ||
                     listDatas[f2].answerType == 'sm' ||
                     listDatas[f2].answerType == 'tel' ||
-                    listDatas[f2].answerType == 'date'
+                    listDatas[f2].answerType == 'date' ||
+                    listDatas[f2].answerType == 'dhwb'
                   ) {
                     formData.collectionAnswers.push({
                       collectionId: listDatas[f2].collectionId,
@@ -4343,7 +4784,8 @@ export default {
                             listDatas2[f10].answerType == 'wb' ||
                             listDatas2[f10].answerType == 'sm' ||
                             listDatas2[f10].answerType == 'date' ||
-                            listDatas2[f10].answerType == 'tel'
+                            listDatas2[f10].answerType == 'tel' ||
+                            listDatas2[f10].answerType == 'dhwb'
                           ) {
                             formData.collectionAnswers.push({
                               collectionId: listDatas2[f10].collectionId,
@@ -4429,7 +4871,8 @@ export default {
                                     listc4[fc4].answerType == 'wb' ||
                                     listc4[fc4].answerType == 'sm' ||
                                     listc4[fc4].answerType == 'date' ||
-                                    listc4[fc4].answerType == 'tel'
+                                    listc4[fc4].answerType == 'tel' ||
+                                    listc4[fc4].answerType == 'dhwb'
                                   ) {
                                     formData.collectionAnswers.push({
                                       collectionId: listc4[fc4].collectionId,
@@ -4530,7 +4973,8 @@ export default {
                                             listc5[fc5].answerType == 'wb' ||
                                             listc5[fc5].answerType == 'sm' ||
                                             listc5[fc5].answerType == 'date' ||
-                                            listc5[fc5].answerType == 'tel'
+                                            listc5[fc5].answerType == 'tel' ||
+                                            listc5[fc5].answerType == 'dhwb'
                                           ) {
                                             formData.collectionAnswers.push({
                                               collectionId: listc5[fc5].collectionId,