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

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>

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>
@ -82,10 +84,11 @@
<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",
@ -162,9 +165,29 @@ export default defineComponent({
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>
@ -227,6 +227,7 @@
sessionStorage.removeItem("SurfaceCorrection");
sessionStorage.removeItem("DensityCorrection");
sessionStorage.removeItem("FourPointCalibration");
sessionStorage.removeItem("GridSettings");
}, 500);
getconfig();
};
@ -261,8 +262,7 @@
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);
}
}