index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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:70px;margin-right:0;"
  65. @click="addButton"
  66. >随手拍</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:80px;"
  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':''" @click="topRightClickType">
  81. <p class="text-p-me">与我有关{{correlationNum}}</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. correlationNum:'',
  239. //新增窗口
  240. addDialogType:false,
  241. addDialogForm:{
  242. deptId:"",
  243. deptName:"",
  244. subId:"",
  245. subName:"",
  246. hazardDescribe:"",
  247. imgDtoList:[],
  248. },
  249. rules:{
  250. deptId: [
  251. { required: true, message: "请选择学院", trigger: "change" },
  252. ],
  253. subId: [
  254. { required: true, message: "请选择实验室", trigger: "change" },
  255. ],
  256. imgDtoList: [
  257. { required: true, message: "请上传隐患照片", trigger: "change" },
  258. ],
  259. },
  260. dialogDeptOptions:[],
  261. dialogLoading:false,
  262. dialogSubList:[],
  263. dialogSubListData:[],
  264. suffixName:"",
  265. //详情
  266. infoPropsData:{}
  267. }
  268. },
  269. created(){
  270. },
  271. mounted(){
  272. this.listDepartments();
  273. this.getList();
  274. },
  275. methods:{
  276. //获取相关数量
  277. getCorrelationNum(){
  278. securityCheckClapList({
  279. pageNum:1,
  280. pageSize:20,
  281. deptId:'',
  282. searchValue:'',
  283. rectifyStatus:'',
  284. upTimeOrder:"",
  285. zgTimeOrder:"",
  286. myRelated:1,
  287. }).then(response => {
  288. this.$set(this,'correlationNum',response.data.total>999?' 999+':(response.data.total<1?'':' '+response.data.total));
  289. });
  290. },
  291. //与我相关按钮
  292. topRightClickType(){
  293. this.$set(this.queryParams,'myRelated',this.queryParams.myRelated==1?0:1);
  294. this.handleQuery();
  295. },
  296. goPage(type,data){
  297. if(this.pageType != type){
  298. if (type==1){
  299. this.$set(this,'pageType',type);
  300. } else if(type==2){
  301. this.$set(this,'pageType',type);
  302. } else if(type==3){
  303. this.$set(this,'infoPropsData',data);
  304. this.$set(this,'pageType',type);
  305. } else if(type==4){
  306. this.$set(this,'pageType',1);
  307. this.getList();
  308. }
  309. }
  310. },
  311. //范围选择
  312. topLeftClickType(type){
  313. if(this.queryParams.rectifyStatus !== type){
  314. this.$set(this.queryParams,'rectifyStatus',type);
  315. this.handleQuery();
  316. }
  317. },
  318. //时间排序方法
  319. sortChange(val){
  320. if(val.prop == 'rectifyTime'){
  321. this.$set(this.queryParams,'zgTimeOrder',val.order=='ascending'?'1':(val.order=='descending'?'2':''));
  322. this.$set(this.queryParams,'upTimeOrder','');
  323. this.handleQuery();
  324. }else if(val.prop == 'createTime'){
  325. this.$set(this.queryParams,'upTimeOrder',val.order=='ascending'?'1':(val.order=='descending'?'2':''));
  326. this.$set(this.queryParams,'zgTimeOrder','');
  327. this.handleQuery();
  328. }
  329. },
  330. //获取数据列表
  331. getList(){
  332. let obj = JSON.parse(JSON.stringify(this.queryParams))
  333. if(this.dateRange[0]){
  334. obj.beginTime = this.dateRange[0]
  335. }else{
  336. obj.beginTime = ""
  337. }
  338. if(this.dateRange[1]){
  339. obj.endTime = this.dateRange[1]
  340. }else{
  341. obj.endTime = ""
  342. }
  343. this.getCorrelationNum();
  344. securityCheckClapList(obj).then(response => {
  345. this.total = response.data.total;
  346. this.tableList = response.data.records;
  347. });
  348. },
  349. /** 搜索按钮操作 */
  350. handleQuery() {
  351. this.$set(this.queryParams,'pageNum',1);
  352. this.getList();
  353. },
  354. /** 重置按钮操作 */
  355. resetQuery() {
  356. this.$set(this,'dateRange',[]);
  357. this.$set(this,'queryParams',{
  358. pageNum:1,
  359. pageSize:20,
  360. deptId:'',
  361. searchValue:'',
  362. rectifyStatus:'',
  363. upTimeOrder:"",
  364. zgTimeOrder:"",
  365. myRelated:1,
  366. });
  367. this.handleQuery();
  368. },
  369. /*==========上传相关==========*/
  370. handleAvatarSuccess(res) {
  371. this.$set(this,'loading',false);
  372. if(this.addDialogForm.imgDtoList.length>4){
  373. this.msgError('最多只可上传5张')
  374. return
  375. }
  376. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  377. //判断文件名中是否有逗号和分号
  378. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  379. }else{
  380. this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
  381. return
  382. }
  383. let obj ={
  384. fileName:this.upDataName,
  385. fileUrl:res.data.url,
  386. };
  387. this.addDialogForm.imgDtoList.push(obj);
  388. this.$forceUpdate()
  389. },
  390. beforeAvatarUpload(file) {
  391. if(this.addDialogForm.imgDtoList.length>4){
  392. this.msgError('最多只可上传5张')
  393. return false
  394. }
  395. let type = false;
  396. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif' || file.type == 'image/bmp') {
  397. if(file.size> 2100000){
  398. this.msgError('上传图片大小不能超过2M')
  399. return false
  400. }
  401. this.$set(this,'loading',true);
  402. this.upDataName = file.name;
  403. type = true;
  404. }else{
  405. this.msgError('仅支持jpg/png/bmp/gif格式')
  406. type = false;
  407. }
  408. return type;
  409. },
  410. //删除照片
  411. delImg(imgIndex){
  412. this.addDialogForm.imgDtoList.splice(imgIndex,1);
  413. },
  414. /**************** 新增窗口 ******************/
  415. //提交
  416. upDialogButton(){
  417. this.$refs["addDialogForm"].validate(valid => {
  418. if (valid) {
  419. checkClapAdd(this.addDialogForm).then(response => {
  420. this.msgSuccess(response.msg);
  421. this.outDialog();
  422. this.getList();
  423. });
  424. }
  425. })
  426. },
  427. addButton(){
  428. this.$set(this,'addDialogForm',{
  429. deptId:"",
  430. deptName:"",
  431. subId:"",
  432. subName:"",
  433. hazardDescribe:"",
  434. imgDtoList:[],
  435. });
  436. this.$set(this,'addDialogType',true);
  437. },
  438. outDialog(){
  439. this.$set(this,'addDialogType',false);
  440. },
  441. //选中院系
  442. dialogDeptChange(val){
  443. let self = this;
  444. let obj = {
  445. deptId:val,
  446. }
  447. getSubjectDictByViolation(obj).then(response => {
  448. this.$set(this,'dialogSubListData',response.data);
  449. this.$set(this,'dialogSubList',response.data);
  450. for(let i=0;i<self.deptSelectList.length;i++){
  451. if(val == self.deptSelectList[i].deptId){
  452. self.$set(self.addDialogForm,'deptName',self.deptSelectList[i].deptName);
  453. }
  454. }
  455. this.$set(this.addDialogForm,'subId','');
  456. this.$set(this.addDialogForm,'subName','');
  457. });
  458. },
  459. //实验室选中
  460. dialogSubChange(val){
  461. let self = this;
  462. for(let i=0;i<self.dialogSubList.length;i++){
  463. if(val == self.dialogSubList[i].id){
  464. self.$set(self.addDialogForm,'subName',self.dialogSubList[i].name);
  465. }
  466. }
  467. },
  468. /** 实验室-本地懒加载 */
  469. getSelectList(val) {
  470. let self = this;
  471. let list = [];
  472. for(let i=0;i<self.dialogSubListData.length;i++){
  473. if(self.dialogSubListData[i].name.indexOf(val) != -1){
  474. list.push(self.dialogSubListData[i]);
  475. }
  476. }
  477. this.dialogSubList = JSON.parse(JSON.stringify(list))
  478. },
  479. //获取学院列表
  480. listDepartments(){
  481. listDepartments().then(response => {
  482. this.deptSelectList = response.data;
  483. });
  484. },
  485. }
  486. }
  487. </script>
  488. <style scoped lang="scss">
  489. .snapshotManagement{
  490. flex: 1;
  491. display: flex !important;
  492. flex-direction: column;
  493. overflow: hidden;
  494. .snapshotManagement-page{
  495. flex: 1;
  496. display: flex !important;
  497. flex-direction: column;
  498. overflow: hidden;
  499. .title-box{
  500. padding-top:20px;
  501. border-bottom:1px solid #dedede;
  502. .form-button-max-big-box{
  503. display: inline-block;
  504. .form-button-big-box{
  505. display: flex;
  506. div{
  507. position: relative;
  508. height:40px;
  509. width:80px;
  510. line-height: 40px;
  511. text-align: center;
  512. color:#999;
  513. font-size:14px;
  514. border:1px solid #999;
  515. border-radius:4px;
  516. margin-left:10px;
  517. font-weight:500;
  518. cursor: pointer;
  519. .icon-p{
  520. width:15px;
  521. height:15px;
  522. line-height:15px;
  523. text-align: center;
  524. position: absolute;
  525. right:0;
  526. bottom:0;
  527. color:#fff;
  528. background: #0183fa;
  529. border-top-left-radius:4px;
  530. }
  531. }
  532. .checkDiv{
  533. color:#0183FA;
  534. border:1px solid #0183FA;
  535. }
  536. }
  537. }
  538. .form-button-max-big-box-me{
  539. display: inline-block;
  540. .form-button-big-box-me{
  541. display: flex;
  542. div{
  543. position: relative;
  544. height:40px;
  545. width:130px;
  546. line-height: 40px;
  547. text-align: center;
  548. color:#999;
  549. font-size:14px;
  550. border:1px solid #999;
  551. border-radius:4px;
  552. font-weight:500;
  553. cursor: pointer;
  554. .icon-p-me{
  555. width:15px;
  556. height:15px;
  557. line-height:15px;
  558. text-align: center;
  559. position: absolute;
  560. right:0;
  561. bottom:0;
  562. color:#fff;
  563. background: #0183fa;
  564. border-top-left-radius:4px;
  565. }
  566. }
  567. .checkDiv-me{
  568. color:#0183FA!important;
  569. border:1px solid #0183FA!important;
  570. }
  571. }
  572. }
  573. }
  574. .content-box{
  575. flex: 1;
  576. display: flex;
  577. flex-direction: column;
  578. padding:20px;
  579. overflow: hidden;
  580. }
  581. }
  582. }
  583. ::v-deep .snapshotManagement-for-img-box{
  584. width:80px;
  585. height:80px;
  586. border-radius:4px;
  587. display: inline-block;
  588. overflow: hidden;
  589. margin-right:20px;
  590. position: relative;
  591. .for-img{
  592. width:80px;
  593. height:80px;
  594. display: inline-block;
  595. overflow: hidden;
  596. }
  597. .for-del-button{
  598. background: rgba(0,0,0,0.7);
  599. width:20px;
  600. height:20px;
  601. line-height: 20px;
  602. text-align: center;
  603. color:#fff;
  604. border-bottom-left-radius:4px;
  605. cursor: pointer;
  606. position: absolute;
  607. top:0;
  608. right:0;
  609. }
  610. }
  611. ::v-deep .up-img-p{
  612. height:80px;
  613. width:80px;
  614. line-height:80px;
  615. text-align: center;
  616. font-size:16px;
  617. border-radius:4px;
  618. border:1px dashed #E0E0E0;
  619. }
  620. </style>