Commit 872dc7c4 authored by daniel's avatar daniel

fix(gunRule): 发枪预约联调

parent 91debcea
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
</n-card> </n-card>
<!-- 搜索框 --> <!-- 搜索框 -->
<div class="w-full flex flex-row items-start gap-x-3"> <div class="w-full flex flex-row items-start gap-x-3">
<div class="bg-white flex flex-col gap-y-2 p-3"> <div class="bg-white flex flex-col gap-y-2 p-3" style="min-width:200px;max-width:250px;">
<h4 class="flex flex-row items-center justify-between w-full"> <h4 class="flex flex-row items-center justify-between w-full">
分类列表 分类列表
<n-button type="primary" @click="onEditCategory(null)" size="tiny"> <n-button type="primary" @click="onEditCategory(null)" size="tiny">
...@@ -138,7 +138,8 @@ ...@@ -138,7 +138,8 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<n-data-table :columns="columns" :loading="loading" :data="feedbacks" :pagination="pagination" <n-data-table :columns="columns" :loading="loading" :data="feedbacks" :pagination="pagination"
:bordered="false" @update:page="handlePageChange"/> :bordered="false"
:remote="true"/>
</div> </div>
</div> </div>
<n-modal :mask-closable="false" :loading="loading" style="width: 400px" :title="categoryFormValue.id?'编辑分类':'新增分类'" <n-modal :mask-closable="false" :loading="loading" style="width: 400px" :title="categoryFormValue.id?'编辑分类':'新增分类'"
...@@ -382,7 +383,9 @@ ...@@ -382,7 +383,9 @@
if (data.code === 200) { if (data.code === 200) {
feedbackCategories.value = data.content.content feedbackCategories.value = data.content.content
showCategoryModal.value = false showCategoryModal.value = false
if (data.content.content.length) {
getFeedBacks() getFeedBacks()
}
} else { } else {
message.error(data.msg) message.error(data.msg)
} }
...@@ -512,7 +515,25 @@ ...@@ -512,7 +515,25 @@
} }
} }
] ]
const pagination = ref({ pageSize: 20, page: 1 }) // 分页
const pagination = reactive({
pageSize: 20,
page: 1,
pageCount: 0,
showSizePicker: true,
itemCount: 0,
pageSizes: [20, 50, 200, 500],
prefix: (info) => "共" + info.itemCount + "条数据",
onChange: (page) => {
pagination.page = page
getFeedBacks()
},
onUpdatePageSize: (pageSize) => {
pagination.pageSize = pageSize
pagination.page = 1
getFeedBacks()
}
})
const keyword = ref('') const keyword = ref('')
// 文件列表 // 文件列表
const fileList = ref([]) const fileList = ref([])
...@@ -569,7 +590,7 @@ ...@@ -569,7 +590,7 @@
const status = ref('') const status = ref('')
// 状态更新 // 状态更新
const updateStatus = (value) => { const updateStatus = (value) => {
pagination.value.page = 1 pagination.page = 1
status.value = value status.value = value
getFeedBacks() getFeedBacks()
} }
...@@ -708,7 +729,14 @@ ...@@ -708,7 +729,14 @@
} }
// 获取反馈分页列表 // 获取反馈分页列表
const getFeedBacks = async () => { const getFeedBacks = async () => {
if (!feedbackCategories.value.length) {
pagination.itemCount = 0
pagination.page = 1
feedbacks.value = []
return;
}
loading.value = true loading.value = true
// 发起请求 // 发起请求
const [err, data] = await to(fetch(F_BASE_URL + '/page', { const [err, data] = await to(fetch(F_BASE_URL + '/page', {
method: "POST", method: "POST",
...@@ -718,8 +746,8 @@ ...@@ -718,8 +746,8 @@
body: JSON.stringify({ body: JSON.stringify({
cmptId: getCId(), cmptId: getCId(),
currentStatus: status.value ? undefined : status.value, currentStatus: status.value ? undefined : status.value,
pageNum: pagination.value.page, pageNum: pagination.page,
pageSize: pagination.value.pageSize, pageSize: pagination.pageSize,
keyword: keyword.value, keyword: keyword.value,
categoryId: feedbackCategories.value[categoryIndex.value].id categoryId: feedbackCategories.value[categoryIndex.value].id
}) })
...@@ -727,16 +755,11 @@ ...@@ -727,16 +755,11 @@
loading.value = false loading.value = false
if (data.code === 200) { if (data.code === 200) {
feedbacks.value = data.content.content feedbacks.value = data.content.content
pagination.itemCount = res.data.total
} else { } else {
message.error(data.msg) message.error(data.msg)
} }
} }
// 分页切换
const handlePageChange = (page) => {
pagination.value.page = page
getFeedBacks()
}
// 日期处理 // 日期处理
const updateFormattedValue = (val) => { const updateFormattedValue = (val) => {
feedbackFormValue.resolvedAt = val feedbackFormValue.resolvedAt = val
...@@ -762,7 +785,6 @@ ...@@ -762,7 +785,6 @@
fileList, fileList,
feedbacks, feedbacks,
pagination, pagination,
handlePageChange,
columns, columns,
deleteFeedback, deleteFeedback,
editFeedback, editFeedback,
......
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