接口专题咨询

This commit is contained in:
13218645326 2023-12-12 18:03:40 +08:00
parent fdb390a574
commit 244a666e2d
4 changed files with 74 additions and 74 deletions

View File

@ -3,12 +3,12 @@
<el-form :inline="true" :model="filterForm" class="demo-form-inline">
<el-form-item label="分类">
<el-select v-model.trim="filterForm.category" placeholder="Select" clearable filterable >
<el-select v-model.trim="filterForm.type" placeholder="Select" clearable filterable >
<el-option v-for="item in categoryList.list" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="关键字">
<el-input v-model.trim="filterForm.keyword" placeholder="请输入关键字" clearable />
<el-input v-model.trim="filterForm.topicName" placeholder="请输入关键字" clearable />
</el-form-item>
<el-form-item label="时间范围">
<el-date-picker v-model.trim="filterForm.dataRange" type="daterange" range-separator="To"
@ -28,22 +28,14 @@
<script lang="ts" setup>
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()
})
</script>
<style scoped lang="scss"></style>

View File

@ -27,7 +27,7 @@
</el-table-column>
</el-table>
<div class="paination_out">
<Pagination :currentPage="paginationInfo.currentPage" :pageSize="paginationInfo.pageSize" @sendPage="getPageFn"></Pagination>
<Pagination :currentPage="paginationInfo.pageNum" :pageSize="paginationInfo.pageSize" @sendPage="getPageFn"></Pagination>
</div>
</el-card>
</template>
@ -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()
})
</script>

View File

@ -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({

View File

@ -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,