✨ feat(mes): 更新物料/产品标识和补齐选项的显示方式
重构了多个组件中的物料/产品标识显示逻辑,使用 dict-tag 组件替代了原有的 getItemOrProductLabel 方法。更新了补齐选项的 radio group,支持动态生成选项。此变更提升了代码的可维护性和可扩展性。pull/871/MERGE
parent
b508aa7c66
commit
d16a92587d
|
|
@ -37,10 +37,14 @@
|
|||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="是否补齐" prop="padded">
|
||||
<!-- DONE @AI:改成 radio group -->
|
||||
<el-radio-group v-model="formData.padded">
|
||||
<el-radio :value="true">是</el-radio>
|
||||
<el-radio :value="false">否</el-radio>
|
||||
<el-radio
|
||||
v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
|
||||
:key="dict.value + ''"
|
||||
:value="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -96,7 +100,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { getBoolDictOptions, getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { AutoCodeRuleApi, AutoCodeRuleVO } from '@/api/mes/md/autocode/rule'
|
||||
import AutoCodePartList from './AutoCodePartList.vue'
|
||||
import { CommonStatusEnum } from '@/utils/constants'
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<el-table-column label="单位" align="center" prop="unitMeasureName" width="80" />
|
||||
<el-table-column label="物料/产品" align="center" prop="itemOrProduct" width="100">
|
||||
<template #default="scope">
|
||||
{{ getItemOrProductLabel(scope.row.itemOrProduct) }}
|
||||
<dict-tag :type="DICT_TYPE.MES_MD_ITEM_OR_PRODUCT" :value="scope.row.itemOrProduct" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用量比例" align="center" prop="quantity" width="100" />
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
<script setup lang="ts">
|
||||
import { MdProductBomApi, MdProductBomVO } from '@/api/mes/md/item/productBom'
|
||||
import { MdItemVO } from '@/api/mes/md/item'
|
||||
import { getItemOrProductLabel } from '@/views/mes/utils/constants'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import MdItemSelectDialog from '@/views/mes/md/item/components/MdItemSelectDialog.vue'
|
||||
|
||||
defineOptions({ name: 'MdProductBomForm' })
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
<el-table-column label="物料分类" align="center" prop="itemTypeName" />
|
||||
<el-table-column label="物料/产品" align="center" prop="itemOrProduct">
|
||||
<template #default="scope">
|
||||
{{ getItemOrProductLabel(scope.row.itemOrProduct) }}
|
||||
<dict-tag :type="DICT_TYPE.MES_MD_ITEM_OR_PRODUCT" :value="scope.row.itemOrProduct" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="安全库存" align="center" prop="safeStockFlag">
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" width="160">
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
|
|
@ -146,15 +146,7 @@
|
|||
>
|
||||
删除
|
||||
</el-button>
|
||||
<!-- TODO @芋艿:【HiPrint】标签打印 -->
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="handleBarcode(scope.row)"
|
||||
v-hasPermi="['mes:md-item:query']"
|
||||
>
|
||||
条码
|
||||
</el-button>
|
||||
<PrinterLabel :bizId="scope.row.id" :bizCode="scope.row.code" bizType="ITEM" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -187,8 +179,8 @@ import { MdItemApi, MdItemVO } from '@/api/mes/md/item'
|
|||
import MdItemForm from './MdItemForm.vue'
|
||||
import MdItemImportForm from './MdItemImportForm.vue'
|
||||
import MdItemTypeTree from './type/components/MdItemTypeTree.vue'
|
||||
import { getItemOrProductLabel, BarcodeBizTypeEnum } from '@/views/mes/utils/constants'
|
||||
import { BarcodeDetail } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
import { BarcodeDetail, PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
defineOptions({ name: 'MesMdItem' })
|
||||
|
||||
|
|
@ -282,12 +274,6 @@ const handleImport = () => {
|
|||
importFormRef.value.open()
|
||||
}
|
||||
|
||||
/** 查看物料条码 */
|
||||
const barcodeDetailRef = ref()
|
||||
const handleBarcode = async (row: MdItemVO) => {
|
||||
await barcodeDetailRef.value.openByBusiness(row.id, BarcodeBizTypeEnum.ITEM, row.code, row.name)
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,13 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="物料/产品标识" prop="itemOrProduct">
|
||||
<el-radio-group v-model="formData.itemOrProduct">
|
||||
<el-radio :value="MesItemOrProductEnum.ITEM.value">物料</el-radio>
|
||||
<el-radio :value="MesItemOrProductEnum.PRODUCT.value">产品</el-radio>
|
||||
<el-radio
|
||||
v-for="dict in getStrDictOptions(DICT_TYPE.MES_MD_ITEM_OR_PRODUCT)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示排序" prop="sort">
|
||||
|
|
@ -60,7 +65,7 @@
|
|||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { MdItemTypeApi, MdItemTypeVO } from '@/api/mes/md/item/type'
|
||||
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
<el-table-column label="分类编码" align="center" prop="code" />
|
||||
<el-table-column label="物料/产品" align="center" prop="itemOrProduct">
|
||||
<template #default="scope">
|
||||
{{ getItemOrProductLabel(scope.row.itemOrProduct) }}
|
||||
<dict-tag :type="DICT_TYPE.MES_MD_ITEM_OR_PRODUCT" :value="scope.row.itemOrProduct" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" align="center" prop="sort" />
|
||||
|
|
@ -118,7 +118,6 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { handleTree } from '@/utils/tree'
|
||||
import { MdItemTypeApi, MdItemTypeVO } from '@/api/mes/md/item/type'
|
||||
import { getItemOrProductLabel } from '@/views/mes/utils/constants'
|
||||
import MdItemTypeForm from './MdItemTypeForm.vue'
|
||||
|
||||
defineOptions({ name: 'MesMdItemType' })
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@
|
|||
>
|
||||
取消
|
||||
</el-button>
|
||||
<PrinterLabel :bizId="scope.row.id" :bizCode="scope.row.code" bizType="PROCARD" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -148,6 +149,7 @@ import CardForm from './CardForm.vue'
|
|||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import ProWorkOrderSelect from '@/views/mes/pro/workorder/components/ProWorkOrderSelect.vue'
|
||||
import { MesProCardStatusEnum } from '@/views/mes/utils/constants'
|
||||
import { PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
defineOptions({ name: 'MesProCard' })
|
||||
|
||||
|
|
|
|||
|
|
@ -492,16 +492,6 @@ export const MesAutoCodeRuleCode = {
|
|||
PRO_CARD_CODE: 'PRO_CARD_CODE' // 流转卡编码
|
||||
} as const
|
||||
|
||||
/** 获取物料/产品标识的标签 */
|
||||
export const getItemOrProductLabel = (value: string): string => {
|
||||
for (const item of Object.values(MesItemOrProductEnum)) {
|
||||
if (item.value === value) {
|
||||
return item.label
|
||||
}
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
/** MES 条码格式枚举 */
|
||||
export enum BarcodeFormatEnum {
|
||||
QR_CODE = 1,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<template>
|
||||
<el-button type="primary" link @click="handlePrint">
|
||||
{{ labelText }}
|
||||
</el-button>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// TODO @芋艿:后续实现。对接 HiPrint 打印插件 + UReport 报表模板,实现标签打印功能
|
||||
|
||||
defineOptions({ name: 'PrinterLabel' })
|
||||
|
||||
defineProps({
|
||||
bizId: { type: Number, default: undefined }, // 业务实体 ID
|
||||
bizCode: { type: String, default: undefined }, // 业务实体编码
|
||||
bizType: { type: String, default: undefined }, // 业务类型(如 ITEM、BATCH、PROCARD 等)
|
||||
labelText: { type: String, default: '标签打印' } // 按钮文字
|
||||
})
|
||||
|
||||
/** 打印 */
|
||||
const handlePrint = () => {
|
||||
ElMessage.warning('标签打印功能暂未实现,敬请期待')
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
export { default as Barcode } from './Barcode.vue'
|
||||
export { default as BarcodeDetail } from './BarcodeDetail.vue'
|
||||
export { default as PrinterLabel } from './PrinterLabel.vue'
|
||||
|
|
|
|||
|
|
@ -45,8 +45,13 @@
|
|||
<el-form-item label="自动生成" prop="autoGenerateFlag">
|
||||
<el-switch v-model="formData.autoGenerateFlag" />
|
||||
</el-form-item>
|
||||
<!-- TODO @芋艿:后续对接 UReport 报表选择器,实现打印模板选择功能 -->
|
||||
<el-form-item label="默认打印模板" prop="defaultTemplate">
|
||||
<el-input v-model="formData.defaultTemplate" placeholder="请输入默认打印模板" />
|
||||
<el-input v-model="formData.defaultTemplate" placeholder="请选择打印模板" readonly class="!w-1/1">
|
||||
<template #append>
|
||||
<el-button @click="handleSelectTemplate">设置</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
|
|
@ -145,6 +150,12 @@ const submitForm = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
/** 选择打印模板 */
|
||||
// TODO @芋艿:后续对接 UReport 报表选择器(reportSelect),实现打印模板选择功能
|
||||
const handleSelectTemplate = () => {
|
||||
ElMessage.warning('打印模板选择功能暂未实现,敬请期待')
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
<el-button v-if="isStock" link type="success" @click="handleStock(scope.row.id)">
|
||||
上架
|
||||
</el-button>
|
||||
<PrinterLabel v-if="isStock" :bizId="scope.row.batchId" :bizCode="scope.row.batchCode" bizType="ITEM_BATCH" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -164,6 +165,7 @@ import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
|||
import WmArrivalNoticeLineSelect from '@/views/mes/wm/arrivalnotice/components/WmArrivalNoticeLineSelect.vue'
|
||||
import ItemReceiptDetailList from './ItemReceiptDetailList.vue'
|
||||
import ItemReceiptDetailForm from './ItemReceiptDetailForm.vue'
|
||||
import { PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
defineOptions({ name: 'ItemReceiptLineList' })
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<el-button v-if="isStock" link type="success" @click="handlePicking(scope.row.id)">
|
||||
上架
|
||||
</el-button>
|
||||
<!-- DONE @芋艿:标签打印;(AI 未修复原因:标注为人工处理,需产品经理确认功能需求) -->
|
||||
<PrinterLabel v-if="isStock" :bizId="scope.row.batchId" :bizCode="scope.row.batchCode" bizType="BATCH" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -171,6 +171,7 @@ import {
|
|||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import OutsourceReceiptDetailList from './OutsourceReceiptDetailList.vue'
|
||||
import OutsourceReceiptDetailForm from './OutsourceReceiptDetailForm.vue'
|
||||
import { PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
defineOptions({ name: 'OutsourceReceiptLineList' })
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
上架
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="handleBarcode(scope.row)"> 条码 </el-button>
|
||||
<PrinterLabel v-if="isStock" :bizId="scope.row.batchId" :bizCode="scope.row.batchCode" bizType="BATCH" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -139,7 +140,7 @@ import WmMaterialStockSelect from '@/views/mes/wm/materialstock/components/WmMat
|
|||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import ProductReceiptDetailList from './ProductReceiptDetailList.vue'
|
||||
import ProductReceiptDetailForm from './ProductReceiptDetailForm.vue'
|
||||
import { BarcodeDetail } from '@/views/mes/wm/barcode/components'
|
||||
import { BarcodeDetail, PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
import { BarcodeBizTypeEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'ProductReceiptLineList' })
|
||||
|
|
|
|||
|
|
@ -123,8 +123,13 @@
|
|||
<el-col :span="8">
|
||||
<el-form-item label="是否校验" prop="oqcCheckFlag">
|
||||
<el-radio-group v-model="formData.oqcCheckFlag">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
<el-radio
|
||||
v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
|
||||
:key="dict.value + ''"
|
||||
:value="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -157,7 +162,7 @@ import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
|||
import WmSalesNoticeLineSelect from '@/views/mes/wm/salesnotice/components/WmSalesNoticeLineSelect.vue'
|
||||
import ProductSalesDetailList from './ProductSalesDetailList.vue'
|
||||
import ProductSalesDetailForm from './ProductSalesDetailForm.vue'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
defineOptions({ name: 'ProductSalesLineList' })
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@
|
|||
上架
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="handleBarcode(scope.row)"> 条码 </el-button>
|
||||
<PrinterLabel v-if="isStock" :bizId="scope.row.batchId" :bizCode="scope.row.batchCode" bizType="BATCH" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -155,7 +156,7 @@ import WmMaterialStockSelect from '@/views/mes/wm/materialstock/components/WmMat
|
|||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import ReturnIssueDetailList from './ReturnIssueDetailList.vue'
|
||||
import ReturnIssueDetailForm from './ReturnIssueDetailForm.vue'
|
||||
import { BarcodeDetail } from '@/views/mes/wm/barcode/components'
|
||||
import { BarcodeDetail, PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
import { BarcodeBizTypeEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'ReturnIssueLineList' })
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<el-button v-if="isStock" link type="success" @click="handleStock(scope.row.id)">
|
||||
上架
|
||||
</el-button>
|
||||
<!-- DONE @芋艿:【待定】标签打印(AI 未修复原因:标注为待定,需人工确认需求) -->
|
||||
<PrinterLabel v-if="isStock" :bizId="scope.row.batchId" :bizCode="scope.row.batchCode" bizType="BATCH" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -145,6 +145,7 @@ import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
|||
import WmBatchSelect from '@/views/mes/wm/batch/components/WmBatchSelect.vue'
|
||||
import ReturnSalesDetailList from './ReturnSalesDetailList.vue'
|
||||
import ReturnSalesDetailForm from './ReturnSalesDetailForm.vue'
|
||||
import { PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
defineOptions({ name: 'ReturnSalesLineList' })
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
<el-button v-if="isStock" link type="success" @click="handlePicking(scope.row.id)">
|
||||
拣货
|
||||
</el-button>
|
||||
<!-- TODO @芋艿:【标签打印】后续在加; -->
|
||||
<PrinterLabel v-if="isStock" :bizId="scope.row.batchId" :bizCode="scope.row.batchCode" bizType="BATCH" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -132,6 +132,7 @@ import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
|||
import WmBatchSelect from '@/views/mes/wm/batch/components/WmBatchSelect.vue'
|
||||
import ReturnVendorDetailList from './ReturnVendorDetailList.vue'
|
||||
import ReturnVendorDetailForm from './ReturnVendorDetailForm.vue'
|
||||
import { PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
defineOptions({ name: 'ReturnVendorLineList' })
|
||||
|
||||
|
|
|
|||
|
|
@ -50,11 +50,10 @@
|
|||
<el-button v-if="isUpdate" link type="danger" @click="handleDelete(scope.row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
<!-- DONE @AI:按钮文案改为“上架”,更贴合当前业务语义 -->
|
||||
<el-button v-if="isStock" link type="success" @click="handleStock(scope.row.id)">
|
||||
上架
|
||||
</el-button>
|
||||
<!-- DONE @芋艿:【标签打印】(AI 未修复原因:标注为人工后续处理) -->
|
||||
<PrinterLabel v-if="isStock" :bizId="scope.row.batchId" :bizCode="scope.row.batchCode" bizType="BATCH" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -153,6 +152,7 @@ import WmMaterialStockSelect from '@/views/mes/wm/materialstock/components/WmMat
|
|||
import { WmMaterialStockApi, WmMaterialStockVO } from '@/api/mes/wm/materialstock'
|
||||
import TransferDetailList from './TransferDetailList.vue'
|
||||
import TransferDetailForm from './TransferDetailForm.vue'
|
||||
import { PrinterLabel } from '@/views/mes/wm/barcode/components'
|
||||
|
||||
defineOptions({ name: 'TransferLineList' })
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue