二级出库逻辑调整

master
zhangdi 4 months ago
parent 8b36334de6
commit 94e2170923
  1. 2
      src/views/materials/components/scrapDialog.vue
  2. 34
      src/views/materials/expend.vue
  3. 148
      src/views/secondOrder/components/categoryDialog.vue
  4. 324
      src/views/secondOrder/components/outDialog.vue
  5. 1
      src/views/secondOrder/inbound.vue

@ -96,7 +96,7 @@ export default {
try { try {
const params = { const params = {
durableFormId: this.durableFormId, durableFormId: this.durableFormId,
num: 1, num: 0,
returnTime: this.formData.returnTime, returnTime: this.formData.returnTime,
returnReason: this.formData.returnReason, returnReason: this.formData.returnReason,
type: 2 type: 2

@ -18,6 +18,11 @@
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
> >
<template slot="isBorrow" slot-scope="scope">
<span v-if="scope.row.isBorrow == '0'">已借出</span>
<span v-else-if="scope.row.isBorrow == '1'">已归还</span>
<span v-else-if="scope.row.isBorrow == '2'">已报废</span>
</template>
<template slot-scope="scope" slot="menu"> <template slot-scope="scope" slot="menu">
<el-button <el-button
v-if="scope.row.isBorrow == '0'" v-if="scope.row.isBorrow == '0'"
@ -183,41 +188,12 @@ export default {
prop: "isBorrow", prop: "isBorrow",
headerAlign: "center", headerAlign: "center",
align: "center", align: "center",
type: "select",
dicData: [
{
label: "已借出",
value: "0",
},
{
label: "已归还",
value: "1",
},
{
label: "已报废",
value: "2",
},
],
formatter: (row, column) => {
const value = row.purchaseEndInfo;
if (value === null || value === undefined || value === "") {
return "无"; //
}
return value; //
}
}, },
{ {
label: "归还时间", label: "归还时间",
prop: "returnTime", prop: "returnTime",
headerAlign: "center", headerAlign: "center",
align: "center", align: "center",
formatter: (row, column) => {
const value = row.returnTime;
if (value === null || value === undefined || value === "") {
return "无"; //
}
return value; //
}
}, },
], ],
}, },

