list.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div class="lvzhi" ref="container">
  3. <NavBar :go="{ type: 'push', path: '/menu' }"/>
  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,enable:1,taskDate:date}}"
  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,taskDate:date}}"
  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,taskDate:date}}"
  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,enable:1,taskDate:date}}"
  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,taskDate:date}}"
  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,taskDate:date}}"
  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. import {getDict} from "@/api/toConsult";
  120. export default {
  121. name: 'lvzhi',
  122. components:{NavBar,DatePicker},
  123. data(){
  124. return{
  125. //绑定的日期
  126. date:dayjs(new Date()).format('YYYY-MM-DD'),
  127. //设置浮动的容器
  128. container: null,
  129. //今日履职
  130. dayList: {
  131. unfinished:[],
  132. proceed:[],
  133. finished:[],
  134. },
  135. //周期履职
  136. otherList:{
  137. unfinished:[],
  138. proceed:[],
  139. finished:[],
  140. },
  141. //配置子页面路径
  142. path:'/resumption_detail',
  143. }
  144. },
  145. created() {
  146. getDict( 'resumption_status' ).then(res => {
  147. let { data } = res
  148. this.stateList = data;
  149. })
  150. },
  151. mounted() {
  152. this.container = this.$refs.container;
  153. this.initDatalist();
  154. document.getElementById('lz-container')
  155. },
  156. computed:{
  157. ...mapGetters(['orgName','orgId','roleList']),
  158. },
  159. beforeRouteEnter(to,from,next){
  160. next(vm=>{
  161. vm.getDatalist();
  162. })
  163. },
  164. methods:{
  165. getDicts(s){
  166. return this.stateList.find(v=> s == v.dictValue).dictLabel;
  167. },
  168. handleScroll(e){
  169. let scrollTop = document.getElementById('lz-container').scrollTop;
  170. this.$refs.DatePicker.showPicker = false;
  171. },
  172. //格式化时间范围
  173. formatTime(start,end,format){
  174. return `${dayjs(start).format(format)}-${dayjs(end).format(format)}`;
  175. },
  176. //页面第一次加载
  177. initDatalist(){
  178. let roleIds = this.roleList.map(v=>{return v.roleId})
  179. let data = {
  180. dateTime: dayjs(new Date()).format('YYYY-MM-DD'),
  181. orgId: this.orgId,
  182. roleId:roleIds,
  183. }
  184. dataList(data).then(res=>{
  185. this.setData(res);
  186. })
  187. },
  188. //点击日期获取数据
  189. getDatalist(){
  190. let roleIds = this.roleList.map(v=>{return v.roleId})
  191. let data = {
  192. dateTime: this.date,
  193. orgId: this.orgId,
  194. roleId:roleIds,
  195. }
  196. dataList(data).then(res=>{
  197. this.setData(res);
  198. })
  199. },
  200. //给本地数据赋值
  201. setData(res){
  202. //今日
  203. this.dayList.unfinished = res.data.day['1'];
  204. this.dayList.proceed = res.data.day['3']
  205. this.dayList.finished = res.data.day['2'];
  206. //周期
  207. this.otherList.unfinished = res.data.noDay['1'];
  208. this.otherList.proceed = res.data.noDay['3']
  209. this.otherList.finished = res.data.noDay['2'];
  210. },
  211. queryMoth(){
  212. },
  213. //点击时间
  214. changeDate(val){
  215. console.log(val,'val')
  216. this.date = val;
  217. this.getDatalist();
  218. },
  219. }
  220. }
  221. </script>
  222. <style lang="scss">
  223. .lvzhi{
  224. .van-empty{
  225. background-color: #fff;
  226. }
  227. .van-cell-group{
  228. background-color: #fff;
  229. }
  230. .van-tabs__line{
  231. background-color: #008cd6;
  232. }
  233. }
  234. </style>
  235. <style lang="scss" scoped>
  236. .lvzhi{
  237. height: 100%;
  238. overflow: hidden;
  239. }
  240. .lz-container{
  241. height: calc(100vh - 190px);
  242. overflow: scroll;
  243. }
  244. .top-date-box{
  245. padding: 0 20px;
  246. }
  247. .lz-list{
  248. box-sizing: border-box;
  249. overflow: auto;
  250. }
  251. .list-item{
  252. margin: 20px;
  253. >p{
  254. color:#999;
  255. font-size: 30px;
  256. height: 60px;
  257. line-height: 60px;
  258. }
  259. }
  260. .title-red{
  261. color: #f16363;
  262. }
  263. .title-red{
  264. color: #58dc33;
  265. }
  266. .title-orange{
  267. color: #fd8104;
  268. }
  269. </style>