解决冲突

# Conflicts:
#	src/views/secondOrder/components/categoryDialog.vue
#	src/views/secondOrder/components/outDialog.vue
master
taozi 4 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 { return {
formData: { formData: {
returnReason: '', returnReason: '',
returnTime: defaultDate, returnTime: defaultDate,
}, },
purchaseTitle:'报废', purchaseTitle:'报废',
openShow: false, openShow: false,
@ -95,10 +95,10 @@ export default {
if (valid) { if (valid) {
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
} }
await returnMaterial(params) await returnMaterial(params)

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

@ -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="closeDialog"></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(
!this.sizeForm.ldTwoOutStorageDetailList.some( (newItem) =>
oldItem => oldItem.id === newItem.id !this.sizeForm.ldTwoOutStorageDetailList.some(
) (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,6 +521,7 @@ export default {
}, },
handleCloseDetail() { handleCloseDetail() {
this.outDialogVisible = false; this.outDialogVisible = false;
<<<<<<< HEAD
this.$emit("handleCloseDetail"); this.$emit("handleCloseDetail");
}, },
@ -410,6 +529,15 @@ export default {
closeDialog() { closeDialog() {
this.categoryVisible = false this.categoryVisible = false
}, },
=======
this.$emit("handleCloseDetail");
},
categoryClose() {
this.categoryVisible = false;
},
>>>>>>> 94e2170923f61585374217a741bc58b7f0790b1e
inInit() { inInit() {
if (this.outDialogType != "add") { if (this.outDialogType != "add") {
getDetails({ twoOutStorageId: this.rowData.id }).then((res) => { getDetails({ twoOutStorageId: this.rowData.id }).then((res) => {
@ -439,7 +567,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