1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <el-select
- filterable
- v-model="modelValue"
- :placeholder="placeholder"
- ref="selectUpResId"
- >
- <el-option
- :value="modelValue"
- style="overflow: auto; height: 100%"
- hidden
- />
- <el-tree
- :data="dataList"
- :props="defaultProps"
- :node-key="nodeKey"
- :expand-on-click-node="expandNode"
- :check-on-click-node="checkNode"
- check-strictly
- @node-click="handleNodeClick"
- />
- </el-select>
- </template>
- <script>
- export default {
- data() {
- return {
- form: {
- label: '',
- id: ''
- },
- dataList:[]
- }
-
- },
- props: {
- param: {
- type: Array,
- required: true
- },
- placeholder: {
- type: String,
- default: '请选择'
- },
- formatId: {
- type: String,
- default: 'deptId'
- },
- defaultProps: {
- type: Object,
- default: () => {
- return {
- children: "children",
- label: "deptName"
- }
- }
- },
- nodeKey: {
- type: String,
- default: 'deptId'
- },
- expandNode: {
- type: Boolean,
- default: false
- },
- checkNode: {
- type: Boolean,
- default: true
- },
- modelValue: {
- type: String,
- default: ''
- }
- },
- created() {
- this.dataList = this.handleTree(this.param, this.formatId);
- },
- methods: {
- handleNodeClick(data) {
- this.$emit('setNodeValue', data)
- this.$refs.selectUpResId.blur()
- }
- }
- }
- </script>
|