style:排产弹框适配中英文

pull/1/head
黄伟杰 4 weeks ago
parent 20b54fbd70
commit 99aeeb54fd

@ -3470,7 +3470,55 @@ export default {
validatorPlanFormTaskIdRequired: 'Task order can not be empty',
validatorPlanFormPlanNumberRequired: 'Quantity can not be empty',
validatorPlanFormPlanStartTimeRequired: 'Plan start time can not be empty',
validatorPlanFormPlanEndTimeRequired: 'Plan end time can not be empty'
validatorPlanFormPlanEndTimeRequired: 'Plan end time can not be empty',
scheduleDialogTitle: 'Schedule',
scheduleRuleLabel: 'Schedule Rule',
capacitySourceLabel: 'Capacity Source',
workTimeLabel: 'Work Time',
skipHolidayLabel: 'Skip Holidays',
confirmScheduleButton: 'Confirm Schedule',
scheduleFormCodeLabel: 'Task Order Code',
scheduleFormCodePlaceholder: 'Please input',
scheduleFormOrderDateLabel: 'Order Date',
scheduleFormDeliveryDateLabel: 'Delivery Date',
scheduleFormRemarkLabel: 'Remark',
scheduleFormRemarkPlaceholder: 'Please input',
scheduleFormInventoryTaskLabel: 'Inventory Task',
scheduleFormSearchButton: 'Search',
scheduleFormResetButton: 'Reset',
scheduleYesLabel: 'Yes',
scheduleNoLabel: 'No',
relateDeviceButton: 'Relate Device',
deviceRelationDialogTitle: 'Relate Device',
deviceRelationLabel: 'Related Device',
deviceRelationPlaceholder: 'Click to select device',
deviceRelationSaveButton: 'Save',
deviceRelationCancelButton: 'Cancel',
selectDeviceDialogTitle: 'Select Device',
deviceColumnCode: 'Device Code',
deviceColumnName: 'Device Name',
deviceColumnModel: 'Device Model',
deviceColumnWorkshop: 'Workshop',
scheduleRulePriority: 'Order Priority',
scheduleRuleCategory: 'Product Category Order',
scheduleRuleDelivery: 'Delivery Date Priority',
capacityTypeRated: 'Rated Capacity',
capacityTypeDailyAvg: 'Daily Report Average',
capacityTypeDataCollection: 'Data Collection Capacity',
inventoryTaskType: 'Inventory Task',
taskNoDetailWarning: 'Task order {code} has no detail data, cannot be selected',
partialTaskNoDetailWarning: 'Some task orders have no detail data, selection has been automatically cancelled',
taskItemNeedPrefix: 'Task Order-',
detailNoProductWarning: 'Current detail has no related product, cannot set device',
deviceRelationSaved: 'Device relation saved',
selectScheduleRuleWarning: 'Please select a schedule rule',
selectCapacitySourceWarning: 'Please select a capacity source',
selectWorkTimeWarning: 'Please select work time',
selectDetailWarning: 'Please select at least one task summary detail',
scheduleSubmitted: 'Schedule submitted',
startDatePlaceholder: 'Start Date',
endDatePlaceholder: 'End Date'
},
Plan: {

@ -3314,7 +3314,55 @@ export default {
validatorPlanFormTaskIdRequired: '任务单不能为空',
validatorPlanFormPlanNumberRequired: '数量不能为空',
validatorPlanFormPlanStartTimeRequired: '计划开始时间不能为空',
validatorPlanFormPlanEndTimeRequired: '计划结束时间不能为空'
validatorPlanFormPlanEndTimeRequired: '计划结束时间不能为空',
scheduleDialogTitle: '排产',
scheduleRuleLabel: '排产规则',
capacitySourceLabel: '产能来源',
workTimeLabel: '生产时间安排',
skipHolidayLabel: '是否跳过节假日',
confirmScheduleButton: '确认排产',
scheduleFormCodeLabel: '任务单编码',
scheduleFormCodePlaceholder: '请输入',
scheduleFormOrderDateLabel: '下达日期',
scheduleFormDeliveryDateLabel: '交货日期',
scheduleFormRemarkLabel: '备注',
scheduleFormRemarkPlaceholder: '请输入',
scheduleFormInventoryTaskLabel: '库存任务',
scheduleFormSearchButton: '查询',
scheduleFormResetButton: '重置',
scheduleYesLabel: '是',
scheduleNoLabel: '否',
relateDeviceButton: '关联设备',
deviceRelationDialogTitle: '关联设备',
deviceRelationLabel: '关联设备',
deviceRelationPlaceholder: '点击选择设备',
deviceRelationSaveButton: '保存',
deviceRelationCancelButton: '取消',
selectDeviceDialogTitle: '选择设备',
deviceColumnCode: '设备编号',
deviceColumnName: '设备名称',
deviceColumnModel: '设备型号',
deviceColumnWorkshop: '所属车间',
scheduleRulePriority: '订单优先级',
scheduleRuleCategory: '产品类别顺序',
scheduleRuleDelivery: '订单交期优先',
capacityTypeRated: '额定产能',
capacityTypeDailyAvg: '每日报工平均值',
capacityTypeDataCollection: '数据采集产能',
inventoryTaskType: '库存任务',
taskNoDetailWarning: '任务单 {code} 无任务明细数据,无法勾选',
partialTaskNoDetailWarning: '部分任务单无明细数据,已自动取消勾选',
taskItemNeedPrefix: '任务单-',
detailNoProductWarning: '当前明细没有关联产品,无法设置设备',
deviceRelationSaved: '关联设备已保存',
selectScheduleRuleWarning: '请选择排产规则',
selectCapacitySourceWarning: '请选择产能来源',
selectWorkTimeWarning: '请选择生产时间安排',
selectDetailWarning: '至少选一个任务单汇总明细的数据',
scheduleSubmitted: '排产已提交',
startDatePlaceholder: '开始日期',
endDatePlaceholder: '结束日期'
},
Plan: {
moduleName: '生产计划',

@ -1,23 +1,23 @@
<template>
<Dialog v-model="dialogVisible" title="排产" :initialFullscreen="true" destroy-on-close>
<Dialog v-model="dialogVisible" :title="t('ProductionPlan.TaskSummary.scheduleDialogTitle')" :initialFullscreen="true" destroy-on-close>
<div class="flex items-center gap-20px mb-16px">
<div class="flex items-center gap-8px">
<span class="text-red-500">*</span>
<span>排产规则</span>
<span>{{ t('ProductionPlan.TaskSummary.scheduleRuleLabel') }}</span>
<el-select v-model="searchForm.sortRule" class="!w-220px" clearable>
<el-option v-for="item in scheduleRuleOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<div class="flex items-center gap-8px">
<span class="text-red-500">*</span>
<span>产能来源</span>
<span>{{ t('ProductionPlan.TaskSummary.capacitySourceLabel') }}</span>
<el-select v-model="searchForm.capacityType" class="!w-220px">
<el-option v-for="item in capacityTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<div class="flex items-center gap-8px">
<span class="text-red-500">*</span>
<span>生产时间安排</span>
<span>{{ t('ProductionPlan.TaskSummary.workTimeLabel') }}</span>
<el-time-picker
v-model="searchForm.workTimeRange"
is-range
@ -30,53 +30,53 @@
/>
</div>
<div class="flex items-center gap-8px">
<span>是否跳过节假日</span>
<span>{{ t('ProductionPlan.TaskSummary.skipHolidayLabel') }}</span>
<el-switch v-model="searchForm.skipHoliday" />
</div>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit" class="ml-auto">确认排产</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit" class="ml-auto">{{ t('ProductionPlan.TaskSummary.confirmScheduleButton') }}</el-button>
</div>
<div class="border border-solid border-gray-200 rounded p-16px mt-16px">
<el-form :inline="true" :model="searchForm" label-width="90px" class="-mb-8px">
<el-form-item label="任务单编码">
<el-input v-model="searchForm.code" placeholder="请输入" clearable class="!w-200px" />
<el-form-item :label="t('ProductionPlan.TaskSummary.scheduleFormCodeLabel')">
<el-input v-model="searchForm.code" :placeholder="t('ProductionPlan.TaskSummary.scheduleFormCodePlaceholder')" clearable class="!w-200px" />
</el-form-item>
<el-form-item label="下达日期">
<el-form-item :label="t('ProductionPlan.TaskSummary.scheduleFormOrderDateLabel')">
<el-date-picker
v-model="searchForm.orderDate"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:start-placeholder="t('ProductionPlan.TaskSummary.startDatePlaceholder')"
:end-placeholder="t('ProductionPlan.TaskSummary.endDatePlaceholder')"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-260px"
/>
</el-form-item>
<el-form-item label="交货日期">
<el-form-item :label="t('ProductionPlan.TaskSummary.scheduleFormDeliveryDateLabel')">
<el-date-picker
v-model="searchForm.deliveryDate"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:start-placeholder="t('ProductionPlan.TaskSummary.startDatePlaceholder')"
:end-placeholder="t('ProductionPlan.TaskSummary.endDatePlaceholder')"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-260px"
/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="searchForm.remark" placeholder="请输入" clearable class="!w-220px" />
<el-form-item :label="t('ProductionPlan.TaskSummary.scheduleFormRemarkLabel')">
<el-input v-model="searchForm.remark" :placeholder="t('ProductionPlan.TaskSummary.scheduleFormRemarkPlaceholder')" clearable class="!w-220px" />
</el-form-item>
<el-form-item label="库存任务">
<el-form-item :label="t('ProductionPlan.TaskSummary.scheduleFormInventoryTaskLabel')">
<div class="flex items-center gap-8px">
<el-switch v-model="searchForm.inventoryTaskSchedule" />
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">
<Icon icon="ep:search" class="mr-5px" /> 查询
<Icon icon="ep:search" class="mr-5px" /> {{ t('ProductionPlan.TaskSummary.scheduleFormSearchButton') }}
</el-button>
<el-button @click="handleReset">
<Icon icon="ep:refresh" class="mr-5px" /> 重置
<Icon icon="ep:refresh" class="mr-5px" /> {{ t('ProductionPlan.TaskSummary.scheduleFormResetButton') }}
</el-button>
</el-form-item>
</el-form>
@ -111,7 +111,7 @@
</el-table-column>
<el-table-column :label="t('ProductionPlan.TaskSummary.tableScheduleCompletedColumn')" align="center">
<template #default="scope">
<el-tag :type="scope.row.isScheduled ? 'success' : 'info'">{{ scope.row.isScheduled ? '是' : '否' }}</el-tag>
<el-tag :type="scope.row.isScheduled ? 'success' : 'info'">{{ scope.row.isScheduled ? t('ProductionPlan.TaskSummary.scheduleYesLabel') : t('ProductionPlan.TaskSummary.scheduleNoLabel') }}</el-tag>
</template>
</el-table-column>
<el-table-column :label="t('ProductionPlan.Task.tableIsUrgentColumn')" align="center" prop="isUrgent" sortable>
@ -171,7 +171,7 @@
{{ t('ProductionPlan.TaskSummary.detailActionMaterialLabel') }}
</el-button>
<el-button link type="primary" @click="openDeviceRelationDialog(scope.row)">
关联设备
{{ t('ProductionPlan.TaskSummary.relateDeviceButton') }}
</el-button>
</template>
</el-table-column>
@ -186,26 +186,26 @@
@saved="handlePreviewSaved"
/>
<Dialog v-model="deviceRelationDialogVisible" title="关联设备" width="520px">
<Dialog v-model="deviceRelationDialogVisible" :title="t('ProductionPlan.TaskSummary.deviceRelationDialogTitle')" width="520px">
<el-form :model="deviceRelationForm" label-width="90px" v-loading="deviceRelationLoading">
<el-form-item label="关联设备">
<el-form-item :label="t('ProductionPlan.TaskSummary.deviceRelationLabel')">
<el-input
:model-value="deviceRelationDisplayText"
placeholder="点击选择设备"
:placeholder="t('ProductionPlan.TaskSummary.deviceRelationPlaceholder')"
readonly
@click="openDeviceSelectDialog"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" :loading="deviceRelationSaving" @click="submitDeviceRelation"></el-button>
<el-button @click="deviceRelationDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="deviceRelationSaving" @click="submitDeviceRelation">{{ t('ProductionPlan.TaskSummary.deviceRelationSaveButton') }}</el-button>
<el-button @click="deviceRelationDialogVisible = false">{{ t('ProductionPlan.TaskSummary.deviceRelationCancelButton') }}</el-button>
</template>
</Dialog>
<TableSelectDialog
ref="deviceSelectDialogRef"
title="选择设备"
:title="t('ProductionPlan.TaskSummary.selectDeviceDialogTitle')"
:columns="deviceColumns"
:fetch-api="fetchDeviceLedgerPage"
row-key="id"
@ -253,28 +253,28 @@ const deviceRelationForm = reactive({
devices: [] as { id: number; name: string }[]
})
const deviceColumns = [
{ label: '设备编号', prop: 'deviceCode', minWidth: 140 },
{ label: '设备名称', prop: 'deviceName', minWidth: 160 },
{ label: '设备型号', prop: 'deviceModel', minWidth: 140 },
{ label: '所属车间', prop: 'workshop', minWidth: 140 }
]
const deviceColumns = computed(() => [
{ label: t('ProductionPlan.TaskSummary.deviceColumnCode'), prop: 'deviceCode', minWidth: 140 },
{ label: t('ProductionPlan.TaskSummary.deviceColumnName'), prop: 'deviceName', minWidth: 160 },
{ label: t('ProductionPlan.TaskSummary.deviceColumnModel'), prop: 'deviceModel', minWidth: 140 },
{ label: t('ProductionPlan.TaskSummary.deviceColumnWorkshop'), prop: 'workshop', minWidth: 140 }
])
const deviceRelationDisplayText = computed(() => {
if (!deviceRelationForm.devices.length) return ''
if (!selectedDeviceRows.value.length) return deviceRelationForm.devices.map((item) => item.name).join('、')
return selectedDeviceRows.value.map((item) => item.deviceName || item.name || item.code || `ID:${item.id}`).join('、')
})
const scheduleRuleOptions = [
{ label: '订单优先级', value: 2 },
{ label: '产品类别顺序', value: 3 },
{ label: '订单交期优先', value: 4 }
]
const capacityTypeOptions = [
{ label: '额定产能', value: 1 },
{ label: '每日报工平均值', value: 2 },
{ label: '数据采集产能', value: 3 }
]
const scheduleRuleOptions = computed(() => [
{ label: t('ProductionPlan.TaskSummary.scheduleRulePriority'), value: 2 },
{ label: t('ProductionPlan.TaskSummary.scheduleRuleCategory'), value: 3 },
{ label: t('ProductionPlan.TaskSummary.scheduleRuleDelivery'), value: 4 }
])
const capacityTypeOptions = computed(() => [
{ label: t('ProductionPlan.TaskSummary.capacityTypeRated'), value: 1 },
{ label: t('ProductionPlan.TaskSummary.capacityTypeDailyAvg'), value: 2 },
{ label: t('ProductionPlan.TaskSummary.capacityTypeDataCollection'), value: 3 }
])
const searchForm = reactive({
inventoryTaskSchedule: false,
@ -384,7 +384,7 @@ const loadTaskList = async () => {
orderDate: searchForm.orderDate,
deliveryDate: searchForm.deliveryDate,
remark: searchForm.remark || undefined,
taskType: searchForm.inventoryTaskSchedule ? '库存任务' : undefined
taskType: searchForm.inventoryTaskSchedule ? t('ProductionPlan.TaskSummary.inventoryTaskType') : undefined
}
const data = await TaskApi.getPlanTaskPage(params)
taskList.value = data?.list ?? []
@ -469,7 +469,7 @@ const handleTaskSelect = async (selection: any[], row: any) => {
await handleCurrentTaskChange(row)
const childList = allDetailsMap.value[row.id] || []
if (childList.length === 0) {
message.warning(`任务单 ${row.code} 无任务明细数据,无法勾选`)
message.warning(t('ProductionPlan.TaskSummary.taskNoDetailWarning', { code: row.code }))
taskTableRef.value?.toggleRowSelection(row, false)
return
}
@ -515,7 +515,7 @@ const handleTaskSelectAll = async (selection: any[]) => {
}
}
if (hasEmptyChild) {
message.warning('部分任务单无明细数据,已自动取消勾选')
message.warning(t('ProductionPlan.TaskSummary.partialTaskNoDetailWarning'))
}
} else {
detailTableRef.value?.clearSelection()
@ -586,7 +586,7 @@ const handleReset = async () => {
const openTaskItemNeed = (row: any) => {
if (!row?.id) return
itemNeedRef.value.open('task', '任务单-' + (row?.code ?? ''), row.id)
itemNeedRef.value.open('task', t('ProductionPlan.TaskSummary.taskItemNeedPrefix') + (row?.code ?? ''), row.id)
}
const openProductItemNeed = (row: any) => {
@ -596,7 +596,7 @@ const openProductItemNeed = (row: any) => {
}
const openDeviceRelationDialog = async (row: any) => {
if (!row?.productId) {
message.warning('当前明细没有关联产品,无法设置设备')
message.warning(t('ProductionPlan.TaskSummary.detailNoProductWarning'))
return
}
currentDeviceRelationRow.value = row
@ -610,7 +610,7 @@ const openDeviceRelationDialog = async (row: any) => {
(productData as any).devices ?? (productData as any).deviceIds,
(productData as any).deviceList,
['name', 'deviceName', 'code'],
'设备'
t('ProductionPlan.TaskSummary.deviceColumnName')
)
deviceRelationForm.productId = Number(row.productId)
deviceRelationForm.devices = devices
@ -632,7 +632,7 @@ const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: an
if (!Number.isFinite(id)) return undefined
return {
id,
name: item.deviceName || item.name || item.code || `设备ID:${id}`
name: item.deviceName || item.name || item.code || `${t('ProductionPlan.TaskSummary.deviceColumnName')}ID:${id}`
}
})
.filter((item): item is { id: number; name: string } => Boolean(item))
@ -655,7 +655,7 @@ const submitDeviceRelation = async () => {
currentData.molds ?? currentData.moldIds,
currentData.moldList,
['name', 'code'],
'模具'
t('ProductionPlan.TaskSummary.deviceColumnName')
)
const payload: any = {
...currentData,
@ -666,7 +666,7 @@ const submitDeviceRelation = async () => {
delete payload.molds
await ProductApi.updateProduct(payload)
await refreshDetailListAfterDeviceSaved()
message.success('关联设备已保存')
message.success(t('ProductionPlan.TaskSummary.deviceRelationSaved'))
deviceRelationDialogVisible.value = false
} finally {
deviceRelationSaving.value = false
@ -683,22 +683,22 @@ const hasValue = (value: unknown) => value !== null && value !== undefined && va
const handleSubmit = async () => {
if (searchForm.sortRule === undefined) {
message.warning('请选择排产规则')
message.warning(t('ProductionPlan.TaskSummary.selectScheduleRuleWarning'))
return
}
if (searchForm.capacityType === undefined) {
message.warning('请选择产能来源')
message.warning(t('ProductionPlan.TaskSummary.selectCapacitySourceWarning'))
return
}
const [workStartTime, workEndTime] = Array.isArray(searchForm.workTimeRange) ? searchForm.workTimeRange : []
if (!workStartTime || !workEndTime) {
message.warning('请选择生产时间安排')
message.warning(t('ProductionPlan.TaskSummary.selectWorkTimeWarning'))
return
}
const selectedRows = detailTableRef.value?.getSelectionRows() || []
if (selectedRows.length === 0) {
message.warning('至少选一个任务单汇总明细的数据')
message.warning(t('ProductionPlan.TaskSummary.selectDetailWarning'))
return
}
submitLoading.value = true
@ -742,7 +742,7 @@ const handleSubmit = async () => {
? (scheduleResult as any).data
: []
previewScheduleList.value = scheduleData
message.success('排产已提交')
message.success(t('ProductionPlan.TaskSummary.scheduleSubmitted'))
previewVisible.value = true
emit('success')
} finally {

Loading…
Cancel
Save