-
-
-
-
-
-
@@ -86,7 +70,7 @@
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
-
+
@@ -129,7 +113,7 @@
-
+
@@ -172,12 +156,14 @@
import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehouse } from "@/api/wms/warehouse";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import WarehouseSelect from '@/components/WarehouseSelect';
export default {
name: "Warehouse",
dicts: ['warehouse_type'],
components: {
- Treeselect
+ Treeselect,
+ WarehouseSelect
},
data() {
return {
@@ -205,7 +191,7 @@ export default {
warehouseCode: undefined,
warehouseName: undefined,
warehouseType: undefined,
- sortNo: undefined,
+ sortNo: 0,
isEnabled: undefined,
},
// 表单参数
@@ -328,9 +314,14 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
- this.buttonLoading = true;
+ this.buttonLoading = true;
+ // 处理 parentId 为 0 的情况
+ let submitData = { ...this.form };
+ if (submitData.parentId === 0) {
+ delete submitData.parentId;
+ }
if (this.form.warehouseId != null) {
- updateWarehouse(this.form).then(response => {
+ updateWarehouse(submitData).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
@@ -338,7 +329,7 @@ export default {
this.buttonLoading = false;
});
} else {
- addWarehouse(this.form).then(response => {
+ addWarehouse(submitData).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();