index.vue 9.8 KB

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