checkItem.vue 15 KB

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