indexOne.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <!--布局管理(针对矿大增加了楼栋与楼层的选择)-->
  2. <template>
  3. <div class="app-container building">
  4. <div class="left-max-box">
  5. <el-tree :data="deptOptions" :props="defaultProps"
  6. accordion @node-click="handleNodeClick">
  7. </el-tree>
  8. </div>
  9. <div class="right-max-box">
  10. <p class="right-top-title color_33" v-if="rightDataList[0]">{{rightTitle}}</p>
  11. <div class="map-img-box border-solid-color-99" v-if="rightDataList[0]">
  12. <div class="map-max-box" :class="buttonId == 5?'map-max-box-1':(buttonId==6?'map-max-box-2':(buttonId==7?'map-max-box-3':''))" v-for="(item,index) in rightDataList" :key="index" v-if="index == fatherIndex">
  13. <!--<div class="map-max-box map-seven-max-box" v-for="(item,index) in rightDataList" :key="index" v-if="index == fatherIndex">-->
  14. <div class="map-min-box for-box" v-for="(minItem,minIndex) in item.list" :key="minIndex">
  15. <p>{{minItem.isSubject == 1?minItem.room:minItem.room}}</p>
  16. <p @click.stop="shadeClick(minItem)">点击编辑</p>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="carousel" v-if="rightDataList[0]">
  21. <p class="button-box el-icon-arrow-left cursor_hover" @click="minMapButton('left')" v-if="rightDataList[1]"></p>
  22. <div class="for-max-box">
  23. <div class="for-min-box" v-for="(item,index) in rightDataList" :key="index">
  24. <div class="img-box" :class="fatherIndex==index?'border-solid-color-one':'border-solid-color-99'" @click="minMapClick(index)">
  25. <img src="@/assets/ZDimages/kuangdaMap/map1.png" v-if="item.id==5">
  26. <img src="@/assets/ZDimages/kuangdaMap/map2.png" v-if="item.id==6">
  27. <img src="@/assets/ZDimages/kuangdaMap/map3.png" v-if="item.id==7">
  28. </div>
  29. <p>{{item.name}}</p>
  30. </div>
  31. </div>
  32. <p class="button-box el-icon-arrow-right cursor_hover" @click="minMapButton('right')" v-if="rightDataList[1]"></p>
  33. </div>
  34. <img class="null-p-img" src="@/assets/ZDimages/null-data.png" v-if="!rightDataList[0]">
  35. <p class="null-p-text" v-if="!rightDataList[0]">暂无数据</p>
  36. </div>
  37. <el-dialog title="修改房间信息" :visible.sync="open" width="500px" append-to-body>
  38. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  39. <el-form-item label="房间编号" prop="joinUserId">
  40. <el-input v-model="form.room" placeholder="请输入房间编号" />
  41. </el-form-item>
  42. <el-form-item label="房间类型">
  43. <el-radio-group v-model="form.isSubject">
  44. <el-radio label="0">非实验室</el-radio>
  45. <el-radio label="1">实验室</el-radio>
  46. </el-radio-group>
  47. </el-form-item>
  48. </el-form>
  49. <div slot="footer" class="dialog-footer">
  50. <el-button @click="cancel">取 消</el-button>
  51. <el-button type="primary" @click="submitForm">确 定</el-button>
  52. </div>
  53. </el-dialog>
  54. </div>
  55. </template>
  56. <script>
  57. import { getBuilding,listBuilding, updateSubject } from "@/api/laboratory/building";
  58. import { treeselect } from "@/api/system/dept";
  59. export default {
  60. name: "Building",
  61. data() {
  62. return {
  63. // 遮罩层
  64. loading: true,
  65. // 选中数组
  66. ids: [],
  67. // 非单个禁用
  68. single: true,
  69. // 非多个禁用
  70. multiple: true,
  71. // 显示搜索条件
  72. showSearch: true,
  73. // 总条数
  74. total: 0,
  75. // 楼栋表格数据
  76. buildingList: [],
  77. // 弹出层标题
  78. title: "",
  79. // 是否显示弹出层
  80. open: false,
  81. // 查询参数
  82. queryParams: {
  83. pageNum: 1,
  84. pageSize:20,
  85. name: null,
  86. type: null,
  87. parentId: null,
  88. deptId: null,
  89. deptName: null,
  90. userId: null,
  91. },
  92. // 表单参数
  93. form: {
  94. room:"",
  95. isSubject:"",
  96. },
  97. // 表单校验
  98. rules: {
  99. room:[
  100. {required: true, message: '请输入房间编号', trigger: 'blur'},
  101. { required: true, message: "请输入房间编号", validator: this.spaceJudgment, trigger: "blur" }
  102. ],
  103. isSubject:[
  104. {required: true, message: '请选择实验室类型', trigger: 'blur'}
  105. ],
  106. },
  107. //左侧列表数据
  108. deptOptions:[],
  109. defaultProps:{
  110. children: 'children',
  111. label: 'label'
  112. },
  113. //右侧数据
  114. rightDataList:[],
  115. //左侧列表选装状态
  116. fatherIndex:0,
  117. // 楼宇id
  118. buildingId:"",
  119. //楼层id
  120. buttonId:null,
  121. //名称
  122. rightTitle:"",
  123. };
  124. },
  125. created() {
  126. this.getList();
  127. this.getTreeselect();
  128. },
  129. methods: {
  130. //点击修改
  131. shadeClick(item){
  132. if(item){
  133. this.form = {...item};
  134. this.form.isSubject = ''+item.isSubject;
  135. this.$forceUpdate();
  136. this.open = true;
  137. console.log("item",item)
  138. }
  139. },
  140. /** 查询部门下拉树结构 */
  141. getTreeselect() {
  142. this.loading = true;
  143. treeselect().then(response => {
  144. this.deptOptions = response.data;
  145. if(this.deptOptions[0].children){
  146. if(this.deptOptions[0].children[0].children){
  147. this.buildingId = this.deptOptions[0].children[0].children[0].id;
  148. }else{
  149. this.buildingId = this.deptOptions[0].children[0].id;
  150. }
  151. }else{
  152. this.buildingId = this.deptOptions[0].id;
  153. }
  154. this.getBuilding();
  155. this.loading = false;
  156. });
  157. },
  158. //树结构选中
  159. handleNodeClick(data) {
  160. if(!data.children){
  161. console.log(data);
  162. this.buildingId = data.id;
  163. this.getBuilding();
  164. }
  165. },
  166. //获取楼宇数据
  167. getBuilding(){
  168. this.loading = true;
  169. getBuilding(this.buildingId).then(response => {
  170. this.rightDataList = response.data;
  171. this.rightTitle = this.rightDataList[this.fatherIndex].remark +' '+ this.rightDataList[this.fatherIndex].name;
  172. this.buttonId = this.rightDataList[this.fatherIndex].id;
  173. this.loading = false;
  174. });
  175. },
  176. minMapClick(index){
  177. if (this.fatherIndex!=index){
  178. this.fatherIndex = index;
  179. this.rightTitle = this.rightDataList[index].remark +' '+ this.rightDataList[index].name;
  180. this.buttonId = this.rightDataList[index].id;
  181. }
  182. },
  183. minMapButton(type){
  184. if(type=='left'){
  185. if (this.fatherIndex>0){
  186. this.fatherIndex--
  187. }
  188. }else if(type=='right'){
  189. if (this.fatherIndex<this.rightDataList.length-1){
  190. this.fatherIndex++
  191. }
  192. }
  193. this.rightTitle = this.rightDataList[this.fatherIndex].remark +' '+ this.rightDataList[this.fatherIndex].name;
  194. this.$forceUpdate();
  195. },
  196. /** 查询楼栋列表 */
  197. getList() {
  198. this.loading = true;
  199. listBuilding(this.queryParams).then(response => {
  200. this.buildingList = response.rows;
  201. this.total = response.total;
  202. this.loading = false;
  203. });
  204. },
  205. // 取消按钮
  206. cancel() {
  207. this.open = false;
  208. this.reset();
  209. },
  210. // 表单重置
  211. reset() {
  212. this.form = {
  213. room: null,
  214. isSubject: null,
  215. id: null,
  216. };
  217. this.resetForm("form");
  218. },
  219. /** 提交按钮 */
  220. submitForm() {
  221. this.$refs["form"].validate(valid => {
  222. if (valid) {
  223. if (this.form.id != null) {
  224. let obj = {
  225. id:this.form.id,
  226. room: this.form.room,
  227. isSubject: this.form.isSubject,
  228. };
  229. updateSubject(obj).then(response => {
  230. this.msgSuccess("修改成功");
  231. this.open = false;
  232. this.reset();
  233. this.getBuilding();
  234. });
  235. }
  236. }
  237. });
  238. },
  239. }
  240. };
  241. </script>
  242. <style scoped lang="scss">
  243. .building {
  244. display: flex!important;
  245. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  246. padding:11px 20px!important;
  247. .el-row{
  248. margin-bottom:20px;
  249. }
  250. .left-max-box{
  251. width:245px;
  252. }
  253. .right-max-box{
  254. flex:1;
  255. display: flex;
  256. flex-direction: column;
  257. .right-top-title{
  258. text-align: center;
  259. font-size:18px;
  260. margin:17px 0 0 0;
  261. line-height:109px;
  262. }
  263. .map-img-box{
  264. flex:1;
  265. margin:0 30px;
  266. position: relative;
  267. .map-max-box{
  268. position: absolute;
  269. top:50%;
  270. left:50%;
  271. display: block;
  272. width:790px;
  273. height:360px;
  274. margin-left:-395px;
  275. margin-top:-180px;
  276. }
  277. }
  278. .carousel{
  279. height:184px;
  280. display: flex;
  281. /*width: 1030px;*/
  282. margin: 0 auto;
  283. .button-box{
  284. width:40px;
  285. height:40px;
  286. margin:66px 50px 0;
  287. background: #cce6fd;
  288. color: #fff;
  289. text-align: center;
  290. line-height:40px;
  291. font-size:14px;
  292. -webkit-border-radius: 50%;
  293. -moz-border-radius: 50%;
  294. border-radius: 50%;
  295. }
  296. .button-box:hover{
  297. background: #0183FA;
  298. color: #fff;
  299. }
  300. .for-max-box{
  301. display: flex;
  302. flex:1;
  303. cursor:pointer;
  304. .for-min-box{
  305. margin:0 20px;
  306. div{
  307. padding:10px;
  308. width:210px;
  309. height:109px;
  310. margin-top:29px;
  311. img{
  312. width:190px;
  313. height:89px;
  314. }
  315. }
  316. p{
  317. line-height:45px;
  318. font-size:16px;
  319. text-align: center;
  320. margin:0;
  321. }
  322. }
  323. }
  324. }
  325. .null-p-img{
  326. width:276px;
  327. height:274px;
  328. margin:200px auto 0;
  329. }
  330. .null-p-text{
  331. text-align:center;
  332. font-size:16px;
  333. color:#999;
  334. line-height:40px;
  335. margin-right:70px;
  336. }
  337. }
  338. }
  339. </style>