Jelajahi Sumber

Merge branch 'feature_20250430_总部移动端筛选全国数据' into release

zhujindu 6 bulan lalu
induk
melakukan
6e94c50784

+ 1 - 0
src/store/modules/user.js

@@ -33,6 +33,7 @@ const user = {
             localStorage.setItem('nickName', res.data.nickName);
             localStorage.setItem('postName', res.data.postName);
             localStorage.setItem('zipPhoto', res.data.zipPhoto);
+            //deptLevel 0:本部;1:公司;2:大区;3:销售部
             localStorage.setItem('deptLevel', res.data.depts[0].deptLevel);
             localStorage.setItem('userId', res.data.userId);
             localStorage.setItem('deptIds', JSON.stringify(res.data.deptIds));

+ 709 - 0
src/views/historicalVisit/historAllVisit copy 2.vue

@@ -0,0 +1,709 @@
+<template>
+  <div class="bgcolor historAllVisit">
+    <div class="navBarTOP">
+      <!--        顶部条-->
+      <van-nav-bar class="navBar" title="历史拜访" left-arrow @click-left="onClickLeft" />
+      <div class="searcTime">
+        <van-row class="serchInput">
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="companyName"
+              is-link
+              arrow-direction="down"
+              @click="regionClick" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="regionName"
+              is-link
+              @click="SalesRegionClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="deptName"
+              is-link
+              @click="SalesDepartmentClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="userName"
+              is-link
+              @click="StaffClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <div class="monthNow" @click="startTimeshow = true">
+              <span class="month">{{ startTime }}</span>
+              <van-icon class="CalendarIcon" :name="timeico" />
+            </div>
+          </van-col>
+          <van-col span="12">
+            <div class="monthNow" @click="endTimeshow = true">
+              <span class="month">{{ endTime }}</span>
+              <van-icon class="CalendarIcon" :name="timeico" />
+            </div>
+          </van-col>
+        </van-row>
+      </div>
+      <div class="searchDiv">
+        <van-search v-model="storeName" show-action placeholder="搜索名称/编号/地址/拜访人">
+          <template #action>
+            <div @click="onSearch">搜索</div>
+          </template>
+        </van-search>
+      </div>
+      <div class="lineGrey"></div>
+    </div>
+    <!--        主体内容-->
+    <div class="container" style="margin-top: 262px">
+      <van-list
+        class="myList1"
+        v-model="loading"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad">
+        <div v-if="list.length > 0">
+          <div class="cellcontent" v-for="(item, index) in list" :key="index">
+            <van-cell>
+              <div class="card" style="position: relative" @click="detilsFn(item)">
+                <span v-if="item.visitSource == 2" class="stateAbnormal">异常拜访</span>
+                <!--<span v-if="item.visitModel==5" class="state">偏差过大</span>-->
+                <span v-if="item.visitSource == 1" class="state">正常拜访</span>
+                <div class="title">
+                  <span>{{ item.storeName }}</span> (<span style="color: #0057ba">{{
+                    item.storeCode
+                  }}</span
+                  >)
+                </div>
+                <div class="info">拜访人:{{ item.nickName }}</div>
+                <div class="info">
+                  拜访时间:{{ item.visitsTime }}
+                  <span class="textRight" v-if="item.status == '1' && item.taskId == null"
+                    >审批中</span
+                  >
+                  <span
+                    class="textRight"
+                    v-if="item.status == '1' && item.taskId != null"
+                    style="color: red"
+                    >退回修改</span
+                  >
+                  <span class="textRight" style="color: #07c160" v-if="item.status == 2"
+                    >审批完成</span
+                  >
+                  <span class="textRight" v-if="item.status == '3'" style="color: red">拒绝</span>
+                </div>
+                <div class="info" v-if="item.dwellTime">拜访时长:{{ item.dwellTime }}</div>
+                <div class="info">地址:{{ item.addressLine }}</div>
+              </div>
+              <!-- 分销店 -->
+              <template
+                v-if="
+                  item.sfaStoreType &&
+                  item.sfaStoreType.type == 'fxd' &&
+                  item.sfaStoreChainsContactList
+                ">
+                <div class="info">
+                  经销商:
+                  <div class="TCFXListItem" v-for="(item, index) in item.sfaStoreChainsContactList">
+                    <el-popover
+                      popper-class="zpover zpoverStoreztype"
+                      placement="bottom-start"
+                      trigger="click">
+                      <div>
+                        <div>{{ item.chainCode }}</div>
+                        <div>{{ item.chainName }}</div>
+                      </div>
+                      <div slot="reference" :key="index">
+                        {{ item.categoryDescribe }}
+                      </div>
+                    </el-popover>
+                  </div>
+                </div>
+              </template>
+              <template v-else>
+                <div class="info">经销商:{{ item.chainName }}</div>
+              </template>
+            </van-cell>
+            <div class="lineGrey"></div>
+          </div>
+        </div>
+      </van-list>
+      <!--      <p style="text-align: center;color: #ccc;font-size: 12px;" v-if="list.length!=0">&#45;&#45;已经到底了&#45;&#45;</p>-->
+      <!--      <van-empty description="&#45;&#45;已经到底了&#45;&#45;" v-if="list.length==0"/>-->
+    </div>
+    <van-popup v-model="startTimeshow" position="bottom" :style="{ height: '30%' }">
+      <van-datetime-picker
+        v-model="startcurrentDate"
+        type="date"
+        title="开始日期"
+        :min-date="minDate"
+        :max-date="startmaxDate"
+        @confirm="dateeconfirm"
+        @cancel="startTimeshow = false" />
+    </van-popup>
+    <van-popup v-model="endTimeshow" position="bottom" :style="{ height: '50%' }">
+      <van-datetime-picker
+        v-model="currentDate"
+        type="date"
+        title="开始日期"
+        :min-date="endminDate"
+        :max-date="maxDate"
+        @confirm="endTimeconfirm"
+        @cancel="endTimeshow = false" />
+    </van-popup>
+    <van-popup v-model="RegionShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="companyList"
+        value-key="deptName"
+        @confirm="onregionConfirm"
+        @cancel="RegionShow = false" />
+    </van-popup>
+    <van-popup v-model="SalesRegionShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="regionList"
+        value-key="deptName"
+        @confirm="onSalesRegionConfirm"
+        @cancel="SalesRegionShow = false" />
+    </van-popup>
+    <van-popup v-model="SalesDepartmentShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="deptList"
+        value-key="deptName"
+        @confirm="onSalesDepartmentConfirm"
+        @cancel="SalesDepartmentShow = false" />
+    </van-popup>
+    <van-popup v-model="StaffShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="userList"
+        @confirm="onStaffConfirm"
+        value-key="nickName"
+        @cancel="StaffShow = false" />
+    </van-popup>
+  </div>
+</template>
+
+<script>
+import { getVisits, getvisitDeptInfo } from '@/api/index';
+import timeico from '@/assets/Icon/datatims.png';
+
+export default {
+  name: 'index.vue',
+  data() {
+    return {
+      timeico: timeico,
+      defaultDate: new Date(),
+      searchValue: '',
+      calendarShow: '',
+      monthNames: [
+        '-01',
+        '-02',
+        '-03',
+        '-04',
+        '-05',
+        '-06',
+        '-07',
+        '-08',
+        '-09',
+        '-10',
+        '-11',
+        '-12',
+      ],
+      calendarIsshow: false,
+      tabVal: 'insidePlan',
+      list: [],
+      loading: false,
+      finished: true,
+      listActive: null,
+      query: '',
+      show: false,
+      minDate: new Date(2022, 0, 1),
+      maxDate: new Date(),
+      currentDate: new Date(),
+      startcurrentDate: new Date(),
+      endminDate: new Date(),
+      startmaxDate: new Date(),
+      endTime: '',
+      startTime: '',
+      endTimeshow: false,
+      startTimeshow: false,
+      storeName: '',
+      companyName: '全部公司',
+      deptName: '全部销售部',
+      regionName: '全部大区',
+      userName: '全部业务员',
+      companyCode: '',
+      deptCode: '',
+      regionCode: '',
+      userCode: '',
+      companyList: [],
+      deptList: [],
+      regionList: [],
+      userList: [],
+      RegionShow: false,
+      SalesRegionShow: false,
+      SalesDepartmentShow: false,
+      StaffShow: false,
+      deptForm: { type: '', parentId: '' },
+      pageNum: 1, // 当前页码  int类型
+      pageSize: 10, // 当前每页条数  int类型
+      deptLevel: null,
+    };
+  },
+  activated() {
+    this.info();
+    this.getDeptInfo('dept', 'companyList', 'first');
+  },
+  created() {},
+  methods: {
+    onLoad() {
+      // this.loading = false;
+      this.getVisitsListFn();
+    },
+    info() {
+      this.deptLevel = localStorage.getItem('deptLevel');
+      // powerGrade:等级(1-销售员 2-销售部主管 3-大区主管 4-区域公司总经理 5-DIY公司)
+      this.powerGrade = localStorage.getItem('powerGrade');
+      this.userList = [];
+      this.pageNum = 1;
+      this.list = [];
+      this.query = this.$route.query;
+      this.startTime = this.getDay(-7);
+      this.startcurrentDate = new Date(this.getDay(-7));
+      this.endTime = this.parseTime(new Date(), '{y}-{m}-{d}');
+      this.endminDate = new Date(this.getDay(-7));
+    },
+    detilsFn(val) {
+      this.$router.push({
+        path: '/historicalDetails',
+        query: {
+          visitId: val.id,
+          storeId: val.storeId,
+          storeCode: val.storeCode,
+          taskId: val.taskId,
+          userId: val.userId,
+          storeCategory: val.storeCategory,
+        },
+      });
+    },
+    timeBefore7(date) {
+      if (!date) {
+        date = new Date();
+      }
+      var y = date.getFullYear();
+      var m = date.getMonth() + 1;
+      var d = date.getDate() - 6;
+      if (d < 0) {
+        m = date.getMonth();
+        var d1 = new Date(y, m, 0);
+        var d2 = d1.getDate();
+        return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d2 + d);
+      } else {
+        return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d < 10 ? '0' + d : d);
+      }
+    },
+    getDay(day) {
+      var today = new Date();
+      var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
+      today.setTime(targetday_milliseconds); //注意,这行是关键代码
+      var tYear = today.getFullYear();
+      var tMonth = today.getMonth();
+      var tDate = today.getDate();
+      tMonth = this.doHandleMonth(tMonth + 1);
+      tDate = this.doHandleMonth(tDate);
+      return tYear + '-' + tMonth + '-' + tDate;
+    },
+    doHandleMonth(month) {
+      var m = month;
+      if (month.toString().length == 1) {
+        m = '0' + month;
+      }
+      return m;
+    },
+    dateeconfirm() {
+      this.startTimeshow = false;
+      this.startTime = this.parseTime(this.startcurrentDate, '{yy}-{mm}-{dd}');
+      this.endminDate = new Date(this.startcurrentDate);
+      this.onSearch();
+    },
+    endTimeconfirm() {
+      this.endTimeshow = false;
+      this.endTime = this.parseTime(this.currentDate, '{yy}-{mm}-{dd}');
+      this.startmaxDate = new Date(this.currentDate);
+      this.onSearch();
+    },
+    onClickLeft() {
+      this.$router.go(-1);
+    },
+    onSearch() {
+      this.pageNum = 1;
+      this.list = [];
+      this.getVisitsListFn();
+    },
+    getVisitsListFn() {
+      let loading1 = this.$toast.loading({
+        duration: 0,
+        message: '数据获取中...',
+        forbidClick: true,
+      });
+      if (this.refreshing) {
+        this.list = [];
+        this.refreshing = false;
+      }
+      getVisits({
+        startTime: this.startTime + ' 00:00:00', //
+        stopTime: this.endTime + ' 24:00:00', //
+        storeRequest: this.storeName.trim(),
+        pageNum: this.pageNum,
+        pageSize: this.pageSize,
+        companyId: this.companyCode,
+        regionId: this.regionCode,
+        userId: this.userCode,
+        deptId: this.deptCode,
+      }).then((res) => {
+        loading1.clear();
+        if (res.code == 200) {
+          this.loading = false;
+          this.list = this.list.concat(res.data);
+          if (this.list.length >= res.total) {
+            this.finished = true;
+          } else {
+            this.finished = false;
+          }
+          this.pageNum = this.pageNum + 1;
+        } else {
+          this.$toast.fail(res.msg);
+        }
+      });
+    },
+    regionClick() {
+      // if(this.powerGrade>4){
+      this.RegionShow = true;
+      // }
+    },
+    SalesRegionClick(val) {
+      // if(this.powerGrade>3){
+      this.SalesRegionShow = true;
+      // }
+    },
+    SalesDepartmentClick() {
+      // if(this.powerGrade>2){
+      this.SalesDepartmentShow = true;
+      // }
+    },
+    StaffClick() {
+      this.StaffShow = true;
+    },
+    StartTimeClick() {
+      this.StartTimeShow = true;
+    },
+    onregionConfirm(val) {
+      this.RegionShow = false;
+      this.companyName = val.deptName;
+      this.companyCode = val.deptId;
+      if (val.deptName == '全部公司') {
+        this.regionName = '全部大区';
+        this.regionCode = '';
+        this.deptName = '全部销售部';
+        this.deptCode = '';
+        this.userName = '全部业务员';
+        this.userCode = '';
+      } else {
+        this.deptList = [];
+        this.regionList = [];
+        this.userList = [];
+      }
+      this.getDeptInfo('dept', 'regionList');
+    },
+    onSalesRegionConfirm(val) {
+      this.SalesRegionShow = false;
+      this.regionName = val.deptName;
+      this.regionCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('dept', 'deptList');
+      }
+      this.deptName = '全部销售部';
+      this.deptCode = '';
+      this.userName = '全部业务员';
+      this.userCode = '';
+      this.userList = [];
+    },
+    onSalesDepartmentConfirm(val) {
+      this.SalesDepartmentShow = false;
+      this.deptName = val.deptName;
+      this.deptCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('user', 'userList');
+      }
+      this.userName = '全部业务员';
+      this.userCode = '';
+    },
+    onStaffConfirm(val) {
+      this.StaffShow = false;
+      this.userName = val.nickName;
+      this.userCode = val.userId;
+    },
+    getDeptInfo(type, activaType, isFirstrequest = false) {
+      this.deptForm.type = type;
+      if (activaType == 'companyList') {
+        // 总部/公司
+        this.deptForm.parentId = '';
+      } else if (activaType == 'regionList') {
+        // 大区
+        this.deptForm.parentId = this.companyCode;
+      } else if (activaType == 'deptList') {
+        // 销售部
+        this.deptForm.parentId = this.regionCode;
+      } else if (activaType == 'userList') {
+        // 业务员
+        this.deptForm.parentId = this.deptCode;
+      }
+      getvisitDeptInfo(this.deptForm).then((res) => {
+        // 总部/公司 默认显示 “全部”;其他:默认显示第一个
+        if (isFirstrequest) {
+          if (this.powerGrade == 5) {
+            this.companyList = [{ deptName: '全部公司', deptId: '' }].concat(res.data.company);
+            // 初始化第一次请求 公司/总部身份 不需要请求大区、销售部、业务员数据
+            this.onSearch();
+          } else {
+            this.companyList = res.data.company;
+            this.companyName = res.data.company[0].deptName;
+            this.companyCode = res.data.company[0].deptId;
+            this.getDeptInfo('dept', 'regionList');
+          }
+        } else {
+          if (activaType == 'regionList') {
+            // 大区
+            this.regionName = res.data.region[0].deptName;
+            this.regionCode = res.data.region[0].deptId;
+            this.regionList = res.data.region;
+            this.getDeptInfo('dept', 'deptList');
+          } else if (activaType == 'deptList') {
+            // 销售部
+            this.deptName = res.data.dept[0].deptName;
+            this.deptCode = res.data.dept[0].deptId;
+            this.deptList = res.data.dept;
+            this.getDeptInfo('user', 'userList');
+          } else if (activaType == 'userList') {
+            // 业务员
+            this.userList = [{ nickName: '全部业务员', userId: '' }].concat(res.data.user);
+          }
+        }
+        // if (type == 'dept') {
+        //   if (grade == '1') {
+        //     if (res.data.region != null) {
+        //       this.regionList = [{ deptName: '全部大区', deptId: '' }].concat(res.data.region);
+        //     }
+        //   } else if (grade == '2') {
+        //     if (res.data.dept != null) {
+        //       this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
+        //     }
+        //   } else {
+        //     this.companyList = res.data.company;
+        //     if (this.$route.query.userCode == undefined) {
+        //       this.companyName = res.data.company[0].deptName;
+        //       this.companyCode = res.data.company[0].deptId;
+        //     }
+        //     if (res.data.dept != null) {
+        //       this.deptName = res.data.dept[0].deptName;
+        //       this.deptCode = res.data.dept[0].deptId;
+        //       this.deptList = res.data.dept;
+        //     }
+        //     if (res.data.region != null) {
+        //       this.regionName = res.data.region[0].deptName;
+        //       this.regionCode = res.data.region[0].deptId;
+        //       this.regionList = res.data.region;
+        //     }
+        //     if (res.data.user != null) {
+        //       this.userList = res.data.user;
+        //       this.userCode = '';
+        //     }
+        //   }
+        // } else if (type == 'user') {
+        //   if (res.data.user != null) {
+        //     this.userList = [{ nickName: '全部业务员', userId: '' }].concat(res.data.user);
+        //   }
+        // }
+      });
+    },
+  },
+};
+</script>
+<style lang="scss">
+.searchDiv {
+  .van-search {
+    background: #fff;
+  }
+  .van-search__action {
+    font-size: 14px;
+    color: #1989fa;
+    font-weight: bold;
+    background: #f5f5f5;
+    border-bottom-right-radius: 60px;
+    border-top-right-radius: 60px;
+    border: 1px solid #ccc;
+    padding: 0 20px;
+  }
+
+  .van-search--show-action {
+    padding-right: 12px;
+  }
+
+  .van-search__content {
+    border: 1px solid #ccc;
+    border-bottom-left-radius: 60px;
+    border-top-left-radius: 60px;
+    background: #f5f5f5;
+    border-right: 0;
+  }
+}
+
+.myList1 {
+  .van-cell {
+    padding: 10px 16px;
+
+    &:after {
+      border-bottom: none;
+    }
+  }
+}
+.historAllVisit {
+  .TCFXListItem {
+    display: inline-block;
+    border: 1px solid #ccc;
+    padding: 3px 5px;
+    margin: 0 5px;
+    border-radius: 6px;
+  }
+}
+</style>
+<style lang="scss" scoped>
+.bgcolor {
+  background-color: #f5f5f5;
+}
+
+.container {
+  padding-bottom: 50px;
+}
+
+.monthNow {
+  height: 34px;
+  line-height: 34px;
+  text-align: left;
+  font-weight: bold;
+  padding: 0 16px;
+  box-sizing: border-box;
+  background-color: #f1f1f1;
+  border-radius: 20px;
+  margin: 8px;
+  border: 1px solid #ccc;
+  position: relative;
+  color: #333;
+  font-size: 14px;
+  .van-cell__left-icon,
+  .van-cell__right-icon {
+    line-height: 34px;
+  }
+  .CalendarIcon {
+    float: right;
+    font-size: 24px;
+    color: #1989fa;
+    margin-top: 6px;
+    position: absolute;
+    right: 12px;
+    img {
+      height: 0.8em;
+    }
+  }
+}
+.serchInput {
+  padding: 0 4px;
+}
+.selectcell {
+  width: 92%;
+}
+.card {
+  box-sizing: border-box;
+
+  .title {
+    font-size: 16px;
+    font-weight: bold;
+    color: #333;
+    line-height: 30px;
+    width: 78%;
+  }
+
+  .info {
+    font-size: 14px;
+    color: #909090;
+    line-height: 26px;
+  }
+}
+
+/**/
+.searcTime {
+  background-color: white;
+}
+.btnbox {
+  padding: 0 16px;
+}
+.cellcontent .centerBtn {
+  margin: 0 auto 10px;
+  display: block;
+  width: 92%;
+  border-radius: 5px;
+}
+
+.statstext {
+  background-color: #1c84c6;
+  position: absolute;
+  right: 0;
+  top: 16px;
+  padding: 2px 6px 2px 12px;
+  border-bottom-left-radius: 60px;
+  border-top-left-radius: 60px;
+  color: #fff;
+}
+
+.stateAbnormal {
+  position: absolute;
+  right: 0;
+  top: 0;
+  color: #fff;
+  background-color: red;
+  border-radius: 5px;
+  display: inline-block;
+  padding: 0 5px;
+}
+
+.state {
+  position: absolute;
+  right: 0;
+  top: 0;
+  color: #fff;
+  background-color: #1c84c6;
+  border-radius: 5px;
+  display: inline-block;
+  padding: 0 5px;
+}
+
+.navBarTOP {
+  position: fixed;
+  width: 100%;
+  z-index: 2;
+  top: 0;
+}
+.cellcontent .textRight {
+  float: right;
+  color: #0057ba;
+}
+</style>

