feat(mes): 更新盘点方案参数及状态管理逻辑

移除不必要的字段,优化参数类型枚举,添加分页请求和响应对象,增强代码可读性和维护性。更新状态管理逻辑,确保盘点方案的启用状态与参数一致性。
pull/871/MERGE
YunaiV 2026-03-09 21:47:24 +08:00
parent 34068a5583
commit ca2447f710
2 changed files with 38 additions and 54 deletions

View File

@ -134,7 +134,6 @@ const formData = ref<StockTakingPlanVO>({
frozenFlag: false, frozenFlag: false,
remark: undefined remark: undefined
}) })
const formRules = reactive({ const formRules = reactive({
code: [{ required: true, message: '方案编码不能为空', trigger: 'blur' }], code: [{ required: true, message: '方案编码不能为空', trigger: 'blur' }],
name: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }],

View File

@ -41,24 +41,24 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" />搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button>
<el-button <el-button
type="primary" type="primary"
plain plain
@click="openForm('create')" @click="openForm('create')"
v-hasPermi="['mes:wm-stocktaking-plan:create']" v-hasPermi="['mes:wm-stock-taking-plan:create']"
> >
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" /> 新增
</el-button> </el-button>
<el-button <el-button
type="success" type="success"
plain plain
@click="handleExport" @click="handleExport"
:loading="exportLoading" :loading="exportLoading"
v-hasPermi="['mes:wm-stocktaking-plan:export']" v-hasPermi="['mes:wm-stock-taking-plan:export']"
> >
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" />导出
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -79,76 +79,61 @@
<dict-tag :type="DICT_TYPE.MES_WM_STOCK_TAKING_TYPE" :value="scope.row.type" /> <dict-tag :type="DICT_TYPE.MES_WM_STOCK_TAKING_TYPE" :value="scope.row.type" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="开始时间" align="center" prop="startTime" min-width="180" /> <el-table-column
<el-table-column label="结束时间" align="center" prop="endTime" min-width="180" /> label="开始时间"
align="center"
prop="startTime"
:formatter="dateFormatter"
width="180"
/>
<el-table-column
label="结束时间"
align="center"
prop="endTime"
:formatter="dateFormatter"
width="180"
/>
<el-table-column label="是否盲盘" align="center" prop="blindFlag" width="100"> <el-table-column label="是否盲盘" align="center" prop="blindFlag" width="100">
<!-- TODO @AI: booleanstring 数据字典 -->
<template #default="scope"> <template #default="scope">
<el-tag :type="scope.row.blindFlag ? 'warning' : 'success'"> <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.blindFlag" />
{{ scope.row.blindFlag ? '是' : '否' }}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否冻结库存" align="center" prop="frozenFlag" width="100"> <el-table-column label="是否冻结库存" align="center" prop="frozenFlag" width="110">
<template #default="scope"> <template #default="scope">
<!-- TODO @AI: booleanstring 数据字典 --> <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.frozenFlag" />
<el-tag :type="scope.row.frozenFlag ? 'warning' : 'info'">
{{ scope.row.frozenFlag ? '是' : '否' }}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<!-- TODO @AIenableFlag status 融合了 --> <el-table-column label="状态" align="center" prop="status" width="120">
<el-table-column label="启用" align="center" prop="enableFlag" width="90">
<template #default="scope"> <template #default="scope">
<el-tag :type="scope.row.enableFlag ? 'success' : 'info'"> <el-switch
{{ scope.row.enableFlag ? '启用' : '停用' }} :model-value="scope.row.status"
</el-tag> :active-value="CommonStatusEnum.ENABLE"
:inactive-value="CommonStatusEnum.DISABLE"
:disabled="loading"
@change="handleStatusChange(scope.row)"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="status" min-width="100"> <el-table-column label="操作" align="center" width="220" fixed="right">
<template #default="scope">
<dict-tag :type="DICT_TYPE.MES_WM_STOCK_TAKING_PLAN_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="340" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="scope.row.status === MesWmStockTakingPlanStatusEnum.PREPARE" v-if="scope.row.status === CommonStatusEnum.DISABLE"
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id)"
v-hasPermi="['mes:wm-stocktaking-plan:update']" v-hasPermi="['mes:wm-stock-taking-plan:update']"
> >
编辑 编辑
</el-button> </el-button>
<!-- TODO @AI去掉确认操作了 -->
<el-button <el-button
v-if="scope.row.status === MesWmStockTakingPlanStatusEnum.PREPARE" v-if="scope.row.status === CommonStatusEnum.DISABLE"
link
type="warning"
@click="handleConfirm(scope.row.id)"
v-hasPermi="['mes:wm-stocktaking-plan:update']"
>
确认
</el-button>
<el-button
v-if="scope.row.status === MesWmStockTakingPlanStatusEnum.PREPARE"
link link
type="danger" type="danger"
@click="handleDelete(scope.row.id)" @click="handleDelete(scope.row.id)"
v-hasPermi="['mes:wm-stocktaking-plan:delete']" v-hasPermi="['mes:wm-stock-taking-plan:delete']"
> >
删除 删除
</el-button> </el-button>
<!-- TODO @AI前后端都去嗲哦这个操作不需要 -->
<el-button
link
type="success"
@click="handleGenerate(scope.row)"
v-hasPermi="['mes:wm-stocktaking-task:create']"
>
生成任务
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -160,13 +145,13 @@
/> />
</ContentWrap> </ContentWrap>
<!-- 添加或修改盘点方案对话框 -->
<StockTakingPlanForm ref="formRef" @success="getList" /> <StockTakingPlanForm ref="formRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ElMessageBox } from 'element-plus'
import { useUserStore } from '@/store/modules/user'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
import { StockTakingPlanApi, type StockTakingPlanVO } from '@/api/mes/wm/stocktaking/plan/index' import { StockTakingPlanApi, type StockTakingPlanVO } from '@/api/mes/wm/stocktaking/plan/index'