createPointZone.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div id="createPoint">
  3. <div class="condition">
  4. <div class="header">
  5. <el-button style="float:left;" size="small" type="default" icon="el-icon-back" @click="goBack"></el-button>
  6. <el-button size="small" style="float:right" @click="createZ">创建</el-button>
  7. </div>
  8. <el-scrollbar style="height:calc(100% - 43px)">
  9. <div class="item">
  10. <span>基本信息:</span>
  11. <div>
  12. <label><span style="color:red;">*</span>业务空间名称</label>
  13. <el-input placeholder="请输入业务空间名称" v-model="RoomLocalName" clearable
  14. style="width:215px;margin-right:10px;"></el-input>
  15. <label>业务空间编码</label>
  16. <el-input placeholder="请输入业务空间编码" v-model="localId" clearable
  17. style="width:215px;margin-right:10px;"></el-input>
  18. </div>
  19. <div>
  20. <label><span style="color:red;">*</span>所属建筑楼层</label>
  21. <el-cascader placeholder='请选择' v-model="buildFloor" :options="options" :props="floorProps" filterable
  22. ref="buildfloor"
  23. style="width:215px;margin-right:10px;"></el-cascader>
  24. <label><span style="color:red;">*</span>业务空间类型</label>
  25. <el-select v-model="space" placeholder="请选择空间" style="width:215px;margin-right:10px;" @change="changeSpace">
  26. <el-option v-for="item in spaceList" :key="item.Code" :label="item.Name" :value="item.Code">
  27. </el-option>
  28. </el-select>
  29. </div>
  30. </div>
  31. <div class="item">
  32. <span>其它可补充信息:</span>
  33. <i style="cursor: pointer;" :class="showEx"
  34. @click="showEx = (showEx == 'el-icon-arrow-up' ? 'el-icon-arrow-down' : 'el-icon-arrow-up')"></i>
  35. <div v-show="showEx == 'el-icon-arrow-up'" v-loading="loadingOtherMsg">
  36. <zoneInput v-show="otherList.length" :inputList="otherList" labelWidth="140px" ref="zoneInput"></zoneInput>
  37. <p v-show="!otherList.length">请选择业务空间类型</p>
  38. </div>
  39. </div>
  40. <div class="item">
  41. <p>位置标签图片信息:</p>
  42. <locationPointMsg ref="pointMsg" :pointObj="$route.params.item"></locationPointMsg>
  43. </div>
  44. </el-scrollbar>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import locationPointMsg from '@/views/data_admin/buildGraphy/locationPointMsg'
  50. import { queryDictionaryHead, zoneCreate } from '@/api/scan/request';
  51. import { getDataDictionary } from "@/api/dict";
  52. import { mapGetters } from 'vuex'
  53. import zoneInput from '@/components/data_admin/zoneInput'
  54. export default {
  55. data() {
  56. return {
  57. floorProps: {
  58. value: 'BuildID',
  59. label: 'BuildLocalName',
  60. children: 'Floor'
  61. },
  62. options: [],//建筑楼层
  63. spaceList: [],//空间列表
  64. space: '',//当前空间
  65. buildFloor: [],//建筑楼层信息
  66. zoneName: '',//业务空间名称
  67. zoneLocalId: '',//业务空间编码
  68. showEx: 'el-icon-arrow-down',//下拉菜单
  69. RoomLocalID: '',//业务空间本地编码
  70. RoomLocalName: '',//业务空间名称
  71. otherList: [],//可补充信息list
  72. loadingOtherMsg: false,
  73. }
  74. },
  75. computed: {
  76. ...mapGetters("layout", ["projectId"])
  77. },
  78. props: {},
  79. components: {
  80. locationPointMsg,
  81. zoneInput
  82. },
  83. created() {
  84. this.options = this.$route.params.floorData
  85. this.getSpaceList();
  86. },
  87. methods: {
  88. //创建
  89. createZ() {
  90. let param = {
  91. Content: []
  92. }
  93. let zObj = this.$refs.zoneInput.getFormData();
  94. zObj.Pic = this.$refs.pointMsg.choImg.concat();
  95. zObj.Pic = zObj.Pic.map(item => ({
  96. Id: item.ObjectId,
  97. Key: item.Key,
  98. Name: item.Name,
  99. Type: item.Type
  100. }))
  101. if (this.RoomLocalName && this.buildFloor.length && this.space) {
  102. zObj.classCode = this.space;
  103. zObj.localName = this.RoomLocalName;
  104. zObj.localId = this.RoomLocalID;
  105. zObj.buildingId = this.buildFloor[0];
  106. zObj.floorId = this.buildFloor[1];
  107. param.content = [zObj];
  108. zoneCreate(param, res => {
  109. this.$message.success("创建成功");
  110. this.$refs.pointMsg.clearImg();
  111. this.RoomLocalName = ''
  112. this.RoomLocalID = ''
  113. this.buildFloor = []
  114. this.space = ''
  115. this.otherList = []
  116. })
  117. } else if (!this.RoomLocalName) {
  118. this.$message("请输入业务空间名称");
  119. } else if (!this.buildFloor.length) {
  120. this.$message("请选择所属建筑楼层");
  121. } else {
  122. this.$message("请选择业务空间类型");
  123. }
  124. },
  125. //获取空间列表
  126. getSpaceList() {
  127. let pa = {
  128. Filters: `parentId='Space'`
  129. }
  130. queryDictionaryHead(pa, res => {
  131. this.spaceList = res.Content.filter((item => {
  132. return item.Name != '元空间'
  133. }));
  134. });
  135. },
  136. //选择业务空间
  137. changeSpace(val) {
  138. this.space = val;
  139. let pa = {
  140. type: this.space,
  141. orders: "sort asc",
  142. pageNumber: 1,
  143. pageSize: 500
  144. };
  145. this.loadingOtherMsg = true;
  146. getDataDictionary(pa, res => {
  147. this.loadingOtherMsg = false;
  148. let filterCode = ["localId", "localName"]
  149. res.content = res.content.filter(item => {
  150. item.inputValue = null;
  151. return filterCode.indexOf(item.code) == -1
  152. });
  153. this.otherList = res.Content;
  154. this.$refs.zoneInput.init(this.otherList);
  155. })
  156. },
  157. //返回
  158. goBack() {
  159. this.$router.push({
  160. name: "buildGraphy",
  161. params: { nowBuildFloor: this.$route.params.nowBuildFloor }
  162. })
  163. }
  164. },
  165. watch: {
  166. projectId: {
  167. handler(val) {
  168. this.goBack();
  169. }
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="less" scoped>
  175. .condition {
  176. position: relative;
  177. padding: 10px 10px;
  178. display: flex;
  179. height: calc(100% - 22px);
  180. flex-direction: column;
  181. border: 1px solid #dfe6ec;
  182. background: #fff;
  183. .header {
  184. padding-bottom: 10px;
  185. border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  186. span {
  187. line-height: 33px;
  188. margin-left: 15px;
  189. }
  190. /deep/ .buildFloor {
  191. line-height: 32px;
  192. }
  193. }
  194. }
  195. /deep/ .el-scrollbar__wrap {
  196. overflow-x: hidden;
  197. }
  198. .item {
  199. padding: 10px 10px;
  200. label {
  201. display: inline-block;
  202. padding: 5px 10px;
  203. width: 130px;
  204. }
  205. }
  206. .suppMsg {
  207. display: inline-block;
  208. position: relative;
  209. }
  210. </style>