index.vue 8.2 KB

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