zqq:更改请求接口

This commit is contained in:
qqGroup0 2023-04-06 14:59:16 +08:00
parent c73c93841f
commit 21e0572f9a
3 changed files with 115 additions and 55 deletions

View File

@ -1,8 +1,18 @@
import request from '/@/utils/request'; import request from '/@/utils/request';
const moduleName = 'zqq-biz-vordm';
export const getRemoteSensingSourceData = (param) => { export const getRemoteSensingSourceData = (param) => {
return request({ return request({
url: '/api/biz-vordm/remoteSensingSourceData', url: '/api/' + moduleName + '/ui/remoteSensingSourceData',
method: 'get',
params: param,
});
};
export const getSelectionCondition = (param) => {
return request({
url: '/api/' + moduleName + '/ui/selectCondition',
method: 'get', method: 'get',
params: param, params: param,
}); });

View File

@ -62,8 +62,8 @@ service.interceptors.response.use(
if (error.response.data.error_description) ElMessage.error(error.response.data.error_description); if (error.response.data.error_description) ElMessage.error(error.response.data.error_description);
else { else {
//if (error.response.data) ElMessage.error(error.response.statusText); //if (error.response.data) ElMessage.error(error.response.statusText);
Session.clear(); // 清除浏览器全部临时缓存 //Session.clear(); // 清除浏览器全部临时缓存
window.location.href = '/'; // 去登录页 //window.location.href = '/'; // 去登录页
ElMessage.error('接口路径找不到'); ElMessage.error('接口路径找不到');
} }
} }

View File

@ -4,35 +4,39 @@
<!-- 选择灾害类型下拉框 --> <!-- 选择灾害类型下拉框 -->
<el-select v-model="state.value_disasterType" <el-select v-model="state.value_disasterType"
size="default" size="default"
placeholder="Select disaster type"> clearable
placeholder="Select disaster type"
@visible-change="searchDisasterType">
<el-option v-for="item in state.options_disasterType" <el-option v-for="item in state.options_disasterType"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" /> :value="item.value" />
</el-select> </el-select>
<!-- 选择灾害时间下拉框 --> <!-- 选择灾害时间下拉框 -->
<el-date-picker v-model="state.value_disasterTime" <el-date-picker v-model="state.value_disasterDate"
type="date" type="date"
placeholder="Select disaster time" placeholder="Select disaster time"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
class="ml10" class="ml10"
size="default" /> size="default"
@focus="searchDisasterDate" />
<!-- 选择受灾地 --> <!-- 选择受灾地 -->
<el-input v-model="state.value_disasterCountry" <!-- <el-input v-model="state.value_disasterCountry"
style="width: 20%;margin-left: 1%;" style="width: 20%;margin-left: 1%;"
placeholder="请输入受灾地" /> placeholder="请输入受灾地" /> -->
<!-- 选择灾害事件下拉框 --> <el-select v-model="state.value_disasterCountry"
<!-- <el-select v-model="state.value_disasterEvent" size="default"
size="default" clearable
placeholder="Select disaster event" placeholder="Select disaster country"
class="ml10"> style="margin-left: 0.6%;"
<el-option v-for="item in options_disasterEvent" @visible-change="searchDisasterCountry">
:key="item.value" <el-option v-for="item in state.options_disasterCountry"
:label="item.label" :key="item.value"
:value="item.value" /> :label="item.label"
</el-select> --> :value="item.value" />
</el-select>
<el-button size="default" <el-button size="default"
type="primary" type="primary"
@ -134,8 +138,8 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive } from 'vue'; import { ref, reactive, onMounted } from 'vue';
import { getRemoteSensingSourceData } from "/@/api/remoteSensingSourceData/index.js"; import { getRemoteSensingSourceData, getSelectionCondition } from "/@/api/remoteSensingSourceData/index.js";
const state = reactive({ const state = reactive({
tableData: { tableData: {
@ -149,33 +153,11 @@ const state = reactive({
}, },
}, },
// //
options_disasterType: [{ options_disasterType: [],
value: 'Earthquake',
label: 'Earthquake',
},
{
value: 'Hurricane',
label: 'Hurricane',
},
{
value: 'Flood',
label: 'Flood',
},
{
value: 'Volcano',
label: 'Volcano',
},
{
value: 'Drought',
label: 'Drought',
},
{
value: 'Landslide',
label: 'Landslide',
}],
value_disasterType: '', value_disasterType: '',
value_disasterTime: '', value_disasterDate: '',
value_disasterCountry: '', options_disasterCountry: [],
value_disasterCountry: [],
requestData: [], requestData: [],
}) })
@ -183,24 +165,89 @@ const state = reactive({
const searchRemoteSensingSourceData = () => { const searchRemoteSensingSourceData = () => {
const select = { const select = {
"disasterType": state.value_disasterType, "disasterType": state.value_disasterType,
"disasterTime": state.value_disasterTime, "disasterDate": state.value_disasterDate,
"disasterCountry": state.value_disasterCountry, "disasterCountry": state.value_disasterCountry,
// "size": state.tableData.param.pageSize, "size": state.tableData.param.pageSize,
// "current": state.tableData.param.pageNum "current": state.tableData.param.pageNum
} }
// //
getRemoteSensingSourceData(select).then( getRemoteSensingSourceData(select).then(
(res) => { (res) => {
state.requestData = res; state.requestData = res.records;
state.tableData.total = res.length; state.tableData.total = res.total;
console.log(res) state.tableData.param.pageNum = res.current;
// state.tableData.param.pageNum = res.current; state.tableData.param.pageSize = res.size;
// state.tableData.param.pageSize = res.size;
}) })
} }
//
const searchDisasterCountry = () => {
const selectCountry = {
"disasterType": state.value_disasterType,
"disasterDate": state.value_disasterDate,
"name": "disaster_country"
}
if (state.options_disasterCountry) {
getSelectionCondition(selectCountry).then(
(res) => {
state.options_disasterCountry = []
for (let index = 0; index < res.length; index++) {
let obj = {}
obj.value = res[index].name
obj.label = res[index].name
state.options_disasterCountry.push(obj)
}
}
)
}
}
//
const searchDisasterType = () => {
const selectType = {
"disasterCountry": state.value_disasterCountry,
"disasterDate": state.value_disasterDate,
"name": "disaster_type"
}
if (state.options_disasterType) {
getSelectionCondition(selectType).then(
(res) => {
state.options_disasterType = []
for (let index = 0; index < res.length; index++) {
let obj = {}
obj.value = res[index].name
obj.label = res[index].name
state.options_disasterType.push(obj)
}
}
)
}
}
//
const searchDisasterDate = () => {
const selectDate = {
"disasterType": state.value_disasterType,
"disasterCountry": state.value_disasterCountry,
"name": "disaster_time"
}
if (state.value_disasterDate == '') {
getSelectionCondition(selectDate).then(
(res) => {
state.value_disasterDate = res[0].name
}
)
}
else {
state.value_disasterDate = ''
getSelectionCondition(selectDate).then(
(res) => {
state.value_disasterDate = res[0].name
})
}
}
// //
const onHandleSizeChange = (val) => { const onHandleSizeChange = (val) => {
// searchContent.value = ""; // searchContent.value = "";
@ -215,6 +262,9 @@ const onHandleCurrentChange = (val) => {
// studentData(classID.value, courseID.value, currentPage.value, pageSize.value); // studentData(classID.value, courseID.value, currentPage.value, pageSize.value);
}; };
onMounted(() => {
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">