AssemblyData.vue 6.7 KB

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