+ 698 - 0
src/views/historicalVisit/historAllVisit copy.vue

@@ -0,0 +1,698 @@
+<template>
+  <div class="bgcolor historAllVisit">
+    <div class="navBarTOP">
+      <!--        顶部条-->
+      <van-nav-bar class="navBar" title="历史拜访" left-arrow @click-left="onClickLeft" />
+      <div class="searcTime">
+        <van-row class="serchInput">
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="companyName"
+              is-link
+              arrow-direction="down"
+              @click="regionClick" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="regionName"
+              is-link
+              @click="SalesRegionClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="deptName"
+              is-link
+              @click="SalesDepartmentClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="userName"
+              is-link
+              @click="StaffClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <div class="monthNow" @click="startTimeshow = true">
+              <span class="month">{{ startTime }}</span>
+              <van-icon class="CalendarIcon" :name="timeico" />
+            </div>
+          </van-col>
+          <van-col span="12">
+            <div class="monthNow" @click="endTimeshow = true">
+              <span class="month">{{ endTime }}</span>
+              <van-icon class="CalendarIcon" :name="timeico" />
+            </div>
+          </van-col>
+        </van-row>
+      </div>
+      <div class="searchDiv">
+        <van-search v-model="storeName" show-action placeholder="搜索名称/编号/地址/拜访人">
+          <template #action>
+            <div @click="onSearch">搜索</div>
+          </template>
+        </van-search>
+      </div>
+      <div class="lineGrey"></div>
+    </div>
+    <!--        主体内容-->
+    <div class="container" style="margin-top: 262px">
+      <van-list
+        class="myList1"
+        v-model="loading"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad">
+        <div v-if="list.length > 0">
+          <div class="cellcontent" v-for="(item, index) in list" :key="index">
+            <van-cell>
+              <div class="card" style="position: relative" @click="detilsFn(item)">
+                <span v-if="item.visitSource == 2" class="stateAbnormal">异常拜访</span>
+                <!--<span v-if="item.visitModel==5" class="state">偏差过大</span>-->
+                <span v-if="item.visitSource == 1" class="state">正常拜访</span>
+                <div class="title">
+                  <span>{{ item.storeName }}</span> (<span style="color: #0057ba">{{
+                    item.storeCode
+                  }}</span
+                  >)
+                </div>
+                <div class="info">拜访人:{{ item.nickName }}</div>
+                <div class="info">
+                  拜访时间:{{ item.visitsTime }}
+                  <span class="textRight" v-if="item.status == '1' && item.taskId == null"
+                    >审批中</span
+                  >
+                  <span
+                    class="textRight"
+                    v-if="item.status == '1' && item.taskId != null"
+                    style="color: red"
+                    >退回修改</span
+                  >
+                  <span class="textRight" style="color: #07c160" v-if="item.status == 2"
+                    >审批完成</span
+                  >
+                  <span class="textRight" v-if="item.status == '3'" style="color: red">拒绝</span>
+                </div>
+                <div class="info" v-if="item.dwellTime">拜访时长:{{ item.dwellTime }}</div>
+                <div class="info">地址:{{ item.addressLine }}</div>
+              </div>
+              <!-- 分销店 -->
+              <template
+                v-if="
+                  item.sfaStoreType &&
+                  item.sfaStoreType.type == 'fxd' &&
+                  item.sfaStoreChainsContactList
+                ">
+                <div class="info">
+                  经销商:
+                  <div class="TCFXListItem" v-for="(item, index) in item.sfaStoreChainsContactList">
+                    <el-popover
+                      popper-class="zpover zpoverStoreztype"
+                      placement="bottom-start"
+                      trigger="click">
+                      <div>
+                        <div>{{ item.chainCode }}</div>
+                        <div>{{ item.chainName }}</div>
+                      </div>
+                      <div slot="reference" :key="index">
+                        {{ item.categoryDescribe }}
+                      </div>
+                    </el-popover>
+                  </div>
+                </div>
+              </template>
+              <template v-else>
+                <div class="info">经销商:{{ item.chainName }}</div>
+              </template>
+            </van-cell>
+            <div class="lineGrey"></div>
+          </div>
+        </div>
+      </van-list>
+      <!--      <p style="text-align: center;color: #ccc;font-size: 12px;" v-if="list.length!=0">&#45;&#45;已经到底了&#45;&#45;</p>-->
+      <!--      <van-empty description="&#45;&#45;已经到底了&#45;&#45;" v-if="list.length==0"/>-->
+    </div>
+    <van-popup v-model="startTimeshow" position="bottom" :style="{ height: '30%' }">
+      <van-datetime-picker
+        v-model="startcurrentDate"
+        type="date"
+        title="开始日期"
+        :min-date="minDate"
+        :max-date="startmaxDate"
+        @confirm="dateeconfirm"
+        @cancel="startTimeshow = false" />
+    </van-popup>
+    <van-popup v-model="endTimeshow" position="bottom" :style="{ height: '50%' }">
+      <van-datetime-picker
+        v-model="currentDate"
+        type="date"
+        title="开始日期"
+        :min-date="endminDate"
+        :max-date="maxDate"
+        @confirm="endTimeconfirm"
+        @cancel="endTimeshow = false" />
+    </van-popup>
+    <van-popup v-model="RegionShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="companyList"
+        value-key="deptName"
+        @confirm="onregionConfirm"
+        @cancel="RegionShow = false" />
+    </van-popup>
+    <van-popup v-model="SalesRegionShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="regionList"
+        value-key="deptName"
+        @confirm="onSalesRegionConfirm"
+        @cancel="SalesRegionShow = false" />
+    </van-popup>
+    <van-popup v-model="SalesDepartmentShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="deptList"
+        value-key="deptName"
+        @confirm="onSalesDepartmentConfirm"
+        @cancel="SalesDepartmentShow = false" />
+    </van-popup>
+    <van-popup v-model="StaffShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="userList"
+        @confirm="onStaffConfirm"
+        value-key="nickName"
+        @cancel="StaffShow = false" />
+    </van-popup>
+  </div>
+</template>
+
+<script>
+import { getVisits, getvisitDeptInfo } from '@/api/index';
+import timeico from '@/assets/Icon/datatims.png';
+
+export default {
+  name: 'index.vue',
+  data() {
+    return {
+      timeico: timeico,
+      defaultDate: new Date(),
+      searchValue: '',
+      calendarShow: '',
+      monthNames: [
+        '-01',
+        '-02',
+        '-03',
+        '-04',
+        '-05',
+        '-06',
+        '-07',
+        '-08',
+        '-09',
+        '-10',
+        '-11',
+        '-12',
+      ],
+      calendarIsshow: false,
+      tabVal: 'insidePlan',
+      list: [],
+      loading: false,
+      finished: true,
+      listActive: null,
+      query: '',
+      show: false,
+      minDate: new Date(2022, 0, 1),
+      maxDate: new Date(),
+      currentDate: new Date(),
+      startcurrentDate: new Date(),
+      endminDate: new Date(),
+      startmaxDate: new Date(),
+      endTime: '',
+      startTime: '',
+      endTimeshow: false,
+      startTimeshow: false,
+      storeName: '',
+      companyName: '全部公司',
+      deptName: '全部销售部',
+      regionName: '全部大区',
+      userName: '全部业务员',
+      companyCode: '',
+      deptCode: '',
+      regionCode: '',
+      userCode: '',
+      companyList: [],
+      deptList: [],
+      regionList: [],
+      userList: [],
+      RegionShow: false,
+      SalesRegionShow: false,
+      SalesDepartmentShow: false,
+      StaffShow: false,
+      deptForm: { type: '', parentId: '' },
+      pageNum: 1, // 当前页码  int类型
+      pageSize: 10, // 当前每页条数  int类型
+      deptLevel: null,
+    };
+  },
+  activated() {
+    this.deptLevel = localStorage.getItem('deptLevel');
+    this.onSearch();
+  },
+  created() {
+    this.info();
+    this.userList = [];
+    this.pageNum = 1;
+    this.list = [];
+    // powerGrade:等级(1-销售员 2-销售部主管 3-大区主管 4-区域公司总经理 5-DIY公司)
+    this.powerGrade = localStorage.getItem('powerGrade');
+    this.getDeptInfo('dept');
+    if (this.powerGrade == 5) {
+      setTimeout(() => {
+        if (this.$route.query.userCode == undefined) {
+          this.companyName = this.companyList[0].deptName;
+          this.companyCode = this.companyList[0].deptId;
+        }
+        this.getDeptInfo('dept', 1);
+      }, 1000);
+    }
+    if (this.powerGrade == 4) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 1);
+      }, 1000);
+    }
+    if (this.powerGrade == 3) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 2);
+      }, 1000);
+    }
+    if (this.powerGrade == 2 || this.powerGrade == 1) {
+      setTimeout(() => {
+        this.getDeptInfo('user');
+      }, 2000);
+    }
+  },
+  methods: {
+    onLoad() {
+      // this.loading = false;
+      this.getVisitsListFn();
+    },
+    info() {
+      this.query = this.$route.query;
+      this.startTime = this.getDay(-7);
+      this.startcurrentDate = new Date(this.getDay(-7));
+      this.endTime = this.parseTime(new Date(), '{y}-{m}-{d}');
+      this.endminDate = new Date(this.getDay(-7));
+    },
+    detilsFn(val) {
+      this.$router.push({
+        path: '/historicalDetails',
+        query: {
+          visitId: val.id,
+          storeId: val.storeId,
+          storeCode: val.storeCode,
+          taskId: val.taskId,
+          userId: val.userId,
+          storeCategory: val.storeCategory,
+        },
+      });
+    },
+    timeBefore7(date) {
+      if (!date) {
+        date = new Date();
+      }
+      var y = date.getFullYear();
+      var m = date.getMonth() + 1;
+      var d = date.getDate() - 6;
+      if (d < 0) {
+        m = date.getMonth();
+        var d1 = new Date(y, m, 0);
+        var d2 = d1.getDate();
+        return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d2 + d);
+      } else {
+        return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d < 10 ? '0' + d : d);
+      }
+    },
+    getDay(day) {
+      var today = new Date();
+      var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
+      today.setTime(targetday_milliseconds); //注意,这行是关键代码
+      var tYear = today.getFullYear();
+      var tMonth = today.getMonth();
+      var tDate = today.getDate();
+      tMonth = this.doHandleMonth(tMonth + 1);
+      tDate = this.doHandleMonth(tDate);
+      return tYear + '-' + tMonth + '-' + tDate;
+    },
+    doHandleMonth(month) {
+      var m = month;
+      if (month.toString().length == 1) {
+        m = '0' + month;
+      }
+      return m;
+    },
+    dateeconfirm() {
+      this.startTimeshow = false;
+      this.startTime = this.parseTime(this.startcurrentDate, '{yy}-{mm}-{dd}');
+      this.endminDate = new Date(this.startcurrentDate);
+      this.onSearch();
+    },
+    endTimeconfirm() {
+      this.endTimeshow = false;
+      this.endTime = this.parseTime(this.currentDate, '{yy}-{mm}-{dd}');
+      this.startmaxDate = new Date(this.currentDate);
+      this.onSearch();
+    },
+    onClickLeft() {
+      this.$router.go(-1);
+    },
+    onSearch() {
+      this.pageNum = 1;
+      this.list = [];
+      this.getVisitsListFn();
+    },
+    getVisitsListFn() {
+      let loading1 = this.$toast.loading({
+        duration: 0,
+        message: '数据获取中...',
+        forbidClick: true,
+      });
+      if (this.refreshing) {
+        this.list = [];
+        this.refreshing = false;
+      }
+      getVisits({
+        startTime: this.startTime + ' 00:00:00', //
+        stopTime: this.endTime + ' 24:00:00', //
+        storeRequest: this.storeName.trim(),
+        pageNum: this.pageNum,
+        pageSize: this.pageSize,
+        companyId: this.companyCode,
+        regionId: this.regionCode,
+        userId: this.userCode,
+        deptId: this.deptCode,
+      }).then((res) => {
+        loading1.clear();
+        if (res.code == 200) {
+          this.loading = false;
+          this.list = this.list.concat(res.data);
+          if (this.list.length >= res.total) {
+            this.finished = true;
+          } else {
+            this.finished = false;
+          }
+          this.pageNum = this.pageNum + 1;
+        } else {
+          this.$toast.fail(res.msg);
+        }
+      });
+    },
+    regionClick() {
+      // if(this.powerGrade>4){
+      this.RegionShow = true;
+      // }
+    },
+    SalesRegionClick(val) {
+      // if(this.powerGrade>3){
+      this.SalesRegionShow = true;
+      // }
+    },
+    SalesDepartmentClick() {
+      // if(this.powerGrade>2){
+      this.SalesDepartmentShow = true;
+      // }
+    },
+    StaffClick() {
+      this.StaffShow = true;
+    },
+    StartTimeClick() {
+      this.StartTimeShow = true;
+    },
+    onregionConfirm(val) {
+      this.RegionShow = false;
+      this.companyName = val.deptName;
+      this.companyCode = val.deptId;
+      this.regionName = '全部大区';
+      this.regionCode = '';
+      this.deptName = '全部销售部';
+      this.deptCode = '';
+      this.userName = '全部业务员';
+      this.userCode = '';
+      this.getDeptInfo('dept', 1);
+    },
+    onSalesRegionConfirm(val) {
+      this.SalesRegionShow = false;
+      this.regionName = val.deptName;
+      this.regionCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('dept', 2);
+      }
+      this.deptName = '全部销售部';
+      this.deptCode = '';
+      this.userName = '全部业务员';
+      this.userCode = '';
+      this.userList = [];
+    },
+    onSalesDepartmentConfirm(val) {
+      this.SalesDepartmentShow = false;
+      this.deptName = val.deptName;
+      this.deptCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('user');
+      }
+      this.userName = '全部业务员';
+      this.userCode = '';
+    },
+    onStaffConfirm(val) {
+      this.StaffShow = false;
+      this.userName = val.nickName;
+      this.userCode = val.userId;
+    },
+    getDeptInfo(type, grade) {
+      this.deptForm.type = type;
+      if (type == 'dept') {
+        if (grade == '1') {
+          this.deptForm.parentId = this.companyCode;
+        } else if (grade == '2') {
+          this.deptForm.parentId = this.regionCode;
+        } else {
+          this.deptForm.type = '';
+          this.deptForm.parentId = '';
+        }
+      } else if (type == 'user') {
+        this.deptForm.parentId = this.deptCode;
+      }
+      getvisitDeptInfo(this.deptForm).then((res) => {
+        if (type == 'dept') {
+          if (grade == '1') {
+            if (res.data.region != null) {
+              this.regionList = [{ deptName: '全部大区', deptId: '' }].concat(res.data.region);
+            }
+          } else if (grade == '2') {
+            if (res.data.dept != null) {
+              this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
+            }
+          } else {
+            this.companyList = res.data.company;
+            if (this.$route.query.userCode == undefined) {
+              this.companyName = res.data.company[0].deptName;
+              this.companyCode = res.data.company[0].deptId;
+            }
+            if (res.data.dept != null) {
+              this.deptName = res.data.dept[0].deptName;
+              this.deptCode = res.data.dept[0].deptId;
+              this.deptList = res.data.dept;
+            }
+            if (res.data.region != null) {
+              this.regionName = res.data.region[0].deptName;
+              this.regionCode = res.data.region[0].deptId;
+              this.regionList = res.data.region;
+            }
+            if (res.data.user != null) {
+              this.userList = res.data.user;
+              this.userCode = '';
+            }
+          }
+        } else if (type == 'user') {
+          if (res.data.user != null) {
+            this.userList = [{ nickName: '全部业务员', userId: '' }].concat(res.data.user);
+          }
+        }
+      });
+    },
+  },
+};
+</script>
+<style lang="scss">
+.searchDiv {
+  .van-search {
+    background: #fff;
+  }
+  .van-search__action {
+    font-size: 14px;
+    color: #1989fa;
+    font-weight: bold;
+    background: #f5f5f5;
+    border-bottom-right-radius: 60px;
+    border-top-right-radius: 60px;
+    border: 1px solid #ccc;
+    padding: 0 20px;
+  }
+
+  .van-search--show-action {
+    padding-right: 12px;
+  }
+
+  .van-search__content {
+    border: 1px solid #ccc;
+    border-bottom-left-radius: 60px;
+    border-top-left-radius: 60px;
+    background: #f5f5f5;
+    border-right: 0;
+  }
+}
+
+.myList1 {
+  .van-cell {
+    padding: 10px 16px;
+
+    &:after {
+      border-bottom: none;
+    }
+  }
+}
+.historAllVisit {
+  .TCFXListItem {
+    display: inline-block;
+    border: 1px solid #ccc;
+    padding: 3px 5px;
+    margin: 0 5px;
+    border-radius: 6px;
+  }
+}
+</style>
+<style lang="scss" scoped>
+.bgcolor {
+  background-color: #f5f5f5;
+}
+
+.container {
+  padding-bottom: 50px;
+}
+
+.monthNow {
+  height: 34px;
+  line-height: 34px;
+  text-align: left;
+  font-weight: bold;
+  padding: 0 16px;
+  box-sizing: border-box;
+  background-color: #f1f1f1;
+  border-radius: 20px;
+  margin: 8px;
+  border: 1px solid #ccc;
+  position: relative;
+  color: #333;
+  font-size: 14px;
+  .van-cell__left-icon,
+  .van-cell__right-icon {
+    line-height: 34px;
+  }
+  .CalendarIcon {
+    float: right;
+    font-size: 24px;
+    color: #1989fa;
+    margin-top: 6px;
+    position: absolute;
+    right: 12px;
+    img {
+      height: 0.8em;
+    }
+  }
+}
+.serchInput {
+  padding: 0 4px;
+}
+.selectcell {
+  width: 92%;
+}
+.card {
+  box-sizing: border-box;
+
+  .title {
+    font-size: 16px;
+    font-weight: bold;
+    color: #333;
+    line-height: 30px;
+    width: 78%;
+  }
+
+  .info {
+    font-size: 14px;
+    color: #909090;
+    line-height: 26px;
+  }
+}
+
+/**/
+.searcTime {
+  background-color: white;
+}
+.btnbox {
+  padding: 0 16px;
+}
+.cellcontent .centerBtn {
+  margin: 0 auto 10px;
+  display: block;
+  width: 92%;
+  border-radius: 5px;
+}
+
+.statstext {
+  background-color: #1c84c6;
+  position: absolute;
+  right: 0;
+  top: 16px;
+  padding: 2px 6px 2px 12px;
+  border-bottom-left-radius: 60px;
+  border-top-left-radius: 60px;
+  color: #fff;
+}
+
+.stateAbnormal {
+  position: absolute;
+  right: 0;
+  top: 0;
+  color: #fff;
+  background-color: red;
+  border-radius: 5px;
+  display: inline-block;
+  padding: 0 5px;
+}
+
+.state {
+  position: absolute;
+  right: 0;
+  top: 0;
+  color: #fff;
+  background-color: #1c84c6;
+  border-radius: 5px;
+  display: inline-block;
+  padding: 0 5px;
+}
+
+.navBarTOP {
+  position: fixed;
+  width: 100%;
+  z-index: 2;
+  top: 0;
+}
+.cellcontent .textRight {
+  float: right;
+  color: #0057ba;
+}
+</style>

