切换地图、列表模式时携带选择的基地信息

master
贾肃 5 months ago
parent e46ebf6575
commit a818dfebe4
  1. 10
      src/components/baseSelection/index.vue
  2. 3
      src/views/system/base/baseRightControl.vue
  3. 27
      src/views/system/base/baseTable.vue

@ -9,6 +9,16 @@ const baseList = ref([
{id: 5, baseName: '种植资源圃1'}, {id: 5, baseName: '种植资源圃1'},
{id: 6, baseName: '种植资源圃2'}, {id: 6, baseName: '种植资源圃2'},
]) ])
const route = useRoute();
onMounted(()=>{
if (route.query.baseId){
baseList.value.forEach(item => {
if (item.id === Number(route.query.baseId)){
clickBase(item)
}
})
}
})
const currentBase = defineModel({type:Object,default:()=>({})}) const currentBase = defineModel({type:Object,default:()=>({})})
const maxHeight = ref(window.innerHeight - 130); const maxHeight = ref(window.innerHeight - 130);
const settingsStore = useSettingsStore() const settingsStore = useSettingsStore()

@ -7,8 +7,9 @@ const plantingSeasonList = [
{value: 2024, label: '2024年种植季'}, {value: 2024, label: '2024年种植季'},
] ]
const router = useRouter() const router = useRouter()
const route = useRoute();
const toBaseTable = () => { const toBaseTable = () => {
router.push('/system/base/baseTable') router.push({path:'/system/base/baseTable',query:route.params})
} }
const control = defineModel({ const control = defineModel({
default: { default: {

@ -3,10 +3,16 @@
<el-row :gutter="20"> <el-row :gutter="20">
<!--育种基地/资源圃选择--> <!--育种基地/资源圃选择-->
<el-col :span="4" :xs="24"> <el-col :span="4" :xs="24">
<base-selection></base-selection> <base-selection v-model="currentBase"></base-selection>
</el-col> </el-col>
<!--用户数据--> <!--用户数据-->
<el-col :span="20" :xs="24"> <el-col :span="20" :xs="24">
<el-row class="base-title">
<el-col :span="6" class="current-base-name">当前基地{{currentBase.baseName || '请选择基地'}}</el-col>
<el-col :span="6" class="current-base-total"><i-pound theme="filled" size="16" fill="#333"/>地块总数{{currentBase.baseName || '请选择基地'}}</el-col>
<el-col :span="6" class="current-base-area"><i-chart-line-area size="16" fill="#333"/>地块面积{{currentBase.area || '请选择基地'}}</el-col>
<el-col :span="6" class="handoff-model" @click="toBaseMap"><el-button type="text">切换地图模式</el-button></el-col>
</el-row>
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
@ -315,7 +321,7 @@ import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser,
const router = useRouter(); const router = useRouter();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex"); const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
const currentBase = ref({})
const userList = ref([]); const userList = ref([]);
const open = ref(false); const open = ref(false);
const loading = ref(false); const loading = ref(false);
@ -579,4 +585,21 @@ function submitForm() {
} }
}); });
}; };
//
const toBaseMap = () => {
if (currentBase.value.id){
router.push('/system/base/massifMap/'+currentBase.value.id)
}else{
router.push('/system/base/mapMarkers')
}
}
</script> </script>
<style scoped lang="scss">
.base-title{
margin: 10px 0;
.handoff-model{
padding-right: 20px;
text-align: right;
}
}
</style>

Loading…
Cancel
Save