feat(mes): 新增盘点方案编码和任务编码常量,更新错误码提示

新增盘点方案编码和盘点任务编码常量,以支持新的盘点功能。同时,更新相关错误码提示,确保用户在操作时获得准确的信息。
pull/871/MERGE
YunaiV 2026-03-31 18:14:42 +08:00
parent 03bc24d3f7
commit abe63d39db
3 changed files with 50 additions and 35 deletions

View File

@ -441,6 +441,8 @@ export const MesAutoCodeRuleCode = {
WM_PRODUCT_SALES_CODE: 'WM_PRODUCT_SALES_CODE', // 销售出库单编码
WM_MISC_ISSUE_CODE: 'WM_MISC_ISSUE_CODE', // 杂项出库单编码
WM_MISC_RECEIPT_CODE: 'WM_MISC_RECEIPT_CODE', // 杂项入库单编码
WM_STOCK_TAKING_PLAN_CODE: 'WM_STOCK_TAKING_PLAN_CODE', // 盘点方案编码
WM_STOCK_TAKING_CODE: 'WM_STOCK_TAKING_CODE', // 盘点任务编码
TRANSFER_CODE: 'TRANSFER_CODE' // 转移调拨单编码
} as const

View File

@ -86,10 +86,10 @@
</el-row>
</el-form>
<!-- 编辑时展示盘点参数 -->
<template v-if="formType === 'update' && formData.id">
<!-- 编辑或详情时展示盘点参数 -->
<template v-if="(formType === 'update' || formType === 'detail') && formData.id">
<el-divider content-position="center">盘点参数</el-divider>
<StockTakingPlanParamList :plan-id="formData.id" />
<StockTakingPlanParamList :plan-id="formData.id" :disabled="formType === 'detail'" />
</template>
<template #footer>
@ -102,11 +102,11 @@
</template>
<script setup lang="ts">
import { generateRandomStr } from '@/utils'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
import { StockTakingPlanApi, type StockTakingPlanVO } from '@/api/mes/wm/stocktaking/plan/index'
import StockTakingPlanParamList from './StockTakingPlanParamList.vue'
import { MesWmStockTakingTypeEnum } from '@/views/mes/utils/constants'
import { MesAutoCodeRuleCode, MesWmStockTakingTypeEnum } from '@/views/mes/utils/constants'
defineOptions({ name: 'StockTakingPlanForm' })
@ -115,6 +115,9 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() //
const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
const formType = ref('create') // create - update - detail -
const isDetail = computed(() => formType.value === 'detail') //
const dialogTitle = computed(() => {
const titles = {
create: '新增盘点方案',
@ -123,10 +126,6 @@ const dialogTitle = computed(() => {
}
return titles[formType.value] || formType.value
}) //
const formLoading = ref(false) // 12
const formType = ref('create') // create - update - detail -
const isDetail = computed(() => formType.value === 'detail') //
const formRef = ref() // Ref
const formData = ref<StockTakingPlanVO>({
id: undefined,
code: undefined,
@ -143,10 +142,13 @@ const formRules = reactive({
name: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }],
type: [{ required: true, message: '盘点类型不能为空', trigger: 'change' }]
})
const formRef = ref() // Ref
/** 生成方案编码 */
const generateCode = () => {
formData.value.code = 'STP' + generateRandomStr(10)
const generateCode = async () => {
formData.value.code = await AutoCodeRecordApi.generateAutoCode(
MesAutoCodeRuleCode.WM_STOCK_TAKING_PLAN_CODE
)
}
/** 打开弹窗 */

View File

@ -116,24 +116,40 @@
</el-table-column>
<el-table-column label="操作" align="center" width="220" fixed="right">
<template #default="scope">
<el-button
v-if="scope.row.status === CommonStatusEnum.DISABLE"
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['mes:wm-stock-taking-plan:update']"
<el-tooltip
:disabled="scope.row.status === CommonStatusEnum.DISABLE"
content="仅关闭状态,才可以操作"
placement="top"
>
编辑
</el-button>
<el-button
v-if="scope.row.status === CommonStatusEnum.DISABLE"
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['mes:wm-stock-taking-plan:delete']"
<span class="inline-block cursor-not-allowed">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['mes:wm-stock-taking-plan:update']"
:disabled="scope.row.status !== CommonStatusEnum.DISABLE"
>
编辑
</el-button>
</span>
</el-tooltip>
<el-tooltip
:disabled="scope.row.status === CommonStatusEnum.DISABLE"
content="仅关闭状态,才可以操作"
placement="top"
>
删除
</el-button>
<span class="inline-block cursor-not-allowed ml-10px">
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['mes:wm-stock-taking-plan:delete']"
:disabled="scope.row.status !== CommonStatusEnum.DISABLE"
>
删除
</el-button>
</span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
@ -163,8 +179,9 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref<StockTakingPlanVO[]>([]) //
const total = ref(0) //
const exportLoading = ref(false) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
@ -173,6 +190,7 @@ const queryParams = reactive({
type: undefined
})
const queryFormRef = ref() //
const formRef = ref() //
/** 查询列表 */
const getList = async () => {
@ -199,7 +217,6 @@ const resetQuery = () => {
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
@ -222,23 +239,17 @@ const handleStatusChange = async (row: StockTakingPlanVO) => {
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await StockTakingPlanApi.deleteStockTakingPlan(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false)
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await StockTakingPlanApi.exportStockTakingPlan(queryParams)
download.excel(data, '盘点方案.xls')