| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <template>
- <ba-tree-picker
- ref="treePicker"
- key="verify"
- :multiple="false"
- @select-change="confirm"
- title="选择分类"
- :localdata="classificationList"
- valueKey="id"
- textKey="name"
- childrenKey="children"
- />
- </template>
- <script>
- import baTreePicker from "@/components/ba-tree-picker/ba-tree-picker.vue";
- import { getTreeByPid } from "@/api/classifyManage";
- export default {
- props: {
- warehousingType: {
- type: [String, Number],
- default: "1", //默认原料
- },
- },
- components: { baTreePicker },
- data() {
- return {
- classificationList: [],
- };
- },
- mounted() {
- this.getClassify();
- },
- methods: {
- show() {
- this.$refs.treePicker._show();
- },
- async getClassify() {
- const res = await getTreeByPid(this.warehousingType);
- this.classificationList = res.data;
- this.$nextTick(() => {
- this.confirm([res.data[0].id], res.data[0].name);
- });
- },
- confirm(...rest) {
- this.$emit("confirm", ...rest);
- },
- },
- };
- </script>
|