|
|
|
@ -1,10 +1,17 @@
|
|
|
|
|
<template>
|
|
|
|
|
<!-- 出库 -->
|
|
|
|
|
<el-card class="hl-card">
|
|
|
|
|
<template #header>
|
|
|
|
|
<span v-text="dialogTitle"></span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading"
|
|
|
|
|
v-bind:disabled="isShowBtnOther">
|
|
|
|
|
<el-form
|
|
|
|
|
ref="formRef"
|
|
|
|
|
:model="formData"
|
|
|
|
|
:rules="formRules"
|
|
|
|
|
label-width="100px"
|
|
|
|
|
v-loading="formLoading"
|
|
|
|
|
v-bind:disabled="isShowBtnOther"
|
|
|
|
|
>
|
|
|
|
|
<!-- 基础信息 -->
|
|
|
|
|
<el-card class="hl-card-info">
|
|
|
|
|
<template #header>
|
|
|
|
@ -23,21 +30,34 @@
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item prop="stockInType" label="出库类型">
|
|
|
|
|
<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"
|
|
|
|
|
:label="dict.label" :value="dict.value" />
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_OUT_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 prop="industry" label="单据状态">
|
|
|
|
|
<el-select v-model="formData.status" 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
|
|
|
|
|
v-model="formData.status"
|
|
|
|
|
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-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
@ -49,10 +69,8 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="单据日期" prop="createTime">
|
|
|
|
@ -63,21 +81,35 @@
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item prop="whId" label="出库仓库" required>
|
|
|
|
|
<el-select v-model="formData.whId" 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
|
|
|
|
|
v-model="formData.whId"
|
|
|
|
|
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-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<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-col>
|
|
|
|
|
</el-row>
|
|
|
|
@ -91,76 +123,135 @@
|
|
|
|
|
<el-col>
|
|
|
|
|
<el-card class="hl-incard">
|
|
|
|
|
<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-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
|
|
|
|
|
v-loading="subFormLoading" label-width="0">
|
|
|
|
|
<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" 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">
|
|
|
|
|
<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-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="物料编码" />
|
|
|
|
|
<el-table-column prop="matType" label="物料类型">
|
|
|
|
|
<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" />
|
|
|
|
|
<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="规格/型号" />
|
|
|
|
|
<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">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit"
|
|
|
|
|
v-if="scope.row.matUnit ? true : false" />
|
|
|
|
|
<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" 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">
|
|
|
|
|
<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-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" 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">
|
|
|
|
|
<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-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName"
|
|
|
|
|
:value="dict.id" />
|
|
|
|
|
<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="库存数量" />
|
|
|
|
|
<el-table-column prop="storageOkQty" width="120" label="出库数量" required>
|
|
|
|
|
|
|
|
|
|
<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-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" width="120" label="批次号" />
|
|
|
|
|
<el-table-column prop="description" width="150" label="备注">
|
|
|
|
|
<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">
|
|
|
|
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<!-- <el-button v-if="!scope.row.editable" type="primary" size="small" link
|
|
|
|
|
@click="handleEdit(scope.$index)">
|
|
|
|
@ -171,8 +262,13 @@
|
|
|
|
|
</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-bind:disabled="isShowBtnOther">
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="danger"
|
|
|
|
|
size="small"
|
|
|
|
|
@click.prevent="handleDelete2(scope.$index)"
|
|
|
|
|
v-bind:disabled="isShowBtnOther"
|
|
|
|
|
>
|
|
|
|
|
删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
@ -192,13 +288,24 @@
|
|
|
|
|
<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
|
|
|
|
|
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">
|
|
|
|
@ -208,17 +315,33 @@
|
|
|
|
|
</template> -->
|
|
|
|
|
</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">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="danger" size="small" v-bind:disabled="isShowBtnOther"
|
|
|
|
|
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="danger"
|
|
|
|
|
size="small"
|
|
|
|
|
v-bind:disabled="isShowBtnOther"
|
|
|
|
|
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)"
|
|
|
|
|
>
|
|
|
|
|
删除
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button link type="primary" size="small" v-if="isShow"
|
|
|
|
|
@click="downloadAttachment(scope.row.name, scope.row.url)">
|
|
|
|
|
下载 </el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="primary"
|
|
|
|
|
size="small"
|
|
|
|
|
v-if="isShow"
|
|
|
|
|
@click="downloadAttachment(scope.row.name, scope.row.url)"
|
|
|
|
|
>
|
|
|
|
|
下载
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
@ -272,41 +395,58 @@
|
|
|
|
|
</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>
|
|
|
|
|
<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 { useRoute } from 'vue-router'
|
|
|
|
|
import { dateFormatter, formatDate } from '@/utils/formatTime'
|
|
|
|
|
import type { UploadUserFile } from 'element-plus'
|
|
|
|
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import * as StorageApi from '@/api/heli/storage'
|
|
|
|
|
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 * as MaterialApi from '@/api/heli/material'
|
|
|
|
|
import * as WarehouseApi from '@/api/heli/warehouse'
|
|
|
|
|
import * as RgApi from '@/api/heli/rg'
|
|
|
|
|
import * as PnApi from '@/api/heli/pn'
|
|
|
|
|
import { deleteFile, downloadFile, getFilePage } from "@/api/infra/file"
|
|
|
|
|
import download from "@/utils/download"
|
|
|
|
|
import * as UserApi from "@/api/system/user";
|
|
|
|
|
import { deleteFile, downloadFile, getFilePage } from '@/api/infra/file'
|
|
|
|
|
import download from '@/utils/download'
|
|
|
|
|
import * as UserApi from '@/api/system/user'
|
|
|
|
|
|
|
|
|
|
const reload = inject('reload')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
const { query } = useRoute()
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
const isShow = ref(false)
|
|
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
@ -348,11 +488,9 @@ 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' }],
|
|
|
|
|
storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }]
|
|
|
|
|
})
|
|
|
|
|
const handleStatus = (async (num) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleStatus = async (num) => {
|
|
|
|
|
formData.value.status = num
|
|
|
|
|
|
|
|
|
|
const dataUpdate = formData.value as unknown as StorageApi.StorageVO
|
|
|
|
@ -367,37 +505,41 @@ const handleStatus = (async (num) => {
|
|
|
|
|
|
|
|
|
|
switch (num) {
|
|
|
|
|
case 1:
|
|
|
|
|
isShowBtnGroup.value = true;
|
|
|
|
|
isShowBtnCancel.value = false;
|
|
|
|
|
isShowBtnGroup.value = true
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
break
|
|
|
|
|
case 2:
|
|
|
|
|
isShowBtnGroup.value = false;
|
|
|
|
|
isShowBtnCancel.value = true;
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = true
|
|
|
|
|
break
|
|
|
|
|
case 3:
|
|
|
|
|
isShowBtnGroup.value = false;
|
|
|
|
|
isShowBtnCancel.value = false;
|
|
|
|
|
break;
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
//查看页面不可以编辑
|
|
|
|
|
if (query.type === 'review') {
|
|
|
|
|
isShowBtnGroup.value = false;
|
|
|
|
|
isShowBtnCancel.value = false;
|
|
|
|
|
isShowBtnOther.value = true;
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnOther.value = true
|
|
|
|
|
}
|
|
|
|
|
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: 'STORAGE', businessId: formData.value.id, businessFileType: 'MATERIAL' })
|
|
|
|
|
const matUploadRef = ref()
|
|
|
|
|
const matUploadFiles = ref<UploadUserFile[]>([])
|
|
|
|
|
const matUploadData = ref({
|
|
|
|
|
businessType: 'STORAGE',
|
|
|
|
|
businessId: formData.value.id,
|
|
|
|
|
businessFileType: 'MATERIAL'
|
|
|
|
|
})
|
|
|
|
|
const matUploadChange = (file, files) => {
|
|
|
|
|
matUploadFiles.value = files;
|
|
|
|
|
matUploadFiles.value = files
|
|
|
|
|
refreshAttachments(files, 'MATERIAL')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -406,28 +548,28 @@ const refreshAttachments = (files, type) => {
|
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
|
|
return v1.createTime - v2.createTime > 0
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 删除附件
|
|
|
|
|
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++) {
|
|
|
|
|
const attachment = deletedAttachments[i];
|
|
|
|
|
const attachment = deletedAttachments[i]
|
|
|
|
|
if (attachment.id) {
|
|
|
|
|
// 清理已上传文件
|
|
|
|
|
await deleteFile(attachment.id);
|
|
|
|
|
await deleteFile(attachment.id)
|
|
|
|
|
}
|
|
|
|
|
// 清理待上传文件
|
|
|
|
|
matUploadFiles.value = matUploadFiles.value.filter(file1 => {
|
|
|
|
|
return file1.name != attachment.name || file1.businessFileType != type;
|
|
|
|
|
matUploadFiles.value = matUploadFiles.value.filter((file1) => {
|
|
|
|
|
return file1.name != attachment.name || file1.businessFileType != type
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -435,7 +577,7 @@ const handleDeleteAttachment = async (index, type) => {
|
|
|
|
|
const downloadAttachment = async (name, url) => {
|
|
|
|
|
if (url) {
|
|
|
|
|
const data = await downloadFile(url)
|
|
|
|
|
download.any(data, name);
|
|
|
|
|
download.any(data, name)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// ====================附件信息 结束=======================================
|
|
|
|
@ -459,8 +601,14 @@ const submitForm = async () => {
|
|
|
|
|
const matCurrentData = await StorageMatApi.getStorageMatList()
|
|
|
|
|
var hasRestNum = true
|
|
|
|
|
formData.value.matItemDOList.forEach((rest) => {
|
|
|
|
|
|
|
|
|
|
if (matCurrentData.find(mat => mat.matId == rest.matId && mat.pnId == rest.pnId && mat.matRest < Number(rest.storageOkQty))) {
|
|
|
|
|
if (
|
|
|
|
|
matCurrentData.find(
|
|
|
|
|
(mat) =>
|
|
|
|
|
mat.matId == rest.matId &&
|
|
|
|
|
mat.pnId == rest.pnId &&
|
|
|
|
|
mat.matRest < Number(rest.storageOkQty)
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
hasRestNum = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -469,24 +617,21 @@ const submitForm = async () => {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 提交请求
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = formData.value as unknown as StorageApi.StorageVO
|
|
|
|
|
if (query.type === 'create') {
|
|
|
|
|
|
|
|
|
|
//库存信息保存
|
|
|
|
|
storageid.value = await StorageApi.createStorage(data)
|
|
|
|
|
commonResult = 'common.createSuccess'
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
storageid.value = data.id
|
|
|
|
|
await StorageApi.updateStorage(data)
|
|
|
|
|
commonResult = 'common.updateSuccess'
|
|
|
|
|
}
|
|
|
|
|
//物料信息保存
|
|
|
|
|
formData.value.matItemDOList.forEach(item => {
|
|
|
|
|
formData.value.matItemDOList.forEach((item) => {
|
|
|
|
|
item.stockId = storageid.value
|
|
|
|
|
item.whId = formData.value.whId
|
|
|
|
|
})
|
|
|
|
@ -501,9 +646,8 @@ const submitForm = async () => {
|
|
|
|
|
|
|
|
|
|
message.success(t(commonResult))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 成功后刷新
|
|
|
|
|
reload();
|
|
|
|
|
reload()
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
@ -534,7 +678,7 @@ const onAddItem = () => {
|
|
|
|
|
matCount = matCount + 1
|
|
|
|
|
formData.value.matItemDOList.push(newData)
|
|
|
|
|
} else {
|
|
|
|
|
message.alertWarning('清选择出库仓库')
|
|
|
|
|
message.alertWarning('请选择出库仓库')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -549,7 +693,7 @@ const warehouseList = ref([])
|
|
|
|
|
var rgList = ref([])
|
|
|
|
|
//库位全数据
|
|
|
|
|
var pnList = ref([])
|
|
|
|
|
const handleWh = (async (wid) => {
|
|
|
|
|
const handleWh = async (wid) => {
|
|
|
|
|
//-------------------库区全数据
|
|
|
|
|
const queryParamsRg = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
@ -562,14 +706,14 @@ const handleWh = (async (wid) => {
|
|
|
|
|
pnList.value = []
|
|
|
|
|
rgList.value = dataRg.list
|
|
|
|
|
|
|
|
|
|
formData.value.matItemDOList.forEach(item => {
|
|
|
|
|
formData.value.matItemDOList.forEach((item) => {
|
|
|
|
|
item.rgId = ''
|
|
|
|
|
item.pnId = ''
|
|
|
|
|
item.pnlist.value = []
|
|
|
|
|
})
|
|
|
|
|
//-------------------
|
|
|
|
|
})
|
|
|
|
|
const handleRg = (async (scope) => {
|
|
|
|
|
}
|
|
|
|
|
const handleRg = async (scope) => {
|
|
|
|
|
//-------------------库位全数据
|
|
|
|
|
const queryParamsRPn = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
@ -581,10 +725,10 @@ const handleRg = (async (scope) => {
|
|
|
|
|
scope.row.pnid = ''
|
|
|
|
|
scope.row.pnlist = dataPn.list
|
|
|
|
|
//-------------------
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const matList = ref<MaterialApi.MaterialVO[]>([]) // 物料列表
|
|
|
|
|
const matSelectLoading = ref(false);
|
|
|
|
|
const matSelectLoading = ref(false)
|
|
|
|
|
const remoteMatCodeSearch = async (name) => {
|
|
|
|
|
matSelectLoading.value = true
|
|
|
|
|
// 获得用户列表
|
|
|
|
@ -592,20 +736,20 @@ const remoteMatCodeSearch = async (name) => {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
name: name,
|
|
|
|
|
status: "1"
|
|
|
|
|
status: '1'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const matLastRemoteData = await StorageMatApi.getStorageMatList()
|
|
|
|
|
|
|
|
|
|
const dataMat = await MaterialApi.getMaterialPage(matParams)
|
|
|
|
|
matList.value = []
|
|
|
|
|
matList.value = dataMat.list.filter((item) => matLastRemoteData.find((fish) => fish.matId === item.id) !== undefined)
|
|
|
|
|
matList.value = dataMat.list.filter(
|
|
|
|
|
(item) => matLastRemoteData.find((fish) => fish.matId === item.id) !== 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
|
|
|
|
@ -653,7 +797,6 @@ const btnWhClickable = ref(false)
|
|
|
|
|
const matLastData = ref([])
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
|
|
|
|
btnWhClickable.value = query.type === 'update' ? true : false
|
|
|
|
|
|
|
|
|
|
matLastData.value = await StorageMatApi.getStorageMatList()
|
|
|
|
@ -662,17 +805,16 @@ onMounted(async () => {
|
|
|
|
|
let matParams = {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 99,
|
|
|
|
|
status: "1"
|
|
|
|
|
status: '1'
|
|
|
|
|
}
|
|
|
|
|
const dataMat = await MaterialApi.getMaterialPage(matParams)
|
|
|
|
|
matList.value = []
|
|
|
|
|
matList.value = dataMat.list
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dialogTitle.value = t('action.' + query.type)
|
|
|
|
|
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()
|
|
|
|
@ -684,25 +826,25 @@ onMounted(async () => {
|
|
|
|
|
|
|
|
|
|
switch (formData.value.status) {
|
|
|
|
|
case 1:
|
|
|
|
|
isShowBtnGroup.value = true;
|
|
|
|
|
isShowBtnCancel.value = false;
|
|
|
|
|
isShowBtnGroup.value = true
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
break
|
|
|
|
|
case 2:
|
|
|
|
|
isShowBtnGroup.value = false;
|
|
|
|
|
isShowBtnCancel.value = true;
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = true
|
|
|
|
|
break
|
|
|
|
|
case 3:
|
|
|
|
|
isShowBtnGroup.value = false;
|
|
|
|
|
isShowBtnCancel.value = false;
|
|
|
|
|
break;
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
//查看页面不可以编辑
|
|
|
|
|
if (query.type === 'review') {
|
|
|
|
|
isShowBtnGroup.value = false;
|
|
|
|
|
isShowBtnCancel.value = false;
|
|
|
|
|
isShowBtnOther.value = true;
|
|
|
|
|
isShowBtnGroup.value = false
|
|
|
|
|
isShowBtnCancel.value = false
|
|
|
|
|
isShowBtnOther.value = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获得库区列表
|
|
|
|
@ -743,7 +885,7 @@ onMounted(async () => {
|
|
|
|
|
})
|
|
|
|
|
const matVos = await MaterialApi.getMaterialPage(queryParamsMat2)
|
|
|
|
|
|
|
|
|
|
formData.value.matItemDOList.forEach(item => {
|
|
|
|
|
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
|
|
|
|
@ -752,18 +894,18 @@ onMounted(async () => {
|
|
|
|
|
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 = 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,
|
|
|
|
@ -771,12 +913,11 @@ onMounted(async () => {
|
|
|
|
|
businessId: query.id,
|
|
|
|
|
businessType: 'STORAGE'
|
|
|
|
|
}
|
|
|
|
|
formData.value.attachments = (await getFilePage(attParams)).list;
|
|
|
|
|
formData.value.attachments = (await getFilePage(attParams)).list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//用户信息
|
|
|
|
|
userList.value = await UserApi.getSimpleUserList()
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|