增加网格设置界面切换时缓存

This commit is contained in:
shefengchun 2023-01-29 14:03:39 +08:00
parent ee4166abc3
commit 1e0e2a529c
3 changed files with 217 additions and 193 deletions

View File

@ -61,7 +61,8 @@
(val > -1 && val < 1920) || $t('Please enter 0-100'),
]" />
</div>
<div class="col-3"><span>{{$t('Whether to operate synchronously')}}</span><q-checkbox v-model="auto_sync" /></div>
<div class="col-3"><span>{{ $t('Whether to operate synchronously') }}</span><q-checkbox
v-model="auto_sync" /></div>
</div>
</div>
</div>
@ -163,7 +164,7 @@ export default defineComponent({
{ alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 },
{ alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 },
]);
const auto_sync=ref(false)
const auto_sync = ref(false)
//
let arr = [1, 0, 2, 3];
let serverconfig = JSON.parse($store.state.fusion_configuration);
@ -386,7 +387,7 @@ export default defineComponent({
array[1].isshow,
Number(array[1].value)
);
if(auto_sync.value)left_right_auto_add(newVal-oldVal);
if (auto_sync.value) left_right_auto_add(newVal - oldVal);
save_set_cache();
},
{ deep: true }
@ -402,7 +403,7 @@ export default defineComponent({
array[2].isshow,
Number(array[2].value)
);
if(auto_sync.value)left_right_auto_add(newVal-oldVal);
if (auto_sync.value) left_right_auto_add(newVal - oldVal);
save_set_cache();
},
{ deep: true }
@ -450,7 +451,7 @@ export default defineComponent({
array[1].isshow,
Number(array[1].value)
);
if(auto_sync.value)left_right_auto_add(0);
if (auto_sync.value) left_right_auto_add(0);
save_set_cache();
},
{ deep: true }
@ -466,7 +467,7 @@ export default defineComponent({
array[2].isshow,
Number(array[2].value)
);
if(auto_sync.value)left_right_auto_add(0);
if (auto_sync.value) left_right_auto_add(0);
save_set_cache();
},
{ deep: true }
@ -547,7 +548,7 @@ export default defineComponent({
if (ste_status.value == 0) {
set_cache_tmp[2].value = Number(set_cache_tmp[2].value) + difference
set_cache_tmp[2].isshow = array[1].isshow
set?.SetBlendingOverlap(0, 0, 2, set_cache_tmp[2].isshow , Number(set_cache_tmp[2].value));
set?.SetBlendingOverlap(0, 0, 2, set_cache_tmp[2].isshow, Number(set_cache_tmp[2].value));
set_cache.value[0] = JSON.stringify(set_cache_tmp);
}
}

View File

@ -26,7 +26,8 @@
<div class="col-4 q-pt-sm">
<div class="row">
<div class="col-4"><span>{{ $t('line color') }}</span></div>
<div class="col-8 border" @click="isshowhex = true; index = 0" :style="{ 'background-color': color[0] }"></div>
<div class="col-8 border" @click="isshowhex = true; index = 0"
:style="{ 'background-color': color[0] }"></div>
</div>
</div>
</div>
@ -37,7 +38,8 @@
<div class="col-4 q-pt-sm">
<div class="row">
<div class="col-4"><span>{{ $t('background color') }}</span></div>
<div class="col-8 border" @click="isshowhex = true; index = 1" :style="{ 'background-color': color[1] }"></div>
<div class="col-8 border" @click="isshowhex = true; index = 1"
:style="{ 'background-color': color[1] }"></div>
</div>
</div>
</div>
@ -75,17 +77,18 @@
</template>
<style scoped>
.border{
.border {
border: 1px solid;
}
</style>
<script lang="ts">
import vue3ResizeDrag from "/src/third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue";
import { defineComponent, ref, reactive } from "vue";
import { defineComponent, ref, reactive, onBeforeUnmount } from "vue";
import { useStore } from "src/store";
import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData";
import { json } from "body-parser";
export default defineComponent({
name: "ComponentGridSettings",
@ -155,16 +158,36 @@ export default defineComponent({
}
}, 100);
}
const use_server_config =()=>{
let server_conf=JSON.parse($store.state.fusion_configuration).options
model[0]=Number(server_conf.blending_grids_row)
model[1]=Number(server_conf.blending_grids_column)
color[0]=server_conf.blending_grids_line_color
RowsColumns[0]=server_conf.blending_grids_hide_row==="false"?false:true
RowsColumns[1]=server_conf.blending_grids_hide_column==="false"?false:true
const use_server_config = () => {
let server_conf = JSON.parse($store.state.fusion_configuration).options
model[0] = Number(server_conf.blending_grids_row)
model[1] = Number(server_conf.blending_grids_column)
color[0] = server_conf.blending_grids_line_color
RowsColumns[0] = server_conf.blending_grids_hide_row === "false" ? false : true
RowsColumns[1] = server_conf.blending_grids_hide_column === "false" ? false : true
}
use_server_config()
onBeforeUnmount(() => {
set_sessionStorage()
});
const set_sessionStorage = () => {
let tmp = { RowsColumns: RowsColumns, color: color, model: model }
sessionStorage.GridSettings = JSON.stringify(tmp)
}
const get_sessionStorage = () => {
let tmp = JSON.parse(sessionStorage.GridSettings)
for (let index = 0; index < tmp.RowsColumns.length; index++) {
RowsColumns[index] = tmp.RowsColumns[index];
}
for (let index = 0; index < tmp.color.length; index++) {
color[index] = tmp.color[index];
}
for (let index = 0; index < tmp.model.length; index++) {
model[index] = tmp.model[index];
}
}
if (sessionStorage.GridSettings) get_sessionStorage()
return {
model,
options,

View File

@ -76,11 +76,11 @@
<span>{{ $t("Whether to hide the desktop") }}</span><q-checkbox style="justify-content: flex-start"
v-model="hide_desktop_value" @click="send_hide_desktop" />
<span>{{ $t("disable blending params") }}</span>
<q-checkbox style="justify-content: flex-start"
v-model="disable_blending_params" @click="send_disable_blending_params" />
<q-checkbox style="justify-content: flex-start" v-model="disable_blending_params"
@click="send_disable_blending_params" />
<span>{{ $t("show blending grids") }}</span>
<q-checkbox style="justify-content: flex-start"
v-model="show_blending_grids" @click="send_show_blending_grids" />
<q-checkbox style="justify-content: flex-start" v-model="show_blending_grids"
@click="send_show_blending_grids" />
<div class="q-space" data-v-39efcd1f=""></div>
<q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall config')" />
<div class="q-space" data-v-39efcd1f=""></div>
@ -104,7 +104,7 @@
</style>
<script lang="ts">
import {
import {
defineComponent,
ref,
Ref,
@ -112,23 +112,23 @@
computed,
onMounted,
onBeforeMount,
} from "vue";
import { useStore } from "src/store";
import { useQuasar, copyToClipboard } from "quasar";
import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData";
import { Protocol } from "src/entities/WSProtocol";
import { EDeviceAttribute } from "src/entities/EDeviceAttribute";
} from "vue";
import { useStore } from "src/store";
import { useQuasar, copyToClipboard } from "quasar";
import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData";
import { Protocol } from "src/entities/WSProtocol";
import { EDeviceAttribute } from "src/entities/EDeviceAttribute";
import ProjectorItem from "src/components/FusionSettings/ProjectorItem.vue";
import ProjectorItem from "src/components/FusionSettings/ProjectorItem.vue";
import FusionLocale from "src/components/FusionSettings/FusionLocale.vue";
import FourPointCalibration from "src/components/FusionSettings/FourPointCalibration.vue";
import GridSettings from "src/components/FusionSettings/GridSettings.vue";
import SurfaceCorrection from "src/components/FusionSettings/SurfaceCorrection.vue";
import DensityCorrection from "src/components/FusionSettings/DensityCorrection.vue";
import FusionLocale from "src/components/FusionSettings/FusionLocale.vue";
import FourPointCalibration from "src/components/FusionSettings/FourPointCalibration.vue";
import GridSettings from "src/components/FusionSettings/GridSettings.vue";
import SurfaceCorrection from "src/components/FusionSettings/SurfaceCorrection.vue";
import DensityCorrection from "src/components/FusionSettings/DensityCorrection.vue";
export default defineComponent({
export default defineComponent({
name: "ComponentFusionSettingsDialog",
components: {
ProjectorItem,
@ -156,7 +156,7 @@
const send_show_blending_grids = () => {
set?.SetBlendingOption(show_blending_grids_id.value, show_blending_grids.value ? "1" : "0");
};
const resetall=()=>{
const resetall = () => {
set?.ResetBlendingConfig()
}
const config = ref({ col: 0, row: 0 });
@ -227,6 +227,7 @@
sessionStorage.removeItem("SurfaceCorrection");
sessionStorage.removeItem("DensityCorrection");
sessionStorage.removeItem("FourPointCalibration");
sessionStorage.removeItem("GridSettings");
}, 500);
getconfig();
};
@ -257,12 +258,11 @@
[disable_blending_params_id, disable_blending_params],
[show_blending_grids_id, show_blending_grids]
];
let k:any;
for(k in local_options) {
let k: any;
for (k in local_options) {
let local_opt = local_options[k];
let opt = tmp.options[(<any>local_opt[0].value)];
if (opt)
{
if (opt) {
local_opt[1].value = ("0" == opt || "false" == opt.toLowerCase() ? false : true);
}
}
@ -287,5 +287,5 @@
resetall
};
},
});
});
</script>