@chenchaolong/plugin-trade-compliance-workbench 0.1.49 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -227,6 +227,7 @@
|
|
|
227
227
|
setFormDialog((current) => current ? Object.assign({}, current, {
|
|
228
228
|
hsCandidateKeyword: keyword,
|
|
229
229
|
hsCandidatePage: nextPage,
|
|
230
|
+
hsCandidateLocalPage: 1,
|
|
230
231
|
hsCandidateLoading: false,
|
|
231
232
|
hsCandidateError: '',
|
|
232
233
|
hsCandidateStatus: candidates.length ? 'pending_confirmation' : 'not_found',
|
|
@@ -476,6 +477,9 @@
|
|
|
476
477
|
hsCandidateKeyword: merged.hsCodeLookupKeyword || buildSupplierHsCandidateKeyword(merged),
|
|
477
478
|
hsCandidatePage: 1,
|
|
478
479
|
hsCandidateJumpPage: '',
|
|
480
|
+
hsCandidateLocalPage: 1,
|
|
481
|
+
hsCandidateLocalPageSize: 5,
|
|
482
|
+
hsCandidateLocalJumpPage: '',
|
|
479
483
|
hsCandidatePagination: null,
|
|
480
484
|
hsCandidateStatus: merged.hsCodeLookupStatus || '',
|
|
481
485
|
hsCandidateError: merged.hsCodeLookupError || '',
|
|
@@ -493,6 +497,9 @@
|
|
|
493
497
|
hsCandidateKeyword: '',
|
|
494
498
|
hsCandidatePage: 1,
|
|
495
499
|
hsCandidateJumpPage: '',
|
|
500
|
+
hsCandidateLocalPage: 1,
|
|
501
|
+
hsCandidateLocalPageSize: 5,
|
|
502
|
+
hsCandidateLocalJumpPage: '',
|
|
496
503
|
hsCandidatePagination: null,
|
|
497
504
|
hsCandidateStatus: '',
|
|
498
505
|
hsCandidateError: '',
|
|
@@ -1175,6 +1182,13 @@
|
|
|
1175
1182
|
function renderSupplierHsCandidatePanel() {
|
|
1176
1183
|
const candidates = Array.isArray(formDialog.hsCandidates) ? formDialog.hsCandidates : []
|
|
1177
1184
|
const pagination = formDialog.hsCandidatePagination || null
|
|
1185
|
+
const hasSourcePagination = pagination && (pagination.hasPrevious || pagination.hasNext || (pagination.pages && pagination.pages.length > 1))
|
|
1186
|
+
const localPageSize = Math.max(1, Number(formDialog.hsCandidateLocalPageSize) || 5)
|
|
1187
|
+
const localTotalPages = Math.max(1, Math.ceil(candidates.length / localPageSize))
|
|
1188
|
+
const localPage = Math.min(Math.max(Number(formDialog.hsCandidateLocalPage) || 1, 1), localTotalPages)
|
|
1189
|
+
const visibleCandidates = hasSourcePagination
|
|
1190
|
+
? candidates
|
|
1191
|
+
: candidates.slice((localPage - 1) * localPageSize, localPage * localPageSize)
|
|
1178
1192
|
return h('section', { className: 'tcw-hs-candidate-panel' },
|
|
1179
1193
|
h('div', { className: 'tcw-subsection-head' },
|
|
1180
1194
|
h('div', null,
|
|
@@ -1193,7 +1207,7 @@
|
|
|
1193
1207
|
),
|
|
1194
1208
|
formDialog.hsCandidateError ? h('div', { className: 'tcw-error' }, formDialog.hsCandidateError) : null,
|
|
1195
1209
|
candidates.length ? h('div', { className: 'tcw-hs-candidate-result' },
|
|
1196
|
-
table(['编码', '商品名称', '英文名称', '单位', '退税率', '监管', '检验检疫', '操作'],
|
|
1210
|
+
table(['编码', '商品名称', '英文名称', '单位', '退税率', '监管', '检验检疫', '操作'], visibleCandidates, (candidate) => [
|
|
1197
1211
|
h('strong', { className: 'tcw-hs-code-text' }, value(candidate.code)),
|
|
1198
1212
|
value(candidate.name),
|
|
1199
1213
|
value(candidate.englishName),
|
|
@@ -1206,11 +1220,36 @@
|
|
|
1206
1220
|
h('button', { type: 'button', className: 'tcw-mini-btn', disabled: !candidate.code && !candidate.detailUrl, onClick: () => loadHsCodeDetail(candidate) }, '详情')
|
|
1207
1221
|
)
|
|
1208
1222
|
], '暂无候选编码。'),
|
|
1209
|
-
|
|
1223
|
+
hasSourcePagination
|
|
1224
|
+
? renderSupplierHsCandidatePagination(pagination)
|
|
1225
|
+
: renderSupplierHsCandidateLocalPagination(candidates.length, localPage, localTotalPages, localPageSize)
|
|
1210
1226
|
) : empty('暂无候选编码,可调整关键词后查询。')
|
|
1211
1227
|
)
|
|
1212
1228
|
}
|
|
1213
1229
|
|
|
1230
|
+
function renderSupplierHsCandidateLocalPagination(total, page, totalPages, pageSize) {
|
|
1231
|
+
if (total <= pageSize) return null
|
|
1232
|
+
return renderUnifiedPagination({
|
|
1233
|
+
total,
|
|
1234
|
+
page,
|
|
1235
|
+
totalPages,
|
|
1236
|
+
pageSize,
|
|
1237
|
+
pageSizeOptions: [5, 10, 20],
|
|
1238
|
+
jumpValue: formDialog.hsCandidateLocalJumpPage || '',
|
|
1239
|
+
onPageChange: (nextPage) => setFormDialog(Object.assign({}, formDialog, { hsCandidateLocalPage: Math.min(Math.max(Number(nextPage) || 1, 1), totalPages) })),
|
|
1240
|
+
onPageSizeChange: (nextSize) => setFormDialog(Object.assign({}, formDialog, { hsCandidateLocalPageSize: Number(nextSize) || 5, hsCandidateLocalPage: 1, hsCandidateLocalJumpPage: '' })),
|
|
1241
|
+
onJumpInput: (nextValue) => setFormDialog(Object.assign({}, formDialog, { hsCandidateLocalJumpPage: nextValue })),
|
|
1242
|
+
onJump: () => {
|
|
1243
|
+
const nextPage = Number(formDialog.hsCandidateLocalJumpPage)
|
|
1244
|
+
if (!Number.isFinite(nextPage) || nextPage <= 0) return
|
|
1245
|
+
setFormDialog(Object.assign({}, formDialog, {
|
|
1246
|
+
hsCandidateLocalPage: Math.min(Math.max(nextPage, 1), totalPages),
|
|
1247
|
+
hsCandidateLocalJumpPage: ''
|
|
1248
|
+
}))
|
|
1249
|
+
}
|
|
1250
|
+
})
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1214
1253
|
function renderSupplierHsCandidatePagination(pagination) {
|
|
1215
1254
|
if (!pagination || (!pagination.hasPrevious && !pagination.hasNext && (!pagination.pages || pagination.pages.length <= 1))) return null
|
|
1216
1255
|
const pages = Array.isArray(pagination.pages) ? pagination.pages.filter((item) => item.page) : []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenchaolong/plugin-trade-compliance-workbench",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.50",
|
|
4
4
|
"description": "Trade Compliance Workbench app plugin for controlled goods review, supplier product management, and customs workbook generation.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "XpertAI",
|