|
|
|
|
@ -1,56 +1,30 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<el-dialog |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
:title="outDialogTiltle" |
|
|
|
|
:visible.sync="outDialogVisible" |
|
|
|
|
:append-to-body="true" |
|
|
|
|
@close="handleCloseDetail" |
|
|
|
|
fullscreen |
|
|
|
|
> |
|
|
|
|
<el-dialog :close-on-click-modal="false" :title="outDialogTiltle" :visible.sync="outDialogVisible" |
|
|
|
|
:append-to-body="true" @close="handleCloseDetail" fullscreen> |
|
|
|
|
<div class="dialog-content"> |
|
|
|
|
<!-- 基本信息 --> |
|
|
|
|
<el-form |
|
|
|
|
:model="sizeForm" |
|
|
|
|
ref="dynamicValidateForm" |
|
|
|
|
label-width="100px" |
|
|
|
|
class="demo-dynamic" |
|
|
|
|
:rules="dynamicRules" |
|
|
|
|
> |
|
|
|
|
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic" |
|
|
|
|
:rules="dynamicRules"> |
|
|
|
|
<div class="form-title">基本信息</div> |
|
|
|
|
<el-row> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="出库申请时间"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="sizeForm.ldTwoOutStorage.outDate" |
|
|
|
|
type="date" |
|
|
|
|
placeholder="选择日期" |
|
|
|
|
style="width: 100%" |
|
|
|
|
disabled |
|
|
|
|
> |
|
|
|
|
<el-date-picker v-model="sizeForm.ldTwoOutStorage.outDate" type="date" placeholder="选择日期" |
|
|
|
|
style="width: 100%" disabled> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="事由" prop="ldTwoOutStorage.reason"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="sizeForm.ldTwoOutStorage.reason" |
|
|
|
|
:disabled="outDialogType != 'add'" |
|
|
|
|
placeholder="请输入" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input v-model="sizeForm.ldTwoOutStorage.reason" :disabled="outDialogType != 'add'" |
|
|
|
|
placeholder="请输入"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item |
|
|
|
|
label="物资类型" |
|
|
|
|
prop="ldTwoOutStorage.materialType" |
|
|
|
|
> |
|
|
|
|
<el-select |
|
|
|
|
v-model="sizeForm.ldTwoOutStorage.materialType" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%" |
|
|
|
|
:disabled="outDialogType != 'add'" |
|
|
|
|
> |
|
|
|
|
<el-form-item label="物资类型" prop="ldTwoOutStorage.materialType"> |
|
|
|
|
<el-select v-model="sizeForm.ldTwoOutStorage.materialType" placeholder="请选择" style="width: 100%" |
|
|
|
|
:disabled="outDialogType != 'add'"> |
|
|
|
|
<el-option label="办公室物资" value="1"></el-option> |
|
|
|
|
<el-option label="其他物资" value="2"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
@ -58,120 +32,59 @@ |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="部门" prop="ldTwoOutStorage.departmentInfo"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="sizeForm.ldTwoOutStorage.departmentInfo" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%" |
|
|
|
|
:disabled="outDialogType != 'add'" |
|
|
|
|
@change="deptChange" |
|
|
|
|
clearable |
|
|
|
|
filterable |
|
|
|
|
value-key="departmentId" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in departmentOptions" |
|
|
|
|
:key="item.departmentId" |
|
|
|
|
:label="item.department" |
|
|
|
|
:value="item" |
|
|
|
|
></el-option> |
|
|
|
|
<el-select v-model="sizeForm.ldTwoOutStorage.departmentInfo" placeholder="请选择" style="width: 100%" |
|
|
|
|
:disabled="outDialogType != 'add'" @change="deptChange" clearable filterable value-key="departmentId"> |
|
|
|
|
<el-option v-for="item in departmentOptions" :key="item.departmentId" :label="item.department" |
|
|
|
|
:value="item"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="领用人" prop="ldTwoOutStorage.proposerInfo"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="sizeForm.ldTwoOutStorage.proposerInfo" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%" |
|
|
|
|
:disabled=" |
|
|
|
|
sizeForm.departmentId == '' || outDialogType == 'details' |
|
|
|
|
" |
|
|
|
|
clearable |
|
|
|
|
filterable |
|
|
|
|
value-key="userId" |
|
|
|
|
@change="proposerChange" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in userOptions" |
|
|
|
|
:key="item.userId" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item" |
|
|
|
|
> |
|
|
|
|
<el-select v-model="sizeForm.ldTwoOutStorage.proposerInfo" placeholder="请选择" style="width: 100%" |
|
|
|
|
:disabled="sizeForm.departmentId == '' || outDialogType == 'details' |
|
|
|
|
" clearable filterable value-key="userId" @change="proposerChange"> |
|
|
|
|
<el-option v-for="item in userOptions" :key="item.userId" :label="item.name" :value="item"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="物资分组" prop="ldTwoOutStorage.groupName"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="sizeForm.ldTwoOutStorage.groupName" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%" |
|
|
|
|
:disabled="outDialogType != 'add'" |
|
|
|
|
clearable |
|
|
|
|
filterable |
|
|
|
|
value-key="departmentId" |
|
|
|
|
@change="groupNameChange" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in groupNameOptions" |
|
|
|
|
:key="item.groupName" |
|
|
|
|
:label="item.groupName" |
|
|
|
|
:value="item.groupName" |
|
|
|
|
></el-option> |
|
|
|
|
<el-select v-model="sizeForm.ldTwoOutStorage.groupName" placeholder="请选择" style="width: 100%" |
|
|
|
|
:disabled="outDialogType != 'add'" clearable filterable value-key="departmentId" |
|
|
|
|
@change="groupNameChange"> |
|
|
|
|
<el-option v-for="item in groupNameOptions" :key="item.groupName" :label="item.groupName" |
|
|
|
|
:value="item.groupName"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
<el-col :span="12" v-if="outDialogType == 'details'"> |
|
|
|
|
<el-form-item label="填报人"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="sizeForm.ldTwoOutStorage.shipperName" |
|
|
|
|
:disabled="outDialogType != 'add'" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input v-model="sizeForm.ldTwoOutStorage.shipperName" :disabled="outDialogType != 'add'"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<div class="form-title">{{ outDateInfo }} 出库信息:</div> |
|
|
|
|
<div v-if="sizeForm.ldTwoOutStorage.groupName !== '自由出库'"> |
|
|
|
|
<el-table |
|
|
|
|
:data="groupTableData" |
|
|
|
|
style="width: 100%" |
|
|
|
|
border |
|
|
|
|
ref="groupTable" |
|
|
|
|
@expand-change="handleExpandChange" |
|
|
|
|
> |
|
|
|
|
<el-table :data="groupTableData" style="width: 100%" border ref="groupTable" |
|
|
|
|
@expand-change="handleExpandChange"> |
|
|
|
|
<!-- 展开行详情 --> |
|
|
|
|
<el-table-column type="expand"> |
|
|
|
|
<template slot-scope="props"> |
|
|
|
|
<!-- 关联表单列表(带复选框) --> |
|
|
|
|
<el-table |
|
|
|
|
:data="props.row.twoInventoryVOList || []" |
|
|
|
|
size="mini" |
|
|
|
|
style="width: 100%" |
|
|
|
|
<el-table :data="props.row.twoInventoryVOList || []" size="mini" style="width: 100%" |
|
|
|
|
@selection-change=" |
|
|
|
|
(val) => handleSelectionChange(val, props.row) |
|
|
|
|
" |
|
|
|
|
border |
|
|
|
|
:row-key="getRowKeyId" |
|
|
|
|
ref="nestedTable" |
|
|
|
|
> |
|
|
|
|
<!-- <el-table-column |
|
|
|
|
type="selection" |
|
|
|
|
width="55" |
|
|
|
|
:selectable="isRowSelectable" |
|
|
|
|
/> --> |
|
|
|
|
" border :row-key="getRowKeyId" ref="nestedTable" v-if="props.row.twoInventoryVOList"> |
|
|
|
|
<el-table-column label="选择" width="55"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-checkbox |
|
|
|
|
v-model="scope.row._selected" |
|
|
|
|
:disabled="!isRowSelectable(scope.row)" |
|
|
|
|
@change=" |
|
|
|
|
(checked) => |
|
|
|
|
handleRowSelect(checked, scope.row, props.row) |
|
|
|
|
" |
|
|
|
|
/> |
|
|
|
|
<el-checkbox v-model="scope.row._selected" :disabled="!isRowSelectable(scope.row)" @change=" |
|
|
|
|
(checked) => |
|
|
|
|
handleRowSelect(checked, scope.row, props.row) |
|
|
|
|
" /> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column type="index" label="#" width="55" /> |
|
|
|
|
@ -179,20 +92,25 @@ |
|
|
|
|
<el-table-column label="物料编码" prop="materialCode" /> |
|
|
|
|
<el-table-column label="规格型号" prop="model" /> |
|
|
|
|
<el-table-column label="数量" prop="inventory" /> |
|
|
|
|
<el-table-column label="实际使用人" prop="userInfo"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-select v-model="scope.row.userInfo" placeholder="请选择" style="width: 100%" :disabled="sizeForm.departmentId == '' || outDialogType == 'details' |
|
|
|
|
" clearable filterable value-key="userId" |
|
|
|
|
@change="(val) => proposerChangeTable(val, scope.$index, props.$index)" |
|
|
|
|
v-if="scope.row.type == 'NY'"> |
|
|
|
|
<el-option v-for="item in userOptions" :key="item.userId" :label="item.name" :value="item"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<span v-else>-</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="本次出库数量" prop="num"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input-number |
|
|
|
|
size="mini" |
|
|
|
|
v-model="scope.row.num" |
|
|
|
|
:min="0" |
|
|
|
|
:max="getMaxQuantity(scope.row)" |
|
|
|
|
style="width: 100%" |
|
|
|
|
:disabled="scope.row.type === 'NY'" |
|
|
|
|
@change=" |
|
|
|
|
<el-input-number size="mini" v-model="scope.row.num" :min="0" :max="getMaxQuantity(scope.row)" |
|
|
|
|
style="width: 100%" :disabled="scope.row.type === 'NY'" @change=" |
|
|
|
|
(newValue) => |
|
|
|
|
handleQuantityChange(newValue, scope.$index) |
|
|
|
|
" |
|
|
|
|
></el-input-number> |
|
|
|
|
"></el-input-number> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="单价" prop="unitPrice" width="80" /> |
|
|
|
|
@ -210,39 +128,16 @@ |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-if="sizeForm.ldTwoOutStorage.groupName == '自由出库'"> |
|
|
|
|
<el-button |
|
|
|
|
type="primary" |
|
|
|
|
size="mini" |
|
|
|
|
style="margin-bottom: 18px" |
|
|
|
|
@click="categoryHandle" |
|
|
|
|
v-if="outDialogType != 'details'" |
|
|
|
|
>新增</el-button |
|
|
|
|
> |
|
|
|
|
<el-table |
|
|
|
|
:data="sizeForm.ldTwoOutStorageDetailList" |
|
|
|
|
border |
|
|
|
|
style="width: 100%" |
|
|
|
|
ref="table" |
|
|
|
|
> |
|
|
|
|
<el-button type="primary" size="mini" style="margin-bottom: 18px" @click="categoryHandle" |
|
|
|
|
v-if="outDialogType != 'details'">新增</el-button> |
|
|
|
|
<el-table :data="sizeForm.ldTwoOutStorageDetailList" border style="width: 100%" ref="table"> |
|
|
|
|
<el-table-column type="expand"> |
|
|
|
|
<template slot-scope="props"> |
|
|
|
|
<el-table |
|
|
|
|
:data="scope.row.twoInventoryVOList" |
|
|
|
|
border |
|
|
|
|
style="width: 100%" |
|
|
|
|
> |
|
|
|
|
<el-table-column |
|
|
|
|
prop="materialName" |
|
|
|
|
label="物资名称" |
|
|
|
|
></el-table-column> |
|
|
|
|
<el-table-column |
|
|
|
|
prop="materialCode" |
|
|
|
|
label="物资编码" |
|
|
|
|
></el-table-column> |
|
|
|
|
<el-table-column |
|
|
|
|
prop="type" |
|
|
|
|
label="物资类型" |
|
|
|
|
></el-table-column> |
|
|
|
|
<el-table :data="scope.row.twoInventoryVOList" border style="width: 100%" |
|
|
|
|
v-if="scope.row.twoInventoryVOList"> |
|
|
|
|
<el-table-column prop="materialName" label="物资名称"></el-table-column> |
|
|
|
|
<el-table-column prop="materialCode" label="物资编码"></el-table-column> |
|
|
|
|
<el-table-column prop="type" label="物资类型"></el-table-column> |
|
|
|
|
<el-table-column prop="num" label="数量"></el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
</template> |
|
|
|
|
@ -250,10 +145,7 @@ |
|
|
|
|
<el-table-column prop="materialCode" label="物资编码"> |
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
<el-table-column |
|
|
|
|
prop="materialName" |
|
|
|
|
label="物资名称" |
|
|
|
|
></el-table-column> |
|
|
|
|
<el-table-column prop="materialName" label="物资名称"></el-table-column> |
|
|
|
|
<el-table-column prop="model" label="规格/型号"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="type" label="类别"> |
|
|
|
|
@ -262,41 +154,36 @@ |
|
|
|
|
scope.row.type === "NY" |
|
|
|
|
? "耐用品" |
|
|
|
|
: scope.row.type === "YH" |
|
|
|
|
? "易耗品" |
|
|
|
|
: "" |
|
|
|
|
? "易耗品" |
|
|
|
|
: "" |
|
|
|
|
}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="unit" label="单位"> </el-table-column> |
|
|
|
|
<el-table-column label="实际使用人" prop="userInfo"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-select v-model="scope.row.userInfo" placeholder="请选择" style="width: 100%" :disabled="sizeForm.departmentId == '' || outDialogType == 'details' |
|
|
|
|
" clearable filterable value-key="userId" |
|
|
|
|
@change="(val) => proposerChangeTable(val, scope.$index, 0)" v-if="scope.row.type == 'NY'"> |
|
|
|
|
<el-option v-for="item in userOptions" :key="item.userId" :label="item.name" :value="item"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<span v-else>-</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="num" label="数量"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input-number |
|
|
|
|
size="mini" |
|
|
|
|
v-model="scope.row.num" |
|
|
|
|
:min="0" |
|
|
|
|
:max="getMaxQuantity(scope.row)" |
|
|
|
|
style="width: 100%" |
|
|
|
|
:disabled=" |
|
|
|
|
outDialogType != 'add' || scope.row.type === 'NY' |
|
|
|
|
" |
|
|
|
|
@change=" |
|
|
|
|
(newValue) => handleQuantityChange(newValue, scope.$index) |
|
|
|
|
" |
|
|
|
|
></el-input-number> |
|
|
|
|
<el-input-number size="mini" v-model="scope.row.num" :min="0" :max="getMaxQuantity(scope.row)" |
|
|
|
|
style="width: 100%" :disabled="outDialogType != 'add' || scope.row.type === 'NY' |
|
|
|
|
" @change=" |
|
|
|
|
(newValue) => handleQuantityChange(newValue, scope.$index) |
|
|
|
|
"></el-input-number> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column |
|
|
|
|
label="操作" |
|
|
|
|
width="100" |
|
|
|
|
v-if="outDialogType != 'details'" |
|
|
|
|
> |
|
|
|
|
<el-table-column label="操作" width="100" v-if="outDialogType != 'details'"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div :disabled="outDialogType == 'details'"> |
|
|
|
|
<el-button |
|
|
|
|
type="text" |
|
|
|
|
size="mini" |
|
|
|
|
@click="handleDelete(scope.$index, scope.row)" |
|
|
|
|
> |
|
|
|
|
<el-button type="text" size="mini" @click="handleDelete(scope.$index, scope.row)"> |
|
|
|
|
删除 |
|
|
|
|
</el-button> |
|
|
|
|
</div> |
|
|
|
|
@ -307,12 +194,7 @@ |
|
|
|
|
<div class="form-title" v-if="outDialogType != 'details'"> |
|
|
|
|
出库账目表格: |
|
|
|
|
</div> |
|
|
|
|
<el-table |
|
|
|
|
:data="statisticsList" |
|
|
|
|
border |
|
|
|
|
style="width: 100%" |
|
|
|
|
v-if="outDialogType != 'details'" |
|
|
|
|
> |
|
|
|
|
<el-table :data="statisticsList" border style="width: 100%" v-if="outDialogType != 'details'"> |
|
|
|
|
<el-table-column prop="date" label="当前库存" align="center"> |
|
|
|
|
<el-table-column prop="materialCode" label="编码"> |
|
|
|
|
</el-table-column> |
|
|
|
|
@ -325,8 +207,8 @@ |
|
|
|
|
scope.row.type === "NY" |
|
|
|
|
? "耐用品" |
|
|
|
|
: scope.row.type === "YH" |
|
|
|
|
? "易耗品" |
|
|
|
|
: "" |
|
|
|
|
? "易耗品" |
|
|
|
|
: "" |
|
|
|
|
}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
@ -363,24 +245,13 @@ |
|
|
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="handleCloseDetail()">取 消</el-button> |
|
|
|
|
<el-button |
|
|
|
|
v-if="outDialogType != 'details'" |
|
|
|
|
type="primary" |
|
|
|
|
@click="sumbit()" |
|
|
|
|
>确 定</el-button |
|
|
|
|
> |
|
|
|
|
<el-button v-if="outDialogType != 'details'" type="primary" @click="sumbit()">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<!-- 新增数据 --> |
|
|
|
|
<categoryDialog |
|
|
|
|
v-if="categoryVisible" |
|
|
|
|
:categoryVisible="categoryVisible" |
|
|
|
|
:selectionData="selectionData" |
|
|
|
|
:departmentId="sizeForm.ldTwoOutStorage.departmentId" |
|
|
|
|
:categoryDialogTitle="categoryDialogTitle" |
|
|
|
|
@confirm="confirm" |
|
|
|
|
@categoryClose="categoryClose" |
|
|
|
|
></categoryDialog> |
|
|
|
|
<categoryDialog v-if="categoryVisible" :categoryVisible="categoryVisible" :selectionData="selectionData" |
|
|
|
|
:departmentId="sizeForm.ldTwoOutStorage.departmentId" :categoryDialogTitle="categoryDialogTitle" |
|
|
|
|
@confirm="confirm" @categoryClose="categoryClose"></categoryDialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
@ -651,35 +522,61 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getOutGroupName() { |
|
|
|
|
// this.groupNameOptions = [ |
|
|
|
|
// { |
|
|
|
|
// groupIds: "83,85", |
|
|
|
|
// groupName: "测试", |
|
|
|
|
// }, |
|
|
|
|
// { |
|
|
|
|
// groupIds: null, |
|
|
|
|
// groupName: "自由出库", |
|
|
|
|
// }, |
|
|
|
|
// ]; |
|
|
|
|
getOutGroupName().then((res) => { |
|
|
|
|
this.groupNameOptions = res.data.result; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 批量 更改明细表数据 |
|
|
|
|
getStatistics() { |
|
|
|
|
getStatistics(this.sizeForm.ldTwoOutStorageDetailList).then((res) => { |
|
|
|
|
this.statisticsList = res.data.result; |
|
|
|
|
this.statisticsList = this.statisticsList.map((stat) => { |
|
|
|
|
const detail = this.sizeForm.ldTwoOutStorageDetailList.find( |
|
|
|
|
(item) => item.materialCode === stat.materialCode |
|
|
|
|
); |
|
|
|
|
return { |
|
|
|
|
...stat, |
|
|
|
|
theOutboundQuantity: detail.num || 0, //本次入库数量 |
|
|
|
|
unitPrice: detail.unitPrice, |
|
|
|
|
totalQuantity: stat.num - detail.num, |
|
|
|
|
}; |
|
|
|
|
let arr = [] |
|
|
|
|
if (this.sizeForm.ldTwoOutStorage.groupName == '自由出库') { |
|
|
|
|
arr = this.sizeForm.ldTwoOutStorageDetailList |
|
|
|
|
} else { |
|
|
|
|
this.groupTableData.forEach(group => { |
|
|
|
|
if (group.twoInventoryVOList && group.twoInventoryVOList.length > 0) { |
|
|
|
|
const selectedItems = group.twoInventoryVOList.filter(item => item._selected); |
|
|
|
|
selectedItems.forEach(item => { |
|
|
|
|
// 确保提取的是最新的数据(包括用户在表格中修改的 num, userId 等) |
|
|
|
|
arr.push({ |
|
|
|
|
...item, |
|
|
|
|
num: Number(item.num) || 0, |
|
|
|
|
unitPrice: Number(item.unitPrice) || 0 |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
getStatistics(arr).then((res) => { |
|
|
|
|
this.statisticsList = res.data.result; |
|
|
|
|
if (this.sizeForm.ldTwoOutStorage.groupName == '自由出库') { |
|
|
|
|
this.statisticsList = this.statisticsList.map((stat) => { |
|
|
|
|
const detail = this.sizeForm.ldTwoOutStorageDetailList.find( |
|
|
|
|
(item) => item.materialCode === stat.materialCode |
|
|
|
|
); |
|
|
|
|
return { |
|
|
|
|
...stat, |
|
|
|
|
theOutboundQuantity: detail.num || 0, //本次入库数量 |
|
|
|
|
unitPrice: detail.unitPrice, |
|
|
|
|
totalQuantity: stat.num - detail.num, |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
this.statisticsList = this.statisticsList.map((stat) => { |
|
|
|
|
|
|
|
|
|
const detail = arr.find( |
|
|
|
|
(item) => item.id === stat.id |
|
|
|
|
); |
|
|
|
|
console.log(90909090,detail) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
...stat, |
|
|
|
|
theOutboundQuantity: detail.num || 1, //本次入库数量 |
|
|
|
|
unitPrice: detail.unitPrice, |
|
|
|
|
totalQuantity: stat.num - detail.num, |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 最大数量 |
|
|
|
|
@ -800,10 +697,21 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 领用人选中 |
|
|
|
|
proposerChange(value) { |
|
|
|
|
console.log("领用人", value); |
|
|
|
|
this.sizeForm.ldTwoOutStorage.proposerId = value.userId; |
|
|
|
|
this.sizeForm.ldTwoOutStorage.proposerName = value.name; |
|
|
|
|
}, |
|
|
|
|
// 实际使用人 |
|
|
|
|
proposerChangeTable(val, index, v) { |
|
|
|
|
if (this.sizeForm.ldTwoOutStorage.groupName !== '自由出库') { |
|
|
|
|
this.groupTableData[v].twoInventoryVOList[index].userName = val.name; |
|
|
|
|
|
|
|
|
|
this.groupTableData[v].twoInventoryVOList[index].userId = val.userId; |
|
|
|
|
} else { |
|
|
|
|
this.sizeForm.ldTwoOutStorageDetailList[index].userName = val.name; |
|
|
|
|
this.sizeForm.ldTwoOutStorageDetailList[index].userId = val.userId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
handleCloseDetail() { |
|
|
|
|
this.outDialogVisible = false; |
|
|
|
|
this.$emit("handleCloseDetail"); |
|
|
|
|
@ -829,8 +737,8 @@ export default { |
|
|
|
|
|
|
|
|
|
if (this.sizeForm.groupName != "自由出库") { |
|
|
|
|
this.groupTableData = res.data.result.ldTwoOutStorageDetailList; |
|
|
|
|
this.groupTableData.forEach(item=>{ |
|
|
|
|
item.applyNum=item.num |
|
|
|
|
this.groupTableData.forEach(item => { |
|
|
|
|
item.applyNum = item.num |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// this.sizeForm.ldTwoOutStorage.proposerInfo={} |
|
|
|
|
@ -852,21 +760,20 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
sumbit() { |
|
|
|
|
console.log("form", this.sizeForm); |
|
|
|
|
|
|
|
|
|
this.$refs.dynamicValidateForm.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
// ===== 非自由出库:校验分组物资勾选数量是否匹配申请数量 ===== |
|
|
|
|
if (this.sizeForm.ldTwoOutStorage.groupName !== "自由出库") { |
|
|
|
|
let hasError = false; |
|
|
|
|
|
|
|
|
|
let finalDetailList = []; // 用于收集最终要提交的数据 |
|
|
|
|
for (const group of this.groupTableData) { |
|
|
|
|
if ( |
|
|
|
|
!group.twoInventoryVOList || |
|
|
|
|
group.twoInventoryVOList.length === 0 |
|
|
|
|
) { |
|
|
|
|
this.$message.error( |
|
|
|
|
`分组【${ |
|
|
|
|
group.materialName || group.materialCode |
|
|
|
|
`分组【${group.materialName || group.materialCode |
|
|
|
|
}】下无可出库物资` |
|
|
|
|
); |
|
|
|
|
hasError = true; |
|
|
|
|
@ -880,13 +787,24 @@ export default { |
|
|
|
|
|
|
|
|
|
if (selectedItems.length === 0) { |
|
|
|
|
this.$message.error( |
|
|
|
|
`分组【${ |
|
|
|
|
group.materialName || group.materialCode |
|
|
|
|
`分组【${group.materialName || group.materialCode |
|
|
|
|
}】未选择任何物资` |
|
|
|
|
); |
|
|
|
|
hasError = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// --- 校验:耐用品必须选择实际使用人 --- |
|
|
|
|
const missingUserItem = selectedItems.find( |
|
|
|
|
(item) => item.type === "NY" && (!item.userId || item.userId === "") |
|
|
|
|
); |
|
|
|
|
if (missingUserItem) { |
|
|
|
|
this.$message.error( |
|
|
|
|
`分组【${group.materialName || group.materialCode}】中,物资【${missingUserItem.materialName}】为耐用品,请选择实际使用人` |
|
|
|
|
); |
|
|
|
|
hasError = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const totalSelectedNum = selectedItems.reduce((sum, item) => { |
|
|
|
|
return sum + (Number(item.num) || 0); |
|
|
|
|
@ -896,17 +814,30 @@ export default { |
|
|
|
|
|
|
|
|
|
if (totalSelectedNum !== applyNum) { |
|
|
|
|
this.$message.error( |
|
|
|
|
`分组【${ |
|
|
|
|
group.materialName || group.materialCode |
|
|
|
|
`分组【${group.materialName || group.materialCode |
|
|
|
|
}】:已选物资出库数量总和(${totalSelectedNum})与申请数量(${applyNum})不一致` |
|
|
|
|
); |
|
|
|
|
hasError = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// 【关键步骤】将当前分组的选中项加入最终列表 |
|
|
|
|
// 确保包含所有必要字段,特别是经过 proposerChangeTable 更新后的 userId/userName |
|
|
|
|
selectedItems.forEach(item => { |
|
|
|
|
finalDetailList.push({ |
|
|
|
|
...item, |
|
|
|
|
// 确保数值类型正确 |
|
|
|
|
num: Number(item.num) || 0, |
|
|
|
|
unitPrice: Number(item.unitPrice) || 0 |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (hasError) { |
|
|
|
|
return; // 阻止提交 |
|
|
|
|
} |
|
|
|
|
// 【合并数据】将构建好的列表赋值给 sizeForm |
|
|
|
|
this.sizeForm.ldTwoOutStorageDetailList = finalDetailList; |
|
|
|
|
console.log("非自由出库合并后的明细数据:", finalDetailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ===== 自由出库:校验是否有明细 ===== |
|
|
|
|
@ -918,8 +849,18 @@ export default { |
|
|
|
|
this.$message.error("请至少选择一项物资"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const freeMissingUser = this.sizeForm.ldTwoOutStorageDetailList.find( |
|
|
|
|
(item) => item.type === "NY" && (!item.userId || item.userId === "") |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (freeMissingUser) { |
|
|
|
|
this.$message.error( |
|
|
|
|
`物资【${freeMissingUser.materialName}】为耐用品,请选择实际使用人` |
|
|
|
|
); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log("form", this.sizeForm); |
|
|
|
|
submit(this.sizeForm).then((res) => { |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
@ -951,6 +892,7 @@ export default { |
|
|
|
|
padding-right: 10px; |
|
|
|
|
/* 预留滚动条空间 */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
::v-deep.el-table th.el-table__cell { |
|
|
|
|
background: #f5f7fa; |
|
|
|
|
font-weight: 500; |
|
|
|
|
|