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

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'), (val > -1 && val < 1920) || $t('Please enter 0-100'),
]" /> ]" />
</div> </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> </div>
</div> </div>

View File

@ -26,7 +26,8 @@
<div class="col-4 q-pt-sm"> <div class="col-4 q-pt-sm">
<div class="row"> <div class="row">
<div class="col-4"><span>{{ $t('line color') }}</span></div> <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> </div>
</div> </div>
@ -37,7 +38,8 @@
<div class="col-4 q-pt-sm"> <div class="col-4 q-pt-sm">
<div class="row"> <div class="row">
<div class="col-4"><span>{{ $t('background color') }}</span></div> <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> </div>
</div> </div>
@ -82,10 +84,11 @@
<script lang="ts"> <script lang="ts">
import vue3ResizeDrag from "/src/third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue"; 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 { useStore } from "src/store";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData"; import GlobalData from "src/common/GlobalData";
import { json } from "body-parser";
export default defineComponent({ export default defineComponent({
name: "ComponentGridSettings", name: "ComponentGridSettings",
@ -162,9 +165,29 @@ export default defineComponent({
color[0] = server_conf.blending_grids_line_color color[0] = server_conf.blending_grids_line_color
RowsColumns[0] = server_conf.blending_grids_hide_row === "false" ? false : true RowsColumns[0] = server_conf.blending_grids_hide_row === "false" ? false : true
RowsColumns[1] = server_conf.blending_grids_hide_column === "false" ? false : true RowsColumns[1] = server_conf.blending_grids_hide_column === "false" ? false : true
} }
use_server_config() 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 { return {
model, model,
options, options,

View File

@ -76,11 +76,11 @@
<span>{{ $t("Whether to hide the desktop") }}</span><q-checkbox style="justify-content: flex-start" <span>{{ $t("Whether to hide the desktop") }}</span><q-checkbox style="justify-content: flex-start"
v-model="hide_desktop_value" @click="send_hide_desktop" /> v-model="hide_desktop_value" @click="send_hide_desktop" />
<span>{{ $t("disable blending params") }}</span> <span>{{ $t("disable blending params") }}</span>
<q-checkbox style="justify-content: flex-start" <q-checkbox style="justify-content: flex-start" v-model="disable_blending_params"
v-model="disable_blending_params" @click="send_disable_blending_params" /> @click="send_disable_blending_params" />
<span>{{ $t("show blending grids") }}</span> <span>{{ $t("show blending grids") }}</span>
<q-checkbox style="justify-content: flex-start" <q-checkbox style="justify-content: flex-start" v-model="show_blending_grids"
v-model="show_blending_grids" @click="send_show_blending_grids" /> @click="send_show_blending_grids" />
<div class="q-space" data-v-39efcd1f=""></div> <div class="q-space" data-v-39efcd1f=""></div>
<q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall config')" /> <q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall config')" />
<div class="q-space" data-v-39efcd1f=""></div> <div class="q-space" data-v-39efcd1f=""></div>
@ -227,6 +227,7 @@
sessionStorage.removeItem("SurfaceCorrection"); sessionStorage.removeItem("SurfaceCorrection");
sessionStorage.removeItem("DensityCorrection"); sessionStorage.removeItem("DensityCorrection");
sessionStorage.removeItem("FourPointCalibration"); sessionStorage.removeItem("FourPointCalibration");
sessionStorage.removeItem("GridSettings");
}, 500); }, 500);
getconfig(); getconfig();
}; };
@ -261,8 +262,7 @@
for (k in local_options) { for (k in local_options) {
let local_opt = local_options[k]; let local_opt = local_options[k];
let opt = tmp.options[(<any>local_opt[0].value)]; let opt = tmp.options[(<any>local_opt[0].value)];
if (opt) if (opt) {
{
local_opt[1].value = ("0" == opt || "false" == opt.toLowerCase() ? false : true); local_opt[1].value = ("0" == opt || "false" == opt.toLowerCase() ? false : true);
} }
} }