laboratoryStatistics.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <!--实验室统计列表-->
  2. <template>
  3. <div class="laboratoryStatistics">
  4. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true">
  5. <el-form-item label="" prop="deptId" label-width="50px">
  6. <el-select v-model="queryParams.deptId" clearable placeholder="全部">
  7. <el-option
  8. v-for="item in deptSelectList"
  9. :key="item.deptId"
  10. :label="item.deptName"
  11. :value="item.deptId">
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="" prop="typeId">
  16. <el-select v-model="queryParams.typeId" clearable placeholder="安全分类" style="width: 120px">
  17. <el-option
  18. v-for="item in classTypeList"
  19. :key="item.id"
  20. :label="item.typeName"
  21. :value="item.id">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="" prop="level">
  26. <el-select v-model="queryParams.level" clearable placeholder="安全分级" style="width: 120px">
  27. <el-option
  28. v-for="item in classifiedList"
  29. :key="item.id"
  30. :label="item.classifiedName"
  31. :value="item.id">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="" prop="searchValue" label-width="80px">
  36. <el-input
  37. maxLength="30"
  38. v-model="queryParams.searchValue"
  39. placeholder="实验室/房间号"
  40. clearable
  41. style="width: 200px"/>
  42. </el-form-item>
  43. <!--<el-form-item label="" prop="dateRange" label-width="70px">-->
  44. <!--<el-date-picker-->
  45. <!--:clearable="false"-->
  46. <!--v-model="dateRange"-->
  47. <!--size="small"-->
  48. <!--style="width: 240px"-->
  49. <!--value-format="yyyy-MM-dd"-->
  50. <!--type="daterange"-->
  51. <!--range-separator="-"-->
  52. <!--start-placeholder="开始日期"-->
  53. <!--end-placeholder="结束日期"-->
  54. <!--&gt;</el-date-picker>-->
  55. <!--</el-form-item>-->
  56. <el-form-item>
  57. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  58. <p class="reset-button-one" @click="resetQuery">重置</p>
  59. </el-form-item>
  60. <el-form-item style="float: right;" v-hasPermi="['safety:dataSub:export']">
  61. <el-dropdown @command="exportButton">
  62. <div class="form-dropdown-box">
  63. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
  64. <p>导出</p>
  65. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  66. </div>
  67. <el-dropdown-menu slot="dropdown">
  68. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
  69. <el-dropdown-item style="margin:0 10px;color:#333;" :command="{command:2}">导出选中数据</el-dropdown-item>
  70. </el-dropdown-menu>
  71. </el-dropdown>
  72. </el-form-item>
  73. </el-form>
  74. <div class="num-data-box">
  75. 搜索到实验室总数 {{numData.sumTotal}},存在危险源的实验室数 {{numData.hazardSubjectTotal}},危险源总数 {{numData.hazardTotal}}<span v-for="item in numData.classListVo">,{{item.levelName}} {{item.amount}}</span>
  76. </div>
  77. <el-table border :data="tableList" ref="multipleTable"
  78. tooltip-effect="dark" :row-key="getRowKeys"
  79. @select="select" @select-all="selectAll">
  80. <el-table-column type="selection" width="50" align="center" fixed/>
  81. <el-table-column label="序号" align="center" type="index" width="60" fixed/>
  82. <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="200" fixed/>
  83. <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip width="180" fixed/>
  84. <el-table-column label="房间号" align="center" prop="roomNumber" show-overflow-tooltip width="100"/>
  85. <el-table-column label="楼栋" align="center" prop="buildName" show-overflow-tooltip width="180"/>
  86. <el-table-column label="安全分类" align="center" prop="typeName" show-overflow-tooltip width="100"/>
  87. <el-table-column label="安全分级" align="center" prop="levelName" show-overflow-tooltip width="100"/>
  88. <el-table-column label="危险源" align="center" prop="hazardName" show-overflow-tooltip width="260"/>
  89. <el-table-column label="实验室安全责任人" align="center" prop="safeUserNameAdminPhone" show-overflow-tooltip width="185"/>
  90. <el-table-column label="实验室负责人" align="center" prop="adminNameAndPhone" show-overflow-tooltip width="180"/>
  91. <el-table-column label="隐患总数" align="center" prop="dangerNum" show-overflow-tooltip width="100"/>
  92. <el-table-column label="整改率" align="center" prop="percent" show-overflow-tooltip width="100"/>
  93. <el-table-column label="复核通过率" align="center" prop="percent2" show-overflow-tooltip width="100"/>
  94. </el-table>
  95. <pagination :page-sizes="[20, 30, 40, 50]"
  96. v-show="total>0"
  97. :total="total"
  98. :page.sync="queryParams.pageNum"
  99. :limit.sync="queryParams.pageSize"
  100. @pagination="getList"
  101. />
  102. </div>
  103. </template>
  104. <script>
  105. import { listDepartments } from "@/api/system/dept";
  106. import { listClassifiedAll } from "@/api/laboratory/classified";
  107. import { listClasstypeAll } from "@/api/laboratory/classtype";
  108. import { dataStatisticsSubList,dataStatisticsSubListTop } from "@/api/safetyCheck/index";
  109. export default {
  110. name: 'laboratoryStatistics',
  111. data(){
  112. return{
  113. deptSelectList:[],
  114. classTypeList:[],
  115. classifiedList:[],
  116. dateRange:[],
  117. queryParams:{
  118. pageNum:1,
  119. pageSize:20,
  120. searchValue:"",
  121. deptId:"",
  122. typeId:"",
  123. level:""
  124. },
  125. setChildren:"",
  126. numData:{},
  127. tableList:[],
  128. total:0,
  129. }
  130. },
  131. created(){
  132. },
  133. mounted(){
  134. this.initializationInterface();
  135. this.getList();
  136. },
  137. methods:{
  138. initializationInterface(){
  139. //获取学院列表
  140. listDepartments().then(response => {
  141. this.deptSelectList = response.data;
  142. });
  143. /**获取分级*/
  144. listClassifiedAll().then(response=>{
  145. this.classifiedList = response.data
  146. })
  147. /**获取分类*/
  148. listClasstypeAll().then(response=>{
  149. this.classTypeList = response.data;
  150. });
  151. },
  152. //获取数据列表
  153. getList(){
  154. let obj = JSON.parse(JSON.stringify(this.queryParams))
  155. if(this.dateRange[0]){
  156. obj.beginTime = this.dateRange[0];
  157. }else{
  158. obj.beginTime = "";
  159. }
  160. if(this.dateRange[1]){
  161. obj.endTime = this.dateRange[1];
  162. }else{
  163. obj.endTime = "";
  164. }
  165. dataStatisticsSubList(obj).then(response => {
  166. this.total = response.data.total;
  167. this.tableList = response.data.records;
  168. });
  169. dataStatisticsSubListTop(obj).then(response => {
  170. this.$set(this,'numData',response.data);
  171. });
  172. },
  173. /** 搜索按钮操作 */
  174. handleQuery() {
  175. this.$set(this.queryParams,'pageNum',1);
  176. this.getList();
  177. },
  178. /** 重置按钮操作 */
  179. resetQuery() {
  180. this.$set(this,'dateRange',[]);
  181. this.$set(this,'queryParams',{
  182. pageNum:1,
  183. pageSize:20,
  184. searchValue:"",
  185. deptId:"",
  186. typeId:"",
  187. level:""
  188. });
  189. this.handleQuery();
  190. },
  191. /** 导出按钮操作 */
  192. exportButton(item) {
  193. let self = this;
  194. if(item.command == 1){
  195. self.$confirm(`确认导出全部数据?`, "提示", {
  196. confirmButtonText: "确定",
  197. cancelButtonText: "取消",
  198. type: "warning"
  199. }).then(async () => {
  200. self.download('/zd-security/DataStatistics/subExport/', {}, '实验室统计-.xlsx')
  201. }).catch(() => {})
  202. }else if(item.command == 2){
  203. let list = self.$refs.multipleTable.selection;
  204. let ids = [];
  205. for(let i=0;i<list.length;i++){
  206. ids.push(list[i].subId)
  207. }
  208. console.log('list',list);
  209. console.log('ids',ids);
  210. if(ids.length>0) {
  211. self.$confirm(`确认导出选中数据?`, "提示", {
  212. confirmButtonText: "确定",
  213. cancelButtonText: "取消",
  214. type: "warning"
  215. }).then(async () => {
  216. self.download(`/zd-security/DataStatistics/subExport/?ids=`+ids,{}, '实验室统计.xlsx')
  217. this.$refs.multipleTable.clearSelection();
  218. }).catch(() => {})
  219. }else {
  220. this.msgError('请选择要导出的数据')
  221. }
  222. }
  223. },
  224. /*===记录勾选数据===
  225. 需要再el-table 添加 :row-key="getRowKeys"
  226. 需要在selection 添加 :reserve-selection="true"
  227. */
  228. getRowKeys(row) {
  229. return row.id
  230. },
  231. // 单选
  232. select (selection, row) {
  233. console.log('selection',selection)
  234. console.log('row',row)
  235. if (selection.some(el => { return row.id === el.id })) {
  236. if (row.children) {
  237. this.setChildren(row.children, true)
  238. }
  239. } else {
  240. if (row.children) {
  241. this.setChildren(row.children, false)
  242. }
  243. }
  244. },
  245. // 全选
  246. selectAll (selection) {
  247. const isSelect = selection.some(el => {
  248. const tableDataIds = this.tableData.map(j => j.id)
  249. return tableDataIds.includes(el.id)
  250. })
  251. const isCancel = !this.tableData.every(el => {
  252. const selectIds = selection.map(j => j.id)
  253. return selectIds.includes(el.id)
  254. })
  255. if (isSelect) {
  256. selection.map(el => {
  257. if (el.children) {
  258. this.setChildren(el.children, true)
  259. }
  260. })
  261. }
  262. if (isCancel) {
  263. this.tableData.map(el => {
  264. if (el.children) {
  265. this.setChildren(el.children, false)
  266. }
  267. })
  268. }
  269. },
  270. }
  271. }
  272. </script>
  273. <style scoped lang="scss">
  274. ::v-deep .el-table__body-wrapper{
  275. padding-bottom: 8px;
  276. }
  277. ::v-deep .el-table__fixed{
  278. margin-top:-1px;
  279. margin-left:-1px;
  280. height:calc(100% - 8px)!important;
  281. }
  282. ::v-deep .el-table__fixed-body-wrapper{
  283. height: calc(100% - 48px);
  284. overflow-y: auto;
  285. }
  286. .laboratoryStatistics{
  287. flex:1;
  288. display: flex;
  289. flex-direction: column;
  290. overflow: hidden;
  291. padding:20px;
  292. .form-box{
  293. .form-dropdown-box{
  294. display: flex;
  295. margin:0;
  296. padding:0 10px;
  297. cursor: pointer;
  298. height:40px;
  299. img:nth-child(1){
  300. width:16px;
  301. height:16px;
  302. margin-top:12px;
  303. }
  304. p{
  305. width:47px;
  306. text-align: center;
  307. font-size:14px;
  308. margin:0;
  309. line-height:40px;
  310. }
  311. img:nth-child(3){
  312. width:10px;
  313. height:6px;
  314. margin-top:17px;
  315. }
  316. }
  317. }
  318. .num-data-box{
  319. background: rgba(1,131,250,0.2);
  320. color:#0183FA;
  321. font-size:14px;
  322. line-height:40px;
  323. padding:0 20px;
  324. border-radius:4px;
  325. margin-bottom:20px;
  326. }
  327. }
  328. </style>