index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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="5">-->
  10. <!-- <div class="org-label">检查机构</div>-->
  11. <!-- </van-col>-->
  12. <van-col span="24">
  13. <org-tree v-model="query.checkOrgId" placeholder="选择检查机构" @change="changeOrgId"></org-tree>
  14. </van-col>
  15. </van-row>
  16. </div>
  17. <div class="org-line van-hairline--bottom">
  18. <van-row>
  19. <!-- <van-col span="5">-->
  20. <!-- <div class="org-label">受检机构</div>-->
  21. <!-- </van-col>-->
  22. <van-col span="24">
  23. <org-tree v-model="query.beCheckedOrgId" clearable placeholder="选择受检机构" @change="refreshData"></org-tree>
  24. </van-col>
  25. </van-row>
  26. </div>
  27. </div>
  28. <div class="van-hairline--bottom">
  29. <search-select-cell
  30. title="检查角色"
  31. v-model="query.roldIds"
  32. :dataList="rolesList"
  33. :prop="prop"
  34. @change="refreshData"/>
  35. </div>
  36. <div class="van-hairline--bottom">
  37. <date-cell title="检查日期" v-model="query.taskTime" date-type="date" @change="refreshData"/>
  38. <!-- <select-cell title="状态" v-model="query.state" :dataList="getDictItem('safety_check_status')" @change="getDataList"/>-->
  39. </div>
  40. <div class="card-list">
  41. <Scroll
  42. ref="Scroll"
  43. @refresh="refreshData"
  44. @loadMore="getDataList"
  45. :pullup="pullup">
  46. <van-empty description="暂无数据" v-if="!dataList || dataList.length === 0" />
  47. <div v-else class="list-item">
  48. <van-panel v-for="(v,i) in dataList" :title="v.taskName" :desc="rangDate(formatDate(v.planStartTime,'DATE'),formatDate(v.planEndTime,'DATE'))" >
  49. <van-collapse v-model="active" :key="v.planId" @change="collapseChange">
  50. <van-collapse-item :name="v.planId" >
  51. <template #title>
  52. <div class="collapse-title">
  53. <div :class="{'active':v.active==1}" @click.stop="changeList(v,1)">完成</div>
  54. <div :class="{'active':v.active==2}" @click.stop="changeList(v,2)">未完成</div>
  55. </div>
  56. </template>
  57. <van-cell
  58. v-if="v.active==1? v.completed.length > 0 : v.uncompleted.length > 0"
  59. v-for="(a,index) in v.active==1? v.completed:v.uncompleted" :key="a.taskId"
  60. :title="a.beCheckedOrgName"
  61. :value="getDictLabel(a.status,'safety_check_status')"
  62. :to="{path:path,query:{id:a.taskId,enable:1}}"
  63. is-link/>
  64. </van-collapse-item>
  65. </van-collapse>
  66. </van-panel>
  67. </div>
  68. </Scroll>
  69. </div>
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. import NavBar from '@/components/NavBar'
  75. import OrgTree from '@/components/orgTree'
  76. import KList from '@/components/list'
  77. import DateCell from '@/components/dateCell'
  78. import SelectCell from '@/components/selectCell'
  79. import SearchSelectCell from '@/components/Yselectcell'
  80. import Scroll from '@/components/scroll/scroll'
  81. import {dataList,registerRole} from './api'
  82. import {mapGetters} from "vuex";
  83. import {formatDate} from "@/filters/filter";
  84. export default {
  85. components: {
  86. NavBar,
  87. OrgTree,
  88. DateCell,
  89. SelectCell,
  90. SearchSelectCell,
  91. KList,
  92. Scroll
  93. },
  94. data() {
  95. return {
  96. active:['1'],
  97. //配置子页面路径
  98. path:'/securityDetail',
  99. query:{
  100. taskTime: `${formatDate(new Date(),'YYYY-MM-DD')}`,
  101. checkOrgId:null,
  102. beCheckedOrgId:null,
  103. roldIds:[],
  104. state:'1',
  105. pageNum:1,
  106. pageSize:10,
  107. },
  108. total:0,
  109. rolesList:[],
  110. prop:{
  111. label:'name',
  112. value:'id',
  113. },
  114. loading:false,
  115. dataList:[],
  116. dicts:['safety_check_status'],
  117. //控制上拉加载
  118. pullup:false,
  119. finishList:[],
  120. unfinishedList:[],
  121. }
  122. },
  123. mounted() {
  124. this.initData();
  125. this.query.checkOrgId = this.orgId;
  126. this.getRoleList();
  127. },
  128. computed:{
  129. ...mapGetters(['orgId','dictionary']),
  130. },
  131. methods: {
  132. formatDate,
  133. changeOrgId(){
  134. console.log(123,'2131')
  135. this.query.roldIds = [];
  136. this.getRoleList();
  137. this.refreshData();
  138. },
  139. collapseChange(){
  140. console.log('collapseChange')
  141. this.$nextTick(()=>{
  142. this.$refs.Scroll.refresh();
  143. })
  144. },
  145. changeList(item,type){
  146. this.$set(item,'active',type);
  147. //this.$refs.Scroll.refresh();
  148. },
  149. refreshData(){
  150. console.log('sadad')
  151. this.pullup = true;
  152. this.query.pageNum = 1;
  153. this.total = 0;
  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. if( this.dataList.length !== 0 && this.dataList.length >= this.total) {
  169. this.pullup = false;
  170. this.$toast('已加载完毕');
  171. return;
  172. }
  173. let data = {
  174. ...this.query
  175. }
  176. if(!this.query.checkOrgId) return this.$toast('请选择机构');
  177. dataList(data).then(res=>{
  178. if(res.total === '0'){
  179. this.pullup = false;
  180. this.$toast('已加载完毕');
  181. return
  182. }
  183. this.total = res.total;
  184. if(this.dataList.length < res.total) {
  185. //this.dataFn(res.row);
  186. this.dataList = [...this.dataList,...res.rows];
  187. this.$nextTick(()=>{
  188. this.$refs.Scroll.loadMoreFinish()
  189. //this.$refs.Scroll.refresh();
  190. })
  191. this.pullup = true;
  192. this.query.pageNum++;
  193. }
  194. })
  195. },
  196. dataFn(arr){
  197. this.dataList = arr.map(v=>{
  198. v.active = 1
  199. return v
  200. });
  201. this.active = arr.map(v=>{
  202. return v.planId
  203. })
  204. },
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. .check-register{
  210. .van-cell-group{
  211. margin-bottom: 20px;
  212. }
  213. .van-cell-group:last-child{
  214. margin-bottom: 0;
  215. }
  216. .van-collapse-item__wrapper{
  217. overflow: visible;
  218. }
  219. }
  220. </style>
  221. <style lang="scss" scoped>
  222. .check-register{
  223. .org-line{
  224. padding:0 10px;
  225. background-color: #fff;
  226. }
  227. .org-label{
  228. height: 90px;
  229. width: 100%;
  230. display: flex;
  231. align-items: center;
  232. font-size: 28px;
  233. }
  234. .card-list{
  235. height: calc(100vh - 580px);
  236. overflow: auto;
  237. }
  238. .list-item{
  239. padding: 20px;
  240. }
  241. .card-num{
  242. display: flex;
  243. align-items: center;
  244. font-size: 28px;
  245. color: #009dff;
  246. }
  247. .collapse-title{
  248. display: flex;
  249. justify-content: flex-start;
  250. align-items: center;
  251. font-size: 28px;
  252. color: #ccc;
  253. >div{
  254. width: 40%;
  255. display: flex;
  256. }
  257. >div.active{
  258. color: #009dff;
  259. }
  260. }
  261. .flex-box{
  262. display: flex;
  263. align-items: center;
  264. >div{
  265. margin-right: 40px;
  266. }
  267. }
  268. .search-box{
  269. display: flex;
  270. justify-content: space-between;
  271. align-items: center;
  272. >div{
  273. width: 50%;
  274. }
  275. }
  276. }
  277. </style>