Merge branch 'feature/31-carousal' into feature/code-review-sprint1
This commit is contained in:
commit
f8fc42dfec
6 files changed
+35
-31
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 = [
|
||||
{
|
||||
@@ -28,21 +29,21 @@ const columns: BaseTableColumns = [
|
||||
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,
|
||||
size: 10,
|
||||
total:0
|
||||
})
|
||||
const query = reactive({
|
||||
const query = reactive<{page:number,size:number}>({
|
||||
page:1,
|
||||
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: 获取轮播图表格数据 */
|
||||
query.page = pagination.page
|
||||
query.size = pagination.size
|
||||
@@ -51,12 +52,12 @@ const fetchSaveCarousalData = async () => {
|
||||
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