|
@@ -5,6 +5,7 @@ import type { BaseTableColumns } from 'tdesign-vue-next'
|
|
|
import CarousalDialog from '@/pages/carousal/components/CarousalDialog.vue'
|
|
import CarousalDialog from '@/pages/carousal/components/CarousalDialog.vue'
|
|
|
import { activeCarousal, deleteCarousal, getCarousalList, inactiveCarousal } from '@/api/carousal'
|
|
import { activeCarousal, deleteCarousal, getCarousalList, inactiveCarousal } from '@/api/carousal'
|
|
|
import { BrowseIcon } from 'tdesign-icons-vue-next'
|
|
import { BrowseIcon } from 'tdesign-icons-vue-next'
|
|
|
|
|
+import type { CarousalResult } from '@/model/carousals'
|
|
|
|
|
|
|
|
const columns: BaseTableColumns = [
|
|
const columns: BaseTableColumns = [
|
|
|
{
|
|
{
|
|
@@ -28,21 +29,21 @@ const columns: BaseTableColumns = [
|
|
|
width: 100,
|
|
width: 100,
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
-const loading = ref(false)
|
|
|
|
|
-const data = ref([])
|
|
|
|
|
-const pagination = reactive({
|
|
|
|
|
|
|
+const loading = ref<boolean>(false)
|
|
|
|
|
+const data = ref<CarousalResult[]>([])
|
|
|
|
|
+const pagination = reactive<{page:number,size:number,total:number}>({
|
|
|
page: 1,
|
|
page: 1,
|
|
|
size: 10,
|
|
size: 10,
|
|
|
total:0
|
|
total:0
|
|
|
})
|
|
})
|
|
|
-const query = reactive({
|
|
|
|
|
|
|
+const query = reactive<{page:number,size:number}>({
|
|
|
page:1,
|
|
page:1,
|
|
|
size:10,
|
|
size:10,
|
|
|
})
|
|
})
|
|
|
-const carousalDialogVisible = ref(false)
|
|
|
|
|
-const isEdit = ref(false)
|
|
|
|
|
-const currentTableData = ref<{}>({})
|
|
|
|
|
-const fetchSaveCarousalData = async () => {
|
|
|
|
|
|
|
+const carousalDialogVisible = ref<boolean>(false)
|
|
|
|
|
+const isEdit = ref<boolean>(false)
|
|
|
|
|
+const currentTableData = ref<CarousalResult | {}>({})
|
|
|
|
|
+const fetchSaveCarousalData = async () :Promise<void> => {
|
|
|
/* TODO: 获取轮播图表格数据 */
|
|
/* TODO: 获取轮播图表格数据 */
|
|
|
query.page = pagination.page
|
|
query.page = pagination.page
|
|
|
query.size = pagination.size
|
|
query.size = pagination.size
|
|
@@ -51,12 +52,12 @@ const fetchSaveCarousalData = async () => {
|
|
|
pagination.total = getCarousalListApi.pagination.total
|
|
pagination.total = getCarousalListApi.pagination.total
|
|
|
}
|
|
}
|
|
|
onMounted(fetchSaveCarousalData)
|
|
onMounted(fetchSaveCarousalData)
|
|
|
-const editClick = (row:object) => {
|
|
|
|
|
|
|
+const editClick = (row:object):void => {
|
|
|
isEdit.value = true
|
|
isEdit.value = true
|
|
|
currentTableData.value = Object.assign({}, row)
|
|
currentTableData.value = Object.assign({}, row)
|
|
|
carousalDialogVisible.value = true
|
|
carousalDialogVisible.value = true
|
|
|
}
|
|
}
|
|
|
-const showClick = async (res:object) => {
|
|
|
|
|
|
|
+const showClick = async (res:CarousalResult):Promise<void> => {
|
|
|
if (res.status === 'active'){
|
|
if (res.status === 'active'){
|
|
|
await inactiveCarousal(res.id)
|
|
await inactiveCarousal(res.id)
|
|
|
} else {
|
|
} else {
|
|
@@ -64,20 +65,19 @@ const showClick = async (res:object) => {
|
|
|
}
|
|
}
|
|
|
await fetchSaveCarousalData()
|
|
await fetchSaveCarousalData()
|
|
|
}
|
|
}
|
|
|
-const delClick = async (row:object) => {
|
|
|
|
|
- console.log(row,'删除')
|
|
|
|
|
|
|
+const delClick = async (row:CarousalResult) :Promise<void>=> {
|
|
|
await deleteCarousal(row.id)
|
|
await deleteCarousal(row.id)
|
|
|
await fetchSaveCarousalData()
|
|
await fetchSaveCarousalData()
|
|
|
}
|
|
}
|
|
|
-const handleCreateCarousal = () => {
|
|
|
|
|
|
|
+const handleCreateCarousal = () :void => {
|
|
|
isEdit.value = false
|
|
isEdit.value = false
|
|
|
carousalDialogVisible.value = true
|
|
carousalDialogVisible.value = true
|
|
|
currentTableData.value = {}
|
|
currentTableData.value = {}
|
|
|
}
|
|
}
|
|
|
-const onPageChange = () => {
|
|
|
|
|
|
|
+const onPageChange = ():void => {
|
|
|
/* TODO: 分页切换 */
|
|
/* TODO: 分页切换 */
|
|
|
}
|
|
}
|
|
|
-const handleSuccessDialog = async () => {
|
|
|
|
|
|
|
+const handleSuccessDialog = async () :Promise<void> => {
|
|
|
await fetchSaveCarousalData()
|
|
await fetchSaveCarousalData()
|
|
|
carousalDialogVisible.value = false
|
|
carousalDialogVisible.value = false
|
|
|
}
|
|
}
|