| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 | <template>  <div class="lvzhi" ref="container">    <nav-bar></nav-bar>    <van-sticky :container="container">      <DatePicker ref="DatePicker" @change="changeDate"></DatePicker>    </van-sticky>    <div class="lz-container" id="lz-container" @scroll="handleScroll">      <div class="lz-list">        <div class="list-item">          <p>每日履职</p>          <van-tabs >            <van-tab title="待完成">              <template #title>待完成 {{dayList.unfinished.length}} </template>              <van-empty description="暂无数据" v-if="!dayList.unfinished.length"/>              <van-cell-group  v-else>                <van-cell                  v-for="v in dayList.unfinished"                  :key="v.id"                  :title="v.planName"                  :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"                  is-link                  :to="{path:path,query:{id:v.id,enable:1}}"                  :value="getDicts(v.status,'resumption_status')"                  :value-class="`title-orange`"/>              </van-cell-group>            </van-tab>            <van-tab title="未完成">              <template #title>未完成 {{dayList.proceed.length}} </template>              <van-empty description="暂无数据" v-if="!dayList.proceed.length"/>              <van-cell-group v-else>                <van-cell                  v-for="v in dayList.proceed"                  :key="v.id"                  :title="v.planName"                  :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"                  is-link                  :to="{path:path,query:{id:v.id}}"                  :value="getDicts(v.status,'resumption_status')"                  :value-class="`title-orange`"/>              </van-cell-group>            </van-tab>            <van-tab title="已完成">              <template #title>已完成 {{dayList.finished.length}} </template>              <van-empty description="暂无数据" v-if="!dayList.finished.length"/>              <van-cell-group v-else>                <van-cell                  v-for="v in dayList.finished"                  :key="v.id"                  :title="v.planName"                  :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"                  is-link                  :to="{path:path,query:{id:v.id}}"                  :value="getDicts(v.status,'resumption_status')"                  :value-class="`title-orange`"/>              </van-cell-group>            </van-tab>          </van-tabs>        </div>        <div class="list-item">          <p>周期履职</p>          <van-tabs >            <van-tab title="待完成">              <template #title>待完成 {{otherList.unfinished.length}} </template>              <van-empty description="暂无数据" v-if="!otherList.unfinished.length"/>              <van-cell-group v-else>                <van-cell                  v-for="v in otherList.unfinished"                  :key="v.id"                  :title="v.planName"                  :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"                  is-link                  :to="{path:path,query:{id:v.id,enable:1}}"                  :value="getDicts(v.status,'resumption_status')"                  :value-class="`title-orange`"/>              </van-cell-group>            </van-tab>            <van-tab title="未完成">              <template #title>未完成 {{otherList.proceed.length}} </template>              <van-empty description="暂无数据" v-if="!otherList.proceed.length"/>              <van-cell-group v-else>                <van-cell                  v-for="v in otherList.proceed"                  :key="v.id"                  :title="v.planName"                  :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"                  is-link                  :to="{path:path,query:{id:v.id}}"                  :value="getDicts(v.status,'resumption_status')"                  :value-class="`title-orange`"/>              </van-cell-group>            </van-tab>            <van-tab title="已完成">              <template #title>已完成 {{otherList.finished.length}} </template>              <van-empty description="暂无数据" v-if="!otherList.finished.length"/>              <van-cell-group v-else>                <van-cell                  v-for="v in otherList.finished"                  :key="v.id"                  :title="v.planName"                  :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"                  is-link                  :to="{path:path,query:{id:v.id}}"                  :value="getDicts(v.status,'resumption_status')"                  :value-class="`title-orange`"/>              </van-cell-group>            </van-tab>          </van-tabs>        </div>      </div>    </div>  </div></template><script>import NavBar from '@/components/NavBar';import DatePicker from '@/components/DatePicker';import {mapGetters} from "vuex";import {dataList} from "./api";import dayjs from "dayjs";import {getDict} from "@/api/toConsult";export default {  name: 'lvzhi',  components:{NavBar,DatePicker},  data(){    return{      //绑定的日期      date:new Date(),      //设置浮动的容器      container: null,      //今日履职      dayList: {        unfinished:[],        proceed:[],        finished:[],      },      //周期履职      otherList:{        unfinished:[],        proceed:[],        finished:[],      },      //配置子页面路径      path:'/lz-edit',    }  },  created() {    getDict( 'resumption_status' ).then(res => {      let { data } = res      this.stateList = data;    })  },  mounted() {    this.container = this.$refs.container;    this.initDatalist();    document.getElementById('lz-container')  },  computed:{    ...mapGetters(['orgName','orgId','roleList']),  },  beforeRouteEnter(to,from,next){    next(vm=>{      vm.getDatalist();    })  },  methods:{    getDicts(s){      return this.stateList.find(v=> s == v.dictValue).dictLabel;    },    handleScroll(e){      let scrollTop = document.getElementById('lz-container').scrollTop;      this.$refs.DatePicker.showPicker = false;    },    //格式化时间范围    formatTime(start,end,format){      return `${dayjs(start).format(format)}-${dayjs(end).format(format)}`;    },    //页面第一次加载    initDatalist(){      let roleIds = this.roleList.map(v=>{return v.roleId})      let data = {        dateTime: dayjs(new Date()).format('YYYY-MM-DD'),        orgId: this.orgId,        roleId:roleIds,      }      dataList(data).then(res=>{        this.setData(res);      })    },    //点击日期获取数据    getDatalist(){      let roleIds = this.roleList.map(v=>{return v.roleId})      let data = {        dateTime: this.date,        orgId: this.orgId,        roleId:roleIds,      }      dataList(data).then(res=>{        this.setData(res);      })    },    //给本地数据赋值    setData(res){      //今日      this.dayList.unfinished = res.data.day['1'];      this.dayList.proceed = res.data.day['3']      this.dayList.finished = res.data.day['2'];      //周期      this.otherList.unfinished = res.data.noDay['1'];      this.otherList.proceed = res.data.noDay['3']      this.otherList.finished = res.data.noDay['2'];    },    queryMoth(){    },    //点击时间    changeDate(val){      console.log(val,'val')      this.date = val;      this.getDatalist();    },  }}</script><style lang="scss">.lvzhi{  .van-empty{    background-color: #fff;  }  .van-cell-group{    background-color: #fff;  }  .van-tabs__line{    background-color: #008cd6;  }}</style><style lang="scss" scoped>  .lvzhi{    height: 100%;    overflow: hidden;  }  .lz-container{    height: calc(100vh - 190px);    overflow: scroll;  }  .top-date-box{    padding: 0 20px;  }  .lz-list{    box-sizing: border-box;    overflow: auto;  }  .list-item{    margin: 20px;    >p{      color:#999;      font-size: 30px;      height: 60px;      line-height: 60px;    }  }  .title-red{    color: #f16363;  }  .title-red{    color: #58dc33;  }  .title-orange{    color: #fd8104;  }</style>
 |