代码优化

This commit is contained in:
zzyuan 2025-07-18 18:10:06 +08:00
parent 8d58e01ac3
commit 71b4067b19
2 changed files with 18 additions and 4 deletions

View File

@ -47,7 +47,7 @@
</div> </div>
</div> </div>
<div style="width: 100%;height: 400px;overflow-y: auto;"> <div style="width: 100%;height: 400px;overflow-y: auto;">
<el-table v-loading="loading" :data="materialLis" ref="multipleTable" height="380" :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="materialList" ref="multipleTable" height="380" :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> --> <!-- <el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> -->
<el-table-column label="序号" align="center" width="80" type="index" /> <el-table-column label="序号" align="center" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> -->
@ -121,7 +121,7 @@ export default {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000 return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
} }
}, },
materialLis:[], materialList:[],
openDialog:false, openDialog:false,
materialTreeOptions:[], materialTreeOptions:[],
// //

View File

@ -16,8 +16,9 @@
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="调出仓库" prop="outWarehouseId"> <el-form-item label="调出仓库" prop="outWarehouseId">
<el-select v-model="baseInfo.outWarehouseId" clearable placeholder="请选择货品仓库" style="width: 100%;"> <el-select v-model="baseInfo.outWarehouseId" clearable placeholder="请选择货品仓库" style="width: 100%;" @change="changeWareHouse">
<el-option v-for="item in wareHouseOptions" <el-option v-for="item in wareHouseOptions"
:disabled="item.disabled"
:key="item.warehouseId" :key="item.warehouseId"
:label="item.warehouseName" :label="item.warehouseName"
:value="item.warehouseId" :value="item.warehouseId"
@ -25,8 +26,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="调入仓库" prop="intoWarehouseId"> <el-form-item label="调入仓库" prop="intoWarehouseId">
<el-select v-model="baseInfo.intoWarehouseId" clearable placeholder="请选择货品仓库" style="width: 100%;"> <el-select v-model="baseInfo.intoWarehouseId" clearable placeholder="请选择货品仓库" style="width: 100%;" @change="changeWareHouse">
<el-option v-for="item in wareHouseOptions" <el-option v-for="item in wareHouseOptions"
:disabled="item.disabled"
:key="item.warehouseId" :key="item.warehouseId"
:label="item.warehouseName" :label="item.warehouseName"
:value="item.warehouseId" :value="item.warehouseId"
@ -331,6 +333,9 @@ export default {
getWareHouseData() { getWareHouseData() {
drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => { drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => {
this.wareHouseOptions = response.rows||[]; this.wareHouseOptions = response.rows||[];
this.wareHouseOptions.forEach(item=>{
item.disabled = false
})
this.$set(this.baseInfo,'outWarehouseId',null) this.$set(this.baseInfo,'outWarehouseId',null)
this.$set(this.baseInfo,'intoWarehouseId',null) this.$set(this.baseInfo,'intoWarehouseId',null)
}); });
@ -400,6 +405,15 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
changeWareHouse(e){
this.wareHouseOptions.forEach(item=>{
item.disabled = false
})
let index = this.wareHouseOptions.findIndex(v=>v.warehouseId==this.baseInfo.outWarehouseId)
this.wareHouseOptions[index].disabled=true
let index2 = this.wareHouseOptions.findIndex(v=>v.warehouseId==this.baseInfo.intoWarehouseId)
this.wareHouseOptions[index2].disabled=true
},
handleSelectionChange2(selection) { handleSelectionChange2(selection) {
this.batchChosenMaterial = selection; this.batchChosenMaterial = selection;
this.batchChosenMaterial.forEach(item=>{ this.batchChosenMaterial.forEach(item=>{