batchAudit.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <!--批量审核-->
  2. <template>
  3. <div class="batchAudit">
  4. <div class="batchAudit-page">
  5. <div class="title-box">
  6. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true" label-width="80px">
  7. <el-form-item label="关键字" prop="searchValue">
  8. <el-input
  9. maxLength="30"
  10. v-model="queryParams.searchValue"
  11. placeholder="计划标题/实验室/房间号"
  12. clearable
  13. style="width: 200px"
  14. />
  15. </el-form-item>
  16. <el-form-item label="整改时间" prop="dateRange" style="margin-left:10px;" label-width="70px">
  17. <el-date-picker
  18. :clearable="false"
  19. v-model="dateRange"
  20. size="small"
  21. style="width: 240px"
  22. value-format="examineOpinion-MM-dd"
  23. type="daterange"
  24. range-separator="-"
  25. start-placeholder="开始日期"
  26. end-placeholder="结束日期"
  27. ></el-date-picker>
  28. </el-form-item>
  29. <el-form-item>
  30. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  31. <p class="reset-button-one" @click="resetQuery">重置</p>
  32. </el-form-item>
  33. </el-form>
  34. </div>
  35. <div class="content-box">
  36. <el-table border :data="tableList" ref="multipleTable" @sort-change="sortChange"
  37. @selection-change="tableChange" :row-key="getRowKeys">
  38. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  39. <el-table-column label="序号" align="center" type="index" width="60" />
  40. <el-table-column label="计划标题" align="center" prop="title" show-overflow-tooltip/>
  41. <el-table-column label="隐患描述" align="center" prop="hazardDescribe" show-overflow-tooltip width="220"/>
  42. <el-table-column label="实验室" align="center" prop="subRoom" show-overflow-tooltip width="170"/>
  43. <el-table-column label="检查时间" sortable="custom" align="center" prop="checkTime" show-overflow-tooltip width="160"/>
  44. <el-table-column label="整改人" align="center" prop="rectifyName" show-overflow-tooltip width="90"/>
  45. <el-table-column label="整改期限" sortable="custom" align="center" prop="rectifyDeadline" show-overflow-tooltip width="130"/>
  46. <el-table-column label="整改状态" align="center" prop="rectifyStatus" show-overflow-tooltip width="110">
  47. <template slot-scope="scope">
  48. <p :class="scope.row.rectifyStatus==1?'rectifyStatusColorA':(scope.row.rectifyStatus==2?'rectifyStatusColorB':(scope.row.rectifyStatus==3?'rectifyStatusColorC':''))">{{scope.row.rectifyStatus==1?'已完成':(scope.row.rectifyStatus==2?'待整改':(scope.row.rectifyStatus==3?'待复核':''))}}</p>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="整改时间" sortable="custom" align="center" prop="rectifyTime" show-overflow-tooltip width="220">
  52. <template slot-scope="scope">
  53. <p>{{scope.row.rectifyTime}}<span v-if="scope.row.overdueStatus==1" style="margin-left:10px;color:#EE0606;">已逾期</span></p>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="审核状态" align="center" prop="examineResult" show-overflow-tooltip width="80"/>
  57. <el-table-column label="操作" align="center" width="80">
  58. <template slot-scope="scope">
  59. <div class="table-button-box">
  60. <p class="table-button-null"></p>
  61. <p class="table-button-p" @click="addDialogOpen(true,scope.row)">详情</p>
  62. <p class="table-button-null"></p>
  63. </div>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <pagination :page-sizes="[20, 30, 40, 50]"
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParams.pageNum"
  71. :limit.sync="queryParams.pageSize"
  72. @pagination="getList"
  73. />
  74. </div>
  75. <div class="dialog-footer-box">
  76. <p class="dialog-footer-button-null"></p>
  77. <p class="dialog-footer-button-info" @click="outButton">返回</p>
  78. <p class="dialog-footer-button-primary" @click="openDialogPage(1)">确认</p>
  79. <p class="dialog-footer-button-null"></p>
  80. </div>
  81. </div>
  82. <infoDialog v-if="infoDialogType" :propsInfoDialogData="propsInfoDialogData"></infoDialog>
  83. <el-dialog class="inspectionPlan-dialog-box"
  84. title="批量审核" :visible.sync="dialogType" v-if="dialogType"
  85. @close="openDialogPage(2)" width="1303px" append-to-body>
  86. <el-table border :data="dialogTableList">
  87. <el-table-column label="序号" align="center" type="index" width="60" />
  88. <el-table-column label="计划标题" align="center" prop="title" show-overflow-tooltip/>
  89. <el-table-column label="隐患描述" align="center" prop="hazardDescribe" show-overflow-tooltip width="220"/>
  90. <el-table-column label="实验室" align="center" prop="subRoom" show-overflow-tooltip width="170"/>
  91. <el-table-column label="整改人" align="center" prop="rectifyName" show-overflow-tooltip width="90"/>
  92. <el-table-column label="操作" align="center" prop="examineResult" width="140">
  93. <template slot-scope="scope">
  94. <el-select v-model="scope.row.examineResult" placeholder="请选择">
  95. <el-option
  96. v-for="item in dialogOptions"
  97. :key="item.value"
  98. :label="item.label"
  99. :value="item.value">
  100. </el-option>
  101. </el-select>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="审核意见" align="center" prop="examineOpinion" width="400">
  105. <template slot-scope="scope">
  106. <el-input v-model="scope.row.examineOpinion" placeholder="请输入审核意见" maxLength="100"></el-input>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. <div slot="footer" class="dialog-footer dialog-footer-box" style="display: flex">
  111. <p class="dialog-footer-button-null"></p>
  112. <p class="dialog-footer-button-info" @click="openDialogPage(2)">返回</p>
  113. <p class="dialog-footer-button-primary" @click="dialogButton">批量审核</p>
  114. <p class="dialog-footer-button-null"></p>
  115. </div>
  116. </el-dialog>
  117. </div>
  118. </template>
  119. <script>
  120. import { checkHazardList,batchApprove } from '@/api/safetyCheck/index'
  121. import infoDialog from '@/views/safetyCheck/components/infoDialog/infoDialog.vue'
  122. export default {
  123. name: 'batchAudit',
  124. props:{
  125. propsBatchAuditData:{},
  126. },
  127. components: {
  128. infoDialog
  129. },
  130. data(){
  131. return{
  132. //组件传参
  133. propsInfoDialogData:{},
  134. infoDialogType:false,
  135. queryParams:{
  136. pageNum:1,
  137. pageSize:20,
  138. rectifyStatus:3,
  139. searchValue:"",
  140. },
  141. dateRange:[],
  142. tableList:[],
  143. total:0,
  144. tableNum:0,
  145. tableIds:[],
  146. //审批弹窗数据
  147. dialogType:false,
  148. dialogTableList:[],
  149. dialogOptions:[
  150. {value:"0",label:"驳回"},
  151. {value:"1",label:"通过"},
  152. ],
  153. }
  154. },
  155. created(){
  156. },
  157. mounted(){
  158. this.getList();
  159. },
  160. methods:{
  161. //批量审核
  162. dialogButton(){
  163. let self = this;
  164. let list = [];
  165. for(let i=0;i<self.dialogTableList.length;i++){
  166. if(!self.dialogTableList[i].examineResult){
  167. this.msgError('第'+(i+1)+'条数据,未选择审核结果')
  168. return
  169. }
  170. if(!self.dialogTableList[i].examineOpinion){
  171. this.msgError('第'+(i+1)+'条数据,未输入审核意见')
  172. return
  173. }
  174. let obj = {
  175. id:self.dialogTableList[i].rectifyId,
  176. checkHazardId:self.dialogTableList[i].id,
  177. examineResult:self.dialogTableList[i].examineResult,
  178. examineOpinion:self.dialogTableList[i].examineOpinion,
  179. };
  180. list.push(obj);
  181. }
  182. batchApprove(list).then(response => {
  183. this.msgSuccess(response.msg)
  184. this.$parent.goPage(3);
  185. });
  186. },
  187. //批量审核弹窗
  188. openDialogPage(type){
  189. if(type == 1){
  190. if(!this.$refs.multipleTable.selection[0]){
  191. this.msgError('请勾选需要审批的数据')
  192. return
  193. }
  194. let list = JSON.parse(JSON.stringify(this.$refs.multipleTable.selection));
  195. for(let i=0;i<list.length;i++){
  196. list[i].examineResult = '';
  197. list[i].examineOpinion = '';
  198. }
  199. this.$set(this,'dialogTableList',list);
  200. this.$set(this,'dialogType',true);
  201. }else{
  202. this.$set(this,'dialogType',false);
  203. }
  204. },
  205. //开关详情页面
  206. addDialogOpen(type,data){
  207. if(this.infoDialogType != type){
  208. if(type){
  209. let obj = {
  210. id:data.id
  211. }
  212. this.$set(this,'propsInfoDialogData',obj);
  213. this.$set(this,'infoDialogType',type);
  214. }else{
  215. this.getList();
  216. this.$set(this,'infoDialogType',type);
  217. }
  218. }
  219. },
  220. //返回
  221. outButton(){
  222. this.$parent.goPage(1);
  223. },
  224. //时间排序方法
  225. sortChange(val){
  226. if(val.prop == 'checkTime'){
  227. this.$set(this.queryParams,'checkTimeOrder',val.order=='ascending'?'1':(val.order=='descending'?'2':''));
  228. this.$set(this.queryParams,'zgTimeOrder','');
  229. this.$set(this.queryParams,'zgTermOrder','');
  230. this.getList();
  231. }else if(val.prop == 'rectifyTime'){
  232. this.$set(this.queryParams,'zgTimeOrder',val.order=='ascending'?'1':(val.order=='descending'?'2':''));
  233. this.$set(this.queryParams,'checkTimeOrder','');
  234. this.$set(this.queryParams,'zgTermOrder','');
  235. this.getList();
  236. }else if(val.prop == 'rectifyDeadline'){
  237. this.$set(this.queryParams,'zgTermOrder',val.order=='ascending'?'1':(val.order=='descending'?'2':''));
  238. this.$set(this.queryParams,'checkTimeOrder','');
  239. this.$set(this.queryParams,'zgTimeOrder','');
  240. this.getList();
  241. }
  242. },
  243. //获取数据列表
  244. getList(){
  245. let obj = JSON.parse(JSON.stringify(this.queryParams))
  246. if(this.dateRange[0]){
  247. obj.beginTime = this.dateRange[0];
  248. }else{
  249. obj.beginTime = "";
  250. }
  251. if(this.dateRange[1]){
  252. obj.endTime = this.dateRange[1];
  253. }else{
  254. obj.endTime = "";
  255. }
  256. obj.hazardType = this.propsBatchAuditData.hazardType
  257. checkHazardList(obj).then(response => {
  258. this.total = response.data.total;
  259. this.tableList = response.data.records;
  260. });
  261. },
  262. /** 搜索按钮操作 */
  263. handleQuery() {
  264. this.$set(this.queryParams,'pageNum',1);
  265. this.getList();
  266. },
  267. /** 重置按钮操作 */
  268. resetQuery() {
  269. this.$set(this,'dateRange',[]);
  270. this.$set(this,'queryParams',{
  271. pageNum:1,
  272. pageSize:20,
  273. rectifyStatus:3,
  274. searchValue:"",
  275. });
  276. this.handleQuery();
  277. },
  278. /*===记录勾选数据===
  279. 需要再el-table 添加 :row-key="getRowKeys"
  280. 需要在selection 添加 :reserve-selection="true"
  281. */
  282. getRowKeys(row) {
  283. return row.id
  284. },
  285. tableChange(selection){
  286. this.tableNum = selection.length;
  287. this.tableIds = selection.map(item => item.userId);
  288. },
  289. }
  290. }
  291. </script>
  292. <style scoped lang="scss">
  293. .batchAudit{
  294. flex: 1;
  295. display: flex !important;
  296. flex-direction: column;
  297. overflow: hidden;
  298. .batchAudit-page{
  299. flex: 1;
  300. display: flex !important;
  301. flex-direction: column;
  302. overflow: hidden;
  303. .title-box{
  304. padding-top:20px;
  305. .form-button-max-big-box{
  306. display: inline-block;
  307. .form-button-big-box{
  308. display: flex;
  309. div{
  310. position: relative;
  311. height:40px;
  312. width:80px;
  313. line-height: 40px;
  314. text-align: center;
  315. color:#999;
  316. font-size:14px;
  317. border:1px solid #999;
  318. border-radius:4px;
  319. margin-left:10px;
  320. font-weight:500;
  321. cursor: pointer;
  322. .icon-p{
  323. width:15px;
  324. height:15px;
  325. line-height:15px;
  326. text-align: center;
  327. position: absolute;
  328. right:0;
  329. bottom:0;
  330. color:#fff;
  331. background: #0183fa;
  332. border-top-left-radius:4px;
  333. }
  334. }
  335. .checkDiv{
  336. color:#0183FA;
  337. border:1px solid #0183FA;
  338. }
  339. }
  340. }
  341. }
  342. .content-box{
  343. flex: 1;
  344. display: flex;
  345. flex-direction: column;
  346. padding:0 20px 20px;
  347. overflow: hidden;
  348. .rectifyStatusColorA{
  349. color:#23B303;
  350. }
  351. .rectifyStatusColorB{
  352. color:#0183FA;
  353. }
  354. .rectifyStatusColorC{
  355. color:#EE0606;
  356. }
  357. }
  358. .dialog-footer-box{
  359. padding:20px 0;
  360. height:70px;
  361. border-top:1px solid #D8D8D8;
  362. display: flex;
  363. }
  364. }
  365. }
  366. </style>