Commit ea0e104d authored by daywrite's avatar daywrite

修改分页

parent d6cc85ce
...@@ -51,6 +51,7 @@ let setUrlK = (o) => { ...@@ -51,6 +51,7 @@ let setUrlK = (o) => {
export function requestAPI (option, data) { export function requestAPI (option, data) {
let _option = Object.assign({}, option) let _option = Object.assign({}, option)
if (dev && data && option.method === 'GET') { if (dev && data && option.method === 'GET') {
_option.url += '?duplextrans'
_option.url += setUrlK(data) _option.url += setUrlK(data)
data = {} data = {}
} }
......
const dev = process.env.NODE_ENV === 'development'
let urlEnd = dev ? '?duplextrans' : ''
export default { export default {
getScheduleList: { getScheduleList: {
url: '/vue/schedule/list' + urlEnd url: '/vue/schedule/list'
}, },
// 获取查询条件 // 获取查询条件
getScheduleFilter: { getScheduleFilter: {
url: '/vue/schedule/get-filter' + urlEnd url: '/vue/schedule/get-filter'
}, },
// 新建待办事项获取下拉列表配置项 // 新建待办事项获取下拉列表配置项
getSaveNew: { getSaveNew: {
url: '/vue/schedule/get-new' + urlEnd url: '/vue/schedule/get-new'
}, },
// 搜索客户名称 // 搜索客户名称
getClientByName: { getClientByName: {
url: '/vue/search/client-by-name' + urlEnd url: '/vue/search/client-by-name'
}, },
// 保存待办事项 // 保存待办事项
saveNewSchedule: { saveNewSchedule: {
url: '/vue/schedule/save-new' + urlEnd url: '/vue/schedule/save-new'
}, },
saveEditSchedule: { saveEditSchedule: {
url: '/vue/schedule/save-edit' + urlEnd url: '/vue/schedule/save-edit'
}, },
// 删除待办事项 // 删除待办事项
deleteSchedule: { deleteSchedule: {
url: '/vue/schedule/delete' + urlEnd url: '/vue/schedule/delete'
}, },
// 留言 // 留言
getCommentList: { getCommentList: {
url: '/vue/comment/list' + urlEnd url: '/vue/comment/list'
}, },
// 留言新建 // 留言新建
saveNewComment: { saveNewComment: {
url: '/vue/comment/save-new' + urlEnd url: '/vue/comment/save-new'
}, },
// 留言删除 // 留言删除
deleteComment: { deleteComment: {
url: '/vue/comment/delete' + urlEnd url: '/vue/comment/delete'
} }
} }
...@@ -142,8 +142,8 @@ export default { ...@@ -142,8 +142,8 @@ export default {
this.updateForm(search) this.updateForm(search)
}, },
updateForm (form) { updateForm (search) {
let _form = Object.assign({}, this.form, form) let _form = Object.assign({}, this.form, search)
this.getScheduleList(_form) this.getScheduleList(_form)
}, },
...@@ -176,9 +176,9 @@ export default { ...@@ -176,9 +176,9 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
requestAPI(api.deleteSchedule) requestAPI(api.deleteSchedule, { id })
.then((res) => { .then((res) => {
console.log(res) this.$message.success('删除成功')
}) })
}).catch(() => { }).catch(() => {
this.$message.info('取消删除') this.$message.info('取消删除')
...@@ -186,19 +186,21 @@ export default { ...@@ -186,19 +186,21 @@ export default {
}, },
getScheduleList (form) { getScheduleList (form) {
requestAPI(api.getScheduleList) let _page = this.result.pagenation
.then((res) => { requestAPI(api.getScheduleList, {
const { ...form,
list = [], page: _page.thispage
pagenation = {}, }).then((res) => {
thisUser = {} const {
} = res list = [],
pagenation = {},
this.result.list = list thisUser = {}
this.result.pagenation = pagenation } = res
this.result.pagenation.totalcount = 120
this.result.thisUser = thisUser this.result.list = list
}) this.result.pagenation = pagenation
this.result.thisUser = thisUser
})
} }
} }
} }
...@@ -229,7 +231,7 @@ export default { ...@@ -229,7 +231,7 @@ export default {
} }
i { i {
display: inline-block; display: inline-block;
padding-right: 3px; padding-right: 3px;
} }
} }
</style> </style>
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
// this.$parent.loadList() // this.$parent.loadList()
}, },
handleCurrentChange (val) { handleCurrentChange (val) {
this.pager.page = val this.pager.thispage = val
this.pager.totalcount = this.total this.pager.totalcount = this.total
this.$emit('update:pager', this.pager) this.$emit('update:pager', this.pager)
// this.$parent.loadList() // this.$parent.loadList()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment