index.vue 19 KB

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