feat(pl): allocate copy_seq_no on first driver plan share-to-group

Add ensure-copy-seq API and miniprogram clipboard prefix so each plan
gets a tenant-scoped fixed serial on first copy; cover allocation with
unit tests and refresh the backend graph.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-10-09 12:36:58 +08:00
1 parent 5357df1cc2
commit 811e6a129f
11 files changed
+21223 -13529

No files matched your search

+17 -3
View File
@@ -281,9 +281,23 @@ function promptCopyAfterSave() {
cancelText: '关闭',
success: async (res) => {
if (res.confirm) {
const ok = await copyDriverPlanToClipboard(page.value || {})
if (ok) {
setTimeout(() => goList(), 400)
try {
const ensured = await driverPlanApi.ensureCopySeq(planId.value)
const copySeqNo = ensured?.copySeqNo ?? ensured?.copy_seq_no
if (copySeqNo == null || copySeqNo === '') {
uni.showToast({ title: '复制失败', icon: 'none' })
resolve()
return
}
const ok = await copyDriverPlanToClipboard({
...(page.value || {}),
copySeqNo
})
if (ok) {
setTimeout(() => goList(), 400)
}
} catch (e) {
uni.showToast({ title: '复制失败', icon: 'none' })
}
}
resolve()
+7 -2
View File
@@ -240,9 +240,14 @@ async function handleCopy(row) {
}
uni.showLoading({ title: '加载中...', mask: true })
try {
const page = await driverPlanApi.get(id)
const page = (await driverPlanApi.get(id)) || {}
const ensured = await driverPlanApi.ensureCopySeq(id)
const copySeqNo = ensured?.copySeqNo ?? ensured?.copy_seq_no
if (copySeqNo == null || copySeqNo === '') {
throw new Error('no seq')
}
uni.hideLoading()
await copyDriverPlanToClipboard(page || {})
await copyDriverPlanToClipboard({ ...page, copySeqNo })
} catch (e) {
uni.hideLoading()
uni.showToast({ title: '复制失败', icon: 'none' })