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