Compare commits

..
Author SHA1 Message Date
zlwuandCursor 5109d8b3e5 fix(backend): 计划开始时间筛选不再内置工单状态限制
去掉 EXISTS 中对工单/任务/步骤活跃态的硬编码,日期条件与前端勾选的状态等检索项组合生效,修复区间内有步骤日期却查空的问题。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-11 10:20:59 +08:00
zlwuandCursor 2a0a2ef72a feat(web-admin): 历史归属维护支持批量调整归属
在历史归属维护列表增加多选与工具栏批量「调整归属」,复用现有单条预览/保存接口逐条提交,便于一次将多条业务记录归属到同一项目。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-11 10:02:24 +08:00
zlwu 3a396d79a2 chore(mobile-h5): 切换本地联调环境与测试 AppID
continuous-integration/drone/tag Build is passing
按用户本地验收要求,将 APP_ENV 切换为 local,使用本机 API 和移动 H5 地址,并将微信 AppID 切换为测试号。
2026-11-10 09:37:04 +08:00
zlwu 9c4944702b fix(db): 补充协议操作日志旧表纠偏脚本
为同名旧表与现行日志模型不兼容的情况提供迁移脚本,并在原建表脚本注明纠偏入口。保留有数据的旧表为备份;本次仅提交现有脚本,未执行数据库迁移。
2026-11-10 09:37:04 +08:00
cykj e06f89dcf6 Merge pull request 'fix(mobile): 修复协议单保存前项目校验异常' (#79) from codex/issue-78-protocol-save into V2.0 2026-11-10 01:24:10 +00:00
zlwu f343f12645 fix(mobile): 修复协议单项目校验引用导致保存中断
循环模板内字符串 ref 被 Vue 收集为数组,调用 validate 时在请求前抛错。改用函数 ref 保持单组件实例,并覆盖两角色新增、编辑及项目校验提示。关联工单 #78。
2026-11-10 09:21:29 +08:00
zlwuandCursor 1032631318 chore(mobile-h5): 微信小程序 AppID 切换为生产
将 mp-weixin.appid 改为 wx2b139581f4c855e4,与 APP_ENV=prod 对齐。

Refs: #77
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-09 16:32:24 +08:00
zlwuandCursor f9f79479e8 chore(mobile-h5): 小程序切换为生产环境配置
将 APP_ENV 设为 prod,API/OA H5/MinIO 指向 xwyd.zkxw.cn,便于发生产版。

Refs: #76
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-09 16:27:28 +08:00
8 changed files with 408 additions and 38 deletions

No files matched your search

+1 -7
View File
@@ -94,7 +94,7 @@ def apply_planned_start_time_step_filter(
planned_start_time_end: Optional[str] = None,
mine_user_id: Optional[str] = None,
):
"""按活跃工单/任务下未完成工艺步骤的计划开始时间过滤。"""
"""按工艺步骤计划开始时间过滤;工单/任务/步骤状态由外层检索条件组合控制。"""
start = (planned_start_time_start or "").strip()
end = (planned_start_time_end or "").strip()
if not start and not end:
@@ -104,15 +104,9 @@ def apply_planned_start_time_step_filter(
BizProductionTaskStep.del_flag == 0,
BizProductionTaskStep.tenant_no == tenant_no,
BizProductionTaskStep.planned_start_time.isnot(None),
BizProductionTaskStep.step_status != "ywc",
BizProductionTask.id == BizProductionTaskStep.task_id,
BizProductionTask.del_flag == 0,
BizProductionTask.tenant_no == tenant_no,
BizProductionTask.task_status.in_(("dpz", "jxz")),
BizProductionWorkOrder.id == BizProductionTask.work_order_id,
BizProductionWorkOrder.del_flag == 0,
BizProductionWorkOrder.tenant_no == tenant_no,
BizProductionWorkOrder.work_order_status.in_(("dpz", "jxz")),
work_order_id_column == BizProductionTask.work_order_id,
]
if start:
@@ -0,0 +1,42 @@
"""计划开始时间筛选:不内置工单/任务/步骤状态限制,交给外层组合条件。"""
from sqlalchemy import create_engine
from sqlalchemy.dialects import mysql
from sqlalchemy.orm import sessionmaker
from app.crud.production_work_order import apply_planned_start_time_step_filter
from app.models.models import BizProductionWorkOrder
def _compile_planned_start_sql() -> str:
eng = create_engine("sqlite://")
SessionLocal = sessionmaker(bind=eng)
db = SessionLocal()
try:
q = db.query(BizProductionWorkOrder).filter(BizProductionWorkOrder.del_flag == 0)
filtered = apply_planned_start_time_step_filter(
q,
tenant_no="zkxw",
work_order_id_column=BizProductionWorkOrder.id,
planned_start_time_start="2026-10-01",
planned_start_time_end="2026-12-31",
)
return str(
filtered.statement.compile(
dialect=mysql.dialect(), compile_kwargs={"literal_binds": True}
)
)
finally:
db.close()
def test_planned_start_filter_keeps_date_bounds_without_status_hardcodes():
sql = _compile_planned_start_sql().lower()
assert "planned_start_time" in sql
assert "2026-10-01 00:00:00" in sql
assert "2026-12-31 23:59:59" in sql
# 不再在 EXISTS 内强制待配置/进行中或未完成步骤
assert "work_order_status in (" not in sql
assert "task_status in (" not in sql
assert "step_status !=" not in sql
assert "step_status <>" not in sql
@@ -1,6 +1,10 @@
-- Issue #24:协议单操作过程日志(before / action / after)
-- MySQL 5.7;可重复执行(CREATE IF NOT EXISTS)。上线前须备份并在目标副本验证。
-- DDL 隐式提交;该脚本不作为自动应用启动步骤。
--
-- 注意:若目标库已存在同名「采集协议单操作日志」旧表(含 collection_protocol_id /
-- operation_code 等列),本脚本会因 IF NOT EXISTS 直接跳过,不会纠偏。
-- 生产纠偏请改用:2026-11-09-protocol-operation-log-rebuild.sql
CREATE TABLE IF NOT EXISTS biz_protocol_operation_log (
id VARCHAR(64) NOT NULL,
@@ -0,0 +1,119 @@
-- =============================================================================
-- 协议操作日志:兼容生产旧表同名冲突,重建为 Issue #24 模型
-- MySQL 5.7;可重复执行。上线前须备份,并在目标副本验证。
--
-- 背景:
-- 生产曾有「采集协议单操作日志」同名表(collection_protocol_id / operation_*),
-- 与当前代码(biz_type / before_json / after_json)不兼容。
-- 旧脚本 2026-11-05-protocol-operation-log.sql 使用 CREATE IF NOT EXISTS,
-- 遇到旧表会直接跳过,无法纠偏。本脚本用于生产纠偏与新环境兜底。
--
-- 行为:
-- 1) 已是新模型(有 biz_type)→ 跳过结构变更
-- 2) 旧模型且 0 行 → DROP 后按新模型 CREATE
-- 3) 旧模型且有数据 → RENAME 为 biz_protocol_operation_log_legacy_20261109 再 CREATE
-- 4) 表不存在 → 直接 CREATE
-- =============================================================================
SET @db := DATABASE();
SET @table_exists := (
SELECT COUNT(*) FROM information_schema.tables
WHERE table_schema = @db AND table_name = 'biz_protocol_operation_log'
);
SET @has_legacy_col := (
SELECT COUNT(*) FROM information_schema.columns
WHERE table_schema = @db
AND table_name = 'biz_protocol_operation_log'
AND column_name = 'collection_protocol_id'
);
SET @has_new_col := (
SELECT COUNT(*) FROM information_schema.columns
WHERE table_schema = @db
AND table_name = 'biz_protocol_operation_log'
AND column_name = 'biz_type'
);
SET @is_legacy := IF(@table_exists > 0 AND @has_legacy_col > 0 AND @has_new_col = 0, 1, 0);
SET @legacy_rows := 0;
SET @cnt_sql := IF(
@is_legacy = 1,
'SET @legacy_rows = (SELECT COUNT(*) FROM `biz_protocol_operation_log`)',
'SET @legacy_rows = 0'
);
PREPARE pol_stmt FROM @cnt_sql;
EXECUTE pol_stmt;
DEALLOCATE PREPARE pol_stmt;
-- 空旧表:直接删除
SET @drop_sql := IF(
@is_legacy = 1 AND @legacy_rows = 0,
'DROP TABLE `biz_protocol_operation_log`',
'SELECT ''skip drop empty legacy biz_protocol_operation_log'' AS migration_status'
);
PREPARE pol_stmt FROM @drop_sql;
EXECUTE pol_stmt;
DEALLOCATE PREPARE pol_stmt;
-- 有数据的旧表:改名保留,避免丢历史(当前生产为 0 行,通常不会走到这里)
SET @legacy_backup_exists := (
SELECT COUNT(*) FROM information_schema.tables
WHERE table_schema = @db AND table_name = 'biz_protocol_operation_log_legacy_20261109'
);
SET @rename_sql := IF(
@is_legacy = 1 AND @legacy_rows > 0 AND @legacy_backup_exists = 0,
'RENAME TABLE `biz_protocol_operation_log` TO `biz_protocol_operation_log_legacy_20261109`',
IF(
@is_legacy = 1 AND @legacy_rows > 0 AND @legacy_backup_exists > 0,
'SELECT ''ERROR: legacy backup biz_protocol_operation_log_legacy_20261109 already exists; resolve manually'' AS migration_status',
'SELECT ''skip rename legacy biz_protocol_operation_log'' AS migration_status'
)
);
PREPARE pol_stmt FROM @rename_sql;
EXECUTE pol_stmt;
DEALLOCATE PREPARE pol_stmt;
-- 新模型建表(纠偏后或全新环境)
CREATE TABLE IF NOT EXISTS `biz_protocol_operation_log` (
`id` VARCHAR(64) NOT NULL COMMENT '主键ID',
`biz_type` VARCHAR(32) NOT NULL COMMENT '业务类型 cell_storage/research_donation',
`biz_id` VARCHAR(64) NOT NULL COMMENT '协议单或捐赠单ID',
`protocol_no` VARCHAR(64) NULL COMMENT '协议/捐赠编号快照',
`action` VARCHAR(32) NOT NULL COMMENT '动作 create/update/delete/void/activate/expire/to_research/to_storage/audit',
`client_channel` VARCHAR(16) NOT NULL DEFAULT 'web' COMMENT '来源端 web/mini',
`before_json` MEDIUMTEXT NULL COMMENT '操作前协议信息JSON',
`after_json` MEDIUMTEXT NULL COMMENT '操作后协议信息JSON',
`operator_user_id` VARCHAR(64) NULL COMMENT '操作人用户ID',
`operator_user_name` VARCHAR(64) NULL COMMENT '操作人姓名快照',
`operate_time` DATETIME NOT NULL COMMENT '业务操作时间',
`tenant_no` VARCHAR(64) NOT NULL COMMENT '租户编号',
`order_num` INT NULL COMMENT '排序号',
`remark` VARCHAR(512) NULL COMMENT '备注',
`create_by` VARCHAR(64) NULL COMMENT '创建人id',
`create_dept_id` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '创建人部门ID',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_by` VARCHAR(64) NULL COMMENT '更新人id',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`del_flag` SMALLINT NOT NULL DEFAULT 0 COMMENT '删除标记',
PRIMARY KEY (`id`),
KEY `ix_pol_biz` (`tenant_no`, `biz_type`, `biz_id`, `del_flag`),
KEY `ix_pol_time` (`tenant_no`, `operate_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='协议单操作过程日志';
-- 验收:新模型关键列应存在
SELECT
COLUMN_NAME,
COLUMN_TYPE,
IS_NULLABLE,
COLUMN_COMMENT
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'biz_protocol_operation_log'
AND COLUMN_NAME IN (
'biz_type', 'biz_id', 'action', 'before_json', 'after_json',
'client_channel', 'operate_time', 'collection_protocol_id', 'operation_code'
)
ORDER BY ORDINAL_POSITION;
+1 -1
View File
@@ -6,7 +6,7 @@
*
* 微信公众平台须为对应环境配置 request / 业务域名(HTTPS)
*/
export const APP_ENV = 'test' // 'local' | 'test' | 'prod'
export const APP_ENV = 'local' // 'local' | 'test' | 'prod'
const ENV_PRESETS = {
local: {
@@ -0,0 +1,110 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import vm from 'node:vm'
import * as Vue from 'vue'
import { compile } from '@vue/compiler-dom'
import { projectValidation } from './project-assignment.js'
const source = readFileSync(new URL('../views/market/MarketModuleForm.vue', import.meta.url), 'utf8')
// Render the real loop/slot/ref structure; native host nodes need no browser or service.
const template = source.slice(source.indexOf('<template v-for="section in leadingSections"'), source.indexOf('\n\n <section'))
const render = new Function('Vue', compile(template, { prefixIdentifiers: true }).code)(Vue)
const submitSource = source.slice(source.indexOf('async function submit()'), source.indexOf('\nasync function confirmLeave()'))
const renderer = Vue.createRenderer({
createElement: () => ({}), createText: () => ({}), createComment: () => ({}),
insert(node, parent, anchor = null) {
parent.children ||= []
node.parent = parent
const index = parent.children.indexOf(anchor)
parent.children.splice(index < 0 ? parent.children.length : index, 0, node)
},
remove(node) {
const siblings = node.parent?.children || []
const index = siblings.indexOf(node)
if (index >= 0) siblings.splice(index, 1)
},
setText() {}, setElementText() {}, patchProp() {},
parentNode: (node) => node.parent,
nextSibling: (node) => {
const siblings = node.parent?.children || []
return siblings[siblings.indexOf(node) + 1] || null
}
})
async function mountForm({ role, mode = 'create', projectId = 'project-1', loading = false, error = '' }) {
const projectAssignment = Vue.ref(null)
const formData = Vue.ref({ source: 'research_donation', projectId })
const messages = [], requests = []
let validations = 0
const ProjectAssignmentField = {
setup(_, { expose }) {
expose({ validate() {
validations++
return projectValidation({ editing: mode === 'edit', required: true, projectId, loading, error })
} })
return () => Vue.h('div')
}
}
const Section = { setup: (_, { slots }) => () => slots.insert?.() }
const context = Vue.ref({ module: 'protocol', marketRole: role })
const app = renderer.createApp({
components: { MarketFormSection: Section, ProjectAssignmentField },
setup: () => ({
projectAssignment, context, formData, mode,
leadingSections: [{ key: 'customer' }, { key: 'protocol' }],
formOptions: {}, fieldsLocked: false, dirty: false,
sectionValue: () => ({}), searchProtocolCustomers() {}, setSectionValue() {},
uploadField() {}, handleFieldChange() {}, handleCustomerSelect() {}
}), render
})
app.mount({})
await Vue.nextTick()
const scope = {
projectAssignment, context, formData, mode: Vue.ref(mode),
submitting: Vue.ref(false), uploadPending: Vue.ref(0), isProtocolV2: Vue.ref(false),
isProtocolV1: Vue.ref(false), id: Vue.ref(mode === 'edit' ? 'record-1' : ''),
action: Vue.ref(mode), visibleSections: Vue.ref([]), dirty: Vue.ref(true),
showToast: (text) => messages.push(text), showSuccessToast: (text) => messages.push(text),
validateRequiredFields: () => '', buildMarketActionPayload: (_module, _action, data) => data,
sanitizeMarketPayload: (data) => data, buildPayload: () => formData.value,
AbortController, submitController: null, allowLeave: false,
saveMarketRecord: async (...args) => { requests.push(args); return { id: 'saved' } },
mountGuard: { isCurrent: () => true }, mountToken: 1,
resolveMarketSavedDetailId: () => 'saved', router: { replace: async () => {} },
route: { query: {} }, marketRecordNavigationQuery: () => ({}),
marketErrorMessage: (cause) => cause.message
}
const submit = vm.runInNewContext(`${submitSource}\nsubmit`, scope)
return { submit, messages, requests, app, validations: () => validations }
}
for (const role of ['specialist', 'manager']) {
for (const mode of ['create', 'edit']) {
test(`${role} ${mode}: a valid project reaches the save request`, async () => {
const form = await mountForm({ role, mode })
try {
await form.submit()
assert.equal(form.validations(), 1)
assert.equal(form.requests.length, 1)
assert.equal(form.requests[0][0].marketRole, role)
assert.deepEqual(form.messages, ['保存成功'])
} finally { form.app.unmount() }
})
}
for (const [state, message] of [
[{ projectId: '' }, '请选择所属项目'],
[{ loading: true }, '项目选项加载中,请稍后保存'],
[{ error: 'network' }, '项目选项加载失败,请重试后保存']
]) {
test(`${role}: ${message}`, async () => {
const form = await mountForm({ role, ...state })
try {
await form.submit()
assert.equal(form.validations(), 1)
assert.equal(form.requests.length, 0)
assert.deepEqual(form.messages, [message])
} finally { form.app.unmount() }
})
}
}
@@ -46,7 +46,7 @@
>
<template #insert>
<ProjectAssignmentField
ref="projectAssignment"
:ref="(instance) => (projectAssignment = instance)"
embedded
v-model="formData.projectId"
:biz-type="formData.source"
@@ -78,15 +78,41 @@
<el-icon><RefreshRight /></el-icon>重试
</el-button>
</el-alert>
<div v-if="assignment" class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button
type="primary"
class="btn-main"
:disabled="!selectedRows.length || busy"
@click="openBatch"
>
<el-icon><Edit /></el-icon>调整归属
</el-button>
</div>
</div>
<div class="list-body list-wrap"
><el-table
ref="tableRef"
:key="query.bizType"
:data="rows"
v-loading="loading"
class="list-table"
stripe
row-key="id"
:empty-text="loading ? '正在加载…' : loadError ? '数据加载失败' : '暂无符合条件的单据'"
@selection-change="handleSelectionChange"
>
<el-table-column
v-if="assignment"
type="selection"
min-width="48"
align="center"
header-align="center"
fixed
/>
<el-table-column
type="index"
label="序号"
@@ -151,26 +177,26 @@
>
<el-form class="form-grid-2" label-position="top">
<el-form-item label="原所属项目组">
<el-input :model-value="selected.teamName || '未归属'" disabled />
<el-input :model-value="originalTeamLabel" disabled />
</el-form-item>
<el-form-item label="原所属项目">
<el-input :model-value="selected.projectName || '未归属'" disabled />
<el-input :model-value="originalProjectLabel" disabled />
</el-form-item>
<el-form-item label="新项目组" required>
<ProjectSelect
:key="`team-${selected.id}`"
:key="`team-${dialogSelectKey}`"
team
v-model="targetTeamId"
:biz-type="selected.bizType"
:biz-type="dialogBizType"
@update:model-value="onTargetTeamChange"
/>
</el-form-item>
<el-form-item label="新项目" required>
<ProjectSelect
:key="`project-${selected.id}-${targetTeamId}`"
:key="`project-${dialogSelectKey}-${targetTeamId}`"
v-model="target"
:team-id="targetTeamId"
:biz-type="selected.bizType"
:biz-type="dialogBizType"
:disabled="!targetTeamId"
/>
</el-form-item>
@@ -262,6 +288,7 @@
page: 1,
pageSize: 20
})
const tableRef = ref<{ clearSelection?: () => void } | null>(null)
const rows = ref<ProjectRecord[]>([]),
total = ref(0),
statusCounts = ref<Record<string, number>>({}),
@@ -273,6 +300,8 @@
target = ref(''),
reason = ref(''),
selected = ref<ProjectRecord>({}),
selectedRows = ref<ProjectRecord[]>([]),
editTargets = ref<ProjectRecord[]>([]),
historyVisible = ref(false),
historyRows = ref<ProjectRecord[]>([])
const visibleColumns = computed(() =>
@@ -283,6 +312,39 @@
const keywordHint = computed(() =>
query.bizType === 'presign' ? '请输入单据编号' : assignmentKeywordHints[query.bizType]
)
const dialogBizType = computed(
() =>
(editTargets.value[0]?.bizType ||
selected.value.bizType ||
query.bizType) as AssignmentBizType
)
const dialogSelectKey = computed(() => {
if (editTargets.value.length <= 1) {
return String(editTargets.value[0]?.id || selected.value.id || 'empty')
}
const firstId = editTargets.value[0]?.id || ''
const lastId = editTargets.value[editTargets.value.length - 1]?.id || ''
return `batch-${editTargets.value.length}-${firstId}-${lastId}`
})
const originalTeamLabel = computed(() => {
if (editTargets.value.length <= 1) {
return editTargets.value[0]?.teamName || selected.value.teamName || '未归属'
}
return `共 ${editTargets.value.length} 条`
})
const originalProjectLabel = computed(() => {
if (editTargets.value.length <= 1) {
return editTargets.value[0]?.projectName || selected.value.projectName || '未归属'
}
return `共 ${editTargets.value.length} 条`
})
function clearSelection() {
selectedRows.value = []
tableRef.value?.clearSelection?.()
}
function handleSelectionChange(selection: ProjectRecord[]) {
selectedRows.value = selection
}
let loadVersion = 0
function statusLabel(status: string) {
return query.bizType === 'presign'
@@ -307,6 +369,7 @@
loading.value = true
loadError.value = false
rows.value = []
clearSelection()
try {
const fetchRecords = props.assignment
? fetchAssignmentRecords
@@ -344,6 +407,7 @@
statusCounts.value = {}
visible.value = false
historyVisible.value = false
clearSelection()
search()
}
function switchBusiness(kind: AssignmentBizType) {
@@ -360,16 +424,41 @@
query.page = page
load()
}
function open(row: ProjectRecord) {
selected.value = row
function resetDialogForm(targets: ProjectRecord[]) {
editTargets.value = targets
selected.value = targets[0] || {}
targetTeamId.value = ''
target.value = ''
reason.value = ''
visible.value = true
}
function open(row: ProjectRecord) {
resetDialogForm([row])
}
function openBatch() {
if (!selectedRows.value.length) {
ElMessage.warning('请先选择要调整的记录')
return
}
resetDialogForm([...selectedRows.value])
}
function onTargetTeamChange() {
target.value = ''
}
async function assignOne(row: ProjectRecord, projectId: string, assignReason: string) {
const preview = await previewAssignment({
bizType: row.bizType,
id: row.id,
projectId
})
await saveAssignment({
bizType: row.bizType,
id: row.id,
projectId,
reason: assignReason,
expectedAssignments: assignmentSnapshot(preview.records)
})
}
async function commit() {
if (!targetTeamId.value) {
ElMessage.warning('请选择新项目组')
@@ -383,33 +472,45 @@
ElMessage.warning('请填写调整原因')
return
}
const targets = editTargets.value.length ? [...editTargets.value] : [selected.value]
if (!targets.length || !targets[0]?.id) {
ElMessage.warning('请选择要调整的记录')
return
}
busy.value = true
const commitTarget = target.value
const commitRecord = selected.value
const commitReason = reason.value.trim()
const commitTargets = targets
let successCount = 0
let failCount = 0
try {
const preview = await previewAssignment({
bizType: selected.value.bizType,
id: selected.value.id,
projectId: target.value
})
if (selected.value !== commitRecord || target.value !== commitTarget || !visible.value) {
for (const row of commitTargets) {
if (target.value !== commitTarget || !visible.value) {
return
}
try {
await assignOne(row, commitTarget, commitReason)
successCount += 1
} catch {
failCount += 1
// API layer already surfaces the conflict / validation message.
}
}
if (target.value !== commitTarget || !visible.value) {
return
}
await saveAssignment({
bizType: selected.value.bizType,
id: selected.value.id,
projectId: target.value,
reason: reason.value.trim(),
expectedAssignments: assignmentSnapshot(preview.records)
})
if (selected.value !== commitRecord || target.value !== commitTarget || !visible.value) {
return
if (successCount > 0) {
visible.value = false
clearSelection()
if (failCount === 0) {
ElMessage.success(
commitTargets.length > 1 ? `已调整 ${successCount} 条归属` : '归属已调整'
)
} else {
ElMessage.warning(`成功 ${successCount} 条,失败 ${failCount} 条`)
}
await load()
}
visible.value = false
ElMessage.success('归属已调整')
await load()
} catch {
// API layer already surfaces the conflict / validation message.
} finally {
busy.value = false
}