addPage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <!--添加线路-->
  2. <template>
  3. <div class="emergencyEvacuationAddPage scrollbar-box">
  4. <el-form :model="form" ref="form" :rules="rules" >
  5. <div class="top-title-box">
  6. <p>基础信息</p>
  7. <p class="inquire-button-one" @click="upButton">提交</p>
  8. <p class="reset-button-one" @click="backPage">返回</p>
  9. </div>
  10. <div class="info-max-box">
  11. <el-row>
  12. <el-col :span="5">
  13. <el-form-item label="楼栋">
  14. <el-input
  15. v-model="lou"
  16. placeholder="请选择楼栋"
  17. disabled
  18. clearable
  19. size="small"/>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="5">
  23. <el-form-item label="楼层">
  24. <el-input
  25. v-model="cen"
  26. disabled
  27. placeholder="请选择楼层"
  28. clearable
  29. size="small"/>
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="5">
  33. <el-form-item label="路径类别" prop="lightDirection">
  34. <template>
  35. <el-radio v-model="form.lightDirection" :label="1">向左疏散</el-radio>
  36. <el-radio v-model="form.lightDirection" :label="2">向右疏散</el-radio>
  37. </template>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. </div>
  42. <div class="top-title-box">
  43. <p>路线规划</p>
  44. </div>
  45. <div class="map-big-box">
  46. <div class="map-min-box">
  47. <div class="map-min-for-box" :class="item.checkType?'map-min-for-box-color':''"
  48. v-for="(item,index) in fjList" :key="index">
  49. <p><i v-if="!item.checkType&&item.subjectId != -1" class="el-icon-circle-plus-outline" @click="addItem(item)"></i></p>
  50. <p>{{item.room}}</p>
  51. </div>
  52. <img class="map-min-img" src="@/assets/ZDimages/icon_sjt.gif">
  53. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif">
  54. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif">
  55. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif">
  56. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif">
  57. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif">
  58. </div>
  59. </div>
  60. <div class="top-title-box" style="margin-bottom:30px;">
  61. <p>疏散指示灯</p>
  62. </div>
  63. <p v-if="!form.labExitLineJoinList[0]" style="text-align: center;line-height:100px;color:#999;font-size:16px;">请添加实验室</p>
  64. <el-row class="for-box" v-for="(item,index) in form.labExitLineJoinList" :key="index" :gutter="24">
  65. <el-col :span="5">
  66. <el-form-item :label="'实验室'+(index+1)" label-width="90px">
  67. <el-input
  68. v-model="item.room"
  69. disabled
  70. placeholder="请选择实验室"
  71. clearable
  72. size="small"
  73. />
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="5">
  77. <el-form-item label="绑定继电器" :prop="'labExitLineJoinList.'+ index +'.relayCode'" :rules="rules.relayCode" label-width="110px">
  78. <el-input
  79. v-model="item.relayCode"
  80. placeholder="请输入继电器"
  81. clearable
  82. size="small"
  83. maxlength="20"
  84. />
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="5">
  88. <el-form-item label="继电器位置" :prop="'labExitLineJoinList.'+ index +'.relayBit'" :rules="rules.relayBit" label-width="110px">
  89. <el-select v-model="item.relayBit" placeholder="请选择继电器位置">
  90. <el-option
  91. v-for="item in relayList"
  92. :key="item.value"
  93. :label="item.label"
  94. :value="item.value">
  95. </el-option>
  96. </el-select>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :span="5">
  100. <el-form-item label="序号" :prop="'labExitLineJoinList.'+ index +'.lightOrder'" :rules="rules.lightOrder">
  101. <el-input-number
  102. v-model="item.lightOrder"
  103. placeholder="请输入序号"
  104. clearable
  105. :min="0"
  106. :max="100"
  107. />
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="2">
  111. <p class="reset-button-one" @click="delItem(item,index)">删除</p>
  112. </el-col>
  113. </el-row>
  114. </el-form>
  115. </div>
  116. </template>
  117. <script>
  118. import { lablayout,addExitJoin } from "@/api/laboratory/emergencyEvacuation";
  119. export default {
  120. name: 'emergencyEvacuationAddPage',
  121. props: {
  122. propsData:{},
  123. },
  124. data() {
  125. return {
  126. lou:"环境学院-祈福楼",
  127. cen:"环境与气象研究所",
  128. //下啦选项
  129. options:[],
  130. //继电器路数数据
  131. relayList:[
  132. {label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},
  133. {label:"6",value:"6"},{label:"7",value:"77"},{label:"8",value:"8"},{label:"9",value:"9"},{label:"10",value:"10"},
  134. ],
  135. form:{
  136. lightDirection:1,
  137. labExitLineJoinList:[],
  138. },
  139. // 表单校验
  140. rules: {
  141. lightDirection: [
  142. { required: true, message: "请选择路径类别", trigger: "blur" }
  143. ],
  144. // room: [
  145. // { required: true, message: "请选择实验室", trigger: "blur" }
  146. // ],
  147. relayCode: [
  148. { required: true, message: "请输入继电器", trigger: "blur" },
  149. { required: true, message: "请输入继电器", validator: this.spaceJudgment, trigger: "blur" }
  150. ],
  151. relayBit: [
  152. { required: true, message: "请选择继电器位置", trigger: "blur" }
  153. ],
  154. lightOrder: [
  155. { required: true, message: "请输入序号", trigger: "blur" },
  156. { required: true, message: "请输入序号", validator: this.spaceJudgment, trigger: "blur" }
  157. ],
  158. },
  159. fjList:[],
  160. }
  161. },
  162. created() {
  163. this.lablayout();
  164. },
  165. mounted(){
  166. },
  167. methods: {
  168. upButton(){
  169. let self = this;
  170. this.$confirm('是否确认提交?', "", {
  171. confirmButtonText: "确定",
  172. cancelButtonText: "取消",
  173. type: "warning"
  174. }).then(function() {
  175. self.upData();
  176. }).then(() => {}).catch(() => {});
  177. },
  178. //提交
  179. upData(){
  180. let self = this;
  181. if(!self.form.labExitLineJoinList[0]){
  182. this.msgError("请添加实验室")
  183. return
  184. }
  185. this.$refs["form"].validate(valid => {
  186. if (valid) {
  187. let list = [];
  188. for(let i=0;i<self.form.labExitLineJoinList.length;i++){
  189. let minObj = {
  190. subjectId:self.form.labExitLineJoinList[i].subjectId,
  191. relayCode:self.form.labExitLineJoinList[i].relayCode,
  192. relayBit:self.form.labExitLineJoinList[i].relayBit,
  193. lightOrder:self.form.labExitLineJoinList[i].lightOrder,
  194. }
  195. list.push(minObj);
  196. }
  197. let obj = {
  198. lineDeptId:"137",
  199. buildId:"5",
  200. lightDirection:this.form.lightDirection,
  201. lineJoinList:list
  202. };
  203. addExitJoin(obj).then(response => {
  204. this.msgSuccess("操作成功")
  205. this.backPage();
  206. });
  207. }
  208. })
  209. },
  210. //返回
  211. backPage(){
  212. this.$parent.pageTypeClick(1);
  213. },
  214. addItem(item){
  215. let self = this;
  216. let num = 0;
  217. for(let i=0;i<self.form.labExitLineJoinList.length;i++){
  218. if(self.form.labExitLineJoinList.subjectId == item.subjectId){
  219. num++
  220. }
  221. }
  222. if(num>0){
  223. this.msgError("该实验室已添加");
  224. return
  225. }
  226. let obj = {
  227. room:item.room,
  228. subjectId:item.subjectId,
  229. relayCode:"",
  230. relayBit:"",
  231. lightOrder:"",
  232. }
  233. this.form.labExitLineJoinList.push(obj);
  234. item.checkType = true;
  235. this.$forceUpdate();
  236. },
  237. delItem(item,index){
  238. console.log("index",index);
  239. let self = this;
  240. for(let i=0;i<self.fjList.length;i++){
  241. if(self.fjList[i].subjectId == item.subjectId){
  242. self.fjList[i].checkType = false;
  243. }
  244. }
  245. this.form.labExitLineJoinList.splice(index,1);
  246. this.$forceUpdate();
  247. },
  248. //获取层实验室数据
  249. lablayout(){
  250. let self = this;
  251. let id = 137;
  252. lablayout(id).then(response => {
  253. for(let i=0;i<response.data.length;i++){
  254. if(response.data[i].id == 5){
  255. for(let o=0;o<response.data[i].list.length;o++){
  256. response.data[i].list[o].checkType = false;
  257. }
  258. self.fjList = response.data[i].list;
  259. }
  260. }
  261. if(self.propsData.id){
  262. for(let o=0;o<self.propsData.labExitLineJoinList.length;o++){
  263. for(let i=0;i<self.fjList.length;i++){
  264. if(self.propsData.labExitLineJoinList[o].subjectId == self.fjList[i].subjectId){
  265. self.fjList[i].checkType = true;
  266. }
  267. }
  268. }
  269. this.$set(this,'form',this.propsData);
  270. }
  271. });
  272. },
  273. }
  274. }
  275. </script>
  276. <style scoped lang="scss">
  277. .emergencyEvacuationAddPage{
  278. flex:1;
  279. display: flex;
  280. flex-direction: column;
  281. overflow-y:scroll;
  282. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  283. border-radius:10px;
  284. padding:20px;
  285. p{
  286. margin:0;
  287. }
  288. .top-title-box{
  289. display: flex;
  290. border-bottom:1px solid #e0e0e0;
  291. p:nth-child(1){
  292. flex:1;
  293. line-height:20px;
  294. font-size:18px;
  295. padding:10px 0 30px;
  296. color:#0045AF;
  297. }
  298. p:nth-child(2){
  299. margin-right:20px;;
  300. font-size:14px;
  301. }
  302. }
  303. .info-max-box{
  304. margin:30px 0 0 30px;
  305. }
  306. .map-big-box{
  307. width:1410px;
  308. height:545px;
  309. margin:20px auto 20px;
  310. border:1px solid #E0E0E0;
  311. .map-min-box{
  312. height:505px;
  313. width:1133px;
  314. margin:20px auto;
  315. background: url("../../../../assets/ZDimages/icon_bj_syspmtcy_jinan.png");
  316. position: relative;
  317. .map-min-for-box{
  318. overflow: hidden;
  319. display: inline-block;
  320. background: rgba(0,189,255,0.3);
  321. p:nth-child(1){
  322. text-align: center;
  323. height:80px;
  324. i{
  325. cursor: pointer;
  326. font-size:26px;
  327. line-height:80px;
  328. color: rgb(0,189,255);
  329. margin:0 auto;
  330. }
  331. }
  332. p:nth-child(2){
  333. text-align: center;
  334. line-height:20px;
  335. font-size:16px;
  336. color:#333;
  337. }
  338. }
  339. .map-min-for-box-color{
  340. background: rgba(0,189,255,0.3);
  341. }
  342. .map-min-for-box:nth-child(1){
  343. margin:4px 143px 0 0;
  344. width:162px;
  345. height:162px;
  346. }
  347. .map-min-for-box:nth-child(2){
  348. margin:4px 0 0 0;
  349. width:101px;
  350. height:162px;
  351. }
  352. .map-min-for-box:nth-child(3){
  353. margin:4px 0 0 0;
  354. width:101px;
  355. height:162px;
  356. }
  357. .map-min-for-box:nth-child(4){
  358. margin:4px 0 0 0;
  359. width:100px;
  360. height:162px;
  361. }
  362. .map-min-for-box:nth-child(5){
  363. margin:4px 0 0 0;
  364. width:100px;
  365. height:162px;
  366. }
  367. .map-min-for-box:nth-child(6){
  368. margin:4px 0 0 0;
  369. width:100px;
  370. height:162px;
  371. }
  372. .map-min-for-box:nth-child(7){
  373. margin:4px 0 0 0;
  374. width:100px;
  375. height:162px;
  376. }
  377. .map-min-for-box:nth-child(8){
  378. margin:4px 60px 0 0;
  379. width:100px;
  380. height:162px;
  381. }
  382. .map-min-for-box:nth-child(9){
  383. margin: 90px 0 0 0;
  384. width: 92px;
  385. height: 240px;
  386. line-height:230px;
  387. }
  388. .map-min-for-box:nth-child(10){
  389. margin: 90px 0 0 0;
  390. width: 107px;
  391. height: 240px;
  392. line-height:230px;
  393. }
  394. .map-min-for-box:nth-child(11){
  395. margin: 90px 0 0 0;
  396. width: 107px;
  397. height: 240px;
  398. line-height:230px;
  399. }
  400. .map-min-for-box:nth-child(12){
  401. margin: 90px 0 0 0;
  402. width: 100px;
  403. height: 240px;
  404. line-height:230px;
  405. }
  406. .map-min-for-box:nth-child(13){
  407. margin: 90px 0 0 0;
  408. width: 100px;
  409. height: 240px;
  410. line-height:230px;
  411. }
  412. .map-min-for-box:nth-child(14){
  413. margin: 90px 0 0 0;
  414. width: 100px;
  415. height: 240px;
  416. line-height:230px;
  417. }
  418. .map-min-for-box:nth-child(15){
  419. margin: 90px 0 0 0;
  420. width: 100px;
  421. height: 240px;
  422. line-height:230px;
  423. }
  424. .map-min-for-box:nth-child(16){
  425. margin: 90px 0 0 0;
  426. width: 100px;
  427. height: 240px;
  428. line-height:230px;
  429. }
  430. .map-min-for-box:nth-child(17){
  431. margin: 90px 0 0 0;
  432. width: 100px;
  433. height: 240px;
  434. line-height:230px;
  435. }
  436. .map-min-for-box:nth-child(18){
  437. margin: 90px 60px 0 0;
  438. width: 100px;
  439. height: 240px;
  440. line-height:230px;
  441. }
  442. .map-min-img{
  443. position: absolute;
  444. width:40px;
  445. height:28px;
  446. }
  447. .map-min-img:nth-child(19){
  448. top: 128px;
  449. left: 175px;
  450. }
  451. .map-min-img:nth-child(20){
  452. top: 194px;
  453. left: 231px;
  454. }
  455. .map-min-img:nth-child(21){
  456. top: 194px;
  457. left: 540px;
  458. }
  459. .map-min-img:nth-child(22){
  460. top: 194px;
  461. left: 630px;
  462. }
  463. .map-min-img:nth-child(23){
  464. top: 194px;
  465. left: 940px;
  466. }
  467. .map-min-img:nth-child(24){
  468. top: 194px;
  469. left: 1030px;
  470. }
  471. }
  472. }
  473. .for-box{
  474. margin:0 ;
  475. }
  476. }
  477. </style>