|
|
|
|
@ -78,7 +78,7 @@
|
|
|
|
|
align="center" />
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.createTime')" prop="createTime"
|
|
|
|
|
:formatter="dateFormatter" width="160" sortable />
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.operate')" fixed="right" width="310">
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.operate')" fixed="right" width="310" align="right">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" @click="openDetail(scope.row.id)">{{ t('MoldManagement.MoldBrandPage.detail')
|
|
|
|
|
}}</el-button>
|
|
|
|
|
@ -104,116 +104,14 @@
|
|
|
|
|
|
|
|
|
|
<!-- 上下模操作表单视图 -->
|
|
|
|
|
<template v-else>
|
|
|
|
|
<div class="mold-operate-page">
|
|
|
|
|
<div class="mold-operate-page__header">
|
|
|
|
|
<el-button @click="closeOperateForm">
|
|
|
|
|
<Icon icon="ep:arrow-left" class="mr-5px" /> {{ t('MoldManagement.MoldBrandPage.back') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 模具信息卡片 -->
|
|
|
|
|
<div class="mold-operate-page__info-card" v-if="currentMold">
|
|
|
|
|
<el-image v-if="getImageList(currentMold.images).length" :src="getImageList(currentMold.images)[0]"
|
|
|
|
|
fit="cover" class="mold-operate-page__info-image" />
|
|
|
|
|
<div class="mold-operate-page__info-empty" v-else></div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">{{ t('MoldManagement.MoldBrandPage.moldCode') }}</span>
|
|
|
|
|
<span class="mold-operate-page__info-value">{{ currentMold.code }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">{{ t('MoldManagement.MoldBrandPage.moldName') }}</span>
|
|
|
|
|
<span class="mold-operate-page__info-value">{{ currentMold.name }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">{{ t('MoldManagement.MoldBrandPage.productName') }}</span>
|
|
|
|
|
<span class="mold-operate-page__info-value">{{ currentMold.productName }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">{{ t('MoldManagement.MoldBrandPage.moldSize') }}</span>
|
|
|
|
|
<span class="mold-operate-page__info-value">{{ currentMold.moldSize }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">{{ t('MoldManagement.MoldBrandPage.status') }}</span>
|
|
|
|
|
<dict-tag :type="DICT_TYPE.ERP_MOLD_STATUS" :value="currentMold.status" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">{{ t('MoldManagement.MoldBrandPage.currentDevice') }}</span>
|
|
|
|
|
<span class="mold-operate-page__info-value">{{ currentMold.currentDevice || '-' }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">{{ t('MoldManagement.MoldBrandPage.lastChangeTime') }}</span>
|
|
|
|
|
<span class="mold-operate-page__info-value">{{ currentMold.lastChangeTime ?
|
|
|
|
|
dateFormatter(currentMold.lastChangeTime) : '-' }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mold-operate-page__body">
|
|
|
|
|
<!-- 左侧表单 -->
|
|
|
|
|
<div class="mold-operate-page__form">
|
|
|
|
|
<el-form ref="operateFormRef" :model="operateFormData" :rules="operateFormRules" label-width="100px">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldBrandPage.targetLine')" prop="lineId">
|
|
|
|
|
<el-select v-model="operateFormData.lineId" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldBrandPage.placeholderTargetLine')" class="!w-full">
|
|
|
|
|
<el-option v-for="line in lineOptions" :key="line.id" :label="line.name" :value="String(line.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldBrandPage.targetDevice')" prop="deviceId">
|
|
|
|
|
<el-select v-model="operateFormData.deviceId" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldBrandPage.placeholderTargetDevice')" class="!w-full">
|
|
|
|
|
<el-option v-for="device in deviceOptions" :key="device.id"
|
|
|
|
|
:label="`${device.deviceName}(${device.deviceCode})`" :value="device.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldBrandPage.operateTime')" prop="operateTime">
|
|
|
|
|
<el-date-picker v-model="operateFormData.operateTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldBrandPage.placeholderOperateTime')" class="!w-full" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldBrandPage.operator')" prop="operatorId">
|
|
|
|
|
<el-select v-model="operateFormData.operatorId" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldBrandPage.placeholderOperator')" class="!w-full">
|
|
|
|
|
<el-option v-for="item in operatorOptions" :key="String(item.id)" :label="item.nickname"
|
|
|
|
|
:value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldBrandPage.remark')" prop="remark">
|
|
|
|
|
<el-input v-model="operateFormData.remark"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldBrandPage.placeholderRemark')" type="textarea" :rows="3" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div class="mold-operate-page__form-actions">
|
|
|
|
|
<el-button @click="closeOperateForm">{{ t('MoldManagement.MoldBrandPage.cancel') }}</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitOperateForm" :loading="operateLoading">{{
|
|
|
|
|
t('MoldManagement.MoldBrandPage.submit') }}</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 右侧记录列表 -->
|
|
|
|
|
<div class="mold-operate-page__history">
|
|
|
|
|
<div class="mold-operate-page__history-header">
|
|
|
|
|
<span class="mold-operate-page__history-title">{{ t('MoldManagement.MoldBrandPage.recentRecords')
|
|
|
|
|
}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-table :data="recentOperateList" :stripe="true" :show-overflow-tooltip="true" v-loading="recentLoading">
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.operateType')">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span :class="scope.row.operateType === '1' ? 'text-primary' : 'text-success'">
|
|
|
|
|
{{ scope.row.operateType === '1' ? t('MoldManagement.MoldBrandPage.installUp') :
|
|
|
|
|
t('MoldManagement.MoldBrandPage.uninstallDown') }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.moldName')" prop="moldName" />
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.lineName')" prop="lineName" />
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.operateTime')" prop="createTime" width="160"
|
|
|
|
|
:formatter="dateFormatter" />
|
|
|
|
|
<el-table-column :label="t('MoldManagement.MoldBrandPage.operator')" prop="operatorName" width="100" />
|
|
|
|
|
</el-table>
|
|
|
|
|
<el-empty v-if="!recentOperateList.length" :description="t('MoldManagement.MoldBrandPage.noRecords')" />
|
|
|
|
|
<Pagination :total="recentTotal" v-model:page="recentPageNo" v-model:limit="recentPageSize"
|
|
|
|
|
@pagination="fetchRecentOperateList" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<MoldOperateViewComp
|
|
|
|
|
ref="moldOperateViewRef"
|
|
|
|
|
:mold="currentMold"
|
|
|
|
|
:type="operateType"
|
|
|
|
|
:device-options="deviceOptions"
|
|
|
|
|
@back="closeOperateForm"
|
|
|
|
|
@success="onOperateSuccess"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
@ -236,9 +134,6 @@ import { defineAsyncComponent } from 'vue'
|
|
|
|
|
import { ProductApi, type ProductVO } from '@/api/erp/product/product'
|
|
|
|
|
import { MoldBrandApi, type MoldBrandVO } from '@/api/erp/mold'
|
|
|
|
|
import { DeviceLedgerApi, type DeviceLedgerVO } from '@/api/mes/deviceledger'
|
|
|
|
|
import { MoldOperateApi, type MoldOperateVO } from '@/api/mes/moldoperate'
|
|
|
|
|
import { OrganizationApi, type OrganizationVO } from '@/api/mes/organization'
|
|
|
|
|
import { getSimpleUserList, type UserVO } from '@/api/system/user'
|
|
|
|
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import download from '@/utils/download'
|
|
|
|
|
@ -282,39 +177,13 @@ const queryParams = reactive({
|
|
|
|
|
const queryFormRef = ref()
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
const MoldBrandFormComp = defineAsyncComponent(() => import('./MoldBrandForm.vue') as any)
|
|
|
|
|
const MoldOperateViewComp = defineAsyncComponent(() => import('./components/MoldOperateView.vue') as any)
|
|
|
|
|
|
|
|
|
|
// 上下模操作相关
|
|
|
|
|
const operateFormVisible = ref(false)
|
|
|
|
|
const operateType = ref(1) // 1: 上模, 2: 下模
|
|
|
|
|
const currentMold = ref<MoldBrandVO | null>(null)
|
|
|
|
|
const operateLoading = ref(false)
|
|
|
|
|
const operateFormRef = ref()
|
|
|
|
|
const recentOperateList = ref<MoldOperateVO[]>([])
|
|
|
|
|
const recentPageNo = ref(1)
|
|
|
|
|
const recentPageSize = ref(5)
|
|
|
|
|
const recentTotal = ref(0)
|
|
|
|
|
const recentLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
// 表单数据
|
|
|
|
|
const operateFormData = reactive({
|
|
|
|
|
lineId: undefined as string | undefined,
|
|
|
|
|
deviceId: undefined as number | undefined,
|
|
|
|
|
operateTime: undefined as string | undefined,
|
|
|
|
|
operatorId: undefined as string | undefined,
|
|
|
|
|
remark: undefined as string | undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 表单验证规则
|
|
|
|
|
const operateFormRules = reactive({
|
|
|
|
|
lineId: [{ required: true, message: t('MoldManagement.MoldBrandPage.validatorTargetLineRequired'), trigger: 'blur' }],
|
|
|
|
|
deviceId: [{ required: true, message: t('MoldManagement.MoldBrandPage.validatorTargetDeviceRequired'), trigger: 'blur' }],
|
|
|
|
|
operateTime: [{ required: true, message: t('MoldManagement.MoldBrandPage.validatorOperateTimeRequired'), trigger: 'blur' }],
|
|
|
|
|
operatorId: [{ required: true, message: t('MoldManagement.MoldBrandPage.validatorOperatorRequired'), trigger: 'blur' }]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 下拉选项
|
|
|
|
|
const lineOptions = ref<OrganizationVO[]>([])
|
|
|
|
|
const operatorOptions = ref<UserVO[]>([])
|
|
|
|
|
const moldOperateViewRef = ref()
|
|
|
|
|
|
|
|
|
|
const statusCards = computed(() => [
|
|
|
|
|
{ key: 'all', label: t('MoldManagement.MoldBrandPage.all'), value: counters.allCount, status: undefined },
|
|
|
|
|
@ -442,20 +311,8 @@ const openOperateForm = async (type: number, row: MoldBrandVO) => {
|
|
|
|
|
operateType.value = type
|
|
|
|
|
currentMold.value = row
|
|
|
|
|
operateFormVisible.value = true
|
|
|
|
|
|
|
|
|
|
// 重置表单
|
|
|
|
|
operateFormData.lineId = undefined
|
|
|
|
|
operateFormData.deviceId = undefined
|
|
|
|
|
operateFormData.operateTime = undefined
|
|
|
|
|
operateFormData.operatorId = undefined
|
|
|
|
|
operateFormData.remark = undefined
|
|
|
|
|
|
|
|
|
|
// 初始化下拉选项
|
|
|
|
|
await initOperateOptions()
|
|
|
|
|
|
|
|
|
|
// 获取最近操作记录
|
|
|
|
|
recentPageNo.value = 1
|
|
|
|
|
await fetchRecentOperateList()
|
|
|
|
|
await nextTick()
|
|
|
|
|
moldOperateViewRef.value?.open()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const closeOperateForm = () => {
|
|
|
|
|
@ -463,74 +320,8 @@ const closeOperateForm = () => {
|
|
|
|
|
currentMold.value = null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const initOperateOptions = async () => {
|
|
|
|
|
// 获取产线选项
|
|
|
|
|
try {
|
|
|
|
|
const data = await OrganizationApi.getOrganizationList()
|
|
|
|
|
lineOptions.value = Array.isArray(data) ? data : []
|
|
|
|
|
} catch {
|
|
|
|
|
lineOptions.value = []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取操作人选项
|
|
|
|
|
try {
|
|
|
|
|
operatorOptions.value = (await getSimpleUserList()) ?? []
|
|
|
|
|
} catch {
|
|
|
|
|
operatorOptions.value = []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fetchRecentOperateList = async () => {
|
|
|
|
|
if (!currentMold.value?.id) return
|
|
|
|
|
|
|
|
|
|
recentLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await MoldOperateApi.getMoldOperatePage({
|
|
|
|
|
pageNo: recentPageNo.value,
|
|
|
|
|
pageSize: recentPageSize.value,
|
|
|
|
|
moldId: currentMold.value.id
|
|
|
|
|
})
|
|
|
|
|
recentOperateList.value = data?.list ?? []
|
|
|
|
|
recentTotal.value = data?.total ?? 0
|
|
|
|
|
} catch {
|
|
|
|
|
recentOperateList.value = []
|
|
|
|
|
recentTotal.value = 0
|
|
|
|
|
} finally {
|
|
|
|
|
recentLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const submitOperateForm = async () => {
|
|
|
|
|
if (!operateFormRef.value) return
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await operateFormRef.value.validate()
|
|
|
|
|
|
|
|
|
|
operateLoading.value = true
|
|
|
|
|
|
|
|
|
|
const submitData = {
|
|
|
|
|
operateType: operateType.value,
|
|
|
|
|
moldId: currentMold.value?.id,
|
|
|
|
|
lineId: operateFormData.lineId,
|
|
|
|
|
deviceId: operateFormData.deviceId,
|
|
|
|
|
remark: operateFormData.remark,
|
|
|
|
|
operateTime: operateFormData.operateTime,
|
|
|
|
|
operatorId: operateFormData.operatorId
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await MoldOperateApi.createMoldOperate(submitData)
|
|
|
|
|
|
|
|
|
|
message.success(operateType.value === 1 ? t('MoldManagement.MoldBrandPage.moldUpSuccess') : t('MoldManagement.MoldBrandPage.moldDownSuccess'))
|
|
|
|
|
|
|
|
|
|
// 提交成功暂不返回列表
|
|
|
|
|
// closeOperateForm()
|
|
|
|
|
// await getList()
|
|
|
|
|
fetchRecentOperateList()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(t('MoldManagement.MoldBrandPage.submitFailed'), error)
|
|
|
|
|
} finally {
|
|
|
|
|
operateLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
const onOperateSuccess = () => {
|
|
|
|
|
// 提交成功后的回调
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
@ -607,113 +398,6 @@ onMounted(async () => {
|
|
|
|
|
height: 220px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 上下模操作页面样式 */
|
|
|
|
|
.mold-operate-page__header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__tabs {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__info-card {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 24px;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__info-image {
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 80px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
border: 1px solid var(--el-border-color-lighter);
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__info-empty {
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 80px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
border: 1px dashed var(--el-border-color-lighter);
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__info-item {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__info-label {
|
|
|
|
|
display: block;
|
|
|
|
|
color: var(--el-text-color-secondary);
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__info-value {
|
|
|
|
|
display: block;
|
|
|
|
|
color: var(--el-text-color-primary);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__body {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__form {
|
|
|
|
|
flex: 1;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
padding: 24px;
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__form-actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
margin-top: 24px;
|
|
|
|
|
padding-top: 16px;
|
|
|
|
|
border-top: 1px solid var(--el-border-color-lighter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__history {
|
|
|
|
|
width: 30vw;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
|
|
|
|
|
max-height: 500px;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__history-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-operate-page__history-title {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: var(--el-text-color-primary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 1200px) {
|
|
|
|
|
.mold-brand-page__header {
|
|
|
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
|
|
|
|