+ 13 - 54
src/views/historicalVisit/historAllVisit.vue

@@ -256,67 +256,25 @@ export default {
       deptForm: { type: '', parentId: '' },
       pageNum: 1, // 当前页码  int类型
       pageSize: 10, // 当前每页条数  int类型
-      formData: {
-        companyId: '', // 公司id,必传 Long类型
-        regionId: '', // 大区id,必传  Long类型
-        deptId: '', // 部门id,如果为周报或日报为必传  Long类型
-        userId: '', // 业务员id,如果为日报为必传      Long类型
-        startTime: '', // 开始时间,必传  格式:yyyy-MM-dd  String类型
-        endTime: '', // 结束时间,必传  格式:yyyy-MM-dd  String类型
-        pageNum: 1, // 当前页码  int类型
-        pageSize: 10, // 当前每页条数  int类型
-      },
+      userDeptLevel: null,
     };
   },
   activated() {
-    // watch: {
-    //   $route(to, from) {
-    //     if (from.path == "/My/index" && to.path == "/historAllVisit") {
-    //       this.info();
-    //       this.userList=[]
-    this.pageNum = 1;
-    this.list = [];
-    // this.powerGrade = localStorage.getItem("powerGrade")
-    // this.getDeptInfo("dept")
-    // if(this.powerGrade==5){
-    //   setTimeout(()=>{
-    //     if(this.$route.query.userCode==undefined){
-    //       this.companyName=this.companyList[0].deptName;
-    //       this.companyCode=this.companyList[0].deptId;
-    //     }
-    //     this.getDeptInfo("dept",1)
-    //   },1000)
-    // }
-    // if(this.powerGrade==4){
-    //   setTimeout(()=>{
-    //     this.getDeptInfo("dept",1)
-    //   },1000)
-    // }
-    // if(this.powerGrade==3){
-    //   setTimeout(()=>{
-    //     this.getDeptInfo("dept",2)
-    //   },1000)
-    // }
-    // if(this.powerGrade==2||this.powerGrade==1){
-    //   setTimeout(()=>{
-    //     this.getDeptInfo("user")
-    //   },2000)
-    // }
     setTimeout(() => {
       this.onSearch();
     }, 1000);
-    // }
-    // }
-    // },
   },
   created() {
     this.info();
     this.userList = [];
     this.pageNum = 1;
     this.list = [];
+    // powerGrade:等级(1-销售员 2-销售部主管 3-大区主管 4-区域公司总经理 5-DIY公司)
     this.powerGrade = localStorage.getItem('powerGrade');
+    // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
+    this.userDeptLevel = localStorage.getItem('userDeptLevel');
     this.getDeptInfo('dept');
-    if (this.powerGrade == 5) {
+    if (this.userDeptLevel == 0) {
       setTimeout(() => {
         if (this.$route.query.userCode == undefined) {
           this.companyName = this.companyList[0].deptName;
@@ -325,24 +283,21 @@ export default {
         this.getDeptInfo('dept', 1);
       }, 1000);
     }
-    if (this.powerGrade == 4) {
+    if (this.userDeptLevel == 1) {
       setTimeout(() => {
         this.getDeptInfo('dept', 1);
       }, 1000);
     }
-    if (this.powerGrade == 3) {
+    if (this.userDeptLevel == 2) {
       setTimeout(() => {
         this.getDeptInfo('dept', 2);
       }, 1000);
     }
-    if (this.powerGrade == 2 || this.powerGrade == 1) {
+    if (this.userDeptLevel == 3 || this.userDeptLevel == 4) {
       setTimeout(() => {
         this.getDeptInfo('user');
       }, 2000);
     }
-    // setTimeout(()=>{
-    //   this.onSearch();
-    // },1000)
   },
   methods: {
     onLoad() {
@@ -545,7 +500,11 @@ export default {
               this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
             }
           } else {
-            this.companyList = res.data.company;
+            if (this.userDeptLevel == 0) {
+              this.companyList = [{ deptName: '全部公司', deptId: '' }].concat(res.data.company);
+            } else {
+              this.companyList = res.data.company;
+            }
             if (this.$route.query.userCode == undefined) {
               this.companyName = res.data.company[0].deptName;
               this.companyCode = res.data.company[0].deptId;

+ 1 - 0
src/views/home/ABtarget.vue

@@ -689,6 +689,7 @@ export default {
           }
           loading1.clear();
           localStorage.setItem('powerGrade', res.data.positionId);
+          localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
           localStorage.setItem('isDiy', res.data.diy);
           localStorage.setItem('uType', res.data.userType);
           localStorage.setItem('jzType', res.data.jzType);

+ 1 - 0
src/views/home/bottomBtn.vue

@@ -137,6 +137,7 @@ export default {
             this.JZQuota = false;
           }
           localStorage.setItem('powerGrade', res.data.positionId);
+          localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
           localStorage.setItem('isDiy', res.data.diy);
           localStorage.setItem('uType', res.data.userType);
           localStorage.setItem('jzType', res.data.jzType);

+ 1 - 0
src/views/home/index.vue

@@ -155,6 +155,7 @@ export default {
       getReportInfo({ isContent: false }).then((res) => {
         if (res.code == 200) {
           localStorage.setItem('powerGrade', res.data.positionId);
+          localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
           localStorage.setItem('isDiy', res.data.diy);
           localStorage.setItem('uType', res.data.userType);
           localStorage.setItem('jzType', res.data.jzType);

+ 11 - 5
src/views/week/VisitSummary.vue

@@ -189,8 +189,10 @@ export default {
     this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + '';
     this.endminDate = new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'), 2));
     this.powerGrade = localStorage.getItem('powerGrade');
+    // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
+    this.userDeptLevel = localStorage.getItem('userDeptLevel');
     this.getDeptInfo('dept');
-    if (this.powerGrade == 5) {
+    if (this.userDeptLevel == 0) {
       setTimeout(() => {
         if (this.$route.query.userCode == undefined) {
           this.companyName = this.companyList[0].deptName;
@@ -199,17 +201,17 @@ export default {
         this.getDeptInfo('dept', 1);
       }, 1000);
     }
-    if (this.powerGrade == 4) {
+    if (this.userDeptLevel == 1) {
       setTimeout(() => {
         this.getDeptInfo('dept', 1);
       }, 1000);
     }
-    if (this.powerGrade == 3) {
+    if (this.userDeptLevel == 2) {
       setTimeout(() => {
         this.getDeptInfo('dept', 2);
       }, 1000);
     }
-    if (this.powerGrade == 2 || this.powerGrade == 1) {
+    if (this.userDeptLevel == 3 || this.userDeptLevel == 4) {
       setTimeout(() => {
         this.getDeptInfo('user');
       }, 2000);
@@ -417,7 +419,11 @@ export default {
               this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
             }
           } else {
-            this.companyList = res.data.company;
+            if (this.userDeptLevel == 0) {
+              this.companyList = [{ deptName: '全部公司', deptId: '' }].concat(res.data.company);
+            } else {
+              this.companyList = res.data.company;
+            }
             if (this.$route.query.userCode == undefined) {
               this.companyName = res.data.company[0].deptName;
               this.companyCode = res.data.company[0].deptId;

+ 2 - 0
src/views/week/daily.vue

@@ -602,6 +602,7 @@ export default {
               });
           } else {
             localStorage.setItem('powerGrade', res.data.positionId);
+            localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
             this.GZQuota = false;
             this.JZQuota = false;
             this.YFQuota = res.data.postType == 'YF' ? true : false;
@@ -778,6 +779,7 @@ export default {
       getReportInfo({ isContent: true }).then((res) => {
         loading1.clear();
         localStorage.setItem('powerGrade', res.data.positionId);
+        localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
         this.powerGrade = res.data.positionId;
         this.showButton = res.data.showButton;
         this.type = res.data.userType;

+ 383 - 373
src/views/week/dailyHistorical.vue

@@ -1,145 +1,144 @@
 <template>
   <div class="bgcolor">
     <!--        顶部条-->
-    <van-nav-bar
-        class="navBar"
-        title="下属业务员历史日报"
-        left-arrow
-        @click-left="onClickLeft"
-    />
+    <van-nav-bar class="navBar" title="下属业务员历史日报" left-arrow @click-left="onClickLeft" />
     <div class="container contentpd16 containers">
       <van-row gutter="20">
         <van-col span="12">
-          <van-cell :title="companyName"  is-link arrow-direction="down" @click="regionClick"/>
+          <van-cell :title="companyName" is-link arrow-direction="down" @click="regionClick" />
         </van-col>
         <van-col span="12">
-          <van-cell :title="regionName"  is-link @click="SalesRegionClick" arrow-direction="down"/>
+          <van-cell :title="regionName" is-link @click="SalesRegionClick" arrow-direction="down" />
         </van-col>
         <van-col span="12">
-          <van-cell :title="deptName" is-link @click="SalesDepartmentClick" arrow-direction="down"/>
+          <van-cell
+            :title="deptName"
+            is-link
+            @click="SalesDepartmentClick"
+            arrow-direction="down" />
         </van-col>
         <van-col span="12">
-          <van-cell :title="userName" is-link @click="StaffClick" arrow-direction="down"/>
+          <van-cell :title="userName" is-link @click="StaffClick" arrow-direction="down" />
         </van-col>
         <van-col span="12">
           <van-cell :title="formData.startTime" is-link @click="StartTimeClick">
             <template #right-icon>
-              <van-icon :name="timeico" class="search-icon"/>
+              <van-icon :name="timeico" class="search-icon" />
             </template>
           </van-cell>
         </van-col>
         <van-col span="12">
           <van-cell :title="formData.endTime" is-link @click="EndTimeClick">
             <template #right-icon>
-              <van-icon :name="timeico" class="search-icon"/>
+              <van-icon :name="timeico" class="search-icon" />
             </template>
           </van-cell>
         </van-col>
       </van-row>
-      <br>
+      <br />
       <van-button type="info" size="small" plain class="Btn100" @click="searchBtn">查找</van-button>
     </div>
-<!--    <div class="container">-->
-<!--      <div class="cellcontent brud" style="padding: 16px 16px;background-color: #fff;">-->
-<!--        <el-table class="elTreeTableLsiy" style="text-align: center;" :data="tableList" row-key="id" border lazy  :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">-->
-<!--          <el-table-column prop="month"  label="月份" width="60" />-->
-<!--          <el-table-column prop="commitRate"  label="提交率%" />-->
-<!--          <el-table-column prop="approvalRate"  label="审批率%" />-->
-<!--        </el-table>-->
-<!--      </div>-->
-<!--    </div>-->
+    <!--    <div class="container">-->
+    <!--      <div class="cellcontent brud" style="padding: 16px 16px;background-color: #fff;">-->
+    <!--        <el-table class="elTreeTableLsiy" style="text-align: center;" :data="tableList" row-key="id" border lazy  :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">-->
+    <!--          <el-table-column prop="month"  label="月份" width="60" />-->
+    <!--          <el-table-column prop="commitRate"  label="提交率%" />-->
+    <!--          <el-table-column prop="approvalRate"  label="审批率%" />-->
+    <!--        </el-table>-->
+    <!--      </div>-->
+    <!--    </div>-->
     <div class="container">
-      <van-list v-model="loading" :finished="finished" @load="onLoad" finished-text="--已经到底了--">
-      <div class="cellcontent brud" v-for="(item,index) in list" :key="index">
-        <van-cell>
-          <div class="cardContent" @click="dailyFn(item)">
-            <div class="title"  >
-              <p class="textLeft">{{item.pnickName}}的日报({{item.date}})</p>
-              <p class="textRight" v-if="item.status==3">已审批</p>
-              <p class="textRight" v-if="item.status==-1">过期未汇报</p>
-              <p class="textRight" v-if="item.status==0">待汇报</p>
-              <p class="textRight" v-if="item.status==2">退回待处理</p>
-              <p class="textRight" v-if="item.status==1">待审批</p>
+      <van-list
+        v-model="loading"
+        :finished="finished"
+        @load="onLoad"
+        finished-text="--已经到底了--">
+        <div class="cellcontent brud" v-for="(item, index) in list" :key="index">
+          <van-cell>
+            <div class="cardContent" @click="dailyFn(item)">
+              <div class="title">
+                <p class="textLeft">{{ item.pnickName }}的日报({{ item.date }})</p>
+                <p class="textRight" v-if="item.status == 3">已审批</p>
+                <p class="textRight" v-if="item.status == -1">过期未汇报</p>
+                <p class="textRight" v-if="item.status == 0">待汇报</p>
+                <p class="textRight" v-if="item.status == 2">退回待处理</p>
+                <p class="textRight" v-if="item.status == 1">待审批</p>
+              </div>
+              <div class="info" v-if="item.status > 0 && item.status < 3">
+                提交时间:{{ item.commitTime }}
+              </div>
+              <div class="info" v-if="item.status < 1">创建时间:{{ dateFn(item.date) }}</div>
+              <div class="info" v-if="item.status == 3">提交时间:{{ item.commitTime }}</div>
+              <div class="info" v-if="item.status == 3">审批时间:{{ item.approvalTime }}</div>
             </div>
-            <div class="info" v-if="item.status>0&&item.status<3">提交时间:{{item.commitTime}}</div>
-            <div class="info" v-if="item.status<1">创建时间:{{dateFn(item.date)}}</div>
-            <div class="info" v-if="item.status==3">提交时间:{{item.commitTime}}</div>
-            <div class="info" v-if="item.status==3">审批时间:{{item.approvalTime}}</div>
-          </div>
-        </van-cell>
-      </div>
-      <van-empty  v-if="list.length==0"/>
+          </van-cell>
+        </div>
+        <van-empty v-if="list.length == 0" />
       </van-list>
     </div>
-    <br>
-    <br>
+    <br />
+    <br />
     <van-popup v-model="RegionShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="companyList"
-          value-key="deptName"
-          @confirm="onregionConfirm"
-          @cancel="RegionShow = false"
-      />
+        show-toolbar
+        :columns="companyList"
+        value-key="deptName"
+        @confirm="onregionConfirm"
+        @cancel="RegionShow = false" />
     </van-popup>
     <van-popup v-model="SalesRegionShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="regionList"
-          value-key="deptName"
-          @confirm="onSalesRegionConfirm"
-          @cancel="SalesRegionShow = false"
-      />
+        show-toolbar
+        :columns="regionList"
+        value-key="deptName"
+        @confirm="onSalesRegionConfirm"
+        @cancel="SalesRegionShow = false" />
     </van-popup>
     <van-popup v-model="SalesDepartmentShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="deptList"
-          value-key="deptName"
-          @confirm="onSalesDepartmentConfirm"
-          @cancel="SalesDepartmentShow = false"
-      />
+        show-toolbar
+        :columns="deptList"
+        value-key="deptName"
+        @confirm="onSalesDepartmentConfirm"
+        @cancel="SalesDepartmentShow = false" />
     </van-popup>
     <van-popup v-model="StaffShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="userList"
-          @confirm="onStaffConfirm"
-          value-key="nickName"
-          @cancel="StaffShow = false"
-      />
+        show-toolbar
+        :columns="userList"
+        @confirm="onStaffConfirm"
+        value-key="nickName"
+        @cancel="StaffShow = false" />
     </van-popup>
 
     <van-popup v-model="StartTimeShow" capture position="bottom">
       <van-datetime-picker
-          v-model="strtcurrentDate"
-          type="date"
-          title="选择查找开始时间"
-          :min-date="strtminDate"
-          :max-date="strtmaxDate"
-          @confirm="onStartTimeConfirm"
-          @cancel="StartTimeShow = false"
-      />
+        v-model="strtcurrentDate"
+        type="date"
+        title="选择查找开始时间"
+        :min-date="strtminDate"
+        :max-date="strtmaxDate"
+        @confirm="onStartTimeConfirm"
+        @cancel="StartTimeShow = false" />
     </van-popup>
     <van-popup v-model="EndTimeShow" capture position="bottom">
       <van-datetime-picker
-          v-model="endcurrentDate"
-          type="date"
-          title="选择查找结束时间"
-          :min-date="endminDate"
-          :max-date="endmaxDate"
-          @confirm="onEndTimeConfirm"
-          @cancel="EndTimeShow = false"
-      />
+        v-model="endcurrentDate"
+        type="date"
+        title="选择查找结束时间"
+        :min-date="endminDate"
+        :max-date="endmaxDate"
+        @confirm="onEndTimeConfirm"
+        @cancel="EndTimeShow = false" />
     </van-popup>
   </div>
 </template>
 
 <script>
-import timeico from "@/assets/Icon/datatims.png";
-import {getDeptInfo,querySubReport} from "@/api/index";
+import timeico from '@/assets/Icon/datatims.png';
+import { getDeptInfo, querySubReport } from '@/api/index';
 export default {
-  name: "MyHistoricalWeekly",
+  name: 'MyHistoricalWeekly',
   data() {
     return {
       timeico: timeico,
@@ -149,180 +148,186 @@ export default {
       StaffShow: false,
       StartTimeShow: false,
       EndTimeShow: false,
-      PhotoTypeList: [{text: "009", value: "09"}],
+      PhotoTypeList: [{ text: '009', value: '09' }],
       strtminDate: new Date(2022, 0, 1),
       endminDate: new Date(2022, 0, 1),
       strtmaxDate: new Date(),
       endmaxDate: new Date(),
       strtcurrentDate: new Date(),
       endcurrentDate: new Date(),
-      companyName:"全部公司",
-      deptName:"全部销售部",
-      regionName:"全部大区",
-      userName:"全部业务员",
-      companyCode:"",
-      deptCode:"",
-      regionCode:"",
-      userCode:"",
-      companyList:[],
-      deptList:[],
-      regionList:[],
-      userList:[],
-      deptForm:{type:"",parentId:""},
-      list:[],
+      companyName: '全部公司',
+      deptName: '全部销售部',
+      regionName: '全部大区',
+      userName: '全部业务员',
+      companyCode: '',
+      deptCode: '',
+      regionCode: '',
+      userCode: '',
+      companyList: [],
+      deptList: [],
+      regionList: [],
+      userList: [],
+      deptForm: { type: '', parentId: '' },
+      list: [],
       loading: false,
       finished: true,
-      formData:{
-          type:"1", // 汇报类型或入口 1-下属业务员日报 2-下属销售部主管周报 3-下属大区主管半月报
-          companyId:"", // 公司id,必传 Long类型
-          regionId:"", // 大区id,必传  Long类型
-          deptId:"", // 部门id,如果为周报或日报为必传  Long类型
-          userId:"", // 业务员id,如果为日报为必传      Long类型
-          startTime:"", // 开始时间,必传  格式:yyyy-MM-dd  String类型
-          endTime:"", // 结束时间,必传  格式:yyyy-MM-dd  String类型
-          pageNum:1 , // 当前页码  int类型
-          pageSize:10, // 当前每页条数  int类型
+      formData: {
+        type: '1', // 汇报类型或入口 1-下属业务员日报 2-下属销售部主管周报 3-下属大区主管半月报
+        companyId: '', // 公司id,必传 Long类型
+        regionId: '', // 大区id,必传  Long类型
+        deptId: '', // 部门id,如果为周报或日报为必传  Long类型
+        userId: '', // 业务员id,如果为日报为必传      Long类型
+        startTime: '', // 开始时间,必传  格式:yyyy-MM-dd  String类型
+        endTime: '', // 结束时间,必传  格式:yyyy-MM-dd  String类型
+        pageNum: 1, // 当前页码  int类型
+        pageSize: 10, // 当前每页条数  int类型
       },
-      tableList:[]
-    }
+      tableList: [],
+      userDeptLevel: null,
+    };
   },
-  beforeDestroy(){
-    console.log("999900")
+  beforeDestroy() {
+    console.log('999900');
   },
   created() {
-    this.userList=[]
-    this.formData.startTime =this.getThreeDaysAgo()
+    this.userList = [];
+    this.formData.startTime = this.getThreeDaysAgo();
     // this.formData.startTime = this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),2)
     // this.strtcurrentDate=new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),2))
-    this.strtcurrentDate=new Date(this.getThreeDaysAgo())
-    this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + ""
-    this.endminDate=new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),2))
-    this.powerGrade = localStorage.getItem("powerGrade")
-     this.getDeptInfo("dept")
-    if(this.powerGrade==5){
-      setTimeout(()=>{
-        if(this.$route.query.userCode==undefined){
-        this.companyName=this.companyList[0].deptName;
-        this.companyCode=this.companyList[0].deptId;
+    this.strtcurrentDate = new Date(this.getThreeDaysAgo());
+    this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + '';
+    this.endminDate = new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'), 2));
+    this.powerGrade = localStorage.getItem('powerGrade');
+    // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
+    this.userDeptLevel = localStorage.getItem('userDeptLevel');
+    this.getDeptInfo('dept');
+    if (this.userDeptLevel == 0) {
+      setTimeout(() => {
+        if (this.$route.query.userCode == undefined) {
+          this.companyName = this.companyList[0].deptName;
+          this.companyCode = this.companyList[0].deptId;
         }
-        this.getDeptInfo("dept",1)
-      },1000)
+        this.getDeptInfo('dept', 1);
+      }, 1000);
     }
-    if(this.powerGrade==4){
-      setTimeout(()=>{
-        this.getDeptInfo("dept",1)
-      },1000)
+    if (this.userDeptLevel == 1) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 1);
+      }, 1000);
     }
-    if(this.powerGrade==3){
-      setTimeout(()=>{
-        this.getDeptInfo("dept",2)
-      },1000)
+    if (this.userDeptLevel == 2) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 2);
+      }, 1000);
     }
-    if(this.powerGrade==2||this.powerGrade==1){
-      setTimeout(()=>{
-        this.getDeptInfo("user")
-      },2000)
+    if (this.userDeptLevel == 3 || this.userDeptLevel == 4) {
+      setTimeout(() => {
+        this.getDeptInfo('user');
+      }, 2000);
     }
-    if(this.$route.query.userCode!=undefined){
-      this.companyName=this.$route.query.companyName
-      this.companyCode=this.$route.query.companyCode
-      this.regionName=this.$route.query.regionName
-      this.regionCode=this.$route.query.regionCode
-      this.userCode=this.$route.query.userCode
-      this.userName=this.$route.query.userName
-      this.deptName=this.$route.query.deptName
-      this.deptCode=this.$route.query.deptCode
-      this.formData.startTime=this.$route.query.startTime
-      this.formData.endTime=this.$route.query.endTime
-        this.searchBtn()
-        this.getDeptInfo("dept",2)
-        this.getDeptInfo("user")
-    }else{
-      setTimeout(()=>{
-        this.searchBtn()
-      },1000)
+    if (this.$route.query.userCode != undefined) {
+      this.companyName = this.$route.query.companyName;
+      this.companyCode = this.$route.query.companyCode;
+      this.regionName = this.$route.query.regionName;
+      this.regionCode = this.$route.query.regionCode;
+      this.userCode = this.$route.query.userCode;
+      this.userName = this.$route.query.userName;
+      this.deptName = this.$route.query.deptName;
+      this.deptCode = this.$route.query.deptCode;
+      this.formData.startTime = this.$route.query.startTime;
+      this.formData.endTime = this.$route.query.endTime;
+      this.searchBtn();
+      this.getDeptInfo('dept', 2);
+      this.getDeptInfo('user');
+    } else {
+      setTimeout(() => {
+        this.searchBtn();
+      }, 1000);
     }
   },
   watch: {
     $route(to, from) {
-      if(to.path=="/subordinateHistoricalDaily"&&from.path!="/dailyHistoricalDetails"){
-        if(this.$route.query.userCode!=undefined){
-          this.companyName=this.$route.query.companyName
-          this.companyCode=this.$route.query.companyCode
-          this.regionName=this.$route.query.regionName
-          this.regionCode=this.$route.query.regionCode
-          this.userCode=this.$route.query.userCode
-          this.userName=this.$route.query.userName
-          this.deptName=this.$route.query.deptName
-          this.deptCode=this.$route.query.deptCode
-          this.formData.startTime=this.$route.query.startTime
-          this.formData.endTime=this.$route.query.endTime
-          this.searchBtn()
-          setTimeout(()=>{
-           this.getDeptInfo("dept",2)
-           this.getDeptInfo("user")
-          })
-        }else{
-          this.userList=[]
-          this.formData.pageNum=1
+      if (to.path == '/subordinateHistoricalDaily' && from.path != '/dailyHistoricalDetails') {
+        if (this.$route.query.userCode != undefined) {
+          this.companyName = this.$route.query.companyName;
+          this.companyCode = this.$route.query.companyCode;
+          this.regionName = this.$route.query.regionName;
+          this.regionCode = this.$route.query.regionCode;
+          this.userCode = this.$route.query.userCode;
+          this.userName = this.$route.query.userName;
+          this.deptName = this.$route.query.deptName;
+          this.deptCode = this.$route.query.deptCode;
+          this.formData.startTime = this.$route.query.startTime;
+          this.formData.endTime = this.$route.query.endTime;
+          this.searchBtn();
+          setTimeout(() => {
+            this.getDeptInfo('dept', 2);
+            this.getDeptInfo('user');
+          });
+        } else {
+          this.userList = [];
+          this.formData.pageNum = 1;
           this.list = [];
-          this.tableList=[];
-          this.regionName="全部大区"
-          this.regionCode=""
-          this.deptName="全部销售部"
-          this.deptCode=""
-          this.userCode=""
-          this.userName="全部业务员"
-          this.powerGrade = localStorage.getItem("powerGrade")
-          this.getDeptInfo("dept")
-          if(this.powerGrade==5){
-            setTimeout(()=>{
-              if(this.$route.query.userCode==undefined){
-              this.companyName=this.companyList[0].deptName;
-              this.companyCode=this.companyList[0].deptId;}
-              this.getDeptInfo("dept",1)
-            },1000)
+          this.tableList = [];
+          this.regionName = '全部大区';
+          this.regionCode = '';
+          this.deptName = '全部销售部';
+          this.deptCode = '';
+          this.userCode = '';
+          this.userName = '全部业务员';
+          this.powerGrade = localStorage.getItem('powerGrade');
+          // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
+          this.userDeptLevel = localStorage.getItem('userDeptLevel');
+          this.getDeptInfo('dept');
+          if (this.userDeptLevel == 0) {
+            setTimeout(() => {
+              if (this.$route.query.userCode == undefined) {
+                this.companyName = this.companyList[0].deptName;
+                this.companyCode = this.companyList[0].deptId;
+              }
+              this.getDeptInfo('dept', 1);
+            }, 1000);
           }
-          if(this.powerGrade==4){
-            setTimeout(()=>{
-              this.getDeptInfo("dept",1)
-            },1000)
+          if (this.userDeptLevel == 1) {
+            setTimeout(() => {
+              this.getDeptInfo('dept', 1);
+            }, 1000);
           }
-          if(this.powerGrade==3){
-            setTimeout(()=>{
-              this.getDeptInfo("dept",2)
-            },1000)
+          if (this.userDeptLevel == 2) {
+            setTimeout(() => {
+              this.getDeptInfo('dept', 2);
+            }, 1000);
           }
-          if(this.powerGrade==2||this.powerGrade==1){
-            setTimeout(()=>{
-              this.getDeptInfo("user")
-            },2000)
+          if (this.userDeptLevel == 3 || this.userDeptLevel == 4) {
+            setTimeout(() => {
+              this.getDeptInfo('user');
+            }, 2000);
           }
-          setTimeout(()=>{
-            this.searchBtn()
-          },1000)
+          setTimeout(() => {
+            this.searchBtn();
+          }, 1000);
         }
-        }
-    }
+      }
+    },
   },
   methods: {
-    dateFn(val){
-      return val.slice(0,4)+"-"+val.slice(4,6)+"-"+val.slice(6,8)
+    dateFn(val) {
+      return val.slice(0, 4) + '-' + val.slice(4, 6) + '-' + val.slice(6, 8);
     },
-    onLoad(){
-      this.querySubReport()
+    onLoad() {
+      this.querySubReport();
     },
-    searchBtn(){
+    searchBtn() {
       // if(this.userCode==""){
       //   this.$toast("业务员未选择")
       // }else{
-        this.formData.pageNum=1
-        this.list = [];
-        this.querySubReport()
+      this.formData.pageNum = 1;
+      this.list = [];
+      this.querySubReport();
       // }
     },
-    querySubReport(){
-      let loading1=this.$toast.loading({
+    querySubReport() {
+      let loading1 = this.$toast.loading({
         duration: 0,
         message: '加载中...',
         forbidClick: true,
@@ -331,24 +336,24 @@ export default {
         this.list = [];
         this.refreshing = false;
       }
-      this.formData.companyId=this.companyCode; // 公司id,必传 Long类型
-      this.formData.regionId=this.regionCode; // 大区id,必传  Long类型
-      this.formData.deptId=this.deptCode; // 部门id,如果为周报或日报为必传  Long类型
-      this.formData.userId=this.userCode; // 业务员id,如果为日报为必传      Long类型
-      querySubReport(this.formData).then(res=>{
-        loading1.clear()
-        if(res.code==200){
-          this.loading=false
-        this.list = this.list.concat(res.data)
-        if (this.list.length >=res.total) {
-          this.finished = true;
-        }else{
-          this.finished = false;
-        }
-        this.formData.pageNum=this.formData.pageNum+1
-        // this.tableList=res.data.rates
+      this.formData.companyId = this.companyCode; // 公司id,必传 Long类型
+      this.formData.regionId = this.regionCode; // 大区id,必传  Long类型
+      this.formData.deptId = this.deptCode; // 部门id,如果为周报或日报为必传  Long类型
+      this.formData.userId = this.userCode; // 业务员id,如果为日报为必传      Long类型
+      querySubReport(this.formData).then((res) => {
+        loading1.clear();
+        if (res.code == 200) {
+          this.loading = false;
+          this.list = this.list.concat(res.data);
+          if (this.list.length >= res.total) {
+            this.finished = true;
+          } else {
+            this.finished = false;
+          }
+          this.formData.pageNum = this.formData.pageNum + 1;
+          // this.tableList=res.data.rates
         }
-      })
+      });
     },
     getThreeDaysAgo() {
       let myDate = new Date();
@@ -357,14 +362,10 @@ export default {
       let lastM = lw.getMonth() + 1;
       let lastD = lw.getDate();
       let startData =
-          lastY +
-          "-" +
-          (lastM < 10 ? "0" + lastM : lastM) +
-          "-" +
-          (lastD < 10 ? "0" + lastD : lastD); //三十天之前日期
+        lastY + '-' + (lastM < 10 ? '0' + lastM : lastM) + '-' + (lastD < 10 ? '0' + lastD : lastD); //三十天之前日期
       return startData;
     },
-    GetPreMonthDay(date, monthNum,type) {
+    GetPreMonthDay(date, monthNum, type) {
       var dateArr = date.split('-');
       var year = dateArr[0]; //获取当前日期的年份
       var month = dateArr[1]; //获取当前日期的月份
@@ -387,129 +388,134 @@ export default {
       if (month2 < 10) {
         month2 = '0' + month2;
       }
-      var t2 =""
-      if(monthNum>0){
-        t2= year2 + '-' + month2 + '-01';
-      }else{
-        if(type=="end"){
-          var Months=new Date().getMonth()+1
-          var days111=new Date().getDate()
+      var t2 = '';
+      if (monthNum > 0) {
+        t2 = year2 + '-' + month2 + '-01';
+      } else {
+        if (type == 'end') {
+          var Months = new Date().getMonth() + 1;
+          var days111 = new Date().getDate();
           if (Months < 10) {
             Months = '0' + Months;
           }
           if (days111 < 10) {
             days111 = '0' + days111;
           }
-          if(new Date().getFullYear()==year){
-              if(parseInt(month2)>=new Date().getMonth()+1){
-                t2= year2 + '-' + Months + '-' + days111;
-              }else{
-                var daysd=this.getMonthDays(year2,month2)
-                t2= year2 + '-' + month2 + '-' + daysd;
-              }
-          }else{
-            var daysd=this.getMonthDays(year2,month2)
-            t2= year2 + '-' + month2 + '-' + daysd;
+          if (new Date().getFullYear() == year) {
+            if (parseInt(month2) >= new Date().getMonth() + 1) {
+              t2 = year2 + '-' + Months + '-' + days111;
+            } else {
+              var daysd = this.getMonthDays(year2, month2);
+              t2 = year2 + '-' + month2 + '-' + daysd;
+            }
+          } else {
+            var daysd = this.getMonthDays(year2, month2);
+            t2 = year2 + '-' + month2 + '-' + daysd;
           }
-        }else{
-          t2= year2 + '-' + month2 + '-' + day2;
+        } else {
+          t2 = year2 + '-' + month2 + '-' + day2;
         }
       }
       return t2;
     },
-    getMonthDays(year,month){
-      var stratDate = new Date(year,month-1,1),
-          endData = new Date(year,month,1);
-      var days = (endData -stratDate)/(1000*60*60*24);
+    getMonthDays(year, month) {
+      var stratDate = new Date(year, month - 1, 1),
+        endData = new Date(year, month, 1);
+      var days = (endData - stratDate) / (1000 * 60 * 60 * 24);
       return days;
     },
-    getDeptInfo(type,grade){
-      this.deptForm.type=type
-      if(type=="dept"){
-        if(grade=="1"){
-          this.deptForm.parentId=this.companyCode
-        }else if(grade=="2"){
-          this.deptForm.parentId=this.regionCode
-        }else{
-          this.deptForm.type=""
-          this.deptForm.parentId=""
+    getDeptInfo(type, grade) {
+      this.deptForm.type = type;
+      if (type == 'dept') {
+        if (grade == '1') {
+          this.deptForm.parentId = this.companyCode;
+        } else if (grade == '2') {
+          this.deptForm.parentId = this.regionCode;
+        } else {
+          this.deptForm.type = '';
+          this.deptForm.parentId = '';
         }
-      }else if(type=="user"){
-        this.deptForm.parentId=this.deptCode
+      } else if (type == 'user') {
+        this.deptForm.parentId = this.deptCode;
       }
-      getDeptInfo(this.deptForm).then(res=>{
-        if(type=="dept"){
-          if(grade=="1"){
-            if(res.data.region!=null){
-              this.regionList=[{deptName:"全部大区",deptId:""}].concat(res.data.region)
+      getDeptInfo(this.deptForm).then((res) => {
+        if (type == 'dept') {
+          if (grade == '1') {
+            if (res.data.region != null) {
+              this.regionList = [{ deptName: '全部大区', deptId: '' }].concat(res.data.region);
+            }
+          } else if (grade == '2') {
+            if (res.data.dept != null) {
+              this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
             }
-          }else if(grade=="2"){
-            if(res.data.dept!=null){
-              this.deptList=[{deptName:"全部销售部",deptId:""}].concat(res.data.dept)
+          } else {
+            if (this.userDeptLevel == 0) {
+              this.companyList = [{ deptName: '全部公司', deptId: '' }].concat(res.data.company);
+            } else {
+              this.companyList = res.data.company;
             }
-          }else{
-            this.companyList=res.data.company
-            if(this.$route.query.userCode==undefined){
-            this.companyName=res.data.company[0].deptName
-            this.companyCode=res.data.company[0].deptId
+            if (this.$route.query.userCode == undefined) {
+              this.companyName = res.data.company[0].deptName;
+              this.companyCode = res.data.company[0].deptId;
             }
-            if(res.data.dept!=null){
-              this.deptName=res.data.dept[0].deptName
-              this.deptCode=res.data.dept[0].deptId
-              this.deptList=res.data.dept
+            if (res.data.dept != null) {
+              this.deptName = res.data.dept[0].deptName;
+              this.deptCode = res.data.dept[0].deptId;
+              this.deptList = res.data.dept;
             }
-            if(res.data.region!=null){
-              this.regionName=res.data.region[0].deptName
-              this.regionCode=res.data.region[0].deptId
-              this.regionList=res.data.region
+            if (res.data.region != null) {
+              this.regionName = res.data.region[0].deptName;
+              this.regionCode = res.data.region[0].deptId;
+              this.regionList = res.data.region;
             }
-            if(res.data.user!=null){
-              this.userList=res.data.user
-              this.userCode=""
+            if (res.data.user != null) {
+              this.userList = res.data.user;
+              this.userCode = '';
             }
           }
-        }else if(type=="user"){
-          if(res.data.user!=null){
-            this.userList=[{nickName:"全部业务员",userId:""}].concat(res.data.user)
+        } else if (type == 'user') {
+          if (res.data.user != null) {
+            this.userList = [{ nickName: '全部业务员', userId: '' }].concat(res.data.user);
           }
         }
-      })
+      });
     },
     dailyFn(row) {
-      if(row.status!='0'){
-        if(row.status==-1){
-          var dayTime=row.date;
-          var times=new Date(dayTime.slice(0, 4)+"-"+dayTime.slice(4, 6)+"-"+dayTime.slice(6, 8)).getTime()
-          var time=new Date("2022-08-25").getTime()
-          if(times<time){
+      if (row.status != '0') {
+        if (row.status == -1) {
+          var dayTime = row.date;
+          var times = new Date(
+            dayTime.slice(0, 4) + '-' + dayTime.slice(4, 6) + '-' + dayTime.slice(6, 8)
+          ).getTime();
+          var time = new Date('2022-08-25').getTime();
+          if (times < time) {
             this.$dialog.alert({
               title: '系统提示',
               message: '非常抱歉,8月25日前历史报告数据不存在',
-            })
-          }else{
+            });
+          } else {
             this.$router.push({
-              path: "/dailyHistoricalDetails",
-              query: {reportId: row.id,}
-            })
+              path: '/dailyHistoricalDetails',
+              query: { reportId: row.id },
+            });
           }
-        }else{
+        } else {
           this.$router.push({
-            path: "/dailyHistoricalDetails",
-            query: {reportId: row.id,}
-          })
+            path: '/dailyHistoricalDetails',
+            query: { reportId: row.id },
+          });
         }
       }
       // if(row.status>0){
       //
       // }
-
     },
     onClickLeft() {
-      this.$router.go(-1)
+      this.$router.go(-1);
     },
     regionClick() {
       // if(this.powerGrade>4){
-        this.RegionShow = true;
+      this.RegionShow = true;
       // }
     },
     SalesRegionClick(val) {
@@ -519,7 +525,7 @@ export default {
     },
     SalesDepartmentClick() {
       // if(this.powerGrade>2){
-       this.SalesDepartmentShow = true;
+      this.SalesDepartmentShow = true;
       // }
     },
     StaffClick() {
@@ -533,65 +539,67 @@ export default {
     },
     onregionConfirm(val) {
       this.RegionShow = false;
-      this.companyName=val.deptName;
-      this.companyCode=val.deptId;
-      this.regionName="全部大区";
-      this.regionCode="";
-      this.deptName="全部销售部";
-      this.deptCode="";
-      this.userName="全部业务员";
-      this.userCode="";
-      this.getDeptInfo("dept",1)
+      this.companyName = val.deptName;
+      this.companyCode = val.deptId;
+      this.regionName = '全部大区';
+      this.regionCode = '';
+      this.deptName = '全部销售部';
+      this.deptCode = '';
+      this.userName = '全部业务员';
+      this.userCode = '';
+      this.getDeptInfo('dept', 1);
     },
     onSalesRegionConfirm(val) {
       this.SalesRegionShow = false;
-      this.regionName=val.deptName;
-      this.regionCode=val.deptId;
-      if(val.deptId!=""){
-      this.getDeptInfo("dept",2)
+      this.regionName = val.deptName;
+      this.regionCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('dept', 2);
       }
-      this.deptName="全部销售部";
-      this.deptCode="";
-      this.userName="全部业务员";
-      this.userCode="";
-      this.userList=[]
+      this.deptName = '全部销售部';
+      this.deptCode = '';
+      this.userName = '全部业务员';
+      this.userCode = '';
+      this.userList = [];
     },
     onSalesDepartmentConfirm(val) {
       this.SalesDepartmentShow = false;
-      this.deptName=val.deptName;
-      this.deptCode=val.deptId;
-      if(val.deptId!=""){
-
-        this.getDeptInfo("user")
+      this.deptName = val.deptName;
+      this.deptCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('user');
       }
-      this.userName="全部业务员";
-      this.userCode="";
+      this.userName = '全部业务员';
+      this.userCode = '';
     },
     onStaffConfirm(val) {
       this.StaffShow = false;
-      this.userName=val.nickName;
-      this.userCode=val.userId;
+      this.userName = val.nickName;
+      this.userCode = val.userId;
     },
     onStartTimeConfirm(val) {
-      this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + ""
+      this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
       this.StartTimeShow = false;
-        this.endminDate = new Date(val)
-        this.endmaxDate=new Date(this.GetPreMonthDay(this.formData.startTime,-2,"end"))
-      if((new Date(this.formData.startTime).getTime()>new Date(this.formData.endTime).getTime())||(new Date(this.endmaxDate).getTime()<new Date(this.formData.endTime).getTime())) {
-        this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + ""
-        this.endcurrentDate=  new Date(this.GetPreMonthDay(this.formData.startTime,-2))
+      this.endminDate = new Date(val);
+      this.endmaxDate = new Date(this.GetPreMonthDay(this.formData.startTime, -2, 'end'));
+      if (
+        new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime() ||
+        new Date(this.endmaxDate).getTime() < new Date(this.formData.endTime).getTime()
+      ) {
+        this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
+        this.endcurrentDate = new Date(this.GetPreMonthDay(this.formData.startTime, -2));
       }
     },
     onEndTimeConfirm(val) {
-      this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}')
+      this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}');
       // this.strtmaxDate = new Date(val)
-      if(new Date(this.formData.startTime).getTime()>new Date(this.formData.endTime).getTime()){
-        this.formData.startTime=this.formData.endTime
+      if (new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime()) {
+        this.formData.startTime = this.formData.endTime;
       }
       this.EndTimeShow = false;
     },
-  }
-}
+  },
+};
 </script>
 <style>
 .cardContent {
@@ -608,7 +616,7 @@ export default {
 
 .cardContent .title p {
   padding: 0;
-  margin: 0
+  margin: 0;
 }
 
 .cardContent .title .textLeft {
@@ -652,23 +660,25 @@ export default {
   color: #fff !important;
   background-color: #0057ba;
   border: 1px solid #0057ba;
-  height: 36px
+  height: 36px;
 }
 
 .contentpd16 .van-cell {
-  background-color: #EBF4FF;
+  background-color: #ebf4ff;
   margin: 8px 0;
   border-radius: 5px;
   padding: 4px 16px;
 }
-.elTreeTableLsiy  th.el-table__cell>.cell{text-align: center;}
-.elTreeTableLsiy td.el-table__cell div{
+.elTreeTableLsiy th.el-table__cell > .cell {
+  text-align: center;
+}
+.elTreeTableLsiy td.el-table__cell div {
   text-align: right;
 }
-.elTreeTableLsiy .el-table__cell{
+.elTreeTableLsiy .el-table__cell {
   padding: 2px 0;
 }
-.elTreeTableLsiy .el-table__cell:first-child .cell{
+.elTreeTableLsiy .el-table__cell:first-child .cell {
   text-align: center;
 }
-</style>
+</style>

+ 1 - 0
src/views/week/doubleWeekly.vue

@@ -650,6 +650,7 @@ export default {
       getReportInfo({ isContent: true }).then((res) => {
         loading1.clear();
         localStorage.setItem('powerGrade', res.data.positionId);
+        localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
         this.powerGrade = res.data.positionId;
         this.showButton = res.data.showButton;
         this.reportTargetAll = res.data.reportTargetAll;

+ 371 - 360
src/views/week/doubleWeeklyHistorical.vue

@@ -2,153 +2,151 @@
   <div class="bgcolor">
     <!--        顶部条-->
     <van-nav-bar
-        class="navBar"
-        title="下属大区主管历史半月报"
-        left-arrow
-        @click-left="onClickLeft"
-    />
+      class="navBar"
+      title="下属大区主管历史半月报"
+      left-arrow
+      @click-left="onClickLeft" />
     <div class="container contentpd16 containers">
       <van-row gutter="20">
         <van-col span="12">
-          <van-cell :title="companyName" :disabled="powerGrade<5" is-link arrow-direction="down" @click="regionClick"/>
+          <van-cell
+            :title="companyName"
+            :disabled="powerGrade < 5"
+            is-link
+            arrow-direction="down"
+            @click="regionClick" />
         </van-col>
         <van-col span="12">
-          <van-cell :title="regionName"  is-link @click="SalesRegionClick" arrow-direction="down"/>
+          <van-cell :title="regionName" is-link @click="SalesRegionClick" arrow-direction="down" />
         </van-col>
-<!--        <van-col span="12">-->
-<!--          <div style="width: 20px;height: 48px"></div>-->
-<!--&lt;!&ndash;          <van-cell :title="deptName" is-link @click="SalesDepartmentClick" arrow-direction="down"/>&ndash;&gt;-->
-<!--        </van-col>-->
-<!--        <van-col span="12">-->
-<!--          <div style="width: 20px;height: 48px"></div>-->
-<!--          &lt;!&ndash;          <van-cell :title="userName" is-link @click="StaffClick" arrow-direction="down"/>&ndash;&gt;-->
-<!--          &lt;!&ndash;           <van-cell  is-link arrow-direction="down"/>&ndash;&gt;-->
-<!--        </van-col>-->
+        <!--        <van-col span="12">-->
+        <!--          <div style="width: 20px;height: 48px"></div>-->
+        <!--&lt;!&ndash;          <van-cell :title="deptName" is-link @click="SalesDepartmentClick" arrow-direction="down"/>&ndash;&gt;-->
+        <!--        </van-col>-->
+        <!--        <van-col span="12">-->
+        <!--          <div style="width: 20px;height: 48px"></div>-->
+        <!--          &lt;!&ndash;          <van-cell :title="userName" is-link @click="StaffClick" arrow-direction="down"/>&ndash;&gt;-->
+        <!--          &lt;!&ndash;           <van-cell  is-link arrow-direction="down"/>&ndash;&gt;-->
+        <!--        </van-col>-->
         <van-col span="12">
           <van-cell :title="formData.startTime" is-link @click="StartTimeClick">
             <template #right-icon>
-              <van-icon :name="timeico" class="search-icon"/>
+              <van-icon :name="timeico" class="search-icon" />
             </template>
           </van-cell>
         </van-col>
         <van-col span="12">
           <van-cell :title="formData.endTime" is-link @click="EndTimeClick">
             <template #right-icon>
-              <van-icon :name="timeico" class="search-icon"/>
+              <van-icon :name="timeico" class="search-icon" />
             </template>
           </van-cell>
         </van-col>
       </van-row>
-      <br>
+      <br />
       <van-button type="info" size="small" plain class="Btn100" @click="searchBtn">查找</van-button>
     </div>
-<!--    <div class="container">-->
-<!--      <div class="cellcontent brud" style="padding: 16px 16px;background-color: #fff;">-->
-<!--        <el-table class="elTreeTableLsiy" style="text-align: center;" :data="tableList" row-key="id" border lazy :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">-->
-<!--          <el-table-column prop="month"  label="月份" width="60" />-->
-<!--          <el-table-column prop="commitRate"  label="提交率%" />-->
-<!--          <el-table-column prop="approvalRate"  label="审批率%" />-->
-<!--        </el-table>-->
-<!--    </div>-->
-<!--  </div>-->
+    <!--    <div class="container">-->
+    <!--      <div class="cellcontent brud" style="padding: 16px 16px;background-color: #fff;">-->
+    <!--        <el-table class="elTreeTableLsiy" style="text-align: center;" :data="tableList" row-key="id" border lazy :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">-->
+    <!--          <el-table-column prop="month"  label="月份" width="60" />-->
+    <!--          <el-table-column prop="commitRate"  label="提交率%" />-->
+    <!--          <el-table-column prop="approvalRate"  label="审批率%" />-->
+    <!--        </el-table>-->
+    <!--    </div>-->
+    <!--  </div>-->
     <div class="container">
       <van-list
-          v-model="loading"
-          :finished="finished"
-          @load="onLoad"
-          finished-text="--已经到底了--"
-      >
-      <div class="cellcontent brud" v-for="(item,index) in list" :key="index">
-        <van-cell>
-          <div class="cardContent" @click="dailyFn(item)">
-            <div class="title"  >
-              <p class="textLeft">{{item.pnickName}}的半月报({{item.date}})</p>
-              <p class="textRight" v-if="item.status==3">已审批</p>
-              <p class="textRight" v-if="item.status==-1">过期未汇报</p>
-              <p class="textRight" v-if="item.status==0">待汇报</p>
-              <p class="textRight" v-if="item.status==2">退回待处理</p>
-              <p class="textRight" v-if="item.status==1">待审批</p>
+        v-model="loading"
+        :finished="finished"
+        @load="onLoad"
+        finished-text="--已经到底了--">
+        <div class="cellcontent brud" v-for="(item, index) in list" :key="index">
+          <van-cell>
+            <div class="cardContent" @click="dailyFn(item)">
+              <div class="title">
+                <p class="textLeft">{{ item.pnickName }}的半月报({{ item.date }})</p>
+                <p class="textRight" v-if="item.status == 3">已审批</p>
+                <p class="textRight" v-if="item.status == -1">过期未汇报</p>
+                <p class="textRight" v-if="item.status == 0">待汇报</p>
+                <p class="textRight" v-if="item.status == 2">退回待处理</p>
+                <p class="textRight" v-if="item.status == 1">待审批</p>
+              </div>
+              <div class="info" v-if="item.status > 0 && item.status < 3">
+                提交时间:{{ item.commitTime }}
+              </div>
+              <div class="info" v-if="item.status < 1">创建时间:{{ dateFn(item.date) }}</div>
+              <div class="info" v-if="item.status == 3">提交时间:{{ item.commitTime }}</div>
+              <div class="info" v-if="item.status == 3">审批时间:{{ item.approvalTime }}</div>
             </div>
-            <div class="info" v-if="item.status>0&&item.status<3">提交时间:{{item.commitTime}}</div>
-            <div class="info" v-if="item.status<1">创建时间:{{dateFn(item.date)}}</div>
-            <div class="info" v-if="item.status==3">提交时间:{{item.commitTime}}</div>
-            <div class="info" v-if="item.status==3">审批时间:{{item.approvalTime}}</div>
-
-          </div>
-        </van-cell>
-      </div>
-      <van-empty  v-if="list.length==0"/>
+          </van-cell>
+        </div>
+        <van-empty v-if="list.length == 0" />
       </van-list>
     </div>
-    <br>
-    <br>
+    <br />
+    <br />
     <van-popup v-model="RegionShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="companyList"
-          value-key="deptName"
-          @confirm="onregionConfirm"
-          @cancel="RegionShow = false"
-      />
+        show-toolbar
+        :columns="companyList"
+        value-key="deptName"
+        @confirm="onregionConfirm"
+        @cancel="RegionShow = false" />
     </van-popup>
     <van-popup v-model="SalesRegionShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="regionList"
-          value-key="deptName"
-          @confirm="onSalesRegionConfirm"
-          @cancel="SalesRegionShow = false"
-      />
+        show-toolbar
+        :columns="regionList"
+        value-key="deptName"
+        @confirm="onSalesRegionConfirm"
+        @cancel="SalesRegionShow = false" />
     </van-popup>
     <van-popup v-model="SalesDepartmentShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="deptList"
-          value-key="deptName"
-          @confirm="onSalesDepartmentConfirm"
-          @cancel="SalesDepartmentShow = false"
-      />
+        show-toolbar
+        :columns="deptList"
+        value-key="deptName"
+        @confirm="onSalesDepartmentConfirm"
+        @cancel="SalesDepartmentShow = false" />
     </van-popup>
     <van-popup v-model="StaffShow" capture position="bottom">
       <van-picker
-          show-toolbar
-          :columns="userList"
-          @confirm="onStaffConfirm"
-          value-key="nickName"
-          @cancel="StaffShow = false"
-      />
+        show-toolbar
+        :columns="userList"
+        @confirm="onStaffConfirm"
+        value-key="nickName"
+        @cancel="StaffShow = false" />
     </van-popup>
 
     <van-popup v-model="StartTimeShow" capture position="bottom">
       <van-datetime-picker
-          v-model="strtcurrentDate"
-          type="date"
-          title="选择查找开始时间"
-          :min-date="strtminDate"
-          :max-date="strtmaxDate"
-          @confirm="onStartTimeConfirm"
-          @cancel="StartTimeShow = false"
-      />
+        v-model="strtcurrentDate"
+        type="date"
+        title="选择查找开始时间"
+        :min-date="strtminDate"
+        :max-date="strtmaxDate"
+        @confirm="onStartTimeConfirm"
+        @cancel="StartTimeShow = false" />
     </van-popup>
     <van-popup v-model="EndTimeShow" capture position="bottom">
       <van-datetime-picker
-          v-model="endcurrentDate"
-          type="date"
-          title="选择查找结束时间"
-          :min-date="endminDate"
-          :max-date="endmaxDate"
-          @confirm="onEndTimeConfirm"
-          @cancel="EndTimeShow = false"
-      />
+        v-model="endcurrentDate"
+        type="date"
+        title="选择查找结束时间"
+        :min-date="endminDate"
+        :max-date="endmaxDate"
+        @confirm="onEndTimeConfirm"
+        @cancel="EndTimeShow = false" />
     </van-popup>
   </div>
 </template>
 
 <script>
-import timeico from "@/assets/Icon/datatims.png";
-import {getDeptInfo,querySubReport} from "@/api/index";
+import timeico from '@/assets/Icon/datatims.png';
+import { getDeptInfo, querySubReport } from '@/api/index';
 export default {
-  name: "MyHistoricalWeekly",
+  name: 'MyHistoricalWeekly',
   data() {
     return {
       timeico: timeico,
@@ -158,156 +156,162 @@ export default {
       StaffShow: false,
       StartTimeShow: false,
       EndTimeShow: false,
-      PhotoTypeList: [{text: "009", value: "09"}],
+      PhotoTypeList: [{ text: '009', value: '09' }],
       strtminDate: new Date(2022, 0, 1),
       endminDate: new Date(2022, 0, 1),
       strtmaxDate: new Date(),
       endmaxDate: new Date(),
       strtcurrentDate: new Date(),
       endcurrentDate: new Date(),
-      companyName:"全部公司",
-      deptName:"全部",
-      regionName:"全部大区",
-      userName:"全部",
-      companyCode:"",
-      deptCode:"",
-      regionCode:"",
-      userCode:"",
-      companyList:[],
-      deptList:[],
-      regionList:[],
-      userList:[],
-      deptForm:{type:"",parentId:""},
-      list:[],
+      companyName: '全部公司',
+      deptName: '全部',
+      regionName: '全部大区',
+      userName: '全部',
+      companyCode: '',
+      deptCode: '',
+      regionCode: '',
+      userCode: '',
+      companyList: [],
+      deptList: [],
+      regionList: [],
+      userList: [],
+      deptForm: { type: '', parentId: '' },
+      list: [],
       loading: false,
       finished: true,
-      formData:{
-        type:"3", // 汇报类型或入口 1-下属业务员日报 2-下属销售部主管周报 3-下属大区主管半月报
-        companyId:"", // 公司id,必传 Long类型
-        regionId:"", // 大区id,必传  Long类型
-        deptId:"", // 部门id,如果为周报或日报为必传  Long类型
-        userId:"", // 业务员id,如果为日报为必传      Long类型
-        startTime:"", // 开始时间,必传  格式:yyyy-MM-dd  String类型
-        endTime:"", // 结束时间,必传  格式:yyyy-MM-dd  String类型
-        pageNum:1 , // 当前页码  int类型
-        pageSize:10, // 当前每页条数  int类型
+      formData: {
+        type: '3', // 汇报类型或入口 1-下属业务员日报 2-下属销售部主管周报 3-下属大区主管半月报
+        companyId: '', // 公司id,必传 Long类型
+        regionId: '', // 大区id,必传  Long类型
+        deptId: '', // 部门id,如果为周报或日报为必传  Long类型
+        userId: '', // 业务员id,如果为日报为必传      Long类型
+        startTime: '', // 开始时间,必传  格式:yyyy-MM-dd  String类型
+        endTime: '', // 结束时间,必传  格式:yyyy-MM-dd  String类型
+        pageNum: 1, // 当前页码  int类型
+        pageSize: 10, // 当前每页条数  int类型
       },
-      tableList:[]
-    }
+      tableList: [],
+    };
   },
   created() {
     // this.formData.startTime = this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),1)
-    this.formData.startTime=this.getThreeDaysAgo()
+    this.formData.startTime = this.getThreeDaysAgo();
     // this.strtcurrentDate=new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),1))
-    this.strtcurrentDate=new Date(this.getThreeDaysAgo())
-    this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + ""
-    this.endminDate=new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),1))
-    this.powerGrade = localStorage.getItem("powerGrade")
-    this.getDeptInfo("dept")
-    if(this.powerGrade==5){
-      setTimeout(()=>{
-        if(this.$route.query.regionCode==undefined){
-        this.companyName=this.companyList[0].deptName;
-        this.companyCode=this.companyList[0].deptId;
+    this.strtcurrentDate = new Date(this.getThreeDaysAgo());
+    this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + '';
+    this.endminDate = new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'), 1));
+    this.powerGrade = localStorage.getItem('powerGrade');
+    // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
+    this.userDeptLevel = localStorage.getItem('userDeptLevel');
+    this.getDeptInfo('dept');
+    if (this.userDeptLevel == 0) {
+      setTimeout(() => {
+        if (this.$route.query.regionCode == undefined) {
+          this.companyName = this.companyList[0].deptName;
+          this.companyCode = this.companyList[0].deptId;
         }
-        this.getDeptInfo("dept",1)
-      },1000)
+        this.getDeptInfo('dept', 1);
+      }, 1000);
     }
-    if(this.powerGrade==4){
-      setTimeout(()=>{
-        this.getDeptInfo("dept",1)
-      },1000)
+    if (this.userDeptLevel == 1) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 1);
+      }, 1000);
     }
-    if(this.powerGrade==3){
-      setTimeout(()=>{
-        this.getDeptInfo("dept",2)
-      },1000)
+    if (this.userDeptLevel == 2) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 2);
+      }, 1000);
     }
-    if(this.powerGrade==2){
-      setTimeout(()=>{
-        this.getDeptInfo("user")
-      },2000)
+    if (this.userDeptLevel == 3) {
+      setTimeout(() => {
+        this.getDeptInfo('user');
+      }, 2000);
     }
-    if(this.$route.query.regionCode!=undefined){
-      this.companyName=this.$route.query.companyName
-      this.companyCode=this.$route.query.companyCode
-      this.regionName=this.$route.query.regionName
-      this.regionCode=this.$route.query.regionCode
-      this.formData.startTime=this.$route.query.startTime
-      this.formData.endTime=this.$route.query.endTime
-        this.searchBtn()
-    }else{
-      setTimeout(()=>{
-        this.searchBtn()
-      },1000)
+    if (this.$route.query.regionCode != undefined) {
+      this.companyName = this.$route.query.companyName;
+      this.companyCode = this.$route.query.companyCode;
+      this.regionName = this.$route.query.regionName;
+      this.regionCode = this.$route.query.regionCode;
+      this.formData.startTime = this.$route.query.startTime;
+      this.formData.endTime = this.$route.query.endTime;
+      this.searchBtn();
+    } else {
+      setTimeout(() => {
+        this.searchBtn();
+      }, 1000);
     }
   },
   watch: {
     $route(to, from) {
-      this.powerGrade = localStorage.getItem("powerGrade")
-      if(to.path=="/doubleWeeklyHistorical"&&from.path!="/doubleHistoricalWeeklyDetils"){
-        if(this.$route.query.regionCode!=undefined){
-          this.companyName=this.$route.query.companyName
-          this.companyCode=this.$route.query.companyCode
-          this.regionName=this.$route.query.regionName
-          this.regionCode=this.$route.query.regionCode
-          this.formData.startTime=this.$route.query.startTime
-          this.formData.endTime=this.$route.query.endTime
-          this.searchBtn()
-        }else{
-          this.regionName="全部大区"
-          this.regionCode=""
-          this.formData.pageNum=1
+      this.powerGrade = localStorage.getItem('powerGrade');
+      // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
+      this.userDeptLevel = localStorage.getItem('userDeptLevel');
+      if (to.path == '/doubleWeeklyHistorical' && from.path != '/doubleHistoricalWeeklyDetils') {
+        if (this.$route.query.regionCode != undefined) {
+          this.companyName = this.$route.query.companyName;
+          this.companyCode = this.$route.query.companyCode;
+          this.regionName = this.$route.query.regionName;
+          this.regionCode = this.$route.query.regionCode;
+          this.formData.startTime = this.$route.query.startTime;
+          this.formData.endTime = this.$route.query.endTime;
+          this.searchBtn();
+        } else {
+          this.regionName = '全部大区';
+          this.regionCode = '';
+          this.formData.pageNum = 1;
           this.list = [];
-          this.tableList=[];
-          this.getDeptInfo("dept")
-          if(this.powerGrade==5){
-            setTimeout(()=>{
-              if(this.$route.query.regionCode==undefined){
-              this.companyName=this.companyList[0].deptName;
-              this.companyCode=this.companyList[0].deptId;}
-              this.getDeptInfo("dept",1)
-            },1000)
+          this.tableList = [];
+          this.getDeptInfo('dept');
+          if (this.userDeptLevel == 0) {
+            setTimeout(() => {
+              if (this.$route.query.regionCode == undefined) {
+                this.companyName = this.companyList[0].deptName;
+                this.companyCode = this.companyList[0].deptId;
+              }
+              this.getDeptInfo('dept', 1);
+            }, 1000);
           }
-          if(this.powerGrade==4){
-            setTimeout(()=>{
-              this.getDeptInfo("dept",1)
-            },1000)
+          if (this.userDeptLevel == 1) {
+            setTimeout(() => {
+              this.getDeptInfo('dept', 1);
+            }, 1000);
           }
-          if(this.powerGrade==3){
-            setTimeout(()=>{
-              this.getDeptInfo("dept",2)
-            },1000)
+          if (this.userDeptLevel == 2) {
+            setTimeout(() => {
+              this.getDeptInfo('dept', 2);
+            }, 1000);
           }
-          if(this.powerGrade==2){
-            setTimeout(()=>{
-              this.getDeptInfo("user")
-            },2000)
+          if (this.userDeptLevel == 3) {
+            setTimeout(() => {
+              this.getDeptInfo('user');
+            }, 2000);
           }
-          setTimeout(()=>{
-            this.searchBtn()},1000)
+          setTimeout(() => {
+            this.searchBtn();
+          }, 1000);
         }
       }
-    }
+    },
   },
   methods: {
-    dateFn(val){
-      return val.slice(0,4)+"-"+val.slice(4,6)+"-"+val.slice(6,8)
+    dateFn(val) {
+      return val.slice(0, 4) + '-' + val.slice(4, 6) + '-' + val.slice(6, 8);
     },
-    onLoad(){
-      this.querySubReport()
+    onLoad() {
+      this.querySubReport();
     },
-    searchBtn(){
+    searchBtn() {
       // if(this.regionCode==""){
       //   this.$toast("大区未选择")
       // }else{
-        this.formData.pageNum=1
-        this.list = [];
-        this.querySubReport()
+      this.formData.pageNum = 1;
+      this.list = [];
+      this.querySubReport();
       // }
     },
-    querySubReport(){
-      let loading1=this.$toast.loading({
+    querySubReport() {
+      let loading1 = this.$toast.loading({
         duration: 0,
         message: '加载中...',
         forbidClick: true,
@@ -316,24 +320,24 @@ export default {
         this.list = [];
         this.refreshing = false;
       }
-      this.formData.companyId=this.companyCode; // 公司id,必传 Long类型
-      this.formData.regionId=this.regionCode; // 大区id,必传  Long类型
-      this.formData.deptId=this.deptCode; // 部门id,如果为周报或日报为必传  Long类型
-      this.formData.userId=this.userCode; // 业务员id,如果为日报为必传      Long类型
-      querySubReport(this.formData).then(res=>{
-        loading1.clear()
-        if(res.code==200){
-          this.loading=false
-          this.list = this.list.concat(res.data)
-          if (this.list.length >=res.total) {
+      this.formData.companyId = this.companyCode; // 公司id,必传 Long类型
+      this.formData.regionId = this.regionCode; // 大区id,必传  Long类型
+      this.formData.deptId = this.deptCode; // 部门id,如果为周报或日报为必传  Long类型
+      this.formData.userId = this.userCode; // 业务员id,如果为日报为必传      Long类型
+      querySubReport(this.formData).then((res) => {
+        loading1.clear();
+        if (res.code == 200) {
+          this.loading = false;
+          this.list = this.list.concat(res.data);
+          if (this.list.length >= res.total) {
             this.finished = true;
-          }else{
+          } else {
             this.finished = false;
           }
-          this.formData.pageNum=this.formData.pageNum+1
+          this.formData.pageNum = this.formData.pageNum + 1;
           // this.tableList=res.data.rates
         }
-      })
+      });
     },
     getThreeDaysAgo() {
       let myDate = new Date();
@@ -342,14 +346,10 @@ export default {
       let lastM = lw.getMonth() + 1;
       let lastD = lw.getDate();
       let startData =
-          lastY +
-          "-" +
-          (lastM < 10 ? "0" + lastM : lastM) +
-          "-" +
-          (lastD < 10 ? "0" + lastD : lastD); //三十天之前日期
+        lastY + '-' + (lastM < 10 ? '0' + lastM : lastM) + '-' + (lastD < 10 ? '0' + lastD : lastD); //三十天之前日期
       return startData;
     },
-    GetPreMonthDay(date, monthNum,type) {
+    GetPreMonthDay(date, monthNum, type) {
       var dateArr = date.split('-');
       var year = dateArr[0]; //获取当前日期的年份
       var month = dateArr[1]; //获取当前日期的月份
@@ -372,115 +372,122 @@ export default {
       if (month2 < 10) {
         month2 = '0' + month2;
       }
-      var t2 =""
-      if(monthNum>0){
-        t2= year2 + '-' + month2 + '-01';
-      }else{
-        if(type=="end"){
-          var Months=new Date().getMonth()+1
-          var days111=new Date().getDate()
+      var t2 = '';
+      if (monthNum > 0) {
+        t2 = year2 + '-' + month2 + '-01';
+      } else {
+        if (type == 'end') {
+          var Months = new Date().getMonth() + 1;
+          var days111 = new Date().getDate();
           if (Months < 10) {
             Months = '0' + Months;
           }
           if (days111 < 10) {
             days111 = '0' + days111;
           }
-          if(new Date().getFullYear()==year){
-            if(parseInt(month2)>=new Date().getMonth()+1){
-              t2= year2 + '-' + Months + '-' + days111;
-            }else{
-              var daysd=this.getMonthDays(year2,month2)
-              t2= year2 + '-' + month2 + '-' + daysd;
+          if (new Date().getFullYear() == year) {
+            if (parseInt(month2) >= new Date().getMonth() + 1) {
+              t2 = year2 + '-' + Months + '-' + days111;
+            } else {
+              var daysd = this.getMonthDays(year2, month2);
+              t2 = year2 + '-' + month2 + '-' + daysd;
             }
-          }else{
-            var daysd=this.getMonthDays(year2,month2)
-            t2= year2 + '-' + month2 + '-' + daysd;
+          } else {
+            var daysd = this.getMonthDays(year2, month2);
+            t2 = year2 + '-' + month2 + '-' + daysd;
           }
-        }else{
-          t2= year2 + '-' + month2 + '-' + day2;
+        } else {
+          t2 = year2 + '-' + month2 + '-' + day2;
         }
       }
       return t2;
     },
-    getMonthDays(year,month){
-      var stratDate = new Date(year,month-1,1),
-          endData = new Date(year,month,1);
-      var days = (endData -stratDate)/(1000*60*60*24);
+    getMonthDays(year, month) {
+      var stratDate = new Date(year, month - 1, 1),
+        endData = new Date(year, month, 1);
+      var days = (endData - stratDate) / (1000 * 60 * 60 * 24);
       return days;
     },
-    getDeptInfo(type,grade){
-      this.deptForm.type=type
-      if(type=="dept"){
-        if(grade=="1"){
-          this.deptForm.parentId=this.companyCode
-        }else if(grade=="2"){
-          this.deptForm.parentId=this.regionCode
-        }else{
-          this.deptForm.type=""
-          this.deptForm.parentId=""
+    getDeptInfo(type, grade) {
+      this.deptForm.type = type;
+      if (type == 'dept') {
+        if (grade == '1') {
+          this.deptForm.parentId = this.companyCode;
+        } else if (grade == '2') {
+          this.deptForm.parentId = this.regionCode;
+        } else {
+          this.deptForm.type = '';
+          this.deptForm.parentId = '';
         }
-      }else if(type=="user"){
-        this.deptForm.parentId=this.deptCode
+      } else if (type == 'user') {
+        this.deptForm.parentId = this.deptCode;
       }
-      getDeptInfo(this.deptForm).then(res=>{
-        if(type=="dept"){
-          if(grade=="1"){
-            if(res.data.region!=null){
-              this.regionList=[{deptName:"全部大区",deptId:""}].concat(res.data.region)
+      getDeptInfo(this.deptForm).then((res) => {
+        if (type == 'dept') {
+          if (grade == '1') {
+            if (res.data.region != null) {
+              this.regionList = [{ deptName: '全部大区', deptId: '' }].concat(res.data.region);
+            }
+          } else if (grade == '2') {
+            if (res.data.dept != null) {
+              this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
             }
-          }else if(grade=="2"){
-            if(res.data.dept!=null){
-              this.deptList=[{deptName:"全部销售部",deptId:""}].concat(res.data.dept)
+          } else {
+            if (this.userDeptLevel == 0) {
+              this.companyList = [{ deptName: '全部公司', deptId: '' }].concat(res.data.company);
+            } else {
+              this.companyList = res.data.company;
             }
-          }else{
-            this.companyList=res.data.company
-            if(this.$route.query.regionCode==undefined){
-            this.companyName=res.data.company[0].deptName
-            this.companyCode=res.data.company[0].deptId}
-            if(res.data.dept!=null){
-              this.deptName=res.data.dept[0].deptName
-              this.deptCode=res.data.dept[0].deptId
-              this.deptList=res.data.dept
+            if (this.$route.query.regionCode == undefined) {
+              this.companyName = res.data.company[0].deptName;
+              this.companyCode = res.data.company[0].deptId;
             }
-            if(res.data.region!=null){
-              this.regionName=res.data.region[0].deptName
-              this.regionCode=res.data.region[0].deptId
-              this.regionList=res.data.region
+            if (res.data.dept != null) {
+              this.deptName = res.data.dept[0].deptName;
+              this.deptCode = res.data.dept[0].deptId;
+              this.deptList = res.data.dept;
             }
-            if(res.data.user!=null){
-              this.userList=res.data.user
-              this.userCode=""
+            if (res.data.region != null) {
+              this.regionName = res.data.region[0].deptName;
+              this.regionCode = res.data.region[0].deptId;
+              this.regionList = res.data.region;
+            }
+            if (res.data.user != null) {
+              this.userList = res.data.user;
+              this.userCode = '';
             }
           }
-        }else if(type=="user"){
-          if(res.data.user!=null){
-            this.userList=[{nickName:"全部",userId:""}].concat(res.data.user)
+        } else if (type == 'user') {
+          if (res.data.user != null) {
+            this.userList = [{ nickName: '全部', userId: '' }].concat(res.data.user);
           }
         }
-      })
+      });
     },
     dailyFn(row) {
-      if(row.status!='0'){
-        if(row.status==-1){
-          var dayTime=row.date;
-          var times=new Date(dayTime.slice(0, 4)+"-"+dayTime.slice(4, 6)+"-"+dayTime.slice(6, 8)).getTime()
-          var time=new Date("2022-08-25").getTime()
-          if(times<time){
+      if (row.status != '0') {
+        if (row.status == -1) {
+          var dayTime = row.date;
+          var times = new Date(
+            dayTime.slice(0, 4) + '-' + dayTime.slice(4, 6) + '-' + dayTime.slice(6, 8)
+          ).getTime();
+          var time = new Date('2022-08-25').getTime();
+          if (times < time) {
             this.$dialog.alert({
               title: '系统提示',
               message: '非常抱歉,8月25日前历史报告数据不存在',
-            })
-          }else{
+            });
+          } else {
             this.$router.push({
-              path: "/doubleHistoricalWeeklyDetils",
-              query: {reportId: row.id,}
-            })
+              path: '/doubleHistoricalWeeklyDetils',
+              query: { reportId: row.id },
+            });
           }
-        }else{
+        } else {
           this.$router.push({
-            path: "/doubleHistoricalWeeklyDetils",
-            query: {reportId: row.id,}
-          })
+            path: '/doubleHistoricalWeeklyDetils',
+            query: { reportId: row.id },
+          });
         }
       }
 
@@ -489,21 +496,21 @@ export default {
       // }
     },
     onClickLeft() {
-      this.$router.go(-1)
+      this.$router.go(-1);
     },
     regionClick() {
       // if(this.powerGrade>4){
-        this.RegionShow = true;
+      this.RegionShow = true;
       // }
     },
     SalesRegionClick(val) {
       // if(this.powerGrade>3){
-        this.SalesRegionShow = true;
+      this.SalesRegionShow = true;
       // }
     },
     SalesDepartmentClick() {
       // if(this.powerGrade>2){
-        this.SalesDepartmentShow = true;
+      this.SalesDepartmentShow = true;
       // }
     },
     StaffClick() {
@@ -517,70 +524,72 @@ export default {
     },
     onregionConfirm(val) {
       this.RegionShow = false;
-      this.companyName=val.deptName;
-      this.companyCode=val.deptId;
-      this.regionName="全部大区";
-      this.regionCode="";
-      this.deptName="全部";
-      this.deptCode="";
-      this.userName="全部";
-      this.userCode="";
-      this.getDeptInfo("dept",1)
+      this.companyName = val.deptName;
+      this.companyCode = val.deptId;
+      this.regionName = '全部大区';
+      this.regionCode = '';
+      this.deptName = '全部';
+      this.deptCode = '';
+      this.userName = '全部';
+      this.userCode = '';
+      this.getDeptInfo('dept', 1);
     },
     onSalesRegionConfirm(val) {
       this.SalesRegionShow = false;
-      this.regionName=val.deptName;
-      this.regionCode=val.deptId;
-      if(val.deptId!=""){
-        this.getDeptInfo("dept",2)
+      this.regionName = val.deptName;
+      this.regionCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('dept', 2);
       }
-      this.deptName="全部";
-      this.deptCode="";
-      this.userName="全部";
-      this.userCode="";
-      this.userList=[]
+      this.deptName = '全部';
+      this.deptCode = '';
+      this.userName = '全部';
+      this.userCode = '';
+      this.userList = [];
     },
     onSalesDepartmentConfirm(val) {
       this.SalesDepartmentShow = false;
-      this.deptName=val.deptName;
-      this.deptCode=val.deptId;
-      if(val.deptId!=""){
-
-        this.getDeptInfo("user")
+      this.deptName = val.deptName;
+      this.deptCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('user');
       }
-      this.userName="全部";
-      this.userCode="";
+      this.userName = '全部';
+      this.userCode = '';
     },
     onStaffConfirm(val) {
       this.StaffShow = false;
-      this.userName=val.nickName;
-      this.userCode=val.userId;
+      this.userName = val.nickName;
+      this.userCode = val.userId;
     },
     onStartTimeConfirm(val) {
-      this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + ""
+      this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
       this.StartTimeShow = false;
-        this.endminDate = new Date(val)
-        this.endmaxDate=new Date(this.GetPreMonthDay(this.formData.startTime,-2,"end"))
-      if((new Date(this.formData.startTime).getTime()>new Date(this.formData.endTime).getTime())||(new Date(this.endmaxDate).getTime()<new Date(this.formData.endTime).getTime())) {
-        this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + ""
-        this.endcurrentDate=  this.GetPreMonthDay(this.formData.startTime,-2)
+      this.endminDate = new Date(val);
+      this.endmaxDate = new Date(this.GetPreMonthDay(this.formData.startTime, -2, 'end'));
+      if (
+        new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime() ||
+        new Date(this.endmaxDate).getTime() < new Date(this.formData.endTime).getTime()
+      ) {
+        this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
+        this.endcurrentDate = this.GetPreMonthDay(this.formData.startTime, -2);
       }
 
-      this.list=[];
-      this.formData.pageNum=1;
+      this.list = [];
+      this.formData.pageNum = 1;
     },
     onEndTimeConfirm(val) {
-      this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}')
-      this.strtmaxDate = new Date(val)
-      if(new Date(this.formData.startTime).getTime()>new Date(this.formData.endTime).getTime()){
-        this.formData.startTime=this.formData.endTime
+      this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}');
+      this.strtmaxDate = new Date(val);
+      if (new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime()) {
+        this.formData.startTime = this.formData.endTime;
       }
-      this.list=[];
-      this.formData.pageNum=1;
+      this.list = [];
+      this.formData.pageNum = 1;
       this.EndTimeShow = false;
     },
-  }
-}
+  },
+};
 </script>
 <style>
 .cardContent {
@@ -597,7 +606,7 @@ export default {
 
 .cardContent .title p {
   padding: 0;
-  margin: 0
+  margin: 0;
 }
 
 .cardContent .title .textLeft {
@@ -641,23 +650,25 @@ export default {
   color: #fff !important;
   background-color: #0057ba;
   border: 1px solid #0057ba;
-  height: 36px
+  height: 36px;
 }
 
 .contentpd16 .van-cell {
-  background-color: #EBF4FF;
+  background-color: #ebf4ff;
   margin: 8px 0;
   border-radius: 5px;
   padding: 4px 16px;
 }
-.elTreeTableLsiy  th.el-table__cell>.cell{text-align: center;}
-.elTreeTableLsiy td.el-table__cell div{
+.elTreeTableLsiy th.el-table__cell > .cell {
+  text-align: center;
+}
+.elTreeTableLsiy td.el-table__cell div {
   text-align: right;
 }
-.elTreeTableLsiy .el-table__cell{
+.elTreeTableLsiy .el-table__cell {
   padding: 2px 0;
 }
-.elTreeTableLsiy .el-table__cell:first-child .cell{
+.elTreeTableLsiy .el-table__cell:first-child .cell {
   text-align: center;
 }
-</style>
+</style>

+ 1 - 0
src/views/week/index.vue

@@ -328,6 +328,7 @@ export default {
         this.list = res.data.summaryTasks;
         this.historyButton = res.data.historyButton;
         localStorage.setItem('powerGrade', res.data.positionId);
+        localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
         this.existReject = res.data.existReject;
         this.powerGrade = res.data.positionId;
         this.showButton = res.data.showButton;

+ 1 - 0
src/views/week/weekly.vue

@@ -523,6 +523,7 @@ export default {
       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;

File diff ditekan karena terlalu besar
+ 436 - 371
src/views/week/weeklyHistorical.vue