Bladeren bron

Merge branch 'feature_20251117_日报填写内容自定义配置' into uat(dev)

# Conflicts:
#	src/views/week/dailyDetails.vue
zhujindu 2 weken geleden
bovenliggende
commit
903044a3d1

+ 113 - 0
src/components/componentZCheckbox.vue

@@ -0,0 +1,113 @@
+<template>
+  <div class="zSelect">
+    <div>
+      <div class="checkbox">
+        <van-checkbox-group v-model="zSelectValuec" @change="checkboxclick">
+          <van-checkbox
+            :disabled="disabled"
+            :name="item[id] + ''"
+            v-for="(item, index) in zCheckboxcolumns"
+            :key="index"
+            shape="square"
+            >{{ item.customOption }}
+          </van-checkbox>
+        </van-checkbox-group>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'zSelect',
+  props: {
+    zCheckboxcolumns: [],
+    textc: '',
+    rules: false,
+    answerType: '',
+    collectionType: '',
+    disabled: false,
+    id: '',
+  },
+  data() {
+    return {
+      zSelect: false,
+      zSelectValuec: [],
+    };
+  },
+  watch: {
+    zCheckboxcolumns: {
+      // 返显
+      handler(val) {
+        this.zSelectValuec = [];
+        for (let i = 0; i < val.length; i++) {
+          if (val[i].answerValue == 'Y') {
+            this.zSelectValuec.push(String(val[i][this.id]));
+          }
+        }
+      },
+      immediate: true,
+    },
+  },
+  activated() {
+    // this.checkboxvalFn();
+  },
+  methods: {
+    checkboxvalFn() {
+      if (this.checkboxval == '' || this.checkboxval == undefined) {
+        this.zSelectValuec = [];
+      } else {
+        this.zSelectValuec = this.checkboxval.split(',');
+      }
+    },
+    checkboxclick(value) {
+      var typeval = [...this.zCheckboxcolumns];
+      typeval.forEach((item) => {
+        if (value.includes(item[this.id] + '')) {
+          item.answerValue = 'Y';
+        } else {
+          item.answerValue = 'N';
+        }
+      });
+      let datalist = {
+        id: this.textc,
+        answerValue: typeval,
+      };
+      this.zSelectValuec = value;
+      this.$emit('zSelectVal', datalist);
+      this.zSelect = false;
+    },
+  },
+};
+</script>
+
+<style scoped>
+.van-f-red {
+  color: red;
+  width: 4px;
+  display: inline-block;
+}
+
+.zSelect .z-cell {
+  padding: 10px 16px 0 16px;
+  font-size: 16px;
+}
+
+/*.checkbox{padding: 10px 16px 0 16px;background-color: white;}*/
+.checkbox .van-checkbox {
+  padding-bottom: 10px;
+}
+</style>
+<style lang="scss">
+.zSelect {
+  .checkbox .van-checkbox__icon .van-icon {
+    border: 1px solid #333 !important;
+  }
+
+  .checkbox .van-checkbox__icon--checked .van-icon {
+    border: 1px solid #1989fa !important;
+    color: #1989fa;
+    background-color: #fff;
+  }
+}
+</style>

+ 117 - 0
src/components/componentZRadio.vue

