index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="check-register">
  3. <NavBar :go="go"/>
  4. <div class="statistics-container">
  5. <!-- 搜索 -->
  6. <div style="background-color: #fff;">
  7. <!--需求改为只查看本检查机构、登录角色的任务-->
  8. <div class="org-line van-hairline--bottom">
  9. <org-tree clearable v-model="query.beCheckedOrgId" placeholder="选择受检机构" @change="changeOrgId"></org-tree>
  10. </div>
  11. <div >
  12. <date-cell title="日期" is-row v-model="query.taskTime" date-type="date" @change="refreshData"/>
  13. <!-- <search-select-cell-->
  14. <!-- class="van-hairline&#45;&#45;right"-->
  15. <!-- title="检查角色"-->
  16. <!-- :border="false"-->
  17. <!-- v-model="query.roleIds"-->
  18. <!-- :dataList="rolesList"-->
  19. <!-- :prop="prop"-->
  20. <!-- @change="refreshData"/> </div> -->
  21. </div>
  22. </div>
  23. <div class="card-list">
  24. <Scroll
  25. ref="Scroll"
  26. @refresh="refreshData"
  27. @loadMore="getDataList"
  28. :pullup="pullup">
  29. <empty v-if="!dataList || dataList.length === 0" />
  30. <card class="list-item" v-for="(v,i) in dataList" :key="v.planId+i">
  31. <div class="item-title">
  32. <van-cell :title="v.taskName" :border="false" :label="rangDate(formatDate(v.planStartTime,'DATE'),formatDate(v.planEndTime,'DATE'))" ></van-cell>
  33. <div class="collapse-title">
  34. <div :class="{'active':v.active==2}" @click.stop="changeList(v,2)">
  35. <p> {{v.uncompleted.length}}</p>
  36. <p>未完成</p>
  37. </div>
  38. <div :class="{'active':v.active==1}" @click.stop="changeList(v,1)">
  39. <p>{{v.completed.length}}</p>
  40. <p>完成</p>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="check-item-list">
  45. <empty v-if="v.active==1? v.completed.length == 0 : v.uncompleted.length == 0" />
  46. <van-cell
  47. v-else
  48. v-for="(a,index) in v.active==1? v.completed:v.uncompleted" :key="a.taskId"
  49. :title="a.beCheckedOrgName"
  50. :to="{path:path,query:{id:a.taskId,enable:1}}">
  51. <template #right-icon>
  52. <div>
  53. <span :style="{color:getState(getDictLabel(a.status,'safety_check_status'))}">
  54. {{getDictLabel(a.status,'safety_check_status')}}
  55. </span>
  56. </div>
  57. </template>
  58. </van-cell>
  59. </div>
  60. </card>
  61. </Scroll>
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import NavBar from '@/components/NavBar'
  68. import OrgTree from '@/components/orgTree'
  69. import Card from '@/components/card'
  70. import DateCell from '@/components/dateCell'
  71. import SelectCell from '@/components/selectCell'
  72. import SearchSelectCell from '@/components/SearchSelectCell'
  73. import Scroll from '@/components/scroll/scroll'
  74. import {dataList,registerRole} from './api'
  75. import {mapGetters} from "vuex";
  76. import {formatDate} from "@/filters/filter";
  77. export default {
  78. components: {
  79. NavBar,
  80. OrgTree,
  81. Card,
  82. DateCell,
  83. SelectCell,
  84. SearchSelectCell,
  85. Scroll
  86. },
  87. data() {
  88. return {
  89. active:['1'],
  90. //配置子页面路径
  91. path:'/securityDetail',
  92. query:{
  93. taskTime: `${formatDate(new Date(),'YYYY-MM-DD')}`,
  94. checkOrgId:null,
  95. beCheckedOrgId:null,
  96. roleIds:[],
  97. // state:'1',
  98. pageNum:1,
  99. pageSize:10,
  100. },
  101. total:0,
  102. rolesList:[],
  103. prop:{
  104. label:'name',
  105. value:'id',
  106. },
  107. loading:false,
  108. dataList:[],
  109. dicts:['safety_check_status'],
  110. finishList:[],
  111. unfinishedList:[],
  112. //控制上拉加载
  113. pullup:false,
  114. go:{
  115. type:'replace',
  116. path:'/menu',
  117. }
  118. }
  119. },
  120. mounted() {
  121. this.initData();
  122. this.query.checkOrgId = this.orgId;
  123. // this.getRoleList();
  124. },
  125. computed:{
  126. ...mapGetters(['orgId','dictionary','roleList']),
  127. },
  128. methods: {
  129. formatDate,
  130. getState(state){
  131. switch (state){
  132. case '待检查':
  133. return '#008cd6';
  134. case '进行中':
  135. return '#bc9f71';
  136. case '完成':
  137. return '#009240';
  138. case '已过期':
  139. return '#D7000F';
  140. }
  141. },
  142. changeOrgId(){
  143. this.query.roleIds = [];
  144. this.getRoleList();
  145. this.refreshData();
  146. },
  147. changeList(item,type){
  148. this.$set(item,'active',type);
  149. },
  150. refreshData(){
  151. this.pullup = true;
  152. this.total = 0;
  153. this.query.pageNum = 1;
  154. this.dataList = [];
  155. this.getDataList();
  156. },
  157. initData(){
  158. this.query.checkOrgId = this.orgId;
  159. this.query.taskTime = formatDate(new Date(),'YYYY-MM-DD');
  160. this.getDataList();
  161. },
  162. getRoleList(){
  163. registerRole(this.query.checkOrgId).then(res=>{
  164. this.rolesList = res.data;
  165. })
  166. },
  167. getDataList(){
  168. console.log(123123123)
  169. if( this.dataList.length !== 0 && this.dataList.length >= this.total) {
  170. this.pullup = false;
  171. this.$toast('已加载完毕');
  172. return;
  173. }
  174. let data = {
  175. ...this.query
  176. }
  177. //if(!this.query.checkOrgId) return this.$toast('请选择机构');
  178. data.roleIds= this.roleList.map(v=>{return v.roleId})
  179. dataList(data).then(res=>{
  180. console.log(res,'ressssssss')
  181. if(res.total === '0'){
  182. this.pullup = false;
  183. this.$toast('已加载完毕');
  184. return
  185. }
  186. this.total = res.total;
  187. res.rows.forEach(v=>{
  188. v.active = 2
  189. });
  190. console.log(res.rows,'arr')
  191. if(this.dataList.length < res.total) {
  192. this.dataList = [...this.dataList,...res.rows];
  193. console.log(111)
  194. this.pullup = true;
  195. this.query.pageNum++;
  196. this.$refs.Scroll.refresh(); //异步请求数据量过大,需手动刷新容器
  197. }
  198. })
  199. },
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. .check-register{
  205. .item-title{
  206. >.van-cell{
  207. padding: 0;
  208. }
  209. }
  210. .van-empty{
  211. padding: 0;
  212. .van-empty__image{
  213. width: 160px;
  214. height: 160px;
  215. }
  216. }
  217. .check-item-list{
  218. >.van-cell{
  219. padding: 20px;
  220. .van-cell__title{
  221. flex:2;
  222. }
  223. .van-cell__value{
  224. flex:1;
  225. }
  226. }
  227. .van-cell::after{
  228. left: 20px;
  229. right: 20px;
  230. }
  231. }
  232. }
  233. </style>
  234. <style lang="scss" scoped>
  235. .check-register{
  236. .org-line{
  237. padding:0 10px;
  238. background-color: #fff;
  239. }
  240. .search-flex{
  241. display: flex;
  242. align-items: center;
  243. justify-content: space-between;
  244. border-bottom: 1px solid #f5f5f5;
  245. >div{
  246. width: 50%;
  247. }
  248. }
  249. .org-label{
  250. height: 90px;
  251. width: 100%;
  252. display: flex;
  253. align-items: center;
  254. font-size: 28px;
  255. }
  256. .card-list{
  257. padding:0 20px 20px 20px;
  258. height: calc(100vh - 370px);
  259. overflow: auto;
  260. }
  261. .list-item{
  262. padding: 20px;
  263. }
  264. .item-title{
  265. width: 100%;
  266. display: flex;
  267. justify-content: space-between;
  268. border-bottom: 1px solid #f5f5f5;
  269. padding-bottom: 10px;
  270. }
  271. .check-item-list{
  272. -max-height: 500px;
  273. overflow: auto;
  274. }
  275. .card-num{
  276. display: flex;
  277. align-items: center;
  278. font-size: 28px;
  279. color: #008cd6;
  280. }
  281. .collapse-title{
  282. width: 50%;
  283. margin-left: 10px;
  284. display: flex;
  285. align-items: center;
  286. justify-content: space-between;
  287. font-size: 28px;
  288. color: #ccc;
  289. >div{
  290. width: 100px;
  291. font-size: 24px;
  292. height: 70px;
  293. padding: 5px 10px;
  294. border: 2px solid #ccc;
  295. border-radius: 10px;
  296. box-shadow: 0 3px 6px #eaeaea;
  297. >p{
  298. height: 28px;
  299. line-height: 28px;
  300. text-align: center;
  301. }
  302. }
  303. >div.active{
  304. color: #fff;
  305. background-color: #008cd6;
  306. border: 3px solid #008cd6;
  307. }
  308. }
  309. .flex-box{
  310. display: flex;
  311. align-items: center;
  312. >div{
  313. margin-right: 40px;
  314. }
  315. }
  316. .search-box{
  317. display: flex;
  318. justify-content: space-between;
  319. align-items: center;
  320. >div{
  321. width: 50%;
  322. }
  323. }
  324. }
  325. </style>