|
|
|
|
@ -1,116 +1,238 @@
|
|
|
|
|
<template>
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<div class="mold-brand-page__header">
|
|
|
|
|
<div
|
|
|
|
|
v-for="card in statusCards"
|
|
|
|
|
:key="card.key"
|
|
|
|
|
class="mold-brand-page__stat"
|
|
|
|
|
:class="{ 'is-active': currentStatusKey === card.key }"
|
|
|
|
|
@click="changeStatus(card.key, card.status)"
|
|
|
|
|
>
|
|
|
|
|
<div class="mold-brand-page__stat-title">{{ card.label }}</div>
|
|
|
|
|
<div class="mold-brand-page__stat-value">{{ card.value }}</div>
|
|
|
|
|
<!-- 列表视图 -->
|
|
|
|
|
<template v-if="!operateFormVisible">
|
|
|
|
|
<div class="mold-brand-page__header">
|
|
|
|
|
<div
|
|
|
|
|
v-for="card in statusCards"
|
|
|
|
|
:key="card.key"
|
|
|
|
|
class="mold-brand-page__stat"
|
|
|
|
|
:class="{ 'is-active': currentStatusKey === card.key }"
|
|
|
|
|
@click="changeStatus(card.key, card.status)"
|
|
|
|
|
>
|
|
|
|
|
<div class="mold-brand-page__stat-title">{{ card.label }}</div>
|
|
|
|
|
<div class="mold-brand-page__stat-value">{{ card.value }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" class="-mb-15px mt-16px">
|
|
|
|
|
<el-form-item prop="keyword">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.keyword"
|
|
|
|
|
placeholder="请输入编码/名称/产品型号"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="status">
|
|
|
|
|
<el-select v-model="queryParams.status" placeholder="模具状态" clearable class="!w-180px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in statusOptions"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="Number(dict.value)"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="productId">
|
|
|
|
|
<el-select v-model="queryParams.productId" placeholder="产品型号" clearable filterable class="!w-180px">
|
|
|
|
|
<el-option v-for="product in productOptions" :key="product.id" :label="product.name" :value="product.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="currentDevice">
|
|
|
|
|
<el-select v-model="queryParams.currentDevice" placeholder="当前设备" clearable filterable class="!w-180px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="device in deviceOptions"
|
|
|
|
|
:key="device.id"
|
|
|
|
|
:label="`${device.deviceName}(${device.deviceCode})`"
|
|
|
|
|
:value="device.deviceName"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="resetQuery">重置</el-button>
|
|
|
|
|
<el-button type="primary" @click="handleQuery">查询</el-button>
|
|
|
|
|
<el-button type="primary" plain @click="openForm('create')" v-hasPermi="['erp:mold-brand:create']">
|
|
|
|
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="success" plain @click="handleExport" :loading="exportLoading" v-hasPermi="['erp:mold-brand:export']">
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id">
|
|
|
|
|
<el-table-column label="图片" align="center" width="92">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" class="-mb-15px mt-16px">
|
|
|
|
|
<el-form-item prop="keyword">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.keyword"
|
|
|
|
|
placeholder="请输入编码/名称/产品型号"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="status">
|
|
|
|
|
<el-select v-model="queryParams.status" placeholder="模具状态" clearable class="!w-180px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in statusOptions"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="Number(dict.value)"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="productId">
|
|
|
|
|
<el-select v-model="queryParams.productId" placeholder="产品型号" clearable filterable class="!w-180px">
|
|
|
|
|
<el-option v-for="product in productOptions" :key="product.id" :label="product.name" :value="product.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="currentDevice">
|
|
|
|
|
<el-select v-model="queryParams.currentDevice" placeholder="当前设备" clearable filterable class="!w-180px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="device in deviceOptions"
|
|
|
|
|
:key="device.id"
|
|
|
|
|
:label="`${device.deviceName}(${device.deviceCode})`"
|
|
|
|
|
:value="device.deviceName"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="resetQuery">重置</el-button>
|
|
|
|
|
<el-button type="primary" @click="handleQuery">查询</el-button>
|
|
|
|
|
<el-button type="primary" plain @click="openForm('create')" v-hasPermi="['erp:mold-brand:create']">
|
|
|
|
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="success" plain @click="handleExport" :loading="exportLoading" v-hasPermi="['erp:mold-brand:export']">
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id">
|
|
|
|
|
<el-table-column label="图片" align="center" width="92">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-image
|
|
|
|
|
v-if="getImageList(scope.row.images).length"
|
|
|
|
|
:src="getImageList(scope.row.images)[0]"
|
|
|
|
|
:preview-src-list="getImageList(scope.row.images)"
|
|
|
|
|
fit="cover"
|
|
|
|
|
preview-teleported
|
|
|
|
|
class="mold-brand-page__thumb"
|
|
|
|
|
/>
|
|
|
|
|
<span v-else class="mold-brand-page__empty">-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="编码" prop="code" min-width="150" sortable />
|
|
|
|
|
<el-table-column label="名称" prop="name" min-width="160" sortable />
|
|
|
|
|
<el-table-column label="产品型号" prop="productName" min-width="140" />
|
|
|
|
|
<el-table-column label="版本" prop="version" width="100" />
|
|
|
|
|
<el-table-column label="状态" prop="status" width="100" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.ERP_MOLD_STATUS" :value="scope.row.status" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="当前设备" min-width="140">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ scope.row.currentDevice || scope.row.machineName || '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="子模数" prop="moldSize" width="90" align="center" />
|
|
|
|
|
<el-table-column label="创建时间" prop="createTime" :formatter="dateFormatter" width="180" sortable />
|
|
|
|
|
<el-table-column label="操作" fixed="right" min-width="240">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" @click="openDetail(scope.row.id)">详情</el-button>
|
|
|
|
|
<el-button link type="primary" @click="openOperateForm(1, scope.row)">上模</el-button>
|
|
|
|
|
<el-button link type="primary" @click="openOperateForm(2, scope.row)">下模</el-button>
|
|
|
|
|
<el-button link type="warning" @click="handleReservedAction('维修')">维修</el-button>
|
|
|
|
|
<el-button link type="primary" @click="previewQrcode(scope.row)">二维码</el-button>
|
|
|
|
|
<el-button link type="primary" @click="openForm('update', scope.row.id)" v-hasPermi="['erp:mold-brand:update']">编辑</el-button>
|
|
|
|
|
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['erp:mold-brand:delete']">删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 上下模操作表单视图 -->
|
|
|
|
|
<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" /> 返回</el-button>
|
|
|
|
|
<div class="mold-operate-page__tabs">
|
|
|
|
|
<el-button
|
|
|
|
|
:type="operateType === 1 ? 'primary' : ''"
|
|
|
|
|
@click="switchOperateType(1)"
|
|
|
|
|
>上模</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
:type="operateType === 2 ? 'primary' : ''"
|
|
|
|
|
@click="switchOperateType(2)"
|
|
|
|
|
>下模</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 模具信息卡片 -->
|
|
|
|
|
<div class="mold-operate-page__info-card" v-if="currentMold">
|
|
|
|
|
<el-image
|
|
|
|
|
v-if="getImageList(scope.row.images).length"
|
|
|
|
|
:src="getImageList(scope.row.images)[0]"
|
|
|
|
|
:preview-src-list="getImageList(scope.row.images)"
|
|
|
|
|
v-if="getImageList(currentMold.images).length"
|
|
|
|
|
:src="getImageList(currentMold.images)[0]"
|
|
|
|
|
fit="cover"
|
|
|
|
|
preview-teleported
|
|
|
|
|
class="mold-brand-page__thumb"
|
|
|
|
|
class="mold-operate-page__info-image"
|
|
|
|
|
/>
|
|
|
|
|
<span v-else class="mold-brand-page__empty">-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="编码" prop="code" min-width="150" sortable />
|
|
|
|
|
<el-table-column label="名称" prop="name" min-width="160" sortable />
|
|
|
|
|
<el-table-column label="产品型号" prop="productName" min-width="140" />
|
|
|
|
|
<el-table-column label="版本" prop="version" width="100" />
|
|
|
|
|
<el-table-column label="状态" prop="status" width="100" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.ERP_MOLD_STATUS" :value="scope.row.status" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="当前设备" min-width="140">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ scope.row.currentDevice || scope.row.machineName || '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="子模数" prop="moldSize" width="90" align="center" />
|
|
|
|
|
<el-table-column label="创建时间" prop="createTime" :formatter="dateFormatter" width="180" sortable />
|
|
|
|
|
<el-table-column label="操作" fixed="right" min-width="240">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" @click="openDetail(scope.row.id)">详情</el-button>
|
|
|
|
|
<el-button link type="primary" @click="handleReservedAction('上模')">上模</el-button>
|
|
|
|
|
<el-button link type="primary" @click="handleReservedAction('下模')">下模</el-button>
|
|
|
|
|
<el-button link type="warning" @click="handleReservedAction('维修')">维修</el-button>
|
|
|
|
|
<el-button link type="primary" @click="previewQrcode(scope.row)">二维码</el-button>
|
|
|
|
|
<el-button link type="primary" @click="openForm('update', scope.row.id)" v-hasPermi="['erp:mold-brand:update']">编辑</el-button>
|
|
|
|
|
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['erp:mold-brand:delete']">删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
<div class="mold-operate-page__info-empty" v-else></div>
|
|
|
|
|
<div class="mold-operate-page__info-item">
|
|
|
|
|
<span class="mold-operate-page__info-label">模具编码</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">模具名称</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">产品型号</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">子模数</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">当前状态</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">当前设备</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">上次更换时间</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="目标产线" prop="targetLine">
|
|
|
|
|
<el-select v-model="operateFormData.targetLine" filterable clearable placeholder="请选择产线" 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="目标设备" prop="deviceId">
|
|
|
|
|
<el-select v-model="operateFormData.deviceId" filterable clearable placeholder="请选择设备" 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="模具" prop="moldId" v-if="operateType === 1">
|
|
|
|
|
<el-select v-model="operateFormData.moldId" clearable filterable placeholder="请选择模具" class="!w-full">
|
|
|
|
|
<el-option v-for="item in moldList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="操作时间" prop="operateTime">
|
|
|
|
|
<el-date-picker v-model="operateFormData.operateTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择时间" class="!w-full" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="操作人" prop="operatorId">
|
|
|
|
|
<el-select v-model="operateFormData.operatorId" filterable clearable placeholder="请选择操作人" 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="备注" prop="remark">
|
|
|
|
|
<el-input v-model="operateFormData.remark" placeholder="请输入备注(选填)" type="textarea" :rows="3" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div class="mold-operate-page__form-actions">
|
|
|
|
|
<el-button @click="closeOperateForm">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitOperateForm" :loading="operateLoading">提交</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 右侧记录列表 -->
|
|
|
|
|
<div class="mold-operate-page__history">
|
|
|
|
|
<div class="mold-operate-page__history-header">
|
|
|
|
|
<span class="mold-operate-page__history-title">最近上下模记录</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-table :data="recentOperateList" :stripe="true" :show-overflow-tooltip="true">
|
|
|
|
|
<el-table-column label="操作类型" width="100">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span :class="scope.row.operateType === 1 ? 'text-primary' : 'text-success'">
|
|
|
|
|
{{ scope.row.operateType === 1 ? '安装(上模)' : '拆卸(下模)' }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="模具编码" prop="moldCode" width="140" />
|
|
|
|
|
<el-table-column label="操作时间" prop="createTime" width="160" :formatter="dateFormatter" />
|
|
|
|
|
<el-table-column label="操作人" prop="creatorName" width="100" />
|
|
|
|
|
<el-table-column label="状态" width="80" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.ERP_MOLD_STATUS" :value="scope.row.status" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<el-empty v-if="!recentOperateList.length" description="暂无操作记录" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<Dialog v-model="qrcodeVisible" title="模具二维码" width="360px">
|
|
|
|
|
@ -137,8 +259,11 @@
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { defineAsyncComponent } from 'vue'
|
|
|
|
|
import { ProductApi, type ProductVO } from '@/api/erp/product/product'
|
|
|
|
|
import { MoldBrandApi, type MoldBrandVO } from '@/api/erp/mold'
|
|
|
|
|
import { MoldBrandApi, type MoldBrandVO, type MoldVO } 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'
|
|
|
|
|
@ -181,6 +306,38 @@ const queryFormRef = ref()
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
const MoldBrandFormComp = defineAsyncComponent(() => import('./MoldBrandForm.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 operateFormData = reactive({
|
|
|
|
|
moldId: undefined as number | undefined,
|
|
|
|
|
targetLine: 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({
|
|
|
|
|
moldId: [{ required: true, message: '请选择模具', trigger: 'blur' }],
|
|
|
|
|
targetLine: [{ required: true, message: '请选择目标产线', trigger: 'blur' }],
|
|
|
|
|
deviceId: [{ required: true, message: '请选择目标设备', trigger: 'blur' }],
|
|
|
|
|
operateTime: [{ required: true, message: '请选择操作时间', trigger: 'blur' }],
|
|
|
|
|
operatorId: [{ required: true, message: '请选择操作人', trigger: 'blur' }]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 下拉选项
|
|
|
|
|
const lineOptions = ref<OrganizationVO[]>([])
|
|
|
|
|
const operatorOptions = ref<UserVO[]>([])
|
|
|
|
|
const moldList = ref<MoldVO[]>([])
|
|
|
|
|
|
|
|
|
|
const statusCards = computed(() => [
|
|
|
|
|
{ key: 'all', label: '全部', value: counters.allCount, status: undefined },
|
|
|
|
|
{ key: 'onMachine', label: '在机', value: counters.onMachineCount, status: 1 },
|
|
|
|
|
@ -302,6 +459,106 @@ const openDetail = (id: number) => {
|
|
|
|
|
push({ name: 'ErpMoldBrandDetail', params: { id } })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 上下模操作函数
|
|
|
|
|
const openOperateForm = async (type: number, row: MoldBrandVO) => {
|
|
|
|
|
operateType.value = type
|
|
|
|
|
currentMold.value = row
|
|
|
|
|
operateFormVisible.value = true
|
|
|
|
|
|
|
|
|
|
// 重置表单
|
|
|
|
|
operateFormData.moldId = undefined
|
|
|
|
|
operateFormData.targetLine = undefined
|
|
|
|
|
operateFormData.deviceId = undefined
|
|
|
|
|
operateFormData.operateTime = undefined
|
|
|
|
|
operateFormData.operatorId = undefined
|
|
|
|
|
operateFormData.remark = undefined
|
|
|
|
|
|
|
|
|
|
// 初始化下拉选项
|
|
|
|
|
await initOperateOptions()
|
|
|
|
|
|
|
|
|
|
// 获取最近操作记录
|
|
|
|
|
await fetchRecentOperateList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const closeOperateForm = () => {
|
|
|
|
|
operateFormVisible.value = false
|
|
|
|
|
currentMold.value = null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const switchOperateType = (type: number) => {
|
|
|
|
|
operateType.value = type
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const initOperateOptions = async () => {
|
|
|
|
|
// 获取产线选项
|
|
|
|
|
try {
|
|
|
|
|
const data = await OrganizationApi.getOrganizationList()
|
|
|
|
|
lineOptions.value = Array.isArray(data) ? data : []
|
|
|
|
|
} catch {
|
|
|
|
|
lineOptions.value = []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取模具列表
|
|
|
|
|
try {
|
|
|
|
|
moldList.value = await MoldBrandApi.getBrandList()
|
|
|
|
|
} catch {
|
|
|
|
|
moldList.value = []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取操作人选项
|
|
|
|
|
try {
|
|
|
|
|
operatorOptions.value = (await getSimpleUserList()) ?? []
|
|
|
|
|
} catch {
|
|
|
|
|
operatorOptions.value = []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fetchRecentOperateList = async () => {
|
|
|
|
|
if (!currentMold.value?.id) return
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const data = await MoldOperateApi.getMoldOperatePage({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 5,
|
|
|
|
|
moldId: currentMold.value.id
|
|
|
|
|
})
|
|
|
|
|
recentOperateList.value = data?.list ?? []
|
|
|
|
|
} catch {
|
|
|
|
|
recentOperateList.value = []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const submitOperateForm = async () => {
|
|
|
|
|
if (!operateFormRef.value) return
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await operateFormRef.value.validate()
|
|
|
|
|
|
|
|
|
|
operateLoading.value = true
|
|
|
|
|
|
|
|
|
|
const submitData = {
|
|
|
|
|
operateType: operateType.value,
|
|
|
|
|
moldId: operateType.value === 1 ? operateFormData.moldId : currentMold.value?.id,
|
|
|
|
|
deviceId: operateFormData.deviceId,
|
|
|
|
|
remark: operateFormData.remark,
|
|
|
|
|
targetLine: operateFormData.targetLine,
|
|
|
|
|
operateTime: operateFormData.operateTime,
|
|
|
|
|
operatorId: operateFormData.operatorId
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await MoldOperateApi.createMoldOperate(submitData)
|
|
|
|
|
|
|
|
|
|
message.success(operateType.value === 1 ? '上模成功' : '下模成功')
|
|
|
|
|
|
|
|
|
|
closeOperateForm()
|
|
|
|
|
await getList()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('提交失败:', error)
|
|
|
|
|
} finally {
|
|
|
|
|
operateLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
productOptions.value = await ProductApi.getMesProductSimpleList()
|
|
|
|
|
deviceOptions.value = await DeviceLedgerApi.getDeviceLedgerList()
|
|
|
|
|
@ -365,6 +622,113 @@ 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: 420px;
|
|
|
|
|
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));
|
|
|
|
|
|