<template>
  <div>
    <!--        顶部条-->
    <div class="navBarTOP">
      <van-nav-bar class="navBar" title="填写周报" left-arrow @click-left="onClickLeft">
        <template #right>
          <span
            v-if="temporaryShow != 'N'"
            @click="tsContentsFn"
            style="
              color: white;
              background: #74a4d9;
              display: block;
              padding: 6px 10px;
              border-radius: 6px;
            "
            >暂存</span
          >
        </template>
      </van-nav-bar>
    </div>
    <div class="lineGrey"></div>
    <!--        主体内容-->
    <div class="container linepAdd">
      <div class="lineGrey"></div>
      <div class="lineGrey"></div>
      <div class="lineGrey"></div>
      <div style="height: 8px"></div>
      <van-collapse v-model="activeNames" style="margin-top: -3px">
        <template v-if="!YFQuota">
          <!-- YFQuota:应用服务平台 不显示各项指标 -->
          <van-collapse-item title="业绩目标SAP(千元)" name="1" v-if="type != 3 && type != 4">
            <performanceSAP :reportTargetAll="reportTargetAll" :JZQuota="JZQuota"></performanceSAP>
          </van-collapse-item>
          <van-collapse-item title="质感外墙SAP(千元)" name="4">
            <zhiganwaiqiangSAP :reportTargetAll="reportTargetAll"></zhiganwaiqiangSAP>
          </van-collapse-item>
          <van-collapse-item v-if="powerGrade != 1" name="3" title="魔术漆SAP(千元)">
            <moshouqiSAP :reportTargetAll="reportTargetAll"></moshouqiSAP>
          </van-collapse-item>
          <van-collapse-item v-if="powerGrade != 1" name="28" title="防水+背胶SAP(千元)">
            <fangshuiSAP :reportTargetAll="reportTargetAll"></fangshuiSAP>
          </van-collapse-item>
          <van-collapse-item
            v-if="powerGrade != 1 && !JZQuota && !GZdata"
            name="27"
            title="内墙中高端SAP(千元)">
            <neiqiangzhonggaoduanSAP :reportTargetAll="reportTargetAll"></neiqiangzhonggaoduanSAP>
          </van-collapse-item>
          <!-- 内外墙平涂SAP -->
          <van-collapse-item v-if="powerGrade != 1" name="2" title="内外墙平涂SAP(千元)">
            <neiwaiqiangpingtu :reportTargetAll="reportTargetAll"></neiwaiqiangpingtu>
          </van-collapse-item>
          <van-collapse-item
            v-if="[1, 4, 5].indexOf(powerGrade) !== -1"
            name="11"
            title="专业时时丽SAP(千元)">
            <ZYSAP :reportTargetAll="reportTargetAll"></ZYSAP>
          </van-collapse-item>
          <van-collapse-item
            v-if="[1, 4, 5].indexOf(powerGrade) !== -1"
            name="29"
            :title="'瓷砖胶SAP(千元)'">
            <cizhuanjiaoSAP :reportTargetAll="reportTargetAll"></cizhuanjiaoSAP>
          </van-collapse-item>
          <van-collapse-item title="建店布机" name="2">
            <createStoreBJ :reportTargetAll="reportTargetAll"></createStoreBJ>
          </van-collapse-item>
          <van-collapse-item name="16" title="专业时时丽分销店下单">
            <ZYPlaceOrder :reportTargetAll="reportTargetAll"></ZYPlaceOrder>
          </van-collapse-item>
          <van-collapse-item name="17" title="超好贴分销店下单">
            <veryGoodPlaceOrder :reportTargetAll="reportTargetAll"></veryGoodPlaceOrder>
          </van-collapse-item>
          <van-collapse-item title="客户开拓" name="6">
            <van-row>
              <van-col span="24"><span class="leftTitle">非片客户开发</span></van-col>
              <van-col span="24"
                ><p>
                  全年开发数:<span class="colorbalck">{{
                    Micrometer(reportTargetAll.customerAct)
                  }}</span>
                </p></van-col
              >
              <van-col span="24"
                ><p>
                  全年进度率:<span class="colorbalck">{{ reportTargetAll.customerYearRate }}%</span>
                </p></van-col
              >
            </van-row>
          </van-collapse-item>
        </template>
        <!-- isHistory 是否为历史汇报：0-新汇报 1-历史汇报 -->
        <div class="contentContainer" v-if="reportTarget.isHistory == '0'">
          <reportCustom
            ref="reportCustom"
            :reportCustomData="reportTarget.customTaskList"></reportCustom>
        </div>
        <template v-else>
          <van-collapse-item title="上周工作成果" name="8">
            <div style="margin-top: -10px">
              <div v-for="(item2, index2) in reportContentsList2" :key="index2">
                <div v-if="index2 < 7">
                  <p class="texttitle">
                    <span class="opint"></span
                    ><span v-if="!reportTarget.hideWeekDate">{{
                      weeklyTimeDivision(item2.contentTime, 0)
                    }}</span
                    ><span>{{ weeklyTimeDivision(item2.contentTime, 1) }}</span
                    ><span v-if="index2 < 5" class="colorRed">(必填)</span>
                  </p>
                  <p>
                    <span class="blackcolor">上午:</span
                    >{{ reportContentsList3[index2].weekContentAm }}
                  </p>
                  <p>
                    <span class="blackcolor">下午:</span
                    >{{ reportContentsList3[index2].weekContentPm }}
                  </p>
                  <p class="texttitle texttitle2">实际工作进度</p>
                  <p>
                    <van-field
                      class="weeklyinput"
                      v-model="item2.weekContentAm"
                      label="上午:"
                      placeholder="请输入" />
                    <van-field
                      class="weeklyinput"
                      v-model="item2.weekContentPm"
                      label="下午:"
                      placeholder="请输入" />
                  </p>
                </div>
                <p v-if="index2 == 7" class="texttitle"><span class="opint"></span>上周工作重点</p>
                <div v-if="index2 == 7" style="padding: 10px 0" class="contentContainer1">
                  <van-field
                    v-model="reportContentsList3[index2].weekContentSummary"
                    rows="4"
                    autosize
                    readonly
                    type="textarea" />
                </div>
                <p v-if="index2 == 7" class="texttitle">
                  <span class="opint"></span>上周工作成果<span class="colorRed">(必填)</span>
                </p>
                <div v-if="index2 == 7" style="padding: 10px 0" class="contentContainer">
                  <van-field
                    v-model="item2.weekContentSummary"
                    rows="4"
                    autosize
                    maxlength="800"
                    show-word-limit
                    type="textarea" />
                </div>
              </div>
            </div>
          </van-collapse-item>
          <van-collapse-item title="本周工作规划" name="9">
            <div style="margin-top: -10px">
              <div v-for="(item, index) in reportContentsList1" :key="index">
                <p class="texttitle" v-if="index < 7">
                  <span class="opint"></span
                  ><span v-if="!reportTarget.hideWeekDate">{{
                    weeklyTimeDivision(item.contentTime, 0)
                  }}</span
                  ><span>{{ weeklyTimeDivision(item.contentTime, 1) }}</span
                  ><span v-if="index < 5" class="colorRed">(必填)</span>
                </p>
                <p v-if="index < 7">
                  <van-field
                    class="weeklyinput"
                    label="上午:"
                    placeholder="请输入"
                    v-model="item.weekContentAm" />
                  <van-field
                    class="weeklyinput"
                    label="下午:"
                    placeholder="请输入"
                    v-model="item.weekContentPm" />
                </p>
                <p v-if="index == 7" class="texttitle">
                  <span class="opint"></span>本周工作重点<span class="colorRed">(必填)</span>
                </p>
                <div v-if="index == 7" style="padding: 10px 0" class="contentContainer">
                  <van-field
                    v-model="item.weekContentSummary"
                    rows="4"
                    autosize
                    maxlength="800"
                    show-word-limit
                    type="textarea" />
                </div>
              </div>
            </div>
          </van-collapse-item>
        </template>
      </van-collapse>
      <br />
      <br />
      <van-button type="info" size="small" plain class="Btn1" @click="submint">提交周报</van-button>
    </div>
    <br />
    <br />
    <br />
  </div>
