修复:完善基础资料页异步与提交保护
This commit is contained in:
@@ -564,6 +564,8 @@ test('六个基础资料页面逐页满足 API、权限、分页和安全删除
|
|||||||
await t.test(contract.relativePath, async () => {
|
await t.test(contract.relativePath, async () => {
|
||||||
const source = await readFile(path.join(frontendRoot, contract.relativePath), 'utf8')
|
const source = await readFile(path.join(frontendRoot, contract.relativePath), 'utf8')
|
||||||
const permissionPrefix = `master:${resource}`
|
const permissionPrefix = `master:${resource}`
|
||||||
|
const suffix = resource[0].toUpperCase() + resource.slice(1)
|
||||||
|
const idKey = `${resource}Id`
|
||||||
const importedModules = [...source.matchAll(/from\s*['"]@\/api\/master\/([a-z]+)['"]/g)]
|
const importedModules = [...source.matchAll(/from\s*['"]@\/api\/master\/([a-z]+)['"]/g)]
|
||||||
.map((match) => match[1])
|
.map((match) => match[1])
|
||||||
|
|
||||||
@@ -608,17 +610,62 @@ test('六个基础资料页面逐页满足 API、权限、分页和安全删除
|
|||||||
assert.doesNotMatch(source, />\s*(?:导入|导出)\s*<\/el-button>/)
|
assert.doesNotMatch(source, />\s*(?:导入|导出)\s*<\/el-button>/)
|
||||||
assert.doesNotMatch(source, /\bhandle(?:Import|Export)\b|proxy\.download\(/)
|
assert.doesNotMatch(source, /\bhandle(?:Import|Export)\b|proxy\.download\(/)
|
||||||
|
|
||||||
assert.match(source, /<el-table-column\b[^>]*type="selection"[^>]*:selectable="isRowSelectable"/)
|
assert.match(source, /let listGeneration = 0;/)
|
||||||
assert.match(source, /function isRowSelectable\(row\)\s*{\s*return row\.canRemove === true;?\s*}/)
|
assert.match(source, /function isCurrentListRequest\(listContext\)\s*{\s*return listContext\.generation === listGeneration;?\s*}/)
|
||||||
assert.match(source, /ids\.value\s*=\s*selection\s*\.filter\(\(item\) => item\.canRemove === true\)/)
|
const listSource = source.slice(source.indexOf('function getList()'), source.indexOf('function reset()'))
|
||||||
|
const staleListGuard = 'if \\(!isCurrentListRequest\\(listContext\\)\\) \\{\\s*return;\\s*\\}'
|
||||||
|
assert.match(listSource, /const listContext = \{\s*generation: \+\+listGeneration,\s*query: \{ \.\.\.queryParams\.value \}\s*};/)
|
||||||
|
assert.match(listSource, new RegExp(`list${suffix}\\(listContext\\.query\\)`))
|
||||||
|
assert.match(listSource, new RegExp(`\\.then\\(\\(response\\) => \\{\\s*${staleListGuard}`))
|
||||||
|
assert.match(listSource, new RegExp(`\\.catch\\(\\(\\) => \\{\\s*${staleListGuard}`))
|
||||||
|
assert.match(listSource, new RegExp(`\\.finally\\(\\(\\) => \\{\\s*${staleListGuard}`))
|
||||||
|
|
||||||
|
assert.match(source, /let detailGeneration = 0;/)
|
||||||
|
assert.match(source, /function isCurrentDetailRequest\(detailContext\)\s*{\s*return detailContext\.generation === detailGeneration;?\s*}/)
|
||||||
|
assert.match(source, /function invalidateDetailRequest\(\)\s*{\s*detailGeneration \+= 1;\s*detailLoading\.value = false;\s*}/)
|
||||||
|
const detailSource = source.slice(source.indexOf('function handleUpdate('), source.indexOf('function afterSubmit('))
|
||||||
|
const staleDetailGuard = 'if \\(!isCurrentDetailRequest\\(detailContext\\)\\) \\{\\s*return;\\s*\\}'
|
||||||
|
assert.match(detailSource, new RegExp(`const detailContext = \\{\\s*generation: \\+\\+detailGeneration,\\s*resourceId: ${idKey}\\s*};`))
|
||||||
|
assert.match(detailSource, new RegExp(`get${suffix}\\(detailContext\\.resourceId\\)`))
|
||||||
|
assert.match(detailSource, new RegExp(`\\.then\\(\\(response\\) => \\{\\s*${staleDetailGuard}`))
|
||||||
|
assert.match(detailSource, new RegExp(`\\.catch\\(\\(\\) => \\{\\s*${staleDetailGuard}`))
|
||||||
|
assert.match(detailSource, new RegExp(`\\.finally\\(\\(\\) => \\{\\s*${staleDetailGuard}`))
|
||||||
|
assert.match(source, /function handleAdd\(\)\s*{\s*invalidateDetailRequest\(\)/)
|
||||||
|
assert.match(source, /function cancel\(\)\s*{\s*if \(submitLoading\.value\) return;\s*invalidateDetailRequest\(\)/)
|
||||||
|
|
||||||
|
const dialogTag = source.match(/<el-dialog\b[^>]*>/)?.[0] || ''
|
||||||
|
assert.match(dialogTag, /:close-on-click-modal="!submitLoading"/)
|
||||||
|
assert.match(dialogTag, /:close-on-press-escape="!submitLoading"/)
|
||||||
|
assert.match(dialogTag, /:show-close="!submitLoading"/)
|
||||||
|
assert.match(dialogTag, /:before-close="handleDialogBeforeClose"/)
|
||||||
|
assert.match(source, /function handleDialogBeforeClose\(done\)\s*{\s*if \(submitLoading\.value\) return;[\s\S]*?invalidateDetailRequest\(\);[\s\S]*?done\(\);\s*}/)
|
||||||
|
|
||||||
|
const selectionColumn = source.match(/<el-table-column\b[^>]*type="selection"[^>]*\/>/)?.[0] || ''
|
||||||
|
assert.ok(selectionColumn, `${resource} 缺少选择列`)
|
||||||
|
assert.doesNotMatch(selectionColumn, /:selectable=/)
|
||||||
|
assert.doesNotMatch(source, /function isRowSelectable\(/)
|
||||||
|
assert.match(source, /const selectedIds = ref\(\[\]\)/)
|
||||||
|
assert.match(source, /const removableIds = ref\(\[\]\)/)
|
||||||
|
const selectionSource = source.slice(source.indexOf('function handleSelectionChange('), source.indexOf('function handleAdd('))
|
||||||
|
assert.match(selectionSource, new RegExp(`selectedIds\\.value = selection\\.map\\(\\(item\\) => item\\.${idKey}\\)`))
|
||||||
|
assert.match(selectionSource, new RegExp(`removableIds\\.value = selection\\s*\\.filter\\(\\(item\\) => item\\.canRemove === true\\)\\s*\\.map\\(\\(item\\) => item\\.${idKey}\\)`))
|
||||||
|
assert.match(selectionSource, /single\.value = selectedIds\.value\.length !== 1/)
|
||||||
|
assert.match(selectionSource, /multiple\.value = removableIds\.value\.length === 0/)
|
||||||
|
assert.match(detailSource, new RegExp(`const ${idKey} = row\\.${idKey} \\|\\| selectedIds\\.value\\[0\\]`))
|
||||||
|
assert.match(source, new RegExp(`const targetIds = row\\?\\.${idKey} \\? \\(row\\.canRemove === true \\? \\[row\\.${idKey}\\] : \\[\\]\\) : removableIds\\.value`))
|
||||||
const rowDeleteButtons = extractButtonBlocks(source, 'handleDelete')
|
const rowDeleteButtons = extractButtonBlocks(source, 'handleDelete')
|
||||||
.filter((button) => button.includes('handleDelete(scope.row)'))
|
.filter((button) => button.includes('handleDelete(scope.row)'))
|
||||||
assert.ok(rowDeleteButtons.length > 0, `${resource} 缺少行删除按钮`)
|
assert.ok(rowDeleteButtons.length > 0, `${resource} 缺少行删除按钮`)
|
||||||
for (const button of rowDeleteButtons) {
|
for (const button of rowDeleteButtons) {
|
||||||
assert.match(button, /v-if="scope\.row\.canRemove === true"/)
|
assert.match(button, /v-if="scope\.row\.canRemove === true"/)
|
||||||
}
|
}
|
||||||
|
const rowUpdateButtons = extractButtonBlocks(source, 'handleUpdate')
|
||||||
|
.filter((button) => button.includes('handleUpdate(scope.row)'))
|
||||||
|
assert.ok(rowUpdateButtons.length > 0, `${resource} 缺少行修改按钮`)
|
||||||
|
for (const button of rowUpdateButtons) {
|
||||||
|
assert.match(button, /:disabled="detailLoading"/)
|
||||||
|
}
|
||||||
|
|
||||||
const suffix = resource[0].toUpperCase() + resource.slice(1)
|
|
||||||
assert.deepEqual(extractCallObjectKeys(source, `add${suffix}`), contract.addPayloadKeys)
|
assert.deepEqual(extractCallObjectKeys(source, `add${suffix}`), contract.addPayloadKeys)
|
||||||
assert.deepEqual(extractCallObjectKeys(source, `update${suffix}`), contract.editPayloadKeys)
|
assert.deepEqual(extractCallObjectKeys(source, `update${suffix}`), contract.editPayloadKeys)
|
||||||
|
|
||||||
@@ -659,10 +706,12 @@ test('六个基础资料页面逐页满足 API、权限、分页和安全删除
|
|||||||
assert.match(printHandler, /['"]load['"][\s\S]*?printWindow\.print\(\)/)
|
assert.match(printHandler, /['"]load['"][\s\S]*?printWindow\.print\(\)/)
|
||||||
assert.match(printHandler, /let closeMonitorId;/)
|
assert.match(printHandler, /let closeMonitorId;/)
|
||||||
assert.match(printHandler, /let cleanupFinished = false;/)
|
assert.match(printHandler, /let cleanupFinished = false;/)
|
||||||
assert.match(printHandler, /const cleanupPrint = \(\) => \{\s*if \(cleanupFinished\) return;\s*cleanupFinished = true;/)
|
assert.doesNotMatch(printHandler, /if \(cleanupFinished\) return;/)
|
||||||
|
assert.match(printHandler, /const cleanupPrint = \(\) => \{[\s\S]*?window\.clearInterval\(closeMonitorId\)[\s\S]*?URL\.revokeObjectURL\(objectUrl\)[\s\S]*?if \(!cleanupFinished\) \{\s*cleanupFinished = true;\s*setPrinting\(row\.palletId, false\);\s*}/)
|
||||||
assert.match(printHandler, /window\.clearInterval\(closeMonitorId\)/)
|
assert.match(printHandler, /window\.clearInterval\(closeMonitorId\)/)
|
||||||
assert.equal((printHandler.match(/URL\.revokeObjectURL\(objectUrl\)/g) || []).length, 1)
|
assert.equal((printHandler.match(/URL\.revokeObjectURL\(objectUrl\)/g) || []).length, 1)
|
||||||
assert.equal((printHandler.match(/setPrinting\(row\.palletId, false\)/g) || []).length, 1)
|
assert.equal((printHandler.match(/setPrinting\(row\.palletId, false\)/g) || []).length, 1)
|
||||||
|
assert.match(printHandler, /objectUrl = URL\.createObjectURL\([^;]+\);\s*if \(cleanupFinished \|\| printWindow\.closed\) \{\s*cleanupPrint\(\);\s*return;\s*}/)
|
||||||
assert.match(printHandler, /closeMonitorId = window\.setInterval\(\(\) => \{\s*if \(printWindow\.closed\) cleanupPrint\(\);\s*}, \d+\)/)
|
assert.match(printHandler, /closeMonitorId = window\.setInterval\(\(\) => \{\s*if \(printWindow\.closed\) cleanupPrint\(\);\s*}, \d+\)/)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
printHandler.indexOf('window.setInterval(') < printHandler.indexOf('getPalletQrcode('),
|
printHandler.indexOf('window.setInterval(') < printHandler.indexOf('getPalletQrcode('),
|
||||||
@@ -713,7 +762,16 @@ test('业务用户分配组件使用固定映射并允许空数组完整替换',
|
|||||||
assert.match(source, /nextTick\([\s\S]*?toggleRowSelection\(row, selectedUserIds\.value\.includes\(row\.userId\)\)/)
|
assert.match(source, /nextTick\([\s\S]*?toggleRowSelection\(row, selectedUserIds\.value\.includes\(row\.userId\)\)/)
|
||||||
assert.match(source, /@row-click="handleRowClick"/)
|
assert.match(source, /@row-click="handleRowClick"/)
|
||||||
assert.match(source, /const userIds = \[\.\.\.new Set\(selectedUserIds\.value\.filter\(\(userId\) => Number\.isInteger\(userId\) && userId > 0\)\)\]/)
|
assert.match(source, /const userIds = \[\.\.\.new Set\(selectedUserIds\.value\.filter\(\(userId\) => Number\.isInteger\(userId\) && userId > 0\)\)\]/)
|
||||||
assert.match(source, /assignUsers\(resourceId\.value, \{ userIds }\)/)
|
assert.match(source, /let submitGeneration = 0;/)
|
||||||
|
assert.match(source, /function isCurrentSubmit\(submitContext\)\s*{[\s\S]*?submitContext\.generation === submitGeneration[\s\S]*?submitContext\.resourceType === resourceType\.value[\s\S]*?submitContext\.resourceId === resourceId\.value[\s\S]*?}/)
|
||||||
|
const submitSource = source.slice(source.indexOf('function submitAssignment()'), source.indexOf('defineExpose('))
|
||||||
|
const staleSubmitGuard = 'if \\(!isCurrentSubmit\\(submitContext\\)\\) \\{\\s*return;\\s*\\}'
|
||||||
|
assert.match(submitSource, /const submitContext = \{\s*generation: \+\+submitGeneration,\s*resourceType: resourceType\.value,\s*resourceId: resourceId\.value\s*};/)
|
||||||
|
assert.match(submitSource, /resourceApiMap\[submitContext\.resourceType\]\.assignUsers\(submitContext\.resourceId, \{ userIds }\)/)
|
||||||
|
assert.match(submitSource, new RegExp(`\\.then\\(\\(response\\) => \\{\\s*${staleSubmitGuard}`))
|
||||||
|
assert.match(submitSource, new RegExp(`\\.catch\\(\\(\\) => \\{\\s*${staleSubmitGuard}`))
|
||||||
|
assert.match(submitSource, new RegExp(`\\.finally\\(\\(\\) => \\{\\s*${staleSubmitGuard}`))
|
||||||
|
assert.match(resetDialogSource, /submitGeneration \+= 1;/)
|
||||||
assert.doesNotMatch(source, /请选择要分配的用户|userIds\.length\s*===?\s*0/)
|
assert.doesNotMatch(source, /请选择要分配的用户|userIds\.length\s*===?\s*0/)
|
||||||
assert.match(source, /:loading="submitLoading"/)
|
assert.match(source, /:loading="submitLoading"/)
|
||||||
assert.match(source, /const loadFailed = ref\(false\)/)
|
assert.match(source, /const loadFailed = ref\(false\)/)
|
||||||
@@ -726,6 +784,13 @@ test('业务用户分配组件使用固定映射并允许空数组完整替换',
|
|||||||
assert.deepEqual(submitPermissions, ['master:site:assign', 'master:warehouse:assign'])
|
assert.deepEqual(submitPermissions, ['master:site:assign', 'master:warehouse:assign'])
|
||||||
assert.match(source, /proxy\.\$modal\.msgSuccess\(response\.msg \|\| ['"]分配成功['"]\)/)
|
assert.match(source, /proxy\.\$modal\.msgSuccess\(response\.msg \|\| ['"]分配成功['"]\)/)
|
||||||
assert.match(source, /visible\.value = false[\s\S]*?emit\(['"]ok['"]\)/)
|
assert.match(source, /visible\.value = false[\s\S]*?emit\(['"]ok['"]\)/)
|
||||||
|
const dialogTag = source.match(/<el-dialog\b[^>]*>/)?.[0] || ''
|
||||||
|
assert.match(dialogTag, /:close-on-click-modal="!submitLoading"/)
|
||||||
|
assert.match(dialogTag, /:close-on-press-escape="!submitLoading"/)
|
||||||
|
assert.match(dialogTag, /:show-close="!submitLoading"/)
|
||||||
|
assert.match(dialogTag, /:before-close="handleDialogBeforeClose"/)
|
||||||
|
assert.match(source, /function handleDialogBeforeClose\(done\)\s*{\s*if \(submitLoading\.value\) return;[\s\S]*?resetDialogState\(\);[\s\S]*?done\(\);\s*}/)
|
||||||
|
assert.match(source, /function closeDialog\(\)\s*{\s*if \(submitLoading\.value\) return;/)
|
||||||
assert.match(source, /<el-alert\b[^>]*v-if="loadError"/)
|
assert.match(source, /<el-alert\b[^>]*v-if="loadError"/)
|
||||||
assert.match(source, /width="min\(720px, 92vw\)"/)
|
assert.match(source, /width="min\(720px, 92vw\)"/)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
top="6vh"
|
top="6vh"
|
||||||
append-to-body
|
append-to-body
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
|
:close-on-click-modal="!submitLoading"
|
||||||
|
:close-on-press-escape="!submitLoading"
|
||||||
|
:show-close="!submitLoading"
|
||||||
|
:before-close="handleDialogBeforeClose"
|
||||||
@closed="resetDialogState"
|
@closed="resetDialogState"
|
||||||
>
|
>
|
||||||
<el-form :inline="true" class="assign-search" @submit.prevent>
|
<el-form :inline="true" class="assign-search" @submit.prevent>
|
||||||
@@ -57,7 +61,7 @@
|
|||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button :disabled="submitLoading" @click="visible = false">取 消</el-button>
|
<el-button :disabled="submitLoading" @click="closeDialog">取 消</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="resourceType === 'site'"
|
v-if="resourceType === 'site'"
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -105,6 +109,7 @@ const selectedUserIds = ref([]);
|
|||||||
const userTableRef = ref();
|
const userTableRef = ref();
|
||||||
const restoringSelection = ref(false);
|
const restoringSelection = ref(false);
|
||||||
let loadGeneration = 0;
|
let loadGeneration = 0;
|
||||||
|
let submitGeneration = 0;
|
||||||
|
|
||||||
const dialogTitle = computed(() => {
|
const dialogTitle = computed(() => {
|
||||||
const label = resourceType.value === "site" ? "客户现场" : "仓库";
|
const label = resourceType.value === "site" ? "客户现场" : "仓库";
|
||||||
@@ -216,7 +221,9 @@ function loadUsers() {
|
|||||||
|
|
||||||
function resetDialogState() {
|
function resetDialogState() {
|
||||||
loadGeneration += 1;
|
loadGeneration += 1;
|
||||||
|
submitGeneration += 1;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
submitLoading.value = false;
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
keyword.value = "";
|
keyword.value = "";
|
||||||
resourceType.value = "";
|
resourceType.value = "";
|
||||||
@@ -228,6 +235,18 @@ function resetDialogState() {
|
|||||||
loadFailed.value = false;
|
loadFailed.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDialogBeforeClose(done) {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
resetDialogState();
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeDialog() {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
visible.value = false;
|
||||||
|
resetDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
function show({ resourceType, resourceId, resourceName }) {
|
function show({ resourceType, resourceId, resourceName }) {
|
||||||
openDialog(resourceType, resourceId, resourceName);
|
openDialog(resourceType, resourceId, resourceName);
|
||||||
}
|
}
|
||||||
@@ -247,21 +266,41 @@ function openDialog(nextResourceType, nextResourceId, nextResourceName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submitAssignment() {
|
function submitAssignment() {
|
||||||
const resourceApi = resourceApiMap[resourceType.value];
|
if (submitLoading.value) return;
|
||||||
|
const submitContext = {
|
||||||
|
generation: ++submitGeneration,
|
||||||
|
resourceType: resourceType.value,
|
||||||
|
resourceId: resourceId.value
|
||||||
|
};
|
||||||
const userIds = [...new Set(selectedUserIds.value.filter((userId) => Number.isInteger(userId) && userId > 0))];
|
const userIds = [...new Set(selectedUserIds.value.filter((userId) => Number.isInteger(userId) && userId > 0))];
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
submitLoading.value = true;
|
submitLoading.value = true;
|
||||||
resourceApi.assignUsers(resourceId.value, { userIds }).then((response) => {
|
resourceApiMap[submitContext.resourceType].assignUsers(submitContext.resourceId, { userIds }).then((response) => {
|
||||||
|
if (!isCurrentSubmit(submitContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
proxy.$modal.msgSuccess(response.msg || "分配成功");
|
proxy.$modal.msgSuccess(response.msg || "分配成功");
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
emit("ok");
|
emit("ok");
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentSubmit(submitContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadError.value = "用户分配失败,请根据提示重试";
|
loadError.value = "用户分配失败,请根据提示重试";
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
if (!isCurrentSubmit(submitContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
submitLoading.value = false;
|
submitLoading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isCurrentSubmit(submitContext) {
|
||||||
|
return submitContext.generation === submitGeneration
|
||||||
|
&& submitContext.resourceType === resourceType.value
|
||||||
|
&& submitContext.resourceId === resourceId.value;
|
||||||
|
}
|
||||||
|
|
||||||
watch(keyword, restoreSelection);
|
watch(keyword, restoreSelection);
|
||||||
|
|
||||||
defineExpose({ show });
|
defineExpose({ show });
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-table v-loading="loading" empty-text="暂无数据" :data="customerList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" empty-text="暂无数据" :data="customerList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" :selectable="isRowSelectable" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="客户ID" prop="customerId" align="center" />
|
<el-table-column label="客户ID" prop="customerId" align="center" />
|
||||||
<el-table-column label="客户编码" prop="customerCode" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="客户编码" prop="customerCode" align="center" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="客户名称" prop="customerName" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="客户名称" prop="customerName" align="center" :show-overflow-tooltip="true" />
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="proxy.$auth.hasPermiAnd(['master:customer:query', 'master:customer:edit'])"
|
v-if="proxy.$auth.hasPermiAnd(['master:customer:query', 'master:customer:edit'])"
|
||||||
link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['master:customer:edit']"
|
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:customer:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.canRemove === true"
|
v-if="scope.row.canRemove === true"
|
||||||
@@ -61,7 +61,16 @@
|
|||||||
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog v-model="open" :title="title" width="min(520px, 92vw)" append-to-body>
|
<el-dialog
|
||||||
|
v-model="open"
|
||||||
|
:title="title"
|
||||||
|
width="min(520px, 92vw)"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="!submitLoading"
|
||||||
|
:close-on-press-escape="!submitLoading"
|
||||||
|
:show-close="!submitLoading"
|
||||||
|
:before-close="handleDialogBeforeClose"
|
||||||
|
>
|
||||||
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-form ref="customerRef" :model="form" :rules="rules" label-width="90px">
|
<el-form ref="customerRef" :model="form" :rules="rules" label-width="90px">
|
||||||
<el-form-item label="客户编码" prop="customerCode">
|
<el-form-item label="客户编码" prop="customerCode">
|
||||||
@@ -96,7 +105,8 @@ import { addCustomer, delCustomer, getCustomer, listCustomer, updateCustomer } f
|
|||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
const customerList = ref([]);
|
const customerList = ref([]);
|
||||||
const ids = ref([]);
|
const selectedIds = ref([]);
|
||||||
|
const removableIds = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const detailLoading = ref(false);
|
const detailLoading = ref(false);
|
||||||
const submitLoading = ref(false);
|
const submitLoading = ref(false);
|
||||||
@@ -107,6 +117,8 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
let listGeneration = 0;
|
||||||
|
let detailGeneration = 0;
|
||||||
|
|
||||||
function validateRequiredText(rule, value, callback) {
|
function validateRequiredText(rule, value, callback) {
|
||||||
if (typeof value !== "string" || value.trim() === "") {
|
if (typeof value !== "string" || value.trim() === "") {
|
||||||
@@ -127,17 +139,36 @@ const data = reactive({
|
|||||||
});
|
});
|
||||||
const { form, queryParams, rules } = toRefs(data);
|
const { form, queryParams, rules } = toRefs(data);
|
||||||
|
|
||||||
|
function isCurrentListRequest(listContext) {
|
||||||
|
return listContext.generation === listGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
|
const listContext = {
|
||||||
|
generation: ++listGeneration,
|
||||||
|
query: { ...queryParams.value }
|
||||||
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
listCustomer(queryParams.value).then((response) => {
|
listCustomer(listContext.query).then((response) => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
customerList.value = response.rows;
|
customerList.value = response.rows;
|
||||||
total.value = response.total;
|
total.value = response.total;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
customerList.value = [];
|
customerList.value = [];
|
||||||
total.value = 0;
|
total.value = 0;
|
||||||
loadError.value = "客户列表加载失败,请稍后重试";
|
loadError.value = "客户列表加载失败,请稍后重试";
|
||||||
}).finally(() => { loading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
@@ -145,26 +176,54 @@ function reset() {
|
|||||||
form.value = { customerId: undefined, customerCode: "", customerName: "", status: "0", remark: "" };
|
form.value = { customerId: undefined, customerCode: "", customerName: "", status: "0", remark: "" };
|
||||||
proxy.resetForm("customerRef");
|
proxy.resetForm("customerRef");
|
||||||
}
|
}
|
||||||
function cancel() { open.value = false; reset(); }
|
function invalidateDetailRequest() {
|
||||||
|
detailGeneration += 1;
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
function isCurrentDetailRequest(detailContext) {
|
||||||
|
return detailContext.generation === detailGeneration;
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
function handleDialogBeforeClose(done) {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
done();
|
||||||
|
}
|
||||||
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
||||||
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
||||||
function isRowSelectable(row) {
|
|
||||||
return row.canRemove === true;
|
|
||||||
}
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection
|
selectedIds.value = selection.map((item) => item.customerId);
|
||||||
|
removableIds.value = selection
|
||||||
.filter((item) => item.canRemove === true)
|
.filter((item) => item.canRemove === true)
|
||||||
.map((item) => item.customerId);
|
.map((item) => item.customerId);
|
||||||
single.value = ids.value.length !== 1;
|
single.value = selectedIds.value.length !== 1;
|
||||||
multiple.value = ids.value.length === 0;
|
multiple.value = removableIds.value.length === 0;
|
||||||
|
}
|
||||||
|
function handleAdd() {
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
title.value = "新增客户";
|
||||||
|
open.value = true;
|
||||||
}
|
}
|
||||||
function handleAdd() { reset(); title.value = "新增客户"; open.value = true; }
|
|
||||||
|
|
||||||
function handleUpdate(row = {}) {
|
function handleUpdate(row = {}) {
|
||||||
reset();
|
reset();
|
||||||
const customerId = row.customerId || ids.value[0];
|
const customerId = row.customerId || selectedIds.value[0];
|
||||||
|
const detailContext = {
|
||||||
|
generation: ++detailGeneration,
|
||||||
|
resourceId: customerId
|
||||||
|
};
|
||||||
detailLoading.value = true;
|
detailLoading.value = true;
|
||||||
getCustomer(customerId).then((response) => {
|
getCustomer(detailContext.resourceId).then((response) => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const detail = response.data;
|
const detail = response.data;
|
||||||
form.value = {
|
form.value = {
|
||||||
customerId: detail.customerId,
|
customerId: detail.customerId,
|
||||||
@@ -176,8 +235,16 @@ function handleUpdate(row = {}) {
|
|||||||
title.value = "修改客户";
|
title.value = "修改客户";
|
||||||
open.value = true;
|
open.value = true;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadError.value = "客户详情加载失败,请稍后重试";
|
loadError.value = "客户详情加载失败,请稍后重试";
|
||||||
}).finally(() => { detailLoading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
detailLoading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterSubmit(response) {
|
function afterSubmit(response) {
|
||||||
@@ -217,7 +284,7 @@ function submitUpdate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const targetIds = row?.customerId ? (row.canRemove === true ? [row.customerId] : []) : ids.value;
|
const targetIds = row?.customerId ? (row.canRemove === true ? [row.customerId] : []) : removableIds.value;
|
||||||
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的客户"); return; }
|
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的客户"); return; }
|
||||||
proxy.$modal.confirm(`是否确认删除客户编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
proxy.$modal.confirm(`是否确认删除客户编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
||||||
delCustomer(targetIds.join(","))
|
delCustomer(targetIds.join(","))
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-table v-loading="loading" empty-text="暂无数据" :data="lineList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" empty-text="暂无数据" :data="lineList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" :selectable="isRowSelectable" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="产线ID" prop="lineId" align="center" />
|
<el-table-column label="产线ID" prop="lineId" align="center" />
|
||||||
<el-table-column label="现场ID" prop="siteId" align="center" />
|
<el-table-column label="现场ID" prop="siteId" align="center" />
|
||||||
<el-table-column label="产线编码" prop="lineCode" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="产线编码" prop="lineCode" align="center" :show-overflow-tooltip="true" />
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="proxy.$auth.hasPermiAnd(['master:line:query', 'master:line:edit'])"
|
v-if="proxy.$auth.hasPermiAnd(['master:line:query', 'master:line:edit'])"
|
||||||
link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['master:line:edit']"
|
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:line:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.canRemove === true"
|
v-if="scope.row.canRemove === true"
|
||||||
@@ -65,7 +65,16 @@
|
|||||||
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog v-model="open" :title="title" width="min(520px, 92vw)" append-to-body>
|
<el-dialog
|
||||||
|
v-model="open"
|
||||||
|
:title="title"
|
||||||
|
width="min(520px, 92vw)"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="!submitLoading"
|
||||||
|
:close-on-press-escape="!submitLoading"
|
||||||
|
:show-close="!submitLoading"
|
||||||
|
:before-close="handleDialogBeforeClose"
|
||||||
|
>
|
||||||
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-form ref="lineRef" :model="form" :rules="rules" label-width="90px">
|
<el-form ref="lineRef" :model="form" :rules="rules" label-width="90px">
|
||||||
<el-form-item label="现场ID" prop="siteId">
|
<el-form-item label="现场ID" prop="siteId">
|
||||||
@@ -103,7 +112,8 @@ import { addLine, delLine, getLine, listLine, updateLine } from "@/api/master/li
|
|||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
const lineList = ref([]);
|
const lineList = ref([]);
|
||||||
const ids = ref([]);
|
const selectedIds = ref([]);
|
||||||
|
const removableIds = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const detailLoading = ref(false);
|
const detailLoading = ref(false);
|
||||||
const submitLoading = ref(false);
|
const submitLoading = ref(false);
|
||||||
@@ -114,6 +124,8 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
let listGeneration = 0;
|
||||||
|
let detailGeneration = 0;
|
||||||
|
|
||||||
function validateRequiredText(rule, value, callback) {
|
function validateRequiredText(rule, value, callback) {
|
||||||
const labels = { lineCode: "产线编码", lineName: "产线名称" };
|
const labels = { lineCode: "产线编码", lineName: "产线名称" };
|
||||||
@@ -143,42 +155,88 @@ const data = reactive({
|
|||||||
});
|
});
|
||||||
const { form, queryParams, rules } = toRefs(data);
|
const { form, queryParams, rules } = toRefs(data);
|
||||||
|
|
||||||
|
function isCurrentListRequest(listContext) {
|
||||||
|
return listContext.generation === listGeneration;
|
||||||
|
}
|
||||||
function getList() {
|
function getList() {
|
||||||
|
const listContext = {
|
||||||
|
generation: ++listGeneration,
|
||||||
|
query: { ...queryParams.value }
|
||||||
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
listLine(queryParams.value).then((response) => {
|
listLine(listContext.query).then((response) => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
lineList.value = response.rows;
|
lineList.value = response.rows;
|
||||||
total.value = response.total;
|
total.value = response.total;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
lineList.value = [];
|
lineList.value = [];
|
||||||
total.value = 0;
|
total.value = 0;
|
||||||
loadError.value = "生产线列表加载失败,请稍后重试";
|
loadError.value = "生产线列表加载失败,请稍后重试";
|
||||||
}).finally(() => { loading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function reset() {
|
function reset() {
|
||||||
formError.value = "";
|
formError.value = "";
|
||||||
form.value = { lineId: undefined, siteId: undefined, lineCode: "", lineName: "", status: "0", remark: "" };
|
form.value = { lineId: undefined, siteId: undefined, lineCode: "", lineName: "", status: "0", remark: "" };
|
||||||
proxy.resetForm("lineRef");
|
proxy.resetForm("lineRef");
|
||||||
}
|
}
|
||||||
function cancel() { open.value = false; reset(); }
|
function invalidateDetailRequest() {
|
||||||
|
detailGeneration += 1;
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
function isCurrentDetailRequest(detailContext) {
|
||||||
|
return detailContext.generation === detailGeneration;
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
function handleDialogBeforeClose(done) {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
done();
|
||||||
|
}
|
||||||
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
||||||
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
||||||
function isRowSelectable(row) {
|
|
||||||
return row.canRemove === true;
|
|
||||||
}
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection
|
selectedIds.value = selection.map((item) => item.lineId);
|
||||||
|
removableIds.value = selection
|
||||||
.filter((item) => item.canRemove === true)
|
.filter((item) => item.canRemove === true)
|
||||||
.map((item) => item.lineId);
|
.map((item) => item.lineId);
|
||||||
single.value = ids.value.length !== 1;
|
single.value = selectedIds.value.length !== 1;
|
||||||
multiple.value = ids.value.length === 0;
|
multiple.value = removableIds.value.length === 0;
|
||||||
|
}
|
||||||
|
function handleAdd() {
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
title.value = "新增生产线";
|
||||||
|
open.value = true;
|
||||||
}
|
}
|
||||||
function handleAdd() { reset(); title.value = "新增生产线"; open.value = true; }
|
|
||||||
function handleUpdate(row = {}) {
|
function handleUpdate(row = {}) {
|
||||||
reset();
|
reset();
|
||||||
const lineId = row.lineId || ids.value[0];
|
const lineId = row.lineId || selectedIds.value[0];
|
||||||
|
const detailContext = {
|
||||||
|
generation: ++detailGeneration,
|
||||||
|
resourceId: lineId
|
||||||
|
};
|
||||||
detailLoading.value = true;
|
detailLoading.value = true;
|
||||||
getLine(lineId).then((response) => {
|
getLine(detailContext.resourceId).then((response) => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const detail = response.data;
|
const detail = response.data;
|
||||||
form.value = {
|
form.value = {
|
||||||
lineId: detail.lineId,
|
lineId: detail.lineId,
|
||||||
@@ -191,8 +249,16 @@ function handleUpdate(row = {}) {
|
|||||||
title.value = "修改生产线";
|
title.value = "修改生产线";
|
||||||
open.value = true;
|
open.value = true;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadError.value = "生产线详情加载失败,请稍后重试";
|
loadError.value = "生产线详情加载失败,请稍后重试";
|
||||||
}).finally(() => { detailLoading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
detailLoading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function afterSubmit(response) {
|
function afterSubmit(response) {
|
||||||
proxy.$modal.msgSuccess(response.msg || "操作成功");
|
proxy.$modal.msgSuccess(response.msg || "操作成功");
|
||||||
@@ -233,7 +299,7 @@ function submitUpdate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const targetIds = row?.lineId ? (row.canRemove === true ? [row.lineId] : []) : ids.value;
|
const targetIds = row?.lineId ? (row.canRemove === true ? [row.lineId] : []) : removableIds.value;
|
||||||
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的生产线"); return; }
|
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的生产线"); return; }
|
||||||
proxy.$modal.confirm(`是否确认删除产线编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
proxy.$modal.confirm(`是否确认删除产线编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
||||||
delLine(targetIds.join(","))
|
delLine(targetIds.join(","))
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-table v-loading="loading" empty-text="暂无数据" :data="palletList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" empty-text="暂无数据" :data="palletList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" :selectable="isRowSelectable" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="托盘ID" prop="palletId" align="center" />
|
<el-table-column label="托盘ID" prop="palletId" align="center" />
|
||||||
<el-table-column label="托盘编码" prop="palletCode" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="托盘编码" prop="palletCode" align="center" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="容量(包)" prop="capacityPackages" align="center" />
|
<el-table-column label="容量(包)" prop="capacityPackages" align="center" />
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
>打印</el-button>
|
>打印</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="proxy.$auth.hasPermiAnd(['master:pallet:query', 'master:pallet:edit'])"
|
v-if="proxy.$auth.hasPermiAnd(['master:pallet:query', 'master:pallet:edit'])"
|
||||||
link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['master:pallet:edit']"
|
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:pallet:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.canRemove === true"
|
v-if="scope.row.canRemove === true"
|
||||||
@@ -62,7 +62,16 @@
|
|||||||
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog v-model="open" :title="title" width="min(560px, 92vw)" append-to-body>
|
<el-dialog
|
||||||
|
v-model="open"
|
||||||
|
:title="title"
|
||||||
|
width="min(560px, 92vw)"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="!submitLoading"
|
||||||
|
:close-on-press-escape="!submitLoading"
|
||||||
|
:show-close="!submitLoading"
|
||||||
|
:before-close="handleDialogBeforeClose"
|
||||||
|
>
|
||||||
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-form ref="palletRef" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="palletRef" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-form-item v-if="!isEdit" label="托盘编码" prop="palletCode">
|
<el-form-item v-if="!isEdit" label="托盘编码" prop="palletCode">
|
||||||
@@ -103,7 +112,8 @@ import { addPallet, delPallet, getPallet, getPalletQrcode, listPallet, updatePal
|
|||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
const palletList = ref([]);
|
const palletList = ref([]);
|
||||||
const ids = ref([]);
|
const selectedIds = ref([]);
|
||||||
|
const removableIds = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const detailLoading = ref(false);
|
const detailLoading = ref(false);
|
||||||
const submitLoading = ref(false);
|
const submitLoading = ref(false);
|
||||||
@@ -115,6 +125,8 @@ const multiple = ref(true);
|
|||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
const printingIds = ref([]);
|
const printingIds = ref([]);
|
||||||
|
let listGeneration = 0;
|
||||||
|
let detailGeneration = 0;
|
||||||
|
|
||||||
function validateRequiredText(rule, value, callback) {
|
function validateRequiredText(rule, value, callback) {
|
||||||
if (typeof value !== "string" || value.trim() === "") {
|
if (typeof value !== "string" || value.trim() === "") {
|
||||||
@@ -143,42 +155,88 @@ const data = reactive({
|
|||||||
const { form, queryParams, rules } = toRefs(data);
|
const { form, queryParams, rules } = toRefs(data);
|
||||||
const isEdit = computed(() => Number.isInteger(form.value.palletId) && form.value.palletId > 0);
|
const isEdit = computed(() => Number.isInteger(form.value.palletId) && form.value.palletId > 0);
|
||||||
|
|
||||||
|
function isCurrentListRequest(listContext) {
|
||||||
|
return listContext.generation === listGeneration;
|
||||||
|
}
|
||||||
function getList() {
|
function getList() {
|
||||||
|
const listContext = {
|
||||||
|
generation: ++listGeneration,
|
||||||
|
query: { ...queryParams.value }
|
||||||
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
listPallet(queryParams.value).then((response) => {
|
listPallet(listContext.query).then((response) => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
palletList.value = response.rows;
|
palletList.value = response.rows;
|
||||||
total.value = response.total;
|
total.value = response.total;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
palletList.value = [];
|
palletList.value = [];
|
||||||
total.value = 0;
|
total.value = 0;
|
||||||
loadError.value = "托盘列表加载失败,请稍后重试";
|
loadError.value = "托盘列表加载失败,请稍后重试";
|
||||||
}).finally(() => { loading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function reset() {
|
function reset() {
|
||||||
formError.value = "";
|
formError.value = "";
|
||||||
form.value = { palletId: undefined, palletCode: "", qrToken: "", capacityPackages: 1, assetStatus: "0", remark: "" };
|
form.value = { palletId: undefined, palletCode: "", qrToken: "", capacityPackages: 1, assetStatus: "0", remark: "" };
|
||||||
proxy.resetForm("palletRef");
|
proxy.resetForm("palletRef");
|
||||||
}
|
}
|
||||||
function cancel() { open.value = false; reset(); }
|
function invalidateDetailRequest() {
|
||||||
|
detailGeneration += 1;
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
function isCurrentDetailRequest(detailContext) {
|
||||||
|
return detailContext.generation === detailGeneration;
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
function handleDialogBeforeClose(done) {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
done();
|
||||||
|
}
|
||||||
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
||||||
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
||||||
function isRowSelectable(row) {
|
|
||||||
return row.canRemove === true;
|
|
||||||
}
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection
|
selectedIds.value = selection.map((item) => item.palletId);
|
||||||
|
removableIds.value = selection
|
||||||
.filter((item) => item.canRemove === true)
|
.filter((item) => item.canRemove === true)
|
||||||
.map((item) => item.palletId);
|
.map((item) => item.palletId);
|
||||||
single.value = ids.value.length !== 1;
|
single.value = selectedIds.value.length !== 1;
|
||||||
multiple.value = ids.value.length === 0;
|
multiple.value = removableIds.value.length === 0;
|
||||||
|
}
|
||||||
|
function handleAdd() {
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
title.value = "新增托盘";
|
||||||
|
open.value = true;
|
||||||
}
|
}
|
||||||
function handleAdd() { reset(); title.value = "新增托盘"; open.value = true; }
|
|
||||||
function handleUpdate(row = {}) {
|
function handleUpdate(row = {}) {
|
||||||
reset();
|
reset();
|
||||||
const palletId = row.palletId || ids.value[0];
|
const palletId = row.palletId || selectedIds.value[0];
|
||||||
|
const detailContext = {
|
||||||
|
generation: ++detailGeneration,
|
||||||
|
resourceId: palletId
|
||||||
|
};
|
||||||
detailLoading.value = true;
|
detailLoading.value = true;
|
||||||
getPallet(palletId).then((response) => {
|
getPallet(detailContext.resourceId).then((response) => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const detail = response.data;
|
const detail = response.data;
|
||||||
form.value = {
|
form.value = {
|
||||||
palletId: detail.palletId,
|
palletId: detail.palletId,
|
||||||
@@ -191,8 +249,16 @@ function handleUpdate(row = {}) {
|
|||||||
title.value = "修改托盘";
|
title.value = "修改托盘";
|
||||||
open.value = true;
|
open.value = true;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadError.value = "托盘详情加载失败,请稍后重试";
|
loadError.value = "托盘详情加载失败,请稍后重试";
|
||||||
}).finally(() => { detailLoading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
detailLoading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function afterSubmit(response) {
|
function afterSubmit(response) {
|
||||||
proxy.$modal.msgSuccess(response.msg || "操作成功");
|
proxy.$modal.msgSuccess(response.msg || "操作成功");
|
||||||
@@ -229,7 +295,7 @@ function submitUpdate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const targetIds = row?.palletId ? (row.canRemove === true ? [row.palletId] : []) : ids.value;
|
const targetIds = row?.palletId ? (row.canRemove === true ? [row.palletId] : []) : removableIds.value;
|
||||||
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的托盘"); return; }
|
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的托盘"); return; }
|
||||||
proxy.$modal.confirm(`是否确认删除托盘编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
proxy.$modal.confirm(`是否确认删除托盘编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
||||||
delPallet(targetIds.join(","))
|
delPallet(targetIds.join(","))
|
||||||
@@ -259,8 +325,6 @@ function handlePrint(row) {
|
|||||||
let cleanupFinished = false;
|
let cleanupFinished = false;
|
||||||
setPrinting(row.palletId, true);
|
setPrinting(row.palletId, true);
|
||||||
const cleanupPrint = () => {
|
const cleanupPrint = () => {
|
||||||
if (cleanupFinished) return;
|
|
||||||
cleanupFinished = true;
|
|
||||||
if (closeMonitorId !== undefined) {
|
if (closeMonitorId !== undefined) {
|
||||||
window.clearInterval(closeMonitorId);
|
window.clearInterval(closeMonitorId);
|
||||||
closeMonitorId = undefined;
|
closeMonitorId = undefined;
|
||||||
@@ -269,7 +333,10 @@ function handlePrint(row) {
|
|||||||
URL.revokeObjectURL(objectUrl);
|
URL.revokeObjectURL(objectUrl);
|
||||||
objectUrl = undefined;
|
objectUrl = undefined;
|
||||||
}
|
}
|
||||||
setPrinting(row.palletId, false);
|
if (!cleanupFinished) {
|
||||||
|
cleanupFinished = true;
|
||||||
|
setPrinting(row.palletId, false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
closeMonitorId = window.setInterval(() => {
|
closeMonitorId = window.setInterval(() => {
|
||||||
if (printWindow.closed) cleanupPrint();
|
if (printWindow.closed) cleanupPrint();
|
||||||
@@ -279,6 +346,10 @@ function handlePrint(row) {
|
|||||||
if (printWindow.closed) throw new Error("打印窗口已关闭");
|
if (printWindow.closed) throw new Error("打印窗口已关闭");
|
||||||
const blob = qrCodeBlob instanceof Blob ? qrCodeBlob : new Blob([qrCodeBlob], { type: "image/png" });
|
const blob = qrCodeBlob instanceof Blob ? qrCodeBlob : new Blob([qrCodeBlob], { type: "image/png" });
|
||||||
objectUrl = URL.createObjectURL(blob);
|
objectUrl = URL.createObjectURL(blob);
|
||||||
|
if (cleanupFinished || printWindow.closed) {
|
||||||
|
cleanupPrint();
|
||||||
|
return;
|
||||||
|
}
|
||||||
printWindow.document.title = `托盘二维码 - ${row.palletCode}`;
|
printWindow.document.title = `托盘二维码 - ${row.palletCode}`;
|
||||||
|
|
||||||
const styleElement = printWindow.document.createElement("style");
|
const styleElement = printWindow.document.createElement("style");
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-table v-loading="loading" empty-text="暂无数据" :data="siteList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" empty-text="暂无数据" :data="siteList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" :selectable="isRowSelectable" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="现场ID" prop="siteId" align="center" />
|
<el-table-column label="现场ID" prop="siteId" align="center" />
|
||||||
<el-table-column label="客户ID" prop="customerId" align="center" />
|
<el-table-column label="客户ID" prop="customerId" align="center" />
|
||||||
<el-table-column label="现场编码" prop="siteCode" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="现场编码" prop="siteCode" align="center" :show-overflow-tooltip="true" />
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<el-button link type="primary" icon="User" @click="handleAssign(scope.row)" v-hasPermi="['master:site:assign']">分配</el-button>
|
<el-button link type="primary" icon="User" @click="handleAssign(scope.row)" v-hasPermi="['master:site:assign']">分配</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="proxy.$auth.hasPermiAnd(['master:site:query', 'master:site:edit'])"
|
v-if="proxy.$auth.hasPermiAnd(['master:site:query', 'master:site:edit'])"
|
||||||
link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['master:site:edit']"
|
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:site:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.canRemove === true"
|
v-if="scope.row.canRemove === true"
|
||||||
@@ -68,7 +68,16 @@
|
|||||||
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog v-model="open" :title="title" width="min(560px, 92vw)" append-to-body>
|
<el-dialog
|
||||||
|
v-model="open"
|
||||||
|
:title="title"
|
||||||
|
width="min(560px, 92vw)"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="!submitLoading"
|
||||||
|
:close-on-press-escape="!submitLoading"
|
||||||
|
:show-close="!submitLoading"
|
||||||
|
:before-close="handleDialogBeforeClose"
|
||||||
|
>
|
||||||
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-form ref="siteRef" :model="form" :rules="rules" label-width="90px">
|
<el-form ref="siteRef" :model="form" :rules="rules" label-width="90px">
|
||||||
<el-form-item label="客户ID" prop="customerId">
|
<el-form-item label="客户ID" prop="customerId">
|
||||||
@@ -112,7 +121,8 @@ import { addSite, delSite, getSite, listSite, updateSite } from "@/api/master/si
|
|||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
const siteList = ref([]);
|
const siteList = ref([]);
|
||||||
const ids = ref([]);
|
const selectedIds = ref([]);
|
||||||
|
const removableIds = ref([]);
|
||||||
const selectedRows = ref([]);
|
const selectedRows = ref([]);
|
||||||
const assignDialogRef = ref();
|
const assignDialogRef = ref();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -125,6 +135,8 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
let listGeneration = 0;
|
||||||
|
let detailGeneration = 0;
|
||||||
|
|
||||||
function validateRequiredText(rule, value, callback) {
|
function validateRequiredText(rule, value, callback) {
|
||||||
const labels = { siteCode: "现场编码", siteName: "现场名称" };
|
const labels = { siteCode: "现场编码", siteName: "现场名称" };
|
||||||
@@ -154,43 +166,89 @@ const data = reactive({
|
|||||||
});
|
});
|
||||||
const { form, queryParams, rules } = toRefs(data);
|
const { form, queryParams, rules } = toRefs(data);
|
||||||
|
|
||||||
|
function isCurrentListRequest(listContext) {
|
||||||
|
return listContext.generation === listGeneration;
|
||||||
|
}
|
||||||
function getList() {
|
function getList() {
|
||||||
|
const listContext = {
|
||||||
|
generation: ++listGeneration,
|
||||||
|
query: { ...queryParams.value }
|
||||||
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
listSite(queryParams.value).then((response) => {
|
listSite(listContext.query).then((response) => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
siteList.value = response.rows;
|
siteList.value = response.rows;
|
||||||
total.value = response.total;
|
total.value = response.total;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
siteList.value = [];
|
siteList.value = [];
|
||||||
total.value = 0;
|
total.value = 0;
|
||||||
loadError.value = "客户现场列表加载失败,请稍后重试";
|
loadError.value = "客户现场列表加载失败,请稍后重试";
|
||||||
}).finally(() => { loading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function reset() {
|
function reset() {
|
||||||
formError.value = "";
|
formError.value = "";
|
||||||
form.value = { siteId: undefined, customerId: undefined, siteCode: "", siteName: "", address: "", status: "0", remark: "" };
|
form.value = { siteId: undefined, customerId: undefined, siteCode: "", siteName: "", address: "", status: "0", remark: "" };
|
||||||
proxy.resetForm("siteRef");
|
proxy.resetForm("siteRef");
|
||||||
}
|
}
|
||||||
function cancel() { open.value = false; reset(); }
|
function invalidateDetailRequest() {
|
||||||
|
detailGeneration += 1;
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
function isCurrentDetailRequest(detailContext) {
|
||||||
|
return detailContext.generation === detailGeneration;
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
function handleDialogBeforeClose(done) {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
done();
|
||||||
|
}
|
||||||
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
||||||
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
||||||
function isRowSelectable(row) {
|
|
||||||
return row.canRemove === true;
|
|
||||||
}
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
selectedRows.value = selection.filter((item) => item.canRemove === true);
|
selectedRows.value = selection;
|
||||||
ids.value = selection
|
selectedIds.value = selection.map((item) => item.siteId);
|
||||||
|
removableIds.value = selection
|
||||||
.filter((item) => item.canRemove === true)
|
.filter((item) => item.canRemove === true)
|
||||||
.map((item) => item.siteId);
|
.map((item) => item.siteId);
|
||||||
single.value = ids.value.length !== 1;
|
single.value = selectedIds.value.length !== 1;
|
||||||
multiple.value = ids.value.length === 0;
|
multiple.value = removableIds.value.length === 0;
|
||||||
|
}
|
||||||
|
function handleAdd() {
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
title.value = "新增客户现场";
|
||||||
|
open.value = true;
|
||||||
}
|
}
|
||||||
function handleAdd() { reset(); title.value = "新增客户现场"; open.value = true; }
|
|
||||||
function handleUpdate(row = {}) {
|
function handleUpdate(row = {}) {
|
||||||
reset();
|
reset();
|
||||||
const siteId = row.siteId || ids.value[0];
|
const siteId = row.siteId || selectedIds.value[0];
|
||||||
|
const detailContext = {
|
||||||
|
generation: ++detailGeneration,
|
||||||
|
resourceId: siteId
|
||||||
|
};
|
||||||
detailLoading.value = true;
|
detailLoading.value = true;
|
||||||
getSite(siteId).then((response) => {
|
getSite(detailContext.resourceId).then((response) => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const detail = response.data;
|
const detail = response.data;
|
||||||
form.value = {
|
form.value = {
|
||||||
siteId: detail.siteId,
|
siteId: detail.siteId,
|
||||||
@@ -204,8 +262,16 @@ function handleUpdate(row = {}) {
|
|||||||
title.value = "修改客户现场";
|
title.value = "修改客户现场";
|
||||||
open.value = true;
|
open.value = true;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadError.value = "客户现场详情加载失败,请稍后重试";
|
loadError.value = "客户现场详情加载失败,请稍后重试";
|
||||||
}).finally(() => { detailLoading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
detailLoading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function handleAssign(row = {}) {
|
function handleAssign(row = {}) {
|
||||||
if (!row.siteId) row = selectedRows.value[0];
|
if (!row.siteId) row = selectedRows.value[0];
|
||||||
@@ -257,7 +323,7 @@ function submitUpdate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const targetIds = row?.siteId ? (row.canRemove === true ? [row.siteId] : []) : ids.value;
|
const targetIds = row?.siteId ? (row.canRemove === true ? [row.siteId] : []) : removableIds.value;
|
||||||
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的客户现场"); return; }
|
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的客户现场"); return; }
|
||||||
proxy.$modal.confirm(`是否确认删除现场编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
proxy.$modal.confirm(`是否确认删除现场编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
||||||
delSite(targetIds.join(","))
|
delSite(targetIds.join(","))
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
|
|
||||||
<el-table v-loading="loading" empty-text="暂无数据" :data="strainList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" empty-text="暂无数据" :data="strainList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" :selectable="isRowSelectable" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="菌种ID" prop="strainId" align="center" />
|
<el-table-column label="菌种ID" prop="strainId" align="center" />
|
||||||
<el-table-column label="菌种编码" prop="strainCode" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="菌种编码" prop="strainCode" align="center" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="菌种名称" prop="strainName" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="菌种名称" prop="strainName" align="center" :show-overflow-tooltip="true" />
|
||||||
@@ -61,6 +61,7 @@
|
|||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="Edit"
|
icon="Edit"
|
||||||
|
:disabled="detailLoading"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['master:strain:edit']"
|
v-hasPermi="['master:strain:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
@@ -84,7 +85,16 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog v-model="open" :title="title" width="min(520px, 92vw)" append-to-body>
|
<el-dialog
|
||||||
|
v-model="open"
|
||||||
|
:title="title"
|
||||||
|
width="min(520px, 92vw)"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="!submitLoading"
|
||||||
|
:close-on-press-escape="!submitLoading"
|
||||||
|
:show-close="!submitLoading"
|
||||||
|
:before-close="handleDialogBeforeClose"
|
||||||
|
>
|
||||||
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-form ref="strainRef" :model="form" :rules="rules" label-width="90px">
|
<el-form ref="strainRef" :model="form" :rules="rules" label-width="90px">
|
||||||
<el-form-item label="菌种编码" prop="strainCode">
|
<el-form-item label="菌种编码" prop="strainCode">
|
||||||
@@ -120,7 +130,8 @@ const { proxy } = getCurrentInstance();
|
|||||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
|
|
||||||
const strainList = ref([]);
|
const strainList = ref([]);
|
||||||
const ids = ref([]);
|
const selectedIds = ref([]);
|
||||||
|
const removableIds = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const detailLoading = ref(false);
|
const detailLoading = ref(false);
|
||||||
const submitLoading = ref(false);
|
const submitLoading = ref(false);
|
||||||
@@ -131,6 +142,8 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
let listGeneration = 0;
|
||||||
|
let detailGeneration = 0;
|
||||||
|
|
||||||
function validateRequiredText(rule, value, callback) {
|
function validateRequiredText(rule, value, callback) {
|
||||||
if (typeof value !== "string" || value.trim() === "") {
|
if (typeof value !== "string" || value.trim() === "") {
|
||||||
@@ -151,17 +164,34 @@ const data = reactive({
|
|||||||
});
|
});
|
||||||
const { form, queryParams, rules } = toRefs(data);
|
const { form, queryParams, rules } = toRefs(data);
|
||||||
|
|
||||||
|
function isCurrentListRequest(listContext) {
|
||||||
|
return listContext.generation === listGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
|
const listContext = {
|
||||||
|
generation: ++listGeneration,
|
||||||
|
query: { ...queryParams.value }
|
||||||
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
listStrain(queryParams.value).then((response) => {
|
listStrain(listContext.query).then((response) => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
strainList.value = response.rows;
|
strainList.value = response.rows;
|
||||||
total.value = response.total;
|
total.value = response.total;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
strainList.value = [];
|
strainList.value = [];
|
||||||
total.value = 0;
|
total.value = 0;
|
||||||
loadError.value = "菌种列表加载失败,请稍后重试";
|
loadError.value = "菌种列表加载失败,请稍后重试";
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -172,11 +202,29 @@ function reset() {
|
|||||||
proxy.resetForm("strainRef");
|
proxy.resetForm("strainRef");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function invalidateDetailRequest() {
|
||||||
|
detailGeneration += 1;
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCurrentDetailRequest(detailContext) {
|
||||||
|
return detailContext.generation === detailGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
open.value = false;
|
open.value = false;
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDialogBeforeClose(done) {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
getList();
|
getList();
|
||||||
@@ -187,19 +235,17 @@ function resetQuery() {
|
|||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRowSelectable(row) {
|
|
||||||
return row.canRemove === true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection
|
selectedIds.value = selection.map((item) => item.strainId);
|
||||||
|
removableIds.value = selection
|
||||||
.filter((item) => item.canRemove === true)
|
.filter((item) => item.canRemove === true)
|
||||||
.map((item) => item.strainId);
|
.map((item) => item.strainId);
|
||||||
single.value = ids.value.length !== 1;
|
single.value = selectedIds.value.length !== 1;
|
||||||
multiple.value = ids.value.length === 0;
|
multiple.value = removableIds.value.length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
|
invalidateDetailRequest();
|
||||||
reset();
|
reset();
|
||||||
title.value = "新增菌种";
|
title.value = "新增菌种";
|
||||||
open.value = true;
|
open.value = true;
|
||||||
@@ -207,9 +253,16 @@ function handleAdd() {
|
|||||||
|
|
||||||
function handleUpdate(row = {}) {
|
function handleUpdate(row = {}) {
|
||||||
reset();
|
reset();
|
||||||
const strainId = row.strainId || ids.value[0];
|
const strainId = row.strainId || selectedIds.value[0];
|
||||||
|
const detailContext = {
|
||||||
|
generation: ++detailGeneration,
|
||||||
|
resourceId: strainId
|
||||||
|
};
|
||||||
detailLoading.value = true;
|
detailLoading.value = true;
|
||||||
getStrain(strainId).then((response) => {
|
getStrain(detailContext.resourceId).then((response) => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const detail = response.data;
|
const detail = response.data;
|
||||||
form.value = {
|
form.value = {
|
||||||
strainId: detail.strainId,
|
strainId: detail.strainId,
|
||||||
@@ -221,8 +274,14 @@ function handleUpdate(row = {}) {
|
|||||||
title.value = "修改菌种";
|
title.value = "修改菌种";
|
||||||
open.value = true;
|
open.value = true;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadError.value = "菌种详情加载失败,请稍后重试";
|
loadError.value = "菌种详情加载失败,请稍后重试";
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
detailLoading.value = false;
|
detailLoading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -271,9 +330,7 @@ function submitUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const targetIds = row?.strainId
|
const targetIds = row?.strainId ? (row.canRemove === true ? [row.strainId] : []) : removableIds.value;
|
||||||
? (row.canRemove === true ? [row.strainId] : [])
|
|
||||||
: ids.value;
|
|
||||||
if (!targetIds.length) {
|
if (!targetIds.length) {
|
||||||
proxy.$modal.msgWarning("请选择允许删除的菌种");
|
proxy.$modal.msgWarning("请选择允许删除的菌种");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-table v-loading="loading" empty-text="暂无数据" :data="warehouseList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" empty-text="暂无数据" :data="warehouseList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" :selectable="isRowSelectable" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="仓库ID" prop="warehouseId" align="center" />
|
<el-table-column label="仓库ID" prop="warehouseId" align="center" />
|
||||||
<el-table-column label="仓库编码" prop="warehouseCode" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="仓库编码" prop="warehouseCode" align="center" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="仓库名称" prop="warehouseName" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="仓库名称" prop="warehouseName" align="center" :show-overflow-tooltip="true" />
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
<el-button link type="primary" icon="User" @click="handleAssign(scope.row)" v-hasPermi="['master:warehouse:assign']">分配</el-button>
|
<el-button link type="primary" icon="User" @click="handleAssign(scope.row)" v-hasPermi="['master:warehouse:assign']">分配</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="proxy.$auth.hasPermiAnd(['master:warehouse:query', 'master:warehouse:edit'])"
|
v-if="proxy.$auth.hasPermiAnd(['master:warehouse:query', 'master:warehouse:edit'])"
|
||||||
link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['master:warehouse:edit']"
|
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:warehouse:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.canRemove === true"
|
v-if="scope.row.canRemove === true"
|
||||||
@@ -64,7 +64,16 @@
|
|||||||
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog v-model="open" :title="title" width="min(560px, 92vw)" append-to-body>
|
<el-dialog
|
||||||
|
v-model="open"
|
||||||
|
:title="title"
|
||||||
|
width="min(560px, 92vw)"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="!submitLoading"
|
||||||
|
:close-on-press-escape="!submitLoading"
|
||||||
|
:show-close="!submitLoading"
|
||||||
|
:before-close="handleDialogBeforeClose"
|
||||||
|
>
|
||||||
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
<el-alert v-if="formError" :title="formError" type="error" :closable="false" show-icon class="mb8" />
|
||||||
<el-form ref="warehouseRef" :model="form" :rules="rules" label-width="90px">
|
<el-form ref="warehouseRef" :model="form" :rules="rules" label-width="90px">
|
||||||
<el-form-item label="仓库编码" prop="warehouseCode">
|
<el-form-item label="仓库编码" prop="warehouseCode">
|
||||||
@@ -105,7 +114,8 @@ import { addWarehouse, delWarehouse, getWarehouse, listWarehouse, updateWarehous
|
|||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
const warehouseList = ref([]);
|
const warehouseList = ref([]);
|
||||||
const ids = ref([]);
|
const selectedIds = ref([]);
|
||||||
|
const removableIds = ref([]);
|
||||||
const selectedRows = ref([]);
|
const selectedRows = ref([]);
|
||||||
const assignDialogRef = ref();
|
const assignDialogRef = ref();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -118,6 +128,8 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
let listGeneration = 0;
|
||||||
|
let detailGeneration = 0;
|
||||||
|
|
||||||
function validateRequiredText(rule, value, callback) {
|
function validateRequiredText(rule, value, callback) {
|
||||||
const labels = { warehouseCode: "仓库编码", warehouseName: "仓库名称" };
|
const labels = { warehouseCode: "仓库编码", warehouseName: "仓库名称" };
|
||||||
@@ -139,43 +151,89 @@ const data = reactive({
|
|||||||
});
|
});
|
||||||
const { form, queryParams, rules } = toRefs(data);
|
const { form, queryParams, rules } = toRefs(data);
|
||||||
|
|
||||||
|
function isCurrentListRequest(listContext) {
|
||||||
|
return listContext.generation === listGeneration;
|
||||||
|
}
|
||||||
function getList() {
|
function getList() {
|
||||||
|
const listContext = {
|
||||||
|
generation: ++listGeneration,
|
||||||
|
query: { ...queryParams.value }
|
||||||
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loadError.value = "";
|
loadError.value = "";
|
||||||
listWarehouse(queryParams.value).then((response) => {
|
listWarehouse(listContext.query).then((response) => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
warehouseList.value = response.rows;
|
warehouseList.value = response.rows;
|
||||||
total.value = response.total;
|
total.value = response.total;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
warehouseList.value = [];
|
warehouseList.value = [];
|
||||||
total.value = 0;
|
total.value = 0;
|
||||||
loadError.value = "仓库列表加载失败,请稍后重试";
|
loadError.value = "仓库列表加载失败,请稍后重试";
|
||||||
}).finally(() => { loading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentListRequest(listContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function reset() {
|
function reset() {
|
||||||
formError.value = "";
|
formError.value = "";
|
||||||
form.value = { warehouseId: undefined, warehouseCode: "", warehouseName: "", address: "", status: "0", remark: "" };
|
form.value = { warehouseId: undefined, warehouseCode: "", warehouseName: "", address: "", status: "0", remark: "" };
|
||||||
proxy.resetForm("warehouseRef");
|
proxy.resetForm("warehouseRef");
|
||||||
}
|
}
|
||||||
function cancel() { open.value = false; reset(); }
|
function invalidateDetailRequest() {
|
||||||
|
detailGeneration += 1;
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
function isCurrentDetailRequest(detailContext) {
|
||||||
|
return detailContext.generation === detailGeneration;
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
function handleDialogBeforeClose(done) {
|
||||||
|
if (submitLoading.value) return;
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
done();
|
||||||
|
}
|
||||||
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
||||||
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
||||||
function isRowSelectable(row) {
|
|
||||||
return row.canRemove === true;
|
|
||||||
}
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
selectedRows.value = selection.filter((item) => item.canRemove === true);
|
selectedRows.value = selection;
|
||||||
ids.value = selection
|
selectedIds.value = selection.map((item) => item.warehouseId);
|
||||||
|
removableIds.value = selection
|
||||||
.filter((item) => item.canRemove === true)
|
.filter((item) => item.canRemove === true)
|
||||||
.map((item) => item.warehouseId);
|
.map((item) => item.warehouseId);
|
||||||
single.value = ids.value.length !== 1;
|
single.value = selectedIds.value.length !== 1;
|
||||||
multiple.value = ids.value.length === 0;
|
multiple.value = removableIds.value.length === 0;
|
||||||
|
}
|
||||||
|
function handleAdd() {
|
||||||
|
invalidateDetailRequest();
|
||||||
|
reset();
|
||||||
|
title.value = "新增仓库";
|
||||||
|
open.value = true;
|
||||||
}
|
}
|
||||||
function handleAdd() { reset(); title.value = "新增仓库"; open.value = true; }
|
|
||||||
function handleUpdate(row = {}) {
|
function handleUpdate(row = {}) {
|
||||||
reset();
|
reset();
|
||||||
const warehouseId = row.warehouseId || ids.value[0];
|
const warehouseId = row.warehouseId || selectedIds.value[0];
|
||||||
|
const detailContext = {
|
||||||
|
generation: ++detailGeneration,
|
||||||
|
resourceId: warehouseId
|
||||||
|
};
|
||||||
detailLoading.value = true;
|
detailLoading.value = true;
|
||||||
getWarehouse(warehouseId).then((response) => {
|
getWarehouse(detailContext.resourceId).then((response) => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const detail = response.data;
|
const detail = response.data;
|
||||||
form.value = {
|
form.value = {
|
||||||
warehouseId: detail.warehouseId,
|
warehouseId: detail.warehouseId,
|
||||||
@@ -188,8 +246,16 @@ function handleUpdate(row = {}) {
|
|||||||
title.value = "修改仓库";
|
title.value = "修改仓库";
|
||||||
open.value = true;
|
open.value = true;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadError.value = "仓库详情加载失败,请稍后重试";
|
loadError.value = "仓库详情加载失败,请稍后重试";
|
||||||
}).finally(() => { detailLoading.value = false; });
|
}).finally(() => {
|
||||||
|
if (!isCurrentDetailRequest(detailContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
detailLoading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function handleAssign(row = {}) {
|
function handleAssign(row = {}) {
|
||||||
if (!row.warehouseId) row = selectedRows.value[0];
|
if (!row.warehouseId) row = selectedRows.value[0];
|
||||||
@@ -239,7 +305,7 @@ function submitUpdate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const targetIds = row?.warehouseId ? (row.canRemove === true ? [row.warehouseId] : []) : ids.value;
|
const targetIds = row?.warehouseId ? (row.canRemove === true ? [row.warehouseId] : []) : removableIds.value;
|
||||||
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的仓库"); return; }
|
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的仓库"); return; }
|
||||||
proxy.$modal.confirm(`是否确认删除仓库编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
proxy.$modal.confirm(`是否确认删除仓库编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
||||||
delWarehouse(targetIds.join(","))
|
delWarehouse(targetIds.join(","))
|
||||||
|
|||||||
Reference in New Issue
Block a user