detailsDialog.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <el-dialog :visible.sync="isShow.details" :width="width">
  3. <span slot="title">
  4. <span v-show="step == 1">{{title}}</span>
  5. <span v-show="step == 1" style="float:right;margin-right:40px;">
  6. <el-button class="saga-padding0" @click="step = 3" type="text">编辑信息</el-button>
  7. <!-- <el-button class="saga-padding0" @click="addMyEquip" type="text">添加设备</el-button> -->
  8. <el-dropdown @command="addMyEquip" trigger="click">
  9. <span class="el-dropdown-link" style="color: #409EFF">添加设备</span>
  10. <el-dropdown-menu slot="dropdown">
  11. <el-dropdown-item command="EquipinSpace">空间内的设备</el-dropdown-item>
  12. <el-dropdown-item command="EquipforSpace">服务于空间的设备</el-dropdown-item>
  13. <el-dropdown-item command="EquipXSpace">其他关系的设备</el-dropdown-item>
  14. </el-dropdown-menu>
  15. </el-dropdown>
  16. <el-button class="saga-padding0" @click="delSpace" type="text">删除该业务空间</el-button>
  17. </span>
  18. <span v-show="step == 2 || step == 3">
  19. <el-button type="text" @click="goBack" icon="el-icon-arrow-left"></el-button>
  20. </span>
  21. </span>
  22. <div id="detailsDialog" v-show="step == 1">
  23. <p class="influence-p">{{list.name}}</p>
  24. <el-tabs type="border-card">
  25. <el-tab-pane label="空间详情">
  26. <div class="saga-details">
  27. <iframe height="400px" v-if="isShow.details" width="100%" :src="iframeSrc"></iframe>
  28. </div>
  29. </el-tab-pane>
  30. <el-tab-pane label="与空间相关联的设备">
  31. <div>
  32. <equip-table ref="myEquip"></equip-table>
  33. </div>
  34. </el-tab-pane>
  35. </el-tabs>
  36. </div>
  37. <div v-show="step == 2">
  38. <add-equip :activeTabType="activeTabType" ref="addEquip"></add-equip>
  39. </div>
  40. <div id="detailsDialog" v-if="step == 3">
  41. <iframe v-if="step == 3" height="400px" width="100%" :src="iframeSrc2"></iframe>
  42. </div>
  43. </el-dialog>
  44. </template>
  45. <script>
  46. import Vue from "vue"
  47. import {
  48. Dropdown,
  49. DropdownMenu,
  50. DropdownItem} from "element-ui"
  51. Vue.use(Dropdown)
  52. Vue.use(DropdownMenu)
  53. Vue.use(DropdownItem)
  54. import { delManySpace } from "@/api/scan/request";
  55. import equipTable from "@/components/table/equipTable";
  56. import addEquip from "@/components/table/addEquip";
  57. export default {
  58. components: {
  59. equipTable,
  60. addEquip
  61. },
  62. props: {
  63. width: {
  64. type: String,
  65. default: "70%"
  66. },
  67. title: {
  68. type: String,
  69. default: "头部信息"
  70. },
  71. isShow: {
  72. type: Object
  73. },
  74. param: {
  75. type: Object
  76. },
  77. activeTabType: {
  78. type: Object,
  79. default: function () {
  80. return {
  81. "code": "GeneralZone",
  82. "name": "默认分区",
  83. "rel_type": "99"
  84. }
  85. }
  86. }
  87. },
  88. data() {
  89. return {
  90. step: 1,
  91. data: null,
  92. proj: null,
  93. activeName: "1",
  94. list: {},
  95. iframeSrc: "",
  96. iframeSrc2: "",
  97. buildMess: ""
  98. };
  99. },
  100. created() { },
  101. methods: {
  102. handleClick() { },
  103. getData(list, buildMess) {
  104. this.step = 1;
  105. this.list = list;
  106. this.buildMess = buildMess;
  107. this.$nextTick(() => {
  108. this.$refs.myEquip.getData(list, this.activeTabType);
  109. });
  110. let perjectId = this.$route.query.projId,
  111. secret = this.$route.query.secret;
  112. this.iframeSrc =
  113. process.env.BASE_URL +
  114. ":8889/#/details?perjectId=" +
  115. perjectId +
  116. "&secret=" +
  117. secret +
  118. "&FmId=" +
  119. list.id +
  120. "&type=0&code=" + this.activeTabType.code;
  121. this.iframeSrc2 =
  122. process.env.BASE_URL +
  123. ":8889/#/changeMess?perjectId=" +
  124. perjectId +
  125. "&secret=" +
  126. secret +
  127. "&id=" +
  128. list.id +
  129. "&type=" + this.activeTabType.code;
  130. },
  131. addMyEquip(str) {
  132. this.step = 2;
  133. this.$nextTick(() => {
  134. console.log(this.activeTabType)
  135. this.$refs.addEquip.getData(this.list, this.buildMess, str, this.activeTabType);
  136. });
  137. },
  138. goBack() {
  139. this.step = 1;
  140. this.$refs.myEquip.getData(this.list, this.activeTabType);
  141. },
  142. delSpace() {
  143. this.$confirm("此操作将永久删除该业务空间, 是否继续?", "删除", {
  144. confirmButtonText: "确定",
  145. cancelButtonText: "取消",
  146. type: "warning"
  147. })
  148. .then(() => {
  149. let param = {
  150. ProjId: this.$route.query.projId,
  151. secret: this.$route.query.secret,
  152. data: {
  153. criteria: {
  154. ids: [this.list.id]
  155. }
  156. }
  157. };
  158. delManySpace(param)
  159. .then(res => {
  160. if (res.data.Result == "success") {
  161. this.$message({
  162. type: "success",
  163. message: "删除成功!"
  164. });
  165. this.$emit("del");
  166. } else {
  167. this.$message.error(res.data.ResultMsg);
  168. }
  169. })
  170. .catch(() => {
  171. this.$message.error("请求发生错误");
  172. });
  173. })
  174. .catch(() => {
  175. this.$message({
  176. type: "info",
  177. message: "已取消删除"
  178. });
  179. });
  180. }
  181. }
  182. };
  183. </script>
  184. <style lang="less">
  185. #detailsDialog {
  186. .el-tabs__content {
  187. max-height: 400px;
  188. }
  189. .influence-p {
  190. height: 40px;
  191. line-height: 40px;
  192. font-size: 17px;
  193. margin-bottom: 10px;
  194. }
  195. }
  196. </style>