index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <div class="app-container snapshotManagement">
  3. <div class="snapshotManagement-page" v-if="pageType == 1">
  4. <div class="title-box">
  5. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true" label-width="80px">
  6. <div class="form-button-max-big-box">
  7. <div class="form-button-big-box" style="margin-left:10px;">
  8. <div :class="queryParams.rectifyStatus===''?'checkDiv':''" @click="topLeftClickType('')">
  9. <p class="text-p">全部</p>
  10. <p class="el-icon-check icon-p" v-if="queryParams.rectifyStatus===''"></p>
  11. </div>
  12. <div :class="queryParams.rectifyStatus===0?'checkDiv':''" @click="topLeftClickType(0)">
  13. <p class="text-p">待整改</p>
  14. <p class="el-icon-check icon-p" v-if="queryParams.rectifyStatus===0"></p>
  15. </div>
  16. <div :class="queryParams.rectifyStatus===1?'checkDiv':''" @click="topLeftClickType(1)">
  17. <p class="text-p">已整改</p>
  18. <p class="el-icon-check icon-p" v-if="queryParams.rectifyStatus===1"></p>
  19. </div>
  20. <div :class="queryParams.rectifyStatus===2?'checkDiv':''" @click="topLeftClickType(2)">
  21. <p class="text-p">暂无法整改</p>
  22. <p class="el-icon-check icon-p" v-if="queryParams.rectifyStatus===2"></p>
  23. </div>
  24. </div>
  25. </div>
  26. <el-form-item label="关键字" prop="searchValue">
  27. <el-input
  28. maxLength="30"
  29. v-model="queryParams.searchValue"
  30. placeholder="实验室/房间号/上报人"
  31. clearable
  32. style="width: 180px"/>
  33. </el-form-item>
  34. <el-form-item label="学院" prop="deptId" label-width="50px">
  35. <el-select v-model="queryParams.deptId" clearable placeholder="学院" style="width: 150px">
  36. <el-option
  37. v-for="item in deptSelectList"
  38. :key="item.deptId"
  39. :label="item.deptName"
  40. :value="item.deptId">
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="上报时间" prop="dateRange" style="margin-left:10px;" label-width="70px">
  45. <el-date-picker
  46. :clearable="false"
  47. v-model="dateRange"
  48. size="small"
  49. style="width: 220px"
  50. value-format="yyyy-MM-dd"
  51. type="daterange"
  52. range-separator="-"
  53. start-placeholder="开始日期"
  54. end-placeholder="结束日期"
  55. ></el-date-picker>
  56. </el-form-item>
  57. <el-form-item>
  58. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  59. <p class="reset-button-one" @click="resetQuery">重置</p>
  60. </el-form-item>
  61. <el-form-item style="float: right;" v-hasPermi="['safety:rectifyClap:add']">
  62. <el-col :span="1.5">
  63. <p class="inquire-button-one"
  64. style="width:100px;margin-right:0;"
  65. @click="addButton"
  66. ><i class="el-icon-plus"></i> 随手拍</p>
  67. </el-col>
  68. </el-form-item>
  69. <el-form-item style="float: right;">
  70. <el-col :span="1.5">
  71. <p class="add-button-one-90"
  72. style="width:100px;"
  73. @click="goPage(2)"
  74. >上报记录</p>
  75. </el-col>
  76. </el-form-item>
  77. </el-form>
  78. </div>
  79. <div class="content-box">
  80. <el-table border :data="tableList" ref="multipleTable" @sort-change="sortChange">
  81. <el-table-column label="序号" align="center" type="index" width="60" />
  82. <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip/>
  83. <el-table-column label="实验室" align="center" prop="subName" show-overflow-tooltip width="220"/>
  84. <el-table-column label="安全责任人" align="center" prop="safetyPeople" show-overflow-tooltip width="120"/>
  85. <el-table-column label="上报人" align="center" prop="createName" show-overflow-tooltip width="90"/>
  86. <el-table-column label="上报时间" sortable="custom" align="center" prop="createTime" show-overflow-tooltip width="157"/>
  87. <el-table-column label="隐患描述" align="center" prop="hazardDescribe" show-overflow-tooltip width="280"/>
  88. <el-table-column label="整改人" align="center" prop="rectifyPeople" show-overflow-tooltip width="100"/>
  89. <el-table-column label="整改时间" sortable="custom" align="center" prop="rectifyTime" show-overflow-tooltip width="157"/>
  90. <el-table-column label="整改状态" align="center" prop="rectifyStatus" show-overflow-tooltip width="120">
  91. <template slot-scope="scope">
  92. {{scope.row.rectifyStatus==0?'待整改':(scope.row.rectifyStatus==1?'已整改':(scope.row.rectifyStatus==2?'暂无法整改':''))}}
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="操作" align="center" prop="deptName" width="70">
  96. <template slot-scope="scope">
  97. <div class="table-button-box">
  98. <p class="table-button-null"></p>
  99. <p class="table-button-p" @click="goPage(3,scope.row)" v-hasPermi="['safety:rectifyClap:query']">详情</p>
  100. <p class="table-button-null"></p>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <pagination :page-sizes="[20, 30, 40, 50]"
  106. v-show="total>0"
  107. :total="total"
  108. :page.sync="queryParams.pageNum"
  109. :limit.sync="queryParams.pageSize"
  110. @pagination="getList"/>
  111. </div>
  112. </div>
  113. <listPage v-if="pageType == 2"></listPage>
  114. <infoPage v-if="pageType == 3" :infoPropsData="infoPropsData"></infoPage>
  115. <el-dialog class="safetyHazard-info-dialog-box" @close="outDialog"
  116. v-loading="loading"
  117. title="随手拍上报" :visible.sync="addDialogType" v-if="addDialogType"
  118. width="787px" append-to-body>
  119. <div>
  120. <el-form ref="addDialogForm" :model="addDialogForm" :rules="rules" label-width="140px">
  121. <el-form-item label="学院:" prop="deptId">
  122. <el-select v-model="addDialogForm.deptId" @change="dialogDeptChange" placeholder="请选择学院" style="width:548px;">
  123. <el-option
  124. v-for="item in deptSelectList"
  125. :key="item.deptId"
  126. :label="item.deptName"
  127. :value="item.deptId">
  128. </el-option>
  129. </el-select>
  130. </el-form-item>
  131. <el-form-item label="实验室:" prop="subId">
  132. <el-select
  133. style="width:548px;"
  134. v-model="addDialogForm.subId"
  135. filterable
  136. remote
  137. reserve-keyword
  138. placeholder="搜索选择实验室"
  139. @change="dialogSubChange"
  140. :remote-method="getSelectList"
  141. :loading="dialogLoading">
  142. <el-option
  143. v-for="item in dialogSubList"
  144. :key="item.id"
  145. :label="item.name"
  146. :value="item.id">
  147. </el-option>
  148. </el-select>
  149. </el-form-item>
  150. <el-form-item label="隐患描述:" prop="hazardDescribe">
  151. <el-input
  152. type="textarea"
  153. :autosize="{ minRows: 4, maxRows: 4}"
  154. placeholder="请输入隐患描述"
  155. v-model="addDialogForm.hazardDescribe"
  156. maxlength="100"
  157. resize="none"
  158. show-word-limit
  159. style="width:548px;">
  160. </el-input>
  161. </el-form-item>
  162. <el-form-item label="隐患照片:" prop="imgDtoList">
  163. <div class="snapshotManagement-for-img-box" v-for="(img,imgIndex) in addDialogForm.imgDtoList" :key="imgIndex">
  164. <img class="for-img" :src="img.fileUrl">
  165. <p class="for-del-button el-icon-circle-close" @click="delImg(imgIndex)"></p>
  166. </div>
  167. <el-upload
  168. v-if="addDialogForm.imgDtoList.length<5"
  169. style="display: inline-block;overflow: hidden"
  170. class="avatar-uploader"
  171. :action="uploadImgUrl"
  172. :show-file-list="false"
  173. :on-success="(res)=>handleAvatarSuccess(res)"
  174. :headers="headers"
  175. :before-upload="(res)=>beforeAvatarUpload(res)">
  176. <p class="el-icon-plus up-img-p" style="display: inline-block"></p>
  177. </el-upload>
  178. <p class="dialog-material-text">支持jpg/png/bmp/gif格式,最多上传5张</p>
  179. </el-form-item>
  180. </el-form>
  181. </div>
  182. <div slot="footer" class="dialog-footer dialog-footer-box" style="display: flex">
  183. <p class="dialog-footer-button-null"></p>
  184. <p class="dialog-footer-button-info" @click="outDialog">取消</p>
  185. <p class="dialog-footer-button-primary" @click="upDialogButton">确定</p>
  186. <p class="dialog-footer-button-null"></p>
  187. </div>
  188. </el-dialog>
  189. </div>
  190. </template>
  191. <script>
  192. import { securityCheckClapList,checkClapAdd } from '@/api/safetyCheck/index'
  193. import { getNoAdminSubjectListNopage } from "@/api/laboratory/subject";
  194. import { listDepartments } from "@/api/system/dept";
  195. import listPage from './listPage.vue'
  196. import infoPage from './infoPage.vue'
  197. import { getToken } from "@/utils/auth";
  198. export default {
  199. name: 'index',
  200. components: {
  201. listPage,
  202. infoPage
  203. },
  204. data(){
  205. return{
  206. loading:false,
  207. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  208. headers: {
  209. Authorization: "Bearer " + getToken(),
  210. },
  211. pageType:1,
  212. deptSelectList:[],
  213. queryParams:{
  214. pageNum:1,
  215. pageSize:20,
  216. deptId:'',
  217. searchValue:'',
  218. rectifyStatus:'',
  219. upTimeOrder:"",
  220. zgTimeOrder:"",
  221. },
  222. dateRange:[],
  223. tableList:[{}],
  224. total:0,
  225. //新增窗口
  226. addDialogType:false,
  227. addDialogForm:{
  228. deptId:"",
  229. deptName:"",
  230. subId:"",
  231. subName:"",
  232. hazardDescribe:"",
  233. imgDtoList:[],
  234. },
  235. rules:{
  236. deptId: [
  237. { required: true, message: "请选择学院", trigger: "change" },
  238. ],
  239. subId: [
  240. { required: true, message: "请选择实验室", trigger: "change" },
  241. ],
  242. imgDtoList: [
  243. { required: true, message: "请上传隐患照片", trigger: "change" },
  244. ],
  245. },
  246. dialogDeptOptions:[],
  247. dialogLoading:false,
  248. dialogSubList:[],
  249. dialogSubListData:[],
  250. suffixName:"",
  251. //详情
  252. infoPropsData:{}
  253. }
  254. },
  255. created(){
  256. },
  257. mounted(){
  258. this.listDepartments();
  259. this.getList();
  260. },
  261. methods:{
  262. goPage(type,data){
  263. if(this.pageType != type){
  264. if (type==1){
  265. this.$set(this,'pageType',type);
  266. } else if(type==2){
  267. this.$set(this,'pageType',type);
  268. } else if(type==3){
  269. this.$set(this,'infoPropsData',data);
  270. this.$set(this,'pageType',type);
  271. } else if(type==4){
  272. this.$set(this,'pageType',1);
  273. this.getList();
  274. }
  275. }
  276. },
  277. //范围选择
  278. topLeftClickType(type){
  279. if(this.queryParams.rectifyStatus !== type){
  280. this.$set(this.queryParams,'rectifyStatus',type);
  281. this.getList();
  282. }
  283. },
  284. //时间排序方法
  285. sortChange(val){
  286. if(val.prop == 'rectifyTime'){
  287. this.$set(this.queryParams,'zgTimeOrder',val.order=='ascending'?'1':(val.order=='descending'?'2':''));
  288. this.$set(this.queryParams,'upTimeOrder','');
  289. this.handleQuery();
  290. }else if(val.prop == 'createTime'){
  291. this.$set(this.queryParams,'upTimeOrder',val.order=='ascending'?'1':(val.order=='descending'?'2':''));
  292. this.$set(this.queryParams,'zgTimeOrder','');
  293. this.handleQuery();
  294. }
  295. },
  296. //获取数据列表
  297. getList(){
  298. let obj = JSON.parse(JSON.stringify(this.queryParams))
  299. if(this.dateRange[0]){
  300. obj.beginTime = this.dateRange[0]
  301. }else{
  302. obj.beginTime = ""
  303. }
  304. if(this.dateRange[1]){
  305. obj.endTime = this.dateRange[1]
  306. }else{
  307. obj.endTime = ""
  308. }
  309. securityCheckClapList(obj).then(response => {
  310. this.total = response.data.total;
  311. this.tableList = response.data.records;
  312. });
  313. },
  314. /** 搜索按钮操作 */
  315. handleQuery() {
  316. this.$set(this.queryParams,'pageNum',1);
  317. this.getList();
  318. },
  319. /** 重置按钮操作 */
  320. resetQuery() {
  321. this.$set(this,'dateRange',[]);
  322. this.$set(this,'queryParams',{
  323. pageNum:1,
  324. pageSize:20,
  325. deptId:'',
  326. searchValue:'',
  327. rectifyStatus:'',
  328. upTimeOrder:"",
  329. zgTimeOrder:"",
  330. });
  331. this.handleQuery();
  332. },
  333. /*==========上传相关==========*/
  334. handleAvatarSuccess(res) {
  335. this.$set(this,'loading',false);
  336. if(this.addDialogForm.imgDtoList.length>4){
  337. this.msgError('最多只可上传5张')
  338. return
  339. }
  340. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  341. //判断文件名中是否有逗号和分号
  342. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  343. }else{
  344. this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
  345. return
  346. }
  347. let obj ={
  348. fileName:this.upDataName,
  349. fileUrl:res.data.url,
  350. };
  351. this.addDialogForm.imgDtoList.push(obj);
  352. this.$forceUpdate()
  353. },
  354. beforeAvatarUpload(file) {
  355. if(this.addDialogForm.imgDtoList.length>4){
  356. this.msgError('最多只可上传5张')
  357. return false
  358. }
  359. let type = false;
  360. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif' || file.type == 'image/bmp') {
  361. if(file.size> 2100000){
  362. this.msgError('上传图片大小不能超过2M')
  363. return false
  364. }
  365. this.$set(this,'loading',true);
  366. this.upDataName = file.name;
  367. type = true;
  368. }else{
  369. this.msgError('仅支持jpg/png/bmp/gif格式')
  370. type = false;
  371. }
  372. return type;
  373. },
  374. //删除照片
  375. delImg(imgIndex){
  376. this.addDialogForm.imgDtoList.splice(imgIndex,1);
  377. },
  378. /**************** 新增窗口 ******************/
  379. //提交
  380. upDialogButton(){
  381. this.$refs["addDialogForm"].validate(valid => {
  382. if (valid) {
  383. checkClapAdd(this.addDialogForm).then(response => {
  384. this.msgSuccess(response.msg);
  385. this.outDialog();
  386. this.getList();
  387. });
  388. }
  389. })
  390. },
  391. addButton(){
  392. this.$set(this,'addDialogForm',{
  393. deptId:"",
  394. deptName:"",
  395. subId:"",
  396. subName:"",
  397. hazardDescribe:"",
  398. imgDtoList:[],
  399. });
  400. this.$set(this,'addDialogType',true);
  401. },
  402. outDialog(){
  403. this.$set(this,'addDialogType',false);
  404. },
  405. //选中院系
  406. dialogDeptChange(val){
  407. let self = this;
  408. let obj = {
  409. deptId:val,
  410. }
  411. getNoAdminSubjectListNopage(obj).then(response => {
  412. this.$set(this,'dialogSubListData',response.data);
  413. this.$set(this,'dialogSubList',response.data);
  414. for(let i=0;i<self.deptSelectList.length;i++){
  415. if(val == self.deptSelectList[i].deptId){
  416. self.$set(self.addDialogForm,'deptName',self.deptSelectList[i].deptName);
  417. }
  418. }
  419. this.$set(this.addDialogForm,'subId','');
  420. this.$set(this.addDialogForm,'subName','');
  421. });
  422. },
  423. //实验室选中
  424. dialogSubChange(val){
  425. let self = this;
  426. for(let i=0;i<self.dialogSubList.length;i++){
  427. if(val == self.dialogSubList[i].id){
  428. self.$set(self.addDialogForm,'subName',self.dialogSubList[i].name);
  429. }
  430. }
  431. },
  432. /** 实验室-本地懒加载 */
  433. getSelectList(val) {
  434. let self = this;
  435. let list = [];
  436. for(let i=0;i<self.dialogSubListData.length;i++){
  437. if(self.dialogSubListData[i].name.indexOf(val) != -1){
  438. list.push(self.dialogSubListData[i]);
  439. }
  440. }
  441. this.dialogSubList = JSON.parse(JSON.stringify(list))
  442. },
  443. //获取学院列表
  444. listDepartments(){
  445. listDepartments().then(response => {
  446. this.deptSelectList = response.data;
  447. });
  448. },
  449. }
  450. }
  451. </script>
  452. <style scoped lang="scss">
  453. .snapshotManagement{
  454. flex: 1;
  455. display: flex !important;
  456. flex-direction: column;
  457. overflow: hidden;
  458. .snapshotManagement-page{
  459. flex: 1;
  460. display: flex !important;
  461. flex-direction: column;
  462. overflow: hidden;
  463. .title-box{
  464. padding-top:20px;
  465. border-bottom:1px solid #dedede;
  466. .form-button-max-big-box{
  467. display: inline-block;
  468. .form-button-big-box{
  469. display: flex;
  470. div{
  471. position: relative;
  472. height:40px;
  473. width:80px;
  474. line-height: 40px;
  475. text-align: center;
  476. color:#999;
  477. font-size:14px;
  478. border:1px solid #999;
  479. border-radius:4px;
  480. margin-left:10px;
  481. font-weight:500;
  482. cursor: pointer;
  483. .icon-p{
  484. width:15px;
  485. height:15px;
  486. line-height:15px;
  487. text-align: center;
  488. position: absolute;
  489. right:0;
  490. bottom:0;
  491. color:#fff;
  492. background: #0183fa;
  493. border-top-left-radius:4px;
  494. }
  495. }
  496. .checkDiv{
  497. color:#0183FA;
  498. border:1px solid #0183FA;
  499. }
  500. }
  501. }
  502. }
  503. .content-box{
  504. flex: 1;
  505. display: flex;
  506. flex-direction: column;
  507. padding:20px;
  508. overflow: hidden;
  509. }
  510. }
  511. }
  512. ::v-deep .snapshotManagement-for-img-box{
  513. width:80px;
  514. height:80px;
  515. border-radius:4px;
  516. display: inline-block;
  517. overflow: hidden;
  518. margin-right:20px;
  519. position: relative;
  520. .for-img{
  521. width:80px;
  522. height:80px;
  523. display: inline-block;
  524. overflow: hidden;
  525. }
  526. .for-del-button{
  527. background: rgba(0,0,0,0.7);
  528. width:20px;
  529. height:20px;
  530. line-height: 20px;
  531. text-align: center;
  532. color:#fff;
  533. border-bottom-left-radius:4px;
  534. cursor: pointer;
  535. position: absolute;
  536. top:0;
  537. right:0;
  538. }
  539. }
  540. ::v-deep .up-img-p{
  541. height:80px;
  542. width:80px;
  543. line-height:80px;
  544. text-align: center;
  545. font-size:16px;
  546. border-radius:4px;
  547. border:1px dashed #E0E0E0;
  548. }
  549. </style>