</template>
<script>
import { updateReport, getReportInfo, getDetailById, tsContents } from '@/api/index';
import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
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 neiwaiqiangpingtu from '@/views/componentsTarget/neiwaiqiangpingtu';
import zhiganwaiqiangSAP from '@/views/componentsTarget/zhiganwaiqiangSAP';
import cizhuanjiaoSAP from '@/views/componentsTarget/cizhuanjiaoSAP';
import neiqiangzhonggaoduanSAP from '@/views/componentsTarget/neiqiangzhonggaoduanSAP';
import moshouqiSAP from '@/views/componentsTarget/moshouqiSAP';
import fangshuiSAP from '@/views/componentsTarget/fangshuiSAP';
import reportCustom from './reportCustom.vue';
export default {
  name: 'home',
  components: {
    createStoreBJ,
    ZYPlaceOrder,
    performanceSAP,
    ZYSAP,
    veryGoodPlaceOrder,
    neiwaiqiangpingtu,
    zhiganwaiqiangSAP,
    cizhuanjiaoSAP,
    neiqiangzhonggaoduanSAP,
    moshouqiSAP,
    fangshuiSAP,
    reportCustom,
  },
  data() {
    return {
      activeNames: [
        '1',
        '2',
        '3',
        '4',
        '5',
        '6',
        '7',
        '8',
        '9',
        '11',
        '12',
        '16',
        '17',
        '27',
        '28',
        '29',
      ],
      powerGrade: '',
      value: '2',
      timeList: [],
      isclick: true,
      reportTargetAll: {},
      reportTarget: {},
      reportContentsList1: [],
      reportContentsList2: [],
      reportContentsList3: [],
      temporaryShow: '',
      type: '-1',
      JZQuota: false,
      YFQuota: false, //应用服务
      GZdata: false,
    };
  },
  created() {
    this.temporaryShow = this.$route.query.temporaryShow;
    if (this.$route.query.reportId != undefined) {
      this.getDetailById();
    } else {
      this.getReportInfo();
    }
    this.powerGrade = localStorage.getItem('powerGrade');
  },
  watch: {
    $route(to, from) {
      this.temporaryShow = this.$route.query.temporaryShow;
      this.powerGrade = localStorage.getItem('powerGrade');
      if (to.path == '/weekly') {
        if (this.$route.query.reportId != undefined) {
          this.getDetailById();
        } else {
          this.getReportInfo();
        }
      }
    },
  },
  methods: {
    getDetailById() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '加载中...',
        forbidClick: true,
      });
      getDetailById({ reportId: this.$route.query.reportId }).then((res) => {
        loading1.clear();
        if (res.code == 200) {
          this.YFQuota = res.data.postType == 'YF' ? true : false;
          this.JZQuota = false;
          if (res.data.postType == 'JZ') {
            this.JZQuota = true;
          }
          if (res.data.postType == 'GZ') {
            this.GZdata = true;
          } else {
            this.GZdata = false;
          }
          var dayTime = res.data.date;
          this.type = res.data.userType;
          this.timeList = this.parseTimeParagraph(
            dayTime.slice(0, 4) + '-' + dayTime.slice(4, 6) + '-' + dayTime.slice(6, 8),
          );
          if (res.data.status != '0' && res.data.status != '2') {
            this.$dialog
              .alert({
                title: '系统提示',
                message: '周报已提交或过期',
              })
              .then(() => {
                window.location.replace(window.location.origin + '/mobile/home');
              });
          } else {
            this.reportTargetAll = res.data.reportTargetAll;
            this.reportTarget = res.data;
            this.reportContents = res.data.reportContents;
            var reportContentsList1 = [];
            var reportContentsList2 = [];
            var reportContentsList3 = [];
            if (res.data.reportContents == null) {
              res.data.reportContents = [];
            }
            var reportContentsdata = res.data.reportContents;
            // var reportContentsdata=[]
            for (var i = 0; i < reportContentsdata.length; i++) {
              if (reportContentsdata[i].type == '1') {
                reportContentsList1.push(reportContentsdata[i]);
              }
              if (reportContentsdata[i].type == '2') {
                reportContentsList2.push(reportContentsdata[i]);
              }
              if (reportContentsdata[i].type == '3') {
                reportContentsList3.push(reportContentsdata[i]);
              }
            }
            if (reportContentsList3.length < 7) {
              var lentype3 = 7 - reportContentsList3.length;
              for (var x1 = 0; x1 < lentype3; x1++) {
                reportContentsList3.push({
                  contentTime: this.timeList[7 + x1],
                  weekContentAm: '',
                  weekContentPm: '',
                  type: 3,
                });
              }
            }
            if (reportContentsList2.length < 7) {
              var lentype2 = 7 - reportContentsList2.length;
              for (var x2 = 0; x2 < lentype2; x2++) {
                reportContentsList2.push({
                  contentTime: this.timeList[0 + x2],
                  weekContentAm: '',
                  weekContentPm: '',
                  type: 2,
                });
              }
            }
            var ln1 = reportContentsList1.length;
            var ln2 = reportContentsList2.length;
            if (reportContentsList2.length > reportContentsList1.length) {
              var len = ln2 - ln1;
              for (var x = 0; x < len; x++) {
                reportContentsList1.push({
                  contentTime: '',
                  weekContentAm: '',
                  weekContentPm: '',
                  type: 1,
                });
              }
            }
            if (reportContentsList2.length == 7) {
              reportContentsList2.push({
                contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
                weekContentAm: '',
                weekContentPm: '',
                weekContentSummary: null,
                type: 2,
              });
            }
            if (reportContentsList1.length == 7) {
              reportContentsList1.push({
                contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
                weekContentAm: '',
                weekContentPm: '',
                weekContentSummary: null,
                type: 1,
              });
            }
            if (reportContentsList3.length == 7) {
              reportContentsList3.push({
                contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
                weekContentAm: '',
                weekContentPm: '',
                weekContentSummary: null,
                type: 3,
              });
            }
            this.reportContentsList1 = reportContentsList3; //1
            this.reportContentsList2 = reportContentsList2; //2
            this.reportContentsList3 = reportContentsList1; //3
          }
        } else {
          this.$toast(res.msg);
        }
      });
    },
    tsContentsFn() {
      if (this.isclick) {
        if (this.reportTarget.isHistory == '1') {
          this.reportTarget.reportContents = [];
          this.reportTarget.reportContents = this.reportContentsList2
            .concat(this.reportContentsList1)
            .concat(this.reportContentsList3);
          console.log(this.reportContentsList1);
          console.log(this.reportContentsList2);
          console.log(this.reportContentsList3);
          console.log(this.reportTarget.reportContents);
          this.tsContentsFun(null);
        } else {
          // 新的
          if (this.reportTarget.customTaskList && this.reportTarget.customTaskList.length) {
            // 配置任务
            this.filterReportCustomData((reportCustomAnswers) => {
              this.tsContentsFun(reportCustomAnswers);
            });
          } else {
            // 没有配置任务
            this.tsContentsFun(null);
          }
        }
      }
    },
    tsContentsFun(reportCustomAnswers) {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '数据提交中...',
        forbidClick: true,
      });
      if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
      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);
        }
      });
    },
    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
          ? 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 {
            if (customData[x].answerValue)
              reportCustomAnswers.push({
                reportCustomTaskId: customData[x].reportCustomTaskId,
                reportCustomCollectionId: customData[x].reportCustomCollectionId,
                answerValue: customData[x].answerValue,
              });
          }
        }
      }
      console.log(reportCustomAnswers);
      callback && callback(reportCustomAnswers);
    },
    // 提交日报
    submint() {
      if (this.isclick) {
        // 旧的
        if (this.reportTarget.isHistory == '1') {
          this.reportTarget.reportContents = [];
          for (var j = 0; j < 5; j++) {
            if (
              this.reportContentsList1[j].weekContentAm.trim() == '' ||
              this.reportContentsList1[j].weekContentPm.trim() == ''
            ) {
              this.$toast('请完善本周规划内容！');
              return false;
            }
          }
          for (var x = 0; x < 5; x++) {
            if (
              this.reportContentsList2[x].weekContentAm.trim() == '' ||
              this.reportContentsList2[x].weekContentPm.trim() == ''
            ) {
              this.$toast('请完善上周周报内容！');
              return false;
            }
          }
          if (this.reportContentsList2[7].weekContentSummary.trim() == '') {
            this.$toast('请完善上周工作成果！');
            return false;
          }
          if (this.reportContentsList1[7].weekContentSummary.trim() == '') {
            this.$toast('请完善本周工作重点！');
            return false;
          }
          if (this.reportContentsList1[7].weekContentSummary.length > 800) {
            this.$toast('上周工作重点超过800字');
            return false;
          }
          if (this.reportContentsList2[7].weekContentSummary.length > 800) {
            this.$toast('上周工作成果超过800字！');
            return false;
          }
          this.reportTarget.reportContents = this.reportContentsList2
            .concat(this.reportContentsList1)
            .concat(this.reportTarget.reportContents);
          this.submintFun();
        } else {
          // 新的
          if (this.reportTarget.customTaskList && this.reportTarget.customTaskList.length) {
            // 配置任务
            this.reportCustomTabstoreVal((reportCustomAnswers) => {
              this.submintFun(reportCustomAnswers);
            });
          } else {
            // 没有配置任务
            this.submintFun(null);
          }
        }
      }
    },
    submintFun(reportCustomAnswers) {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '数据提交中...',
        forbidClick: true,
      });
      if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
      this.reportTarget.status = '1';
      this.isclick = false;
      updateReport(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 {
                this.onClickLeft();
                // window.location.replace(window.location.origin + '/mobile/home');
              }
            });
        } else {
          this.$toast.fail(res.msg);
        }
      });
    },
    getReportInfo() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '加载中...',
        forbidClick: true,
      });
      getReportInfo({ isContent: true }).then((res) => {
        loading1.clear();
        localStorage.setItem('powerGrade', res.data.positionId);
        localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
        this.type = res.data.userType;
        var dayTime = res.data.date;
        this.YFQuota = res.data.postType == 'YF' ? true : false;
        this.timeList = this.parseTimeParagraph(
          dayTime.slice(0, 4) + '-' + dayTime.slice(4, 6) + '-' + dayTime.slice(6, 8),
        );
        this.powerGrade = res.data.positionId;
        this.showButton = res.data.showButton;
        this.reportTargetAll = res.data.reportTargetAll;
        this.reportTarget = res.data;
        if (res.data.reportContents == null) {
          res.data.reportContents = [];
        }
        var reportContentsList1 = [];
        var reportContentsList2 = [];
        var reportContentsList3 = [];
        if (res.data.reportContents.length == '0') {
          for (var i = 0; i < 7; i++) {
            reportContentsList1.push({
              weekContentAm: '',
              weekContentPm: '',
              contentTime: this.timeList[i + 7],
              weekContentSummary: null,
              type: 3,
            });
            reportContentsList3.push({
              weekContentAm: '',
              weekContentPm: '',
              contentTime: this.timeList[i],
              weekContentSummary: null,
              type: 1,
            });
            reportContentsList2.push({
              weekContentAm: '',
              weekContentPm: '',
              contentTime: this.timeList[i],
              weekContentSummary: null,
              type: 2,
            });
          }
          reportContentsList1.push({
            weekContentAm: '',
            weekContentPm: '',
            contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
            weekContentSummary: null,
            type: 3,
          });
          reportContentsList2.push({
            weekContentAm: '',
            weekContentPm: '',
            contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
            weekContentSummary: null,
            type: 2,
          });
          reportContentsList3.push({
            weekContentAm: '',
            weekContentPm: '',
            contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
            weekContentSummary: null,
            type: 1,
          });
          this.reportContentsList2 = reportContentsList2;
          this.reportContentsList1 = reportContentsList1;
          this.reportContentsList3 = reportContentsList3;
          if (res.data.reportContents.length == '0') {
            this.reportContentsList3 = reportContentsList3;
          } else {
            var reportContentsLength = res.data.reportContents.length;
            if (reportContentsLength < 7) {
              var reportContentsListList = res.data.reportContents;
              for (var p = 0; p < 7 - reportContentsLength; p++) {
                reportContentsListList.push(reportContentsList3[p]);
              }
              this.reportContentsList3 = reportContentsListList;
            } else {
              this.reportContentsList3 = res.data.reportContents;
            }
          }
        } else {
          var reportContentsdata = res.data.reportContents;
          for (var i = 0; i < reportContentsdata.length; i++) {
            if (reportContentsdata[i].type == '1') {
              reportContentsList1.push(reportContentsdata[i]);
            }
            if (reportContentsdata[i].type == '2') {
              reportContentsList2.push(reportContentsdata[i]);
            }
            if (reportContentsdata[i].type == '3') {
              reportContentsList3.push(reportContentsdata[i]);
            }
          }
          if (reportContentsList3.length < 7) {
            var lentype3 = 7 - reportContentsList3.length;
            for (var x1 = 0; x1 < lentype3; x1++) {
              reportContentsList3.push({
                contentTime: this.timeList[7 + x1],
                weekContentAm: '',
                weekContentPm: '',
                weekContentSummary: null,
                type: 3,
              });
            }
          }
          if (reportContentsList2.length < 7) {
            var lentype2 = 7 - reportContentsList2.length;
            for (var x2 = 0; x2 < lentype2; x2++) {
              reportContentsList2.push({
                contentTime: this.timeList[0 + x2],
                weekContentAm: '',
                weekContentPm: '',
                weekContentSummary: null,
                type: 2,
              });
            }
          }
          if (reportContentsList2.length == 7) {
            reportContentsList2.push({
              contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
              weekContentAm: '',
              weekContentPm: '',
              weekContentSummary: null,
              type: 2,
            });
          }
          if (reportContentsList3.length == 7) {
            reportContentsList3.push({
              contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
              weekContentAm: '',
              weekContentPm: '',
              weekContentSummary: null,
              type: 3,
            });
          }
          var ln1 = reportContentsList1.length;
          var ln2 = reportContentsList2.length;
          if (reportContentsList2.length > reportContentsList1.length) {
            var len = ln2 - ln1;
            for (var x = 0; x < len; x++) {
              reportContentsList1.push({
                contentTime: '',
                weekContentAm: '',
                weekContentPm: '',
                weekContentSummary: null,
                type: 1,
              });
            }
          }
          this.reportContentsList1 = reportContentsList3; //1
          this.reportContentsList2 = reportContentsList2; //2
          this.reportContentsList3 = reportContentsList1; //3
        }
        console.log(this.reportContentsList2);
        console.log(this.reportContentsList1);

        console.log(this.reportContentsList3);
      });
    },
    onClickLeft() {
      this.$router.go(-1);
    },
  },
};
</script>
<style scoped>
.container {
  margin: 10px;
}

