feat(mes): 重构 IQC 状态管理,使用枚举替代硬编码,简化代码并提升可维护性
parent
99b983f00f
commit
a0ac62e0fa
|
|
@ -64,20 +64,9 @@
|
|||
v-model="formData.itemId"
|
||||
placeholder="请选择产品物料"
|
||||
class="!w-1/1"
|
||||
@change="handleItemChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料名称">
|
||||
<el-input :model-value="itemName" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规格型号">
|
||||
<el-input :model-value="itemSpecification" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider content-position="left">检测情况</el-divider>
|
||||
|
|
@ -278,10 +267,6 @@ const formLoading = ref(false)
|
|||
const formType = ref('')
|
||||
const activeTab = ref('line')
|
||||
|
||||
// 关联数据回显
|
||||
const itemName = ref('')
|
||||
const itemSpecification = ref('')
|
||||
|
||||
// 模板列表
|
||||
const templateList = ref<any[]>([])
|
||||
|
||||
|
|
@ -327,12 +312,6 @@ const formRules = reactive({
|
|||
})
|
||||
const formRef = ref()
|
||||
|
||||
/** 物料变更回调 */
|
||||
const handleItemChange = (item: any) => {
|
||||
itemName.value = item?.name || ''
|
||||
itemSpecification.value = item?.specification || ''
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
|
|
@ -348,9 +327,6 @@ const open = async (type: string, id?: number) => {
|
|||
try {
|
||||
const data = await QcIqcApi.getIqc(id)
|
||||
formData.value = data
|
||||
// 回显关联数据
|
||||
itemName.value = data.itemName || ''
|
||||
itemSpecification.value = data.itemSpecification || ''
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
|
@ -432,9 +408,6 @@ const resetForm = () => {
|
|||
majorQuantity: 0,
|
||||
minorQuantity: 0
|
||||
}
|
||||
// TODO @AI:这些字段是不是不用了?因为 item 是下拉框;
|
||||
itemName.value = ''
|
||||
itemSpecification.value = ''
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@
|
|||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['mes:qc-iqc:update']"
|
||||
v-if="scope.row.status === QC_IQC_STATUS.PREPARE"
|
||||
v-if="scope.row.status === MesQcIqcStatusEnum.PREPARE"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
type="success"
|
||||
@click="handleComplete(scope.row.id)"
|
||||
v-hasPermi="['mes:qc-iqc:update']"
|
||||
v-if="scope.row.status === QC_IQC_STATUS.PREPARE"
|
||||
v-if="scope.row.status === MesQcIqcStatusEnum.PREPARE"
|
||||
>
|
||||
完成
|
||||
</el-button>
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-if="scope.row.status !== QC_IQC_STATUS.PREPARE"
|
||||
v-if="scope.row.status !== MesQcIqcStatusEnum.PREPARE"
|
||||
>
|
||||
查看报表
|
||||
</el-button>
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['mes:qc-iqc:delete']"
|
||||
v-if="scope.row.status === QC_IQC_STATUS.PREPARE"
|
||||
v-if="scope.row.status === MesQcIqcStatusEnum.PREPARE"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
|
|
@ -212,16 +212,10 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|||
import MdVendorSelect from '@/views/mes/md/vendor/components/MdVendorSelect.vue'
|
||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import UserSelect from '@/views/system/user/components/UserSelect.vue'
|
||||
import { MesQcIqcStatusEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'MesQcIqc' })
|
||||
|
||||
/** IQC 状态枚举 */
|
||||
// TODO @AI:放到 constants 里;
|
||||
const QC_IQC_STATUS = {
|
||||
PREPARE: 0,
|
||||
FINISHED: 1
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue