createPointZone.vue 6.7 KB

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