.container .van-collapse-item {
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
}

.linepAdd p {
  margin: 10px 0 0 0;
  font-size: 14px;
  color: #666;
}

.linepAdd .texttitle {
  color: #0057ba;
  position: relative;
  padding-left: 10px;
}

.linepAdd .texttitle2 {
  padding-left: 0;
}

.linepAdd .texttitle .opint {
  position: absolute;
  left: 0px;
  top: 6px;
  margin-right: 6px;
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 10px;
  background-color: #004d8c;
}

.leftTitle {
  background-color: #74a4d9;
  color: #fff;
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
}

.rightTitle {
  background-color: #e7b4bb;
  color: #fff;
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
}
</style>
<style>
.homeTitle .van-cell__title {
  color: #333;
  font-size: 14px;
  font-weight: bold;
  padding-left: 4px;
  line-height: 32px;
}

.linepAdd .van-cell__title {
  color: #1e5398;
  font-weight: 500;
}

.Btn1 {
  display: block;
  width: 100%;
  border-radius: 6px;
  color: #fff !important;
  background-color: #0057ba;
  border: 1px solid #0057ba;
  height: 44px;
}

.linepAdd .contentContainer {
  background-color: white;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 10px;
}

.linepAdd .contentContainer .contentContainerTitle {
  color: #222;
}

.linepAdd .contentContainer .contentContainerTitle span {
  font-size: 12px;
  color: #666;
}

.linepAdd .contentContainer .van-field__control {
  background-color: #f1f1f1;
  padding: 10px;
  border-radius: 8px;
}

.linepAdd .contentContainer .van-cell {
  padding: 0;
}

.weeklyinput {
  padding: 0 0 10px 0;
}

.weeklyinput .van-field__control {
  background-color: #f8f8f8;
  padding: 4px 10px;
  border-radius: 5px;
}

.weeklyinput .van-field__label {
  width: 40px;
  margin: 0;
  color: #333;
}

.blackcolor {
  color: #333;
}
.colorRed {
  color: red;
}
.van-dialog__confirm,
.van-dialog__confirm:active {
  color: #0057ba;
}
</style>
