|
|
|
@ -23,13 +23,7 @@ import {
|
|
|
|
|
toRefs, |
|
|
|
|
watch |
|
|
|
|
} from 'vue' |
|
|
|
|
import { |
|
|
|
|
NButton, |
|
|
|
|
NIcon, |
|
|
|
|
NDataTable, |
|
|
|
|
NPagination, |
|
|
|
|
NSpace |
|
|
|
|
} from 'naive-ui' |
|
|
|
|
import { NButton, NIcon, NDataTable, NPagination, NSpace } from 'naive-ui' |
|
|
|
|
import { SearchOutlined } from '@vicons/antd' |
|
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
|
import { useColumns } from './use-columns' |
|
|
|
@ -56,15 +50,17 @@ const list = defineComponent({
|
|
|
|
|
const { data, changePage, changePageSize, deleteRecord, updateList } = |
|
|
|
|
useTable() |
|
|
|
|
|
|
|
|
|
const { getColumns } = useColumns((id: number, type: 'edit' | 'delete', row?: any) => { |
|
|
|
|
if (type === 'edit') { |
|
|
|
|
showDetailModal.value = true |
|
|
|
|
selectId.value = id |
|
|
|
|
selectType.value = row.type |
|
|
|
|
} else { |
|
|
|
|
deleteRecord(id) |
|
|
|
|
const { getColumns } = useColumns( |
|
|
|
|
(id: number, type: 'edit' | 'delete', row?: any) => { |
|
|
|
|
if (type === 'edit') { |
|
|
|
|
showDetailModal.value = true |
|
|
|
|
selectId.value = id |
|
|
|
|
selectType.value = row.type |
|
|
|
|
} else { |
|
|
|
|
deleteRecord(id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const onCreate = () => { |
|
|
|
|
selectId.value = null |
|
|
|
@ -83,6 +79,10 @@ const list = defineComponent({
|
|
|
|
|
showSourceModal.value = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleSourceModalClose = () => { |
|
|
|
|
showSourceModal.value = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
changePage(1) |
|
|
|
|
columns.value = getColumns() |
|
|
|
@ -106,7 +106,8 @@ const list = defineComponent({
|
|
|
|
|
trim, |
|
|
|
|
handleSelectSourceType, |
|
|
|
|
selectType, |
|
|
|
|
handleSourceModalOpen |
|
|
|
|
handleSourceModalOpen, |
|
|
|
|
handleSourceModalClose |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
render() { |
|
|
|
@ -127,7 +128,8 @@ const list = defineComponent({
|
|
|
|
|
onUpdatedList, |
|
|
|
|
handleSelectSourceType, |
|
|
|
|
selectType, |
|
|
|
|
handleSourceModalOpen |
|
|
|
|
handleSourceModalOpen, |
|
|
|
|
handleSourceModalClose |
|
|
|
|
} = this |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
@ -144,9 +146,9 @@ const list = defineComponent({
|
|
|
|
|
</NButton> |
|
|
|
|
<NSpace justify='end' wrap={false}> |
|
|
|
|
<Search |
|
|
|
|
v-model:value = {this.searchVal} |
|
|
|
|
placeholder = {t('datasource.search_input_tips')} |
|
|
|
|
onSearch={onUpdatedList} |
|
|
|
|
v-model:value={this.searchVal} |
|
|
|
|
placeholder={t('datasource.search_input_tips')} |
|
|
|
|
onSearch={onUpdatedList} |
|
|
|
|
/> |
|
|
|
|
<NButton type='primary' size='small' onClick={onUpdatedList}> |
|
|
|
|
<NIcon> |
|
|
|
@ -180,7 +182,11 @@ const list = defineComponent({
|
|
|
|
|
</NSpace> |
|
|
|
|
</NSpace> |
|
|
|
|
</Card> |
|
|
|
|
<SourceModal show={showSourceModal} onChange={handleSelectSourceType}></SourceModal> |
|
|
|
|
<SourceModal |
|
|
|
|
show={showSourceModal} |
|
|
|
|
onChange={handleSelectSourceType} |
|
|
|
|
onMaskClick={handleSourceModalClose} |
|
|
|
|
></SourceModal> |
|
|
|
|
<DetailModal |
|
|
|
|
show={showDetailModal} |
|
|
|
|
id={id} |
|
|
|
|