index.vue 8.3 KB

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