index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="app-container rectificationReport">
  3. <div class="title-box">
  4. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true" label-width="80px">
  5. <el-form-item label="关键字" prop="searchValue">
  6. <el-input
  7. maxLength="30"
  8. v-model="queryParams.searchValue"
  9. placeholder="计划任务/实验室/房间号"
  10. clearable
  11. style="width: 200px"
  12. />
  13. </el-form-item>
  14. <el-form-item label="学院" prop="deptId" label-width="50px">
  15. <el-select v-model="queryParams.deptId" clearable placeholder="学院" style="width: 150px">
  16. <el-option
  17. v-for="item in deptSelectList"
  18. :key="item.deptId"
  19. :label="item.deptName"
  20. :value="item.deptId">
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="检查时间" prop="dateRange" style="margin-left:10px;" label-width="70px">
  25. <el-date-picker
  26. :clearable="false"
  27. v-model="dateRange"
  28. size="small"
  29. style="width: 240px"
  30. value-format="yyyy-MM-dd"
  31. type="daterange"
  32. range-separator="-"
  33. start-placeholder="开始日期"
  34. end-placeholder="结束日期"
  35. ></el-date-picker>
  36. </el-form-item>
  37. <el-form-item>
  38. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  39. <p class="reset-button-one" @click="resetQuery">重置</p>
  40. </el-form-item>
  41. <el-form-item style="float: right;">
  42. <el-col :span="1.5">
  43. <p class="inquire-button-one"
  44. style="width:100px;"
  45. @click="allDownload"
  46. >批量下载</p>
  47. </el-col>
  48. </el-form-item>
  49. </el-form>
  50. </div>
  51. <div class="content-box">
  52. <el-table border :data="tableList" ref="multipleTable" @selection-change="handleSelectionChange" :row-key="getRowKeys">
  53. <el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
  54. <el-table-column label="序号" align="center" type="index" width="50" />
  55. <el-table-column label="计划任务" align="center" prop="title" show-overflow-tooltip/>
  56. <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="160"/>
  57. <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip width="160"/>
  58. <el-table-column label="房间号" align="center" prop="roomNumber" show-overflow-tooltip width="80"/>
  59. <el-table-column label="楼栋" align="center" prop="buildName" show-overflow-tooltip width="100"/>
  60. <el-table-column label="隐患数" align="center" prop="hazardCount" show-overflow-tooltip width="80"/>
  61. <el-table-column label="计划周期" align="center" prop="cycleTime" show-overflow-tooltip width="200"/>
  62. <el-table-column label="检查者" align="center" prop="checkUser" show-overflow-tooltip width="80"/>
  63. <el-table-column label="检查时间" align="center" prop="checkTime" show-overflow-tooltip width="120"/>
  64. <el-table-column label="操作" align="center" prop="deptName" width="200">
  65. <template slot-scope="scope">
  66. <div class="table-button-box">
  67. <p class="table-button-p" @click="addDialogOpen(true)">检查详情</p>
  68. <p class="table-button-p" @click="lookDocumentButton(1,scope.row)">查看</p>
  69. <p class="table-button-p" @click="downloadButton(scope.row)">下载</p>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <pagination :page-sizes="[20, 30, 40, 50]"
  75. v-show="total>0"
  76. :total="total"
  77. :page.sync="queryParams.pageNum"
  78. :limit.sync="queryParams.pageSize"
  79. @pagination="getList"
  80. />
  81. </div>
  82. <infoDialog v-if="infoDialogType"></infoDialog>
  83. <lookDocumentDialog v-if="lookDocumentType" :propsLookDocumentData="propsLookDocumentData"></lookDocumentDialog>
  84. </div>
  85. </template>
  86. <script>
  87. import { listDepartments } from "@/api/system/dept";
  88. import { checkRectifyList,genReport,genReportZip } from '@/api/safetyCheck/index'
  89. import infoDialog from '@/views/safetyCheck/components/infoDialog/infoDialog.vue'
  90. import lookDocumentDialog from '@/components/lookDocumentDialog/lookDocumentDialog.vue'
  91. export default {
  92. name: 'index',
  93. components: {
  94. infoDialog,
  95. lookDocumentDialog
  96. },
  97. data(){
  98. return{
  99. //子组件数据
  100. infoDialogType:false,
  101. lookDocumentType:false,
  102. propsLookDocumentData:{},
  103. deptSelectList:[],
  104. queryParams:{
  105. pageNum:1,
  106. pageSize:20,
  107. deptId:'',
  108. searchValue:'',
  109. },
  110. dateRange:[],
  111. tableList:[{
  112. name:"我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容",
  113. url:"statics/bigFile/2023022011/f23a32c8-bf8e-40b5-9e52-04cf73fc6037.docx",},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},],
  114. total:0,
  115. selectedNum:0,
  116. ids:[],
  117. }
  118. },
  119. created(){
  120. },
  121. mounted(){
  122. this.listDepartments();
  123. this.getList();
  124. },
  125. methods:{
  126. // 批量下载
  127. allDownload(){
  128. let self = this;
  129. if(!this.ids[0]){
  130. this.msgError('请先勾选数据')
  131. return
  132. }
  133. this.$confirm('是否批量下载?', "警告", {
  134. confirmButtonText: "确定",
  135. cancelButtonText: "取消",
  136. type: "warning"
  137. }).then(function() {
  138. let text = self.ids+'';
  139. self.download('/zd-security/checkRectify/genReport/zip/'+text, {}, '批量报告下载.zip')
  140. }).then(() => {
  141. }).catch(() => {});
  142. },
  143. // 单个下载按钮
  144. downloadButton(row){
  145. this.download('/zd-security/checkRectify/genReport/'+row.id, {}, row.title+'.docx')
  146. },
  147. //开关详情页面
  148. addDialogOpen(type,data){
  149. if(this.infoDialogType != type){
  150. this.$set(this,'infoDialogType',type);
  151. }
  152. },
  153. //查看单个文档
  154. lookDocumentButton(type,row){
  155. if(type==1){
  156. this.$set(this,'propsLookDocumentData',{
  157. title:"整改报告",
  158. name:row.name,
  159. url:row.url
  160. });
  161. this.$set(this,'lookDocumentType',true);
  162. }else{
  163. this.$set(this,'lookDocumentType',false);
  164. }
  165. },
  166. //获取数据列表
  167. getList(){
  168. let obj = JSON.parse(JSON.stringify(this.queryParams))
  169. if(this.dateRange[0]){
  170. obj.beginTime = this.dateRange[0]
  171. }else{
  172. obj.beginTime = ""
  173. }
  174. if(this.dateRange[1]){
  175. obj.endTime = this.dateRange[1]
  176. }else{
  177. obj.endTime = ""
  178. }
  179. checkRectifyList(obj).then(response => {
  180. this.total = response.total;
  181. this.tableList = response.rows;
  182. });
  183. },
  184. /** 搜索按钮操作 */
  185. handleQuery() {
  186. this.$set(this.queryParams,'pageNum',1);
  187. this.getList();
  188. },
  189. /** 重置按钮操作 */
  190. resetQuery() {
  191. this.$set(this,'dateRange',[]);
  192. this.$set(this,'queryParams',{
  193. pageNum:1,
  194. pageSize:20,
  195. deptId:'',
  196. searchValue:'',
  197. });
  198. this.handleQuery();
  199. },
  200. /*===记录勾选数据===
  201. 需要再el-table 添加 :row-key="getRowKeys"
  202. 需要在selection 添加 :reserve-selection="true"
  203. */
  204. getRowKeys(row) {
  205. return row.id
  206. },
  207. // 多选框选中数据
  208. handleSelectionChange(selection) {
  209. this.selectedNum = selection.length;
  210. this.ids = selection.map(item => item.id)
  211. },
  212. //获取学院列表
  213. listDepartments(){
  214. listDepartments().then(response => {
  215. this.deptSelectList = response.data;
  216. });
  217. },
  218. },
  219. }
  220. </script>
  221. <style scoped lang="scss">
  222. .rectificationReport{
  223. flex: 1;
  224. display: flex !important;
  225. flex-direction: column;
  226. overflow: hidden;
  227. .title-box{
  228. padding-top:20px;
  229. .form-button-max-big-box{
  230. display: inline-block;
  231. .form-button-big-box{
  232. display: flex;
  233. div{
  234. position: relative;
  235. height:40px;
  236. width:100px;
  237. line-height: 40px;
  238. text-align: center;
  239. color:#0045AF;
  240. font-size:14px;
  241. border:1px solid #0045AF;
  242. border-radius:4px;
  243. margin-left:10px;
  244. font-weight:500;
  245. cursor: pointer;
  246. }
  247. .checkDiv{
  248. color:#fff;
  249. background-color:#0045AF;
  250. border:1px solid #0045AF;
  251. }
  252. }
  253. }
  254. }
  255. .content-box{
  256. flex: 1;
  257. display: flex;
  258. flex-direction: column;
  259. padding:0 20px 20px;
  260. overflow: hidden;
  261. }
  262. }
  263. </style>