add:添加类型
This commit is contained in:
1 parent
df4d5848a2
commit
0e521db11e
5 files changed
+28
-22
No files matched your search
@@ -5,6 +5,7 @@ import type { BaseTableColumns } from 'tdesign-vue-next'
|
||||
import CarousalDialog from '@/pages/carousal/components/CarousalDialog.vue'
|
||||
import { activeCarousal, deleteCarousal, getCarousalList, inactiveCarousal } from '@/api/carousal'
|
||||
import { BrowseIcon } from 'tdesign-icons-vue-next'
|
||||
import type { CarousalResult } from '@/model/carousals'
|
||||
|
||||
const columns: BaseTableColumns = [
|
||||
{
|
||||
@@ -29,7 +30,7 @@ const columns: BaseTableColumns = [
|
||||
}
|
||||
]
|
||||
const loading = ref<boolean>(false)
|
||||
const data = ref([])
|
||||
const data = ref<CarousalResult[]>([])
|
||||
const pagination = reactive<{page:number,size:number,total:number}>({
|
||||
page: 1,
|
||||
size: 10,
|
||||
@@ -41,7 +42,7 @@ const query = reactive<{page:number,size:number}>({
|
||||
})
|
||||
const carousalDialogVisible = ref<boolean>(false)
|
||||
const isEdit = ref<boolean>(false)
|
||||
const currentTableData = ref<object>({})
|
||||
const currentTableData = ref<CarousalResult | {}>({})
|
||||
const fetchSaveCarousalData = async () :Promise<void> => {
|
||||
/* TODO: 获取轮播图表格数据 */
|
||||
query.page = pagination.page
|
||||
@@ -51,12 +52,12 @@ const fetchSaveCarousalData = async () :Promise<void> => {
|
||||
pagination.total = getCarousalListApi.pagination.total
|
||||
}
|
||||
onMounted(fetchSaveCarousalData)
|
||||
const editClick = (row:object) => {
|
||||
const editClick = (row:object):void => {
|
||||
isEdit.value = true
|
||||
currentTableData.value = Object.assign({}, row)
|
||||
carousalDialogVisible.value = true
|
||||
}
|
||||
const showClick = async (res:object) => {
|
||||
const showClick = async (res:CarousalResult):Promise<void> => {
|
||||
if (res.status === 'active'){
|
||||
await inactiveCarousal(res.id)
|
||||
} else {
|
||||
@@ -64,20 +65,19 @@ const showClick = async (res:object) => {
|
||||
}
|
||||
await fetchSaveCarousalData()
|
||||
}
|
||||
const delClick = async (row:object) => {
|
||||
console.log(row,'删除')
|
||||
const delClick = async (row:CarousalResult) :Promise<void>=> {
|
||||
await deleteCarousal(row.id)
|
||||
await fetchSaveCarousalData()
|
||||
}
|
||||
const handleCreateCarousal = () => {
|
||||
const handleCreateCarousal = () :void => {
|
||||
isEdit.value = false
|
||||
carousalDialogVisible.value = true
|
||||
currentTableData.value = {}
|
||||
}
|
||||
const onPageChange = () => {
|
||||
const onPageChange = ():void => {
|
||||
/* TODO: 分页切换 */
|
||||
}
|
||||
const handleSuccessDialog = async () => {
|
||||
const handleSuccessDialog = async () :Promise<void> => {
|
||||
await fetchSaveCarousalData()
|
||||
carousalDialogVisible.value = false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user