index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <!-- 自查隐患 -->
  2. <template>
  3. <div class="app-container selfInspectionHazard">
  4. <div class="page-container selfInspectionHazardPage" v-if="pageType === 1">
  5. <div class="top-table-button-box">
  6. <div :class="rectifyStatus === null ? 'tableCheck':''" @click="tableCheck(null)">
  7. <p>全部</p>
  8. <p></p>
  9. </div>
  10. <div :class="rectifyStatus === 2 ? 'tableCheck':''" @click="tableCheck(2)">
  11. <p>待整改</p>
  12. <p></p>
  13. </div>
  14. <div :class="rectifyStatus === 1 ? 'tableCheck':''" @click="tableCheck(1)">
  15. <p>已整改</p>
  16. <p></p>
  17. </div>
  18. <div :class="rectifyStatus === 4 ? 'tableCheck':''" @click="tableCheck(4)">
  19. <p>暂无法整改</p>
  20. <p></p>
  21. </div>
  22. <div :class="rectifyStatus === 5 ? 'tableCheck':''" @click="tableCheck(5)">
  23. <p>多次整改未完成</p>
  24. <p></p>
  25. </div>
  26. </div>
  27. <div class="page-form-title-box" style="border:none;" :class="advancedType?'page-advanced-form-title-box':''">
  28. <el-form :model="queryParams" class="form-box" ref="queryForm"
  29. :inline="true" style="width:100%;">
  30. <el-form-item label="" prop="planTitle">
  31. <el-input
  32. maxLength="30"
  33. v-model="queryParams.planTitle"
  34. placeholder="计划标题"
  35. style="width: 150px"
  36. />
  37. </el-form-item>
  38. <el-form-item label="" prop="hazardCheckPro">
  39. <el-cascader
  40. style="width: 150px"
  41. placeholder="检查指标"
  42. v-model="queryParams.hazardCheckPro"
  43. filterable
  44. :show-all-levels="false"
  45. :options="cascaderData"
  46. :props="{ value: 'id', label: 'labelName',emitPath:false }"
  47. ></el-cascader>
  48. </el-form-item>
  49. <el-form-item label="" prop="hazardCheckName">
  50. <el-input
  51. maxLength="30"
  52. v-model="queryParams.hazardCheckName"
  53. placeholder="模糊搜索检查指标项"
  54. style="width: 160px"
  55. />
  56. </el-form-item>
  57. <el-form-item label="" prop="deptId">
  58. <el-select v-model="queryParams.deptId" placeholder="学院单位" style="width: 170px">
  59. <el-option
  60. v-for="dict in deptOption"
  61. :key="dict.deptId"
  62. :label="dict.deptName"
  63. :value="dict.deptId"
  64. />
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item label="" prop="levelId">
  68. <el-select v-model="queryParams.levelId" placeholder="安全分级" style="width: 160px">
  69. <el-option
  70. v-for="dict in levelOption"
  71. :key="dict.levelId"
  72. :label="dict.levelName"
  73. :value="dict.levelId"
  74. />
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="" prop="searchValue">
  78. <el-input
  79. maxLength="30"
  80. v-model="queryParams.searchValue"
  81. placeholder="实验室/房间号"
  82. style="width: 140px"
  83. />
  84. </el-form-item>
  85. <el-form-item label="" prop="rectifyName">
  86. <el-input
  87. maxLength="30"
  88. v-model="queryParams.rectifyName"
  89. placeholder="整改人"
  90. style="width: 140px"
  91. />
  92. </el-form-item>
  93. <el-form-item label="" prop="state">
  94. <el-date-picker
  95. :clearable="false"
  96. v-model="dateRange"
  97. size="small"
  98. style="width: 230px"
  99. value-format="yyyy-MM-dd"
  100. type="daterange"
  101. range-separator="-"
  102. start-placeholder="开始日期"
  103. end-placeholder="结束日期"
  104. ></el-date-picker>
  105. </el-form-item>
  106. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  107. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  108. </el-form>
  109. </div>
  110. <div class="page-content-box" style="padding-top:0;">
  111. <el-table class="table-box" v-loading="loading" border :data="dataList">
  112. <el-table-column label="序号" type="index" width="60"/>
  113. <el-table-column label="计划标题" prop="planTitle" width="250" show-overflow-tooltip/>
  114. <el-table-column label="检查类型" prop="checkTypeName" width="100" show-overflow-tooltip/>
  115. <el-table-column label="不符合项" prop="hazardCheckName" width="250" show-overflow-tooltip>
  116. <template slot-scope="scope">
  117. <span>{{scope.row.hazardCheckName}} {{scope.row.hazardCheckName}}</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="实验室" prop="subName" width="220" show-overflow-tooltip/>
  121. <el-table-column label="整改期限" prop="rectifyDeadline" width="130" show-overflow-tooltip/>
  122. <el-table-column label="整改状态" prop="rectifyStatus" width="130" show-overflow-tooltip>
  123. <template slot-scope="scope">
  124. <span>{{scope.row.rectifyStatus == 1?'已完成':(scope.row.rectifyStatus == 2?'待整改':(scope.row.rectifyStatus == 3?'待复核':(scope.row.rectifyStatus == 4?'暂无法整改':'')))}}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="整改人" prop="rectifyName" width="100" show-overflow-tooltip/>
  128. <el-table-column label="整改时间" prop="rectifyTime" width="150" show-overflow-tooltip>
  129. <template slot-scope="scope">
  130. <span>{{ parseTime(scope.row.rectifyTime,"{y}-{m}-{d} {h}:{i}") }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="复查结果" prop="reviewStatus" width="130" show-overflow-tooltip>
  134. <template slot-scope="scope">
  135. <span>{{ scope.row.reviewStatus ==1 ?'已复查':(scope.row.reviewStatus ==0 ?'未复查':'') }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="操作" width="100" show-overflow-tooltip >
  139. <template slot-scope="scope">
  140. <div class="table-button-box">
  141. <p class="table-button-null"></p>
  142. <p class="table-button-p"
  143. @click="tableButton(2,scope.row)"
  144. >详情/整改</p>
  145. <p class="table-button-null"></p>
  146. </div>
  147. </template>
  148. </el-table-column>
  149. </el-table>
  150. <pagination :page-sizes="[20, 30, 40, 50]"
  151. v-show="total>0"
  152. :total="total"
  153. :page.sync="queryParams.page"
  154. :limit.sync="queryParams.pageSize"
  155. @pagination="getList"
  156. />
  157. </div>
  158. </div>
  159. <!--<add-page :propsData="propsData" v-if="pageType === 2"></add-page>-->
  160. </div>
  161. </template>
  162. <script>
  163. import {
  164. getDeptDropList,
  165. laboratoryClassLevelGetList,
  166. } from '@/api/commonality/permission'
  167. import {
  168. securityCheckOptionList,
  169. securityCheckDangerList,
  170. } from "@/api/safetyCheck/indexDemoOne";
  171. //import addPage from "./addPage.vue";
  172. export default {
  173. name: 'index',
  174. //components: {
  175. // addPage
  176. //},
  177. data () {
  178. return {
  179. tableButtonType:this.hasPermiDom(['demo:demo:detail','demo:demo:edit','demo:demo:del',]),
  180. //页面状态
  181. pageType:1,
  182. //选项卡状态
  183. rectifyStatus:null,
  184. //页面遮罩
  185. loading:false,
  186. //学院列表
  187. deptOption:[],
  188. //分级下拉列表
  189. levelOption:[],
  190. //检查项下拉列表
  191. cascaderData:[],
  192. //查询条件
  193. queryParams:{
  194. page:1,
  195. pageSize:20,
  196. checkCategory:2,
  197. planTitle:"",
  198. hazardCheckPro :null,
  199. hazardCheckName :"",
  200. deptId :null,
  201. levelId :null,
  202. searchValue :"",
  203. },
  204. //时间数据
  205. dateRange:[],
  206. advancedType:false,
  207. //列表数据
  208. dataList:[],
  209. //数据数量
  210. total:0,
  211. //组件传参
  212. propsData:{},
  213. }
  214. },
  215. created () {
  216. this.getDeptDropList();
  217. this.laboratoryClassLevelGetList();
  218. this.securityCheckOptionList();
  219. },
  220. mounted () {
  221. this.getList();
  222. },
  223. methods: {
  224. //选项卡切换
  225. tableCheck(type){
  226. if (this.rectifyStatus !== type){
  227. this.$set(this,'rectifyStatus',type);
  228. this.resetQuery();
  229. }
  230. },
  231. //查询按钮
  232. handleQuery(){
  233. this.$set(this.queryParams,'page',1);
  234. this.getList();
  235. },
  236. //重置按钮
  237. resetQuery(){
  238. this.$set(this,'dateRange',[])
  239. this.$set(this,'queryParams',{
  240. page:1,
  241. pageSize:20,
  242. checkCategory:2,
  243. planTitle:"",
  244. hazardCheckPro :null,
  245. hazardCheckName :"",
  246. deptId :null,
  247. levelId :null,
  248. searchValue :"",
  249. });
  250. this.getList();
  251. },
  252. //获取数据列表
  253. getList(){
  254. this.$set(this,'loading',true);
  255. let obj = JSON.parse(JSON.stringify(this.queryParams))
  256. obj.rectifyStatus = this.rectifyStatus;
  257. if(this.dateRange[0]){
  258. obj.startTime = this.dateRange[0]+'T00:00:00'
  259. obj.endTime = this.dateRange[1]+'T23:59:59'
  260. }else{
  261. obj.startTime = "";
  262. obj.endTime = "";
  263. }
  264. securityCheckDangerList(obj).then(response => {
  265. this.$set(this,'loading',false);
  266. this.$set(this,'dataList',response.data.records);
  267. this.$set(this,'total',response.data.total);
  268. });
  269. },
  270. //操作按钮
  271. tableButton(type,row){
  272. let self = this;
  273. if(type == 1){
  274. //新增
  275. this.$set(this,'pageType',2);
  276. this.$set(this,'propsData',{});
  277. }else if(type == 2){
  278. //详情
  279. this.$set(this,'pageType',2);
  280. let obj = JSON.parse(JSON.stringify(row))
  281. obj.showType = true;
  282. this.$set(this,'propsData',obj);
  283. }else if(type == 3){
  284. //编辑
  285. this.$set(this,'pageType',2);
  286. let obj = JSON.parse(JSON.stringify(row))
  287. obj.showType = false;
  288. this.$set(this,'propsData',obj);
  289. }else if(type == 4){
  290. //删除
  291. this.$confirm('是否确认删除?', "警告", {
  292. confirmButtonText: "确定",
  293. cancelButtonText: "取消",
  294. type: "warning"
  295. }).then(function() {
  296. }).then(() => {
  297. deleteFunction({id:row.id}).then(response => {
  298. self.msgSuccess(response.message)
  299. self.getList();
  300. });
  301. }).catch(() => {});
  302. }else if(type == 5){
  303. //启用&停用
  304. let text = row.state ? "停用" : "启用";
  305. this.$confirm('是否确认' + text + '?', "警告", {
  306. confirmButtonText: "确定",
  307. cancelButtonText: "取消",
  308. type: "warning"
  309. }).then(function() {
  310. }).then(() => {
  311. stateFunction({id:row.id,state:!row.state,}).then(response => {
  312. self.msgSuccess(response.message)
  313. self.getList();
  314. });
  315. }).catch(() => {});
  316. }else if(type == 6){
  317. //返回并刷新
  318. this.$set(this,'pageType',1);
  319. this.getList();
  320. }
  321. },
  322. //学院列表
  323. getDeptDropList() {
  324. getDeptDropList({ deptName: '', level: 2, deptType: 1 }).then(response => {
  325. this.$set(this, 'deptOption', response.data)
  326. })
  327. },
  328. //分级下拉列表
  329. laboratoryClassLevelGetList(){
  330. laboratoryClassLevelGetList({}).then(response => {
  331. this.$set(this,'levelOption',response.data);
  332. });
  333. },
  334. //检查项列表
  335. securityCheckOptionList() {
  336. securityCheckOptionList({}).then(response => {
  337. let list = this.getCascaderData(JSON.parse(JSON.stringify(response.data)),3)
  338. this.$nextTick(()=>{
  339. this.$set(this, 'cascaderData', list)
  340. })
  341. })
  342. },
  343. //检查项格式处理
  344. getCascaderData(list,type) {
  345. let self = this
  346. for (let i = 0; i < list.length; i++) {
  347. list[i].labelName = list[i].code ? list[i].code + ' ' + list[i].name : list[i].name
  348. if(list[i].level == type){
  349. delete list[i].children
  350. }else if (list[i].children) {
  351. if (list[i].children[0]) {
  352. list[i].children = self.getCascaderData(list[i].children,type)
  353. } else {
  354. list.splice(i, 1)
  355. i--
  356. }
  357. } else {
  358. list.splice(i, 1)
  359. i--
  360. }
  361. }
  362. for (let i = 0; i < list.length; i++) {
  363. list[i].labelName = list[i].code ? list[i].code + ' ' + list[i].name : list[i].name
  364. if(list[i].level == type){
  365. delete list[i].children
  366. }else if (list[i].children) {
  367. if (list[i].children[0]) {
  368. list[i].children = self.getCascaderData(list[i].children,type)
  369. } else {
  370. list.splice(i, 1)
  371. i--
  372. }
  373. } else {
  374. list.splice(i, 1)
  375. i--
  376. }
  377. }
  378. for (let i = 0; i < list.length; i++) {
  379. list[i].labelName = list[i].code ? list[i].code + ' ' + list[i].name : list[i].name
  380. if(list[i].level == type){
  381. delete list[i].children
  382. }else if (list[i].children) {
  383. if (list[i].children[0]) {
  384. list[i].children = self.getCascaderData(list[i].children,type)
  385. } else {
  386. list.splice(i, 1)
  387. i--
  388. }
  389. } else {
  390. list.splice(i, 1)
  391. i--
  392. }
  393. }
  394. return list
  395. },
  396. },
  397. }
  398. </script>
  399. <style scoped lang="scss">
  400. .selfInspectionHazard{
  401. .selfInspectionHazardPage{
  402. .top-table-button-box{
  403. display: flex;
  404. padding:0 40px;
  405. border-bottom: 1px solid #dedede;
  406. div{
  407. cursor: pointer;
  408. padding:20px 0 20px 0;
  409. margin-right:30px;
  410. p:nth-child(1){
  411. font-size:16px;
  412. color:#333;
  413. padding:0 15px;
  414. line-height:36px;
  415. height:36px;
  416. }
  417. p:nth-child(2){
  418. height:4px;
  419. border-radius:4px;
  420. }
  421. }
  422. .tableCheck{
  423. p:nth-child(1){
  424. color:#0045AF;
  425. }
  426. p:nth-child(2){
  427. background-color: #0045AF;
  428. }
  429. }
  430. }
  431. .form-button-max-big-box-me{
  432. display: inline-block;
  433. overflow: hidden;
  434. margin-right:10px;
  435. .form-button-big-box-me{
  436. display: flex;
  437. div{
  438. position: relative;
  439. height:40px;
  440. width:100px;
  441. line-height: 40px;
  442. text-align: center;
  443. color:#999;
  444. font-size:14px;
  445. border:1px solid #999;
  446. border-radius:4px;
  447. font-weight:500;
  448. cursor: pointer;
  449. .icon-p-me{
  450. width:15px;
  451. height:15px;
  452. line-height:15px;
  453. text-align: center;
  454. position: absolute;
  455. right:0;
  456. bottom:0;
  457. color:#fff;
  458. background: #0183fa;
  459. border-top-left-radius:4px;
  460. }
  461. }
  462. .checkDiv-me{
  463. color:#0183FA!important;
  464. border:1px solid #0183FA!important;
  465. }
  466. }
  467. }
  468. }
  469. }
  470. </style>