@@ -0,0 +1,117 @@
+<template>
+  <div class="zSelect">
+    <div class="checkbox">
+      <van-radio-group v-model="zradioc" @change="radiofn" :disabled="disabled">
+        <van-radio
+          :name="item[id] + ''"
+          @click="radioclick"
+          v-for="(item, index) in zRadiocolumns"
+          :key="index"
+          >{{ item.customOption }}</van-radio
+        >
+      </van-radio-group>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'zSelect',
+  props: {
+    textc: '',
+    zRadiocolumns: [],
+    answerType: '',
+    collectionType: '',
+    disabled: false,
+    id: '',
+  },
+  data() {
+    return {
+      radioChange: false,
+      zradioc: '',
+    };
+  },
+  watch: {
+    zRadiocolumns: {
+      // 返显
+      handler(val) {
+        for (let i = 0; i < val.length; i++) {
+          if (val[i].answerValue == 'Y') {
+            this.zradioc = String(val[i][this.id]);
+          }
+        }
+      },
+      immediate: true,
+    },
+  },
+  methods: {
+    radiofn(value) {
+      this.radioChange = true;
+      var typeval = [...this.zRadiocolumns];
+      for (var k = 0; k < this.zRadiocolumns.length; k++) {
+        typeval[k].answerValue = 'N';
+        if (this.zRadiocolumns[k][this.id] == value) {
+          typeval[k].answerValue = 'Y';
+        }
+      }
+      let datalist = {
+        id: this.textc,
+        answerValue: typeval,
+      };
+      this.$emit('zSelectVal', datalist);
+    },
+    radioclick() {
+      if (this.disabled) return;
+      if (!this.radioChange) {
+        this.zradioc = '';
+      }
+      this.radioChange = false;
+    },
+  },
+};
+</script>
+
+<style scoped>
+.van-f-red {
+  color: red;
+  width: 4px;
+  display: inline-block;
+}
+
+.zSelect .z-cell {
+  padding: 10px 16px 0 16px;
+  font-size: 16px;
+}
+
+.checkbox .van-radio {
+  padding-bottom: 10px;
+}
+</style>
+<style>
+.checkbox .van-radio__icon {
+  border: 1px solid #333;
+  border-radius: 80px;
+  width: 1em;
+}
+
+.checkbox .van-radio__icon .van-icon {
+  border: 0 !important;
+  height: 1em;
+  width: 1em;
+}
+
+.checkbox .van-radio__icon--checked .van-icon {
+  color: #1989fa;
+  background-color: #fff;
+  display: block;
+  height: 14px;
+  width: 14px;
+  margin: 2px auto;
+  background-color: #1989fa;
+  color: transparent;
+}
+
+.checkbox .van-radio__icon--checked {
+  border: 1px solid #1989fa;
+}
+</style>

+ 228 - 162
src/views/week/daily.vue

@@ -404,57 +404,67 @@
         </div>
       </van-collapse>
       <div class="contentContainer">
-        <div v-if="GZQuota">
-          <p class="contentContainerTitle">今日项目跟进数<span class="colorRed">(必填)</span></p>
-          <div style="padding: 10px 0">
-            <van-field v-model="reportContents[2].projectFollowNum" type="digit" />
+        <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
+        <reportCustom
+          ref="reportCustom"
+          v-if="reportTarget.isHistory == '0'"
+          :reportCustomData="reportTarget.customTaskList"></reportCustom>
+        <template v-else>
+          <div v-if="GZQuota">
+            <p class="contentContainerTitle">今日项目跟进数<span class="colorRed">(必填)</span></p>
+            <div style="padding: 10px 0">
+              <van-field v-model="reportContents[2].projectFollowNum" type="digit" />
+            </div>
+            <p class="contentContainerTitle">
+              今日TUC成功报备数量<span class="colorRed">(必填)</span>
+            </p>
+            <div style="padding: 10px 0">
+              <van-field v-model="reportContents[3].tucReportingSuccessNum" type="digit" />
+            </div>
+          </div>
+          <div
+            v-if="
+              (this.$route.query.reportId && notVisitReason) || reportTarget.showNotVisitReason
+            ">
+            <p class="contentContainerTitle">
+              截至日报提交时间,今日拜访0家店的原因<span class="colorRed">(必填)</span>
+            </p>
+            <div style="padding: 10px 0">
+              <van-field
+                v-model="notVisitReason"
+                rows="3"
+                autosize
+                maxlength="1000"
+                show-word-limit
+                type="textarea"
+                :formatter="formatter" />
+            </div>
           </div>
           <p class="contentContainerTitle">
-            今日TUC成功报备数量<span class="colorRed">(必填)</span>
+            今日机会与挑战总结<span class="colorRed">(必填)</span>
           </p>
           <div style="padding: 10px 0">
-            <van-field v-model="reportContents[3].tucReportingSuccessNum" type="digit" />
+            <van-field
+              v-model="reportContents[0].dayContent"
+              rows="4"
+              autosize
+              maxlength="800"
+              show-word-limit
+              type="textarea"
+              :formatter="formatter" />
           </div>
-        </div>
-        <!-- 今日未拜访原因 如果为false,则不展示;如果为true,则展示,需要展示“今日拜访0家店的原因” -->
-        <div
-          v-if="(this.$route.query.reportId && notVisitReason) || reportTarget.showNotVisitReason">
-          <p class="contentContainerTitle">
-            截至日报提交时间,今日拜访0家店的原因<span class="colorRed">(必填)</span>
-          </p>
+          <p class="contentContainerTitle">明日工作规划 <span class="colorRed">(必填)</span></p>
           <div style="padding: 10px 0">
             <van-field
-              v-model="notVisitReason"
-              rows="3"
+              v-model="reportContents[1].dayContent"
+              rows="4"
               autosize
