|
|
|
@ -0,0 +1,825 @@
|
|
|
|
|
<template>
|
|
|
|
|
<!-- 出库 -->
|
|
|
|
|
<el-card class="hl-card" style="position: relative">
|
|
|
|
|
<template #header>
|
|
|
|
|
<span v-text="dialogTitle"></span>
|
|
|
|
|
</template>
|
|
|
|
|
<div class="abstatus">
|
|
|
|
|
<img src="/src/assets/imgs/status/status2.png" v-if="formData.status == 2" alt="" />
|
|
|
|
|
<img src="/src/assets/imgs/status/statuszf.png" v-else-if="formData.status == 3" alt="" />
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="200px" v-loading="formLoading"
|
|
|
|
|
v-bind:disabled="isShowBtnOther">
|
|
|
|
|
<!-- 基础信息 -->
|
|
|
|
|
<el-card class="hl-card-info">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">基础信息</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item prop="stockNo" label="盘点单号">
|
|
|
|
|
<el-input v-model="formData.stockNo" disabled placeholder="系统自动生成" class="!w-400px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item prop="whId" label="盘点仓库" required>
|
|
|
|
|
<el-select v-model="formData.whId" placeholder="下拉选择" clearable disabled class="!w-400px"
|
|
|
|
|
@change="handleWh">
|
|
|
|
|
<el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item prop="status" label="单据状态">
|
|
|
|
|
<el-select v-model="formData.status" placeholder="下拉选择" clearable class="!w-400px" disabled>
|
|
|
|
|
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_MAT_CHECK_STATUS)"
|
|
|
|
|
:key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item prop="checkType" label="盘点类型">
|
|
|
|
|
<el-select v-model="formData.checkType" clearable class="!w-400px" disabled>
|
|
|
|
|
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_MAT_CHECK_TYPE)" :key="dict.value"
|
|
|
|
|
:label="dict.label" :value="dict.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="排除库存为0的物料?" prop="noZero">
|
|
|
|
|
<el-radio-group v-model="formData.noZero" disabled>
|
|
|
|
|
<el-radio v-for="dict in getIntDictOptions(DICT_TYPE.HELI_COMMON_IS_OR_NOT)" :key="dict.value"
|
|
|
|
|
:label="dict.value">
|
|
|
|
|
{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="盘点开始日期" prop="checkTime">
|
|
|
|
|
<el-date-picker v-model="formData.checkTime" value-format="YYYY-MM-DD" type="date" disabled class="!w-220px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="20">
|
|
|
|
|
<el-form-item label="备注" prop="description">
|
|
|
|
|
<el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" disabled />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
<!-- 物料信息 -->
|
|
|
|
|
<el-card class="hl-card-info">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">物料信息</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col>
|
|
|
|
|
<el-card class="hl-incard">
|
|
|
|
|
<el-col>
|
|
|
|
|
<el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem">新增</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
|
|
|
|
|
v-loading="subFormLoading" label-width="0">
|
|
|
|
|
<el-table :data="formData.matItemDOList" class="hl-table">
|
|
|
|
|
<el-table-column prop="cid" label="序号" :width="80" />
|
|
|
|
|
<el-table-column prop="matId" min-width="140" align="center">
|
|
|
|
|
<template #header> <span class="hl-table_header">*</span>物料名称 </template>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!">
|
|
|
|
|
<el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch"
|
|
|
|
|
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading"
|
|
|
|
|
@change="(val) => handleMatCode(scope, val)" class="!w-180px">
|
|
|
|
|
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="matCode" label="物料编码" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="matType" label="物料类型" min-width="120" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType"
|
|
|
|
|
v-if="scope.row.matType ? true : false" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="matSpec" label="规格/型号" min-width="120" align="center" />
|
|
|
|
|
|
|
|
|
|
<el-table-column prop="matUnit" label="系统单位" min-width="120" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit"
|
|
|
|
|
v-if="scope.row.matUnit ? true : false" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="rgId" min-width="120" align="center">
|
|
|
|
|
<template #header> <span class="hl-table_header">*</span>出库库区 </template>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!">
|
|
|
|
|
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)"
|
|
|
|
|
disabled="">
|
|
|
|
|
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="pnId" min-width="140" align="center">
|
|
|
|
|
<template #header> <span class="hl-table_header">*</span>出库库位 </template>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!">
|
|
|
|
|
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%">
|
|
|
|
|
<el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName"
|
|
|
|
|
:value="dict.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="matRest" label="库存数量" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="storageOkQty" min-width="120" align="center">
|
|
|
|
|
<template #header> <span class="hl-table_header">*</span>出库数量</template>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
|
|
|
|
|
class="mb-0px!">
|
|
|
|
|
<el-input v-model="scope.row.storageOkQty" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" />
|
|
|
|
|
<el-table-column prop="description" min-width="180" label="备注" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input v-model="scope.row.description" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" width="240">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<!-- <el-button v-if="!scope.row.editable" type="primary" size="small" link
|
|
|
|
|
@click="handleEdit(scope.$index)">
|
|
|
|
|
编辑
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button link v-else type="success" size="small" @click="handleSave(scope.$index)">
|
|
|
|
|
保存
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
|
|
<el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</el-button> -->
|
|
|
|
|
<el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)"
|
|
|
|
|
v-if="isShowBtnDelete">
|
|
|
|
|
删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
<!-- 附件信息 -->
|
|
|
|
|
<el-card class="hl-card-info">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">附件信息</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col>
|
|
|
|
|
<el-card class="hl-incard">
|
|
|
|
|
<el-col>
|
|
|
|
|
<el-upload ref="matUploadRef" :file-list="matUploadFiles" multiple :limit="10" :action="uploadUrl"
|
|
|
|
|
:headers="{
|
|
|
|
|
Authorization: 'Bearer ' + getAccessToken(),
|
|
|
|
|
'tenant-id': getTenantId()
|
|
|
|
|
}" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData"
|
|
|
|
|
:on-change="matUploadChange" class="upload-file-uploader">
|
|
|
|
|
<el-button type="primary">
|
|
|
|
|
<Icon icon="ep:upload-filled" />上传
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-table :data="formData.attachments" class="hl-table">
|
|
|
|
|
<el-table-column prop="name" label="文件名称" align="center">
|
|
|
|
|
<!-- <template #default="scope">
|
|
|
|
|
<a :href="scope.row.url" target="_blank" style="color: #409eff">{{ scope.row.name }} </a>
|
|
|
|
|
</template> -->
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column prop="createTime" align="center" label="上传日期" :formatter="dateFormatter" />
|
|
|
|
|
|
|
|
|
|
<el-table-column label="操作" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="danger" size="small" v-if="isShowBtnDelete"
|
|
|
|
|
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
|
|
|
|
|
删除
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button link type="primary" size="small"
|
|
|
|
|
@click="downloadAttachment(scope.row.name, scope.row.url)">
|
|
|
|
|
下载
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
<!-- 系统信息 -->
|
|
|
|
|
<el-card class="hl-card-info">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">系统信息</span>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<el-row justify="center">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item prop="creator" label="创建人">
|
|
|
|
|
{{ userList.find((user) => user.id == formData.creator)?.nickname }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item prop="createTime" label="创建时间">
|
|
|
|
|
{{ formatDate(formData.createTime, 'YYYY-MM-DD HH:mm') }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row justify="center">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item prop="outbound" label="出库人">
|
|
|
|
|
{{ userList.find((user) => user.id == formData.outbound)?.nickname }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item prop="outboundTime" label="出库时间">
|
|
|
|
|
{{ formatDate(formData.outboundTime, 'YYYY-MM-DD HH:mm') }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row justify="center">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item prop="cancel" label="作废人">
|
|
|
|
|
{{ userList.find((user) => user.id == formData.cancel)?.nickname }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item prop="cancelTime" label="作废时间">
|
|
|
|
|
{{ formatDate(formData.cancelTime, 'YYYY-MM-DD HH:mm') }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div class="text-center hl-footer">
|
|
|
|
|
<el-button @click="() => router.go(-1)" size="large">取 消</el-button>
|
|
|
|
|
<el-button @click="submitForm" v-if="isShowBtnGroup" type="success" :disabled="formLoading" size="large">保
|
|
|
|
|
存</el-button>
|
|
|
|
|
<el-button @click="handleStatus(2)" v-if="isShowBtnGroup" type="primary" :disabled="formLoading" size="large">提
|
|
|
|
|
交</el-button>
|
|
|
|
|
<el-button @click="handleStatus(3)" v-if="isShowBtnCancel" type="danger" :disabled="formLoading" size="large">删
|
|
|
|
|
除</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
import { dateFormatter, formatDate } from '@/utils/formatTime'
|
|
|
|
|
|
|
|
|
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { getAccessToken, getTenantId } from '@/utils/auth'
|
|
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
|
|
|
|
|
|
|
import * as CheckApi from '@/api/heli/storagecheck'
|
|
|
|
|
import * as CheckMatApi from '@/api/heli/storagecheckmat'
|
|
|
|
|
|
|
|
|
|
import * as UserApi from '@/api/system/user'
|
|
|
|
|
import * as MatApi from '@/api/heli/material'
|
|
|
|
|
import * as WhApi from '@/api/heli/warehouse'
|
|
|
|
|
import * as RgApi from '@/api/heli/rg'
|
|
|
|
|
import * as PnApi from '@/api/heli/pn'
|
|
|
|
|
|
|
|
|
|
import type { UploadUserFile } from 'element-plus'
|
|
|
|
|
import { deleteFile, downloadFile, getFilePage } from '@/api/infra/file'
|
|
|
|
|
import download from '@/utils/download'
|
|
|
|
|
|
|
|
|
|
const reload = inject('reload')
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
const { query } = useRoute()
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
const formData = ref({
|
|
|
|
|
id: undefined,
|
|
|
|
|
stockNo: undefined,
|
|
|
|
|
checkType: undefined,
|
|
|
|
|
checkTime: undefined,
|
|
|
|
|
status:undefined,
|
|
|
|
|
noZero: undefined,
|
|
|
|
|
whId: undefined,
|
|
|
|
|
description: undefined,
|
|
|
|
|
creator: undefined,
|
|
|
|
|
createTime: undefined,
|
|
|
|
|
keeper: undefined,
|
|
|
|
|
keeperTime: undefined,
|
|
|
|
|
outbound: undefined,
|
|
|
|
|
outboundTime: undefined,
|
|
|
|
|
cancel: undefined,
|
|
|
|
|
cancelTime: undefined,
|
|
|
|
|
matItemDOList: [],
|
|
|
|
|
attachments: []
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
// name: [{ required: true, message: '模具类型不能为空', trigger: 'blur' }],
|
|
|
|
|
status: [{ required: true, message: '启用状态不能为空', trigger: 'blur' }],
|
|
|
|
|
stockInType: [{ required: true, message: '出库类型不能为空', trigger: 'blur' }],
|
|
|
|
|
whId: [{ required: true, message: '出库仓库不能为空', trigger: 'blur' }]
|
|
|
|
|
})
|
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
const matSubFormRef = ref() //子表单 Ref
|
|
|
|
|
|
|
|
|
|
const subFormLoading = ref(false) // 子表单的加载中
|
|
|
|
|
const subFormRules = reactive({
|
|
|
|
|
matId: [{ required: true, message: '物料不能为空', trigger: 'blur' }],
|
|
|
|
|
rgId: [{ required: true, message: '库区不能为空', trigger: 'blur' }],
|
|
|
|
|
pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }],
|
|
|
|
|
storageOkQty: [{ required: true, message: '盘点数量不能为空', trigger: 'blur' }]
|
|
|
|
|
})
|
|
|
|
|
const handleStatus = async (num) => {
|
|
|
|
|
// 校验表单
|
|
|
|
|
await formRef.value.validate()
|
|
|
|
|
if (formData.value.matItemDOList.length === 0) {
|
|
|
|
|
message.alertWarning('请添加物料信息!')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 校验子表单
|
|
|
|
|
try {
|
|
|
|
|
await matSubFormRef.value.validate()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//保存表单数据
|
|
|
|
|
await saveFormData()
|
|
|
|
|
|
|
|
|
|
formData.value.status = num
|
|
|
|
|
|
|
|
|
|
const dataUpdate = formData.value as unknown as CheckApi.StorageVO
|
|
|
|
|
if (num == 2) {
|
|
|
|
|
dataUpdate.outbound = useUserStore().getUser.id
|
|
|
|
|
} else {
|
|
|
|
|
dataUpdate.cancel = useUserStore().getUser.id
|
|
|
|
|
}
|
|
|
|
|
await CheckApi.updateStorageStatus(dataUpdate)
|
|
|
|
|
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
|
|
|
|
|
switch (num) {
|
|
|
|
|
case 1:
|
|
|
|
|
isShowBtnGroup.value = true
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnOther.value = true
|
|
|
|
|
isShowBtnDelete.value = true
|
|
|
|
|
break
|
|
|
|
|
case 2:
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = true
|
|
|
|
|
isShowBtnOther.value = false
|
|
|
|
|
isShowBtnDelete.value = false
|
|
|
|
|
break
|
|
|
|
|
case 3:
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnOther.value = false
|
|
|
|
|
isShowBtnDelete.value = false
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
//查看页面不可以编辑
|
|
|
|
|
if (query.type === 'review') {
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnOther.value = false
|
|
|
|
|
isShowBtnDelete.value = false
|
|
|
|
|
}
|
|
|
|
|
query.id = storageid.value
|
|
|
|
|
query.type = 'update'
|
|
|
|
|
reload()
|
|
|
|
|
}
|
|
|
|
|
const userList = ref<UserApi.UserVO[]>([]) // 用户列表
|
|
|
|
|
|
|
|
|
|
// ====================附件信息 开始=======================================
|
|
|
|
|
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
|
|
|
|
|
const matUploadRef = ref()
|
|
|
|
|
const matUploadFiles = ref<UploadUserFile[]>([])
|
|
|
|
|
const matUploadData = ref({
|
|
|
|
|
businessType: 'STORAGECHECK',
|
|
|
|
|
businessId: formData.value.id,
|
|
|
|
|
businessFileType: ''
|
|
|
|
|
})
|
|
|
|
|
const matUploadChange = (file, files) => {
|
|
|
|
|
matUploadFiles.value = files
|
|
|
|
|
refreshAttachments(files, '')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const refreshAttachments = (files, type) => {
|
|
|
|
|
formData.value.attachments = formData.value.attachments.filter((value, index, array) => {
|
|
|
|
|
return value.id
|
|
|
|
|
})
|
|
|
|
|
for (let i = 0; i < files.length; i++) {
|
|
|
|
|
let file = files[i]
|
|
|
|
|
file.businessFileType = type
|
|
|
|
|
file.createTime = new Date()
|
|
|
|
|
formData.value.attachments.push(file)
|
|
|
|
|
}
|
|
|
|
|
// 排序
|
|
|
|
|
formData.value.attachments.sort((v1, v2) => {
|
|
|
|
|
return v1.createTime - v2.createTime > 0
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 删除附件
|
|
|
|
|
const handleDeleteAttachment = async (index, type) => {
|
|
|
|
|
const deletedAttachments = formData.value.attachments.splice(index, 1)
|
|
|
|
|
for (let i = 0; i < deletedAttachments.length; i++) {
|
|
|
|
|
const attachment = deletedAttachments[i]
|
|
|
|
|
if (attachment.id) {
|
|
|
|
|
// 清理已上传文件
|
|
|
|
|
await deleteFile(attachment.id)
|
|
|
|
|
}
|
|
|
|
|
// 清理待上传文件
|
|
|
|
|
matUploadFiles.value = matUploadFiles.value.filter((file1) => {
|
|
|
|
|
return file1.name != attachment.name || file1.businessFileType != type
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 下载文件
|
|
|
|
|
const downloadAttachment = async (name, url) => {
|
|
|
|
|
if (url) {
|
|
|
|
|
const data = await downloadFile(url)
|
|
|
|
|
download.any(data, name)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// ====================附件信息 结束=======================================
|
|
|
|
|
|
|
|
|
|
const storageid = ref()
|
|
|
|
|
var commonResult = ''
|
|
|
|
|
|
|
|
|
|
/** 提交表单 */
|
|
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
|
|
|
|
|
|
|
|
const saveFormData = async () => {
|
|
|
|
|
|
|
|
|
|
// 提交请求
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
//物料信息保存
|
|
|
|
|
formData.value.matItemDOList.forEach((item) => {
|
|
|
|
|
item.stockId = storageid.value
|
|
|
|
|
item.whId = formData.value.whId
|
|
|
|
|
})
|
|
|
|
|
const dataMats = formData.value.matItemDOList as unknown as CheckMatApi.StorageCheckMatVO[]
|
|
|
|
|
await CheckMatApi.createStorageMatBatch(dataMats, storageid.value)
|
|
|
|
|
|
|
|
|
|
if (formData.value.matItemDOList.length > 0) {
|
|
|
|
|
//附件信息保存
|
|
|
|
|
matUploadData.value.businessId = storageid
|
|
|
|
|
matUploadRef.value!.submit()
|
|
|
|
|
}
|
|
|
|
|
message.success(t(commonResult))
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const submitForm = async () => {
|
|
|
|
|
// 校验表单
|
|
|
|
|
await formRef.value.validate()
|
|
|
|
|
if (formData.value.matItemDOList.length === 0) {
|
|
|
|
|
message.alertWarning('请添加物料信息!')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 校验子表单
|
|
|
|
|
try {
|
|
|
|
|
await matSubFormRef.value.validate()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//保存表单数据
|
|
|
|
|
await saveFormData()
|
|
|
|
|
// 成功后刷新
|
|
|
|
|
query.id = storageid.value
|
|
|
|
|
query.type = 'update'
|
|
|
|
|
reload()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var matCount = 1
|
|
|
|
|
const onAddItem = () => {
|
|
|
|
|
if (formData.value.whId) {
|
|
|
|
|
const newData = {
|
|
|
|
|
// 新数据的属性
|
|
|
|
|
cid: matCount,
|
|
|
|
|
stockId: 0,
|
|
|
|
|
matId: '',
|
|
|
|
|
matName: '',
|
|
|
|
|
matCode: '',
|
|
|
|
|
matType: '',
|
|
|
|
|
matSpec: '',
|
|
|
|
|
matUnit: '',
|
|
|
|
|
whId: '',
|
|
|
|
|
rgId: '',
|
|
|
|
|
pnId: '',
|
|
|
|
|
pnlist: ref([]),
|
|
|
|
|
storageOkQty: '',
|
|
|
|
|
lotNo: '',
|
|
|
|
|
description: '',
|
|
|
|
|
productBomItemValueDOList: []
|
|
|
|
|
}
|
|
|
|
|
matCount = matCount + 1
|
|
|
|
|
|
|
|
|
|
formData.value.matItemDOList.push(newData)
|
|
|
|
|
} else {
|
|
|
|
|
message.alertWarning('请选择出库仓库')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除新增物料信息
|
|
|
|
|
const handleDelete2 = (index: number) => {
|
|
|
|
|
formData.value.matItemDOList.splice(index, 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//仓库全数据
|
|
|
|
|
const warehouseList = ref([])
|
|
|
|
|
//库区全数据
|
|
|
|
|
var rgList = ref([])
|
|
|
|
|
//库位全数据
|
|
|
|
|
var pnList = ref([])
|
|
|
|
|
const handleWh = async (wid) => {
|
|
|
|
|
//-------------------库区全数据
|
|
|
|
|
const queryParamsRg = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
whId: wid
|
|
|
|
|
})
|
|
|
|
|
const dataRg = await RgApi.getRgPage(queryParamsRg)
|
|
|
|
|
|
|
|
|
|
rgList.value = []
|
|
|
|
|
pnList.value = []
|
|
|
|
|
rgList.value = dataRg.list
|
|
|
|
|
|
|
|
|
|
const matLastRemoteData = await CheckMatApi.getStorageMatList()
|
|
|
|
|
|
|
|
|
|
let matParams = {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
status: '1'
|
|
|
|
|
}
|
|
|
|
|
const dataMat = await MatApi.getMaterialPage(matParams)
|
|
|
|
|
matList.value = []
|
|
|
|
|
matList.value = dataMat.list.filter(
|
|
|
|
|
(item) =>
|
|
|
|
|
matLastRemoteData.find((fish) => fish.matId === item.id && fish.whId == wid) !== undefined
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
formData.value.matItemDOList = []
|
|
|
|
|
// formData.value.matItemDOList.forEach(item => {
|
|
|
|
|
// item.rgId = ''
|
|
|
|
|
// item.pnId = ''
|
|
|
|
|
// item.pnlist.value = []
|
|
|
|
|
// })
|
|
|
|
|
//-------------------
|
|
|
|
|
}
|
|
|
|
|
const handleRg = async (scope) => {
|
|
|
|
|
//-------------------库位全数据
|
|
|
|
|
const queryParamsRPn = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
rgId: scope.row.rgId,
|
|
|
|
|
pnStatus: 1
|
|
|
|
|
})
|
|
|
|
|
const dataPn = await PnApi.getPnPage(queryParamsRPn)
|
|
|
|
|
scope.row.pnid = ''
|
|
|
|
|
scope.row.pnlist = dataPn.list
|
|
|
|
|
//-------------------
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const matList = ref<MatApi.MaterialVO[]>([]) // 物料列表
|
|
|
|
|
const matSelectLoading = ref(false)
|
|
|
|
|
const remoteMatCodeSearch = async (name) => {
|
|
|
|
|
matSelectLoading.value = true
|
|
|
|
|
// 获得用户列表
|
|
|
|
|
let matParams = {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
name: name,
|
|
|
|
|
status: '1'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const matLastRemoteData = await CheckMatApi.getStorageMatList()
|
|
|
|
|
|
|
|
|
|
const dataMat = await MatApi.getMaterialPage(matParams)
|
|
|
|
|
matList.value = []
|
|
|
|
|
matList.value = dataMat.list.filter(
|
|
|
|
|
(item) =>
|
|
|
|
|
matLastRemoteData.find(
|
|
|
|
|
(fish) => fish.matId === item.id && fish.whId == formData.value.whId
|
|
|
|
|
) !== undefined
|
|
|
|
|
)
|
|
|
|
|
matSelectLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleMatCode = async (scope, matid) => {
|
|
|
|
|
if (matid && matLastData.value.find((item) => item.matId === matid)) {
|
|
|
|
|
const matVo = matLastData.value.find((item) => item.matId === matid)
|
|
|
|
|
scope.row.matId = matVo.matId
|
|
|
|
|
scope.row.matName = matVo.matName
|
|
|
|
|
scope.row.matCode = matVo.matCode
|
|
|
|
|
scope.row.matSpec = matVo.matSpec
|
|
|
|
|
scope.row.matType = matVo.materialType
|
|
|
|
|
scope.row.matUnit = matVo.matUnit
|
|
|
|
|
scope.row.rgId = matVo.rgId
|
|
|
|
|
scope.row.pnId = matVo.pnId
|
|
|
|
|
scope.row.matRest = matVo.matRest
|
|
|
|
|
scope.row.storageOkQty = matVo.storageOkQty
|
|
|
|
|
scope.row.lotNo = matVo.lotNo
|
|
|
|
|
scope.row.description = matVo.description
|
|
|
|
|
|
|
|
|
|
const queryParamsRPn = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
rgId: scope.row.rgId,
|
|
|
|
|
pnStatus: 1
|
|
|
|
|
})
|
|
|
|
|
const dataPn = await PnApi.getPnPage(queryParamsRPn)
|
|
|
|
|
scope.row.pnlist = dataPn.list
|
|
|
|
|
} else {
|
|
|
|
|
scope.row.matId = ''
|
|
|
|
|
scope.row.matName = ''
|
|
|
|
|
scope.row.matCode = ''
|
|
|
|
|
scope.row.matSpec = ''
|
|
|
|
|
scope.row.matType = ''
|
|
|
|
|
scope.row.matUnit = ''
|
|
|
|
|
scope.row.rgId = ''
|
|
|
|
|
scope.row.pnId = ''
|
|
|
|
|
scope.row.matRest = ''
|
|
|
|
|
scope.row.storageOkQty = ''
|
|
|
|
|
scope.row.lotNo = ''
|
|
|
|
|
scope.row.description = ''
|
|
|
|
|
scope.row.pnlist = []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isShowBtnGroup = ref(true)
|
|
|
|
|
const isShowBtnCancel = ref(false)
|
|
|
|
|
const isShowBtnOther = ref(false)
|
|
|
|
|
const isShowBtnDelete = ref(true)
|
|
|
|
|
const btnWhClickable = ref(false)
|
|
|
|
|
const matLastData = ref([])
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
btnWhClickable.value = query.type === 'update' ? true : false
|
|
|
|
|
|
|
|
|
|
matLastData.value = await CheckMatApi.getStorageMatList()
|
|
|
|
|
|
|
|
|
|
// 获得物料列表
|
|
|
|
|
let matParams = {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
status: '1'
|
|
|
|
|
}
|
|
|
|
|
const dataMat = await MatApi.getMaterialPage(matParams)
|
|
|
|
|
matList.value = []
|
|
|
|
|
matList.value = dataMat.list
|
|
|
|
|
|
|
|
|
|
dialogTitle.value = t('action.' + query.type)
|
|
|
|
|
dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value
|
|
|
|
|
|
|
|
|
|
//-------------------仓库全数据
|
|
|
|
|
const data = await WhApi.getWarehouseSimpList()
|
|
|
|
|
warehouseList.value = data
|
|
|
|
|
//-------------------
|
|
|
|
|
if (query.id) {
|
|
|
|
|
//获取库存信息
|
|
|
|
|
formData.value = await CheckApi.getStorage(query.id)
|
|
|
|
|
|
|
|
|
|
switch (formData.value.status) {
|
|
|
|
|
case 1:
|
|
|
|
|
isShowBtnGroup.value = true
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnDelete.value = true
|
|
|
|
|
break
|
|
|
|
|
case 2:
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = true
|
|
|
|
|
isShowBtnOther.value = false
|
|
|
|
|
isShowBtnDelete.value = false
|
|
|
|
|
break
|
|
|
|
|
case 3:
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnOther.value = false
|
|
|
|
|
isShowBtnDelete.value = false
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
//查看页面不可以编辑
|
|
|
|
|
if (query.type === 'review') {
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnOther.value = false
|
|
|
|
|
isShowBtnDelete.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获得库区列表
|
|
|
|
|
const queryParamsRg = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
status: 1,
|
|
|
|
|
whId: formData.value.whId
|
|
|
|
|
})
|
|
|
|
|
const dataRg = await RgApi.getRgPage(queryParamsRg)
|
|
|
|
|
|
|
|
|
|
rgList.value = []
|
|
|
|
|
rgList.value = dataRg.list
|
|
|
|
|
//获得库区列表
|
|
|
|
|
const queryParamsPn = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99
|
|
|
|
|
})
|
|
|
|
|
const dataPn = await PnApi.getPnPage(queryParamsPn)
|
|
|
|
|
|
|
|
|
|
pnList.value = []
|
|
|
|
|
pnList.value = dataPn.list
|
|
|
|
|
|
|
|
|
|
//获取库存物料列表信息
|
|
|
|
|
const queryParamsMat = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
stockId: query.id
|
|
|
|
|
})
|
|
|
|
|
const dataMats = await CheckMatApi.getStorageMatPage(queryParamsMat)
|
|
|
|
|
formData.value.matItemDOList = dataMats.list
|
|
|
|
|
|
|
|
|
|
//获取原始物料信息
|
|
|
|
|
const queryParamsMat2 = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
status: 1
|
|
|
|
|
})
|
|
|
|
|
const matVos = await MatApi.getMaterialPage(queryParamsMat2)
|
|
|
|
|
|
|
|
|
|
formData.value.matItemDOList.forEach((item) => {
|
|
|
|
|
item.cid = matCount
|
|
|
|
|
item.matId = matVos.list.find((record) => record.id === item.matId)?.id
|
|
|
|
|
//item.matCode = matVos.list.find( (record) => record.id === item.matId)?.id
|
|
|
|
|
item.matCode = matVos.list.find((record) => record.id == item.matId)?.code
|
|
|
|
|
item.matSpec = matVos.list.find((record) => record.id == item.matId)?.spec
|
|
|
|
|
item.matType = matVos.list.find((record) => record.id == item.matId)?.materialType
|
|
|
|
|
item.matUnit = matVos.list.find((record) => record.id == item.matId)?.unit
|
|
|
|
|
item.pnlist = pnList.value.filter((pn) => pn.rgId == item.rgId)
|
|
|
|
|
item.matRest = matLastData.value.find(
|
|
|
|
|
(rest) => rest.rgId == item.rgId && rest.pnId == item.pnId
|
|
|
|
|
)?.matRest
|
|
|
|
|
item.matRest = item.matRest == undefined ? 0 : item.matRest
|
|
|
|
|
matCount = matCount + 1
|
|
|
|
|
|
|
|
|
|
// item = matLastData.value.find((rest) => rest.rgId === item.rgId && rest.pnId === item.pnId)
|
|
|
|
|
// item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId)
|
|
|
|
|
// item.cid = matCount
|
|
|
|
|
// matCount = matCount + 1
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 附件信息
|
|
|
|
|
let attParams = {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
businessId: query.id,
|
|
|
|
|
businessType: 'STORAGE'
|
|
|
|
|
}
|
|
|
|
|
formData.value.attachments = (await getFilePage(attParams)).list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//用户信息
|
|
|
|
|
userList.value = await UserApi.getSimpleUserList()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
a {
|
|
|
|
|
color: #409eff;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
}
|
|
|
|
|
</style>
|