This commit is contained in:
JIAL 2024-01-19 08:47:04 +08:00
parent afa5d8d0a3
commit e3d8335aba
5 changed files with 13885 additions and 74 deletions

View File

@ -0,0 +1,21 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="html" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
</profile>
</component>

7
.idea/jpa-buddy.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="defaultUnitInitialized" value="true" />
<option name="renamerInitialized" value="true" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -40,17 +40,18 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="3">
<el-cascader <el-form-item >
:options="options" <el-input v-model="formLabelAlign.type"></el-input>
:props="{ checkStrictly: true }" </el-form-item>
:style="{width: '100%'}"
clearable
@change="handleChange">
</el-cascader>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<el-form-item label="区"> <el-form-item >
<el-input v-model="formLabelAlign.type"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item >
<el-input v-model="formLabelAlign.type"></el-input> <el-input v-model="formLabelAlign.type"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -147,8 +148,6 @@
{ kunnr1: '101', kunnr2: '102', kunnr3: '103', kunnr4: '104', kunnr5: '105', kunnr6: '106', kunnr7: '107', kunnr8: '108' }, { kunnr1: '101', kunnr2: '102', kunnr3: '103', kunnr4: '104', kunnr5: '105', kunnr6: '106', kunnr7: '107', kunnr8: '108' },
// Add more rows as needed // Add more rows as needed
], ],
value: [],
options: [],
} }
}, },
@ -165,50 +164,7 @@
async init () { async init () {
}, },
handleChange(value) {
console.log(value);
console.log(value[0]);
}, },
async getChinaData() {
try {
const response = await this.$axios.get('https://restapi.amap.com/v3/config/district', {
params: {
key: 'your_amap_api_key',
keywords: '中国',
subdistrict: 1,
extensions: 'all'
}
});
if (response.data && response.data.districts && response.data.districts.length > 0) {
const chinaData = response.data.districts[0];
this.options = this.transformDistrictData(chinaData.districts);
}
} catch (error) {
console.error('Error fetching China data:', error);
}
},
transformDistrictData(districts) {
return districts.map(province => {
return {
value: province.adcode,
label: province.name,
children: province.districts.map(city => {
return {
value: city.adcode,
label: city.name,
children: city.districts.map(area => {
return {
value: area.adcode,
label: area.name
};
})
};
})
};
});
},
}
}) })
</script> </script>
</body> </body>

View File

@ -42,9 +42,10 @@
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<el-cascader <el-cascader
v-model="selectedValues"
:options="options" :options="options"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true }"
:style="{width: '100%'}" :style="{ width: '100%' }"
clearable clearable
@change="handleChange"> @change="handleChange">
</el-cascader> </el-cascader>
@ -149,6 +150,7 @@
], ],
value: [], value: [],
options: [], options: [],
selectedValues: [], // 用于绑定选择的值
} }
}, },
@ -171,18 +173,19 @@
}, },
async getChinaData() { async getChinaData() {
try { try {
const response = await this.$axios.get('https://restapi.amap.com/v3/config/district', { const response = await axios.get('https://restapi.amap.com/v3/config/district', {
params: { params: {
key: '8ae95f669eb23a81586ec1d1a5ecd98e', key: 'b3cfce12e9b6ae37d0599623870404d5',
keywords: '中国', keywords: '中国',
subdistrict: 1, subdistrict: 1,
extensions: 'all' extensions: 'all',
level: 'province'
} }
}); });
if (response.data && response.data.districts && response.data.districts.length > 0) { if (response.data && response.data.districts && response.data.districts.length > 0) {
const chinaData = response.data.districts[0]; const provinces = response.data.districts[0].districts;
this.options = this.transformDistrictData(chinaData.districts); this.options = this.transformDistrictData(provinces);
} }
} catch (error) { } catch (error) {
console.error('Error fetching China data:', error); console.error('Error fetching China data:', error);
@ -193,20 +196,37 @@
return { return {
value: province.adcode, value: province.adcode,
label: province.name, label: province.name,
children: province.districts.map(city => { children: [] // 初始状态下,市级数据为空
return {
value: city.adcode,
label: city.name,
children: city.districts.map(area => {
return {
value: area.adcode,
label: area.name
};
})
};
})
}; };
});
},
async loadCityData(selectedOptions) {
const targetOption = selectedOptions[selectedOptions.length - 1];
targetOption.loading = true;
try {
const response = await axios.get('https://restapi.amap.com/v3/config/district', {
params: {
key: 'b3cfce12e9b6ae37d0599623870404d5',
keywords: targetOption.label,
subdistrict: 1,
extensions: 'all',
level: 'city'
} }
});
if (response.data && response.data.districts && response.data.districts.length > 0) {
const cities = response.data.districts[0].districts;
targetOption.children = this.transformDistrictData(cities);
targetOption.isLeaf = true; // 设置省级节点为叶子节点
}
} catch (error) {
console.error('Error fetching city data:', error);
} finally {
targetOption.loading = false;
}
},
},
}) })
</script> </script>
</body> </body>