AssemblyData.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <Search></Search>
  3. <div>
  4. <div class="datacenter-right">
  5. <div class="resource_list" id="map_list">
  6. <!-- <div v-for="(i, k) in list" :key="k" class="item">
  7. <div><img :src="i.url" srcset=""></div>
  8. <b>{{ i.servicename }}</b>
  9. <p>
  10. <span><a :href="[`../../mapview.html?onlineIde_${i.servicealiasname}`]" target="_blank"
  11. rel="noopener noreferrer">浏览</a></span>
  12. <span>详情</span>
  13. <span>加入库</span>
  14. <span>已入库</span>
  15. </p>
  16. </div> -->
  17. <div v-for="(j, key, index) in list" :key="index" style="clear: both;">
  18. <p class="itemName" :id="key">{{ key }}</p>
  19. <div v-for="(i, n) in j" :key="n" class="item">
  20. <div><img :src="i.url" srcset=""></div>
  21. <b>{{ i.servicename }}</b>
  22. <p class="bottomBut">
  23. <span><a :href="[`./mapview.html?onlineIde_${i.servicealiasname}`]" target="_blank"
  24. rel="noopener noreferrer">浏览</a></span>
  25. <span @click="showDrawer(i)">详情</span>
  26. <span v-if="i.consumetype == 0">加入库</span>
  27. <span v-if="i.consumetype == 1">已入库</span>
  28. </p>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <a-drawer title="组件详情" width="400px" placement="right" :closable="false" v-model:visible="visible"
  34. :after-visible-change="afterVisibleChange">
  35. <p><b>资源名称:</b>&nbsp;&nbsp;<span>{{ action.servicename }}</span></p>
  36. <p><b>资源别名:</b>&nbsp;&nbsp;<span>{{ action.servicealiasname }}</span></p>
  37. <p><b>资源类型:</b>&nbsp;&nbsp;<span>{{ action.source }}</span></p>
  38. <p><b>浏览资源:</b>&nbsp;&nbsp;<span><a :href="[`../../mapview.html?onlineIde_${action.servicealiasname}`]"
  39. target="_blank" rel="noopener noreferrer">查看组件</a></span></p>
  40. <p><b>资源描述:</b>&nbsp;&nbsp;<span>{{ action.description }}</span></p>
  41. <div class="footer">
  42. <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
  43. </div>
  44. </a-drawer>
  45. <AssemblyDrawer @register="registerModal" />
  46. </div>
  47. </template>
  48. <script lang="ts">
  49. import { defineComponent, nextTick, onMounted, ref, defineProps, watch, reactive, getCurrentInstance } from 'vue';
  50. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  51. import { columns, searchFormSchema } from './sms.data';
  52. import { Popconfirm, Tooltip } from 'ant-design-vue';
  53. import { Authority } from '/@/components/Authority';
  54. import { platList, img, apply } from '/@/api/resource/plat';
  55. import { message } from 'ant-design-vue';
  56. // 加载自定义侧边弹出框 组件
  57. import { useDrawer } from '/@/components/Drawer';
  58. // 导入子页面【新增、修改】
  59. import AssemblyDrawer from './AssemblyDrawer.vue';
  60. import Search from './child/Search.vue';
  61. import { session } from '/@/utils/Memory';
  62. import { getImgUrl } from '/@/api/dataAdmin/assembly';
  63. export default defineComponent({
  64. name: 'SmsLog',
  65. components: { BasicTable, TableAction, Authority, Search, Popconfirm, Tooltip, AssemblyDrawer },
  66. props: {
  67. list: { type: Array, default: ref([]) }
  68. },
  69. setup(props, { emit }) {
  70. const [registerModal, { openDrawer }] = useDrawer(); //使用右侧弹出框
  71. // const list = reactive(props.list);
  72. // watch(() => props.list, (obj) => {
  73. // list.values = obj;
  74. // console.log(list.values);
  75. // });
  76. const list = ref([]);
  77. console.log("list", list);
  78. eventBus.on('assemblylist', (i) => {
  79. console.log("i:", i);
  80. for (var j in i) {
  81. // i[j].map(async (k) => k.url = await getImg(k.mapingurl))
  82. if (i[j]) i[j].map((k) => { k.url = `http://106.12.170.138:4001/examples/img/${k.publiccurl}` });
  83. }
  84. list.value = i
  85. // setTimeout(() => list.value = i, 5000)
  86. })
  87. function handleQuery(record: Recordable) {
  88. console.log("11111:", record)
  89. openDrawer(true, {
  90. record,
  91. });
  92. }
  93. async function getImg(i) {
  94. var defUrl = '/static/img/Earth.jpg';
  95. var url = null;
  96. if (i) {
  97. var arr = i.split(',')
  98. if (arr.length > 1) url = await getImgUrl(arr[0], arr[1]);
  99. }
  100. return url ? url : defUrl;
  101. }
  102. const visible = ref<boolean>(false);
  103. const action = ref({});
  104. const afterVisibleChange = (bool: boolean) => {
  105. console.log('visible', bool);
  106. };
  107. const showDrawer = (i) => {
  108. console.log("i", i);
  109. action.value = i;
  110. visible.value = true;
  111. };
  112. const onClose = () => {
  113. visible.value = false;
  114. };
  115. return {
  116. onClose,
  117. action,
  118. visible,
  119. afterVisibleChange,
  120. showDrawer,
  121. getImg,
  122. registerModal,
  123. list,
  124. handleQuery,
  125. };
  126. },
  127. });
  128. </script>
  129. <style scoped>
  130. .footer {
  131. position: absolute;
  132. bottom: 0px;
  133. width: 100%;
  134. border-top: 1px solid rgb(232, 232, 232);
  135. padding: 10px 16px;
  136. text-align: right;
  137. left: 0px;
  138. background: rgb(255, 255, 255);
  139. border-radius: 0px 0px 4px 4px;
  140. }
  141. .bottomBut span:first-child,
  142. .bottomBut span:nth-child(2) {
  143. float: left;
  144. }
  145. .bottomBut span:nth-child(3),
  146. .bottomBut span:nth-child(4) {
  147. float: right;
  148. color: #fff;
  149. background: #05B069;
  150. }
  151. .bottomBut span:nth-child(3) {
  152. margin-right: 0px;
  153. }
  154. .itemName {
  155. font-size: 16px;
  156. font-weight: 500;
  157. line-height: normal;
  158. letter-spacing: 0em;
  159. color: #333333;
  160. border-left: solid 4px #0671DD;
  161. padding-left: 20px;
  162. margin-left: 12px;
  163. }
  164. .item p span {
  165. display: inline-block;
  166. min-width: 50px;
  167. height: 34px;
  168. line-height: 34px;
  169. margin-right: 20px;
  170. padding: 0 10px;
  171. background: #E8E8E8;
  172. cursor: pointer;
  173. }
  174. .item b {
  175. font-size: 16px;
  176. font-weight: bold;
  177. display: inline-block;
  178. margin: 10px 0;
  179. }
  180. .item {
  181. width: 378px;
  182. height: 299px;
  183. border-radius: 4px;
  184. background: #FFFFFF;
  185. border: 1px solid #DEDEDE;
  186. padding: 15px;
  187. float: left;
  188. margin: 0px 20px 20px 0px;
  189. }
  190. .item img {
  191. width: 354px;
  192. height: 190px;
  193. }
  194. </style>