处理分页查询报错的问题

This commit is contained in:
renpy 2023-08-01 10:34:35 +08:00
parent 51303a266f
commit 995931c822
5 changed files with 48 additions and 20 deletions

View File

@ -1,6 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import { axios } from '@/utils/request' import { axios } from '@/utils/request'
import signMd5Utils from '@/utils/encryption/signMd5Utils' import signMd5Utils from '@/utils/encryption/signMd5Utils'
import qs from "qs";
const api = { const api = {
user: '/mock/api/user', user: '/mock/api/user',
@ -65,6 +66,9 @@ export function getAction(url,parameter) {
url: url, url: url,
method: 'get', method: 'get',
params: parameter, params: parameter,
paramsSerializer: function (params) {
return qs.stringify(params, { arrayFormat: "repeat" });
},
headers: signHeader headers: signHeader
}) })
} }

View File

@ -128,7 +128,8 @@ export default {
url: { url: {
list: '/alarmLog/findPage' list: '/alarmLog/findPage'
}, },
pieTotal:0 pieTotal: 0,
paramsArg: {}
} }
}, },
mounted () { mounted () {
@ -139,6 +140,11 @@ export default {
return (Math.random()+new Date().getTime()).toString(32).slice(0,8) return (Math.random()+new Date().getTime()).toString(32).slice(0,8)
}, },
handleSearch({ startDate, endDate, types }) { handleSearch({ startDate, endDate, types }) {
this.paramsArg = {
startDate,
endDate,
types
}
this.getAlarmLogBar({ startDate, endDate }) this.getAlarmLogBar({ startDate, endDate })
this.getTypeAlarmPie({ startDate, endDate }) this.getTypeAlarmPie({ startDate, endDate })
this.getAlarmLogTable({ startDate, endDate, types }) this.getAlarmLogTable({ startDate, endDate, types })
@ -164,7 +170,7 @@ export default {
let params = { let params = {
pageNo: this.ipagination.current, pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize, pageSize: this.ipagination.pageSize,
type:obj.types, type:obj.types || null,
startDate:obj.startDate, startDate:obj.startDate,
endDate:obj.endDate endDate:obj.endDate
} }
@ -261,12 +267,12 @@ export default {
handlePageChange(page, pageSize) { handlePageChange(page, pageSize) {
this.ipagination.current = page this.ipagination.current = page
this.ipagination.pageSize = pageSize this.ipagination.pageSize = pageSize
this.getAlarmLogTable() this.getAlarmLogTable(this.paramsArg)
}, },
handleSizeChange(current, size) { handleSizeChange(current, size) {
this.ipagination.current = current this.ipagination.current = current
this.ipagination.pageSize = size this.ipagination.pageSize = size
this.getAlarmLogTable() this.getAlarmLogTable(this.paramsArg)
}, },
handleTabChange(key) { handleTabChange(key) {
console.log(key); console.log(key);

View File

@ -34,6 +34,7 @@
</template> </template>
<script> <script>
import dateFormat from '@/components/jeecg/JEasyCron/format-date'
import SearchBar from '../../components/searchBar'; import SearchBar from '../../components/searchBar';
import TableList from '../../components/tableList.vue'; import TableList from '../../components/tableList.vue';
import { getAction,postAction,httpAction,deleteAction } from '@/api/manage' import { getAction,postAction,httpAction,deleteAction } from '@/api/manage'
@ -79,11 +80,12 @@ export default {
nameOptions: [], nameOptions: [],
dataSource: [], dataSource: [],
loading: false, loading: false,
paramsArg: {}
} }
}, },
mounted () { mounted () {
this.getDbList(); this.getDbList();
this.getDbAlarmHistory({startDate:dateFormat(new Date(), 'yyyy-MM-dd'),endDate:dateFormat(new Date(), 'yyyy-MM-dd')})
}, },
methods: { methods: {
getDbList() { getDbList() {
@ -101,13 +103,17 @@ export default {
}) })
}, },
handleSearch({ startDate, endDate, names }) { handleSearch({ startDate, endDate, names }) {
console.log(startDate, endDate, names); this.paramsArg = {
startDate,
endDate,
names
}
this.getDbAlarmHistory({ startDate, endDate, names }) this.getDbAlarmHistory({ startDate, endDate, names })
}, },
getDbAlarmHistory(obj) { getDbAlarmHistory(obj) {
this.loading = true this.loading = true
let params = { let params = {
sourceId: obj.names, sourceId: obj.names||null,
startDate:obj.startDate, startDate:obj.startDate,
endDate: obj.endDate, endDate: obj.endDate,
pageNo: this.ipagination.current, pageNo: this.ipagination.current,
@ -129,12 +135,12 @@ export default {
handlePageChange(page, pageSize) { handlePageChange(page, pageSize) {
this.ipagination.current = page this.ipagination.current = page
this.ipagination.pageSize = pageSize this.ipagination.pageSize = pageSize
this.getDbAlarmHistory() this.getDbAlarmHistory(this.paramsArg)
}, },
handleSizeChange(current, size) { handleSizeChange(current, size) {
this.ipagination.current = current this.ipagination.current = current
this.ipagination.pageSize = size this.ipagination.pageSize = size
this.getDbAlarmHistory() this.getDbAlarmHistory(this.paramsArg)
}, },
}, },
} }

View File

@ -34,6 +34,7 @@
</template> </template>
<script> <script>
import dateFormat from '@/components/jeecg/JEasyCron/format-date'
import SearchBar from '../../components/searchBar'; import SearchBar from '../../components/searchBar';
import TableList from '../../components/tableList.vue'; import TableList from '../../components/tableList.vue';
import { getAction,postAction,httpAction,deleteAction } from '@/api/manage' import { getAction,postAction,httpAction,deleteAction } from '@/api/manage'
@ -79,11 +80,12 @@ export default {
nameOptions: [], nameOptions: [],
dataSource: [], dataSource: [],
loading: false, loading: false,
paramsArg: {}
} }
}, },
mounted () { mounted () {
this.getEmailList(); this.getEmailList();
this.getEmailAlarmHistory({startDate:dateFormat(new Date(), 'yyyy-MM-dd'),endDate:dateFormat(new Date(), 'yyyy-MM-dd')})
}, },
methods: { methods: {
getEmailList() { getEmailList() {
@ -101,13 +103,17 @@ export default {
}) })
}, },
handleSearch({ startDate, endDate, names }) { handleSearch({ startDate, endDate, names }) {
console.log(startDate, endDate, names); this.paramsArg = {
startDate,
endDate,
names
}
this.getEmailAlarmHistory({ startDate, endDate, names }) this.getEmailAlarmHistory({ startDate, endDate, names })
}, },
getEmailAlarmHistory(obj) { getEmailAlarmHistory(obj) {
this.loading = true this.loading = true
let params = { let params = {
sourceId: obj.names, sourceId: obj.names||null,
startDate:obj.startDate, startDate:obj.startDate,
endDate: obj.endDate, endDate: obj.endDate,
pageNo: this.ipagination.current, pageNo: this.ipagination.current,
@ -129,12 +135,12 @@ export default {
handlePageChange(page, pageSize) { handlePageChange(page, pageSize) {
this.ipagination.current = page this.ipagination.current = page
this.ipagination.pageSize = pageSize this.ipagination.pageSize = pageSize
this.getEmailAlarmHistory() this.getEmailAlarmHistory(this.paramsArg)
}, },
handleSizeChange(current, size) { handleSizeChange(current, size) {
this.ipagination.current = current this.ipagination.current = current
this.ipagination.pageSize = size this.ipagination.pageSize = size
this.getEmailAlarmHistory() this.getEmailAlarmHistory(this.paramsArg)
}, },
}, },
} }

View File

@ -34,6 +34,7 @@
</template> </template>
<script> <script>
import dateFormat from '@/components/jeecg/JEasyCron/format-date'
import SearchBar from '../../components/searchBar'; import SearchBar from '../../components/searchBar';
import TableList from '../../components/tableList.vue'; import TableList from '../../components/tableList.vue';
import { getAction,postAction,httpAction,deleteAction } from '@/api/manage' import { getAction,postAction,httpAction,deleteAction } from '@/api/manage'
@ -79,11 +80,12 @@ export default {
nameOptions: [], nameOptions: [],
dataSource: [], dataSource: [],
loading: false, loading: false,
paramsArg: {}
} }
}, },
mounted () { mounted () {
this.getServerList(); this.getServerList();
this.getServerAlarmHistory({startDate:dateFormat(new Date(), 'yyyy-MM-dd'),endDate:dateFormat(new Date(), 'yyyy-MM-dd')})
}, },
methods: { methods: {
getServerList() { getServerList() {
@ -101,13 +103,17 @@ export default {
}) })
}, },
handleSearch({ startDate, endDate, names }) { handleSearch({ startDate, endDate, names }) {
console.log(startDate, endDate, names); this.paramsArg = {
startDate,
endDate,
names
}
this.getServerAlarmHistory({ startDate, endDate, names }) this.getServerAlarmHistory({ startDate, endDate, names })
}, },
getServerAlarmHistory(obj) { getServerAlarmHistory(obj) {
this.loading = true this.loading = true
let params = { let params = {
sourceId: obj.names, sourceId: obj.names||null,
startDate:obj.startDate, startDate:obj.startDate,
endDate: obj.endDate, endDate: obj.endDate,
pageNo: this.ipagination.current, pageNo: this.ipagination.current,
@ -129,12 +135,12 @@ export default {
handlePageChange(page, pageSize) { handlePageChange(page, pageSize) {
this.ipagination.current = page this.ipagination.current = page
this.ipagination.pageSize = pageSize this.ipagination.pageSize = pageSize
this.getServerAlarmHistory() this.getServerAlarmHistory(this.paramsArg)
}, },
handleSizeChange(current, size) { handleSizeChange(current, size) {
this.ipagination.current = current this.ipagination.current = current
this.ipagination.pageSize = size this.ipagination.pageSize = size
this.getServerAlarmHistory() this.getServerAlarmHistory(this.paramsArg)
}, },
}, },
} }