解决冲突

# Conflicts:
#	src/views/secondOrder/components/categoryDialog.vue
#	src/views/secondOrder/components/outDialog.vue
master
taozi 3 months ago
commit 7a03181d04
  1. 10
      src/views/materials/components/scrapDialog.vue
  2. 40
      src/views/materials/expend.vue
  3. 595
      src/views/secondOrder/components/categoryDialog.vue
  4. 330
      src/views/secondOrder/components/outDialog.vue
  5. 1
      src/views/secondOrder/inbound.vue

@ -35,7 +35,7 @@ export default {
return {
formData: {
returnReason: '',
returnTime: defaultDate,
returnTime: defaultDate,
},
purchaseTitle:'报废',
openShow: false,
@ -95,10 +95,10 @@ export default {
if (valid) {
try {
const params = {
durableFormId: this.durableFormId,
num: 1,
returnTime: this.formData.returnTime,
returnReason: this.formData.returnReason,
durableFormId: this.durableFormId,
num: 0,
returnTime: this.formData.returnTime,
returnReason: this.formData.returnReason,
type: 2
}
await returnMaterial(params)

@ -18,6 +18,11 @@
@refresh-change="refreshChange"
@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">
<el-button
v-if="scope.row.isBorrow == '0'"
@ -43,7 +48,7 @@
:showDialog="returnShow"
:rowDta="returnInfo"
@closeDialog="closeDialog"
:durableFormId="returnInfo.id"
:durableFormId="returnInfo.id"
@submitSuccess="handleRefresh"
></returnDialog>
<!-- 报废 -->
@ -52,7 +57,7 @@
:showDialog="scrapShow"
:rowDta="scrapInfo"
@closeDialog="closeDialog"
:durableFormId="scrapInfo.id"
:durableFormId="scrapInfo.id"
@submitSuccess="handleRefresh"
></scrapDialog>
</div>
@ -171,7 +176,7 @@ export default {
headerAlign: "center",
align: "center",
},
// {
// label: "",
// prop: "amount",
@ -183,41 +188,12 @@ export default {
prop: "isBorrow",
headerAlign: "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: "归还时间",
prop: "returnTime",
headerAlign: "center",
align: "center",
formatter: (row, column) => {
const value = row.returnTime;
if (value === null || value === undefined || value === "") {
return "无"; //
}
return value; //
}
},
],
},

@ -1,305 +1,362 @@
<template>
<el-dialog :close-on-click-modal="false" :title="categoryDialogTitle" :visible.sync="categoryVisible"
:append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen>
<el-tabs v-model="transactionType" @tab-click="handleTabClick">
<el-tab-pane label="易耗品" name="YH"></el-tab-pane>
<el-tab-pane label="耐用品" name="NY"></el-tab-pane>
</el-tabs>
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page"
:permission="permissionList" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad" @row-change="handleRowChange">
</avue-crud>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCloseDetail">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
</el-dialog>
<el-dialog
: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-tab-pane label="易耗品" name="YH"></el-tab-pane>
<el-tab-pane label="耐用品" name="NY"></el-tab-pane>
</el-tabs>
<avue-crud
:option="option"
:table-loading="loading"
: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>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
</el-dialog>
</template>
<script>
import { getList } from "@/api/secondOrder/list.js";
import { getList as fetchDurableApi } from "@/api/materials/expend";
export default {
props: {
categoryVisible: {
type: Boolean,
default: false
},
categoryDialogTitle: {
type: String,
default: ''
},
departmentId: {
type: String,
default: ''
},
selectionData: {
type: Array,
default: () => []
}
props: {
categoryVisible: {
type: Boolean,
default: false,
},
data() {
return {
form: {},
selectionList: [],
newselection: [],
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
reserveSelection: true,
calcHeight: 30,
tip: false,
searchShow: true,
searchMenuSpan: 18,
border: true,
index: true,
selection: true,
viewBtn: true,
dialogClickModal: false,
menu: false,
addBtn: false,
printBtn: false,
refreshBtn: false,
gridBtn: false,
gridBackgroundImage: false,
gridSpan: false,
filterBtn: false,
columnBtn: false,
menuAlign: "left",
searchMenuPosition: "right",
menuWidth: 80,
selectable: (row, index) => row.num !== 0,
column: [
{
label: "存货编号",
prop: "materialCode",
headerAlign: "center",
align: "center",
},
{
label: "存货名称",
prop: "materialName",
search: true,
headerAlign: "center",
align: "left",
},
{
label: "规格型号",
prop: "model",
headerAlign: "center",
align: "left",
},
{
label: "类别",
prop: "type",
search: false,
type: "select",
headerAlign: "center",
align: "center",
value: "NY",
disabled: true,
dicData: [
{
label: "易耗品",
value: "YH",
},
{
label: "耐用品",
value: "NY",
},
],
},
{
label: "计量单位",
prop: "unit",
headerAlign: "center",
align: "center",
},
{
label: "数量",
prop: "num",
headerAlign: "center",
align: "center",
},
{
label: "单价",
prop: "unitPrice",
headerAlign: "center",
align: "center",
formatter: (row, column) => {
const value = row.unitPrice;
if (value === null || value === undefined || value === "") {
return "-";
}
return value;
}
},
],
categoryDialogTitle: {
type: String,
default: "",
},
departmentId: {
type: [String, Number],
default: "",
},
selectionData: {
type: Array,
default: () => [],
},
},
data() {
return {
form: {},
selectionList: [],
newselection: [],
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
reserveSelection: true,
calcHeight: 30,
tip: false,
searchShow: true,
searchMenuSpan: 18,
border: true,
index: true,
selection: true,
viewBtn: true,
dialogClickModal: false,
menu: false,
addBtn: false,
printBtn: false,
refreshBtn: false,
gridBtn: false,
gridBackgroundImage: false,
gridSpan: false,
filterBtn: false,
columnBtn: false,
menuAlign: "left",
searchMenuPosition: "right",
menuWidth: 80,
selectable: (row, index) => row.num !== 0,
column: [
{
label: "存货编号",
prop: "materialCode",
headerAlign: "center",
align: "center",
},
{
label: "存货名称",
prop: "materialName",
search: true,
headerAlign: "center",
align: "left",
},
{
label: "规格型号",
prop: "model",
headerAlign: "center",
align: "left",
},
{
label: "类别",
prop: "type",
search: false,
type: "select",
headerAlign: "center",
align: "center",
value: "NY",
disabled: true,
dicData: [
{
label: "易耗品",
value: "YH",
},
{
label: "耐用品",
value: "NY",
},
],
},
{
label: "计量单位",
prop: "unit",
headerAlign: "center",
align: "center",
},
{
label: "数量",
prop: "num",
headerAlign: "center",
align: "center",
},
{
label: "单价",
prop: "unitPrice",
headerAlign: "center",
align: "center",
formatter: (row, column) => {
const value = row.unitPrice;
if (value === null || value === undefined || value === "") {
return "-";
}
return value;
},
data: [],
dialogLogVisible: false,
transactionType: "YH",
tableData: [],
ckTable: [],
rkTable: [],
currentRow: null,
allSelectedList: [],
isUpdatingSelection: false,
}
},
],
},
data: [],
dialogLogVisible: false,
transactionType: "YH",
tableData: [],
ckTable: [],
rkTable: [],
currentRow: null,
allSelectedList: [],
isUpdatingSelection: false,
};
},
mounted() {
// 使selectionData
this.allSelectedList = [...this.selectionData];
this.onLoad(this.page);
},
methods: {
//
searchReset() {
this.query = {};
this.onLoad(this.page);
},
mounted() {
// 使selectionData
this.allSelectedList = [...this.selectionData];
this.onLoad(this.page);
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
methods: {
//
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
//
updateCurrentPageSelection() {
if (!this.$refs.crud || !this.data) return;
this.isUpdatingSelection = true;
const currentPageData = this.data
//
this.$refs.crud.toggleSelection();
//
updateCurrentPageSelection() {
if (!this.$refs.crud || !this.data) return;
// allSelectedList
currentPageData.forEach((item) => {
const isSelected = this.allSelectedList.some(selectedItem =>
selectedItem.id === item.id
);
this.isUpdatingSelection = true;
if (isSelected) {
this.$refs.crud.toggleRowSelection(item, true);
}
const currentPageData = this.data || [];
});
//
this.$refs.crud.toggleSelection();
//
this.$nextTick(() => {
setTimeout(() => {
this.isUpdatingSelection = false
}, 100);
});
},
// allSelectedList
currentPageData.forEach((item) => {
const isSelected = this.allSelectedList.some(
(selectedItem) => selectedItem.id === item.id
);
selectionChange(selection) {
console.log(selection,'selection-------')
console.log(this.selectionData, '---selectionData')
const currentPageIds = this.selectionData.map(item => item.id)
let arr = selection.filter(item => !currentPageIds.includes(item.id)) //
const selectionWithTwoInventoryId = arr.map(item => ({
...item,
twoInventoryId: item.id
}))
this.allSelectedList.push(...selectionWithTwoInventoryId);
this.allSelectedList = this.uniqueById(this.allSelectedList);
},
//
uniqueById(arr) {
const uniqueObj = {};
arr.forEach(item => {
if (item.id && !uniqueObj[item.id]) {
uniqueObj[item.id] = item;
}
});
return Object.values(uniqueObj);
},
if (isSelected) {
this.$refs.crud.toggleRowSelection(item, true);
}
});
//
handleConfirm() {
const uniqueList = this.uniqueById(this.allSelectedList)
this.$emit("confirm", uniqueList)
},
//
this.$nextTick(() => {
setTimeout(() => {
this.isUpdatingSelection = false;
}, 100);
});
},
handleCloseDetail() {
this.$emit('handleCloseDetail')
},
//
selectionChange(selection,row) {
selectionClear() {
this.allSelectedList = []
if (this.$refs.crud) {
this.$refs.crud.toggleSelection()
}
},
let isSelectedInfo = selection.filter(
(item) => item.id==row.id
);
if (this.isUpdatingSelection) {
return;
}
currentChange(currentPage) {
this.page.currentPage = currentPage;
this.onLoad(this.page, this.query)
},
// ID
const currentPageIds = this.data.map((item) => item.id);
sizeChange(pageSize) {
this.page.pageSize = pageSize;
this.onLoad(this.page, this.query)
},
const otherPageSelected = this.allSelectedList.filter(
(item) => !currentPageIds.includes(item.id)
);
refreshChange() {
this.onLoad(this.page, this.query)
},
const currentSelected = selection.map((item) => ({
...item,
twoInventoryId: item.id,
}));
handleTabClick() {
this.page.currentPage = 1
this.onLoad(this.page)
},
//
const combinedSelection = [
...otherPageSelected, //
...currentSelected, //
];
onLoad(page, params = {}) {
this.loading = true
const requestParams = Object.assign({}, params, this.query, {
num: 0,
departmentId: this.departmentId
});
const apiPromise = this.transactionType === "YH"
? getList(page.currentPage, page.pageSize, requestParams)
: fetchDurableApi(page.currentPage, page.pageSize, requestParams)
apiPromise.then((res) => {
this.data = res.data.result.list
this.page.total = res.data.result.total
// allSelectedList
this.allSelectedList = this.uniqueById(combinedSelection);
//
this.$nextTick(() => {
this.updateCurrentPageSelection()
});
}).catch(error => {
this.$message.error('加载数据失败: ' + error.message)
}).finally(() => {
this.loading = false;
})
},
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);
},
handleCancel() {
this.categoryVisible = false
//
uniqueById(arr) {
const uniqueObj = {};
arr.forEach((item) => {
if (item.id && !uniqueObj[item.id]) {
uniqueObj[item.id] = item;
}
});
return Object.values(uniqueObj);
},
}
//
handleConfirm() {
const uniqueList = this.uniqueById(this.allSelectedList);
this.$emit("confirm", uniqueList);
},
selectionClear() {
this.allSelectedList = [];
if (this.$refs.crud) {
this.$refs.crud.toggleSelection();
}
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
this.onLoad(this.page, this.query);
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
this.onLoad(this.page, this.query);
},
refreshChange() {
this.onLoad(this.page, this.query);
},
handleTabClick() {
this.page.currentPage = 1;
this.onLoad(this.page);
},
onLoad(page, params = {}) {
this.loading = true;
const requestParams = Object.assign({}, params, this.query, {
num: 0,
departmentId: this.departmentId,
});
const apiPromise =
this.transactionType === "YH"
? getList(page.currentPage, page.pageSize, requestParams)
: fetchDurableApi(page.currentPage, page.pageSize, requestParams);
apiPromise
.then((res) => {
this.data = res.data.result.list;
this.page.total = res.data.result.total;
//
this.$nextTick(() => {
this.updateCurrentPageSelection();
});
})
.catch((error) => {
this.$message.error("加载数据失败: " + error.message);
})
.finally(() => {
this.loading = false;
});
},
handleCancel() {
this.categoryVisible = false;
this.$emit("categoryClose");
},
},
};
</script>
<style lang="scss" scoped>
::v-deep.el-dialog__footer {
position: fixed !important;
bottom: 0 !important;
right: 0 !important;
position: fixed !important;
bottom: 0 !important;
right: 0 !important;
}
::v-deep.dialog-content {
max-height: calc(100vh - 200px);
overflow-y: auto;
padding-right: 10px;
overflow-x: hidden;
max-height: calc(100vh - 200px);
overflow-y: auto;
padding-right: 10px;
overflow-x: hidden;
}
</style>
</style>

@ -1,30 +1,56 @@
<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>
@ -32,74 +58,119 @@
</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" 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>
<!-- <el-button
<el-button
type="primary"
size="mini"
style="margin-bottom: 18px"
@click="inTableAdd()"
@click="categoryHandle"
v-if="outDialogType != 'details'"
>新增</el-button
> -->
<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%">
>
<el-table
:data="sizeForm.ldTwoOutStorageDetailList"
border
style="width: 100%"
>
<el-table-column prop="materialCode" label="物资编码">
</el-table-column>
<!-- <el-table-column prop="str2" label="物资名称">
<template slot-scope="scope">
<el-select v-model="scope.row.materialitem" placeholder="请选择物资名称" style="width: 100%" @change="
handleMaterialChange(scope.row.materialitem, scope.$index)
" v-if="outDialogType != 'details'" value-key="id">
<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="materialName"
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="类别">
<template slot-scope="scope">
{{ scope.row.type === "NY" ? "耐用品" : (scope.row.type === "YH" ? "易耗品" : "") }}
{{
scope.row.type === "NY"
? "耐用品"
: scope.row.type === "YH"
? "易耗品"
: ""
}}
</template>
</el-table-column>
<el-table-column prop="unit" label="单位"> </el-table-column>
<el-table-column prop="num" label="数量">
<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'"
@change="(newValue) => handleQuantityChange(newValue, scope.$index)"></el-input-number>
@change="
(newValue) => handleQuantityChange(newValue, scope.$index)
"
></el-input-number>
</template>
</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">
<div style="text-align: center;" :disabled="outDialogType == 'details'">
<el-button type="text" size="mini" @click="handleDelete(scope.$index, scope.row)">
<div :disabled="outDialogType == 'details'">
<el-button
type="text"
size="mini"
@click="handleDelete(scope.$index, scope.row)"
>
删除
</el-button>
</div>
@ -109,7 +180,12 @@
<div class="form-title" v-if="outDialogType != 'details'">
出库账目表格
</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="materialCode" label="编码">
</el-table-column>
@ -118,13 +194,29 @@
<el-table-column prop="model" 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="oldNum" label="数量"> </el-table-column>
<el-table-column prop="num" label="数量"> </el-table-column>
</el-table-column>
<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 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>
</el-form>
@ -132,26 +224,39 @@
<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" @handleCloseDetail="closeDialog"></categoryDialog>
<!-- 新增数据 -->
<categoryDialog
v-if="categoryVisible"
:categoryVisible="categoryVisible"
:selectionData="selectionData"
:departmentId="sizeForm.ldTwoOutStorage.departmentId"
:categoryDialogTitle="categoryDialogTitle"
@confirm="confirm"
@categoryClose="categoryClose"
></categoryDialog>
</div>
</template>
<script>
import { getDetailedItems } from "@/api/firstOrder/outbound";
import categoryDialog from './categoryDialog.vue'
import categoryDialog from "./categoryDialog.vue";
import {
getUserList,
getMaterialList,
submit,
getDetails,
getStatistics,
} from "@/api/secondOrder/outbound";
export default {
components: {
categoryDialog
categoryDialog,
},
props: {
repairVisible: {
@ -200,9 +305,9 @@ export default {
return {
outDialogVisible: false,
categoryVisible: false,
categoryDialogTitle: '出库',
allSelectedList:[],
selectionData:[],
categoryDialogTitle: "出库",
allSelectedList: [],
selectionData: [],
sizeForm: {
ldTwoOutStorage: {
outDate: "",
@ -215,7 +320,7 @@ export default {
submitName: "", //
departmentInfo: null,
proposerInfo: null,
optionType: 'YH'
optionType: "YH",
},
ldTwoOutStorageDetailList: [], //
inAccountsTableData: [], //
@ -265,6 +370,7 @@ export default {
userOptions: [], //
departmentOptions: [], //
dynamicRules: {}, //
statisticsList: [], //
};
},
mounted() {
@ -278,54 +384,67 @@ export default {
this.getDetailedItems();
},
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() {
this.categoryVisible = true
if((!this.sizeForm.ldTwoOutStorage.proposerInfo)||(!this.sizeForm.ldTwoOutStorage.departmentInfo)){
this.$message.error('请先选择部门和领用人');
return false
}
this.categoryVisible = true;
},
confirm(allSelectedList) {
console.log('allSelectedList-------',allSelectedList)
console.log("allSelectedList-------", allSelectedList);
// this.selectionData = allSelectedList
allSelectedList.map(item =>{
this.selectionData.push(item)
})
allSelectedList.map((item) => {
this.selectionData.push(item);
});
this.categoryVisible = false;
//
const newItems = allSelectedList.filter(newItem =>
!this.sizeForm.ldTwoOutStorageDetailList.some(
oldItem => oldItem.id === newItem.id
)
const newItems = allSelectedList.filter(
(newItem) =>
!this.sizeForm.ldTwoOutStorageDetailList.some(
(oldItem) => oldItem.id === newItem.id
)
);
//
this.sizeForm.ldTwoOutStorageDetailList = [
...this.sizeForm.ldTwoOutStorageDetailList,
...newItems
];
console.log('ldTwoOutStorageDetailList--------',this.sizeForm.ldTwoOutStorageDetailList)
this.sizeForm.ldTwoOutStorageDetailList = allSelectedList;
console.log(
"ldTwoOutStorageDetailList--------",
this.sizeForm.ldTwoOutStorageDetailList
);
//
this.summaryTableData();
},
categoryHandle() {
this.categoryVisible = true;
// this.summaryTableData();
this.getStatistics();
},
//
handleDelete(index, row) {
this.sizeForm.ldTwoOutStorageDetailList.splice(index, 1)
this.sizeForm.ldTwoOutStorageDetailList.splice(index, 1);
this.getStatistics()
},
// inAccountsTableData
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) {
const currentRow = this.sizeForm.ldTwoOutStorageDetailList[index];
if (!currentRow) return;
@ -335,12 +454,13 @@ export default {
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
return;
}
const stockNum = currentRow.num //
currentRow.oldNum = stockNum //
currentRow.num = newValue //
currentRow.newNum = stockNum - newValue //
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow)
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow })
const stockNum = currentRow.num; //
currentRow.oldNum = stockNum; //
currentRow.num = newValue; //
currentRow.newNum = stockNum - newValue; //
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow);
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
this.getStatistics()
},
//
@ -364,8 +484,6 @@ export default {
row.materialName;
this.sizeForm.ldTwoOutStorageDetailList[index].type = row.type;
this.sizeForm.ldTwoOutStorageDetailList[index].unit = row.unit;
},
//
getUserList(value) {
@ -393,7 +511,7 @@ export default {
this.sizeForm.ldTwoOutStorage.department = value.department;
this.getUserList(value.departmentId);
this.getMaterialList(value.departmentId);
this.sizeForm.ldTwoOutStorageDetailList = []
this.sizeForm.ldTwoOutStorageDetailList = [];
},
//
proposerChange(value) {
@ -403,6 +521,7 @@ export default {
},
handleCloseDetail() {
this.outDialogVisible = false;
<<<<<<< HEAD
this.$emit("handleCloseDetail");
},
@ -410,6 +529,15 @@ export default {
closeDialog() {
this.categoryVisible = false
},
=======
this.$emit("handleCloseDetail");
},
categoryClose() {
this.categoryVisible = false;
},
>>>>>>> 94e2170923f61585374217a741bc58b7f0790b1e
inInit() {
if (this.outDialogType != "add") {
getDetails({ twoOutStorageId: this.rowData.id }).then((res) => {
@ -439,7 +567,7 @@ export default {
// ,
inTableAdd() {
this.sizeForm.ldTwoOutStorageDetailList.push({});
this.summaryTableData()
this.summaryTableData();
},
//
sumbit() {

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

Loading…
Cancel
Save