subDialog.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <!--待检查实验室-->
  2. <template>
  3. <el-dialog class="inspectionPlan-dialog-box"
  4. :close-on-click-modal="false"
  5. title="待检查实验室" :visible.sync="addDialogType" v-if="addDialogType"
  6. @close="addDialogOff" width="1430px" append-to-body>
  7. <div class="inspectionPlan-dialog-sub-box">
  8. <div v-if="!lookInfoType" class="left-max-box">
  9. <div class="dept-table-title-box">
  10. <p>待选实验室</p>
  11. <p>{{subNumLeft}}/{{subTotalLeft}}</p>
  12. </div>
  13. <div class="dept-table-max-box">
  14. <el-form :model="subQueryParamsLeft" class="form-box" ref="queryForm" :inline="true" label-width="50px">
  15. <el-form-item label="" prop="deptId" v-if="schoolCollegeType == 'school'">
  16. <el-select v-model="subQueryParamsLeft.deptId" clearable placeholder="学院" style="width: 144px">
  17. <el-option
  18. v-for="item in deptSelectList"
  19. :key="item.deptId"
  20. :label="item.deptName"
  21. :value="item.deptId">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="" prop="buildId" v-if="schoolCollegeType == 'school'">
  26. <el-select v-model="subQueryParamsLeft.buildId" clearable placeholder="楼栋" style="width: 144px">
  27. <el-option
  28. v-for="item in buildSelectList"
  29. :key="item.id"
  30. :label="item.name"
  31. :value="item.id">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="" prop="typeId">
  36. <el-select v-model="subQueryParamsLeft.typeId" clearable placeholder="分类" style="width: 144px">
  37. <el-option
  38. v-for="item in classTypeList"
  39. :key="item.typeId"
  40. :label="item.subType"
  41. :value="item.typeId">
  42. </el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="" prop="levelId">
  46. <el-select v-model="subQueryParamsLeft.levelId" clearable placeholder="分级" style="width: 144px">
  47. <el-option
  48. v-for="item in classifiedList"
  49. :key="item.levelId"
  50. :label="item.titleName"
  51. :value="item.levelId">
  52. </el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item label="" prop="hazardType">
  56. <el-select v-model="subQueryParamsLeft.hazardType" clearable placeholder="危险源标签" style="width: 144px">
  57. <el-option
  58. v-for="item in hazardTypeList"
  59. :key="item.code"
  60. :label="item.name"
  61. :value="item.code">
  62. </el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item label="" prop="searchValue" class="form-index">
  66. <el-input
  67. maxLength="30"
  68. v-model="subQueryParamsLeft.searchValue"
  69. placeholder="实验室/房间号"
  70. clearable
  71. style="width: 313px">
  72. </el-input>
  73. </el-form-item>
  74. <p class="page-inquire-common-style-button" @click="subHandleQueryLeft" style="width:60px;">搜索</p>
  75. <p class="page-reset-common-style-button" @click="subResetQueryLeft" style="width:60px;margin-right:0;">重置</p>
  76. </el-form>
  77. <el-table class="table-box table-null-img-20" ref="leftSubTable" border :data="subTableListLeft" @selection-change="subChangeLeft" :row-key="getSubRowKeys">
  78. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  79. <el-table-column label="实验室" align="center" prop="subName" show-overflow-tooltip>
  80. <template slot-scope="scope">{{scope.row.roomNum?scope.row.subName+'-'+scope.row.roomNum:scope.row.subName}}</template>
  81. </el-table-column>
  82. <el-table-column label="分级分类" align="center" prop="deptName" show-overflow-tooltip width="150">
  83. <template slot-scope="scope">
  84. <span>{{scope.row.classTypeNames}}</span>
  85. <span>-</span>
  86. <span :style="'color:'+scope.row.classLevelColor+';'">{{scope.row.classLevelName}}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip width="150"/>
  90. </el-table>
  91. <pagination layout="total, prev, pager, next, jumper"
  92. v-show="subTotalLeft>0"
  93. :total="subTotalLeft"
  94. :page.sync="subQueryParamsLeft.page"
  95. :limit.sync="subQueryParamsLeft.pageSize"
  96. @pagination="subGetListLeft"/>
  97. </div>
  98. </div>
  99. <div v-if="!lookInfoType" class="center-box">
  100. <p class="el-icon-arrow-left" @click="subArrowButton(1)">到左边</p>
  101. <p class="el-icon-arrow-right" @click="subArrowButton(2)">到右边</p>
  102. </div>
  103. <div class="right-max-box">
  104. <div class="dept-table-title-box" v-if="!lookInfoType">
  105. <p>已选实验室</p>
  106. <p v-if="!lookInfoType">{{subNumRight}}/{{subTotalRight}}</p>
  107. <p v-if="lookInfoType">{{subTotalRight}}</p>
  108. </div>
  109. <div class="dept-table-max-box">
  110. <el-form :model="subQueryParamsRight" class="form-box" ref="queryForm" :inline="true" label-width="50px">
  111. <el-form-item label="" prop="deptId" v-if="schoolCollegeType == 'school'">
  112. <el-select v-model="subQueryParamsRight.deptId" clearable placeholder="学院" :style="!lookInfoType?'width:144px':'width:180px'">
  113. <el-option
  114. v-for="item in deptSelectList"
  115. :key="item.deptId"
  116. :label="item.deptName"
  117. :value="item.deptId">
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item label="" prop="buildId" v-if="schoolCollegeType == 'school'">
  122. <el-select v-model="subQueryParamsRight.buildId" clearable placeholder="楼栋" :style="!lookInfoType?'width:144px':'width:180px'">
  123. <el-option
  124. v-for="item in buildSelectList"
  125. :key="item.id"
  126. :label="item.name"
  127. :value="item.id">
  128. </el-option>
  129. </el-select>
  130. </el-form-item>
  131. <el-form-item label="" prop="typeId">
  132. <el-select v-model="subQueryParamsRight.typeId" clearable placeholder="分类" :style="!lookInfoType?'width:144px':'width:140px'">
  133. <el-option
  134. v-for="item in classTypeList"
  135. :key="item.typeId"
  136. :label="item.subType"
  137. :value="item.typeId">
  138. </el-option>
  139. </el-select>
  140. </el-form-item>
  141. <el-form-item label="" prop="levelId">
  142. <el-select v-model="subQueryParamsRight.levelId" clearable placeholder="分级" :style="!lookInfoType?'width:144px':'width:140px'">
  143. <el-option
  144. v-for="item in classifiedList"
  145. :key="item.levelId"
  146. :label="item.titleName"
  147. :value="item.levelId">
  148. </el-option>
  149. </el-select>
  150. </el-form-item>
  151. <el-form-item label="" prop="hazardType">
  152. <el-select v-model="subQueryParamsRight.hazardType" clearable placeholder="危险源标签" :style="!lookInfoType?'width:144px':'width:140px'">
  153. <el-option
  154. v-for="item in hazardTypeList"
  155. :key="item.code"
  156. :label="item.name"
  157. :value="item.code">
  158. </el-option>
  159. </el-select>
  160. </el-form-item>
  161. <el-form-item label="" prop="searchValue" class="form-index">
  162. <el-input
  163. maxLength="30"
  164. v-model="subQueryParamsRight.searchValue"
  165. placeholder="实验室/房间号"
  166. clearable
  167. :style="!lookInfoType?'width:313px':'width:180px'">
  168. </el-input>
  169. </el-form-item>
  170. <p class="page-inquire-common-style-button" @click="subHandleQueryRight" style="width:60px;">搜索</p>
  171. <p class="page-reset-common-style-button" @click="subResetQueryRight" style="width:60px;margin-right:0;">重置</p>
  172. </el-form>
  173. <el-table class="table-box table-null-img-20" ref="rightSubTable" border :data="subTableListRight" @selection-change="subChangeRight" :row-key="getSubRowKeys">
  174. <el-table-column v-if="!lookInfoType" type="selection" width="50" :reserve-selection="true" align="center"/>
  175. <el-table-column label="实验室" align="center" prop="subName" show-overflow-tooltip>
  176. <template slot-scope="scope">{{scope.row.roomNum?scope.row.subName+'-'+scope.row.roomNum:scope.row.subName}}</template>
  177. </el-table-column>
  178. <el-table-column label="分级分类" align="center" prop="classTypeNames" show-overflow-tooltip width="150" v-if="!lookInfoType">
  179. <template slot-scope="scope">
  180. <span>{{scope.row.classTypeNames}}</span>
  181. <span>-</span>
  182. <span :style="'color:'+scope.row.classLevelColor+';'">{{scope.row.classLevelName}}</span>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip width="150" v-if="!lookInfoType"/>
  186. <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip width="250" v-if="lookInfoType"/>
  187. <el-table-column label="楼栋" align="center" prop="buildName" show-overflow-tooltip width="200" v-if="lookInfoType"/>
  188. <el-table-column label="分类" align="center" prop="classTypeNames" show-overflow-tooltip width="150" v-if="lookInfoType"/>
  189. <el-table-column label="分级" align="center" prop="classLevelName" show-overflow-tooltip width="150" v-if="lookInfoType">
  190. <template slot-scope="scope">
  191. <span :style="'color:'+scope.row.classLevelColor+';'">{{scope.row.classLevelName}}</span>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="负责人" align="center" prop="deptName" show-overflow-tooltip width="220" v-if="lookInfoType"/>
  195. </el-table>
  196. <pagination layout="total, prev, pager, next, jumper"
  197. v-show="subTotalRight>0"
  198. :total="subTotalRight"
  199. :page.sync="subQueryParamsRight.page"
  200. :limit.sync="subQueryParamsRight.pageSize"
  201. @pagination="subGetListRight"/>
  202. </div>
  203. </div>
  204. </div>
  205. <div slot="footer" class="dialog-footer dialog-footer-box" style="display: flex">
  206. <p class="dialog-footer-button-null"></p>
  207. <p class="dialog-footer-button-info" @click="addDialogOff" v-if="!lookInfoType">取消</p>
  208. <p class="dialog-footer-button-primary" @click="addUserButton" v-if="!lookInfoType">确定</p>
  209. <p class="dialog-footer-button-primary" @click="addDialogOff" v-if="lookInfoType">确认</p>
  210. <p class="dialog-footer-button-null"></p>
  211. </div>
  212. </el-dialog>
  213. </template>
  214. <script> import {
  215. laboratorySubRelInfoConditionSubjectInfo,
  216. } from '@/api/safetyCheck/indexDemoOne'
  217. import {
  218. getDeptDropList,
  219. systemBuildingGetOptList,
  220. laboratoryTypeConfigGetList,
  221. laboratoryLevelConfigGetLevelTitleList,
  222. laboratorySubRelInfoGetHazardTypeList,
  223. } from "@/api/commonality/permission";
  224. export default {
  225. name: 'subDialog',
  226. props:{
  227. subCheckData:{},
  228. schoolCollegeType:null
  229. },
  230. data(){
  231. return{
  232. addDialogType:true,
  233. lookInfoType:false,
  234. deptSelectList:[],
  235. buildSelectList:[],
  236. classTypeList:[],
  237. classifiedList:[],
  238. hazardTypeList:[],
  239. subQueryParamsLeft:{
  240. page:1,
  241. pageSize:20,
  242. typeId:"",
  243. levelId:"",
  244. deptId:"",
  245. searchValue:"",
  246. filtType:1
  247. },
  248. subTableListLeft:[],
  249. subTotalLeft:0,
  250. subNumLeft:0,
  251. subIdsLeft:[],
  252. subQueryParamsRight:{
  253. page:1,
  254. pageSize:20,
  255. typeId:"",
  256. levelId:"",
  257. deptId:"",
  258. searchValue:"",
  259. filtType:2
  260. },
  261. subTableListRight:[],
  262. subTotalRight:0,
  263. subNumRight:0,
  264. subIdsRight:[],
  265. dialogTableSubDataList:[],
  266. }
  267. },
  268. created(){
  269. },
  270. mounted(){
  271. this.$set(this,'dialogTableSubDataList',this.subCheckData.subIds);
  272. this.$set(this,'lookInfoType',this.subCheckData.showType);
  273. //下拉框查询
  274. this.getDeptDropList();
  275. this.systemBuildingGetOptList();
  276. this.laboratoryTypeConfigGetList();
  277. this.laboratoryLevelConfigGetLevelTitleList();
  278. this.laboratorySubRelInfoGetHazardTypeList();
  279. this.subResetQueryLeft();
  280. this.subResetQueryRight();
  281. },
  282. methods:{
  283. //弹窗关闭
  284. addDialogOff(){
  285. this.$parent.subCheckButton(4)
  286. },
  287. //确定按钮
  288. addUserButton(){
  289. let self = this;
  290. if(!this.dialogTableSubDataList[0]){
  291. this.msgError('请勾选实验室')
  292. return
  293. }
  294. //实验室选择页面确定
  295. // let list = [];
  296. let ids = [];
  297. for(let o=0;o<self.dialogTableSubDataList.length;o++){
  298. ids.push(self.dialogTableSubDataList[o])
  299. // let obj = {
  300. // subId:self.dialogTableSubDataList[o].subId,
  301. // subjectName:self.dialogTableSubDataList[o].subjectName,
  302. // typeId:self.dialogTableSubDataList[o].typeId,
  303. // levelId:self.dialogTableSubDataList[o].levelId,
  304. // collegeName:self.dialogTableSubDataList[o].collegeName,
  305. // };
  306. // list.push(obj)
  307. }
  308. // console.log('list',list)
  309. this.$parent.subCheckButton(3,ids);
  310. },
  311. //查询
  312. subHandleQueryLeft(){
  313. this.$set(this.subQueryParamsLeft,'page',1);
  314. this.subGetListLeft();
  315. },
  316. //重置
  317. subResetQueryLeft(){
  318. this.$set(this,'subQueryParamsLeft',{
  319. page:1,
  320. pageSize:20,
  321. typeId:"",
  322. levelId:"",
  323. deptId:"",
  324. searchValue:"",
  325. filtType:1
  326. });
  327. this.subHandleQueryLeft();
  328. },
  329. //查询接口
  330. subGetListLeft(){
  331. let self = this;
  332. let leftObj = JSON.parse(JSON.stringify(this.subQueryParamsLeft));
  333. leftObj.selectedSubIds = [];
  334. for(let i=0;i<self.dialogTableSubDataList.length;i++){
  335. leftObj.selectedSubIds.push(self.dialogTableSubDataList[i]);
  336. }
  337. laboratorySubRelInfoConditionSubjectInfo(leftObj).then(response => {
  338. this.subTotalLeft = response.data.total;
  339. this.subTableListLeft = response.data.records;
  340. });
  341. },
  342. //查询
  343. subHandleQueryRight(){
  344. this.$set(this.subQueryParamsRight,'page',1);
  345. this.subGetListRight();
  346. },
  347. //重置
  348. subResetQueryRight(){
  349. this.$set(this,'subQueryParamsRight',{
  350. page:1,
  351. pageSize:20,
  352. typeId:"",
  353. levelId:"",
  354. deptId:"",
  355. searchValue:"",
  356. filtType:2
  357. });
  358. this.subHandleQueryRight();
  359. },
  360. //查询接口
  361. subGetListRight(){
  362. let self = this;
  363. let rightObj = JSON.parse(JSON.stringify(this.subQueryParamsRight));
  364. rightObj.subIds = [];
  365. for(let i=0;i<self.dialogTableSubDataList.length;i++){
  366. rightObj.subIds.push(self.dialogTableSubDataList[i]);
  367. }
  368. laboratorySubRelInfoConditionSubjectInfo(rightObj).then(response => {
  369. this.subTotalRight = response.data.total;
  370. this.subTableListRight = response.data.records;
  371. });
  372. },
  373. //实验室穿梭按钮
  374. subArrowButton(type){
  375. if(type == 1){
  376. if(this.$refs.rightSubTable.selection[0]){
  377. let list = JSON.parse(JSON.stringify(this.dialogTableSubDataList));
  378. let subIdsRight = JSON.parse(JSON.stringify(this.$refs.rightSubTable.selection))
  379. for(let i=0;i<subIdsRight.length;i++){
  380. for(let s=0;s<list.length;s++){
  381. if(subIdsRight[i].subId == list[s]){
  382. list.splice(s,1);
  383. s--
  384. }
  385. }
  386. }
  387. this.$set(this,'dialogTableSubDataList',list);
  388. this.$refs.rightSubTable.clearSelection();
  389. this.subHandleQueryLeft();
  390. this.subHandleQueryRight();
  391. }else{
  392. this.msgError('请先勾选右侧列表')
  393. }
  394. }else if(type == 2){
  395. if(this.$refs.leftSubTable.selection[0]){
  396. let list = JSON.parse(JSON.stringify(this.dialogTableSubDataList));
  397. let subIdsLeft = JSON.parse(JSON.stringify(this.$refs.leftSubTable.selection))
  398. for(let i=0;i<subIdsLeft.length;i++){
  399. // let obj = {
  400. // subId:subIdsLeft[i].subId,
  401. // subjectName:subIdsLeft[i].subName,
  402. // typeId:subIdsLeft[i].typeId,
  403. // levelId:subIdsLeft[i].levelId,
  404. // collegeName:subIdsLeft[i].deptName,
  405. // }
  406. // list.push(obj);
  407. list.push(subIdsLeft[i].subId);
  408. }
  409. this.$set(this,'dialogTableSubDataList',list);
  410. this.$refs.leftSubTable.clearSelection();
  411. this.subHandleQueryLeft();
  412. this.subHandleQueryRight();
  413. }else{
  414. this.msgError('请先勾选左侧列表')
  415. }
  416. }
  417. },
  418. /*===记录勾选数据===
  419. 需要再el-table 添加 :row-key="getRowKeys"
  420. 需要在selection 添加 :reserve-selection="true"
  421. */
  422. getSubRowKeys(row) {
  423. return row.subId
  424. },
  425. subChangeLeft(selection){
  426. this.subNumLeft = selection.length;
  427. this.subIdsLeft = selection.map(item => item.subId);
  428. },
  429. subChangeRight(selection){
  430. this.subNumRight = selection.length;
  431. this.subIdsRight = selection.map(item => item.subId);
  432. },
  433. //学院下拉列表
  434. getDeptDropList(){
  435. getDeptDropList({level:2,deptType:1}).then(response => {
  436. this.$set(this,'deptSelectList',response.data);
  437. });
  438. },
  439. //楼栋下拉列表
  440. systemBuildingGetOptList(){
  441. systemBuildingGetOptList({type:2}).then(response => {
  442. this.$set(this,'buildSelectList',response.data);
  443. });
  444. },
  445. //分类下拉列表
  446. laboratoryTypeConfigGetList(){
  447. laboratoryTypeConfigGetList({}).then(response => {
  448. this.$set(this,'classTypeList',response.data);
  449. });
  450. },
  451. //分级下拉列表
  452. laboratoryLevelConfigGetLevelTitleList(){
  453. laboratoryLevelConfigGetLevelTitleList({}).then(response => {
  454. this.$set(this,'classifiedList',response.data);
  455. });
  456. },
  457. //危险源下拉列表
  458. laboratorySubRelInfoGetHazardTypeList(){
  459. laboratorySubRelInfoGetHazardTypeList().then(response => {
  460. this.$set(this,'hazardTypeList',response.data);
  461. });
  462. },
  463. },
  464. }
  465. </script>
  466. <style scoped lang="scss">
  467. .inspectionPlan-dialog-box{
  468. .el-dialog__body{
  469. padding:20px 0 20px 30px;
  470. }
  471. .inspectionPlan-dialog-sub-box{
  472. display: flex;
  473. overflow: hidden;
  474. height:520px;
  475. .el-table__empty-text{
  476. background-size: 30%!important;
  477. }
  478. .dept-table-title-box{
  479. display: flex;
  480. padding:0 20px;
  481. background: rgba(1,131,250,0.1);
  482. p{
  483. flex:1;
  484. color:#0183FA;
  485. font-size:16px;
  486. line-height:40px;
  487. }
  488. p:nth-child(1){
  489. text-align: left;
  490. }
  491. p:nth-child(2){
  492. text-align: right;
  493. }
  494. }
  495. .dept-table-max-box{
  496. border: 1px solid #e0e0e0;
  497. flex:1;
  498. display: flex;
  499. flex-direction: column;
  500. overflow: hidden;
  501. padding:20px;
  502. .form-index{
  503. .el-input__inner{
  504. border-right:none;
  505. padding-right:0;
  506. }
  507. .el-input-group__append{
  508. background: #fff;
  509. cursor: pointer;
  510. padding:0 10px;
  511. }
  512. }
  513. input{
  514. border: 1px solid #DCDFE6;
  515. }
  516. }
  517. .left-max-box{
  518. height:520px;
  519. display: flex;
  520. flex-direction: column;
  521. overflow: hidden;
  522. flex:1;
  523. }
  524. .right-max-box{
  525. height:520px;
  526. display: flex;
  527. flex-direction: column;
  528. overflow: hidden;
  529. flex:1;
  530. }
  531. .center-box{
  532. width:70px;
  533. p{
  534. display: block;
  535. width:60px;
  536. height:30px;
  537. line-height:30px;
  538. text-align: center;
  539. background: #fff;
  540. color:#0183FA;
  541. border-radius:4px;
  542. border:1px solid #0183FA;
  543. cursor: pointer;
  544. font-size:12px;
  545. }
  546. p:nth-child(1){
  547. margin:260px 5px 0;
  548. }
  549. p:nth-child(2){
  550. margin:14px 5px 0;
  551. }
  552. p:hover{
  553. background: #0183FA;
  554. color:#fff;
  555. border:1px solid #0183FA;
  556. }
  557. }
  558. }
  559. }
  560. </style>