1
This commit is contained in:
@@ -25,11 +25,14 @@ export function executeInstructionWithForce(data) {
|
||||
* @param limit 条数上限
|
||||
* @param keyword 可选,搜索关键词;传则后端在全部数据中过滤后返回
|
||||
*/
|
||||
export function getHistory(type, limit, keyword) {
|
||||
export function getHistory(type, limit, keyword, days) {
|
||||
const params = { type, limit }
|
||||
if (keyword != null && String(keyword).trim() !== '') {
|
||||
params.keyword = String(keyword).trim()
|
||||
}
|
||||
if (days != null && Number(days) > 0) {
|
||||
params.days = Number(days)
|
||||
}
|
||||
return request({
|
||||
url: '/jarvis/instruction/history',
|
||||
method: 'get',
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
/>
|
||||
<el-button type="primary" :loading="historyLoading" @click="searchHistory">搜索</el-button>
|
||||
</div>
|
||||
<p class="history-hint">待填写(生成后未补全)排在前面,已落库记录也保留。</p>
|
||||
<p class="history-hint">仅查最近 3 天。待填写排在前面,已落库记录也保留。</p>
|
||||
<div class="history-list" v-loading="historyLoading">
|
||||
<div v-if="!historyList.length && !historyLoading" class="history-empty">暂无历史记录</div>
|
||||
<div
|
||||
@@ -878,17 +878,32 @@ export default {
|
||||
id: row.id
|
||||
}
|
||||
},
|
||||
historyDateRange(days) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setDate(start.getDate() - (days || 3))
|
||||
const fmt = d => {
|
||||
const y = d.getFullYear()
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
return `${y}-${m}-${day}`
|
||||
}
|
||||
return { beginTime: fmt(start), endTime: fmt(end) }
|
||||
},
|
||||
async loadHistory() {
|
||||
this.historyLoading = true
|
||||
try {
|
||||
const kw = (this.historyKeyword || '').trim()
|
||||
const range = this.historyDateRange(3)
|
||||
const [histRes, orderRes] = await Promise.all([
|
||||
getHistory('response', 300, kw || undefined),
|
||||
getHistory('response', 300, kw || undefined, 3),
|
||||
listJDOrders({
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
orderBy: 'id',
|
||||
isAsc: 'desc',
|
||||
beginTime: range.beginTime,
|
||||
endTime: range.endTime,
|
||||
quickRecordSearch: kw || undefined
|
||||
})
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user