list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div class="lvzhi">
  3. <NavBar :go="{ type: 'push', path: '/menu' }"/>
  4. <div>
  5. <date-cell title="日期" is-row v-model="date" date-type="date" @change="changeDate"/>
  6. <!-- <DatePicker ref="DatePicker" @change="changeDate"></DatePicker>-->
  7. <div class="lz-list">
  8. <div class="list-item">
  9. <p>每日履职</p>
  10. <van-tabs>
  11. <van-tab title="待完成" :badge="dayList.unfinished.length === 0 ? false :dayList.unfinished.length">
  12. <Empty v-if="!dayList.unfinished.length"/>
  13. <div class="list-container" v-else>
  14. <van-cell
  15. v-for="v in dayList.unfinished"
  16. :key="v.id"
  17. :title="v.planName"
  18. :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
  19. is-link
  20. @click="onClick(path,v.id,date,v.planStartTime)"
  21. :value-class="`title-orange`">
  22. <template #right-icon>
  23. <span :style="{ color: getState(getDictLabel(v.status, 'resumption_status')) }">
  24. {{ getDictLabel(v.status, 'resumption_status') }}
  25. </span>
  26. </template>
  27. </van-cell>
  28. </div>
  29. </van-tab>
  30. <van-tab title="未完成" :badge="dayList.proceed.length=== 0 ? false :dayList.proceed.length">
  31. <Empty v-if="!dayList.proceed.length"/>
  32. <div class="list-container" v-else>
  33. <van-cell
  34. v-for="v in dayList.proceed"
  35. :key="v.id"
  36. :title="v.planName"
  37. :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
  38. :value-class="`title-red`">
  39. <template #right-icon>
  40. <span :style="{ color: getState(getDictLabel(v.status, 'resumption_status')) }">
  41. {{ getDictLabel(v.status, 'resumption_status') }}
  42. </span>
  43. </template>
  44. </van-cell>
  45. </div>
  46. </van-tab>
  47. <van-tab title="已完成" :badge="dayList.finished.length=== 0 ? false :dayList.finished.length">
  48. <Empty v-if="!dayList.finished.length"/>
  49. <div class="list-container" v-else>
  50. <van-cell
  51. v-for="v in dayList.finished"
  52. :key="v.id"
  53. :title="v.planName"
  54. :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
  55. is-link
  56. :to="{path:path,query:{id:v.id,taskDate:date}}"
  57. :value-class="`title-green`">
  58. <template #right-icon>
  59. <span :style="{ color: getState(getDictLabel(v.status, 'resumption_status')) }">
  60. {{ getDictLabel(v.status, 'resumption_status') }}
  61. </span>
  62. </template>
  63. </van-cell>
  64. </div>
  65. </van-tab>
  66. </van-tabs>
  67. </div>
  68. <div class="list-item">
  69. <p>周期履职</p>
  70. <van-tabs >
  71. <van-tab title="待完成" :badge="otherList.unfinished.length=== 0 ? false :otherList.unfinished.length">
  72. <Empty v-if="!otherList.unfinished.length"/>
  73. <div class="list-container" v-else>
  74. <van-cell
  75. v-for="v in otherList.unfinished"
  76. :key="v.id"
  77. :title="v.planName"
  78. :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
  79. is-link
  80. @click="onClick(path,v.id,date,v.planStartTime)"
  81. :value-class="`title-orange`">
  82. <template #right-icon>
  83. <span :style="{ color: getState(getDictLabel(v.status, 'resumption_status')) }">
  84. {{ getDictLabel(v.status, 'resumption_status') }}
  85. </span>
  86. </template>
  87. </van-cell>
  88. </div>
  89. </van-tab>
  90. <van-tab title="未完成" :badge="otherList.proceed.length=== 0 ? false :otherList.proceed.length">
  91. <Empty v-if="!otherList.proceed.length"/>
  92. <div class="list-container" v-else>
  93. <van-cell
  94. v-for="v in otherList.proceed"
  95. :key="v.id"
  96. :title="v.planName"
  97. :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
  98. :value-class="`title-red`">
  99. <template #right-icon>
  100. <span :style="{ color: getState(getDictLabel(v.status, 'resumption_status')) }">
  101. {{ getDictLabel(v.status, 'resumption_status') }}
  102. </span>
  103. </template>
  104. </van-cell>
  105. </div>
  106. </van-tab>
  107. <van-tab title="已完成" :badge="otherList.finished.length=== 0 ? false :otherList.finished.length">
  108. <Empty v-if="!otherList.finished.length"/>
  109. <div class="list-container" v-else>
  110. <van-cell
  111. v-for="v in otherList.finished"
  112. :key="v.id"
  113. :title="v.planName"
  114. :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
  115. is-link
  116. :to="{path:path,query:{id:v.id,taskDate:date}}"
  117. :value-class="`title-green`">
  118. <template #right-icon>
  119. <span :style="{ color: getState(getDictLabel(v.status, 'resumption_status')) }">
  120. {{ getDictLabel(v.status, 'resumption_status') }}
  121. </span>
  122. </template>
  123. </van-cell>
  124. </div>
  125. </van-tab>
  126. </van-tabs>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </template>
  132. <script>
  133. import NavBar from '@/components/NavBar';
  134. import DatePicker from '@/components/DatePicker';
  135. import Empty from '@/components/EmptyBox';
  136. import {mapGetters} from "vuex";
  137. import {dataList} from "./api";
  138. import dayjs from "dayjs";
  139. import {getDict} from "@/api/toConsult";
  140. import DateCell from "@/components/dateCell/index.vue";
  141. export default {
  142. name: 'resumption',
  143. components:{DateCell, NavBar,DatePicker,Empty},
  144. data(){
  145. return{
  146. //绑定的日期
  147. date:dayjs(new Date()).format('YYYY-MM-DD'),
  148. //设置浮动的容器
  149. container: null,
  150. //今日履职
  151. dayList: {
  152. unfinished:[],
  153. proceed:[],
  154. finished:[],
  155. },
  156. //周期履职
  157. otherList:{
  158. unfinished:[],
  159. proceed:[],
  160. finished:[],
  161. },
  162. //配置子页面路径
  163. path:'/resumption_detail',
  164. statusList:[],
  165. dicts: ['resumption_status'],
  166. }
  167. },
  168. // created() {
  169. // getDict( 'resumption_status' ).then(res => {
  170. // let { data } = res
  171. // this.statusList = data;
  172. // })
  173. // },
  174. mounted() {
  175. this.initDatalist();
  176. },
  177. computed:{
  178. ...mapGetters(['dictionary','orgName','orgId','roleList']),
  179. // stateList(){
  180. // return this.statusList
  181. // },
  182. },
  183. beforeRouteEnter(to,from,next){
  184. next(vm=>{
  185. if(to.params.event === 'refresh'){
  186. vm.getDatalist();
  187. }
  188. })
  189. },
  190. methods:{
  191. onClick(path,id,date,planStartTime){
  192. let now = new Date();
  193. let start = new Date(planStartTime);
  194. if(now > start){
  195. this.$router.push({path:path,query:{id:id,enable:1,taskDate:date}})
  196. }else{
  197. this.$toast.fail({
  198. message: '任务未到开始时间!',
  199. position: 'top'
  200. })
  201. }
  202. },
  203. getState(state) {
  204. switch (state) {
  205. case '待履职':
  206. return '#008cd6'
  207. case '进行中':
  208. return '#d9b627'
  209. case '已完成':
  210. return '#009240'
  211. case '已逾期':
  212. return '#D7000F'
  213. }
  214. },
  215. getDicts(s){
  216. return this.stateList.find(v=> s == v.dictValue).dictLabel;
  217. },
  218. //格式化时间范围
  219. formatTime(start,end,format){
  220. return `${dayjs(start).format(format)}-${dayjs(end).format(format)}`;
  221. },
  222. //页面第一次加载
  223. initDatalist(){
  224. let roleIds = this.roleList.map(v=>{return v.roleId})
  225. let data = {
  226. dateTime: dayjs(new Date()).format('YYYY-MM-DD'),
  227. orgId: this.orgId,
  228. roleId:roleIds,
  229. }
  230. dataList(data).then(res=>{
  231. this.setData(res);
  232. })
  233. },
  234. //点击日期获取数据
  235. getDatalist(){
  236. let roleIds = this.roleList.map(v=>{return v.roleId})
  237. let data = {
  238. dateTime: this.date,
  239. orgId: this.orgId,
  240. roleId:roleIds,
  241. }
  242. dataList(data).then(res=>{
  243. this.setData(res);
  244. })
  245. },
  246. //给本地数据赋值
  247. setData(res){
  248. //今日
  249. this.dayList.unfinished = res.data.day['1'];
  250. this.dayList.proceed = res.data.day['3']
  251. this.dayList.finished = res.data.day['2'];
  252. //周期
  253. this.otherList.unfinished = res.data.noDay['1'];
  254. this.otherList.proceed = res.data.noDay['3']
  255. this.otherList.finished = res.data.noDay['2'];
  256. },
  257. queryMoth(){
  258. },
  259. //点击时间
  260. changeDate(val){
  261. console.log(val,'val')
  262. this.date = val;
  263. this.getDatalist();
  264. },
  265. },
  266. destroyed(){
  267. window.openCameraCallBack = null;
  268. window.openNFCScanCallBack = null;
  269. }
  270. }
  271. </script>
  272. <style lang="scss">
  273. .lvzhi{
  274. .van-empty{
  275. //padding: 20px;
  276. background-color: #fff;
  277. }
  278. .van-tabs__wrap{
  279. height: 90px;
  280. border-bottom: 1px solid #f5f5f5;
  281. }
  282. .van-cell-group{
  283. background-color: #fff;
  284. }
  285. .van-tabs__line{
  286. background-color: #008cd6;
  287. }
  288. .van-info {
  289. background-color: #008cd6;
  290. }
  291. }
  292. </style>
  293. <style lang="scss" scoped>
  294. .lvzhi{
  295. height: 100%;
  296. overflow: hidden;
  297. }
  298. .top-date-box{
  299. padding: 0 20px;
  300. }
  301. .lz-list{
  302. height: calc(100vh - 280px);
  303. overflow: auto;
  304. }
  305. .list-item{
  306. margin: 20px;
  307. >p{
  308. color:#333;
  309. font-size: 30px;
  310. height: 90px;
  311. line-height: 90px;
  312. background-color: #fff;
  313. padding-left: 20px;
  314. border-bottom: 1px solid #f5f5f5;
  315. }
  316. }
  317. .list-container{
  318. max-height: 700px;
  319. overflow: auto;
  320. }
  321. .title-red{
  322. color: #f16363;
  323. }
  324. .title-green{
  325. color: #58dc33;
  326. }
  327. .title-orange{
  328. color: #fd8104;
  329. }
  330. </style>