-              maxlength="1000"
+              maxlength="800"
               show-word-limit
               type="textarea"
               :formatter="formatter" />
           </div>
-        </div>
-        <p class="contentContainerTitle">今日机会与挑战总结<span class="colorRed">(必填)</span></p>
-        <div style="padding: 10px 0">
-          <van-field
-            v-model="reportContents[0].dayContent"
-            rows="4"
-            autosize
-            maxlength="800"
-            show-word-limit
-            type="textarea"
-            :formatter="formatter" />
-        </div>
-        <p class="contentContainerTitle">明日工作规划 <span class="colorRed">(必填)</span></p>
-        <div style="padding: 10px 0">
-          <van-field
-            v-model="reportContents[1].dayContent"
-            rows="4"
-            autosize
-            maxlength="800"
-            show-word-limit
-            type="textarea"
-            :formatter="formatter" />
-        </div>
+        </template>
       </div>
       <br />
     </div>
@@ -485,6 +495,7 @@ import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
 import performanceSAP from '@/views/componentsTarget/performanceSAP';
 import ZYSAP from '@/views/componentsTarget/ZYSAP';
 import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
+import reportCustom from './reportCustom';
 
 export default {
   name: 'daily',
@@ -496,6 +507,7 @@ export default {
     performanceSAP,
     ZYSAP,
     veryGoodPlaceOrder,
+    reportCustom,
   },
   data() {
     return {
@@ -711,151 +723,205 @@ export default {
       });
     },
     tsContentsFn() {
-      let loading1 = this.$toast.loading({
-        duration: 0,
-        message: '数据提交中...',
-        forbidClick: true,
-      });
+      this.toastLoading(0, '加载中...', true);
       if (this.isclick) {
-        this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
-        this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
-        if (this.GZQuota) {
-          this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
-          this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
-        }
-        this.reportTarget.reportContents = this.reportContents;
-        this.reportTarget.notVisitReason = this.notVisitReason;
-        this.reportTarget.status = '1';
-        this.isclick = false;
-        tsContents(this.reportTarget).then((res) => {
-          loading1.clear();
-          this.isclick = true;
-          if (res.code == 200) {
-            this.$dialog
-              .alert({
-                title: '系统提示',
-                message: '暂存成功',
-              })
-              .then(() => {
-                // if(this.$route.query.reportId!=undefined){
-                //   window.location.replace(window.location.origin+"/mobile/myHistoricalDaily")
-                // }else{
-                //   window.location.replace(window.location.origin+"/mobile/home")
-                // }
-              });
-          } else {
-            this.$toast.fail(res.msg);
+        // 旧的
+        if (this.reportTarget.isHistory == '1') {
+          this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
+          this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
+          if (this.GZQuota) {
+            this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
+            this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
           }
-        });
+          this.reportTarget.reportContents = this.reportContents;
+          this.reportTarget.notVisitReason = this.notVisitReason;
+          this.tsContentsFun();
+        } else {
+          // 新的
+          this.filterReportCustomData((reportCustomAnswers) => {
+            this.tsContentsFun(reportCustomAnswers);
+          });
+        }
       }
     },
+    tsContentsFun(reportCustomAnswers) {
+      if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
+      this.reportTarget.status = '1';
+      this.isclick = false;
+      tsContents(this.reportTarget).then((res) => {
+        this.toastLoading().clear();
+        this.isclick = true;
+        if (res.code == 200) {
+          this.$dialog
+            .alert({
+              title: '系统提示',
+              message: '暂存成功',
+            })
+            .then(() => {});
+        } else {
+          this.$toast.fail(res.msg);
+        }
+      });
+    },
     // 提交日报
     submint() {
-      let loading1 = this.$toast.loading({
-        duration: 0,
-        message: '数据提交中...',
-        forbidClick: true,
-      });
+      this.toastLoading(0, '加载中...', true);
       if (this.isclick) {
-        if (this.GZQuota) {
-          if (this.reportContents[2].projectFollowNum.trim() == '') {
-            this.$toast('请输入今日项目跟进数量!');
-            return false;
+        // 旧的
+        if (this.reportTarget.isHistory == '1') {
+          if (this.GZQuota) {
+            if (this.reportContents[2].projectFollowNum.trim() == '') {
+              this.$toast('请输入今日项目跟进数量!');
+              return false;
+            }
+            if (this.reportContents[3].tucReportingSuccessNum.trim() == '') {
+              this.$toast('请输入今日TUC成功报备数量!');
+              return false;
+            }
           }
-          if (this.reportContents[3].tucReportingSuccessNum.trim() == '') {
-            this.$toast('请输入今日TUC成功报备数量!');
-            return false;
+          if (
+            (this.$route.query.reportId && this.notVisitReason) ||
+            this.reportTarget.showNotVisitReason
+          ) {
+            if (this.notVisitReason.trim() == '') {
+              this.$toast('请输入今日拜访0家店的原因!');
+              return false;
+            }
+            this.reportTarget.notVisitReason = this.notVisitReason;
           }
-        }
-        if (
-          (this.$route.query.reportId && this.notVisitReason) ||
-          this.reportTarget.showNotVisitReason
-        ) {
-          if (this.notVisitReason.trim() == '') {
-            this.$toast('请输入今日拜访0家店的原因!');
+          if (this.reportContents[0].dayContent.trim() == '') {
+            this.$toast('请输入日报内容!');
             return false;
-          }
-          this.reportTarget.notVisitReason = this.notVisitReason;
-        }
-        if (this.reportContents[0].dayContent.trim() == '') {
-          this.$toast('请输入日报内容!');
-          return false;
-        } else if (this.reportContents[0].dayContent.length > 800) {
-          this.$toast('日报内容太长!');
-          return false;
-        } else if (this.reportContents[1].dayContent.trim() == '') {
-          this.$toast('请输入明日工作规划!');
+          } else if (this.reportContents[0].dayContent.length > 800) {
+            this.$toast('日报内容太长!');
+            return false;
+          } else if (this.reportContents[1].dayContent.trim() == '') {
+            this.$toast('请输入明日工作规划!');
 
-          return false;
-        } else if (this.reportContents[1].dayContent.length > 800) {
-          this.$toast('明日工作规划内容太长!');
-          return false;
-        } else {
+            return false;
+          } else if (this.reportContents[1].dayContent.length > 800) {
+            this.$toast('明日工作规划内容太长!');
+            return false;
+          }
           this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
           this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
           if (this.GZQuota) {
             this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
             this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
           }
-          // this.reportContents[4].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}')
           this.reportTarget.reportContents = this.reportContents;
-
-          this.reportTarget.status = '1';
-          this.isclick = false;
-          updateReport(this.reportTarget).then((res) => {
-            loading1.clear();
-            this.isclick = true;
-            if (res.code == 200) {
-              if (this.reportTarget.reportPostType == 'fx') {
-                this.$dialog
-                  .alert({
-                    message: '已提交,是否分享',
-                    showCancelButton: true,
-                    confirmButtonText: '分享',
-                    cancelButtonText: '返回首页',
-                    className: 'dailyShareBtn',
-                  })
-                  .then(() => {
-                    buryingPoint({
-                      systemModel: '日报审核',
-                      buryingPointType: 2,
-                      buryingPointValue: this.$route.query.reportId,
-                      buryingPointName: '日报提交分享',
-                      buryingPointPosition: '日报提交',
-                    });
-                    // 跳转历史汇报详情 分享汇报
-                    this.$router.replace({
-                      path: 'dailyDetails',
-                      query: { reportId: res.data, sourceType: 'daily' },
-                    });
-                  })
-                  .catch(() => {
-                    if (this.$route.query.reportId != undefined) {
-                      window.location.replace(window.location.origin + '/mobile/home');
-                    } else {
-                      this.onClickLeft();
-                    }
-                  });
-              } else {
-                this.$dialog
-                  .alert({
-                    title: '系统提示',
-                    message: '提交成功',
-                  })
-                  .then(() => {
-                    if (this.$route.query.reportId != undefined) {
-                      window.location.replace(window.location.origin + '/mobile/myHistoricalDaily');
-                    } else {
-                      this.onClickLeft();
-                    }
-                  });
+          this.submintFun();
+        } else {
+          // 新的
+          this.reportCustomTabstoreVal((reportCustomAnswers) => {
+            this.submintFun(reportCustomAnswers);
+          });
+        }
+      }
+    },
+    submintFun(reportCustomAnswers) {
+      this.reportTarget.status = '1';
+      if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
+      this.isclick = false;
+      updateReport(this.reportTarget).then((res) => {
+        this.toastLoading().clear();
+        this.isclick = true;
+        if (res.code == 200) {
+          if (this.reportTarget.reportPostType == 'fx') {
+            this.$dialog
+              .alert({
+                message: '已提交,是否分享',
+                showCancelButton: true,
+                confirmButtonText: '分享',
+                cancelButtonText: '返回首页',
+                className: 'dailyShareBtn',
+              })
+              .then(() => {
+                buryingPoint({
+                  systemModel: '日报审核',
+                  buryingPointType: 2,
+                  buryingPointValue: this.$route.query.reportId,
+                  buryingPointName: '日报提交分享',
+                  buryingPointPosition: '日报提交',
+                });
+                // 跳转历史汇报详情 分享汇报
+                this.$router.replace({
+                  path: 'dailyDetails',
+                  query: { reportId: res.data, sourceType: 'daily' },
+                });
+              })
+              .catch(() => {
+                if (this.$route.query.reportId != undefined) {
+                  window.location.replace(window.location.origin + '/mobile/home');
+                } else {
+                  this.onClickLeft();
+                }
+              });
+          } else {
+            this.$dialog
+              .alert({
+                title: '系统提示',
+                message: '提交成功',
+              })
+              .then(() => {
+                if (this.$route.query.reportId != undefined) {
+                  window.location.replace(window.location.origin + '/mobile/myHistoricalDaily');
+                } else {
+                  this.onClickLeft();
+                }
+              });
+          }
+        } else {
+          this.$toast.fail(res.msg);
+        }
+      });
+    },
+    reportCustomTabstoreVal(callback) {
+      // 必填校验
+      this.$refs.reportCustom.$refs.tabstoreVal
+        .validate()
+        .then(() => {
+          // 验证通过
+          this.filterReportCustomData(callback);
+        })
+        .catch((errors) => {
+          this.toastLoading().clear();
+          return;
+        });
+    },
+    filterReportCustomData(callback) {
+      let reportCustomData = this.$refs.reportCustom ? this.$refs.reportCustom.fromData : {} || {};
+      let reportCustomAnswers = [];
+      for (let i = 0; i < reportCustomData.length; i++) {
+        let customData = reportCustomData[i].sfaReportCustomCollections;
+        for (let x = 0; x < customData.length; x++) {
+          if (
+            customData[x].reportCustomCollectionType == 'dx' ||
+            customData[x].reportCustomCollectionType == 'duox'
+          ) {
+            let optionData = customData[x].sfaReportCustomOptions;
+            for (let y = 0; y < optionData.length; y++) {
+              if (optionData[y].answerValue == 'Y') {
+                reportCustomAnswers.push({
+                  reportCustomTaskId: customData[x].reportCustomTaskId,
+                  reportCustomCollectionId: optionData[y].reportCustomCollectionId,
+                  reportCustomOptionId: optionData[y].reportCustomOptionId,
+                  answerValue: 'Y',
+                });
               }
-            } else {
-              this.$toast.fail(res.msg);
             }
-          });
+          } else {
+            if (customData[x].answerValue)
+              reportCustomAnswers.push({
+                reportCustomTaskId: customData[x].reportCustomTaskId,
+                reportCustomCollectionId: customData[x].reportCustomCollectionId,
+                answerValue: customData[x].answerValue,
+              });
+          }
         }
       }
+      console.log(reportCustomAnswers);
+      callback && callback(reportCustomAnswers);
     },
     // 获取日报数据
     getReportInfo() {

+ 35 - 25
src/views/week/dailyApproval.vue

@@ -425,36 +425,44 @@
         </van-collapse-item>
       </van-collapse>
       <div class="contentContainer">
-        <div v-if="GZQuota">
-          <p class="contentContainerTitle">今日项目跟进数</p>
-          <div style="padding: 10px 0">
-            <van-field readonly v-model="projectFollowNum" type="digit" />
+        <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
+        <reportCustom
+          ref="reportCustom"
+          v-if="reportTarget.isHistory == '0'"
+          :disabled="true"
+          :reportCustomData="reportTarget.customTaskList"></reportCustom>
+        <template v-else>
+          <div v-if="GZQuota">
+            <p class="contentContainerTitle">今日项目跟进数</p>
+            <div style="padding: 10px 0">
+              <van-field readonly v-model="projectFollowNum" type="digit" />
+            </div>
+            <p class="contentContainerTitle">今日TUC成功报备数量</p>
+            <div style="padding: 10px 0">
+              <van-field readonly v-model="tucReportingSuccessNum" type="digit" />
+            </div>
+          </div>
+          <!-- 今日未拜访原因 如果不为空则展示,为空则不展示 -->
+          <div v-if="reportTarget.notVisitReason && reportTarget.notVisitReason != ''">
+            <p class="contentContainerTitle">截至日报提交时间,今日拜访0家店的原因</p>
+            <div style="padding: 10px 0">
+              <van-field
+                readonly
+                v-model="reportTarget.notVisitReason"
+                rows="4"
+                autosize
+                type="textarea" />
+            </div>
           </div>
-          <p class="contentContainerTitle">今日TUC成功报备数量</p>
+          <p class="contentContainerTitle">今日机会与挑战总结</p>
           <div style="padding: 10px 0">
-            <van-field readonly v-model="tucReportingSuccessNum" type="digit" />
+            <van-field v-model="Contents" rows="4" autosize readonly type="textarea" />
           </div>
-        </div>
-        <!-- 今日未拜访原因 如果不为空则展示,为空则不展示 -->
-        <div v-if="reportTarget.notVisitReason && reportTarget.notVisitReason != ''">
-          <p class="contentContainerTitle">截至日报提交时间,今日拜访0家店的原因</p>
+          <p class="contentContainerTitle">明日工作规划</p>
           <div style="padding: 10px 0">
-            <van-field
-              readonly
-              v-model="reportTarget.notVisitReason"
-              rows="4"
-              autosize
-              type="textarea" />
+            <van-field v-model="Content2" rows="4" autosize readonly type="textarea" />
           </div>
-        </div>
-        <p class="contentContainerTitle">今日机会与挑战总结</p>
-        <div style="padding: 10px 0">
-          <van-field v-model="Contents" rows="4" autosize readonly type="textarea" />
-        </div>
-        <p class="contentContainerTitle">明日工作规划</p>
-        <div style="padding: 10px 0">
-          <van-field v-model="Content2" rows="4" autosize readonly type="textarea" />
-        </div>
+        </template>
       </div>
       <div class="contentContainer">
         <p class="contentContainerTitle">打分 <span>请点亮小星星,一颗小星星代表1分</span></p>
@@ -517,6 +525,7 @@ import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
 import performanceSAP from '@/views/componentsTarget/performanceSAP';
 import ZYSAP from '@/views/componentsTarget/ZYSAP';
 import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
+import reportCustom from './reportCustom';
 export default {
   name: 'daily',
   components: {
@@ -527,6 +536,7 @@ export default {
     performanceSAP,
     ZYSAP,
     veryGoodPlaceOrder,
+    reportCustom,
   },
   data() {
     return {

+ 35 - 25
src/views/week/dailyDetails.vue

@@ -448,36 +448,44 @@
           </van-collapse-item>
         </van-collapse>
         <div class="contentContainer">
-          <div v-if="GZQuota">
-            <p class="contentContainerTitle">今日项目跟进数</p>
-            <div style="padding: 10px 0">
-              <van-field readonly v-model="projectFollowNum" type="digit" />
+          <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
+          <reportCustom
+            ref="reportCustom"
+            v-if="reportTarget.isHistory == '0'"
+            :disabled="true"
+            :reportCustomData="reportTarget.customTaskList"></reportCustom>
+          <template v-else>
+            <div v-if="GZQuota">
+              <p class="contentContainerTitle">今日项目跟进数</p>
+              <div style="padding: 10px 0">
+                <van-field readonly v-model="projectFollowNum" type="digit" />
+              </div>
+              <p class="contentContainerTitle">今日TUC成功报备数量</p>
+              <div style="padding: 10px 0">
+                <van-field readonly v-model="tucReportingSuccessNum" type="digit" />
+              </div>
+            </div>
+            <!-- 今日未拜访原因 如果不为空则展示,为空则不展示 -->
+            <div v-if="reportTarget.notVisitReason && reportTarget.notVisitReason != ''">
+              <p class="contentContainerTitle">截至日报提交时间,今日拜访0家店的原因</p>
+              <div style="padding: 10px 0">
+                <van-field
+                  readonly
+                  v-model="reportTarget.notVisitReason"
+                  rows="4"
+                  autosize
+                  type="textarea" />
+              </div>
             </div>
-            <p class="contentContainerTitle">今日TUC成功报备数量</p>
+            <p class="contentContainerTitle">今日机会与挑战总结</p>
             <div style="padding: 10px 0">
-              <van-field readonly v-model="tucReportingSuccessNum" type="digit" />
+              <van-field v-model="Content" rows="4" autosize readonly type="textarea" />
             </div>
-          </div>
-          <!-- 今日未拜访原因 如果不为空则展示,为空则不展示 -->
-          <div v-if="reportTarget.notVisitReason && reportTarget.notVisitReason != ''">
-            <p class="contentContainerTitle">截至日报提交时间,今日拜访0家店的原因</p>
+            <p class="contentContainerTitle">明日工作规划</p>
             <div style="padding: 10px 0">
-              <van-field
-                readonly
-                v-model="reportTarget.notVisitReason"
-                rows="4"
-                autosize
-                type="textarea" />
+              <van-field v-model="Content2" rows="4" autosize readonly type="textarea" />
             </div>
-          </div>
-          <p class="contentContainerTitle">今日机会与挑战总结</p>
-          <div style="padding: 10px 0">
-            <van-field v-model="Content" rows="4" autosize readonly type="textarea" />
-          </div>
-          <p class="contentContainerTitle">明日工作规划</p>
-          <div style="padding: 10px 0">
-            <van-field v-model="Content2" rows="4" autosize readonly type="textarea" />
-          </div>
+          </template>
         </div>
         <div
           class="contentContainer"
@@ -623,6 +631,7 @@ import ZYSAP from '@/views/componentsTarget/ZYSAP';
 import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
 import share from '@/components/share';
 import chatBIReport from './chatBIReport.vue';
+import reportCustom from './reportCustom';
 
 export default {
   name: 'dailyDetails',
@@ -636,6 +645,7 @@ export default {
     veryGoodPlaceOrder,
     share,
     chatBIReport,
+    reportCustom,
   },
   data() {
     return {

+ 255 - 0
src/views/week/reportCustom.vue

@@ -0,0 +1,255 @@
+<template>
+  <div class="reportCustom" v-if="fromData && fromData.length">
+    <van-form ref="tabstoreVal" :disabled="disabled">
+      <template v-for="value in fromData">
+        <template v-if="value.sfaReportCustomCollections">
+          <div v-for="(item, index) in value.sfaReportCustomCollections" :key="index">
+            <div v-if="item.reportCustomCollectionType == 'sz'" class="formLabel z-cell">
+              <van-cell>
+                <template #title>
+                  <span v-if="item.isMust == '1'" class="van-f-red">*</span>
+                  {{ 1 + index + '.' }}
+                  {{ item.reportCustomCollectionName }}
+                </template>
+              </van-cell>
+              <van-field
+                :name="item.reportCustomCollectionName"
+                v-model="item.answerValue"
+                :placeholder="item.remark"
+                type="number"
+                @input="numberFn(item, index)"
+                :rules="[{ required: item.isMust == '1' }]"></van-field>
+            </div>
+            <div v-if="item.reportCustomCollectionType == 'wb'" class="formLabel z-cell">
+              <van-cell>
+                <template #title>
+                  <span v-if="item.isMust == '1'" class="van-f-red">*</span>
+                  {{ 1 + index + '.' }}
+                  {{ item.reportCustomCollectionName }}
+                </template>
+              </van-cell>
+              <van-field
+                :name="item.reportCustomCollectionName"
+                v-model="item.answerValue"
+                :formatter="formatter"
+                autosize
+                type="textarea"
+                :placeholder="item.remark"
+                :rules="[{ required: item.isMust == '1' }]"></van-field>
+            </div>
+            <div v-if="item.reportCustomCollectionType == 'duox'" class="formLabel z-cell">
+              <van-cell>
+                <template #title>
+                  <span v-if="item.isMust == '1'" class="van-f-red">*</span>
+                  {{ 1 + index + '.' }}
+                  {{ item.reportCustomCollectionName }}
+                </template>
+              </van-cell>
+              <van-field
+                :name="item.reportCustomCollectionName"
+                :rules="[
+                  {
+                    required: item.isMust == '1',
+                    message: '请选择' + item.reportCustomCollectionName,
+                  },
+                ]">
+                <template #input>
+                  <z-checkbox
+                    :textc="item.reportCustomOptionId"
+                    :zCheckboxcolumns="item.sfaReportCustomOptions"
+                    :id="'reportCustomOptionId'"
+                    :disabled="disabled"
+                    @zSelectVal="zSelectVal"></z-checkbox>
+                </template>
+              </van-field>
+              <p style="color: red; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
+                {{ item.remark }}
+              </p>
+            </div>
+            <div v-if="item.reportCustomCollectionType == 'dx'" class="formLabel z-cell">
+              <van-cell>
+                <template #title>
+                  <span v-if="item.isMust == '1'" class="van-f-red">*</span>
+                  {{ 1 + index + '.' }}
+                  {{ item.reportCustomCollectionName }}
+                </template>
+              </van-cell>
+              <van-field
+                :name="item.reportCustomCollectionName"
+                :rules="[
+                  {
+                    required: item.isMust == '1',
+                    message: '请选择' + item.reportCustomCollectionName,
+                  },
+                ]">
+                <template #input>
+                  <z-radio
+                    :answerType="item.reportCustomCollectionType"
+                    :collectionType="item.collectionType"
+                    :textc="item.reportCustomOptionId"
+                    :zRadiocolumns="item.sfaReportCustomOptions"
+                    :id="'reportCustomOptionId'"
+                    :disabled="disabled"
+                    @zSelectVal="zSelectVal"></z-radio>
+                </template>
+              </van-field>
+              <p style="color: red; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
+                {{ item.remark }}
+              </p>
+            </div>
+          </div>
+        </template>
+      </template>
+    </van-form>
+    <van-calendar
+      v-model="showCalendar"
+      @confirm="onConfirm"
+      color="#0057ba"
+      :min-date="minDate"
+      :max-date="maxDate"
+      :show-confirm="false" />
+  </div>
+</template>
+<script>
+import zRadio from '@/components/componentZRadio';
+import zCheckbox from '@/components/componentZCheckbox';
+export default {
+  components: { zRadio, zCheckbox },
+  props: {
+    reportCustomData: {
+      type: Array,
+      default: () => [],
+    },
+    disabled: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  watch: {
+    reportCustomData: {
+      handler(val) {
+        this.filterFromData(val);
+      },
+      immediate: true,
+      deep: true,
+    },
+  },
+  data() {
+    return {
+      fromData: null,
+      dateIndex: '',
+      showCalendar: false,
+      minDate: new Date(2020, 0, 1),
+      maxDate: new Date(2090, 0, 31),
+    };
+  },
+  methods: {
+    filterFromData(val) {
+      this.fromData = val;
+    },
+    showCalendarClick(item, index) {
+      if (!item.allowWriteAgain) return;
+      this.dateIndex = index;
+      this.showCalendar = true;
+    },
+    onConfirm(date) {
+      this.showCalendar = false;
+      this.fromData[this.dateIndex].answerValue = this.formatDate(date);
+    },
+    numberFn(val, index) {
+      if (val.answerValue) {
+        if (!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(val.answerValue)) {
+          val.answerValue = val.answerValue.replace(
+            /\.\d{2,}$/,
+            val.answerValue.substr(val.answerValue.indexOf('.'), 3)
+          );
+        }
+      }
+    },
+    formatter(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/gi,
+        ''
+      );
+    },
+    zSelectVal(value) {
+      console.log(value);
+      // var collectionAnswerlisd = this.collectionAnswerlisd;
+      // if (collectionAnswerlisd.length > 0) {
+      //   var num = 0;
+      //   for (var a = 0; a < collectionAnswerlisd.length; a++) {
+      //     if (collectionAnswerlisd[a].id == value.id) {
+      //       collectionAnswerlisd[a] = value;
+      //       num = 0;
+      //     } else {
+      //       num = 1;
+      //     }
+      //   }
+      //   if (num > 0) {
+      //     collectionAnswerlisd.push(value);
+      //   }
+      // } else {
+      //   collectionAnswerlisd.push(value);
+      // }
+      // this.collectionAnswerlisd = collectionAnswerlisd;
+    },
+  },
+};
+</script>
+<style lang="scss">
+.reportCustom {
+  .van-f-red {
+    color: red;
+    width: 8px;
+    display: inline-block;
+    line-height: 26px;
+  }
+
+  .formLabel {
+    // margin: 0 16px;
+    border-bottom: 1px solid #f1f1f1;
+  }
+
+  .formLabel .van-cell {
+    padding: 10px 0;
+  }
+
+  .formLabel .van-cell::after {
+    border: 0;
+  }
+
+  .formLabel .van-field {
+    border: 1px solid #f1f1f1;
+    padding: 0;
+    width: 100%;
+    border-radius: 4px;
+    overflow: hidden;
+  }
+  .van-field__control {
+    background-color: white !important;
+    padding: 0 10px;
+  }
+
+  .formLabel .formLabeltitle {
+    position: absolute;
+    top: 8px;
+  }
+
+  .lineGrey {
+    height: 10px;
+    width: 100%;
+    background: #f1f1f1;
+  }
+
+  .z-checkbox .van-radio {
+    padding: 6px 0;
+  }
+
+  .z-cell .van-cell__title {
+    font-size: 16px;
+  }
+  .van-form {
+    background-color: white;
+  }
+}
+</style>