|
|
@@ -830,10 +830,12 @@ export default {
|
|
|
},
|
|
|
// 监听仓库选择变化,获取对应区域列表
|
|
|
"formData.warehouseId": {
|
|
|
- handler(newVal) {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
if (this.formData.businessType === "13" && newVal) {
|
|
|
this.loadAreaList(newVal);
|
|
|
- // 清空已选择的区域和货位
|
|
|
+ // 第一次 oldVal 为 undefined,认为是初始化,不清空
|
|
|
+ if (oldVal === undefined) return;
|
|
|
+ // 人工切换仓库
|
|
|
this.formData.areaCode = undefined;
|
|
|
this.formData.locationCode = undefined;
|
|
|
this.locationList = [];
|
|
|
@@ -845,14 +847,14 @@ export default {
|
|
|
},
|
|
|
// 监听区域选择变化,获取对应货位列表
|
|
|
"formData.areaCode": {
|
|
|
- handler(newVal) {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
if (
|
|
|
this.formData.businessType === "13" &&
|
|
|
newVal &&
|
|
|
this.formData.warehouseId
|
|
|
) {
|
|
|
this.loadLocationList(this.formData.warehouseId, newVal);
|
|
|
- // 清空已选择的货位
|
|
|
+ if (oldVal === undefined) return; // 初始化阶段不清空
|
|
|
this.formData.locationCode = undefined;
|
|
|
} else {
|
|
|
this.locationList = [];
|
|
|
@@ -1237,19 +1239,30 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.formData = res.data;
|
|
|
-
|
|
|
- /* 3. 现在仓库列表有了,再加载区域/货位 */
|
|
|
- if (this.formData.businessType === "13" && this.formData.warehouseId) {
|
|
|
- await this.loadAreaList(this.formData.warehouseId);
|
|
|
- if (this.formData.areaCode) {
|
|
|
+ /* 3. 现在仓库列表有了,先加载区域/货位 */
|
|
|
+ if (res.data.businessType === "13" && res.data.warehouseId) {
|
|
|
+ console.log("开始加载区域列表", res.data.warehouseId);
|
|
|
+ await this.loadAreaList(res.data.warehouseId);
|
|
|
+ console.log(
|
|
|
+ "区域下拉",
|
|
|
+ this.areaList.map((i) => i.areaCode)
|
|
|
+ );
|
|
|
+ if (res.data.areaCode) {
|
|
|
+ console.log("开始加载货位列表", res.data.areaCode);
|
|
|
await this.loadLocationList(
|
|
|
- this.formData.warehouseId,
|
|
|
- this.formData.areaCode
|
|
|
+ res.data.warehouseId,
|
|
|
+ res.data.areaCode
|
|
|
+ );
|
|
|
+ console.log(
|
|
|
+ "货位下拉",
|
|
|
+ this.locationList.map((i) => i.locationCode)
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /* 最后再赋值表单数据 */
|
|
|
+ this.formData = res.data;
|
|
|
+
|
|
|
this.uploadFiles = res.data.filesListVos;
|
|
|
} finally {
|
|
|
this.formLoading = false;
|