1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <xm-cascader
- ref="cascaderRef"
- v-model="value"
- :options="list"
- :checkStrictly="checkStrictly"
- @input="handleInput"
- :showAllLevels="true"
- @confirm="handleConfirm"
- :props="{
- value: 'code',
- label: 'areaName',
- children: 'child'
- }"
- >
- </xm-cascader>
- </template>
- <script>
- import { getCodeAreaTree,getConfigKey} from "@/api/common/system.js";
- export default {
- props: {
- checkStrictly: { //传入此参数columns无效
- type: Boolean,
- default: true,
- },
- },
- data() {
- return {
- value: '',
- list: [
- /* {
- "code": 1,
- "areaName": "Parent 1",
- "parentId": 0,
- "child": [{
- "code": 2,
- "areaName": "Child 1.1",
- "parentId": 1,
- "child": []
- },
- {
- "code": 3,
- "areaName": "Child 1.2",
- "parentId": 1,
- "child": []
- }
- ]
- }, */
- ],
- }
- },
- created() {
- this.initOptions()
- },
- methods: {
- async initOptions() {
- let { msg } = await getConfigKey('areaCode');
- let { data } = await getCodeAreaTree({pCode: msg});
- this.list = data
- },
- handleInput(e) {
- // console.log(e,'eeee')
- },
-
- show() {
- this.$refs.cascaderRef.openDept()
- },
- close() {
- this.$refs.cascaderRef.close()
- },
- handleConfirm(e) {
- this.$emit('confirm', e)
- },
- }
- }
- </script>
- <style lang="scss" scoped></style>
|