| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <template>
- <div>
- <el-cascader :options="list" v-model="value" @change="change"></el-cascader>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- value: [],
- list: []
- };
- },
- async mounted() {
- const res = await this.$axios.$post(
- "/uapi/work/get/get.occupation.direction.form.sign.new"
- );
- this.list = res.data.list;
- },
- methods: {
- getValue(arr) {
- if (!arr || arr.length == 0) {
- this.$message.error("请选择方向");
- }
- let result = [];
- let target = this.list;
- arr.forEach(selectItem => {
- let {
- children,
- ...options
- } = target.find(item => item.value == selectItem)
- result.push(options);
- target = children;
- });
- return result
- },
- change(e) {
- let result = this.getValue(e)
- this.$emit('change', result)
- }
- }
- };
- </script>
- <style lang="scss" scoped></style>
|