index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <div class="app-container subject">
  3. <div class="page-container subject-page" v-if="pageType == 1">
  4. <div class="left-subject-list">
  5. <div class="page-form-title-box">
  6. <el-form :model="queryParams" ref="queryForm" :inline="true">
  7. <el-form-item label="" prop="searchValue">
  8. <el-input
  9. v-model="queryParams.searchValue"
  10. placeholder="实验室/房间号"
  11. clearable
  12. maxlength="10"
  13. style="width:150px;"
  14. />
  15. </el-form-item>
  16. <el-form-item label="" prop="deptId">
  17. <el-select v-model="queryParams.deptId" placeholder="二级单位" style="width:140px;">
  18. <el-option
  19. v-for="dict in deptOptions"
  20. :key="dict.deptId"
  21. :label="dict.deptName"
  22. :value="dict.deptId"
  23. ></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="" prop="buildId">
  27. <el-select v-model="queryParams.buildId" placeholder="楼栋" style="width:140px;">
  28. <el-option
  29. v-for="dict in buildOptions"
  30. :key="dict.id"
  31. :label="dict.name"
  32. :value="dict.id"
  33. ></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="" prop="typeId">
  37. <el-select v-model="queryParams.typeId" placeholder="安全分类" style="width:140px;">
  38. <el-option
  39. v-for="dict in typeList"
  40. :key="dict.typeId"
  41. :label="dict.typeName"
  42. :value="dict.typeId"
  43. ></el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="" prop="levelId">
  47. <el-select v-model="queryParams.levelId" placeholder="安全分级" style="width:140px;">
  48. <el-option
  49. v-for="dict in levelList"
  50. :key="dict.levelId"
  51. :label="dict.levelName"
  52. :value="dict.levelId"
  53. ></el-option>
  54. </el-select>
  55. </el-form-item>
  56. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  57. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  58. <el-dropdown @command="commandButton" style="float: right;">
  59. <p class="page-submit-common-style-button" style="width:105px;"
  60. >操作<span class="el-icon-arrow-down" style="margin-left:10px;"></span></p>
  61. <el-dropdown-menu slot="dropdown">
  62. <el-dropdown-item :command="{command:1}" v-hasPermiRouter="['system:subject:add']">新增</el-dropdown-item>
  63. <!--<el-dropdown-item :command="{command:2}">关联配置</el-dropdown-item>-->
  64. <!--<el-dropdown-item :command="{command:3}">准入配置</el-dropdown-item>-->
  65. <el-dropdown-item :command="{command:4}">下载二维码</el-dropdown-item>
  66. </el-dropdown-menu>
  67. </el-dropdown>
  68. <el-form-item v-hasPermiRouter="['system:subject:import']" style="float: right;">
  69. <import-component :importConfig="importConfig"></import-component>
  70. </el-form-item>
  71. </el-form>
  72. </div>
  73. <div class="page-content-box">
  74. <el-table class="table-box" ref="table-box" border :data="dataList" highlight-current-row
  75. @select-all="handleSelectionChange" @select="handleSelectionChange" :row-key="getRowKeys"
  76. @current-change="handleCurrentChange">
  77. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  78. <el-table-column label="排序" align="left" prop="orderNum" width="75">
  79. <template slot-scope="scope">
  80. <el-input maxlength="4" type="text" oninput="value=value.replace(/[^0-9.]/g,'')"
  81. v-model="scope.row.orderNum" @focus="liveSort(scope.row)"
  82. @blur="editSort(scope.row)">
  83. </el-input>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="实验室名称" align="left" prop="subName" show-overflow-tooltip/>
  87. <el-table-column label="房间号" align="left" prop="roomName" width="100" show-overflow-tooltip>
  88. <template slot-scope="scope">
  89. <span>{{scope.row.roomName?scope.row.roomName:'未绑定'}}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="学院" align="left" prop="deptName" width="130" show-overflow-tooltip/>
  93. <el-table-column label="楼栋/楼层" align="left" prop="buildName" width="130" show-overflow-tooltip>
  94. <template slot-scope="scope">
  95. <span>{{scope.row.buildName}}/{{scope.row.floorName}}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="分类/分级" align="left" prop="levelName" width="150" show-overflow-tooltip>
  99. <template slot-scope="scope">
  100. <span>{{scope.row.typeName}}/</span>
  101. <span :style="'color:'+scope.row.levelColor+';'">{{scope.row.levelName}}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="实验室责任人" align="left" prop="adminName" width="120" show-overflow-tooltip/>
  105. <el-table-column label="安全员" align="left" prop="safeUserNames" width="120" show-overflow-tooltip/>
  106. <el-table-column label="操作" align="left" width="140">
  107. <template slot-scope="scope">
  108. <div class="table-button-box">
  109. <p class="table-button-null"></p>
  110. <p class="table-button-p" v-hasPermiRouter="['system:subject:detail']"
  111. @click.stop="clickPage(7,scope.row)">详情</p>
  112. <el-dropdown trigger="click" size="mini" @command="(command) => handleCommand(command, scope.row)">
  113. <p class="table-button-p">更多>></p>
  114. <el-dropdown-menu slot="dropdown" style="margin:0!important;">
  115. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="1"
  116. v-hasPermiRouter="['system:subject:edit']">关联配置
  117. </el-dropdown-item>
  118. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="2"
  119. v-hasPermiRouter="['system:subject:edit']">准入配置
  120. </el-dropdown-item>
  121. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="3"
  122. v-hasPermiRouter="['system:subject:edit']">编辑
  123. </el-dropdown-item>
  124. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="5"
  125. v-hasPermiRouter="['system:subject:edit']">信息牌下载
  126. </el-dropdown-item>
  127. </el-dropdown-menu>
  128. </el-dropdown>
  129. <p class="table-button-null"></p>
  130. </div>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. <pagination
  135. v-show="total>0"
  136. :total="total"
  137. :page.sync="queryParams.page"
  138. :limit.sync="queryParams.pageSize"
  139. @pagination="getList"
  140. />
  141. </div>
  142. </div>
  143. <index-right-page ref="indexRightPage"></index-right-page>
  144. </div>
  145. <!--新增/编辑-->
  146. <add-subject v-if="pageType == 2" :subjectData="subjectData"></add-subject>
  147. <!--准入配置-->
  148. <admission-configuration v-if="pageType == 4" :subjectData="subjectData"></admission-configuration>
  149. <!--关联配置-->
  150. <association-configuration v-if="pageType == 5" :subjectData="subjectData"></association-configuration>
  151. <!--详情-->
  152. <info-page v-if="pageType == 6" :subjectData="subjectData"></info-page>
  153. <!--批量二维码-->
  154. <batchQrCodeDialog ref="batchQrCodeDialog" :batchQrCodeDialogData="batchQrCodeDialogData"></batchQrCodeDialog>
  155. </div>
  156. </template>
  157. <script>
  158. /********************** V3 **********************/
  159. import importComponent from "@/components/importComponent/importComponent.vue";
  160. import batchQrCodeDialog from "@/components/batchQrCodeDialog/batchQrCodeDialog.vue";
  161. import {
  162. getDeptDropList,
  163. systemBuildingGetTreeList,
  164. laboratoryClassTypeGetList,
  165. laboratoryClassLevelGetList,
  166. } from '@/api/commonality/permission'
  167. import {
  168. laboratorySubRelInfoList,
  169. laboratorySubRelInfoGetDetailInfo,
  170. laboratorySubRelInfoGetHazardSubRelInfo,
  171. laboratorySubRelInfoUpdateBySort,
  172. laboratorySubRelInfoUpdateByControl,
  173. laboratoryBoardExportBoardInfo,
  174. } from '@/api/integratedManagement/index'
  175. import indexRightPage from './indexRightPage/indexRightPage.vue'
  176. import addSubject from './addSubject.vue'
  177. import admissionConfiguration from './admissionConfiguration.vue'
  178. import associationConfiguration from './associationConfiguration.vue'
  179. import infoPage from './infoPage.vue'
  180. export default {
  181. name: 'subject',
  182. components: {
  183. importComponent,
  184. addSubject,
  185. admissionConfiguration,
  186. associationConfiguration,
  187. infoPage,
  188. indexRightPage,
  189. batchQrCodeDialog
  190. },
  191. data() {
  192. return {
  193. //批量二维码
  194. batchQrCodeDialogData:{},
  195. //导入数据
  196. importConfig:{
  197. upLoadApi:'/laboratory/subRelInfo/importSubData', //上传接口地址
  198. downloadApi:'/laboratory/subRelInfo/exportSubTemplate', //下载模板接口地址
  199. loseApi:'/laboratory/subRelInfo/exportProblemData', //失败报表接口地址
  200. fileName:'实验室导入模板', //下载模板命名
  201. },
  202. //页面状态
  203. pageType: 1,
  204. // 查询参数
  205. queryParams: {
  206. page: 1,
  207. pageSize: 20,
  208. searchValue: '',
  209. deptId: '',
  210. typeId: '',
  211. levelId: ''
  212. },
  213. // 实验室表格数据
  214. dataList: [],
  215. // 楼栋
  216. buildOptions:[],
  217. // 总条数
  218. total: 0,
  219. //学院列表
  220. deptOptions: [],
  221. //实验室数据
  222. subjectData: {},
  223. // 临时保存排序
  224. orderNum: '',
  225. //分类数据
  226. typeList: [],
  227. //分级数据
  228. levelList: [],
  229. //二维码勾选数据
  230. codeList:'',
  231. }
  232. },
  233. created() {
  234. },
  235. mounted() {
  236. //获取院系列表
  237. this.getDeptDropList()
  238. //获取楼栋列表
  239. this.systemBuildingGetTreeList()
  240. //获取分类列表
  241. this.laboratoryClassTypeGetList()
  242. //获取分级列表
  243. this.laboratoryClassLevelGetList()
  244. //获取列表数据
  245. this.getList()
  246. },
  247. methods: {
  248. //操作按钮
  249. commandButton(item){
  250. if(item.command == 1){
  251. this.clickPage(2);
  252. }else if(item.command == 2){
  253. }else if(item.command == 3){
  254. }else if(item.command == 4){
  255. if(this.codeList.length>0){
  256. let list = [];
  257. this.codeList.forEach((item)=>{
  258. list.push({
  259. code:item.infoId+'&subId='+item.subId,
  260. name:item.subName
  261. })
  262. })
  263. this.$set(this,'batchQrCodeDialogData',{
  264. title:'实验室二维码批量下载', //弹窗名称(非必传)
  265. type:'5', //二维码类型 用于区分二维码功能类型
  266. codeList:list
  267. });
  268. this.$nextTick(function () {
  269. this.$refs['batchQrCodeDialog'].initialize();
  270. })
  271. }else{
  272. this.msgError('请勾选实验室')
  273. }
  274. }
  275. },
  276. // 页面切换
  277. clickPage(type, row) {
  278. if (this.pageType != type) {
  279. if (type == 1) {
  280. //列表页面
  281. this.pageType = type
  282. this.getList()
  283. this.$set(this, 'subjectData', {})
  284. } else if (type == 2) {
  285. //新增页面
  286. this.pageType = type
  287. }else if (type == 7) {
  288. //实验室详情
  289. this.getSubInfo(row,1)
  290. }
  291. }
  292. },
  293. //更多按钮
  294. handleCommand(command, row) {
  295. let self = this
  296. switch (command) {
  297. case '1':
  298. //关联配置
  299. laboratorySubRelInfoGetHazardSubRelInfo({ infoId: row.infoId }).then(response => {
  300. this.$set(this, 'subjectData', response.data)
  301. this.$set(this, 'pageType', 5)
  302. })
  303. break
  304. case '2':
  305. //准入配置
  306. this.pageType = 4
  307. this.$set(this, 'subjectData', row)
  308. break
  309. case '3':
  310. //编辑页面
  311. this.getSubInfo(row,2)
  312. break
  313. case '4':
  314. let text = row.accessControl?'关闭':'开启'
  315. //开启/关闭门禁权限
  316. self.$confirm('是否确认'+text+'实验室准入?', '', {
  317. confirmButtonText: '确定',
  318. cancelButtonText: '取消',
  319. type: 'warning'
  320. }).then(function() {
  321. laboratorySubRelInfoUpdateByControl({
  322. infoId: row.infoId,
  323. accessControl:!row.accessControl
  324. }).then(response => {
  325. self.msgSuccess(response.message)
  326. self.getList()
  327. })
  328. }).then(() => {
  329. }).catch(() => {
  330. })
  331. break
  332. case '5':
  333. laboratoryBoardExportBoardInfo({
  334. labId: row.subId,
  335. }).then(response => {
  336. })
  337. break
  338. default:
  339. break
  340. }
  341. },
  342. //获取实验室详情 type:1.详情 2.编辑
  343. getSubInfo(row,type){
  344. laboratorySubRelInfoGetDetailInfo({ infoId: row.infoId }).then(response => {
  345. let classifyList = [];
  346. for(let i=0;i<response.data.labInfoBrandModels.length;i++){
  347. if(response.data.labInfoBrandModels[i].privateList.length>0 && (response.data.labInfoBrandModels[i].brandType==1||response.data.labInfoBrandModels[i].brandType==2)){
  348. classifyList.push(response.data.labInfoBrandModels[i]);
  349. }
  350. }
  351. response.data.classifyList = classifyList;
  352. if(response.data.safeUserList[0]){
  353. response.data.safeUserId = [];
  354. response.data.safeUserList.forEach((item)=>{
  355. response.data.safeUserId.push(item.safeUserId);
  356. })
  357. }
  358. this.$set(this, 'subjectData', response.data)
  359. if(type == 1){
  360. //详情
  361. this.$set(this, 'pageType', 6)
  362. }else if(type == 2){
  363. //编辑
  364. this.$set(this, 'pageType', 2)
  365. }
  366. })
  367. },
  368. //保存当前排序
  369. liveSort(row) {
  370. let obj = {
  371. orderNum: row.orderNum
  372. }
  373. this.orderNum = JSON.parse(JSON.stringify(obj))
  374. },
  375. //编辑排序
  376. editSort(row) {
  377. let self = this
  378. if (row.orderNum != this.orderNum.orderNum) {
  379. self.$confirm('是否确认修改排序?', '', {
  380. confirmButtonText: '确定',
  381. cancelButtonText: '取消',
  382. type: 'warning'
  383. }).then(function() {
  384. let obj = {
  385. infoId: row.infoId,
  386. orderNum: row.orderNum
  387. }
  388. laboratorySubRelInfoUpdateBySort(obj).then(response => {
  389. self.msgSuccess('修改成功')
  390. self.getList()
  391. })
  392. }).then(() => {
  393. }).catch(() => {
  394. let obj = JSON.parse(JSON.stringify(self.orderNum))
  395. row.orderNum = obj.orderNum
  396. })
  397. }
  398. },
  399. /** 搜索按钮操作 */
  400. handleQuery() {
  401. this.$set(this.queryParams,'page',1);
  402. this.$set(this,'codeList','');
  403. this.$refs['table-box'].clearSelection();
  404. this.getList()
  405. },
  406. /** 重置按钮操作 */
  407. resetQuery() {
  408. this.$set(this, 'queryParams', {
  409. page: 1,
  410. pageSize: 20,
  411. searchValue: '',
  412. deptId: '',
  413. buildId: '',
  414. typeId: '',
  415. levelId: ''
  416. })
  417. this.$set(this,'codeList','');
  418. this.$refs['table-box'].clearSelection();
  419. this.getList()
  420. },
  421. //选中实验室
  422. handleCurrentChange(val) {
  423. this.$refs.indexRightPage.initialize(val);
  424. },
  425. /** 查询实验室列表 */
  426. getList() {
  427. laboratorySubRelInfoList(this.queryParams).then(response => {
  428. this.$set(this,'dataList',response.data.records);
  429. this.$set(this,'total',response.data.total);
  430. if (response.data.records[0]) {
  431. this.$refs['table-box'].setCurrentRow(response.data.records[0])
  432. }
  433. })
  434. },
  435. /** 查询学院列表 */
  436. getDeptDropList() {
  437. getDeptDropList({ deptName: '', level: 2, deptType: 1 }).then(response => {
  438. this.$set(this, 'deptOptions', response.data)
  439. })
  440. },
  441. //查询楼栋楼层
  442. systemBuildingGetTreeList(){
  443. systemBuildingGetTreeList({}).then(response => {
  444. let newList = [];
  445. if (response.data[0]) {
  446. let list = this.forBuildFloor(response.data);
  447. for(let i=0;i<list.length;i++){
  448. if(list[i].buildFloorVoList){
  449. for(let o=0;o<list[i].buildFloorVoList.length;o++){
  450. if(list[i].buildFloorVoList[o].buildFloorVoList){
  451. newList.push(list[i].buildFloorVoList[o])
  452. }
  453. }
  454. }
  455. }
  456. }
  457. this.$set(this, 'buildOptions', newList)
  458. })
  459. },
  460. //处理楼栋楼层数据
  461. forBuildFloor(list){
  462. let self = this;
  463. for(let i=0;i<list.length;i++){
  464. if(list[i].buildFloorVoList){
  465. if(list[i].buildFloorVoList[0]){
  466. list[i].buildFloorVoList = self.forBuildFloor(list[i].buildFloorVoList);
  467. }else{
  468. delete list[i].buildFloorVoList;
  469. }
  470. }else{
  471. delete list[i].buildFloorVoList;
  472. }
  473. }
  474. return list
  475. },
  476. //查询安全分级
  477. laboratoryClassLevelGetList() {
  478. laboratoryClassLevelGetList({}).then(response => {
  479. this.$set(this, 'levelList', response.data)
  480. })
  481. },
  482. //查询安全分类
  483. laboratoryClassTypeGetList() {
  484. laboratoryClassTypeGetList({}).then(response => {
  485. this.$set(this, 'typeList', response.data)
  486. })
  487. },
  488. //****************************************导入功能**************************************
  489. // 多选框选中数据
  490. handleSelectionChange(selection) {
  491. let self = this;
  492. if(selection[40]){
  493. this.$refs['table-box'].clearSelection();
  494. this.$nextTick(()=>{
  495. let ids = [];
  496. for(let i=0;i<selection.length;i++){
  497. if(i<40){
  498. ids.push(selection[i]);
  499. self.$refs['table-box'].toggleRowSelection(selection[i],true);
  500. }
  501. }
  502. self.$set(self,'codeList',ids);
  503. })
  504. this.msgError('最多勾选40条')
  505. }else{
  506. this.$set(this,'codeList',selection.map(item => item));
  507. }
  508. },
  509. /*===记录勾选数据===
  510. 需要再el-table 添加 :row-key="getRowKeys"
  511. 需要在selection 添加 :reserve-selection="true"
  512. */
  513. getRowKeys(row) {
  514. return row.subId
  515. },
  516. },
  517. }
  518. </script>
  519. <style scoped lang="scss">
  520. .subject {
  521. flex:1;
  522. display: flex!important;
  523. flex-direction: column;
  524. overflow: hidden;
  525. box-shadow: none;
  526. margin:0;
  527. .subject-page {
  528. flex:1;
  529. display: flex;
  530. flex-direction: row;
  531. overflow: hidden;
  532. .left-subject-list {
  533. flex: 1;
  534. width: 1143px;
  535. display: flex;
  536. flex-direction: column;
  537. overflow: hidden;
  538. box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
  539. border-radius: 10px 10px 10px 10px;
  540. margin: 5px 7px 20px 10px;
  541. .page-content-box {
  542. .table-box{
  543. ::v-deep .el-input--medium .el-input__inner {
  544. height: 26px;
  545. line-height: 26px;
  546. width: 55px;
  547. text-align: center;
  548. padding: 0 10px;
  549. }
  550. }
  551. }
  552. }
  553. }
  554. ::v-deep .el-table__row {
  555. td:nth-child(1) {
  556. padding: 0;
  557. }
  558. }
  559. ::v-deep .el-table__row{
  560. cursor: pointer;
  561. }
  562. }
  563. </style>