index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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="refreshData"></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 title="检查角色" v-model="query.roldIds" :dataList="rolesList" :prop="prop" @change="refreshData"/>
  30. </div>
  31. <div class="van-hairline--bottom">
  32. <date-cell title="检查日期" v-model="query.taskTime" date-type="date" @change="refreshData"/>
  33. <!-- <select-cell title="状态" v-model="query.state" :dataList="getDictItem('safety_check_status')" @change="getDataList"/>-->
  34. </div>
  35. <div class="card-list">
  36. <Scroll
  37. @pulldown="refreshData"
  38. @pullup="getDataList"
  39. :data='dataList'
  40. :pullup="pullup"
  41. class="wrapper"
  42. ref="wrapper">
  43. <van-empty description="暂无数据" v-if="!dataList || dataList.length === 0" />
  44. <div v-else class="list-item">
  45. <van-panel v-for="(v,i) in dataList" :title="v.taskName" :desc="`${formatDate(v.planStartTime,'YYYY-MM-DD')}~${formatDate(v.planEndTime,'YYYY-MM-DD')}`" >
  46. <!-- <van-tabs v-model="active">-->
  47. <!-- <van-tab title="完成">-->
  48. <!-- <van-collapse v-if="v.completed.length > 0" v-model="activeNames" :key="v.planId">-->
  49. <!-- <van-collapse-item title="标题1" name="1" >-->
  50. <!-- <van-cell-->
  51. <!-- v-for="(a,index) in v.completed" :key="a.taskId"-->
  52. <!-- :title="a.beCheckedOrgName"-->
  53. <!-- :value="getDictLabel(a.status,'safety_check_status')"-->
  54. <!-- :to="{path:path,query:{id:a.taskId,enable:1}}"-->
  55. <!-- is-link/>-->
  56. <!-- </van-collapse-item>-->
  57. <!-- </van-collapse>-->
  58. <!-- </van-tab>-->
  59. <!-- <van-tab title="未完成">-->
  60. <!-- <van-collapse v-if="v.uncompleted.length > 0" v-model="activeNames" :key="v.planId">-->
  61. <!-- <van-collapse-item title="标题1" name="1" >-->
  62. <!-- <van-cell-->
  63. <!-- v-for="(a,index) in v.uncompleted" :key="a.taskId"-->
  64. <!-- :title="a.beCheckedOrgName"-->
  65. <!-- :value="getDictLabel(a.status,'safety_check_status')"-->
  66. <!-- :to="{path:path,query:{id:a.taskId,enable:1}}"-->
  67. <!-- is-link/>-->
  68. <!-- </van-collapse-item>-->
  69. <!-- </van-collapse>-->
  70. <!-- </van-tab>-->
  71. <!-- </van-tabs>-->
  72. <van-collapse v-model="activeNames" :key="v.planId">
  73. <van-collapse-item name="1" >
  74. <template #title>
  75. <div class="collapse-title">
  76. <div :class="{'active':v.active==1}" @click.stop="changeList(v,1)">完成</div>
  77. <div :class="{'active':v.active==2}" @click.stop="changeList(v,2)">未完成</div>
  78. </div>
  79. </template>
  80. <van-cell
  81. v-if="v.active==1? v.completed.length > 0 : v.uncompleted.length > 0"
  82. v-for="(a,index) in v.active==1? v.completed:v.uncompleted" :key="a.taskId"
  83. :title="a.beCheckedOrgName"
  84. :value="getDictLabel(a.status,'safety_check_status')"
  85. :to="{path:path,query:{id:a.taskId,enable:1}}"
  86. is-link/>
  87. </van-collapse-item>
  88. </van-collapse>
  89. </van-panel>
  90. </div>
  91. <!-- <van-button type="info" @click="to">详情</van-button>-->
  92. <!-- <van-cell-group v-for="v in dataList">-->
  93. <!-- <van-cell :title="v.orgName" >-->
  94. <!-- <template #extra>-->
  95. <!-- <div class="card-num">-->
  96. <!-- {{v.finishRate}}-->
  97. <!-- </div>-->
  98. <!-- </template>-->
  99. <!-- <template #label>-->
  100. <!-- <div class="flex-box">-->
  101. <!-- <div>应培训数:{{v.shouldFinish}}</div>-->
  102. <!-- <div>已培训数:{{v.finish}}</div>-->
  103. <!-- </div>-->
  104. <!-- </template>-->
  105. <!-- </van-cell>-->
  106. <!-- </van-cell-group>-->
  107. </Scroll>
  108. </div>
  109. </div>
  110. </div>
  111. </template>
  112. <script>
  113. import NavBar from '@/components/NavBar'
  114. import OrgTree from '@/components/orgTree'
  115. import KList from '@/components/list'
  116. import DateCell from '@/components/dateCell'
  117. import SelectCell from '@/components/selectCell'
  118. import SearchSelectCell from '@/components/SearchSelectCell'
  119. import Scroll from '@/components/scroll/scroll'
  120. import {dataList,registerRole} from './api'
  121. import {mapGetters} from "vuex";
  122. import {formatDate} from "@/filters/filter";
  123. export default {
  124. components: {
  125. NavBar,
  126. OrgTree,
  127. DateCell,
  128. SelectCell,
  129. SearchSelectCell,
  130. KList,
  131. Scroll
  132. },
  133. data() {
  134. return {
  135. activeNames:['1'],
  136. //配置子页面路径
  137. path:'/securityDetail',
  138. query:{
  139. taskTime: null,
  140. checkOrgId:null,
  141. beCheckedOrgId:null,
  142. roldIds:null,
  143. state:'1',
  144. },
  145. rolesList:[],
  146. prop:{
  147. label:'name',
  148. value:'id',
  149. },
  150. loading:false,
  151. dataList:[],
  152. dicts:['safety_check_status'],
  153. //控制上拉加载
  154. pullup:false,
  155. finishList:[],
  156. unfinishedList:[],
  157. }
  158. },
  159. mounted() {
  160. this.initData();
  161. },
  162. computed:{
  163. ...mapGetters(['orgId','dictionary']),
  164. },
  165. watch:{
  166. 'query.checkOrgId':{
  167. handler(v){
  168. this.getRoleList();
  169. }
  170. }
  171. },
  172. methods: {
  173. formatDate,
  174. changeList(item,type){
  175. this.$set(item,'active',type);
  176. },
  177. refreshData(){
  178. this.query.pageNum = 1;
  179. this.pullup = false;
  180. this.dataList = [];
  181. this.getDataList();
  182. },
  183. initData(){
  184. this.query.checkOrgId = this.orgId;
  185. this.query.taskTime = formatDate(new Date(),'YYYY-MM-DD');
  186. this.getDataList();
  187. },
  188. getRoleList(){
  189. registerRole(this.query.checkOrgId).then(res=>{
  190. this.rolesList = res.data;
  191. })
  192. },
  193. getDataList(){
  194. let data = {
  195. ...this.query
  196. }
  197. if(!this.query.checkOrgId) return this.$toast('请选择机构');
  198. dataList(data).then(res=>{
  199. this.dataList = res.rows.map(v=>{
  200. v.active = 1
  201. return v
  202. });
  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>