detailsDialog.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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 {
  47. delManySpace
  48. } from "@/api/scan/request";
  49. import equipTable from "@/components/business_space/table/equipTable";
  50. import addEquip from "@/components/business_space/table/addEquip";
  51. import {
  52. mapGetters,
  53. mapActions
  54. } from "vuex";
  55. export default {
  56. components: {
  57. equipTable,
  58. addEquip
  59. },
  60. computed: {
  61. ...mapGetters("peojMess", [
  62. "projectId",
  63. "secret",
  64. "userId"
  65. ])
  66. },
  67. props: {
  68. width: {
  69. type: String,
  70. default: "900px"
  71. },
  72. title: {
  73. type: String,
  74. default: "头部信息"
  75. },
  76. isShow: {
  77. type: Object
  78. },
  79. param: {
  80. type: Object
  81. },
  82. activeTabType: {
  83. type: Object,
  84. default: function() {
  85. return {
  86. "code": "GeneralZone",
  87. "name": "默认分区",
  88. "rel_type": "99"
  89. }
  90. }
  91. }
  92. },
  93. data() {
  94. return {
  95. step: 1,
  96. data: null,
  97. proj: null,
  98. activeName: "1",
  99. list: {},
  100. iframeSrc: "",
  101. iframeSrc2: "",
  102. buildMess: ""
  103. };
  104. },
  105. created() {},
  106. methods: {
  107. handleClick() {},
  108. getData(list, buildMess) {
  109. this.step = 1;
  110. this.list = list;
  111. this.buildMess = buildMess;
  112. this.$nextTick(() => {
  113. this.$refs.myEquip.getData(list, this.activeTabType);
  114. });
  115. let perjectId = this.projectId,
  116. secret = this.secret;
  117. this.iframeSrc =
  118. process.env.BASE_URL +
  119. ":8889/#/details?perjectId=" +
  120. perjectId +
  121. "&secret=" +
  122. secret +
  123. "&FmId=" +
  124. list.id +
  125. "&type=0&code=" + this.activeTabType.code;
  126. this.iframeSrc2 =
  127. process.env.BASE_URL +
  128. ":8889/#/changeMess?perjectId=" +
  129. perjectId +
  130. "&secret=" +
  131. secret +
  132. "&id=" +
  133. list.id +
  134. "&type=" + this.activeTabType.code;
  135. },
  136. addMyEquip(str) {
  137. this.step = 2;
  138. this.$nextTick(() => {
  139. console.log(this.activeTabType)
  140. this.$refs.addEquip.getData(this.list, this.buildMess, str, this.activeTabType);
  141. });
  142. },
  143. goBack() {
  144. this.step = 1;
  145. this.$refs.myEquip.getData(this.list, this.activeTabType);
  146. },
  147. delSpace() {
  148. this.$confirm("此操作将永久删除该业务空间, 是否继续?", "删除", {
  149. confirmButtonText: "确定",
  150. cancelButtonText: "取消",
  151. type: "warning"
  152. })
  153. .then(() => {
  154. let param = {
  155. ProjId: this.projectId,
  156. secret: this.secret,
  157. data: {
  158. criteria: {
  159. ids: [this.list.id]
  160. }
  161. }
  162. };
  163. delManySpace(param)
  164. .then(res => {
  165. if (res.data.Result == "success") {
  166. this.$message({
  167. type: "success",
  168. message: "删除成功!"
  169. });
  170. this.$emit("del");
  171. } else {
  172. this.$message.error(res.data.ResultMsg);
  173. }
  174. })
  175. .catch(() => {
  176. this.$message.error("请求发生错误");
  177. });
  178. })
  179. .catch(() => {
  180. this.$message({
  181. type: "info",
  182. message: "已取消删除"
  183. });
  184. });
  185. }
  186. }
  187. };
  188. </script>
  189. <style lang="less">
  190. .el-dialog__header{
  191. .el-dropdown{
  192. font-size: 12px;
  193. line-height: 33px;
  194. }
  195. }
  196. #detailsDialog {
  197. .el-tabs__content {
  198. max-height: 400px;
  199. }
  200. .influence-p {
  201. height: 40px;
  202. line-height: 40px;
  203. font-size: 17px;
  204. margin-bottom: 10px;
  205. }
  206. }
  207. </style>