checkIndexStatistics.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <div class="checkIndexStatistics">
  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="searchValue" label-width="80px">
  15. <el-input
  16. maxLength="30"
  17. v-model="queryParams.searchValue"
  18. placeholder="计划任务"
  19. clearable
  20. style="width: 200px"/>
  21. </el-form-item>
  22. <el-form-item label="" prop="dateRange" label-width="70px">
  23. <el-date-picker
  24. :clearable="false"
  25. v-model="dateRange"
  26. size="small"
  27. style="width: 240px"
  28. value-format="yyyy-MM-dd"
  29. type="daterange"
  30. range-separator="-"
  31. start-placeholder="开始日期"
  32. end-placeholder="结束日期"
  33. ></el-date-picker>
  34. </el-form-item>
  35. <el-form-item>
  36. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  37. <p class="reset-button-one" @click="resetQuery">重置</p>
  38. </el-form-item>
  39. <el-form-item style="float: right;">
  40. <el-dropdown @command="exportButton">
  41. <div class="form-dropdown-box">
  42. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
  43. <p>导出</p>
  44. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  45. </div>
  46. <el-dropdown-menu slot="dropdown">
  47. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
  48. <el-dropdown-item style="margin:0 10px;color:#333;" :command="{command:2}">导出选中数据</el-dropdown-item>
  49. </el-dropdown-menu>
  50. </el-dropdown>
  51. </el-form-item>
  52. </el-form>
  53. <div class="num-data-box">
  54. 共搜索到隐患总数 {{numData.sumTotal}},一级指标隐患总数 {{numData.level1}},占比 {{numData.percent1}},二级指标隐患总数 {{numData.level2}},占比 {{numData.percent2}},三级指标隐患总数 {{numData.level3}},占比 {{numData.percent3}}
  55. </div>
  56. <el-table border :data="tableList" ref="multipleTable"
  57. :row-key="getRowKeys"
  58. @select="select" @select-all="selectAll">
  59. <el-table-column type="selection" width="50" align="center"/>
  60. <el-table-column label="序号" align="center" type="index" width="60" />
  61. <el-table-column label="计划任务" align="center" prop="title" show-overflow-tooltip/>
  62. <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="230"/>
  63. <el-table-column label="隐患总数" align="center" prop="sumTotal" show-overflow-tooltip width="120"/>
  64. <el-table-column label="一级指标隐患数" align="center" prop="schoolItemsTotal1" show-overflow-tooltip width="130"/>
  65. <el-table-column label="一级指标占比" align="center" prop="percent" show-overflow-tooltip width="130"/>
  66. <el-table-column label="二级指标隐患数" align="center" prop="schoolItemsTotal2" show-overflow-tooltip width="130"/>
  67. <el-table-column label="二级指标占比" align="center" prop="percent2" show-overflow-tooltip width="130"/>
  68. <el-table-column label="三级指标隐患数" align="center" prop="schoolItemsTotal3" show-overflow-tooltip width="130"/>
  69. <el-table-column label="三级指标占比" align="center" prop="percent3" show-overflow-tooltip width="130"/>
  70. </el-table>
  71. <pagination :page-sizes="[20, 30, 40, 50]"
  72. v-show="total>0"
  73. :total="total"
  74. :page.sync="queryParams.pageNum"
  75. :limit.sync="queryParams.pageSize"
  76. @pagination="getList"
  77. />
  78. </div>
  79. </template>
  80. <script>
  81. import { listDepartments } from "@/api/system/dept";
  82. import { dataStatisticsItemsList,dataStatisticsItemsListTop } from "@/api/safetyCheck/index";
  83. export default {
  84. name: 'checkIndexStatistics',
  85. data(){
  86. return{
  87. deptSelectList:[],
  88. classTypeList:[],
  89. classifiedList:[],
  90. dateRange:[],
  91. queryParams:{
  92. pageNum:1,
  93. pageSize:20,
  94. searchValue:"",
  95. deptId:""
  96. },
  97. setChildren:"",
  98. numData:{},
  99. tableList:[{}],
  100. total:0,
  101. currentDate:'',
  102. }
  103. },
  104. created(){
  105. },
  106. mounted(){
  107. this.initializationInterface();
  108. this.getList();
  109. },
  110. methods:{
  111. initializationInterface(){
  112. //获取学院列表
  113. listDepartments().then(response => {
  114. this.deptSelectList = response.data;
  115. });
  116. },
  117. //获取数据列表
  118. getList(){
  119. let obj = JSON.parse(JSON.stringify(this.queryParams))
  120. if(this.dateRange[0]){
  121. obj.beginTime = this.dateRange[0];
  122. }else{
  123. obj.beginTime = "";
  124. }
  125. if(this.dateRange[1]){
  126. obj.endTime = this.dateRange[1];
  127. }else{
  128. obj.endTime = "";
  129. }
  130. dataStatisticsItemsList(obj).then(response => {
  131. this.total = response.total;
  132. this.tableList = response.rows;
  133. });
  134. dataStatisticsItemsListTop(obj).then(response => {
  135. this.$set(this,'numData',response.data);
  136. });
  137. },
  138. /** 搜索按钮操作 */
  139. handleQuery() {
  140. this.$set(this.queryParams,'pageNum',1);
  141. this.getList();
  142. },
  143. /** 重置按钮操作 */
  144. resetQuery() {
  145. this.$set(this,'dateRange',[]);
  146. this.$set(this,'queryParams',{
  147. pageNum:1,
  148. pageSize:20,
  149. searchValue:"",
  150. deptId:""
  151. });
  152. this.handleQuery();
  153. },
  154. /** 当前时间 */
  155. getCurrentTime () {
  156. const yy = new Date().getFullYear()
  157. const mm = new Date().getMonth() + 1
  158. const dd = new Date().getDate()
  159. const hh = new Date().getHours()
  160. const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
  161. const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
  162. return yy + '-' + mm + '-' + dd
  163. },
  164. /** 导出按钮操作 */
  165. exportButton(item) {
  166. let self = this;
  167. this.currentDate=this.getCurrentTime()
  168. if(item.command == 1){
  169. self.$confirm(`确认导出全部数据?`, "提示", {
  170. confirmButtonText: "确定",
  171. cancelButtonText: "取消",
  172. type: "warning"
  173. }).then(async () => {
  174. self.download('/system/user/teacher/export/', {...self.queryParams}, '教职工信息-'+this.currentDate+'.xlsx')
  175. }).catch(() => {})
  176. }else if(item.command == 2){
  177. if(self.ids.length>0) {
  178. self.$confirm(`确认导出选中数据?`, "提示", {
  179. confirmButtonText: "确定",
  180. cancelButtonText: "取消",
  181. type: "warning"
  182. }).then(async () => {
  183. let ids = self.ids.join(',');
  184. let obj = {
  185. ids :ids
  186. }
  187. self.download(`/system/user/teacher/export/`,obj, '教职工信息-'+this.currentDate+'.xlsx')
  188. }).catch(() => {})
  189. }else {
  190. Message({
  191. message: "请选择要导出的数据",
  192. type: 'error'
  193. });
  194. }
  195. }
  196. },
  197. /*===记录勾选数据===
  198. 需要再el-table 添加 :row-key="getRowKeys"
  199. 需要在selection 添加 :reserve-selection="true"
  200. */
  201. getRowKeys(row) {
  202. return row.id
  203. },
  204. // 单选
  205. select (selection, row) {
  206. if (selection.some(el => { return row.id === el.id })) {
  207. if (row.children) {
  208. this.setChildren(row.children, true)
  209. }
  210. } else {
  211. if (row.children) {
  212. this.setChildren(row.children, false)
  213. }
  214. }
  215. },
  216. // 全选
  217. selectAll (selection) {
  218. const isSelect = selection.some(el => {
  219. const tableDataIds = this.tableData.map(j => j.id)
  220. return tableDataIds.includes(el.id)
  221. })
  222. const isCancel = !this.tableData.every(el => {
  223. const selectIds = selection.map(j => j.id)
  224. return selectIds.includes(el.id)
  225. })
  226. if (isSelect) {
  227. selection.map(el => {
  228. if (el.children) {
  229. this.setChildren(el.children, true)
  230. }
  231. })
  232. }
  233. if (isCancel) {
  234. this.tableData.map(el => {
  235. if (el.children) {
  236. this.setChildren(el.children, false)
  237. }
  238. })
  239. }
  240. },
  241. }
  242. }
  243. </script>
  244. <style scoped lang="scss">
  245. .checkIndexStatistics{
  246. flex:1;
  247. display: flex;
  248. flex-direction: column;
  249. overflow: hidden;
  250. padding:20px;
  251. .form-box{
  252. .form-dropdown-box{
  253. display: flex;
  254. margin:0;
  255. padding:0 10px;
  256. cursor: pointer;
  257. height:40px;
  258. img:nth-child(1){
  259. width:16px;
  260. height:16px;
  261. margin-top:12px;
  262. }
  263. p{
  264. width:47px;
  265. text-align: center;
  266. font-size:14px;
  267. margin:0;
  268. line-height:40px;
  269. }
  270. img:nth-child(3){
  271. width:10px;
  272. height:6px;
  273. margin-top:17px;
  274. }
  275. }
  276. }
  277. .num-data-box{
  278. background: rgba(1,131,250,0.2);
  279. color:#0183FA;
  280. font-size:14px;
  281. line-height:40px;
  282. padding:0 20px;
  283. border-radius:4px;
  284. margin-bottom:20px;
  285. }
  286. }
  287. </style>