@ -1,14 +1,36 @@
<template> <template>
<el-dialog :close-on-click-modal="false" :title="categoryDialogTitle" :visible.sync="categoryVisible" <el-dialog
:append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen> :close-on-click-modal="false"
:title="categoryDialogTitle"
:visible.sync="categoryVisible"
:append-to-body="true"
width="70%"
@close="handleCancel"
fullscreen
>
<el-tabs v-model="transactionType" @tab-click="handleTabClick"> <el-tabs v-model="transactionType" @tab-click="handleTabClick">
<el-tab-pane label="易耗品" name="YH"></el-tab-pane> <el-tab-pane label="易耗品" name="YH"></el-tab-pane>
<el-tab-pane label="耐用品" name="NY"></el-tab-pane> <el-tab-pane label="耐用品" name="NY"></el-tab-pane>
</el-tabs> </el-tabs>
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page" <avue-crud
:permission="permissionList" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" :option="option"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" :table-loading="loading"
@refresh-change="refreshChange" @on-load="onLoad" @row-change="handleRowChange"> :data="data"
ref="crud"
v-model="form"
:page.sync="page"
:permission="permissionList"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@select="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
@row-change="handleRowChange"
row-key="id"
>
</avue-crud> </avue-crud>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
@ -24,20 +46,20 @@ export default {
props: { props: {
categoryVisible: { categoryVisible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
categoryDialogTitle: { categoryDialogTitle: {
type: String, type: String,
default: '' default: "",
}, },
departmentId: { departmentId: {
type: [String, Number], type: [String, Number],
default: '' default: "",
}, },
selectionData: { selectionData: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
data() { data() {
return { return {
@ -138,7 +160,7 @@ export default {
return "-"; return "-";
} }
return value; return value;
} },
}, },
], ],
}, },
@ -151,7 +173,7 @@ export default {
currentRow: null, currentRow: null,
allSelectedList: [], allSelectedList: [],
isUpdatingSelection: false, isUpdatingSelection: false,
} };
}, },
mounted() { mounted() {
// 使selectionData // 使selectionData
@ -184,8 +206,8 @@ export default {
// allSelectedList // allSelectedList
currentPageData.forEach((item) => { currentPageData.forEach((item) => {
const isSelected = this.allSelectedList.some(selectedItem => const isSelected = this.allSelectedList.some(
selectedItem.id === item.id (selectedItem) => selectedItem.id === item.id
); );
if (isSelected) { if (isSelected) {
@ -196,49 +218,58 @@ export default {
// //
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.isUpdatingSelection = false this.isUpdatingSelection = false;
}, 100); }, 100);
}); });
}, },
// //
selectionChange(selection) { selectionChange(selection,row) {
let isSelectedInfo = selection.filter(
(item) => item.id==row.id
);
if (this.isUpdatingSelection) { if (this.isUpdatingSelection) {
return; return;
} }
console.log('当前选择:', selection)
console.log('当前页面数据:', this.data)
console.log('当前全部勾选:', this.allSelectedList)
// ID // ID
const currentPageIds = this.data.map(item => item.id); const currentPageIds = this.data.map((item) => item.id);
const otherPageSelected = this.allSelectedList.filter(item => const otherPageSelected = this.allSelectedList.filter(
!currentPageIds.includes(item.id) (item) => !currentPageIds.includes(item.id)
); );
const currentSelected = selection.map(item => ({ const currentSelected = selection.map((item) => ({
...item, ...item,
twoInventoryId: item.id twoInventoryId: item.id,
})); }));
// //
const combinedSelection = [ const combinedSelection = [
...otherPageSelected, // ...otherPageSelected, //
...currentSelected // ...currentSelected, //
]; ];
// allSelectedList // allSelectedList
this.allSelectedList = this.uniqueById(combinedSelection) this.allSelectedList = this.uniqueById(combinedSelection);
console.log('更新后的allSelectedList:', this.allSelectedList) if(isSelectedInfo.length<=0){
this.allSelectedList=this.allSelectedList.filter(
(item) => item.id!==row.id
);
}
console.log('isSelectedInfo', this.allSelectedList);
this.allSelectedList.forEach(item=>{
item.num = 0
})
// console.log("allSelectedList:", this.allSelectedList);
}, },
// //
uniqueById(arr) { uniqueById(arr) {
const uniqueObj = {}; const uniqueObj = {};
arr.forEach(item => { arr.forEach((item) => {
if (item.id && !uniqueObj[item.id]) { if (item.id && !uniqueObj[item.id]) {
uniqueObj[item.id] = item; uniqueObj[item.id] = item;
} }
@ -248,69 +279,72 @@ export default {
// //
handleConfirm() { handleConfirm() {
const uniqueList = this.uniqueById(this.allSelectedList) const uniqueList = this.uniqueById(this.allSelectedList);
this.$emit("confirm", uniqueList) this.$emit("confirm", uniqueList);
}, },
handleCloseDetail() {
this.$emit('handleCloseDetail')
},
selectionClear() { selectionClear() {
this.allSelectedList = [] this.allSelectedList = [];
if (this.$refs.crud) { if (this.$refs.crud) {
this.$refs.crud.toggleSelection() this.$refs.crud.toggleSelection();
} }
}, },
currentChange(currentPage) { currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
this.onLoad(this.page, this.query) this.onLoad(this.page, this.query);
}, },
sizeChange(pageSize) { sizeChange(pageSize) {
this.page.pageSize = pageSize; this.page.pageSize = pageSize;
this.onLoad(this.page, this.query) this.onLoad(this.page, this.query);
}, },
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query) this.onLoad(this.page, this.query);
}, },
handleTabClick() { handleTabClick() {
this.page.currentPage = 1 this.page.currentPage = 1;
this.onLoad(this.page) this.onLoad(this.page);
}, },
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true this.loading = true;
const requestParams = Object.assign({}, params, this.query, { const requestParams = Object.assign({}, params, this.query, {
num: 0, num: 0,
departmentId: this.departmentId departmentId: this.departmentId,
}); });
const apiPromise = this.transactionType === "YH" const apiPromise =
this.transactionType === "YH"
? getList(page.currentPage, page.pageSize, requestParams) ? getList(page.currentPage, page.pageSize, requestParams)
: fetchDurableApi(page.currentPage, page.pageSize, requestParams) : fetchDurableApi(page.currentPage, page.pageSize, requestParams);
apiPromise.then((res) => { apiPromise
this.data = res.data.result.list .then((res) => {
this.page.total = res.data.result.total this.data = res.data.result.list;
this.page.total = res.data.result.total;
// //
this.$nextTick(() => { this.$nextTick(() => {
this.updateCurrentPageSelection() this.updateCurrentPageSelection();
}); });
}).catch(error => {
this.$message.error('加载数据失败: ' + error.message)
}).finally(() => {
this.loading = false;
}) })
.catch((error) => {
this.$message.error("加载数据失败: " + error.message);
})
.finally(() => {
this.loading = false;
});
}, },
handleCancel() { handleCancel() {
this.categoryVisible = false this.categoryVisible = false;
} this.$emit("categoryClose");
}, },
} },
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep.el-dialog__footer { ::v-deep.el-dialog__footer {

@ -1,30 +1,56 @@
<template> <template>
<div> <div>
<el-dialog :close-on-click-modal="false" :title="outDialogTiltle" :visible.sync="outDialogVisible" <el-dialog
:append-to-body="true" @close="handleCloseDetail" fullscreen> :close-on-click-modal="false"
:title="outDialogTiltle"
:visible.sync="outDialogVisible"
:append-to-body="true"
@close="handleCloseDetail"
fullscreen
>
<div class="dialog-content"> <div class="dialog-content">
<!-- 基本信息 --> <!-- 基本信息 -->
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic" <el-form
:rules="dynamicRules"> :model="sizeForm"
ref="dynamicValidateForm"
label-width="100px"
class="demo-dynamic"
:rules="dynamicRules"
>
<div class="form-title">基本信息</div> <div class="form-title">基本信息</div>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="出库申请时间"> <el-form-item label="出库申请时间">
<el-date-picker v-model="sizeForm.ldTwoOutStorage.outDate" type="date" placeholder="选择日期" <el-date-picker
style="width: 100%" disabled> v-model="sizeForm.ldTwoOutStorage.outDate"
type="date"
placeholder="选择日期"
style="width: 100%"
disabled
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="事由" prop="ldTwoOutStorage.reason"> <el-form-item label="事由" prop="ldTwoOutStorage.reason">
<el-input v-model="sizeForm.ldTwoOutStorage.reason" :disabled="outDialogType != 'add'" <el-input
placeholder="请输入"></el-input> v-model="sizeForm.ldTwoOutStorage.reason"
:disabled="outDialogType != 'add'"
placeholder="请输入"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="物资类型" prop="ldTwoOutStorage.materialType"> <el-form-item
<el-select v-model="sizeForm.ldTwoOutStorage.materialType" placeholder="请选择" style="width: 100%" label="物资类型"
:disabled="outDialogType != 'add'"> 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="1"></el-option>
<el-option label="其他物资" value="2"></el-option> <el-option label="其他物资" value="2"></el-option>
</el-select> </el-select>
@ -32,74 +58,119 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="部门" prop="ldTwoOutStorage.departmentInfo"> <el-form-item label="部门" prop="ldTwoOutStorage.departmentInfo">
<el-select v-model="sizeForm.ldTwoOutStorage.departmentInfo" placeholder="请选择" style="width: 100%" <el-select
:disabled="outDialogType != 'add'" @change="deptChange" clearable filterable value-key="departmentId"> v-model="sizeForm.ldTwoOutStorage.departmentInfo"
<el-option v-for="item in departmentOptions" :key="item.departmentId" :label="item.department" placeholder="请选择"
:value="item"></el-option> 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-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="领用人" prop="ldTwoOutStorage.proposerInfo"> <el-form-item label="领用人" prop="ldTwoOutStorage.proposerInfo">
<el-select v-model="sizeForm.ldTwoOutStorage.proposerInfo" placeholder="请选择" style="width: 100%" <el-select
:disabled="sizeForm.departmentId == '' || outDialogType == 'details' v-model="sizeForm.ldTwoOutStorage.proposerInfo"
" clearable filterable value-key="userId" @change="proposerChange"> placeholder="请选择"
<el-option v-for="item in userOptions" :key="item.userId" :label="item.name" :value="item"> 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-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="outDialogType == 'details'"> <el-col :span="12" v-if="outDialogType == 'details'">
<el-form-item label="填报人"> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>
<div class="form-title">{{ outDateInfo }} 出库信息</div> <div class="form-title">{{ outDateInfo }} 出库信息</div>
<!-- <el-button
<el-button
type="primary" type="primary"
size="mini" size="mini"
style="margin-bottom: 18px" style="margin-bottom: 18px"
@click="inTableAdd()" @click="categoryHandle"
v-if="outDialogType != 'details'" v-if="outDialogType != 'details'"
>新增</el-button >新增</el-button
> --> >
<el-button type="primary" size="mini" style="margin-bottom: 18px" @click="categoryHandle" <el-table
v-if="outDialogType != 'details'">新增</el-button> :data="sizeForm.ldTwoOutStorageDetailList"
<el-table :data="sizeForm.ldTwoOutStorageDetailList" border style="width: 100%"> border
style="width: 100%"
>
<el-table-column prop="materialCode" label="物资编码"> <el-table-column prop="materialCode" label="物资编码">
</el-table-column> </el-table-column>
<!-- <el-table-column prop="str2" label="物资名称">
<template slot-scope="scope"> <el-table-column
<el-select v-model="scope.row.materialitem" placeholder="请选择物资名称" style="width: 100%" @change=" prop="materialName"
handleMaterialChange(scope.row.materialitem, scope.$index) label="物资名称"
" v-if="outDialogType != 'details'" value-key="id"> ></el-table-column>
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName" :value="item">
</el-option>
</el-select>
<span v-else> {{ scope.row.materialName }}</span>
</template>
</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="model" label="规格/型号"> </el-table-column>
<!-- <el-table-column prop="type" label="类别"> </el-table-column> -->
<el-table-column prop="type" label="类别"> <el-table-column prop="type" label="类别">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.type === "NY" ? "耐用品" : (scope.row.type === "YH" ? "易耗品" : "") }} {{
scope.row.type === "NY"
? "耐用品"
: scope.row.type === "YH"
? "易耗品"
: ""
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位"> </el-table-column> <el-table-column prop="unit" label="单位"> </el-table-column>
<el-table-column prop="num" label="数量"> <el-table-column prop="num" label="数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.num" :min="1" style="width: 100%" <el-input-number
size="mini"
v-model="scope.row.num"
:min="0"
style="width: 100%"
:disabled="outDialogType != 'add' || scope.row.type === 'NY'" :disabled="outDialogType != 'add' || scope.row.type === 'NY'"
@change="(newValue) => handleQuantityChange(newValue, scope.$index)"></el-input-number> @change="
(newValue) => handleQuantityChange(newValue, scope.$index)
"
></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" style="text-align: center;" v-if="outDialogType != 'details'"> <el-table-column
label="操作"
width="100"
v-if="outDialogType != 'details'"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div style="text-align: center;" :disabled="outDialogType == 'details'"> <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> </el-button>
</div> </div>
@ -109,7 +180,12 @@
<div class="form-title" v-if="outDialogType != 'details'"> <div class="form-title" v-if="outDialogType != 'details'">
出库账目表格 出库账目表格
</div> </div>
<el-table :data="sizeForm.inAccountsTableData" 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="当前库存"> <el-table-column prop="date" label="当前库存">
<el-table-column prop="materialCode" label="编码"> <el-table-column prop="materialCode" label="编码">
</el-table-column> </el-table-column>
@ -118,13 +194,29 @@
<el-table-column prop="model" label="规格"> </el-table-column> <el-table-column prop="model" label="规格"> </el-table-column>
<el-table-column prop="type" label="类别"> </el-table-column> <el-table-column prop="type" label="类别"> </el-table-column>
<el-table-column prop="unit" label="单位"> </el-table-column> <el-table-column prop="unit" label="单位"> </el-table-column>
<el-table-column prop="oldNum" label="数量"> </el-table-column> <el-table-column prop="num" label="数量"> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column prop="date" label="出库信息"> <el-table-column prop="date" label="出库信息">
<el-table-column prop="num" label="数量"> </el-table-column> <el-table-column prop="theOutboundQuantity" label="数量"> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column prop="date" label="出库后库存"> <el-table-column prop="date" label="出库后库存">
<el-table-column prop="newNum" label="数量"> </el-table-column> <el-table-column prop="totalQuantity" label="数量"> </el-table-column>
</el-table-column>
<el-table-column prop="date" label="出库信息">
<el-table-column label="出库人">
<template slot-scope="scope">
{{
scope.row.userInfoVO
? scope.row.userInfoVO.name
: sizeForm.userInfoVO.name
}}
</template>
</el-table-column>
<el-table-column prop="outDateInfo" label="出库时间" width="150">
<template slot-scope="scope">
{{ outDateInfo }}
</template>
</el-table-column>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form> </el-form>
@ -132,26 +224,39 @@
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handleCloseDetail()"> </el-button> <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> </span>
</el-dialog> </el-dialog>
<categoryDialog v-if="categoryVisible" :categoryVisible='categoryVisible' :selectionData="selectionData" <!-- 新增数据 -->
:departmentId="sizeForm.ldTwoOutStorage.departmentId" :categoryDialogTitle="categoryDialogTitle" <categoryDialog
@confirm="confirm" @handleCloseDetail="handleCloseDetail"></categoryDialog> v-if="categoryVisible"
:categoryVisible="categoryVisible"
:selectionData="selectionData"
:departmentId="sizeForm.ldTwoOutStorage.departmentId"
:categoryDialogTitle="categoryDialogTitle"
@confirm="confirm"
@categoryClose="categoryClose"
></categoryDialog>
</div> </div>
</template> </template>
<script> <script>
import { getDetailedItems } from "@/api/firstOrder/outbound"; import { getDetailedItems } from "@/api/firstOrder/outbound";
import categoryDialog from './categoryDialog.vue' import categoryDialog from "./categoryDialog.vue";
import { import {
getUserList, getUserList,
getMaterialList, getMaterialList,
submit, submit,
getDetails, getDetails,
getStatistics,
} from "@/api/secondOrder/outbound"; } from "@/api/secondOrder/outbound";
export default { export default {
components: { components: {
categoryDialog categoryDialog,
}, },
props: { props: {
repairVisible: { repairVisible: {
@ -200,9 +305,9 @@ export default {
return { return {
outDialogVisible: false, outDialogVisible: false,
categoryVisible: false, categoryVisible: false,
categoryDialogTitle: '出库', categoryDialogTitle: "出库",
allSelectedList:[], allSelectedList: [],
selectionData:[], selectionData: [],
sizeForm: { sizeForm: {
ldTwoOutStorage: { ldTwoOutStorage: {
outDate: "", outDate: "",
@ -215,7 +320,7 @@ export default {
submitName: "", // submitName: "", //
departmentInfo: null, departmentInfo: null,
proposerInfo: null, proposerInfo: null,
optionType: 'YH' optionType: "YH",
}, },
ldTwoOutStorageDetailList: [], // ldTwoOutStorageDetailList: [], //
inAccountsTableData: [], // inAccountsTableData: [], //
@ -265,6 +370,7 @@ export default {
userOptions: [], // userOptions: [], //
departmentOptions: [], // departmentOptions: [], //
dynamicRules: {}, // dynamicRules: {}, //
statisticsList: [], //
}; };
}, },
mounted() { mounted() {
@ -278,54 +384,67 @@ export default {
this.getDetailedItems(); this.getDetailedItems();
}, },
methods: { methods: {
//
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,
};
});
});
},
categoryHandle() { categoryHandle() {
this.categoryVisible = true
if((!this.sizeForm.ldTwoOutStorage.proposerInfo)||(!this.sizeForm.ldTwoOutStorage.departmentInfo)){
this.$message.error('请先选择部门和领用人');
return false
}
this.categoryVisible = true;
}, },
confirm(allSelectedList) { confirm(allSelectedList) {
console.log('allSelectedList-------',allSelectedList) console.log("allSelectedList-------", allSelectedList);
// this.selectionData = allSelectedList // this.selectionData = allSelectedList
allSelectedList.map(item =>{ allSelectedList.map((item) => {
this.selectionData.push(item) this.selectionData.push(item);
}) });
this.categoryVisible = false; this.categoryVisible = false;
// //
const newItems = allSelectedList.filter(newItem => const newItems = allSelectedList.filter(
(newItem) =>
!this.sizeForm.ldTwoOutStorageDetailList.some( !this.sizeForm.ldTwoOutStorageDetailList.some(
oldItem => oldItem.id === newItem.id (oldItem) => oldItem.id === newItem.id
) )
); );
// //
this.sizeForm.ldTwoOutStorageDetailList = [ this.sizeForm.ldTwoOutStorageDetailList = allSelectedList;
...this.sizeForm.ldTwoOutStorageDetailList, console.log(
...newItems "ldTwoOutStorageDetailList--------",
]; this.sizeForm.ldTwoOutStorageDetailList
console.log('ldTwoOutStorageDetailList--------',this.sizeForm.ldTwoOutStorageDetailList) );
// //
this.summaryTableData(); // this.summaryTableData();
}, this.getStatistics();
categoryHandle() {
this.categoryVisible = true;
}, },
// //
handleDelete(index, row) { handleDelete(index, row) {
this.sizeForm.ldTwoOutStorageDetailList.splice(index, 1) this.sizeForm.ldTwoOutStorageDetailList.splice(index, 1);
this.getStatistics()
}, },
// inAccountsTableData // inAccountsTableData
summaryTableData() { summaryTableData() {
this.sizeForm.inAccountsTableData = JSON.parse(JSON.stringify(this.sizeForm.ldTwoOutStorageDetailList)) this.sizeForm.inAccountsTableData = JSON.parse(
}, JSON.stringify(this.sizeForm.ldTwoOutStorageDetailList)
// handleQuantityChange(newValue, index) { );
// const currentRow = this.sizeForm.ldTwoOutStorageDetailList[index]; },
// console.log(currentRow,'c')
// if (currentRow.materialCode != '') {
// currentRow.oldNum = currentRow.materialitem.num
// currentRow.num = currentRow.num
// currentRow.newNum = currentRow.materialitem.num - currentRow.num
// }
// this.$set(this.sizeForm.inAccountsTableData, index, currentRow)
// this.sizeForm.inAccountsTableData[index] = currentRow
// },
handleQuantityChange(newValue, index) { handleQuantityChange(newValue, index) {
const currentRow = this.sizeForm.ldTwoOutStorageDetailList[index]; const currentRow = this.sizeForm.ldTwoOutStorageDetailList[index];
if (!currentRow) return; if (!currentRow) return;
@ -335,12 +454,13 @@ export default {
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow }); this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
return; return;
} }
const stockNum = currentRow.num // const stockNum = currentRow.num; //
currentRow.oldNum = stockNum // currentRow.oldNum = stockNum; //
currentRow.num = newValue // currentRow.num = newValue; //
currentRow.newNum = stockNum - newValue // currentRow.newNum = stockNum - newValue; //
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow) this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow);
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow }) this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
this.getStatistics()
}, },
// //
@ -364,8 +484,6 @@ export default {
row.materialName; row.materialName;
this.sizeForm.ldTwoOutStorageDetailList[index].type = row.type; this.sizeForm.ldTwoOutStorageDetailList[index].type = row.type;
this.sizeForm.ldTwoOutStorageDetailList[index].unit = row.unit; this.sizeForm.ldTwoOutStorageDetailList[index].unit = row.unit;
}, },
// //
getUserList(value) { getUserList(value) {
@ -393,7 +511,7 @@ export default {
this.sizeForm.ldTwoOutStorage.department = value.department; this.sizeForm.ldTwoOutStorage.department = value.department;
this.getUserList(value.departmentId); this.getUserList(value.departmentId);
this.getMaterialList(value.departmentId); this.getMaterialList(value.departmentId);
this.sizeForm.ldTwoOutStorageDetailList = [] this.sizeForm.ldTwoOutStorageDetailList = [];
}, },
// //
proposerChange(value) { proposerChange(value) {
@ -403,9 +521,13 @@ export default {
}, },
handleCloseDetail() { handleCloseDetail() {
this.outDialogVisible = false; this.outDialogVisible = false;
this.categoryVisible = false
this.$emit("handleCloseDetail"); this.$emit("handleCloseDetail");
}, },
categoryClose() {
this.categoryVisible = false;
},
inInit() { inInit() {
if (this.outDialogType != "add") { if (this.outDialogType != "add") {
getDetails({ twoOutStorageId: this.rowData.id }).then((res) => { getDetails({ twoOutStorageId: this.rowData.id }).then((res) => {
@ -435,7 +557,7 @@ export default {
// , // ,
inTableAdd() { inTableAdd() {
this.sizeForm.ldTwoOutStorageDetailList.push({}); this.sizeForm.ldTwoOutStorageDetailList.push({});
this.summaryTableData() this.summaryTableData();
}, },
// //
sumbit() { sumbit() {

@ -192,6 +192,7 @@ export default {
}, },
closeDialog() { closeDialog() {
this.purchaseOpen = false; this.purchaseOpen = false;
this.onLoad(this.page);
}, },
handleCloseDetail(table) { handleCloseDetail(table) {
this.inDialogVisible = false; this.inDialogVisible = false;

Loading…
Cancel
Save