# Conflicts:
#	mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue
#	mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageOut.vue
pull/1/head
siontion 9 months ago
commit a8ad9f1b56

@ -1182,8 +1182,9 @@ const submitForm = async (active) => {
router.back() router.back()
} else { } else {
// //
reload() query.active = 'update'
query.id = orderId query.id = orderId
reload()
} }
} finally { } finally {
formLoading.value = false formLoading.value = false

@ -1,10 +1,17 @@
<template> <template>
<!-- 入库 -->
<el-card class="hl-card"> <el-card class="hl-card">
<template #header> <template #header>
<span v-text="dialogTitle"></span> <span v-text="dialogTitle"></span>
</template> </template>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading" <el-form
v-bind:disabled="isShowBtnOther"> ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
v-bind:disabled="isShowBtnOther"
>
<!-- 基础信息 --> <!-- 基础信息 -->
<el-card class="hl-card-info"> <el-card class="hl-card-info">
<template #header> <template #header>
@ -23,22 +30,34 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="stockInType" label="入库类型"> <el-form-item prop="stockInType" label="入库类型">
<el-select v-model="formData.stockInType" clearable style="width: 100%"> <el-select v-model="formData.stockInType" clearable style="width: 100%">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)" :key="dict.value" <el-option
:label="dict.label" :value="dict.value" /> v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="industry" label="单据状态"> <el-form-item prop="industry" label="单据状态">
<el-select v-model="formData.status" placeholder="下拉选择" clearable class="!w-700px" disabled> <el-select
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_STATUS)" :key="dict.value" v-model="formData.status"
:label="dict.label" :value="dict.value" /> placeholder="下拉选择"
clearable
class="!w-700px"
disabled
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -50,7 +69,6 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-row> <el-row>
@ -62,21 +80,35 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="whId" label="入库仓库" required> <el-form-item prop="whId" label="入库仓库">
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh"> <el-select
<el-option v-for="dict in warehouseList" :key="dict.id" :label="dict.whName" :value="dict.id" /> v-model="formData.whId"
placeholder="下拉选择"
clearable
class="!w-400px"
@change="handleWh"
>
<el-option
v-for="dict in warehouseList"
:key="dict.id"
:label="dict.whName"
:value="dict.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="description"> <el-form-item label="备注" prop="description">
<el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" /> <el-input
type="textarea"
v-model="formData.description"
show-word-limit
maxlength="200"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -90,24 +122,51 @@
<el-col> <el-col>
<el-card class="hl-incard"> <el-card class="hl-incard">
<el-col> <el-col>
<el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem"></el-button> <el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem"
>新增</el-button
>
</el-col> </el-col>
<el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules" <el-form
v-loading="subFormLoading" label-width="0"> ref="matSubFormRef"
<el-table :data="formData.matItemDOList" class="hl-table"> :model="formData.matItemDOList"
<el-table-column prop="cid" label="序号" :width="80" /> :rules="subFormRules"
<el-table-column prop="matId" label="物料编码"> v-loading="subFormLoading"
label-width="0"
>
<el-table :data="formData.matItemDOList" class="hl-table" >
<el-table-column prop="cid" label="序号" min-width="80" align="center" fixed />
<el-table-column prop="matId" min-width="140" align="center">
<template #header> <span class="hl-table_header">*</span> 物料编码 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!"> <el-form-item
<el-select v-model="scope.row.matId" placeholder="物料编码" :remote-method="remoteMatCodeSearch" :prop="`${scope.$index}.matId`"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" :rules="subFormRules.matId"
@change="(val) => handleMatCode(scope, val)" class="!w-180px"> class="mb-0px!"
<el-option v-for="item in matList" :key="item.id" :label="item.code" :value="item.id" /> >
<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.code"
:value="item.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="matName" label="物料名称"> <el-table-column prop="matName" label="物料名称" min-width="120" align="center">
<!-- <template #default="scope"> <!-- <template #default="scope">
<el-input v-model="scope.row.matName" <el-input v-model="scope.row.matName"
:disabled="!scope.row.editable" /> :disabled="!scope.row.editable" />
@ -120,66 +179,108 @@
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column prop="matType" label="物料类型"> <el-table-column prop="matType" label="物料类型" align="center" min-width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" <dict-tag
v-if="scope.row.matType ? true : false" /> :type="DICT_TYPE.HELI_MATERIAL_TYPE"
:value="scope.row.matType"
v-if="scope.row.matType ? true : false"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="matSpec" label="规格/型号" /> <el-table-column
prop="matSpec"
<el-table-column prop="matUnit" label="系统单位"> label="规格/型号"
align="center"
min-width="120"
/>
<el-table-column prop="matUnit" label="系统单位" align="center" min-width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit" <dict-tag
v-if="scope.row.matUnit ? true : false" /> :type="DICT_TYPE.HELI_MATERIAL_UNIT"
:value="scope.row.matUnit"
v-if="scope.row.matUnit ? true : false"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rgId" width="140" label="入库库区" required> <el-table-column prop="rgId" align="center" min-width="120">
<template #header> <span class="hl-table_header">*</span> 入库库区 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!"> <el-form-item
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)"> :prop="`${scope.$index}.rgId`"
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" /> :rules="subFormRules.rgId"
class="mb-0px!"
>
<el-select
v-model="scope.row.rgId"
placeholder=""
style="width: 100%"
@change="handleRg(scope)"
>
<el-option
v-for="dict in rgList"
:key="dict.id"
:label="dict.rgName"
:value="dict.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="pnId" width="140" label="入库库位" required> <el-table-column prop="pnId" align="center" min-width="120">
<template #header> <span class="hl-table_header">*</span> 入库库位 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!"> <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-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" <el-option
:value="dict.id" /> v-for="dict in scope.row.pnlist"
:key="dict.id"
:label="dict.pnName"
:value="dict.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="storageOkQty" width="120" label="入库数量" required> <el-table-column prop="storageOkQty" align="center" min-width="120">
<template #header> <span class="hl-table_header">*</span> 入库数量 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty" <el-form-item
class="mb-0px!"> :prop="`${scope.$index}.storageOkQty`"
:rules="subFormRules.storageOkQty"
class="mb-0px!"
>
<el-input v-model="scope.row.storageOkQty" /> <el-input v-model="scope.row.storageOkQty" />
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lotNo" width="120" label="批次号"> <el-table-column prop="lotNo" label="批次号" align="center" min-width="120">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.lotNo" /> <el-input v-model="scope.row.lotNo" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="projectNo" width="120" label="子项目编号"> <el-table-column
prop="projectNo"
label="子项目编号"
align="center"
min-width="120"
>
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.projectNo" /> <el-input v-model="scope.row.projectNo" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="description" width="150" label="备注"> <el-table-column prop="description" label="备注" align="center" min-width="180" >
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.description" /> <el-input v-model="scope.row.description" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="240"> <el-table-column label="操作" align="center" min-width="120" fixed="right">
<template #default="scope"> <template #default="scope">
<!-- <el-button v-if="!scope.row.editable" type="primary" size="small" link <!-- <el-button v-if="!scope.row.editable" type="primary" size="small" link
@click="handleEdit(scope.$index)"> @click="handleEdit(scope.$index)">
@ -190,8 +291,12 @@
</el-button> </el-button>
<el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</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)" <el-button
v-bind:disabled="isShowBtnOther"> link
type="danger"
@click.prevent="handleDelete2(scope.$index)"
v-bind:disabled="isShowBtnOther"
>
删除 删除
</el-button> </el-button>
</template> </template>
@ -211,13 +316,24 @@
<el-col> <el-col>
<el-card class="hl-incard"> <el-card class="hl-incard">
<el-col> <el-col>
<el-upload ref="matUploadRef" :file-list="matUploadFiles" multiple :limit="10" :action="uploadUrl" <el-upload
:headers="{ 'Authorization': 'Bearer ' + getAccessToken(), 'tenant-id': getTenantId() }" name="files" ref="matUploadRef"
:show-file-list="false" :auto-upload="false" :data="matUploadData" :on-change="matUploadChange" :file-list="matUploadFiles"
class="upload-file-uploader"> multiple
<el-button type="primary"> :limit="10"
<Icon icon="ep:upload-filled" />上传 :action="uploadUrl"
</el-button> :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-upload>
</el-col> </el-col>
<el-table :data="formData.attachments" class="hl-table"> <el-table :data="formData.attachments" class="hl-table">
@ -227,18 +343,33 @@
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column prop="createTime" align="center" label="上传日期" :formatter="dateFormatter" /> <el-table-column
prop="createTime"
align="center"
label="上传日期"
:formatter="dateFormatter"
/>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button link type="danger" size="small" <el-button
link
type="danger"
size="small"
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)" @click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)"
v-bind:disabled="isShowBtnOther"> v-bind:disabled="isShowBtnOther"
>
删除 删除
</el-button> </el-button>
<el-button link type="primary" size="small" v-if="isShow" <el-button
@click="downloadAttachment(scope.row.name, scope.row.url)"> link
下载 </el-button> type="primary"
size="small"
v-if="isShow"
@click="downloadAttachment(scope.row.name, scope.row.url)"
>
下载
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -292,41 +423,58 @@
</el-form> </el-form>
<div class="text-center hl-footer"> <div class="text-center hl-footer">
<el-button @click="() => router.go(-1)" size="large"> </el-button> <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="submitForm"
<el-button @click="handleStatus(2)" v-if="isShowBtnGroup" type="primary" :disabled="formLoading" size="large"> v-if="isShowBtnGroup"
</el-button> type="success"
<el-button @click="handleStatus(3)" v-if="isShowBtnCancel" type="danger" :disabled="formLoading" size="large"> :disabled="formLoading"
</el-button> 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> </div>
</el-card> </el-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { useRoute } from "vue-router" import { useRoute } from 'vue-router'
import { dateFormatter, formatDate } from "@/utils/formatTime" import { dateFormatter, formatDate } from '@/utils/formatTime'
import type { UploadUserFile } from 'element-plus' import type { UploadUserFile } from 'element-plus'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as StorageApi from '@/api/heli/storage' import * as StorageApi from '@/api/heli/storage'
import * as StorageMatApi from '@/api/heli/storagemat' import * as StorageMatApi from '@/api/heli/storagemat'
import { getAccessToken, getTenantId } from "@/utils/auth" import { getAccessToken, getTenantId } from '@/utils/auth'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import * as MaterialApi from '@/api/heli/material' import * as MaterialApi from '@/api/heli/material'
import * as WarehouseApi from '@/api/heli/warehouse' import * as WarehouseApi from '@/api/heli/warehouse'
import * as RgApi from '@/api/heli/rg' import * as RgApi from '@/api/heli/rg'
import * as PnApi from '@/api/heli/pn' import * as PnApi from '@/api/heli/pn'
import { deleteFile, downloadFile, getFilePage } from "@/api/infra/file" import { deleteFile, downloadFile, getFilePage } from '@/api/infra/file'
import download from "@/utils/download" import download from '@/utils/download'
import * as UserApi from "@/api/system/user"; import * as UserApi from '@/api/system/user'
const reload = inject('reload') const reload = inject('reload')
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const { query } = useRoute() const { query } = useRoute()
const router = useRouter(); const router = useRouter()
const isShow = ref(false) const isShow = ref(false)
const dialogTitle = ref('') // const dialogTitle = ref('') //
@ -367,11 +515,9 @@ const subFormRules = reactive({
matId: [{ required: true, message: '物料不能为空', trigger: 'blur' }], matId: [{ required: true, message: '物料不能为空', trigger: 'blur' }],
rgId: [{ required: true, message: '库区不能为空', trigger: 'blur' }], rgId: [{ required: true, message: '库区不能为空', trigger: 'blur' }],
pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }], pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }],
storageOkQty: [{ required: true, message: '入库数量不能为空', trigger: 'blur' }], storageOkQty: [{ required: true, message: '入库数量不能为空', trigger: 'blur' }]
}) })
const handleStatus = (async (num) => { const handleStatus = async (num) => {
formData.value.status = num formData.value.status = num
const dataUpdate = formData.value as unknown as StorageApi.StorageVO const dataUpdate = formData.value as unknown as StorageApi.StorageVO
@ -388,41 +534,45 @@ const handleStatus = (async (num) => {
switch (num) { switch (num) {
case 1: case 1:
isShowBtnGroup.value = true; isShowBtnGroup.value = true
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break break
case 2: case 2:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = true; isShowBtnCancel.value = true
break break
case 3: case 3:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break; break
default: default:
break break
} }
// //
if (query.type === 'review') { if (query.type === 'review') {
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
isShowBtnOther.value = true; isShowBtnOther.value = true
} }
query.type= 'update' query.type= 'update'
query.id = storageid.value query.id = storageid.value
formData.value.id = storageid.value formData.value.id = storageid.value
reload(); reload();
}) })
const userList = ref<UserApi.UserVO[]>([]) // const userList = ref<UserApi.UserVO[]>([]) //
// ==================== ======================================= // ==================== =======================================
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL) const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
const matUploadRef = ref(); const matUploadRef = ref()
const matUploadFiles = ref<UploadUserFile[]>([]); const matUploadFiles = ref<UploadUserFile[]>([])
const matUploadData = ref({ businessType: 'STORAGE', businessId: formData.value.id, businessFileType: 'MATERIAL' }) const matUploadData = ref({
businessType: 'STORAGE',
businessId: formData.value.id,
businessFileType: 'MATERIAL'
})
const matUploadChange = (file, files) => { const matUploadChange = (file, files) => {
matUploadFiles.value = files; matUploadFiles.value = files
refreshAttachments(files, 'MATERIAL') refreshAttachments(files, 'MATERIAL')
} }
@ -431,28 +581,28 @@ const refreshAttachments = (files, type) => {
return value.id return value.id
}) })
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
let file = files[i]; let file = files[i]
file.businessFileType = type; file.businessFileType = type
file.createTime = new Date(); file.createTime = new Date()
formData.value.attachments.push(file); formData.value.attachments.push(file)
} }
// //
formData.value.attachments.sort((v1, v2) => { formData.value.attachments.sort((v1, v2) => {
return (v1.createTime - v2.createTime) > 0 return v1.createTime - v2.createTime > 0
}) })
} }
// //
const handleDeleteAttachment = async (index, type) => { const handleDeleteAttachment = async (index, type) => {
const deletedAttachments = formData.value.attachments.splice(index, 1); const deletedAttachments = formData.value.attachments.splice(index, 1)
for (let i = 0; i < deletedAttachments.length; i++) { for (let i = 0; i < deletedAttachments.length; i++) {
const attachment = deletedAttachments[i]; const attachment = deletedAttachments[i]
if (attachment.id) { if (attachment.id) {
// //
await deleteFile(attachment.id); await deleteFile(attachment.id)
} }
// //
matUploadFiles.value = matUploadFiles.value.filter(file1 => { matUploadFiles.value = matUploadFiles.value.filter((file1) => {
return file1.name != attachment.name || file1.businessFileType != type; return file1.name != attachment.name || file1.businessFileType != type
}) })
} }
} }
@ -460,7 +610,7 @@ const handleDeleteAttachment = async (index, type) => {
const downloadAttachment = async (name, url) => { const downloadAttachment = async (name, url) => {
if (url) { if (url) {
const data = await downloadFile(url) const data = await downloadFile(url)
download.any(data, name); download.any(data, name)
} }
} }
// ==================== ======================================= // ==================== =======================================
@ -484,18 +634,16 @@ const submitForm = async () => {
try { try {
const data = formData.value as unknown as StorageApi.StorageVO const data = formData.value as unknown as StorageApi.StorageVO
if (query.type === 'create') { if (query.type === 'create') {
// //
storageid.value = await StorageApi.createStorage(data) storageid.value = await StorageApi.createStorage(data)
commonResult = 'common.createSuccess' commonResult = 'common.createSuccess'
} else { } else {
storageid.value = data.id storageid.value = data.id
await StorageApi.updateStorage(data) await StorageApi.updateStorage(data)
commonResult = 'common.updateSuccess' commonResult = 'common.updateSuccess'
} }
// //
formData.value.matItemDOList.forEach(item => { formData.value.matItemDOList.forEach((item) => {
item.stockId = storageid.value item.stockId = storageid.value
item.whId = formData.value.whId item.whId = formData.value.whId
}) })
@ -510,7 +658,6 @@ const submitForm = async () => {
message.success(t(commonResult)) message.success(t(commonResult))
// //
query.type= 'update' query.type= 'update'
query.id = storageid.value query.id = storageid.value
@ -545,7 +692,6 @@ const onAddItem = () => {
} }
matCount = matCount + 1 matCount = matCount + 1
formData.value.matItemDOList.push(newData) formData.value.matItemDOList.push(newData)
} }
// //
@ -559,7 +705,7 @@ const warehouseList = ref([])
var rgList = ref([]) var rgList = ref([])
// //
var pnList = ref([]) var pnList = ref([])
const handleWh = (async (wid) => { const handleWh = async (wid) => {
//------------------- //-------------------
const queryParamsRg = reactive({ const queryParamsRg = reactive({
pageNo: 1, pageNo: 1,
@ -572,14 +718,14 @@ const handleWh = (async (wid) => {
pnList.value = [] pnList.value = []
rgList.value = dataRg.list rgList.value = dataRg.list
formData.value.matItemDOList.forEach(item => { formData.value.matItemDOList.forEach((item) => {
item.rgId = '' item.rgId = ''
item.pnId = '' item.pnId = ''
item.pnlist.value = [] item.pnlist.value = []
}) })
//------------------- //-------------------
}) }
const handleRg = (async (scope) => { const handleRg = async (scope) => {
//------------------- //-------------------
const queryParamsRPn = reactive({ const queryParamsRPn = reactive({
pageNo: 1, pageNo: 1,
@ -591,10 +737,10 @@ const handleRg = (async (scope) => {
scope.row.pnid = '' scope.row.pnid = ''
scope.row.pnlist = dataPn.list scope.row.pnlist = dataPn.list
//------------------- //-------------------
}) }
const matList = ref<MaterialApi.MaterialVO[]>([]) // const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matSelectLoading = ref(false); const matSelectLoading = ref(false)
const remoteMatCodeSearch = async (code) => { const remoteMatCodeSearch = async (code) => {
matSelectLoading.value = true matSelectLoading.value = true
// //
@ -602,17 +748,15 @@ const remoteMatCodeSearch = async (code) => {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
code: code, code: code,
status: "1" status: '1'
} }
const dataMat = await MaterialApi.getMaterialPage(matParams) const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = [] matList.value = []
matList.value = dataMat.list matList.value = dataMat.list
matSelectLoading.value = false matSelectLoading.value = false
} }
const handleMatCode = async (scope, matid) => { const handleMatCode = async (scope, matid) => {
if (matid) { if (matid) {
const matVo = await MaterialApi.getMaterial(scope.row.matId) const matVo = await MaterialApi.getMaterial(scope.row.matId)
scope.row.matId = matVo.id scope.row.matId = matVo.id
@ -636,23 +780,21 @@ const isShowBtnOther = ref(false)
const btnWhClickable = ref(false) const btnWhClickable = ref(false)
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
// //
let matParams = { let matParams = {
pageNo: 1, pageNo: 1,
pageSize: 99, pageSize: 99,
status: "1" status: '1'
} }
const dataMat = await MaterialApi.getMaterialPage(matParams) const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = [] matList.value = []
matList.value = dataMat.list matList.value = dataMat.list
dialogTitle.value = t('action.' + query.type) dialogTitle.value = t('action.' + query.type)
dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value
isShow.value = query.type == "create" ? false : true isShow.value = query.type == 'create' ? false : true
//------------------- //-------------------
const data = await WarehouseApi.getWarehouseSimpList() const data = await WarehouseApi.getWarehouseSimpList()
@ -664,25 +806,25 @@ onMounted(async () => {
switch (formData.value.status) { switch (formData.value.status) {
case 1: case 1:
isShowBtnGroup.value = true; isShowBtnGroup.value = true
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break break
case 2: case 2:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = true; isShowBtnCancel.value = true
break break
case 3: case 3:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break; break
default: default:
break break
} }
// //
if (query.type === 'review') { if (query.type === 'review') {
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
isShowBtnOther.value = true; isShowBtnOther.value = true
} }
// //
@ -723,7 +865,7 @@ onMounted(async () => {
}) })
const matVos = await MaterialApi.getMaterialPage(queryParamsMat2) const matVos = await MaterialApi.getMaterialPage(queryParamsMat2)
formData.value.matItemDOList.forEach(item => { formData.value.matItemDOList.forEach((item) => {
item.cid = matCount item.cid = matCount
item.matId = matVos.list.find((record) => record.id === item.matId)?.id 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)?.id
@ -735,7 +877,6 @@ onMounted(async () => {
matCount = matCount + 1 matCount = matCount + 1
}) })
// //
let attParams = { let attParams = {
pageNo: 1, pageNo: 1,
@ -743,12 +884,11 @@ onMounted(async () => {
businessId: query.id, businessId: query.id,
businessType: 'STORAGE' businessType: 'STORAGE'
} }
formData.value.attachments = (await getFilePage(attParams)).list; formData.value.attachments = (await getFilePage(attParams)).list
} }
// //
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })
</script> </script>
<style> <style>

@ -1,10 +1,17 @@
<template> <template>
<!-- 出库 -->
<el-card class="hl-card"> <el-card class="hl-card">
<template #header> <template #header>
<span v-text="dialogTitle"></span> <span v-text="dialogTitle"></span>
</template> </template>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading" <el-form
v-bind:disabled="isShowBtnOther"> ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
v-bind:disabled="isShowBtnOther"
>
<!-- 基础信息 --> <!-- 基础信息 -->
<el-card class="hl-card-info"> <el-card class="hl-card-info">
<template #header> <template #header>
@ -23,21 +30,34 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="stockInType" label="出库类型"> <el-form-item prop="stockInType" label="出库类型">
<el-select v-model="formData.stockInType" clearable style="width: 100%"> <el-select v-model="formData.stockInType" clearable style="width: 100%">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_OUT_TYPE)" :key="dict.value" <el-option
:label="dict.label" :value="dict.value" /> v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_OUT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="industry" label="单据状态"> <el-form-item prop="industry" label="单据状态">
<el-select v-model="formData.status" placeholder="下拉选择" clearable class="!w-700px" disabled> <el-select
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_STATUS)" :key="dict.value" v-model="formData.status"
:label="dict.label" :value="dict.value" /> placeholder="下拉选择"
clearable
class="!w-700px"
disabled
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -49,10 +69,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="单据日期" prop="createTime"> <el-form-item label="单据日期" prop="createTime">
@ -63,21 +81,35 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="whId" label="出库仓库" required> <el-form-item prop="whId" label="出库仓库" required>
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" <el-select
v-bind:disabled="btnWhClickable"> v-model="formData.whId"
<el-option v-for="dict in warehouseList" :key="dict.id" :label="dict.whName" :value="dict.id" /> placeholder="下拉选择"
clearable
class="!w-400px"
@change="handleWh"
v-bind:disabled="btnWhClickable"
>
<el-option
v-for="dict in warehouseList"
:key="dict.id"
:label="dict.whName"
:value="dict.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="description"> <el-form-item label="备注" prop="description">
<el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" /> <el-input
type="textarea"
v-model="formData.description"
show-word-limit
maxlength="200"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -91,71 +123,130 @@
<el-col> <el-col>
<el-card class="hl-incard"> <el-card class="hl-incard">
<el-col> <el-col>
<el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem"></el-button> <el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem"
>新增</el-button
>
</el-col> </el-col>
<el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules" <el-form
v-loading="subFormLoading" label-width="0"> ref="matSubFormRef"
:model="formData.matItemDOList"
:rules="subFormRules"
v-loading="subFormLoading"
label-width="0"
>
<el-table :data="formData.matItemDOList" class="hl-table"> <el-table :data="formData.matItemDOList" class="hl-table">
<el-table-column prop="cid" label="序号" :width="80" /> <el-table-column prop="cid" label="序号" :width="80" />
<el-table-column prop="matId" label="物料名称" :width="150"> <el-table-column prop="matId" min-width="140" align="center">
<template #header> <span class="hl-table_header">*</span>物料名称 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!"> <el-form-item
<el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch" :prop="`${scope.$index}.matId`"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" :rules="subFormRules.matId"
@change="(val) => handleMatCode(scope, val)" class="!w-180px"> class="mb-0px!"
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" /> >
<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-select>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="matCode" label="物料编码" /> <el-table-column prop="matCode" label="物料编码" min-width="120" align="center" />
<el-table-column prop="matType" label="物料类型"> <el-table-column prop="matType" label="物料类型" min-width="120" align="center">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" <dict-tag
v-if="scope.row.matType ? true : false" /> :type="DICT_TYPE.HELI_MATERIAL_TYPE"
:value="scope.row.matType"
v-if="scope.row.matType ? true : false"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="matSpec" label="规格/型号" /> <el-table-column prop="matSpec" label="规格/型号" min-width="120" align="center" />
<el-table-column prop="matUnit" label="系统单位"> <el-table-column prop="matUnit" label="系统单位" min-width="120" align="center">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit" <dict-tag
v-if="scope.row.matUnit ? true : false" /> :type="DICT_TYPE.HELI_MATERIAL_UNIT"
:value="scope.row.matUnit"
v-if="scope.row.matUnit ? true : false"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rgId" width="140" label="出库库区" required> <el-table-column prop="rgId" min-width="120" align="center">
<template #header> <span class="hl-table_header">*</span>出库库区 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!"> <el-form-item
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)" :prop="`${scope.$index}.rgId`"
disabled=""> :rules="subFormRules.rgId"
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" /> 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-select>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="pnId" width="140" label="出库库位" required> <el-table-column prop="pnId" min-width="140" align="center">
<template #header> <span class="hl-table_header">*</span>出库库位 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!"> <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-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" <el-option
:value="dict.id" /> v-for="dict in scope.row.pnlist"
:key="dict.id"
:label="dict.pnName"
:value="dict.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="matRest" label="库存数量" /> <el-table-column prop="matRest" label="库存数量" min-width="120" align="center" />
<el-table-column prop="storageOkQty" width="120" label="出库数量" required> <el-table-column prop="storageOkQty" min-width="120" align="center">
<template #header> <span class="hl-table_header">*</span>出库数量</template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty" <el-form-item
class="mb-0px!"> :prop="`${scope.$index}.storageOkQty`"
:rules="subFormRules.storageOkQty"
class="mb-0px!"
>
<el-input v-model="scope.row.storageOkQty" /> <el-input v-model="scope.row.storageOkQty" />
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lotNo" width="120" label="批次号" /> <el-table-column prop="lotNo" min-width="120" label="批次号" align="center" />
<el-table-column prop="description" width="150" label="备注"> <el-table-column prop="description" min-width="180" label="备注" align="center">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.description" /> <el-input v-model="scope.row.description" />
</template> </template>
@ -171,8 +262,13 @@
</el-button> </el-button>
<el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</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)" <el-button
v-bind:disabled="isShowBtnOther"> link
type="danger"
size="small"
@click.prevent="handleDelete2(scope.$index)"
v-bind:disabled="isShowBtnOther"
>
删除 删除
</el-button> </el-button>
</template> </template>
@ -192,13 +288,24 @@
<el-col> <el-col>
<el-card class="hl-incard"> <el-card class="hl-incard">
<el-col> <el-col>
<el-upload ref="matUploadRef" :file-list="matUploadFiles" multiple :limit="10" :action="uploadUrl" <el-upload
:headers="{ 'Authorization': 'Bearer ' + getAccessToken(), 'tenant-id': getTenantId() }" name="files" ref="matUploadRef"
:show-file-list="false" :auto-upload="false" :data="matUploadData" :on-change="matUploadChange" :file-list="matUploadFiles"
class="upload-file-uploader"> multiple
<el-button type="primary"> :limit="10"
<Icon icon="ep:upload-filled" />上传 :action="uploadUrl"
</el-button> :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-upload>
</el-col> </el-col>
<el-table :data="formData.attachments" class="hl-table"> <el-table :data="formData.attachments" class="hl-table">
@ -208,17 +315,33 @@
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column prop="createTime" align="center" label="上传日期" :formatter="dateFormatter" /> <el-table-column
prop="createTime"
align="center"
label="上传日期"
:formatter="dateFormatter"
/>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button link type="danger" size="small" v-bind:disabled="isShowBtnOther" <el-button
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)"> link
type="danger"
size="small"
v-bind:disabled="isShowBtnOther"
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)"
>
删除 删除
</el-button> </el-button>
<el-button link type="primary" size="small" v-if="isShow" <el-button
@click="downloadAttachment(scope.row.name, scope.row.url)"> link
下载 </el-button> type="primary"
size="small"
v-if="isShow"
@click="downloadAttachment(scope.row.name, scope.row.url)"
>
下载
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -272,41 +395,58 @@
</el-form> </el-form>
<div class="text-center hl-footer"> <div class="text-center hl-footer">
<el-button @click="() => router.go(-1)" size="large"> </el-button> <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="submitForm"
<el-button @click="handleStatus(2)" v-if="isShowBtnGroup" type="primary" :disabled="formLoading" size="large"> v-if="isShowBtnGroup"
</el-button> type="success"
<el-button @click="handleStatus(3)" v-if="isShowBtnCancel" type="danger" :disabled="formLoading" size="large"> :disabled="formLoading"
</el-button> 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> </div>
</el-card> </el-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { useRoute } from "vue-router" import { useRoute } from 'vue-router'
import { dateFormatter, formatDate } from "@/utils/formatTime" import { dateFormatter, formatDate } from '@/utils/formatTime'
import type { UploadUserFile } from 'element-plus' import type { UploadUserFile } from 'element-plus'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as StorageApi from '@/api/heli/storage' import * as StorageApi from '@/api/heli/storage'
import * as StorageMatApi from '@/api/heli/storagemat' import * as StorageMatApi from '@/api/heli/storagemat'
import { getAccessToken, getTenantId } from "@/utils/auth" import { getAccessToken, getTenantId } from '@/utils/auth'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import * as MaterialApi from '@/api/heli/material' import * as MaterialApi from '@/api/heli/material'
import * as WarehouseApi from '@/api/heli/warehouse' import * as WarehouseApi from '@/api/heli/warehouse'
import * as RgApi from '@/api/heli/rg' import * as RgApi from '@/api/heli/rg'
import * as PnApi from '@/api/heli/pn' import * as PnApi from '@/api/heli/pn'
import { deleteFile, downloadFile, getFilePage } from "@/api/infra/file" import { deleteFile, downloadFile, getFilePage } from '@/api/infra/file'
import download from "@/utils/download" import download from '@/utils/download'
import * as UserApi from "@/api/system/user"; import * as UserApi from '@/api/system/user'
const reload = inject('reload') const reload = inject('reload')
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const { query } = useRoute() const { query } = useRoute()
const router = useRouter(); const router = useRouter()
const isShow = ref(false) const isShow = ref(false)
const dialogTitle = ref('') // const dialogTitle = ref('') //
@ -348,11 +488,9 @@ const subFormRules = reactive({
matId: [{ required: true, message: '物料不能为空', trigger: 'blur' }], matId: [{ required: true, message: '物料不能为空', trigger: 'blur' }],
rgId: [{ required: true, message: '库区不能为空', trigger: 'blur' }], rgId: [{ required: true, message: '库区不能为空', trigger: 'blur' }],
pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }], pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }],
storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }], storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }]
}) })
const handleStatus = (async (num) => { const handleStatus = async (num) => {
formData.value.status = num formData.value.status = num
const dataUpdate = formData.value as unknown as StorageApi.StorageVO const dataUpdate = formData.value as unknown as StorageApi.StorageVO
@ -367,40 +505,44 @@ const handleStatus = (async (num) => {
switch (num) { switch (num) {
case 1: case 1:
isShowBtnGroup.value = true; isShowBtnGroup.value = true
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break break
case 2: case 2:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = true; isShowBtnCancel.value = true
break break
case 3: case 3:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break; break
default: default:
break break
} }
// //
if (query.type === 'review') { if (query.type === 'review') {
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
isShowBtnOther.value = true; isShowBtnOther.value = true
} }
query.id = storageid.value query.id = storageid.value
query.type= 'update' query.type= 'update'
formData.value.id = storageid.value formData.value.id = storageid.value
reload() reload()
}) }
const userList = ref<UserApi.UserVO[]>([]) // const userList = ref<UserApi.UserVO[]>([]) //
// ==================== ======================================= // ==================== =======================================
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL) const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
const matUploadRef = ref(); const matUploadRef = ref()
const matUploadFiles = ref<UploadUserFile[]>([]); const matUploadFiles = ref<UploadUserFile[]>([])
const matUploadData = ref({ businessType: 'STORAGE', businessId: formData.value.id, businessFileType: 'MATERIAL' }) const matUploadData = ref({
businessType: 'STORAGE',
businessId: formData.value.id,
businessFileType: 'MATERIAL'
})
const matUploadChange = (file, files) => { const matUploadChange = (file, files) => {
matUploadFiles.value = files; matUploadFiles.value = files
refreshAttachments(files, 'MATERIAL') refreshAttachments(files, 'MATERIAL')
} }
@ -409,28 +551,28 @@ const refreshAttachments = (files, type) => {
return value.id return value.id
}) })
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
let file = files[i]; let file = files[i]
file.businessFileType = type; file.businessFileType = type
file.createTime = new Date(); file.createTime = new Date()
formData.value.attachments.push(file); formData.value.attachments.push(file)
} }
// //
formData.value.attachments.sort((v1, v2) => { formData.value.attachments.sort((v1, v2) => {
return (v1.createTime - v2.createTime) > 0 return v1.createTime - v2.createTime > 0
}) })
} }
// //
const handleDeleteAttachment = async (index, type) => { const handleDeleteAttachment = async (index, type) => {
const deletedAttachments = formData.value.attachments.splice(index, 1); const deletedAttachments = formData.value.attachments.splice(index, 1)
for (let i = 0; i < deletedAttachments.length; i++) { for (let i = 0; i < deletedAttachments.length; i++) {
const attachment = deletedAttachments[i]; const attachment = deletedAttachments[i]
if (attachment.id) { if (attachment.id) {
// //
await deleteFile(attachment.id); await deleteFile(attachment.id)
} }
// //
matUploadFiles.value = matUploadFiles.value.filter(file1 => { matUploadFiles.value = matUploadFiles.value.filter((file1) => {
return file1.name != attachment.name || file1.businessFileType != type; return file1.name != attachment.name || file1.businessFileType != type
}) })
} }
} }
@ -438,7 +580,7 @@ const handleDeleteAttachment = async (index, type) => {
const downloadAttachment = async (name, url) => { const downloadAttachment = async (name, url) => {
if (url) { if (url) {
const data = await downloadFile(url) const data = await downloadFile(url)
download.any(data, name); download.any(data, name)
} }
} }
// ==================== ======================================= // ==================== =======================================
@ -462,8 +604,14 @@ const submitForm = async () => {
const matCurrentData = await StorageMatApi.getStorageMatList() const matCurrentData = await StorageMatApi.getStorageMatList()
var hasRestNum = true var hasRestNum = true
formData.value.matItemDOList.forEach((rest) => { formData.value.matItemDOList.forEach((rest) => {
if (
if (matCurrentData.find(mat => mat.matId == rest.matId && mat.pnId == rest.pnId && mat.matRest < Number(rest.storageOkQty))) { matCurrentData.find(
(mat) =>
mat.matId == rest.matId &&
mat.pnId == rest.pnId &&
mat.matRest < Number(rest.storageOkQty)
)
) {
hasRestNum = false hasRestNum = false
} }
}) })
@ -472,24 +620,21 @@ const submitForm = async () => {
return return
} }
// //
formLoading.value = true formLoading.value = true
try { try {
const data = formData.value as unknown as StorageApi.StorageVO const data = formData.value as unknown as StorageApi.StorageVO
if (query.type === 'create') { if (query.type === 'create') {
// //
storageid.value = await StorageApi.createStorage(data) storageid.value = await StorageApi.createStorage(data)
commonResult = 'common.createSuccess' commonResult = 'common.createSuccess'
} else { } else {
storageid.value = data.id storageid.value = data.id
await StorageApi.updateStorage(data) await StorageApi.updateStorage(data)
commonResult = 'common.updateSuccess' commonResult = 'common.updateSuccess'
} }
// //
formData.value.matItemDOList.forEach(item => { formData.value.matItemDOList.forEach((item) => {
item.stockId = storageid.value item.stockId = storageid.value
item.whId = formData.value.whId item.whId = formData.value.whId
}) })
@ -504,7 +649,6 @@ const submitForm = async () => {
message.success(t(commonResult)) message.success(t(commonResult))
// //
query.id = storageid.value query.id = storageid.value
query.type= 'update' query.type= 'update'
@ -539,10 +683,10 @@ const onAddItem = () => {
} }
matCount = matCount + 1 matCount = matCount + 1
formData.value.matItemDOList.push(newData) formData.value.matItemDOList.push(newData)
} else { } else {
message.alertWarning('选择出库仓库') message.alertWarning('选择出库仓库')
} }
} }
@ -557,7 +701,7 @@ const warehouseList = ref([])
var rgList = ref([]) var rgList = ref([])
// //
var pnList = ref([]) var pnList = ref([])
const handleWh = (async (wid) => { const handleWh = async (wid) => {
//------------------- //-------------------
const queryParamsRg = reactive({ const queryParamsRg = reactive({
pageNo: 1, pageNo: 1,
@ -588,8 +732,8 @@ const handleWh = (async (wid) => {
// item.pnlist.value = [] // item.pnlist.value = []
// }) // })
//------------------- //-------------------
}) }
const handleRg = (async (scope) => { const handleRg = async (scope) => {
//------------------- //-------------------
const queryParamsRPn = reactive({ const queryParamsRPn = reactive({
pageNo: 1, pageNo: 1,
@ -601,10 +745,10 @@ const handleRg = (async (scope) => {
scope.row.pnid = '' scope.row.pnid = ''
scope.row.pnlist = dataPn.list scope.row.pnlist = dataPn.list
//------------------- //-------------------
}) }
const matList = ref<MaterialApi.MaterialVO[]>([]) // const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matSelectLoading = ref(false); const matSelectLoading = ref(false)
const remoteMatCodeSearch = async (name) => { const remoteMatCodeSearch = async (name) => {
matSelectLoading.value = true matSelectLoading.value = true
// //
@ -612,7 +756,7 @@ const remoteMatCodeSearch = async (name) => {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
name: name, name: name,
status: "1" status: '1'
} }
const matLastRemoteData = await StorageMatApi.getStorageMatList() const matLastRemoteData = await StorageMatApi.getStorageMatList()
@ -621,11 +765,9 @@ const remoteMatCodeSearch = async (name) => {
matList.value = [] matList.value = []
matList.value = dataMat.list.filter((item) => matLastRemoteData.find((fish) => fish.matId === item.id && fish.whId == formData.value.whId) !== undefined) matList.value = dataMat.list.filter((item) => matLastRemoteData.find((fish) => fish.matId === item.id && fish.whId == formData.value.whId) !== undefined)
matSelectLoading.value = false matSelectLoading.value = false
} }
const handleMatCode = async (scope, matid) => { const handleMatCode = async (scope, matid) => {
if (matid && matLastData.value.find((item) => item.matId === matid)) { if (matid && matLastData.value.find((item) => item.matId === matid)) {
const matVo = matLastData.value.find((item) => item.matId === matid) const matVo = matLastData.value.find((item) => item.matId === matid)
scope.row.matId = matVo.matId scope.row.matId = matVo.matId
@ -673,7 +815,6 @@ const btnWhClickable = ref(false)
const matLastData = ref([]) const matLastData = ref([])
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
btnWhClickable.value = query.type === 'update' ? true : false btnWhClickable.value = query.type === 'update' ? true : false
matLastData.value = await StorageMatApi.getStorageMatList() matLastData.value = await StorageMatApi.getStorageMatList()
@ -682,17 +823,16 @@ onMounted(async () => {
let matParams = { let matParams = {
pageNo: 1, pageNo: 1,
pageSize: 99, pageSize: 99,
status: "1" status: '1'
} }
const dataMat = await MaterialApi.getMaterialPage(matParams) const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = [] matList.value = []
matList.value = dataMat.list matList.value = dataMat.list
dialogTitle.value = t('action.' + query.type) dialogTitle.value = t('action.' + query.type)
dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value
isShow.value = query.type == "create" ? false : true isShow.value = query.type == 'create' ? false : true
//------------------- //-------------------
const data = await WarehouseApi.getWarehouseSimpList() const data = await WarehouseApi.getWarehouseSimpList()
@ -704,25 +844,25 @@ onMounted(async () => {
switch (formData.value.status) { switch (formData.value.status) {
case 1: case 1:
isShowBtnGroup.value = true; isShowBtnGroup.value = true
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break break
case 2: case 2:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = true; isShowBtnCancel.value = true
break break
case 3: case 3:
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
break; break
default: default:
break break
} }
// //
if (query.type === 'review') { if (query.type === 'review') {
isShowBtnGroup.value = false; isShowBtnGroup.value = false
isShowBtnCancel.value = false; isShowBtnCancel.value = false
isShowBtnOther.value = true; isShowBtnOther.value = true
} }
// //
@ -763,7 +903,7 @@ onMounted(async () => {
}) })
const matVos = await MaterialApi.getMaterialPage(queryParamsMat2) const matVos = await MaterialApi.getMaterialPage(queryParamsMat2)
formData.value.matItemDOList.forEach(item => { formData.value.matItemDOList.forEach((item) => {
item.cid = matCount item.cid = matCount
item.matId = matVos.list.find((record) => record.id === item.matId)?.id 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)?.id
@ -772,18 +912,18 @@ onMounted(async () => {
item.matType = matVos.list.find((record) => record.id == item.matId)?.materialType item.matType = matVos.list.find((record) => record.id == item.matId)?.materialType
item.matUnit = matVos.list.find((record) => record.id == item.matId)?.unit item.matUnit = matVos.list.find((record) => record.id == item.matId)?.unit
item.pnlist = pnList.value.filter((pn) => pn.rgId == item.rgId) 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 = matLastData.value.find(
(rest) => rest.rgId == item.rgId && rest.pnId == item.pnId
)?.matRest
item.matRest = item.matRest == undefined ? 0 : item.matRest item.matRest = item.matRest == undefined ? 0 : item.matRest
matCount = matCount + 1 matCount = matCount + 1
// item = matLastData.value.find((rest) => rest.rgId === item.rgId && rest.pnId === item.pnId) // item = matLastData.value.find((rest) => rest.rgId === item.rgId && rest.pnId === item.pnId)
// item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId) // item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId)
// item.cid = matCount // item.cid = matCount
// matCount = matCount + 1 // matCount = matCount + 1
}) })
// //
let attParams = { let attParams = {
pageNo: 1, pageNo: 1,
@ -791,12 +931,11 @@ onMounted(async () => {
businessId: query.id, businessId: query.id,
businessType: 'STORAGE' businessType: 'STORAGE'
} }
formData.value.attachments = (await getFilePage(attParams)).list; formData.value.attachments = (await getFilePage(attParams)).list
} }
// //
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })
</script> </script>
<style> <style>

@ -108,20 +108,20 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table">
<!-- <el-table-column label="主键id" align="center" prop="id" /> --> <!-- <el-table-column label="主键id" align="center" prop="id" /> -->
<el-table-column label="入库单号" align="center" prop="stockNo" /> <el-table-column label="入库单号" align="center" prop="stockNo" min-width="140" fixed />
<el-table-column label="入库类型" align="center" prop="stockInType"> <el-table-column label="入库类型" align="center" prop="stockInType" min-width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_STORAGE_IN_TYPE" :value="scope.row.stockInType" /> <dict-tag :type="DICT_TYPE.HELI_STORAGE_IN_TYPE" :value="scope.row.stockInType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上游单号" align="center" prop="headerNo" /> <el-table-column label="上游单号" align="center" prop="headerNo" min-width="100" />
<el-table-column label="入库仓库" align="center" prop="whId"> <el-table-column label="入库仓库" align="center" prop="whId" min-width="120">
<template #default="scope"> <template #default="scope">
{{ warehouseList.find((tag) => tag.id === scope.row.whId)?.whName }} {{ warehouseList.find((tag) => tag.id === scope.row.whId)?.whName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="description" /> <el-table-column label="备注" align="center" prop="description" min-width="120" />
<el-table-column label="创建人" align="center" prop="creator"> <el-table-column label="创建人" align="center" prop="creator" min-width="120">
<template #default="scope"> <template #default="scope">
{{ userList.find((user) => user.id === scope.row.creator)?.nickname }} {{ userList.find((user) => user.id === scope.row.creator)?.nickname }}
</template> </template>
@ -131,10 +131,10 @@
align="center" align="center"
prop="createTime" prop="createTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" min-width="240"
/> />
<el-table-column label="提交人" align="center" prop="keeper"> <el-table-column label="提交人" align="center" prop="keeper" min-width="120">
<template #default="scope"> <template #default="scope">
{{ userList.find((user) => user.id == scope.row.keeper)?.nickname }} {{ userList.find((user) => user.id == scope.row.keeper)?.nickname }}
</template> </template>
@ -144,9 +144,9 @@
align="center" align="center"
prop="keeperTime" prop="keeperTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" min-width="240"
/> />
<el-table-column label="作废人" align="center" prop="cancel"> <el-table-column label="作废人" align="center" prop="cancel" min-width="120">
<template #default="scope"> <template #default="scope">
{{ userList.find((user) => user.id == scope.row.cancel)?.nickname }} {{ userList.find((user) => user.id == scope.row.cancel)?.nickname }}
</template> </template>
@ -156,14 +156,14 @@
align="center" align="center"
prop="cancelTime" prop="cancelTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" min-width="240"
/> />
<el-table-column label="单据状态" align="center" prop="status"> <el-table-column label="单据状态" align="center" prop="status" min-width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_STORAGE_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.HELI_STORAGE_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="150"> <el-table-column label="操作" align="center" min-width="150" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="openDetail('update', scope.row.id)"> <el-button link type="primary" @click="openDetail('update', scope.row.id)">
编辑 编辑

@ -108,20 +108,20 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table">
<!-- <el-table-column label="主键id" align="center" prop="id" /> --> <!-- <el-table-column label="主键id" align="center" prop="id" /> -->
<el-table-column label="出库单号" align="center" prop="stockNo" /> <el-table-column label="出库单号" align="center" prop="stockNo" fixed min-width="140" />
<el-table-column label="出库类型" align="center" prop="stockInType"> <el-table-column label="出库类型" align="center" prop="stockInType" min-width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_STORAGE_IN_TYPE" :value="scope.row.stockInType" /> <dict-tag :type="DICT_TYPE.HELI_STORAGE_IN_TYPE" :value="scope.row.stockInType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上游单号" align="center" prop="headerNo" /> <el-table-column label="上游单号" align="center" prop="headerNo" min-width="100" />
<el-table-column label="出库仓库" align="center" prop="whId"> <el-table-column label="出库仓库" align="center" prop="whId" min-width="120">
<template #default="scope"> <template #default="scope">
{{ warehouseList.find((tag) => tag.id === scope.row.whId)?.whName }} {{ warehouseList.find((tag) => tag.id === scope.row.whId)?.whName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="description" /> <el-table-column label="备注" align="center" prop="description" min-width="120"/>
<el-table-column label="创建人" align="center" prop="creator"> <el-table-column label="创建人" align="center" prop="creator" min-width="120">
<template #default="scope"> <template #default="scope">
{{ userList.find((user) => user.id === scope.row.creator)?.nickname }} {{ userList.find((user) => user.id === scope.row.creator)?.nickname }}
</template> </template>
@ -131,10 +131,10 @@
align="center" align="center"
prop="createTime" prop="createTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" min-width="240"
/> />
<el-table-column label="提交人" align="center" prop="keeper"> <el-table-column label="提交人" align="center" prop="keeper" min-width="120">
<template #default="scope"> <template #default="scope">
{{ userList.find((user) => user.id == scope.row.keeper)?.nickname }} {{ userList.find((user) => user.id == scope.row.keeper)?.nickname }}
</template> </template>
@ -144,9 +144,9 @@
align="center" align="center"
prop="keeperTime" prop="keeperTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" min-width="240"
/> />
<el-table-column label="作废人" align="center" prop="cancel"> <el-table-column label="作废人" align="center" prop="cancel" min-width="120">
<template #default="scope"> <template #default="scope">
{{ userList.find((user) => user.id == scope.row.cancel)?.nickname }} {{ userList.find((user) => user.id == scope.row.cancel)?.nickname }}
</template> </template>
@ -156,14 +156,14 @@
align="center" align="center"
prop="cancelTime" prop="cancelTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" min-width="240"
/> />
<el-table-column label="单据状态" align="center" prop="status"> <el-table-column label="单据状态" align="center" prop="status" min-width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_STORAGE_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.HELI_STORAGE_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="130"> <el-table-column label="操作" align="center" width="150" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="openDetail('update', scope.row.id)"> <el-button link type="primary" @click="openDetail('update', scope.row.id)">
编辑 编辑

Loading…
Cancel
Save