index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div id="unifiedPortalIndex">
  3. <div class="content_box">
  4. <el-card class="box-card">
  5. <div class="control_bar">
  6. <el-button
  7. type="primary"
  8. icon="el-icon-plus"
  9. @click="add"
  10. v-if="$hasPermission('sys:system:save')"
  11. >新增</el-button
  12. >
  13. </div>
  14. <div class="list">
  15. <div class="list_box">
  16. <template v-for="(item, index) in list">
  17. <div
  18. :class="[
  19. (index + 1) % 6 == 0 ? 'list-item margin_0' : 'list-item'
  20. ]"
  21. >
  22. <el-card>
  23. <div slot="header" class="clearfix">
  24. <span>{{ item.name }}</span>
  25. <i
  26. class="el-icon-delete"
  27. @click="deleted(item)"
  28. v-if="$hasPermission('mian:codeManage:delete')"
  29. ></i>
  30. <i
  31. class="el-icon-edit"
  32. @click="edit(item)"
  33. v-if="$hasPermission('mian:codeManage:update')"
  34. ></i>
  35. </div>
  36. <div class="card-content">
  37. <el-image
  38. class="img"
  39. :src="item.img"
  40. fit="cover"
  41. :preview-src-list="[item.img]"
  42. >
  43. </el-image>
  44. <div class="item">
  45. <span>排序</span>
  46. <span>{{ item.sort }}</span>
  47. </div>
  48. <div class="item">
  49. <span>链接</span>
  50. <span>{{ item.linkUrl }}</span>
  51. </div>
  52. <div class="item">
  53. <span>链接类型</span>
  54. <span>{{ item.linkTypeName }}</span>
  55. </div>
  56. <div class="item">
  57. <span>架构类型</span>
  58. <span>{{ item.architTypeName }}</span>
  59. </div>
  60. <div class="item">
  61. <span>备注</span>
  62. <span>{{ item.remark }}</span>
  63. </div>
  64. </div>
  65. </el-card>
  66. </div>
  67. </template>
  68. </div>
  69. </div>
  70. </el-card>
  71. </div>
  72. <Dialog ref="dialogRef" @reload="getPages"></Dialog>
  73. </div>
  74. </template>
  75. <script>
  76. import dictMixins from '@/mixins/dictMixins';
  77. import Dialog from './dialog.vue';
  78. import { getList, deleteInfo } from '@/api/system/unifiedPortal/index.js';
  79. import { getImageUrl } from '@/utils/file';
  80. export default {
  81. mixins: [dictMixins],
  82. components: { Dialog },
  83. data() {
  84. return {
  85. type: '新增',
  86. list: []
  87. };
  88. },
  89. created() {
  90. this.getPages();
  91. this.requestDict('链接分类');
  92. this.requestDict('架构分类');
  93. },
  94. methods: {
  95. async getPages() {
  96. let data = await getList({ pageNum: 1, size: 9999 });
  97. this.list = data.list.map((item) => {
  98. return {
  99. ...item,
  100. architTypeName:
  101. this.getDictValue('架构分类', String(item.architType)) || '',
  102. linkTypeName:
  103. this.getDictValue('链接分类', String(item.linkType)) || '',
  104. img:
  105. window.location.origin +
  106. '/api/main/file/getFile?objectName=' +
  107. item.iconPath
  108. };
  109. });
  110. },
  111. add() {
  112. this.type = '新增';
  113. this.$refs.dialogRef.open(this.type);
  114. },
  115. edit(item) {
  116. this.type = '编辑';
  117. this.$refs.dialogRef.open(this.type, item.id);
  118. },
  119. deleted(item) {
  120. this.$confirm('是否确认删除?', '提示', {
  121. confirmButtonText: '确定',
  122. cancelButtonText: '取消',
  123. type: 'warning'
  124. }).then(async () => {
  125. try {
  126. await deleteInfo([item.id]);
  127. this.$message.success('删除成功');
  128. await this.getPages();
  129. } catch (error) {
  130. console.log(error);
  131. this.$message.error('删除失败');
  132. }
  133. });
  134. }
  135. }
  136. };
  137. </script>
  138. <style lang="scss" scoped>
  139. #unifiedPortalIndex {
  140. height: calc(100vh - 97px);
  141. width: 100%;
  142. .content_box {
  143. width: 100%;
  144. height: 100%;
  145. padding: 20px;
  146. box-sizing: border-box;
  147. :deep(.el-card) {
  148. height: 100%;
  149. width: 100%;
  150. .el-card__header {
  151. width: 100%;
  152. .clearfix {
  153. display: flex;
  154. justify-content: center;
  155. align-items: center;
  156. > span {
  157. flex: 1;
  158. }
  159. .el-icon-delete {
  160. color: red;
  161. cursor: pointer;
  162. margin-right: 5px;
  163. }
  164. .el-icon-edit {
  165. color: #40a9ff;
  166. cursor: pointer;
  167. }
  168. }
  169. }
  170. .el-card__body {
  171. height: 100%;
  172. width: 100%;
  173. display: flex;
  174. flex-direction: column;
  175. .control_bar {
  176. height: 60px;
  177. border: 10px;
  178. padding: 0 20px;
  179. box-sizing: border-box;
  180. display: flex;
  181. align-items: center;
  182. border-bottom: 2px solid #ebeef5;
  183. margin-bottom: 20px;
  184. }
  185. .list {
  186. flex: 1 0 auto;
  187. height: 0;
  188. .list_box {
  189. height: 100%;
  190. width: 100%;
  191. padding: 10px;
  192. box-sizing: border-box;
  193. overflow: auto;
  194. .list-item {
  195. width: 15%;
  196. margin-right: 2%;
  197. margin-bottom: 10px;
  198. display: inline-block;
  199. .el-card__body {
  200. display: flex;
  201. flex-direction: column;
  202. font-size: 12px;
  203. .img {
  204. width: 100%;
  205. height: 150px;
  206. }
  207. .item {
  208. padding: 5px 0;
  209. display: flex;
  210. > span:first-child {
  211. margin-right: 10px;
  212. }
  213. }
  214. }
  215. }
  216. .margin_0 {
  217. margin-right: 0;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. }
  224. }
  225. </style>