|
@@ -30,12 +30,17 @@
|
|
:table-head="state.query.tableHead"
|
|
:table-head="state.query.tableHead"
|
|
:no-page="true"
|
|
:no-page="true"
|
|
>
|
|
>
|
|
|
|
+ <template #isMain-column-value="{scope}">
|
|
|
|
+ {{DictionaryStore.isMainIndexMap.get(scope.row.isMain)}}
|
|
|
|
+ </template>
|
|
<template #do-column-value="{scope}">
|
|
<template #do-column-value="{scope}">
|
|
|
|
+ <CusButton type="table-edit" @click="onEdit(scope.row)"/>
|
|
<CusButton type="table-del" @click="onDel(scope.row)"/>
|
|
<CusButton type="table-del" @click="onDel(scope.row)"/>
|
|
</template>
|
|
</template>
|
|
</CusTable>
|
|
</CusTable>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <RelationDetailCom v-model:show="state.relationDetail.show" :transfer="state.relationDetail.transfer" @refresh="initRelation"/>
|
|
</CusDialog>
|
|
</CusDialog>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -43,12 +48,12 @@
|
|
import {computed, getCurrentInstance, nextTick, reactive, ref, watch} from "vue";
|
|
import {computed, getCurrentInstance, nextTick, reactive, ref, watch} from "vue";
|
|
import {useDictionaryStore} from "@/stores";
|
|
import {useDictionaryStore} from "@/stores";
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
-import DetailCom from "@/views/manage/type/detail.vue";
|
|
|
|
|
|
+import RelationDetailCom from "./relation-detail.vue";
|
|
import {
|
|
import {
|
|
- sysLabelAddIndexToLabel, sysLabelDeleteLink,
|
|
|
|
- sysLabelGetAllIndexsByKey,
|
|
|
|
- sysLabelGetAllSysLabelTypes
|
|
|
|
|
|
+ sysLabelDeleteLink,
|
|
|
|
+ sysLabelGetAllIndexsByKey
|
|
} from "@/api/modules/manage/type";
|
|
} from "@/api/modules/manage/type";
|
|
|
|
+import {sysThemeFind, sysThemeIndexFindAll} from "@/api/modules/manage/theme";
|
|
|
|
|
|
const emit = defineEmits(['update:show', 'refresh'])
|
|
const emit = defineEmits(['update:show', 'refresh'])
|
|
const {proxy} = getCurrentInstance()
|
|
const {proxy} = getCurrentInstance()
|
|
@@ -62,19 +67,27 @@ const state: any = reactive({
|
|
query: {
|
|
query: {
|
|
loading: false,
|
|
loading: false,
|
|
tableHead: [
|
|
tableHead: [
|
|
- {value: "indexName", label: "索引中文"},
|
|
|
|
- {value: "indexTableName", label: "索引表名", popover: true},
|
|
|
|
- {value: "num", label: "数据量", width: 100},
|
|
|
|
- {value: "linkTime", label: "关联时间", minWidth: 200},
|
|
|
|
- {value: "do", label: "操作", width: 100, fixed: 'right'},
|
|
|
|
|
|
+ {value: "indexTableName", label: "索引英文", popover: true},
|
|
|
|
+ {value: "indexName", label: "索引名称"},
|
|
|
|
+ {value: "indexNameShort", label: "索引简称"},
|
|
|
|
+ {value: "isMain", label: "主索引"},
|
|
|
|
+ {value: "fieldName", label: "关联索引"},
|
|
|
|
+ {value: "weight", label: "权重"},
|
|
|
|
+ {value: "description", label: "关系描述"},
|
|
|
|
+ {value: "do", label: "操作", width: 300, fixed: 'right'},
|
|
],
|
|
],
|
|
result: {
|
|
result: {
|
|
data: []
|
|
data: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ form: {},
|
|
loadingIndex: false,
|
|
loadingIndex: false,
|
|
indexList: [],
|
|
indexList: [],
|
|
- indexSelect: ''
|
|
|
|
|
|
+ indexSelect: '',
|
|
|
|
+ relationDetail: {
|
|
|
|
+ transfer: {},
|
|
|
|
+ show: false
|
|
|
|
+ }
|
|
})
|
|
})
|
|
const ref_search = ref()
|
|
const ref_search = ref()
|
|
const fetchSuggestions = (queryString: string, cb: any) => {
|
|
const fetchSuggestions = (queryString: string, cb: any) => {
|
|
@@ -91,27 +104,17 @@ const fetchSuggestions = (queryString: string, cb: any) => {
|
|
cb(results)
|
|
cb(results)
|
|
}
|
|
}
|
|
const handleSelect = (item) => {
|
|
const handleSelect = (item) => {
|
|
- ElMessageBox.confirm(`是否关联${item.indexName}?`, "提示", {
|
|
|
|
- confirmButtonText: "确定",
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
- type: "warning",
|
|
|
|
- } as any).then(() => {
|
|
|
|
- state.loading = true
|
|
|
|
- sysLabelAddIndexToLabel(proxy.$util.formatGetParam({
|
|
|
|
- indexId: item.id,
|
|
|
|
- typeId: props.transfer.id
|
|
|
|
- })).then(res => {
|
|
|
|
- if (res.code === 200) {
|
|
|
|
- ElMessage.success('添加成功!')
|
|
|
|
- emit('refresh')
|
|
|
|
- state.loading = false
|
|
|
|
- ref_search.value?.blur()
|
|
|
|
- initRelation()
|
|
|
|
- } else {
|
|
|
|
- ElMessage.error(res.msg)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }).catch(() => {})
|
|
|
|
|
|
+ state.relationDetail.transfer = {
|
|
|
|
+ mode: 'add',
|
|
|
|
+ indexId: item.id,
|
|
|
|
+ indexTableName: item.indexTableName,
|
|
|
|
+ indexName: item.indexName,
|
|
|
|
+ themeId: props.transfer.id,
|
|
|
|
+ conditionOptions: state.form.themeParam,
|
|
|
|
+ relationOptions: state.query.result.data.map(v => ({dictLabel: v.indexName, dictValue: v.id})),
|
|
|
|
+ hasMain: state.query.result.data.some(v => v.isMain == 1)
|
|
|
|
+ }
|
|
|
|
+ state.relationDetail.show = true
|
|
}
|
|
}
|
|
const initIndex = () => {
|
|
const initIndex = () => {
|
|
state.loadingIndex = true
|
|
state.loadingIndex = true
|
|
@@ -126,7 +129,7 @@ const initIndex = () => {
|
|
}
|
|
}
|
|
const initRelation = () => {
|
|
const initRelation = () => {
|
|
state.query.loading = true
|
|
state.query.loading = true
|
|
- sysLabelGetAllSysLabelTypes(props.transfer.id).then(res => {
|
|
|
|
|
|
+ sysThemeIndexFindAll(props.transfer.id).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
state.query.result.data = res.data
|
|
state.query.result.data = res.data
|
|
state.query.loading = false
|
|
state.query.loading = false
|
|
@@ -135,6 +138,26 @@ const initRelation = () => {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+const onEdit = (row) => {
|
|
|
|
+ let hasMain = false
|
|
|
|
+ state.query.result.data.forEach(v => {
|
|
|
|
+ if (v.isMain == 1) {
|
|
|
|
+ if (v.id != row.id) {
|
|
|
|
+ hasMain = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ state.relationDetail.transfer = {
|
|
|
|
+ mode: 'edit',
|
|
|
|
+ id: row.id,
|
|
|
|
+ indexTableName: row.indexTableName,
|
|
|
|
+ indexName: row.indexName,
|
|
|
|
+ conditionOptions: state.form.themeParam,
|
|
|
|
+ relationOptions: state.query.result.data.filter(v => v.id !== row.id).map(v => ({dictLabel: v.indexName, dictValue: v.id})),
|
|
|
|
+ hasMain: hasMain
|
|
|
|
+ }
|
|
|
|
+ state.relationDetail.show = true
|
|
|
|
+}
|
|
const onDel = (row) => {
|
|
const onDel = (row) => {
|
|
ElMessageBox.confirm(`请确认是否取消关联${row.indexName}?`, "提示", {
|
|
ElMessageBox.confirm(`请确认是否取消关联${row.indexName}?`, "提示", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
@@ -154,13 +177,29 @@ const onDel = (row) => {
|
|
})
|
|
})
|
|
}).catch(() => {})
|
|
}).catch(() => {})
|
|
}
|
|
}
|
|
|
|
+const initDetail = () => {
|
|
|
|
+ state.loading = true
|
|
|
|
+ sysThemeFind(props.transfer.id).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ state.form = res.data
|
|
|
|
+ if (state.form.themeType == '2') {
|
|
|
|
+ state.form.themeParam = state.form.themeParam.split(',')
|
|
|
|
+ }
|
|
|
|
+ state.loading = false
|
|
|
|
+ } else {
|
|
|
|
+ ElMessage.error(res.msg)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
watch(() => props.show, (n) => {
|
|
watch(() => props.show, (n) => {
|
|
if (n) {
|
|
if (n) {
|
|
initIndex()
|
|
initIndex()
|
|
- // initRelation()
|
|
|
|
|
|
+ initRelation()
|
|
|
|
+ initDetail()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
const initDictionary = () => {
|
|
const initDictionary = () => {
|
|
|
|
+ DictionaryStore.initDict('is_main_index')
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|