laboratoryStatistics.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="laboratoryStatistics">
  3. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true">
  4. <el-form-item label="" prop="deptId" label-width="50px">
  5. <el-select v-model="queryParams.deptId" clearable placeholder="全部">
  6. <el-option
  7. v-for="item in deptSelectList"
  8. :key="item.deptId"
  9. :label="item.deptName"
  10. :value="item.deptId">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="" prop="typeId">
  15. <el-select v-model="queryParams.typeId" clearable placeholder="安全分类" style="width: 120px">
  16. <el-option
  17. v-for="item in classTypeList"
  18. :key="item.id"
  19. :label="item.typeName"
  20. :value="item.id">
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="" prop="level">
  25. <el-select v-model="queryParams.level" clearable placeholder="安全分级" style="width: 120px">
  26. <el-option
  27. v-for="item in classifiedList"
  28. :key="item.id"
  29. :label="item.classifiedName"
  30. :value="item.id">
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="" prop="searchValue" label-width="80px">
  35. <el-input
  36. maxLength="30"
  37. v-model="queryParams.searchValue"
  38. placeholder="实验室/房间号"
  39. clearable
  40. style="width: 200px"/>
  41. </el-form-item>
  42. <el-form-item label="" prop="dateRange" label-width="70px">
  43. <el-date-picker
  44. :clearable="false"
  45. v-model="dateRange"
  46. size="small"
  47. style="width: 240px"
  48. value-format="yyyy-MM-dd"
  49. type="daterange"
  50. range-separator="-"
  51. start-placeholder="开始日期"
  52. end-placeholder="结束日期"
  53. ></el-date-picker>
  54. </el-form-item>
  55. <el-form-item>
  56. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  57. <p class="reset-button-one" @click="resetQuery">重置</p>
  58. </el-form-item>
  59. <el-form-item style="float: right;">
  60. <el-dropdown @command="exportButton">
  61. <div class="form-dropdown-box">
  62. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
  63. <p>导出</p>
  64. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  65. </div>
  66. <el-dropdown-menu slot="dropdown">
  67. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
  68. <el-dropdown-item style="margin:0 10px;color:#333;" :command="{command:2}">导出选中数据</el-dropdown-item>
  69. </el-dropdown-menu>
  70. </el-dropdown>
  71. </el-form-item>
  72. </el-form>
  73. <div class="num-data-box">
  74. 搜索到实验室总数 {{numData.sumTotal}},存在危险源的实验室数 {{numData.hazardSubjectTotal}},危险源总数 {{numData.hazardTotal}},特种设备安全类 {{numData.specialTotal}}<span v-for="item in numData.classListVo">,{{item.levelName}} {{item.amount}}</span>
  75. </div>
  76. <el-table border :data="tableList" ref="multipleTable"
  77. :row-key="getRowKeys"
  78. @select="select" @select-all="selectAll">
  79. <el-table-column type="selection" width="50" align="center"/>
  80. <el-table-column label="序号" align="center" type="index" width="60" />
  81. <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="200"/>
  82. <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip width="180"/>
  83. <el-table-column label="房间号" align="center" prop="roomNumber" show-overflow-tooltip width="100"/>
  84. <el-table-column label="楼栋" align="center" prop="buildName" show-overflow-tooltip width="180"/>
  85. <el-table-column label="安全分类" align="center" prop="typeName" show-overflow-tooltip width="100"/>
  86. <el-table-column label="安全分级" align="center" prop="levelName" show-overflow-tooltip width="100"/>
  87. <el-table-column label="危险源" align="center" prop="hazardName" show-overflow-tooltip width="260"/>
  88. <el-table-column label="实验室安全责任人" align="center" prop="safeUserNameAdminPhone" show-overflow-tooltip width="185"/>
  89. <el-table-column label="实验室负责人" align="center" prop="adminNameAndPhone" show-overflow-tooltip width="180"/>
  90. <el-table-column label="隐患总数" align="center" prop="dangerNum" show-overflow-tooltip width="100"/>
  91. <el-table-column label="整改率" align="center" prop="percent" show-overflow-tooltip width="100"/>
  92. <el-table-column label="复核通过率" align="center" prop="percent2" show-overflow-tooltip width="100"/>
  93. </el-table>
  94. <pagination :page-sizes="[20, 30, 40, 50]"
  95. v-show="total>0"
  96. :total="total"
  97. :page.sync="queryParams.pageNum"
  98. :limit.sync="queryParams.pageSize"
  99. @pagination="getList"
  100. />
  101. </div>
  102. </template>
  103. <script>
  104. import { listDepartments } from "@/api/system/dept";
  105. import { listClassifiedAll } from "@/api/laboratory/classified";
  106. import { listClasstypeAll } from "@/api/laboratory/classtype";
  107. import { dataStatisticsSubList,dataStatisticsSubListTop } from "@/api/safetyCheck/index";
  108. export default {
  109. name: 'laboratoryStatistics',
  110. data(){
  111. return{
  112. deptSelectList:[],
  113. classTypeList:[],
  114. classifiedList:[],
  115. dateRange:[],
  116. queryParams:{
  117. pageNum:1,
  118. pageSize:20,
  119. searchValue:"",
  120. deptId:"",
  121. typeId:"",
  122. level:""
  123. },
  124. setChildren:"",
  125. numData:{},
  126. tableList:[],
  127. total:0,
  128. currentDate:'',
  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.total;
  167. this.tableList = response.rows;
  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. getCurrentTime () {
  193. const yy = new Date().getFullYear()
  194. const mm = new Date().getMonth() + 1
  195. const dd = new Date().getDate()
  196. const hh = new Date().getHours()
  197. const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
  198. const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
  199. return yy + '-' + mm + '-' + dd
  200. },
  201. /** 导出按钮操作 */
  202. exportButton(item) {
  203. let self = this;
  204. this.currentDate=this.getCurrentTime()
  205. if(item.command == 1){
  206. self.$confirm(`确认导出全部数据?`, "提示", {
  207. confirmButtonText: "确定",
  208. cancelButtonText: "取消",
  209. type: "warning"
  210. }).then(async () => {
  211. self.download('/system/user/teacher/export/', {...self.queryParams}, '教职工信息-'+this.currentDate+'.xlsx')
  212. }).catch(() => {})
  213. }else if(item.command == 2){
  214. if(self.ids.length>0) {
  215. self.$confirm(`确认导出选中数据?`, "提示", {
  216. confirmButtonText: "确定",
  217. cancelButtonText: "取消",
  218. type: "warning"
  219. }).then(async () => {
  220. let ids = self.ids.join(',');
  221. let obj = {
  222. ids :ids
  223. }
  224. self.download(`/system/user/teacher/export/`,obj, '教职工信息-'+this.currentDate+'.xlsx')
  225. }).catch(() => {})
  226. }else {
  227. Message({
  228. message: "请选择要导出的数据",
  229. type: 'error'
  230. });
  231. }
  232. }
  233. },
  234. /*===记录勾选数据===
  235. 需要再el-table 添加 :row-key="getRowKeys"
  236. 需要在selection 添加 :reserve-selection="true"
  237. */
  238. getRowKeys(row) {
  239. return row.id
  240. },
  241. // 单选
  242. select (selection, row) {
  243. if (selection.some(el => { return row.id === el.id })) {
  244. if (row.children) {
  245. this.setChildren(row.children, true)
  246. }
  247. } else {
  248. if (row.children) {
  249. this.setChildren(row.children, false)
  250. }
  251. }
  252. },
  253. // 全选
  254. selectAll (selection) {
  255. const isSelect = selection.some(el => {
  256. const tableDataIds = this.tableData.map(j => j.id)
  257. return tableDataIds.includes(el.id)
  258. })
  259. const isCancel = !this.tableData.every(el => {
  260. const selectIds = selection.map(j => j.id)
  261. return selectIds.includes(el.id)
  262. })
  263. if (isSelect) {
  264. selection.map(el => {
  265. if (el.children) {
  266. this.setChildren(el.children, true)
  267. }
  268. })
  269. }
  270. if (isCancel) {
  271. this.tableData.map(el => {
  272. if (el.children) {
  273. this.setChildren(el.children, false)
  274. }
  275. })
  276. }
  277. },
  278. }
  279. }
  280. </script>
  281. <style scoped lang="scss">
  282. .laboratoryStatistics{
  283. flex:1;
  284. display: flex;
  285. flex-direction: column;
  286. overflow: hidden;
  287. padding:20px;
  288. .form-box{
  289. .form-dropdown-box{
  290. display: flex;
  291. margin:0;
  292. padding:0 10px;
  293. cursor: pointer;
  294. height:40px;
  295. img:nth-child(1){
  296. width:16px;
  297. height:16px;
  298. margin-top:12px;
  299. }
  300. p{
  301. width:47px;
  302. text-align: center;
  303. font-size:14px;
  304. margin:0;
  305. line-height:40px;
  306. }
  307. img:nth-child(3){
  308. width:10px;
  309. height:6px;
  310. margin-top:17px;
  311. }
  312. }
  313. }
  314. .num-data-box{
  315. background: rgba(1,131,250,0.2);
  316. color:#0183FA;
  317. font-size:14px;
  318. line-height:40px;
  319. padding:0 20px;
  320. border-radius:4px;
  321. margin-bottom:20px;
  322. }
  323. }
  324. </style>