index.vue 8.0 KB

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