feat: 新增盘库和维修计划初版

This commit is contained in:
2026-06-25 10:53:27 +08:00
parent e994afb97f
commit a9b4d5ddd6
17 changed files with 5303 additions and 2 deletions

View File

@@ -0,0 +1,102 @@
<template>
<el-select
v-model="selected"
:placeholder="placeholder"
:clearable="clearable"
:disabled="disabled"
:size="size"
filterable
@change="onChange"
style="width: 100%"
>
<el-option
v-for="item in options"
:key="item.actualWarehouseId"
:label="item.actualWarehouseName"
:value="item.actualWarehouseId"
:disabled="item.isEnabled === 0"
>
<span :style="{ paddingLeft: item.level === 2 ? '20px' : '0' }">
{{ item.actualWarehouseName }}
</span>
</el-option>
</el-select>
</template>
<script>
import { treeActualWarehouseTwoLevel } from '@/api/wms/actualWarehouse';
export default {
name: 'ActualWarehouseL1L2Select',
props: {
value: {
type: [Number, String],
default: null
},
placeholder: {
type: String,
default: '请选择实际库区'
},
clearable: {
type: Boolean,
default: true
},
disabled: {
type: Boolean,
default: false
},
size: {
type: String,
default: 'mini'
}
},
data() {
return {
options: [],
selected: this.value
};
},
watch: {
value(val) {
this.selected = val;
}
},
mounted() {
this.loadOptions();
},
methods: {
loadOptions() {
var self = this;
treeActualWarehouseTwoLevel({}).then(function(response) {
var data = response.data || [];
self.options = self.flattenTree(data);
}).catch(function() {
self.options = [];
});
},
flattenTree(nodes, level) {
if (level === undefined) { level = 1; }
var result = [];
if (!nodes || nodes.length === 0) return result;
nodes.forEach(function(node) {
result.push({
actualWarehouseId: node.actualWarehouseId,
actualWarehouseName: node.actualWarehouseName,
isEnabled: node.isEnabled,
level: level
});
var children = node.children;
if (children && children.length > 0 && level < 2) {
var childResults = this.flattenTree(children, level + 1);
result = result.concat(childResults);
}
}, this);
return result;
},
onChange(val) {
this.$emit('input', val);
this.$emit('change', val);
}
}
};
</script>