index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <div class="lvzhi" ref="container">
  3. <nav-bar></nav-bar>
  4. <van-sticky :container="container">
  5. <DatePicker ref="DatePicker" @change="changeDate"></DatePicker>
  6. </van-sticky>
  7. <div class="lz-container" id="lz-container" @scroll="handleScroll">
  8. <div class="lz-list">
  9. <div class="list-item">
  10. <p>今日履职</p>
  11. <van-tabs >
  12. <van-tab title="待完成">
  13. <template #title>待完成 {{dayList.unfinished.length}} </template>
  14. <van-empty description="暂无数据" v-if="!dayList.unfinished.length"/>
  15. <van-cell-group v-else>
  16. <van-cell
  17. v-for="v in dayList.unfinished"
  18. :key="v.id"
  19. :title="v.planName"
  20. :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
  21. is-link
  22. :to="{path:path,query:{id:v.id}}"
  23. :value="getDicts(v.status,'resumption_status')"
  24. :value-class="`title-orange`"/>
  25. </van-cell-group>
  26. </van-tab>
  27. <van-tab title="未完成">
  28. <template #title>未完成 {{dayList.proceed.length}} </template>
  29. <van-empty description="暂无数据" v-if="!dayList.proceed.length"/>
  30. <van-cell-group v-else>
  31. <van-cell
  32. v-for="v in dayList.proceed"
  33. :key="v.id"
  34. :title="v.planName"
  35. :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
  36. is-link
  37. :to="{path:path,query:{id:v.id}}"
  38. :value="getDicts(v.status,'resumption_status')"
  39. :value-class="`title-orange`"/>
  40. </van-cell-group>
  41. </van-tab>
  42. <van-tab title="已完成">
  43. <template #title>已完成 {{dayList.finished.length}} </template>
  44. <van-empty description="暂无数据" v-if="!dayList.finished.length"/>
  45. <van-cell-group v-else>
  46. <van-cell
  47. v-for="v in dayList.finished"
  48. :key="v.id"
  49. :title="v.planName"
  50. :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
  51. is-link
  52. :to="{path:path,query:{id:v.id}}"
  53. :value="getDicts(v.status,'resumption_status')"
  54. :value-class="`title-orange`"/>
  55. </van-cell-group>
  56. </van-tab>
  57. </van-tabs>
  58. </div>
  59. <div class="list-item">
  60. <p>周期履职</p>
  61. <van-tabs >
  62. <van-tab title="待完成">
  63. <template #title>待完成 {{otherList.unfinished.length}} </template>
  64. <van-empty description="暂无数据" v-if="!otherList.unfinished.length"/>
  65. <van-cell-group v-else>
  66. <van-cell
  67. v-for="v in otherList.unfinished"
  68. :key="v.id"
  69. :title="v.planName"
  70. :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
  71. is-link
  72. :to="{path:path,query:{id:v.id}}"
  73. :value="getDicts(v.status,'resumption_status')"
  74. :value-class="`title-orange`"/>
  75. </van-cell-group>
  76. </van-tab>
  77. <van-tab title="未完成">
  78. <template #title>未完成 {{otherList.proceed.length}} </template>
  79. <van-empty description="暂无数据" v-if="!otherList.proceed.length"/>
  80. <van-cell-group v-else>
  81. <van-cell
  82. v-for="v in otherList.proceed"
  83. :key="v.id"
  84. :title="v.planName"
  85. :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
  86. is-link
  87. :to="{path:path,query:{id:v.id}}"
  88. :value="getDicts(v.status,'resumption_status')"
  89. :value-class="`title-orange`"/>
  90. </van-cell-group>
  91. </van-tab>
  92. <van-tab title="已完成">
  93. <template #title>已完成 {{otherList.finished.length}} </template>
  94. <van-empty description="暂无数据" v-if="!otherList.finished.length"/>
  95. <van-cell-group v-else>
  96. <van-cell
  97. v-for="v in otherList.finished"
  98. :key="v.id"
  99. :title="v.planName"
  100. :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
  101. is-link
  102. :to="{path:path,query:{id:v.id}}"
  103. :value="getDicts(v.status,'resumption_status')"
  104. :value-class="`title-orange`"/>
  105. </van-cell-group>
  106. </van-tab>
  107. </van-tabs>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </template>
  113. <script>
  114. import NavBar from '@/components/NavBar';
  115. import DatePicker from '@/components/DatePicker';
  116. import {mapGetters} from "vuex";
  117. import {dataList} from "./api";
  118. import dayjs from "dayjs";
  119. export default {
  120. components:{NavBar,DatePicker},
  121. data(){
  122. return{
  123. //绑定的日期
  124. date:new Date(),
  125. //设置浮动的容器
  126. container: null,
  127. //今日履职
  128. dayList: {
  129. unfinished:[],
  130. proceed:[],
  131. finished:[],
  132. },
  133. //周期履职
  134. otherList:{
  135. unfinished:[],
  136. proceed:[],
  137. finished:[],
  138. },
  139. //配置子页面路径
  140. path:'/lz-edit',
  141. //字典表
  142. dicts: ['resumption_status'],
  143. }
  144. },
  145. mounted() {
  146. this.container = this.$refs.container;
  147. this.initDatalist();
  148. document.getElementById('lz-container')
  149. },
  150. computed:{
  151. ...mapGetters(['orgName','orgId']),
  152. },
  153. watch:{
  154. },
  155. methods:{
  156. handleScroll(e){
  157. let scrollTop = document.getElementById('lz-container').scrollTop;
  158. this.$refs.DatePicker.showPicker = false;
  159. console.log(scrollTop,'555')
  160. },
  161. //格式化时间范围
  162. formatTime(start,end,format){
  163. return `${dayjs(start).format(format)}-${dayjs(end).format(format)}`;
  164. },
  165. //页面第一次加载
  166. initDatalist(){
  167. let data = {
  168. dateTime: dayjs(new Date()).format('YYYY-MM-DD'),
  169. orgId: this.orgId,
  170. roleId:this.roleId,
  171. }
  172. dataList(data).then(res=>{
  173. console.log(res,'ressss')
  174. this.setData(res);
  175. })
  176. },
  177. //点击日期获取数据
  178. getDatalist(){
  179. let data = {
  180. dateTime: this.date,
  181. orgId: this.orgId,
  182. roleId:this.roleId,
  183. }
  184. dataList(data).then(res=>{
  185. console.log(res,'ressssssssss')
  186. this.setData(res);
  187. })
  188. },
  189. //给本地数据赋值
  190. setData(res){
  191. //今日
  192. this.dayList.unfinished = res.data.day['1'];
  193. this.dayList.proceed = res.data.day['3']
  194. this.dayList.finished = res.data.day['2'];
  195. //周期
  196. this.otherList.unfinished = res.data.noDay['1'];
  197. this.otherList.proceed = res.data.noDay['3']
  198. this.otherList.finished = res.data.noDay['2'];
  199. },
  200. queryMoth(){
  201. },
  202. //点击时间
  203. changeDate(val){
  204. console.log(val,'val')
  205. this.date = val;
  206. this.getDatalist();
  207. },
  208. }
  209. }
  210. </script>
  211. <style lang="scss">
  212. .lvzhi{
  213. .van-empty{
  214. background-color: #fff;
  215. }
  216. .van-cell-group{
  217. background-color: #fff;
  218. }
  219. }
  220. </style>
  221. <style lang="scss" scoped>
  222. .lvzhi{
  223. height: 100%;
  224. overflow: hidden;
  225. }
  226. .lz-container{
  227. height: calc(100vh - 190px);
  228. overflow: scroll;
  229. }
  230. .top-date-box{
  231. padding: 0 20px;
  232. }
  233. .lz-list{
  234. box-sizing: border-box;
  235. overflow: auto;
  236. }
  237. .list-item{
  238. margin: 20px;
  239. >p{
  240. color:#999;
  241. font-size: 30px;
  242. height: 60px;
  243. line-height: 60px;
  244. }
  245. }
  246. .title-red{
  247. color: #f16363;
  248. }
  249. .title-red{
  250. color: #58dc33;
  251. }
  252. .title-orange{
  253. color: #fd8104;
  254. }
  255. </style>