indexOne.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <!--疏散路线(针对矿大增加了楼栋与楼层的选择)-->
  2. <template>
  3. <div class="app-container emergencyEvacuation">
  4. <div class="emergencyEvacuation-page scrollbar-box" v-if="pageType == 1">
  5. <div class="top-title-box building-box">
  6. <el-select v-model="buildingId" @change="selectChange" placeholder="请选择">
  7. <el-option
  8. v-for="item in buildingList"
  9. :key="item.value"
  10. :label="item.label"
  11. :value="item.value">
  12. </el-option>
  13. </el-select>
  14. <!--<i class="el-icon-arrow-down"></i>-->
  15. </div>
  16. <div class="for-button-box">
  17. <div class="for-button-min-box">
  18. <!--楼层选择器-->
  19. <div :class="buttonId == item.id ?'button-one':'button-two'"
  20. @click="buttonListClick(item.id,index)"
  21. v-for="(item,index) in floorList" :key="index">{{item.name}}
  22. </div>
  23. </div>
  24. <div class="for-button-right-box button-one" @click="pageTypeClick(2)" v-hasPermi="['laboratory:line:add']">新增疏散路线</div>
  25. </div>
  26. <div class="map-big-box" v-if="buttonId == '5'||buttonId == '6'||buttonId == '7'">
  27. <div :class="buttonId == '5'?'map-min-box-1':(buttonId == '6'?'map-min-box-2':(buttonId == '7'?'map-min-box-3':''))">
  28. <div class="map-min-for-box"
  29. v-for="(item,index) in fjList" :key="index">
  30. {{item.room}}
  31. </div>
  32. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif">
  33. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif">
  34. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif">
  35. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif">
  36. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif">
  37. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif">
  38. </div>
  39. </div>
  40. <p v-if="buttonId != '5'&& buttonId != '6'&& buttonId != '7'" style="text-align: center;color:#999;">缺少对应场景地图</p>
  41. <div class="table-box">
  42. <el-table v-loading="loading" border :data="routeList">
  43. <el-table-column label="路径类别" align="left" prop="lightDirection" width="200">
  44. <template slot-scope="scope">
  45. {{scope.row.lightDirection == 1?'向左疏散':(scope.row.lightDirection == 2?'向右疏散':'')}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="实验室" align="left" prop="subNames"/>
  49. <el-table-column label="指示灯数量" align="left" prop="labExitLineJoinList.length" width="200"/>
  50. <el-table-column label="操作" align="center" width="160" v-if="tableButtonType">
  51. <template slot-scope="scope">
  52. <div class="table-button-box">
  53. <p class="table-button-null"></p>
  54. <p class="table-button-p"
  55. v-hasPermiAnd="['laboratory:line:query','laboratory:line:edit']"
  56. @click="laboratoryLine(scope.row)"
  57. >编辑</p>
  58. <p class="table-button-p"
  59. v-hasPermi="['laboratory:line:remove']"
  60. @click="delButton(scope.row)"
  61. >移除</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>
  76. <add-page v-if="pageType == 2"
  77. :propsData="propsData"
  78. :propsList="propsList"></add-page>
  79. </div>
  80. </template>
  81. <script>
  82. import { buildIdList,lablayout,laboratoryLine,laboratoryLineDel,getRedis } from "@/api/laboratory/emergencyEvacuation";
  83. import { getBuilding } from "@/api/laboratory/building";
  84. import { treeselectByUser } from "@/api/system/dept";
  85. import addPage from './addPageOne.vue'
  86. export default {
  87. components:{
  88. addPage
  89. },
  90. name: "emergencyEvacuation",
  91. data() {
  92. return {
  93. tableButtonType:this.hasPermiDom(['laboratory:line:query','laboratory:line:edit','laboratory:line:remove']),
  94. pageType:1,
  95. queryParams:{
  96. pageNum:1,
  97. pageSize:20,
  98. },
  99. routeList:[],
  100. loading:false,
  101. total:0,
  102. //组件传参数据
  103. propsData:{},
  104. propsList:{},
  105. //楼栋选择数据
  106. buildingList:[],
  107. buildingId:null,
  108. floorList:[],
  109. buttonId:null,
  110. fjList:[],
  111. }
  112. },
  113. created() {
  114. },
  115. mounted(){
  116. this.treeselectByUser();
  117. },
  118. methods: {
  119. getBuilding(id){
  120. getBuilding(id).then(response => {
  121. // this.$set(this,'floorList',response.data);
  122. // 过滤了三楼
  123. let list = [];
  124. for(let i=0;i<response.data.length;i++){
  125. if(response.data[i].id != 7){
  126. list.push(response.data[i]);
  127. }
  128. }
  129. this.$set(this,'floorList',list);
  130. if(response.data[0]){
  131. this.$set(this,'buttonId',response.data[0].id);
  132. this.$set(this,'fjList',response.data[0].list);
  133. this.getList();
  134. }
  135. })
  136. },
  137. //获取院系/楼层
  138. treeselectByUser(){
  139. treeselectByUser().then(response => {
  140. let list = [];
  141. for(let i=0;i<response.data.length;i++){
  142. if(response.data[i].children){
  143. for(let o=0;o<response.data[i].children.length;o++){
  144. let obj = {
  145. label:response.data[i].label+'-'+response.data[i].children[o].label,
  146. value:response.data[i].children[o].id,
  147. }
  148. list.push(obj);
  149. if(i==0&&o==0){
  150. this.$set(this,'buildingId',response.data[i].children[o].id);
  151. }
  152. }
  153. }
  154. }
  155. this.$set(this,'buildingList',list);
  156. this.getBuilding(this.buildingId);
  157. });
  158. },
  159. // 楼层点击
  160. buttonListClick(id,index){
  161. this.$set(this,'buttonId',id);
  162. this.$set(this,'fjList',this.floorList[index].list);
  163. this.getList();
  164. },
  165. //删除按钮
  166. delButton(item){
  167. let self = this;
  168. this.$confirm('是否确认删除?', "", {
  169. confirmButtonText: "确定",
  170. cancelButtonText: "取消",
  171. type: "warning"
  172. }).then(function() {
  173. self.delItem(item);
  174. }).then(() => {}).catch(() => {});
  175. },
  176. //删除路线
  177. delItem(item){
  178. laboratoryLineDel(item.id).then(response => {
  179. this.msgSuccess("操作成功");
  180. this.getList();
  181. });
  182. },
  183. //获取层线路
  184. getList(){
  185. let id = this.buttonId;
  186. buildIdList(id).then(response => {
  187. this.routeList = response.rows;
  188. this.total = response.total;
  189. });
  190. },
  191. //获取路线详情
  192. laboratoryLine(item){
  193. laboratoryLine(item.id).then(response => {
  194. console.log("resp",response)
  195. this.$set(this,'propsData',response.data)
  196. this.$set(this,'propsList',{
  197. buildingList:this.buildingList,
  198. floorList:this.floorList,
  199. buildingId:this.buildingId,
  200. buttonId:this.buttonId,
  201. })
  202. this.pageType = 2;
  203. });
  204. },
  205. //切换页面状态
  206. pageTypeClick(type){
  207. if(type == 1){
  208. this.pageType = 1;
  209. this.getList();
  210. }else if(type == 2){
  211. this.$set(this,'propsData',{});
  212. this.$set(this,'propsList',{
  213. buildingList:this.buildingList,
  214. floorList:this.floorList,
  215. buildingId:this.buildingId,
  216. buttonId:this.buttonId,
  217. })
  218. this.pageType = 2;
  219. }
  220. },
  221. //选择疏散方向
  222. selectChange(e){
  223. this.$set(this,'buildingId',e);
  224. this.getBuilding(this.buildingId);
  225. },
  226. }
  227. };
  228. </script>
  229. <style scoped lang="scss">
  230. .emergencyEvacuation{
  231. flex:1;
  232. display: flex;
  233. flex-direction: column;
  234. overflow: hidden !important;
  235. .emergencyEvacuation-page{
  236. flex:1;
  237. display: flex;
  238. flex-direction: column;
  239. overflow-y: scroll;
  240. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  241. border-radius:10px;
  242. .top-title-box{
  243. height:80px;
  244. line-height:80px;
  245. margin:0 46px;
  246. border-bottom:1px solid #E0E0E0;
  247. color:#0045AF;
  248. font-size:18px;
  249. i{
  250. margin-left:18px;
  251. }
  252. }
  253. .for-button-box{
  254. margin:26px 86px 26px;
  255. display: flex;
  256. .for-button-min-box{
  257. flex:1;
  258. div{
  259. margin-right:20px!important;
  260. }
  261. }
  262. .for-button-null-box{
  263. flex:1;
  264. }
  265. .for-button-right-box{
  266. }
  267. .button-one{
  268. font-size:14px;
  269. cursor:pointer;
  270. display: inline-block;
  271. text-align: center;
  272. padding:0 20px;
  273. height: 40px;
  274. line-height:40px;
  275. border-radius: 6px;
  276. border: 1px solid #0045af;
  277. color:#ffffff;
  278. background:#0045af;
  279. margin:0;
  280. }
  281. .button-two{
  282. font-size:14px;
  283. cursor:pointer;
  284. display: inline-block;
  285. text-align: center;
  286. padding:0 20px;
  287. height: 40px;
  288. line-height:40px;
  289. border-radius: 6px;
  290. border: 1px solid #DCDFE6;
  291. color:#606266;
  292. font-size: 14px;
  293. background:#ffffff;
  294. margin:0;
  295. }
  296. }
  297. .table-box{
  298. min-height:400px;
  299. display: flex;
  300. flex:1;
  301. flex-direction: column;
  302. margin:20px 20px;
  303. .button-box{
  304. display: flex;
  305. p:nth-child(1){
  306. margin-right:20px;
  307. }
  308. }
  309. }
  310. }
  311. }
  312. </style>
  313. <style lang="scss">
  314. .emergencyEvacuation{
  315. .building-box{
  316. .el-input__inner{
  317. border:none;
  318. color:#0045AF;
  319. font-size:18px;
  320. }
  321. .el-select .el-input .el-select__caret{
  322. font-size:20px;
  323. }
  324. .el-select{
  325. display: flex;
  326. }
  327. }
  328. }
  329. </style>