index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="__cus-manage_content">
  3. <div class="__cus-manage_content-title"><SvgIcon class="flag" name="flag_1" color="var(--cus-main-color)"/>{{$route.meta.title}}</div>
  4. <div class="__cus-manage_content-filters">
  5. <CusForm labelWidth="100px" @handleEnter="onSearch">
  6. <CusFormColumn
  7. :span="8"
  8. v-model:param="state.query.form.keyword"
  9. placeholder="请输入索引中文名称或索引表名进行搜索"
  10. />
  11. <CusButton type="main" title="搜索" @click="onSearch"/>
  12. <CusButton type="main" title="重置" @click="onReset"/>
  13. <CusButton title="导出" style="margin-left: auto"/>
  14. <CusButton type="main" title="新增" @click="onAdd"/>
  15. </CusForm>
  16. </div>
  17. <div class="__cus-manage_content-main" v-loading="state.query.loading">
  18. <CusTable
  19. :page-num="state.query.page.pageNum"
  20. :page-size="state.query.page.pageSize"
  21. :total="state.query.result.total"
  22. :data="state.query.result.data"
  23. :table-head="state.query.tableHead"
  24. @handlePage="onPage"
  25. >
  26. <template #shareMethod-column-value="{scope}">
  27. {{DictionaryStore.gxMethodMap.get(scope.row.shareMethod)}}
  28. </template>
  29. <template #shareCycle-column-value="{scope}">
  30. {{DictionaryStore.gxCycleMap.get(scope.row.shareCycle)}}
  31. </template>
  32. <template #themeMode-column-value="{scope}">
  33. {{DictionaryStore.themeModeMap.get(scope.row.themeMode)}}
  34. </template>
  35. <template #do-column-value="{scope}">
  36. <CusButton type="table" icon="relation" title="关联分类" @click="onRelation(scope.row)"/>
  37. <CusButton type="table-add" icon="text" title="字段" @click="onText(scope.row)"/>
  38. <CusButton type="table-edit" @click="onEdit(scope.row)"/>
  39. <CusButton type="table-del" @click="onDel(scope.row)"/>
  40. </template>
  41. </CusTable>
  42. </div>
  43. <DetailCom v-model:show="state.detail.show" :transfer="state.detail.transfer" @refresh="onSearch"/>
  44. <RelationCom v-model:show="state.relation.show" :transfer="state.relation.transfer" @refresh="onSearch"/>
  45. <TextCom v-model:show="state.text.show" :transfer="state.text.transfer"/>
  46. </div>
  47. </template>
  48. <script setup lang="ts">
  49. import {getCurrentInstance, onMounted, reactive} from "vue";
  50. import {ElMessage} from "element-plus";
  51. import {sysIndexFindIndexByPage} from "@/api/modules/manage";
  52. import DetailCom from "./detail.vue";
  53. import RelationCom from "./relation.vue";
  54. import TextCom from "./text.vue";
  55. import {useDictionaryStore} from "@/stores";
  56. const {proxy} = getCurrentInstance()
  57. const DictionaryStore = useDictionaryStore()
  58. const state: any = reactive({
  59. query: {
  60. loading: false,
  61. page: {
  62. pageNum: 1,
  63. pageSize: 10
  64. },
  65. tableHead: [
  66. {value: "indexName", label: "索引中文", fixed: 'left', width: 180},
  67. {value: "indexTableName", label: "索引表名", fixed: 'left', width: 180, popover: true},
  68. {value: "dataSource", label: "数据共享来源", width: 180},
  69. {value: "dataOffer", label: "数据提供来源", width: 180},
  70. {value: "shareMethod", label: "共享方式", width: 180},
  71. {value: "shareCycle", label: "共享周期", width: 180},
  72. {value: "pictureField", label: "图片字段", width: 180},
  73. {value: "themeMode", label: "主题模式", width: 180},
  74. {value: "pictureModeCardNum", label: "图模式卡片数", width: 180},
  75. {value: "cardColumnNum", label: "卡片列数", width: 180},
  76. {value: "columnModelNum", label: "列模式列数", width: 180},
  77. {value: "num", label: "数据量", width: 180},
  78. {value: "linkTypeNum", label: "关联分类数量", width: 180},
  79. {value: "createTime", label: "创建时间", width: 180},
  80. {value: "updateTime", label: "最后修改时间", width: 180},
  81. {value: "remark", label: "备注", width: 200},
  82. {value: "do", label: "操作", width: 320, fixed: 'right'},
  83. ],
  84. form: {},
  85. formReal: {},
  86. result: {
  87. total: 0,
  88. data: []
  89. }
  90. },
  91. detail: {
  92. show: false,
  93. transfer: {}
  94. },
  95. relation: {
  96. show: false,
  97. transfer: {}
  98. },
  99. text: {
  100. show: false,
  101. transfer: {}
  102. }
  103. })
  104. const onPage = (pageNum, pageSize) => {
  105. state.query.page = {
  106. pageNum: pageNum,
  107. pageSize: pageSize
  108. }
  109. const params = {
  110. page: state.query.page.pageNum,
  111. size: state.query.page.pageSize,
  112. }
  113. if (proxy.$util.isValue(state.query.formReal.keyword)) {
  114. params.keyword = state.query.formReal.keyword
  115. }
  116. state.query.loading = true
  117. sysIndexFindIndexByPage(proxy.$util.formatGetParam(params)).then(res => {
  118. if (res.code === 200) {
  119. state.query.result.total = res.data.totalElements
  120. state.query.result.data = res.data.content
  121. state.query.loading = false
  122. } else {
  123. ElMessage.error(res.msg)
  124. }
  125. })
  126. }
  127. const onSearch = () => {
  128. state.query.formReal = JSON.parse(JSON.stringify(state.query.form))
  129. onPage(1, state.query.page.pageSize)
  130. }
  131. const onReset = () => {
  132. state.query.page = {
  133. pageNum: 1,
  134. pageSize: 10
  135. }
  136. state.query.form = {}
  137. onSearch()
  138. }
  139. const onRelation = (row) => {
  140. state.relation.transfer = {
  141. id: row.id
  142. }
  143. state.relation.show = true
  144. }
  145. const onText = (row) => {
  146. state.text.transfer = {
  147. id: row.id,
  148. }
  149. state.text.show = true
  150. }
  151. const onAdd = () => {
  152. state.detail.transfer = {
  153. mode: 'add'
  154. }
  155. state.detail.show = true
  156. }
  157. const onEdit = (row) => {
  158. state.detail.transfer = {
  159. mode: 'edit',
  160. id: row.id,
  161. }
  162. state.detail.show = true
  163. }
  164. const onDel = (row) => {
  165. }
  166. const initDictionary = () => {
  167. DictionaryStore.initDict('gx_method')
  168. DictionaryStore.initDict('gx_cycle')
  169. DictionaryStore.initDict('theme_mode')
  170. DictionaryStore.initDict('default_model')
  171. }
  172. onMounted(() => {
  173. initDictionary()
  174. onReset()
  175. })
  176. </script>
  177. <style lang="scss" scoped>
  178. </style>