分页
//例
handleCurrentChange(val) {
this.paging.page = val
this.queryParams.pageNum = val
this.getList()
},
查询列表
每次编辑、删除、查询、重置时运行
getList() {
this.loading = true
getBillInPlanData(this.queryParams).then((response) => {
this.BaseBillInPlanList = response.rows
this.paging.total = response.total
this.loading = false
})
},
搜索按钮
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
重置按钮
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
删除
handleDelete(row) {
this.$confirm('是否确认删除所选点位分组?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeBaseLogicalAreas(row.id).then((response) => {
this.$modal.msgSuccess('删除成功')
this.open = false
if (this.paging.total % 10 === 1) {
this.queryParams.pageNum == 1 ? this.queryParams.pageNum : (this.queryParams.pageNum = this.queryParams.pageNum - 1)
}
this.getList()
})
})
},
修改按钮
/** 修改按钮操作 */
handleUpdate(row) {
let tempRow = JSON.parse(JSON.stringify(row))
this.reset()
let data = {
id: tempRow.id,
logicAreaNo: tempRow.logicAreaNo,
logicAreaName: tempRow.logicAreaName,
isActivity: tempRow.isActivity,
remark: tempRow.remark
}
this.form = data
this.open = true
this.title = '编辑'
},
提交按钮
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.title === '编辑' && this.form.id !== null) {
saveOrUpdateBaseLogicalAreas(JSON.stringify([this.form])).then((response) => {
this.$modal.msgSuccess('编辑成功')
this.open = false
this.getList()
})
} else {
// console.log(JSON.stringify([this.form]))
saveOrUpdateBaseLogicalAreas(JSON.stringify([this.form])).then((response) => {
this.$modal.msgSuccess('添加成功')
this.open = false
this.getList()
})
}
}
})
}
新增
handleAdd() {
this.reset()
this.open = true
this.title = '新增'
},