indexOne.vue 9.9 KB

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