✨ feat(mes): 新增盘点方案编码和任务编码常量,更新错误码提示
新增盘点方案编码和盘点任务编码常量,以支持新的盘点功能。同时,更新相关错误码提示,确保用户在操作时获得准确的信息。pull/871/MERGE
parent
03bc24d3f7
commit
abe63d39db
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
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) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
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
|
||||
)
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Reference in New Issue