权限:移除业务物理删除入口

This commit is contained in:
焦龙言
2026-09-24 08:13:16 +08:00
parent 4706c4afeb
commit ae8c4c8c38
35 changed files with 668 additions and 445 deletions
@@ -17,21 +17,18 @@ const expectedRequests = {
{ url: "'/master/strain/' + strainId", method: 'get' },
{ url: "'/master/strain'", method: 'post' },
{ url: "'/master/strain'", method: 'put' },
{ url: "'/master/strain/' + strainIds", method: 'delete' }
],
'src/api/master/customer.js': [
{ url: "'/master/customer/list'", method: 'get' },
{ url: "'/master/customer/' + customerId", method: 'get' },
{ url: "'/master/customer'", method: 'post' },
{ url: "'/master/customer'", method: 'put' },
{ url: "'/master/customer/' + customerIds", method: 'delete' }
],
'src/api/master/site.js': [
{ url: "'/master/site/list'", method: 'get' },
{ url: "'/master/site/' + siteId", method: 'get' },
{ url: "'/master/site'", method: 'post' },
{ url: "'/master/site'", method: 'put' },
{ url: "'/master/site/' + siteIds", method: 'delete' },
{ url: "'/master/site/' + siteId + '/users'", method: 'get' },
{ url: "'/master/site/' + siteId + '/users'", method: 'put' }
],
@@ -40,14 +37,12 @@ const expectedRequests = {
{ url: "'/master/line/' + lineId", method: 'get' },
{ url: "'/master/line'", method: 'post' },
{ url: "'/master/line'", method: 'put' },
{ url: "'/master/line/' + lineIds", method: 'delete' }
],
'src/api/master/warehouse.js': [
{ url: "'/master/warehouse/list'", method: 'get' },
{ url: "'/master/warehouse/' + warehouseId", method: 'get' },
{ url: "'/master/warehouse'", method: 'post' },
{ url: "'/master/warehouse'", method: 'put' },
{ url: "'/master/warehouse/' + warehouseIds", method: 'delete' },
{ url: "'/master/warehouse/' + warehouseId + '/users'", method: 'get' },
{ url: "'/master/warehouse/' + warehouseId + '/users'", method: 'put' }
],
@@ -57,7 +52,6 @@ const expectedRequests = {
{ url: "'/master/pallet/' + palletId + '/qrcode'", method: 'get' },
{ url: "'/master/pallet'", method: 'post' },
{ url: "'/master/pallet'", method: 'put' },
{ url: "'/master/pallet/' + palletIds", method: 'delete' }
],
'src/api/business/inbound.js': [
{ url: "'/business/inbound/list'", method: 'get' },
@@ -66,7 +60,6 @@ const expectedRequests = {
{ url: "'/business/inbound/' + inboundId", method: 'get' },
{ url: "'/business/inbound'", method: 'post' },
{ url: "'/business/inbound'", method: 'put' },
{ url: "'/business/inbound/' + inboundIds", method: 'delete' },
{ url: "'/business/inbound/' + inboundId + '/confirm'", method: 'put' }
],
'src/api/business/filling.js': [
@@ -84,7 +77,6 @@ const expectedRequests = {
{ url: "'/business/shipment/' + shipmentId", method: 'get' },
{ url: "'/business/shipment'", method: 'post' },
{ url: "'/business/shipment'", method: 'put' },
{ url: "'/business/shipment/' + shipmentIds", method: 'delete' },
{ url: "'/business/shipment/' + shipmentId + '/confirm'", method: 'put' }
],
'src/api/business/usage.js': [
@@ -134,43 +126,43 @@ const expectedReportExports = {
const masterPageContracts = {
strain: {
relativePath: 'src/views/master/strain/index.vue',
apiNames: ['addStrain', 'delStrain', 'getStrain', 'listStrain', 'updateStrain'],
permissions: ['add', 'edit', 'list', 'query', 'remove'],
apiNames: ['addStrain', 'getStrain', 'listStrain', 'updateStrain'],
permissions: ['add', 'edit', 'list', 'query'],
addPayloadKeys: ['remark', 'status', 'strainCode', 'strainName'],
editPayloadKeys: ['remark', 'status', 'strainCode', 'strainId', 'strainName']
},
customer: {
relativePath: 'src/views/master/customer/index.vue',
apiNames: ['addCustomer', 'delCustomer', 'getCustomer', 'listCustomer', 'updateCustomer'],
permissions: ['add', 'edit', 'list', 'query', 'remove'],
apiNames: ['addCustomer', 'getCustomer', 'listCustomer', 'updateCustomer'],
permissions: ['add', 'edit', 'list', 'query'],
addPayloadKeys: ['customerCode', 'customerName', 'remark', 'status'],
editPayloadKeys: ['customerCode', 'customerId', 'customerName', 'remark', 'status']
},
site: {
relativePath: 'src/views/master/site/index.vue',
apiNames: ['addSite', 'delSite', 'getSite', 'listSite', 'updateSite'],
permissions: ['add', 'assign', 'edit', 'list', 'query', 'remove'],
apiNames: ['addSite', 'getSite', 'listSite', 'updateSite'],
permissions: ['add', 'assign', 'edit', 'list', 'query'],
addPayloadKeys: ['address', 'customerId', 'remark', 'siteCode', 'siteName', 'status'],
editPayloadKeys: ['address', 'customerId', 'remark', 'siteCode', 'siteId', 'siteName', 'status']
},
line: {
relativePath: 'src/views/master/line/index.vue',
apiNames: ['addLine', 'delLine', 'getLine', 'listLine', 'updateLine'],
permissions: ['add', 'edit', 'list', 'query', 'remove'],
apiNames: ['addLine', 'getLine', 'listLine', 'updateLine'],
permissions: ['add', 'edit', 'list', 'query'],
addPayloadKeys: ['lineCode', 'lineName', 'remark', 'siteId', 'status'],
editPayloadKeys: ['lineCode', 'lineId', 'lineName', 'remark', 'siteId', 'status']
},
warehouse: {
relativePath: 'src/views/master/warehouse/index.vue',
apiNames: ['addWarehouse', 'delWarehouse', 'getWarehouse', 'listWarehouse', 'updateWarehouse'],
permissions: ['add', 'assign', 'edit', 'list', 'query', 'remove'],
apiNames: ['addWarehouse', 'getWarehouse', 'listWarehouse', 'updateWarehouse'],
permissions: ['add', 'assign', 'edit', 'list', 'query'],
addPayloadKeys: ['address', 'remark', 'status', 'warehouseCode', 'warehouseName'],
editPayloadKeys: ['address', 'remark', 'status', 'warehouseCode', 'warehouseId', 'warehouseName']
},
pallet: {
relativePath: 'src/views/master/pallet/index.vue',
apiNames: ['addPallet', 'delPallet', 'getPallet', 'getPalletQrcode', 'listPallet', 'updatePallet'],
permissions: ['add', 'edit', 'list', 'print', 'query', 'remove'],
apiNames: ['addPallet', 'getPallet', 'getPalletQrcode', 'listPallet', 'updatePallet'],
permissions: ['add', 'edit', 'list', 'print', 'query'],
addPayloadKeys: ['capacityPackages', 'palletCode', 'remark'],
editPayloadKeys: ['assetStatus', 'capacityPackages', 'palletId', 'remark']
}
@@ -182,14 +174,13 @@ const businessPageContracts = {
apiNames: [
'addInbound',
'confirmInbound',
'delInbound',
'getInbound',
'getInboundWarehouseOptions',
'listInbound',
'scanInboundPallet',
'updateInbound'
],
permissions: ['add', 'confirm', 'edit', 'list', 'query', 'remove'],
permissions: ['add', 'confirm', 'edit', 'list', 'query'],
payloads: {
addInbound: ['palletIds', 'warehouseId'],
updateInbound: ['inboundId', 'palletIds', 'warehouseId'],
@@ -217,7 +208,6 @@ const businessPageContracts = {
apiNames: [
'addShipment',
'confirmShipment',
'delShipment',
'getShipment',
'getShipmentSiteOptions',
'getShipmentWarehouseOptions',
@@ -225,7 +215,7 @@ const businessPageContracts = {
'scanShipmentPallet',
'updateShipment'
],
permissions: ['add', 'confirm', 'edit', 'list', 'query', 'remove'],
permissions: ['add', 'confirm', 'edit', 'list', 'query'],
payloads: {
addShipment: ['palletIds', 'sourceWarehouseId', 'targetSiteId'],
updateShipment: ['palletIds', 'shipmentId', 'sourceWarehouseId', 'targetSiteId'],
@@ -361,47 +351,40 @@ const expectedButtonPermissions = [
'master:strain:query',
'master:strain:add',
'master:strain:edit',
'master:strain:remove',
'master:customer:query',
'master:customer:add',
'master:customer:edit',
'master:customer:remove',
'master:site:query',
'master:site:add',
'master:site:edit',
'master:site:remove',
'master:site:assign',
'master:line:query',
'master:line:add',
'master:line:edit',
'master:line:remove',
'master:warehouse:query',
'master:warehouse:add',
'master:warehouse:edit',
'master:warehouse:remove',
'master:warehouse:assign',
'master:pallet:query',
'master:pallet:add',
'master:pallet:edit',
'master:pallet:remove',
'master:pallet:print',
'business:inbound:query',
'business:inbound:add',
'business:inbound:edit',
'business:inbound:remove',
'business:inbound:confirm',
'business:filling:query',
'business:filling:add',
'business:shipment:query',
'business:shipment:add',
'business:shipment:edit',
'business:shipment:remove',
'business:shipment:confirm',
'business:usage:query',
'business:usage:add',
'business:return:query',
'business:return:request',
'business:return:confirm'
'business:return:confirm',
'system:testbatch:adopt'
]
const expectedPermissions = [...expectedPagePermissions, ...expectedButtonPermissions].sort()
@@ -536,7 +519,7 @@ function parseStaticPermissionArray(expression) {
assert.ok(index === ranges.length - 1, '权限门禁数组禁止稀疏元素,仅允许单个尾逗号')
continue
}
const literal = /^(['"])((?:master|business|report):[a-z]+:[a-z]+)\1$/.exec(item)
const literal = /^(['"])((?:master|business|report|system):[a-z]+:[a-z]+)\1$/.exec(item)
assert.ok(literal, '权限门禁数组禁止动态表达式或非法字面量')
permissions.push(literal[2])
}
@@ -1147,8 +1130,8 @@ test('窄屏模式控件仍保留正式退出与测试批次切换入口', async
test('17 个页面的真实权限门禁逐项匹配独立硬编码契约', async () => {
assert.equal(expectedPagePermissions.length, 17)
assert.equal(expectedButtonPermissions.length, 44)
assert.equal(new Set(expectedPermissions).size, 61)
assert.equal(expectedButtonPermissions.length, 37)
assert.equal(new Set(expectedPermissions).size, 54)
const relativePaths = [
...Object.values(masterPageContracts),
...Object.values(businessPageContracts),
@@ -1450,7 +1433,7 @@ test('首次入库确认失败后取消重试不丢弃原幂等键', async () =>
test('17 个 API 文件逐一匹配硬编码请求契约', async (t) => {
assert.equal(Object.keys(expectedRequests).length, 17)
assert.equal(Object.values(expectedRequests).flat().length, 74)
assert.equal(Object.values(expectedRequests).flat().length, 66)
for (const [relativePath, expected] of Object.entries(expectedRequests)) {
await t.test(relativePath, async () => {
@@ -1647,7 +1630,6 @@ test('六个基础资料页面逐页满足 API、权限、分页和安全删除
assertButtonsUsePermission(source, 'submitCreate', `${permissionPrefix}:add`)
assertButtonsUsePermission(source, 'handleUpdate', `${permissionPrefix}:edit`)
assertButtonsUsePermission(source, 'submitUpdate', `${permissionPrefix}:edit`)
assertButtonsUsePermission(source, 'handleDelete', `${permissionPrefix}:remove`)
for (const button of extractButtonBlocks(source, 'handleUpdate')) {
assert.match(
@@ -1708,20 +1690,10 @@ test('六个基础资料页面逐页满足 API、权限、分页和安全删除
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')
.filter((button) => button.includes('handleDelete(scope.row)'))
assert.ok(rowDeleteButtons.length > 0, `${resource} 缺少行删除按钮`)
for (const button of rowDeleteButtons) {
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} 缺少行修改按钮`)
@@ -1980,7 +1952,6 @@ test('入库页面只允许 DRAFT 变更并以 authoritative 详情和独立确
assertButtonsUsePermission(source, 'handleAdd', 'business:inbound:add')
assertButtonsUsePermission(source, 'submitInbound', 'business:inbound:add')
assertButtonsUsePermission(source, 'handleUpdate', 'business:inbound:edit')
assertButtonsUsePermission(source, 'handleDelete', 'business:inbound:remove')
assertButtonsUsePermission(source, 'handleConfirm', 'business:inbound:confirm')
assert.match(source, /proxy\.\$auth\.hasPermiAnd\(\['business:inbound:query', 'business:inbound:add'\]\)/)
assert.match(source, /proxy\.\$auth\.hasPermiAnd\(\['business:inbound:query', 'business:inbound:edit'\]\)/)
@@ -1999,9 +1970,8 @@ test('入库页面只允许 DRAFT 变更并以 authoritative 详情和独立确
/^function handleAdd\(\)\s*\{\s*if \(!canAddInbound\.value \|\| operationPending\.value \|\| optionLoading\.value \|\| detailLoading\.value \|\| open\.value\) return/
)
assert.match(source, /scope\.row\.status === ['"]DRAFT['"][\s\S]*?handleUpdate\(scope\.row\)/)
assert.match(source, /scope\.row\.status === ['"]DRAFT['"][\s\S]*?handleDelete\(scope\.row\)/)
assert.match(source, /scope\.row\.status === ['"]DRAFT['"][\s\S]*?handleConfirm\(scope\.row\)/)
for (const functionName of ['handleUpdate', 'handleDelete', 'handleConfirm']) {
for (const functionName of ['handleUpdate', 'handleConfirm']) {
assert.match(extractNamedFunction(source, functionName), /status !== ['"]DRAFT['"]/)
}
@@ -2041,11 +2011,6 @@ test('入库页面只允许 DRAFT 变更并以 authoritative 详情和独立确
)
assert.match(submitSource, /if \(!valid\) \{\s*submitLoading\.value = false\s*return/)
assert.match(submitSource, /\.finally\(\(\) => \{\s*submitLoading\.value = false/)
const deleteSource = extractNamedFunction(source, 'handleDelete')
assert.ok(
deleteSource.indexOf('deleteLoading.value = true') < deleteSource.indexOf('proxy.$modal.confirm('),
'入库删除必须在打开二次确认框前加锁'
)
assert.deepEqual(extractSecondCallObjectKeys(source, 'scanInboundPallet'), ['warehouseId'])
const scanSource = extractNamedFunction(source, 'handleInboundScan')
@@ -2187,7 +2152,6 @@ test('发货页面只允许 DRAFT 变更、展示只读余量并复用确认幂
assertButtonsUsePermission(source, 'handleAdd', 'business:shipment:add')
assertButtonsUsePermission(source, 'submitShipment', 'business:shipment:add')
assertButtonsUsePermission(source, 'handleUpdate', 'business:shipment:edit')
assertButtonsUsePermission(source, 'handleDelete', 'business:shipment:remove')
assertButtonsUsePermission(source, 'handleConfirm', 'business:shipment:confirm')
assert.match(source, /proxy\.\$auth\.hasPermiAnd\(\['business:shipment:query', 'business:shipment:add'\]\)/)
assert.match(source, /proxy\.\$auth\.hasPermiAnd\(\['business:shipment:query', 'business:shipment:edit'\]\)/)
@@ -2206,9 +2170,8 @@ test('发货页面只允许 DRAFT 变更、展示只读余量并复用确认幂
/^function handleAdd\(\)\s*\{\s*if \(!canAddShipment\.value \|\| operationPending\.value \|\| optionLoading\.value \|\| detailLoading\.value \|\| open\.value\) return/
)
assert.match(source, /scope\.row\.status === ['"]DRAFT['"][\s\S]*?handleUpdate\(scope\.row\)/)
assert.match(source, /scope\.row\.status === ['"]DRAFT['"][\s\S]*?handleDelete\(scope\.row\)/)
assert.match(source, /scope\.row\.status === ['"]DRAFT['"][\s\S]*?handleConfirm\(scope\.row\)/)
for (const functionName of ['handleUpdate', 'handleDelete', 'handleConfirm']) {
for (const functionName of ['handleUpdate', 'handleConfirm']) {
assert.match(extractNamedFunction(source, functionName), /status !== ['"]DRAFT['"]/)
}
@@ -2250,11 +2213,6 @@ test('发货页面只允许 DRAFT 变更、展示只读余量并复用确认幂
)
assert.match(submitSource, /if \(!valid\) \{\s*submitLoading\.value = false\s*return/)
assert.match(submitSource, /\.finally\(\(\) => \{\s*submitLoading\.value = false/)
const deleteSource = extractNamedFunction(source, 'handleDelete')
assert.ok(
deleteSource.indexOf('deleteLoading.value = true') < deleteSource.indexOf('proxy.$modal.confirm('),
'发货删除必须在打开二次确认框前加锁'
)
assert.deepEqual(extractSecondCallObjectKeys(source, 'scanShipmentPallet'), ['sourceWarehouseId', 'targetSiteId'])
assert.match(source, /label="[^"]*只读[^"]*"[^>]*prop="remainingPackages"|prop="remainingPackages"[\s\S]*?不可修改/)
@@ -2534,6 +2492,7 @@ test('测试批次管理与旧数据纳入遵守 root、权限和预览提交契
assert.match(source, /useUserStore\(\)/, `${rootType} 必须读取 admin 可见性`)
assert.match(source, /useTestBatchStore\(\)/, `${rootType} 必须读取测试模式`)
assert.match(source, /userStore\.admin === true\s*&&\s*!testBatchStore\.isTestMode/, `${rootType} 纳入入口必须只在管理员正式模式显示`)
assert.match(source, /v-hasPermi="\['system:testbatch:adopt'\]"/, `${rootType} 纳入入口必须校验批次纳入权限`)
assert.match(source, new RegExp(`<test-batch-adoption-dialog\\b[\\s\\S]*?:root-type="['\"]${rootType}['\"][\\s\\S]*?:resource-ids="selectedIds"`))
assert.match(source, new RegExp(`selectedIds\\.value\\s*=\\s*selection\\.map\\(\\(item\\)\\s*=>\\s*item\\.${contract.id}\\)`), `${rootType} 必须传递正整数根 ID`)
}
@@ -52,14 +52,6 @@ export function updateInbound(data) {
})
}
// 删除首次入库草稿
export function delInbound(inboundIds) {
return request({
url: '/business/inbound/' + inboundIds,
method: 'delete'
})
}
// 确认首次入库单
export function confirmInbound(inboundId, data) {
return request({
@@ -60,14 +60,6 @@ export function updateShipment(data) {
})
}
// 删除整托发货草稿
export function delShipment(shipmentIds) {
return request({
url: '/business/shipment/' + shipmentIds,
method: 'delete'
})
}
// 确认整托发货单
export function confirmShipment(shipmentId, data) {
return request({
@@ -34,11 +34,3 @@ export function updateCustomer(data) {
data: data
})
}
// 删除客户
export function delCustomer(customerIds) {
return request({
url: '/master/customer/' + customerIds,
method: 'delete'
})
}
@@ -34,11 +34,3 @@ export function updateLine(data) {
data: data
})
}
// 删除生产线
export function delLine(lineIds) {
return request({
url: '/master/line/' + lineIds,
method: 'delete'
})
}
@@ -43,11 +43,3 @@ export function updatePallet(data) {
data: data
})
}
// 删除托盘
export function delPallet(palletIds) {
return request({
url: '/master/pallet/' + palletIds,
method: 'delete'
})
}
@@ -35,14 +35,6 @@ export function updateSite(data) {
})
}
// 删除客户现场
export function delSite(siteIds) {
return request({
url: '/master/site/' + siteIds,
method: 'delete'
})
}
// 查询客户现场可分配用户
export function getSiteUsers(siteId) {
return request({
@@ -34,11 +34,3 @@ export function updateStrain(data) {
data: data
})
}
// 删除菌种
export function delStrain(strainIds) {
return request({
url: '/master/strain/' + strainIds,
method: 'delete'
})
}
@@ -35,14 +35,6 @@ export function updateWarehouse(data) {
})
}
// 删除仓库
export function delWarehouse(warehouseIds) {
return request({
url: '/master/warehouse/' + warehouseIds,
method: 'delete'
})
}
// 查询仓库可分配用户
export function getWarehouseUsers(warehouseId) {
return request({
@@ -32,7 +32,7 @@
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog">纳入测试批次</el-button></div>
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></div>
<el-table v-loading="loading" empty-text="暂无数据" :data="fillingList" class="data-table" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="装填单号" prop="fillingNo" min-width="170" :show-overflow-tooltip="true" />
@@ -41,7 +41,7 @@
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog">纳入测试批次</el-button></div>
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></div>
<el-table v-loading="loading" empty-text="暂无数据" :data="inboundList" class="data-table" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="入库单号" prop="inboundNo" min-width="170" :show-overflow-tooltip="true" />
@@ -72,15 +72,6 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['business:inbound:edit']"
>编辑</el-button>
<el-button
v-if="scope.row.status === 'DRAFT'"
link
type="danger"
icon="Delete"
:disabled="operationPending"
@click="handleDelete(scope.row)"
v-hasPermi="['business:inbound:remove']"
>删除</el-button>
<el-button
v-if="scope.row.status === 'DRAFT'"
link
@@ -208,7 +199,6 @@ import useTestBatchStore from '@/store/modules/testBatch'
import {
addInbound,
confirmInbound,
delInbound,
getInbound,
getInboundWarehouseOptions,
listInbound,
@@ -229,7 +219,6 @@ const optionLoading = ref(false)
const detailLoading = ref(false)
const scanLoading = ref(false)
const submitLoading = ref(false)
const deleteLoading = ref(false)
const confirmLoading = ref(false)
const loadError = ref('')
const optionError = ref('')
@@ -242,7 +231,7 @@ const editDetailReady = ref(false)
const isEdit = computed(() => Boolean(form.value.inboundId))
const canAddInbound = computed(() => proxy.$auth.hasPermiAnd(['business:inbound:query', 'business:inbound:add']))
const canEditInbound = computed(() => proxy.$auth.hasPermiAnd(['business:inbound:query', 'business:inbound:edit']))
const operationPending = computed(() => submitLoading.value || deleteLoading.value || confirmLoading.value)
const operationPending = computed(() => submitLoading.value || confirmLoading.value)
let listGeneration = 0
let optionGeneration = 0
let detailGeneration = 0
@@ -545,27 +534,6 @@ function saveInboundUpdate() {
submitInboundForm(true)
}
function handleDelete(row) {
if (row.status !== 'DRAFT') {
proxy.$modal.msgWarning('只有草稿入库单可以删除')
return
}
if (operationPending.value) return
deleteLoading.value = true
proxy.$modal.confirm(`是否确认删除入库单“${row.inboundNo || `#${row.inboundId}`}”?`).then(() => {
return delInbound(String(row.inboundId))
}).then((response) => {
proxy.$modal.msgSuccess(response.msg || '删除成功')
getList()
}).catch((error) => {
if (error !== 'cancel' && error !== 'close') {
loadError.value = '入库单删除失败,请稍后重试'
}
}).finally(() => {
deleteLoading.value = false
})
}
function clearConfirmIdempotency() {
confirmIdempotency.inboundId = undefined
confirmIdempotency.key = ''
@@ -173,7 +173,7 @@
</el-form>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog">纳入测试批次</el-button></div>
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></div>
<el-table v-loading="loading" empty-text="暂无数据" :data="returnList" class="data-table" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="退回单号" prop="returnNo" min-width="170" :show-overflow-tooltip="true" />
@@ -38,7 +38,7 @@
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog">纳入测试批次</el-button></div>
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></div>
<el-table v-loading="loading" empty-text="暂无数据" :data="shipmentList" class="data-table" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="发货单号" prop="shipmentNo" min-width="170" :show-overflow-tooltip="true" />
@@ -69,15 +69,6 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['business:shipment:edit']"
>编辑</el-button>
<el-button
v-if="scope.row.status === 'DRAFT'"
link
type="danger"
icon="Delete"
:disabled="operationPending"
@click="handleDelete(scope.row)"
v-hasPermi="['business:shipment:remove']"
>删除</el-button>
<el-button
v-if="scope.row.status === 'DRAFT'"
link
@@ -219,7 +210,6 @@ import useTestBatchStore from '@/store/modules/testBatch'
import {
addShipment,
confirmShipment,
delShipment,
getShipment,
getShipmentSiteOptions,
getShipmentWarehouseOptions,
@@ -242,7 +232,6 @@ const optionLoading = ref(false)
const detailLoading = ref(false)
const scanLoading = ref(false)
const submitLoading = ref(false)
const deleteLoading = ref(false)
const confirmLoading = ref(false)
const loadError = ref('')
const optionError = ref('')
@@ -255,7 +244,7 @@ const editDetailReady = ref(false)
const isEdit = computed(() => Boolean(form.value.shipmentId))
const canAddShipment = computed(() => proxy.$auth.hasPermiAnd(['business:shipment:query', 'business:shipment:add']))
const canEditShipment = computed(() => proxy.$auth.hasPermiAnd(['business:shipment:query', 'business:shipment:edit']))
const operationPending = computed(() => submitLoading.value || deleteLoading.value || confirmLoading.value)
const operationPending = computed(() => submitLoading.value || confirmLoading.value)
let listGeneration = 0
let optionGeneration = 0
let detailGeneration = 0
@@ -577,25 +566,6 @@ function saveShipmentUpdate() {
submitShipmentForm(true)
}
function handleDelete(row) {
if (row.status !== 'DRAFT') {
proxy.$modal.msgWarning('只有草稿发货单可以删除')
return
}
if (operationPending.value) return
deleteLoading.value = true
proxy.$modal.confirm(`是否确认删除发货单“${row.shipmentNo || `#${row.shipmentId}`}”?`).then(() => {
return delShipment(String(row.shipmentId))
}).then((response) => {
proxy.$modal.msgSuccess(response.msg || '删除成功')
getList()
}).catch((error) => {
if (error !== 'cancel' && error !== 'close') loadError.value = '发货单删除失败,请稍后重试'
}).finally(() => {
deleteLoading.value = false
})
}
function clearConfirmIdempotency() {
confirmIdempotency.shipmentId = undefined
confirmIdempotency.key = ''
@@ -112,7 +112,7 @@
</el-form>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog">纳入测试批次</el-button></div>
<div v-if="userStore.admin === true && !testBatchStore.isTestMode" class="mb8"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length || operationPending" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></div>
<el-table v-loading="loading" empty-text="暂无数据" :data="usageList" class="data-table" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="使用记录号" prop="usageNo" min-width="170" :show-overflow-tooltip="true" />
@@ -27,10 +27,9 @@
@click="handleUpdate()" v-hasPermi="['master:customer:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5"><el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['master:customer:remove']">删除</el-button></el-col>
</el-row>
<el-row v-if="userStore.admin === true && !testBatchStore.isTestMode" :gutter="10" class="mb8 master-toolbar">
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog">纳入测试批次</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></el-col>
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
@@ -51,10 +50,6 @@
v-if="proxy.$auth.hasPermiAnd(['master:customer:query', 'master:customer:edit'])"
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:customer:edit']"
>修改</el-button>
<el-button
v-if="scope.row.canRemove === true"
link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['master:customer:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -117,7 +112,7 @@
</style>
<script setup name="Customer">
import { addCustomer, delCustomer, getCustomer, listCustomer, updateCustomer } from "@/api/master/customer";
import { addCustomer, getCustomer, listCustomer, updateCustomer } from "@/api/master/customer";
import TestBatchAdoptionDialog from '@/components/TestBatchAdoptionDialog'
import useUserStore from '@/store/modules/user'
import useTestBatchStore from '@/store/modules/testBatch'
@@ -130,7 +125,6 @@ const adoptionDialogRef = ref()
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const customerList = ref([]);
const selectedIds = ref([]);
const removableIds = ref([]);
const loading = ref(false);
const detailLoading = ref(false);
const submitLoading = ref(false);
@@ -138,7 +132,6 @@ const loadError = ref("");
const formError = ref("");
const open = ref(false);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
let listGeneration = 0;
@@ -223,11 +216,7 @@ function handleQuery() { queryParams.value.pageNum = 1; getList(); }
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
function handleSelectionChange(selection) {
selectedIds.value = selection.map((item) => item.customerId);
removableIds.value = selection
.filter((item) => item.canRemove === true)
.map((item) => item.customerId);
single.value = selectedIds.value.length !== 1;
multiple.value = removableIds.value.length === 0;
}
function openAdoptionDialog() { adoptionDialogRef.value?.open() }
@@ -309,15 +298,5 @@ function submitUpdate() {
}).finally(() => { submitLoading.value = false; });
});
}
function handleDelete(row) {
const targetIds = row?.customerId ? (row.canRemove === true ? [row.customerId] : []) : removableIds.value;
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的客户"); return; }
proxy.$modal.confirm(`是否确认删除客户编号为“${targetIds.join(",")}”的数据项?`).then(() =>
delCustomer(targetIds.join(","))
).then(() => { proxy.$modal.msgSuccess("删除成功"); getList(); }).catch((error) => {
if (error !== "cancel" && error !== "close") loadError.value = "客户删除失败,请稍后重试";
});
}
getList();
</script>
@@ -30,10 +30,9 @@
@click="handleUpdate()" v-hasPermi="['master:line:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5"><el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['master:line:remove']">删除</el-button></el-col>
</el-row>
<el-row v-if="userStore.admin === true && !testBatchStore.isTestMode" :gutter="10" class="mb8 master-toolbar">
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog">纳入测试批次</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></el-col>
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
@@ -55,10 +54,6 @@
v-if="proxy.$auth.hasPermiAnd(['master:line:query', 'master:line:edit'])"
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:line:edit']"
>修改</el-button>
<el-button
v-if="scope.row.canRemove === true"
link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['master:line:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -119,7 +114,7 @@
</style>
<script setup name="Line">
import { addLine, delLine, getLine, listLine, updateLine } from "@/api/master/line";
import { addLine, getLine, listLine, updateLine } from "@/api/master/line";
import TestBatchAdoptionDialog from '@/components/TestBatchAdoptionDialog'
import useUserStore from '@/store/modules/user'
import useTestBatchStore from '@/store/modules/testBatch'
@@ -132,7 +127,6 @@ const adoptionDialogRef = ref()
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const lineList = ref([]);
const selectedIds = ref([]);
const removableIds = ref([]);
const loading = ref(false);
const detailLoading = ref(false);
const submitLoading = ref(false);
@@ -140,7 +134,6 @@ const loadError = ref("");
const formError = ref("");
const open = ref(false);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
let listGeneration = 0;
@@ -232,11 +225,7 @@ function handleQuery() { queryParams.value.pageNum = 1; getList(); }
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
function handleSelectionChange(selection) {
selectedIds.value = selection.map((item) => item.lineId);
removableIds.value = selection
.filter((item) => item.canRemove === true)
.map((item) => item.lineId);
single.value = selectedIds.value.length !== 1;
multiple.value = removableIds.value.length === 0;
}
function openAdoptionDialog() { adoptionDialogRef.value?.open() }
@@ -319,15 +308,5 @@ function submitUpdate() {
}).finally(() => { submitLoading.value = false; });
});
}
function handleDelete(row) {
const targetIds = row?.lineId ? (row.canRemove === true ? [row.lineId] : []) : removableIds.value;
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的生产线"); return; }
proxy.$modal.confirm(`是否确认删除产线编号为“${targetIds.join(",")}”的数据项?`).then(() =>
delLine(targetIds.join(","))
).then(() => { proxy.$modal.msgSuccess("删除成功"); getList(); }).catch((error) => {
if (error !== "cancel" && error !== "close") loadError.value = "生产线删除失败,请稍后重试";
});
}
getList();
</script>
@@ -24,10 +24,9 @@
@click="handleUpdate()" v-hasPermi="['master:pallet:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5"><el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['master:pallet:remove']">删除</el-button></el-col>
</el-row>
<el-row v-if="userStore.admin === true && !testBatchStore.isTestMode" :gutter="10" class="mb8 master-toolbar">
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog">纳入测试批次</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></el-col>
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
@@ -52,10 +51,6 @@
v-if="proxy.$auth.hasPermiAnd(['master:pallet:query', 'master:pallet:edit'])"
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:pallet:edit']"
>修改</el-button>
<el-button
v-if="scope.row.canRemove === true"
link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['master:pallet:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -119,7 +114,7 @@
</style>
<script setup name="Pallet">
import { addPallet, delPallet, getPallet, getPalletQrcode, listPallet, updatePallet } from "@/api/master/pallet";
import { addPallet, getPallet, getPalletQrcode, listPallet, updatePallet } from "@/api/master/pallet";
import TestBatchAdoptionDialog from '@/components/TestBatchAdoptionDialog'
import useUserStore from '@/store/modules/user'
import useTestBatchStore from '@/store/modules/testBatch'
@@ -132,7 +127,6 @@ const adoptionDialogRef = ref()
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const palletList = ref([]);
const selectedIds = ref([]);
const removableIds = ref([]);
const loading = ref(false);
const detailLoading = ref(false);
const submitLoading = ref(false);
@@ -140,7 +134,6 @@ const loadError = ref("");
const formError = ref("");
const open = ref(false);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const printingIds = ref([]);
@@ -232,11 +225,7 @@ function handleQuery() { queryParams.value.pageNum = 1; getList(); }
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
function handleSelectionChange(selection) {
selectedIds.value = selection.map((item) => item.palletId);
removableIds.value = selection
.filter((item) => item.canRemove === true)
.map((item) => item.palletId);
single.value = selectedIds.value.length !== 1;
multiple.value = removableIds.value.length === 0;
}
function openAdoptionDialog() { adoptionDialogRef.value?.open() }
@@ -315,16 +304,6 @@ function submitUpdate() {
}).finally(() => { submitLoading.value = false; });
});
}
function handleDelete(row) {
const targetIds = row?.palletId ? (row.canRemove === true ? [row.palletId] : []) : removableIds.value;
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的托盘"); return; }
proxy.$modal.confirm(`是否确认删除托盘编号为“${targetIds.join(",")}”的数据项?`).then(() =>
delPallet(targetIds.join(","))
).then(() => { proxy.$modal.msgSuccess("删除成功"); getList(); }).catch((error) => {
if (error !== "cancel" && error !== "close") loadError.value = "托盘删除失败,请稍后重试";
});
}
function isPrinting(palletId) {
return printingIds.value.includes(palletId);
}
@@ -30,11 +30,10 @@
@click="handleUpdate()" v-hasPermi="['master:site:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5"><el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['master:site:remove']">删除</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="User" :disabled="single" @click="handleAssign()" v-hasPermi="['master:site:assign']">分配用户</el-button></el-col>
</el-row>
<el-row v-if="userStore.admin === true && !testBatchStore.isTestMode" :gutter="10" class="mb8 master-toolbar">
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog">纳入测试批次</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></el-col>
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
@@ -58,10 +57,6 @@
v-if="proxy.$auth.hasPermiAnd(['master:site:query', 'master:site:edit'])"
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:site:edit']"
>修改</el-button>
<el-button
v-if="scope.row.canRemove === true"
link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['master:site:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -128,7 +123,7 @@
<script setup name="Site">
import BusinessUserAssignDialog from "@/components/BusinessUserAssignDialog";
import { addSite, delSite, getSite, listSite, updateSite } from "@/api/master/site";
import { addSite, getSite, listSite, updateSite } from "@/api/master/site";
import TestBatchAdoptionDialog from '@/components/TestBatchAdoptionDialog'
import useUserStore from '@/store/modules/user'
import useTestBatchStore from '@/store/modules/testBatch'
@@ -141,7 +136,6 @@ const adoptionDialogRef = ref()
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const siteList = ref([]);
const selectedIds = ref([]);
const removableIds = ref([]);
const selectedRows = ref([]);
const assignDialogRef = ref();
const loading = ref(false);
@@ -151,7 +145,6 @@ const loadError = ref("");
const formError = ref("");
const open = ref(false);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
let listGeneration = 0;
@@ -244,11 +237,7 @@ function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
function handleSelectionChange(selection) {
selectedRows.value = selection;
selectedIds.value = selection.map((item) => item.siteId);
removableIds.value = selection
.filter((item) => item.canRemove === true)
.map((item) => item.siteId);
single.value = selectedIds.value.length !== 1;
multiple.value = removableIds.value.length === 0;
}
function openAdoptionDialog() { adoptionDialogRef.value?.open() }
@@ -343,15 +332,5 @@ function submitUpdate() {
}).finally(() => { submitLoading.value = false; });
});
}
function handleDelete(row) {
const targetIds = row?.siteId ? (row.canRemove === true ? [row.siteId] : []) : removableIds.value;
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的客户现场"); return; }
proxy.$modal.confirm(`是否确认删除现场编号为“${targetIds.join(",")}”的数据项?`).then(() =>
delSite(targetIds.join(","))
).then(() => { proxy.$modal.msgSuccess("删除成功"); getList(); }).catch((error) => {
if (error !== "cancel" && error !== "close") loadError.value = "客户现场删除失败,请稍后重试";
});
}
getList();
</script>
@@ -34,12 +34,9 @@
v-hasPermi="['master:strain:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['master:strain:remove']">删除</el-button>
</el-col>
</el-row>
<el-row v-if="userStore.admin === true && !testBatchStore.isTestMode" :gutter="10" class="mb8 master-toolbar">
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog">纳入测试批次</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></el-col>
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
@@ -68,14 +65,6 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['master:strain:edit']"
>修改</el-button>
<el-button
v-if="scope.row.canRemove === true"
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['master:strain:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -136,7 +125,7 @@
</style>
<script setup name="Strain">
import { addStrain, delStrain, getStrain, listStrain, updateStrain } from "@/api/master/strain";
import { addStrain, getStrain, listStrain, updateStrain } from "@/api/master/strain";
import TestBatchAdoptionDialog from '@/components/TestBatchAdoptionDialog'
import useUserStore from '@/store/modules/user'
import useTestBatchStore from '@/store/modules/testBatch'
@@ -150,7 +139,6 @@ const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const strainList = ref([]);
const selectedIds = ref([]);
const removableIds = ref([]);
const loading = ref(false);
const detailLoading = ref(false);
const submitLoading = ref(false);
@@ -158,7 +146,6 @@ const loadError = ref("");
const formError = ref("");
const open = ref(false);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
let listGeneration = 0;
@@ -256,11 +243,7 @@ function resetQuery() {
function handleSelectionChange(selection) {
selectedIds.value = selection.map((item) => item.strainId);
removableIds.value = selection
.filter((item) => item.canRemove === true)
.map((item) => item.strainId);
single.value = selectedIds.value.length !== 1;
multiple.value = removableIds.value.length === 0;
}
function openAdoptionDialog() { adoptionDialogRef.value?.open() }
@@ -350,21 +333,5 @@ function submitUpdate() {
});
}
function handleDelete(row) {
const targetIds = row?.strainId ? (row.canRemove === true ? [row.strainId] : []) : removableIds.value;
if (!targetIds.length) {
proxy.$modal.msgWarning("请选择允许删除的菌种");
return;
}
proxy.$modal.confirm(`是否确认删除菌种编号为“${targetIds.join(",")}”的数据项?`).then(() =>
delStrain(targetIds.join(","))
).then(() => {
proxy.$modal.msgSuccess("删除成功");
getList();
}).catch((error) => {
if (error !== "cancel" && error !== "close") loadError.value = "菌种删除失败,请稍后重试";
});
}
getList();
</script>
@@ -27,11 +27,10 @@
@click="handleUpdate()" v-hasPermi="['master:warehouse:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5"><el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['master:warehouse:remove']">删除</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="User" :disabled="single" @click="handleAssign()" v-hasPermi="['master:warehouse:assign']">分配用户</el-button></el-col>
</el-row>
<el-row v-if="userStore.admin === true && !testBatchStore.isTestMode" :gutter="10" class="mb8 master-toolbar">
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog">纳入测试批次</el-button></el-col>
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></el-col>
</el-row>
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
@@ -54,10 +53,6 @@
v-if="proxy.$auth.hasPermiAnd(['master:warehouse:query', 'master:warehouse:edit'])"
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:warehouse:edit']"
>修改</el-button>
<el-button
v-if="scope.row.canRemove === true"
link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['master:warehouse:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -121,7 +116,7 @@
<script setup name="Warehouse">
import BusinessUserAssignDialog from "@/components/BusinessUserAssignDialog";
import { addWarehouse, delWarehouse, getWarehouse, listWarehouse, updateWarehouse } from "@/api/master/warehouse";
import { addWarehouse, getWarehouse, listWarehouse, updateWarehouse } from "@/api/master/warehouse";
import TestBatchAdoptionDialog from '@/components/TestBatchAdoptionDialog'
import useUserStore from '@/store/modules/user'
import useTestBatchStore from '@/store/modules/testBatch'
@@ -134,7 +129,6 @@ const adoptionDialogRef = ref()
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const warehouseList = ref([]);
const selectedIds = ref([]);
const removableIds = ref([]);
const selectedRows = ref([]);
const assignDialogRef = ref();
const loading = ref(false);
@@ -144,7 +138,6 @@ const loadError = ref("");
const formError = ref("");
const open = ref(false);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
let listGeneration = 0;
@@ -229,11 +222,7 @@ function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
function handleSelectionChange(selection) {
selectedRows.value = selection;
selectedIds.value = selection.map((item) => item.warehouseId);
removableIds.value = selection
.filter((item) => item.canRemove === true)
.map((item) => item.warehouseId);
single.value = selectedIds.value.length !== 1;
multiple.value = removableIds.value.length === 0;
}
function openAdoptionDialog() { adoptionDialogRef.value?.open() }
@@ -325,15 +314,5 @@ function submitUpdate() {
}).finally(() => { submitLoading.value = false; });
});
}
function handleDelete(row) {
const targetIds = row?.warehouseId ? (row.canRemove === true ? [row.warehouseId] : []) : removableIds.value;
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的仓库"); return; }
proxy.$modal.confirm(`是否确认删除仓库编号为“${targetIds.join(",")}”的数据项?`).then(() =>
delWarehouse(targetIds.join(","))
).then(() => { proxy.$modal.msgSuccess("删除成功"); getList(); }).catch((error) => {
if (error !== "cancel" && error !== "close") loadError.value = "仓库删除失败,请稍后重试";
});
}
getList();
</script>