|
|
|
|
@ -36,7 +36,7 @@ |
|
|
|
|
<el-form-item label="选项"> |
|
|
|
|
<el-radio-group v-model="sizeForm.options" @change="radioChange()" |
|
|
|
|
:disabled="outDialogType == 'details'"> |
|
|
|
|
<el-radio :label="1" :disabled="sizeForm.type == 2"><span @click="closeHandle">批量选择</span></el-radio> |
|
|
|
|
<el-radio :label="1" :disabled="sizeForm.type == 2"><span >批量选择</span></el-radio> |
|
|
|
|
<el-radio :label="2">单项选择</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
@ -58,7 +58,7 @@ |
|
|
|
|
</el-row> |
|
|
|
|
<div class="form-title">{{ outDate }} 出库信息:</div> |
|
|
|
|
<el-button type="primary" size="mini" style="margin-bottom: 18px;" @click="inTableAdd()" |
|
|
|
|
v-if="sizeForm.options == 2">新增</el-button> |
|
|
|
|
v-if="sizeForm.options == 2 && outDialogType != 'details'">新增</el-button> |
|
|
|
|
<el-table :data="sizeForm.inTableData" border style="width: 100%"> |
|
|
|
|
<el-table-column prop="materialCode" label="物资编码"> |
|
|
|
|
</el-table-column> |
|
|
|
|
@ -102,22 +102,22 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="applicationQuantity" label="申请数量" v-if="sizeForm.options == 1"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="outboundQuantity" label="已出库数量" v-if="sizeForm.options == 1"> |
|
|
|
|
<!-- <el-table-column prop="outboundQuantity" label="已出库数量" v-if="sizeForm.options == 1"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.row.outboundQuantity || 0 }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table-column> --> |
|
|
|
|
<el-table-column prop="theOutboundQuantity" label="本次出库数量"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input-number size="mini" v-model="scope.row.theOutboundQuantity" :min="0" style="width: 100%;" |
|
|
|
|
@change="syncInboundQuantity(scope.row)" :disabled="outDialogType == 'details'"></el-input-number> |
|
|
|
|
<!-- <span v-else>{{ scope.row.theOutboundQuantity || 0 }}</span> --> |
|
|
|
|
@change="syncInboundQuantity(scope.row)" :disabled="outDialogType == 'details'" |
|
|
|
|
v-if="sizeForm.optionType === 'YH' ||inBatchForm.optionType === 'YH'"></el-input-number> |
|
|
|
|
<span v-else>{{ scope.row.theOutboundQuantity = 1 }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" v-if="sizeForm.optionType === 'YH' || inBatchForm.optionType === 'YH'" |
|
|
|
|
style="text-align: center;"> |
|
|
|
|
<el-table-column label="操作" style="text-align: center;" v-if="outDialogType != 'details'"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div style="text-align: center;"> |
|
|
|
|
<div style="text-align: center;" :disabled="outDialogType == 'details'"> |
|
|
|
|
<el-button type="text" size="mini" @click="handleDelete(scope.$index, scope.row)"> |
|
|
|
|
删除 |
|
|
|
|
</el-button> |
|
|
|
|
@ -165,13 +165,13 @@ |
|
|
|
|
</el-table> |
|
|
|
|
</el-form> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="outDialogType != 'details'"> |
|
|
|
|
<el-button @click="handleCloseDetail()">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="submit(1)">暂存</el-button> |
|
|
|
|
<el-button type="primary" @click="submit(2)">提交</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<!-- 批量出库 选择弹窗 --> |
|
|
|
|
<!-- 批量出库 选择数据源弹窗 --> |
|
|
|
|
<el-dialog :close-on-click-modal="false" title="选择数据来源" :visible.sync="inBatchDialogVisible" :append-to-body="true" |
|
|
|
|
width="40%" @close="handleBatchClose" @open="getQuarterList"> |
|
|
|
|
<el-form :model="inBatchForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic"> |
|
|
|
|
@ -214,64 +214,25 @@ |
|
|
|
|
<el-button type="primary" @click="batchSubmit()">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<!-- 选择弹窗 --> |
|
|
|
|
<el-dialog :close-on-click-modal="false" title="选择耐用品" :visible.sync="goodsVisible" :append-to-body="true" |
|
|
|
|
width="70%"> |
|
|
|
|
<!-- 搜索区域 --> |
|
|
|
|
<div class="search-container" style="margin-bottom: 15px;"> |
|
|
|
|
<el-input v-model="searchKeyword" placeholder="请输入物资名称搜索" clearable style="width: 300px;" |
|
|
|
|
@keyup.enter.native="handleSearch"> |
|
|
|
|
<el-button slot="append" icon="el-icon-search" @click="handleSearch"></el-button> |
|
|
|
|
</el-input> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="goodsList" border style="width: 100%" @selection-change="goodsListSelectionChange"> |
|
|
|
|
<el-table-column type="selection" width="55"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="materialCode" 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="类别"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ 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="departmentName" label="部门" v-if="sizeForm.options == 2"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="applicationQuantity" label="申请数量"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="outboundQuantity" label="已出库数量"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.row.outboundQuantity || 0 }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<!-- 分页组件 --> |
|
|
|
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" |
|
|
|
|
:page-sizes="[5, 10, 20, 50]" :page-size="pageSize" :total="total" |
|
|
|
|
layout="total, sizes, prev, pager, next, jumper"> |
|
|
|
|
</el-pagination> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="goodsVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="goodsSubmit()">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<consumableDialog v-if="consumableVisible" :consumableVisible='consumableVisible' :demandDialogTitle="demandDialogTitle" |
|
|
|
|
@handleCloseDetail="handleCloseDetail"> |
|
|
|
|
</consumableDialog> |
|
|
|
|
|
|
|
|
|
<!-- 单条新增耐用品弹窗 --> |
|
|
|
|
<consumableDialog v-if="consumableVisible" :consumableVisible='consumableVisible' |
|
|
|
|
:demandDialogTitle="demandDialogTitle" @handleCloseDetail="handleCloseDetail" @confirm="confirm"> |
|
|
|
|
</consumableDialog> |
|
|
|
|
<batchSelectionDialog v-if="batchSelectionVisible" :batchSelectionVisible='batchSelectionVisible' |
|
|
|
|
:batchSelectionTitle="batchSelectionTitle" :tableData="batchTableData" |
|
|
|
|
@batchclose="batchclose" :inBatchForm="inBatchForm" @confirm-selection="handleConfirmSelection" @selectionChange="selectionChange"></batchSelectionDialog> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import { getQuarterList, getDepartmentList, getDetailedList, getDetailedItems, submitData, getMaterialList, editList } from "@/api/firstOrder/outbound"; |
|
|
|
|
import { getQuarterList, getDepartmentList, getDetailedList, getDetailedItems, submitData, getMaterialList, editList, batchList } from "@/api/firstOrder/outbound"; |
|
|
|
|
import consumableDialog from './consumableDialog.vue' |
|
|
|
|
import batchSelectionDialog from './batchSelectionDialog.vue' |
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
consumableDialog, |
|
|
|
|
batchSelectionDialog |
|
|
|
|
}, |
|
|
|
|
props: { |
|
|
|
|
repairVisible: { |
|
|
|
|
@ -297,9 +258,16 @@ export default { |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
dialogVisible: false, |
|
|
|
|
materialList: [], |
|
|
|
|
demandDialogTitle: '耐用品出库', |
|
|
|
|
batchSelectionTitle: '耐用品出库', |
|
|
|
|
goodsVisible: false, |
|
|
|
|
batchSelectionVisible: false, |
|
|
|
|
batchSelection: true, // 保持组件渲染 |
|
|
|
|
batchTableData: [], |
|
|
|
|
consumableVisible: false, //单条耐耗品弹窗显示 |
|
|
|
|
batchSelection: false, |
|
|
|
|
quarterList: [], |
|
|
|
|
departmentList: [], |
|
|
|
|
outDialogVisible: false, |
|
|
|
|
@ -325,25 +293,16 @@ export default { |
|
|
|
|
}, |
|
|
|
|
goodsList: [], |
|
|
|
|
goodsSelectList: [], |
|
|
|
|
inTableData: [], |
|
|
|
|
// inTableData: [], |
|
|
|
|
inBatchDialogVisible: false,//选择采购单的数据 |
|
|
|
|
batchType: '',//需求单选择类型 |
|
|
|
|
inBatchForm: { |
|
|
|
|
batchType: '', |
|
|
|
|
department: '', |
|
|
|
|
optionType: '', |
|
|
|
|
inBatchForm: { //批量选择 |
|
|
|
|
batchType: '', //需求单类型 |
|
|
|
|
department: '', //部门 |
|
|
|
|
optionType: '', //YH/NY |
|
|
|
|
}, |
|
|
|
|
quarterYearMap: {}, |
|
|
|
|
quarterQuarterMap: {}, |
|
|
|
|
rules: { |
|
|
|
|
reason: [ |
|
|
|
|
{ required: true, message: '事由不能为空', trigger: 'blur' } |
|
|
|
|
], |
|
|
|
|
materialType: [ |
|
|
|
|
{ required: true, message: '请选择物资类型', trigger: 'change' } |
|
|
|
|
] |
|
|
|
|
// 其他字段校验规则 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
@ -360,7 +319,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.outDialogVisible = this.repairVisible |
|
|
|
|
if (this.outDialogType == 'add') { |
|
|
|
|
this.addInit() |
|
|
|
|
@ -371,6 +330,18 @@ export default { |
|
|
|
|
// this.getMaterialList() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
batchclose() { |
|
|
|
|
this.batchSelectionVisible = false |
|
|
|
|
}, |
|
|
|
|
selectionChange(row){ |
|
|
|
|
this.batchSelectionVisible = false |
|
|
|
|
this.sizeForm.inTableData=row |
|
|
|
|
}, |
|
|
|
|
confirm(allSelectedList) { |
|
|
|
|
this.consumableVisible = false |
|
|
|
|
this.sizeForm.inTableData = allSelectedList |
|
|
|
|
console.log(this.sizeForm.inTableData, '111220') |
|
|
|
|
}, |
|
|
|
|
// // 获取物资列表 |
|
|
|
|
// async getMaterialList() { |
|
|
|
|
// const { data: res } = await this.$http.get('material/getMaterialList') |
|
|
|
|
@ -415,34 +386,31 @@ export default { |
|
|
|
|
// this.$message.error("获取商品列表失败,请重试"); |
|
|
|
|
// } |
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
|
// 选择变化时保存到数组 |
|
|
|
|
goodsListSelectionChange(val) { |
|
|
|
|
this.goodsSelectList = JSON.parse(JSON.stringify(val)); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 确认选择 |
|
|
|
|
goodsSubmit() { |
|
|
|
|
if (this.goodsSelectList.length > 0) { |
|
|
|
|
const newItems = this.goodsSelectList.map(item => ({ |
|
|
|
|
...item, |
|
|
|
|
materialId: item.materialId, |
|
|
|
|
materialCode: item.materialCode, |
|
|
|
|
materialName: item.materialName, |
|
|
|
|
model: item.model, |
|
|
|
|
type: item.type, |
|
|
|
|
unit: item.unit, |
|
|
|
|
department: item.departmentId, |
|
|
|
|
departmentName: item.departmentName, |
|
|
|
|
theOutboundQuantity: 0 |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
this.sizeForm.inTableData.push(...newItems); |
|
|
|
|
this.goodsVisible = false; |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning('请先勾选需要添加的数据'); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 批量选择耐用品弹窗确认选择 |
|
|
|
|
// goodsSubmit() { |
|
|
|
|
// if (this.goodsSelectList.length > 0) { |
|
|
|
|
// const newItems = this.goodsSelectList.map(item => ({ |
|
|
|
|
// ...item, |
|
|
|
|
// materialId: item.materialId, |
|
|
|
|
// materialCode: item.materialCode, |
|
|
|
|
// materialName: item.materialName, |
|
|
|
|
// model: item.model, |
|
|
|
|
// type: item.type, |
|
|
|
|
// unit: item.unit, |
|
|
|
|
// department: item.departmentId, |
|
|
|
|
// departmentName: item.departmentName, |
|
|
|
|
// theOutboundQuantity: 0 |
|
|
|
|
// })); |
|
|
|
|
// this.sizeForm.inTableData.push(...newItems); |
|
|
|
|
// this.batchSelectionVisible = true; |
|
|
|
|
// } else { |
|
|
|
|
// this.$message.warning('请先勾选需要添加的数据') |
|
|
|
|
// } |
|
|
|
|
// }, |
|
|
|
|
depchange(value) { |
|
|
|
|
this.departmentList = this.departmentList |
|
|
|
|
}, |
|
|
|
|
@ -480,7 +448,9 @@ export default { |
|
|
|
|
row.theOutboundQuantity = maxAllowQuantity; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.sizeForm.optionType === 'NY') { |
|
|
|
|
row.theOutboundQuantity = 1 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//关闭新增弹窗 |
|
|
|
|
handleCloseDetail() { |
|
|
|
|
@ -532,70 +502,143 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//批量选择弹窗确定 |
|
|
|
|
async batchSubmit() { |
|
|
|
|
if (!this.inBatchForm.batchType) { |
|
|
|
|
this.$message.error('请选择需求单'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!this.inBatchForm.department) { |
|
|
|
|
this.$message.error('请选择部门'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!this.inBatchForm.optionType) { |
|
|
|
|
this.$message.error('请选择类别'); |
|
|
|
|
return; |
|
|
|
|
// async batchSubmit() { |
|
|
|
|
// if (!this.inBatchForm.batchType) { |
|
|
|
|
// this.$message.error('请选择需求单'); |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// if (!this.inBatchForm.department) { |
|
|
|
|
// this.$message.error('请选择部门'); |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// if (!this.inBatchForm.optionType) { |
|
|
|
|
// this.$message.error('请选择类别'); |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// const res = await getDetailedList({ |
|
|
|
|
// ids: this.inBatchForm.batchType, |
|
|
|
|
// departmentId: this.inBatchForm.department, |
|
|
|
|
// optionType: this.inBatchForm.optionType, |
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
// if (res.data && res.data.result) { |
|
|
|
|
// this.sizeForm.inTableData = res.data.result |
|
|
|
|
// const selectedDept = this.departmentList.find( |
|
|
|
|
// dept => dept.departmentId === this.inBatchForm.department |
|
|
|
|
// ) |
|
|
|
|
// const deptName = selectedDept ? selectedDept.department : ''; |
|
|
|
|
// this.sizeForm.inTableData = res.data.result.map(item => ({ |
|
|
|
|
// ...item, |
|
|
|
|
// IdDemandEndld: this.inBatchForm.batchType, |
|
|
|
|
// // department: this.inBatchForm.department, |
|
|
|
|
// department: deptName |
|
|
|
|
// })) |
|
|
|
|
// this.inBatchDialogVisible = false; |
|
|
|
|
// const selectedQuarter = this.quarterList.find( |
|
|
|
|
// item => item.ids === this.inBatchForm.batchType |
|
|
|
|
// ) |
|
|
|
|
// if (selectedQuarter) { |
|
|
|
|
// this.sizeForm.demandEndInfo = selectedQuarter.quarterName; |
|
|
|
|
// } |
|
|
|
|
// if (this.inBatchForm.optionType === 'NY') { |
|
|
|
|
// this.batchSelectionVisible = true; |
|
|
|
|
// this.batchTableData = res.data.result; |
|
|
|
|
// } |
|
|
|
|
// this.$nextTick(() => { |
|
|
|
|
// this.$forceUpdate(); |
|
|
|
|
// }) |
|
|
|
|
// } else { |
|
|
|
|
// this.$message.warning('未获取到详细数据'); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// }, |
|
|
|
|
async batchSubmit() { |
|
|
|
|
if (!this.inBatchForm.batchType) { |
|
|
|
|
this.$message.error('请选择需求单'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!this.inBatchForm.department) { |
|
|
|
|
this.$message.error('请选择部门'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!this.inBatchForm.optionType) { |
|
|
|
|
this.$message.error('请选择类别'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const requestParams = { |
|
|
|
|
ids: this.inBatchForm.batchType, |
|
|
|
|
departmentId: this.inBatchForm.department, |
|
|
|
|
optionType: this.inBatchForm.optionType, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
let res; |
|
|
|
|
if (this.inBatchForm.optionType === 'YH') { |
|
|
|
|
res = await getDetailedList(requestParams); |
|
|
|
|
} else if (this.inBatchForm.optionType === 'NY') { |
|
|
|
|
res = await batchList(requestParams); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (res.data && res.data.result) { |
|
|
|
|
this.sizeForm.inTableData = res.data.result; |
|
|
|
|
const selectedDept = this.departmentList.find( |
|
|
|
|
dept => dept.departmentId === this.inBatchForm.department |
|
|
|
|
); |
|
|
|
|
const deptName = selectedDept ? selectedDept.department : ''; |
|
|
|
|
|
|
|
|
|
this.sizeForm.inTableData = res.data.result.map(item => ({ |
|
|
|
|
...item, |
|
|
|
|
IdDemandEndld: this.inBatchForm.batchType, |
|
|
|
|
department: deptName |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
// 关闭批量选择弹窗 |
|
|
|
|
this.inBatchDialogVisible = false; |
|
|
|
|
|
|
|
|
|
// 设置需求单名称 |
|
|
|
|
const selectedQuarter = this.quarterList.find( |
|
|
|
|
item => item.ids === this.inBatchForm.batchType |
|
|
|
|
); |
|
|
|
|
if (selectedQuarter) { |
|
|
|
|
this.sizeForm.demandEndInfo = selectedQuarter.quarterName; |
|
|
|
|
} |
|
|
|
|
const res = await getDetailedList({ |
|
|
|
|
ids: this.inBatchForm.batchType, |
|
|
|
|
departmentId: this.inBatchForm.department, |
|
|
|
|
optionType: this.inBatchForm.optionType, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if (res.data && res.data.result) { |
|
|
|
|
this.sizeForm.inTableData = res.data.result |
|
|
|
|
const selectedDept = this.departmentList.find( |
|
|
|
|
dept => dept.departmentId === this.inBatchForm.department |
|
|
|
|
) |
|
|
|
|
const deptName = selectedDept ? selectedDept.department : ''; |
|
|
|
|
this.sizeForm.inTableData = res.data.result.map(item => ({ |
|
|
|
|
...item, |
|
|
|
|
IdDemandEndld: this.inBatchForm.batchType, |
|
|
|
|
// department: this.inBatchForm.department, |
|
|
|
|
department: deptName |
|
|
|
|
})) |
|
|
|
|
this.inBatchDialogVisible = false; |
|
|
|
|
const selectedQuarter = this.quarterList.find( |
|
|
|
|
item => item.ids === this.inBatchForm.batchType |
|
|
|
|
) |
|
|
|
|
if (selectedQuarter) { |
|
|
|
|
this.sizeForm.demandEndInfo = selectedQuarter.quarterName; |
|
|
|
|
} |
|
|
|
|
if (this.inBatchForm.optionType === 'NY') { |
|
|
|
|
this.goodsVisible = true |
|
|
|
|
this.data.goodsList = res.data.result |
|
|
|
|
} |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning('未获取到详细数据'); |
|
|
|
|
// 耐用品特殊处理(打开批量选择弹窗) |
|
|
|
|
if (this.inBatchForm.optionType === 'NY') { |
|
|
|
|
console.log(this.inBatchForm.optionType, 'this.inBatchForm.optionType') |
|
|
|
|
this.batchSelectionVisible = true; |
|
|
|
|
this.dialogVisible = true; |
|
|
|
|
console.log(1) |
|
|
|
|
this.batchTableData = res.data.result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// 强制更新视图 |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning('未获取到详细数据'); |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
this.$message.error(`获取${this.inBatchForm.optionType === 'YH' ? '易耗品' : '耐用品'}数据失败:${error.message}`); |
|
|
|
|
console.error('批量提交接口调用失败:', error); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//批量选择耐用品选择回调函数 |
|
|
|
|
goodsListSelectionChange(val) { |
|
|
|
|
this.goodsSelectList = val |
|
|
|
|
}, |
|
|
|
|
//批量选择耐用品弹窗点击确认按钮 |
|
|
|
|
goodsSubmit() { |
|
|
|
|
if (this.goodsSelectList.length > 0) { |
|
|
|
|
this.sizeForm.inTableData.push(...this.goodsSelectList); |
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning('请先勾选需要添加的数据'); |
|
|
|
|
} |
|
|
|
|
this.goodsVisible = false |
|
|
|
|
}, |
|
|
|
|
// goodsSubmit() { |
|
|
|
|
// if (this.goodsSelectList.length > 0) { |
|
|
|
|
// this.sizeForm.inTableData.push(...this.goodsSelectList); |
|
|
|
|
// this.$forceUpdate(); |
|
|
|
|
// } else { |
|
|
|
|
// this.$message.warning('请先勾选需要添加的数据'); |
|
|
|
|
// } |
|
|
|
|
// this.batchSelectionVisible = true; |
|
|
|
|
// }, |
|
|
|
|
//获取单条选择的部门名称列表 |
|
|
|
|
async getDetailedItems() { |
|
|
|
|
this.loading = true |
|
|
|
|
@ -615,8 +658,9 @@ export default { |
|
|
|
|
//获取单条选择的物资名称列表 |
|
|
|
|
async getMaterialList() { |
|
|
|
|
this.loading = true |
|
|
|
|
this.goodsVisible = false; |
|
|
|
|
this.consumableVisible = false; |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
if (this.sizeForm.optionType === "NY") { |
|
|
|
|
this.consumableVisible = true |
|
|
|
|
} else { |
|
|
|
|
@ -671,13 +715,15 @@ export default { |
|
|
|
|
this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData |
|
|
|
|
let arr = this.departmentList.find(item => item.departmentId === this.inBatchForm.department || {}) |
|
|
|
|
this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData.map(row => { |
|
|
|
|
console.log(row, 'row') |
|
|
|
|
const deptId = row.department |
|
|
|
|
const dept = this.list.find(item => item.departmentId === deptId); |
|
|
|
|
console.log(dept, 'dept') |
|
|
|
|
const oneFormId = row.id |
|
|
|
|
return { |
|
|
|
|
...row, |
|
|
|
|
department: this.sizeForm.options == '1' ? arr.departmentId : deptId, |
|
|
|
|
departmentName: this.sizeForm.options == '1' ? arr.department : dept.department, |
|
|
|
|
oneFormId: oneFormId |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log(this.sizeForm, '111') |
|
|
|
|
@ -701,60 +747,95 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//编辑和详情 |
|
|
|
|
async inInit() { |
|
|
|
|
if (this.outDialogType == 'details' || this.outDialogType == 'edit') { |
|
|
|
|
try { |
|
|
|
|
const res = await editList(this.id); |
|
|
|
|
const { ldOneOutStorage, ldOneOutStorageDetails = [] } = res.data.result || {}; |
|
|
|
|
if (!ldOneOutStorage) { |
|
|
|
|
this.$message.error("回显数据异常"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
const handledDetailList = ldOneOutStorageDetails.map(item => ({ |
|
|
|
|
...item, |
|
|
|
|
outboundQuantity: item.outboundQuantity || 0 |
|
|
|
|
})) |
|
|
|
|
this.sizeForm = { |
|
|
|
|
...this.sizeForm, |
|
|
|
|
...ldOneOutStorage, |
|
|
|
|
outDate: ldOneOutStorage.outDate ? new Date(ldOneOutStorage.outDate) : '', |
|
|
|
|
options: Number(ldOneOutStorage.options) || 1, |
|
|
|
|
} |
|
|
|
|
this.sizeForm.inTableData = handledDetailList; |
|
|
|
|
editList(this.id).then(res => { |
|
|
|
|
console.log(res.data.result, '详情数据') |
|
|
|
|
const { ldOneOutStorage, ldOneOutStorageDetails } = res.data.result || {}; |
|
|
|
|
|
|
|
|
|
// this.sizeForm = res.data.result.ldOneOutStorage |
|
|
|
|
this.sizeForm.inTableData = res.data.result.ldOneOutStorageDetails |
|
|
|
|
this.sizeForm.orderNo = ldOneOutStorage.orderNo |
|
|
|
|
this.sizeForm.reason = ldOneOutStorage.reason |
|
|
|
|
this.sizeForm.demandEndInfo = ldOneOutStorage.demandEndInfo |
|
|
|
|
this.sizeForm.outDate = ldOneOutStorage.outDate |
|
|
|
|
this.sizeForm.options = Number(ldOneOutStorage.options) |
|
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
this.$message.error("获取详情数据失败"); |
|
|
|
|
} |
|
|
|
|
// reason: '',//事由 |
|
|
|
|
// inAccountsTableData: [],//总计 |
|
|
|
|
// inTableData: [], |
|
|
|
|
// ldOneOutStorageDetailVOList: [], |
|
|
|
|
// demandEndInfo: '',//需求单名称 |
|
|
|
|
// outDate: '',//出库时间 |
|
|
|
|
// options: 2,//出库类型 |
|
|
|
|
// optionType: '', // 1易耗品 2耐用品 |
|
|
|
|
// materialType: '1',//物资类型 |
|
|
|
|
// status: '',//1暂存 2提交 |
|
|
|
|
// materialld: '',//物资Id |
|
|
|
|
this.$set(this.sizeForm,'inTableData',res.data.result.ldOneOutStorageDetails) |
|
|
|
|
console.log(this.sizeForm, '111') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// this.sizeForm = { |
|
|
|
|
// // ...this.sizeForm, |
|
|
|
|
// // ...ldOneOutStorage, |
|
|
|
|
// // outDate: ldOneOutStorage.outDate ? new Date(ldOneOutStorage.outDate) : '', |
|
|
|
|
// // options: Number(ldOneOutStorage.options) || 1, |
|
|
|
|
// // inTableData: ldOneOutStorageDetails |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// try { |
|
|
|
|
// const res = await editList(this.id) |
|
|
|
|
// console.log(res, '详情数据') |
|
|
|
|
// const { ldOneOutStorage, ldOneOutStorageDetails = [] } = res.data.result || {}; |
|
|
|
|
// if (!ldOneOutStorage) { |
|
|
|
|
// this.$message.error("回显数据异常"); |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// // const handledDetailList = ldOneOutStorageDetails.map(item => ({ |
|
|
|
|
// // ...item, |
|
|
|
|
// // outboundQuantity: item.outboundQuantity || 0 |
|
|
|
|
// // })) |
|
|
|
|
// console.log(handledDetailList, 'handledDetailList') |
|
|
|
|
// this.sizeForm = { |
|
|
|
|
// ...this.sizeForm, |
|
|
|
|
// ...ldOneOutStorage, |
|
|
|
|
// outDate: ldOneOutStorage.outDate ? new Date(ldOneOutStorage.outDate) : '', |
|
|
|
|
// options: Number(ldOneOutStorage.options) || 1, |
|
|
|
|
// inTableData: ldOneOutStorageDetails |
|
|
|
|
// } |
|
|
|
|
// // console.log(this.sizeForm.inTableData, 'this.sizeForm') |
|
|
|
|
// } catch (error) { |
|
|
|
|
// this.$message.error("获取详情数据失败"); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// 选项选择 |
|
|
|
|
async radioChange() { |
|
|
|
|
radioChange() { |
|
|
|
|
this.sizeForm.inTableData = [] |
|
|
|
|
this.sizeForm.optionType = ''; |
|
|
|
|
if (this.sizeForm.options === 1) { |
|
|
|
|
await this.getQuarterList() |
|
|
|
|
this.getQuarterList() |
|
|
|
|
this.inBatchDialogVisible = true |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
closeHandle() { |
|
|
|
|
this.inBatchForm.batchType = '', |
|
|
|
|
this.inBatchForm.batchType = '', |
|
|
|
|
this.inBatchForm.department = '' |
|
|
|
|
this.inBatchForm.optionType = '' |
|
|
|
|
this.sizeForm.inTableData = [] |
|
|
|
|
this.getQuarterList() |
|
|
|
|
this.inBatchDialogVisible = true |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
}); |
|
|
|
|
// this.sizeForm.inTableData = [] |
|
|
|
|
this.inBatchForm.optionType = '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// closeHandle() { |
|
|
|
|
// this.inBatchForm.batchType = '', |
|
|
|
|
// this.inBatchForm.department = '' |
|
|
|
|
// this.inBatchForm.optionType = '' |
|
|
|
|
// this.sizeForm.inTableData = [] |
|
|
|
|
// this.getQuarterList() |
|
|
|
|
// this.inBatchDialogVisible = true |
|
|
|
|
|
|
|
|
|
// // this.sizeForm.inTableData = [] |
|
|
|
|
// }, |
|
|
|
|
// 删除表格行数据 |
|
|
|
|
handleDelete(index, row) { |
|
|
|
|
this.sizeForm.inTableData.splice(index, 1) |
|
|
|
|
@ -776,15 +857,6 @@ export default { |
|
|
|
|
// this.getMaterialList() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 当弹窗显示时加载数据 |
|
|
|
|
goodsVisible(newVal) { |
|
|
|
|
if (newVal) { |
|
|
|
|
// 重置搜索条件和分页 |
|
|
|
|
this.searchKeyword = ''; |
|
|
|
|
this.currentPage = 1; |
|
|
|
|
this.loadGoodsList(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|