From 244a666e2dc3e0a9f5ac007137d35172c7ba97ef Mon Sep 17 00:00:00 2001 From: 13218645326 Date: Tue, 12 Dec 2023 18:03:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=B8=93=E9=A2=98=E5=92=A8?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/headerTop.vue | 33 +++--- .../specialInformationConfiguration/index.vue | 112 +++++++++--------- .../configuration/swiperConfig/com/addCom.vue | 2 + .../configuration/swiperConfig/index.vue | 1 - 4 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/views/configuration/specialInformationConfiguration/com/headerTop.vue b/src/views/configuration/specialInformationConfiguration/com/headerTop.vue index d5007af..e583597 100644 --- a/src/views/configuration/specialInformationConfiguration/com/headerTop.vue +++ b/src/views/configuration/specialInformationConfiguration/com/headerTop.vue @@ -3,12 +3,12 @@ - + - + const emits = defineEmits(['search', 'reset', 'export', 'add']) +import { getdatatime } from "utils/time" const categoryList = reactive({ - list: [{ - - value: 'Option1', - label: 'Option1', - }, - { - value: 'Option2', - label: 'Option2', - - }] + list: [] }) -const filterForm = reactive({ - category:'', - keyword: '', - dataRange: '' +const filterForm:any = reactive({ + type:'', + topicName: '', + dataRange:'' }) @@ -52,7 +44,10 @@ const serachFn = () => { } const resetFn = () => { - emits('reset') + filterForm.type = '' + filterForm.topicName = '' + filterForm.dataRange = getdatatime() + emits('reset',filterForm) } const exportFn = () => { @@ -62,7 +57,9 @@ const addFn = () => { emits('add') } - +onMounted(() => { + filterForm.dataRange = getdatatime() +}) diff --git a/src/views/configuration/specialInformationConfiguration/index.vue b/src/views/configuration/specialInformationConfiguration/index.vue index 0e486c9..5bf8da8 100644 --- a/src/views/configuration/specialInformationConfiguration/index.vue +++ b/src/views/configuration/specialInformationConfiguration/index.vue @@ -27,7 +27,7 @@
- +
@@ -36,52 +36,18 @@ import headerTop from "./com/headerTop.vue" import addCom from "./com/addCom.vue" import { ElConfirmBeforeOpert } from "utils/elementCom" +import { apiBmTopicInfoList } from "http/api/config" +import moment from "moment"; + const addComRef = ref() const paginationInfo = reactive({ - currentPage: 1, + pageNum: 1, pageSize: 15 }) -const tableData = [ - { - v_id: '1', - v_title: '2016-05-03', - v_category: 'Tom', - v_publisher: 'California', - v_showCount: 'Los Angeles', - }, - { - v_id: '2', - v_title: '2016-05-03', - v_category: 'Tom', - v_publisher: 'California', - v_showCount: 'Los Angeles', - }, - { - v_id: '3', - v_title: '2016-05-03', - v_category: 'Tom', - v_publisher: 'California', - v_showCount: 'Los Angeles', - }, - { - v_id: '4', - v_title: '2016-05-03', - v_category: 'Tom', - v_publisher: 'California', - v_showCount: 'Los Angeles', - }, - { - v_id: '5', - v_title: '2016-05-03', - v_category: 'Tom', - v_publisher: 'California', - v_showCount: 'Los Angeles', - }, - -] +let total = ref(0) let tableListInfo = reactive({ - list: tableData + list: [] }) const showRowFn = (row: any) => { @@ -96,11 +62,20 @@ const editRowFn = (row: any) => { } -const deleteItem = (row: any) => { - const itemID = row.v_id - console.log("ITEMid", row) -} +const deleteItem = async (row: any) => { + const itemID = row.id + const index = tableListInfo.list.findIndex((ele: any) => ele.id == itemID) + const res = await apiBmCarouselSetsListDelete(itemID) + let tipMessage = "删除成功" + tableListInfo.list.splice(index, 1) + + ElMessage({ + type: 'success', + message: tipMessage + }) + +} const deleteRowFn = (row: any) => { ElConfirmBeforeOpert( '操作确认', @@ -112,15 +87,26 @@ const deleteRowFn = (row: any) => { ) } - -const searchFn = () => { - +let searchParams: any = { + carName: '' +} +const searchFn = (params: any) => { + searchParams = params + console.log("searchParams", params) + searchParams.beginTime = moment(params.dataRange[0]).format('yyyy-MM-DD') + searchParams.endTime = moment(params.dataRange[1]).format('yyyy-MM-DD') + initTableList() } -const resetFn = () => { - +const resetFn = (params: any) => { + searchParams = params + console.log("searchParams", params) + searchParams.beginTime = moment(params.dataRange[0]).format('yyyy-MM-DD') + searchParams.endTime = moment(params.dataRange[1]).format('yyyy-MM-DD') + initTableList() } + const exportFn = () => { } @@ -131,15 +117,31 @@ const addFn = () => { }) } -const getPageFn =(val:any)=>{ - paginationInfo.currentPage = val.currentPage - paginationInfo.pageSize = val.pageSize +const getPageFn = (val: any) => { + paginationInfo.pageNum = val.pageNum + paginationInfo.pageSize = val.pageSize initTableList() } -const initTableList =()=>{ - +const initTableList = async () => { + const params = { + ...searchParams, + ...paginationInfo + } + const res: any = await apiBmTopicInfoList(params) + console.log("apiBmTopicInfoList", res) + tableListInfo.list = res.rows.map((ele: any) => { + return { + ...ele, + status: ele.status == 1 ? true : false + } + }) + // tableListInfo.list = + total.value = res.total } +onMounted(() => { + initTableList() +}) diff --git a/src/views/configuration/swiperConfig/com/addCom.vue b/src/views/configuration/swiperConfig/com/addCom.vue index feb6983..4a0320c 100644 --- a/src/views/configuration/swiperConfig/com/addCom.vue +++ b/src/views/configuration/swiperConfig/com/addCom.vue @@ -37,6 +37,7 @@ import type { FormInstance, FormRules } from 'element-plus' import { ElMessage } from 'element-plus' import { linkReg } from "utils/reg" import { apiBmCarouselSetsById, apiBmCarouselSetsAddorupdate } from "http/api/config" +import { emit } from "process" const emits = defineEmits(['send']) const addShow = ref(false) let title: any = ref("新增") @@ -141,6 +142,7 @@ const updateFn = async () => { message: title.value + '成功' }) addShow.value = false + emit("send") } defineExpose({ diff --git a/src/views/configuration/swiperConfig/index.vue b/src/views/configuration/swiperConfig/index.vue index 2c18625..9f7f1ca 100644 --- a/src/views/configuration/swiperConfig/index.vue +++ b/src/views/configuration/swiperConfig/index.vue @@ -58,7 +58,6 @@ import { ElConfirmBeforeOpert } from "utils/elementCom" import { apiBmCarouselSetsListDelete, apiBmCarouselSetList, apiBmCarouselSetsAddorupdate } from "http/api/config" import { ElMessage } from 'element-plus' import moment from "moment"; -import { status } from "nprogress" const addComRef = ref() const paginationInfo = reactive({ pageNum: 1,