CzRger 6 日 前
コミット
3bc1904e9a
共有2 個のファイルを変更した24 個の追加1 個の削除を含む
  1. 5 0
      src/api/modules/manage/index.ts
  2. 19 1
      src/views/manage/index/index.vue

+ 5 - 0
src/api/modules/manage/index.ts

@@ -74,3 +74,8 @@ export const sysIndexGetThemeByIndex = (id: any) => handle({
   url: `/${suffix}/sys-index/getThemeByIndex/${id}`,
   method: 'get',
 })
+// 创建索引
+export const sysIndexCreateEsIndex = (code: any) => handle({
+  url: `/${suffix}/sys-index/createEsIndex/${code}`,
+  method: 'get',
+})

+ 19 - 1
src/views/manage/index/index.vue

@@ -33,6 +33,7 @@
           {{DictionaryStore.themeModeMap.get(scope.row.themeMode)}}
         </template>
         <template #do-column-value="{scope}">
+          <CusButton type="table-add" title="创建索引" @click="onCreate(scope.row)"/>
           <CusButton type="table" icon="relation" title="关联分类" @click="onRelation(scope.row)"/>
           <CusButton type="table" icon="relation" title="关联主题" @click="onTheme(scope.row)"/>
           <CusButton type="table-add" icon="text" title="字段" @click="onText(scope.row)"/>
@@ -52,6 +53,7 @@
 import {getCurrentInstance, onMounted, reactive} from "vue";
 import {ElMessage, ElMessageBox} from "element-plus";
 import {
+  sysIndexCreateEsIndex,
   sysIndexDeleteIndexById,
   sysIndexExport,
   sysIndexFindIndexByPage
@@ -89,7 +91,7 @@ const state: any = reactive({
       {value: "createTime", label: "创建时间", width: 200},
       {value: "updateTime", label: "最后修改时间", width: 200},
       {value: "remark", label: "备注", width: 200},
-      {value: "do", label: "操作", width: 420, fixed: 'right'},
+      {value: "do", label: "操作", width: 500, fixed: 'right'},
     ],
     form: {},
     formReal: {},
@@ -149,6 +151,22 @@ const onReset = () => {
   state.query.form = {}
   onSearch()
 }
+const onCreate = (row) => {
+  ElMessageBox.confirm(`请确认是否创建索引${row.indexName}(${row.indexTableName})?`, "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  } as any).then(() => {
+    state.query.loading = true
+    sysIndexCreateEsIndex(row.indexTableName).then(res => {
+      ElMessage.success('创建成功!')
+      state.query.loading = false
+      onSearch()
+    }).catch(() => {
+      state.query.loading = false
+    })
+  }).catch(() => {})
+}
 const onRelation = (row) => {
   state.relation.transfer = {
     id: row.id