AssemblyData.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <div class="assembly-data">
  3. <Search></Search>
  4. <div class="datacenter-right-1">
  5. <div class="resource_list" id="map_list">
  6. <div v-for="(i, k) in list" :key="k" class="item">
  7. <div class="img-box"><img :src="interfaceImg" alt="" srcset=""></div>
  8. <div class="itemLetf">
  9. <div class="item-top">
  10. <div class="title">{{ i.name }}</div>
  11. <div class="opts-btn">
  12. <div class="add-library btn">加入申请库</div>
  13. <div class="interface-details btn" @click="showDrawer(i)">查看详情</div>
  14. </div>
  15. </div>
  16. <div class="describle">
  17. <div class="title">描述:</div>
  18. <div class="text" v-html="i.remark"></div>
  19. </div>
  20. <div class="split-line"></div>
  21. <div class="leftBut">
  22. <p><span>当前版本:</span><span>{{ i.version }}</span></p>
  23. <p><span>调用次数:</span><span>{{ i.is_open || 0 }}</span></p>
  24. <p><span>发布时间:</span><span>{{ i.publishTime }}</span></p>
  25. <p><span>更新时间:</span><span>{{ i.updateTime }}</span></p>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="pagination">
  31. <Pagination v-model:current="current" :page-size-options="pageSizeOptions" :total="total" show-size-changer
  32. :page-size="pageSize" @showSizeChange="onShowSizeChange">
  33. <template #buildOptionText="props">
  34. <span v-if="props.value !== '50'">{{ props.value }}条/页</span>
  35. <span v-else>全部</span>
  36. </template>
  37. </Pagination>
  38. </div>
  39. </div>
  40. <a-drawer title="接口详情" width="700px" placement="right" :closable="false" v-model:visible="visible"
  41. :after-visible-change="afterVisibleChange">
  42. <Details :action="action"></Details>
  43. <div class="footer">
  44. <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
  45. </div>
  46. </a-drawer>
  47. <AssemblyDrawer @register="registerModal" />
  48. </div>
  49. </template>
  50. <script lang="ts">
  51. import { defineComponent, nextTick, onMounted, ref, defineProps, watch } from 'vue';
  52. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  53. import { columns, searchFormSchema } from './sms.data';
  54. import { Popconfirm, Tooltip, Pagination } from 'ant-design-vue';
  55. import { Authority } from '/@/components/Authority';
  56. import { interfaceList, getGroupId } from '/@/api/interface/interface.ts';
  57. import { message } from 'ant-design-vue';
  58. // 加载自定义侧边弹出框 组件
  59. import { useDrawer } from '/@/components/Drawer';
  60. // 导入子页面【新增、修改】
  61. import AssemblyDrawer from './AssemblyDrawer.vue';
  62. import Search from './child/Search.vue';
  63. import Details from './child/Details.vue';
  64. import { session } from '/@/utils/Memory';
  65. import interfaceImg from '/@/assets/images/count2.png';
  66. export default defineComponent({
  67. name: 'SmsLog',
  68. components: { Pagination, BasicTable, TableAction, Authority, Search, Details, Popconfirm, Tooltip, AssemblyDrawer },
  69. setup() {
  70. const [registerModal, { openDrawer }] = useDrawer(); //使用右侧弹出框
  71. const props = defineProps({
  72. listData: {
  73. type: Array,
  74. default: () => [],
  75. }
  76. })
  77. // setInterval(() => {
  78. // console.log(props)
  79. // }, 2000)
  80. function handleQuery(record: Recordable) {
  81. console.log("11111:", record)
  82. openDrawer(true, {
  83. record,
  84. });
  85. }
  86. // var list = [
  87. // { src: 'http://106.12.170.138:4001/examples/img/Earth.jpg', name: '地图加载', has: false, href: "onlineIde_a1_Hello_World_01" },
  88. // { src: 'http://106.12.170.138:4001/examples/img/Earth.jpg', name: '地图加载', has: false, href: "onlineIde_a1_Hello_World_01" },
  89. // { src: 'http://106.12.170.138:4001/examples/img/Earth.jpg', name: '地图加载', has: false, href: "onlineIde_a1_Hello_World_01" }
  90. // ]
  91. var list = ref([]);
  92. // onMounted(() => getList())
  93. function getList() {
  94. interfaceList({
  95. page: current.value,
  96. rows: pageSize.value,
  97. keyword: keyword.value,
  98. }).then((e) => {
  99. console.log("e:", e)
  100. if (e.records.length) {
  101. eventBus.emit("interfaceNum", e);
  102. total.value = e.total;
  103. list.value = e.records;
  104. }
  105. })
  106. }
  107. const visible = ref<boolean>(false);
  108. const action = ref({});
  109. const afterVisibleChange = (bool: boolean) => {
  110. console.log('visible', bool);
  111. };
  112. const showDrawer = (i) => {
  113. console.log("i", i);
  114. action.value = i;
  115. visible.value = true;
  116. };
  117. const onClose = () => {
  118. visible.value = false;
  119. };
  120. function formatData(e) {
  121. var str = null;
  122. try {
  123. str = JSON.stringify(JSON.parse(action.request_headers), null, 4)
  124. } catch (error) {
  125. str = e;
  126. }
  127. return str;
  128. }
  129. const pageSizeOptions = ref(['10', '20', '30', '40', '50']);
  130. const current = ref(1);
  131. const pageSize = ref(6);
  132. const total = ref(50);
  133. const onShowSizeChange = (current, pageSize) => {
  134. console.log(pageSize);
  135. pageSize.value = pageSize;
  136. getGroupIdList()
  137. };
  138. watch(current, () => {
  139. getGroupIdList();
  140. });
  141. const keyword = ref("");
  142. eventBus.on("interfaceSearch", (e) => { keyword.value = e, getList() });
  143. eventBus.on("groupIdInterface", (e) => { groupId = e; getGroupIdList(groupId) });
  144. var groupId = null;
  145. function getGroupIdList(id) {
  146. getGroupId({
  147. page: current.value,
  148. rows: pageSize.value,
  149. groupId: groupId,
  150. }).then((e) => {
  151. eventBus.emit("interfaceNum", e);
  152. total.value = e.totalNum;
  153. list.value = e.list;
  154. })
  155. }
  156. return {
  157. pageSizeOptions,
  158. current,
  159. pageSize,
  160. total,
  161. onShowSizeChange,
  162. formatData,
  163. visible,
  164. action,
  165. afterVisibleChange,
  166. showDrawer,
  167. onClose,
  168. interfaceImg,
  169. registerModal,
  170. list,
  171. handleQuery,
  172. };
  173. },
  174. });
  175. </script>
  176. <style scoped lang="less">
  177. .assembly-data {
  178. width: 100%;
  179. height: 100%;
  180. .datacenter-right-1 {
  181. width: 100%;
  182. position: relative;
  183. height: calc(100% - 64px);
  184. max-height: 810px;
  185. // height: 890px;
  186. .resource_list {
  187. width: 100%;
  188. height: calc(100% - 45px);
  189. max-height: 760px;
  190. overflow: auto;
  191. &::-webkit-scrollbar {
  192. width: 1px;
  193. }
  194. .item {
  195. margin-bottom: 20px;
  196. width: 100%;
  197. height: 110px;
  198. border-radius: 4px;
  199. background: #FFFFFF;
  200. border: 1px solid #DEDEDE;
  201. padding: 10px;
  202. display: flex;
  203. align-items: center;
  204. &:last-child {
  205. margin-bottom: 0;
  206. }
  207. .img-box {
  208. width: 140px;
  209. height: 90px;
  210. display: flex;
  211. align-items: center;
  212. justify-content: center;
  213. border: solid 1px #f1eded;
  214. box-sizing: border-box;
  215. img {
  216. width: 48px;
  217. height: 48px;
  218. }
  219. }
  220. .itemLetf {
  221. flex-grow: 1;
  222. margin-left: 20px;
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: center;
  226. .item-top {
  227. display: flex;
  228. justify-content: space-between;
  229. align-items: center;
  230. .title {
  231. font-family: Source Han Sans CN;
  232. font-size: 16px;
  233. font-weight: bold;
  234. color: #333333;
  235. }
  236. .opts-btn {
  237. margin-right: 10px;
  238. display: flex;
  239. .add-library {
  240. margin-right: 9px;
  241. padding-right: 9px;
  242. border-right: 1px solid #0671DD;
  243. }
  244. .btn {
  245. font-family: '阿里巴巴普惠体 2.0';
  246. font-size: 14px;
  247. font-weight: normal;
  248. color: #0671DD;
  249. user-select: none;
  250. cursor: pointer;
  251. }
  252. }
  253. }
  254. .describle {
  255. margin-top: 7px;
  256. display: flex;
  257. .title {
  258. font-family: Source Han Sans CN;
  259. font-size: 14px;
  260. font-weight: normal;
  261. color: #888888;
  262. }
  263. .text {
  264. font-family: Source Han Sans CN;
  265. font-size: 14px;
  266. color: #333333;
  267. p {
  268. margin-bottom: 0 !important;
  269. }
  270. }
  271. }
  272. .split-line {
  273. margin-top: 7px;
  274. height: 1px;
  275. background-color: #DEDEDE;
  276. }
  277. .leftBut {
  278. margin-top: 7px;
  279. display: flex;
  280. justify-content: space-between;
  281. p {
  282. margin-bottom: 0;
  283. &:last-child {
  284. margin-right: 10px;
  285. }
  286. }
  287. }
  288. }
  289. }
  290. }
  291. .pagination {
  292. width: 100%;
  293. height: 40px;
  294. position: absolute;
  295. // z-index: 4;
  296. bottom: 0px;
  297. right: 0;
  298. // background: #fff;
  299. ul {
  300. float: right;
  301. }
  302. }
  303. }
  304. }
  305. </style>