index.vue 21 KB

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