javascript
<!-- 仓位 -->
<template>
<el-select
clearable
:value="value || []"
class="ele-fluid"
:filterable="true"
placeholder="仓位"
@input="updateValue"
>
<el-option
v-for="item in data"
:key="item.id"
:value="item.id"
:label="item.storageName"
/>
</el-select>
</template>
<script>
// import { listStorage } from '@/api/basic/storage/index';
import { listStorage } from '@/api/basic/storage';
export default {
props: {
// 选中的数据(v-model)
value: [Array, String, Number],
// 提示信息
placeholder: {
type: String,
default: '请选择转入仓位'
}
},
data() {
return {
//班次数据
data: []
};
},
created() {
listStorage({})
.then((list) => {
this.loading = false;
this.data = list;
// this.data = this.$util.toTreeData({
// data: list,
// idField: 'organizationId',
// parentIdField: 'parentId'
// });
console.log(this.data);
// this.$nextTick(() => {
// this.onNodeClick(this.data[0]);
// });
})
.catch((e) => {
this.loading = false;
this.$message.error(e.message);
});
},
methods: {
/* 更新选中数据 */
updateValue(value) {
this.$emit('input', value);
}
}
};
</script>
@input="updateValue"
:value="value || []"