修复重置时不保存数据

This commit is contained in:
shefengchun 2023-02-23 14:35:52 +08:00
parent 1b93f2f92a
commit 5c7ac2a7d0
5 changed files with 114 additions and 110 deletions

View File

@ -49,66 +49,68 @@
<div class="col-5"><q-radio v-model="now_v_h" val="vertical" :label="$t('vertical')" /></div> <div class="col-5"><q-radio v-model="now_v_h" val="vertical" :label="$t('vertical')" /></div>
</div> </div>
<div>
<div class="row" v-show="now_v_h == 'vertical'"> <div class="row" v-show="now_v_h == 'vertical'">
<div class="col-1"></div> <div class="col-1"></div>
<div class="col-3 q-px-md"> <q-select class="q-pt-md" :label="$t('vertical point')" <div class="col-2 q-px-md"> <q-select class="q-pt-md" :label="$t('vertical point')"
@update:model-value="(val) => { chang_point_amount(val, 'v') }" :dense="true" filled @update:model-value="(val) => { chang_point_amount(val, 'v') }" :dense="true" filled
v-model="value_v_point_amount" :options="options_value_v_point_amount" emit-value map-options /></div> v-model="value_v_point_amount" :options="options_value_v_point_amount" emit-value map-options /></div>
<div class="col-3 q-pt-md q-px-md"><q-btn color="white" @click="add_dialog = true" text-color="black" <div class="col-2 q-pt-md q-px-md"><q-btn color="white" @click="add_dialog = true" text-color="black"
:label="$t('add control points')" /></div> :label="$t('add control points')" /></div>
<div class="col-3 q-pt-md q-px-md"><q-btn color="white" @click="() => { del_dialog = true }" <div class="col-2 q-pt-md q-px-md"><q-btn color="white" @click="() => { del_dialog = true }"
:disable="value_v_point_amount <= 5" text-color="black" :label="$t('reduce control points')" /></div> :disable="value_v_point_amount <= 5" text-color="black" :label="$t('reduce control points')" /></div>
</div> <div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall_all" text-color="black"
:label="$t('Reset all program control points')" /></div>
<div class="row" v-show="now_v_h == 'vertical'">
<div class="col-1"></div>
<div class="col-3 q-px-md" @mousewheel="details_selsect_v"> <q-select class="q-pt-md " :label="$t('vertical')"
@update:model-value="(val) => { options_v = val }" :dense="true" filled v-model="options_model_v"
:options="options_v" emit-value map-options /></div>
<div class="col-3 q-px-md" @mousewheel="details_selsect_val($event,'v')" > <q-input v-if="value_v[options_model_v]" filled type="number" class="q-pt-md"
:dense="true" v-model="value_v[options_model_v].y" @update:model-value="chang(options_model_v, $event, 'v')"
lazy-rules />
</div>
<div class="q-pt-md col-3">
<q-btn color="white" @click="reset(options_model_v, true, 'v')" text-color="black" :label="$t('reset')" />
</div> </div>
</div> <div class="row" v-show="now_v_h == 'vertical'">
<div class="col-1"></div>
<div class="col-2 q-px-md" @mousewheel="details_selsect_v"> <q-select class="q-pt-md " :label="$t('vertical')"
@update:model-value="(val) => { options_v = val }" :dense="true" filled v-model="options_model_v"
:options="options_v" emit-value map-options /></div>
<div class="col-2 q-px-md" @mousewheel="details_selsect_val($event, 'v')"> <q-input v-if="value_v[options_model_v]"
filled type="number" class="q-pt-md" :dense="true" v-model="value_v[options_model_v].y"
@update:model-value="chang(options_model_v, $event, 'v')" lazy-rules />
</div>
<div class="q-pt-md col-2">
<q-btn color="white" @click="reset(options_model_v, true, 'v')" text-color="black" :label="$t('reset')" />
</div>
<div class="row" v-show="now_v_h == 'level'"> <div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall" text-color="black"
<div class="col-1"></div> :label="$t('reset all')+value_v_point_amount+$t('point')" /></div>
<div class="col-3 q-px-md"> <q-select class="q-pt-md" :label="$t('level point')"
@update:model-value="(val) => { chang_point_amount(val, 'h') }" :dense="true" filled
v-model="value_h_point_amount" :options="options_value_h_point_amount" emit-value map-options /></div>
<div class="col-3 q-pt-md "><q-btn color="white" @click="add_dialog = true" text-color="black"
:label="$t('add control points')" /></div>
<div class="col-3 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }"
:disable="value_h_point_amount <= 5" text-color="black" :label="$t('reduce control points')" /></div>
</div>
<div class="row" v-show="now_v_h == 'level'">
<div class="col-1"></div>
<div class="col-3 q-px-md" @mousewheel="details_selsect_h"> <q-select class="q-pt-md" :label="$t('level')"
@update:model-value="(val) => { options_h = val }" :dense="true" filled v-model="options_model_h"
:options="options_h" emit-value map-options /></div>
<div class="col-3 q-px-md" @mousewheel="details_selsect_val($event,'h')"> <q-input v-if="value_h[options_model_h]" filled type="number" class="q-pt-md"
:dense="true" v-model="value_h[options_model_h].x" @update:model-value="chang(options_model_h, $event, 'h')"
lazy-rules />
</div> </div>
<div class="q-pt-md col-3"> </div>
<q-btn color="white" @click="reset(options_model_h, true, 'h')" text-color="black" :label="$t('reset')" />
<div>
<div class="row" v-show="now_v_h == 'level'">
<div class="col-1"></div>
<div class="col-2 q-px-md"> <q-select class="q-pt-md" :label="$t('level point')"
@update:model-value="(val) => { chang_point_amount(val, 'h') }" :dense="true" filled
v-model="value_h_point_amount" :options="options_value_h_point_amount" emit-value map-options /></div>
<div class="col-2 q-pt-md "><q-btn color="white" @click="add_dialog = true" text-color="black"
:label="$t('add control points')" /></div>
<div class="col-2 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }"
:disable="value_h_point_amount <= 5" text-color="black" :label="$t('reduce control points')" /></div>
<div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall_all" text-color="black"
:label="$t('Reset all program control points')" /></div>
</div> </div>
</div> <div class="row" v-show="now_v_h == 'level'">
<div class="col-1"></div>
<div class="col-2 q-px-md" @mousewheel="details_selsect_h"> <q-select class="q-pt-md" :label="$t('level')"
@update:model-value="(val) => { options_h = val }" :dense="true" filled v-model="options_model_h"
:options="options_h" emit-value map-options /></div>
<div class="col-2 q-px-md" @mousewheel="details_selsect_val($event, 'h')"> <q-input v-if="value_h[options_model_h]"
filled type="number" class="q-pt-md" :dense="true" v-model="value_h[options_model_h].x"
@update:model-value="chang(options_model_h, $event, 'h')" lazy-rules />
</div>
<div class="q-pt-md col-2">
<q-btn color="white" @click="reset(options_model_h, true, 'h')" text-color="black" :label="$t('reset')" />
</div>
<div class="row"> <div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall" text-color="black"
<div class="col-1"></div> :label="$t('reset all')+value_h_point_amount+$t('point')" /></div>
<div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall" text-color="black" </div>
:label="$t('Reset the current program control point')" /></div>
<div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall_all" text-color="black"
:label="$t('Reset all program control points')" /></div>
</div> </div>
</div> </div>
<div style="position: absolute;bottom: 0;"> <div style="position: absolute;bottom: 0;">
@ -145,7 +147,7 @@
<q-btn flat :label="$t('ok')" @click="add" color="primary" v-close-popup /> <q-btn flat :label="$t('ok')" @click="add" color="primary" v-close-popup />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>
<style scoped> <style scoped>
@ -592,6 +594,7 @@ export default defineComponent({
break; break;
} }
send_value(-1, 'v', 0); send_value(-1, 'v', 0);
save_set_cache()
} }
/** /**
@ -898,36 +901,36 @@ export default defineComponent({
* 滚轮切换 * 滚轮切换
* @param details * @param details
*/ */
const details_selsect_v=(details:any) => { const details_selsect_v = (details: any) => {
let spt=details.deltaY/100 let spt = details.deltaY / 100
if(spt<0){ if (spt < 0) {
if(options_model_v.value>=value_v_point.value.length-1){ if (options_model_v.value >= value_v_point.value.length - 1) {
options_model_v.value=0 options_model_v.value = 0
}else{ } else {
options_model_v.value++ options_model_v.value++
} }
}else{ } else {
if(options_model_v.value<=0){ if (options_model_v.value <= 0) {
options_model_v.value=value_v_point.value.length-1 options_model_v.value = value_v_point.value.length - 1
}else{ } else {
options_model_v.value-- options_model_v.value--
} }
} }
} }
const details_selsect_h=(details:any) => { const details_selsect_h = (details: any) => {
let spt=details.deltaY/100 let spt = details.deltaY / 100
if(spt<0){ if (spt < 0) {
if(options_model_h.value>=value_h_point.value.length-1){ if (options_model_h.value >= value_h_point.value.length - 1) {
options_model_h.value=0 options_model_h.value = 0
}else{ } else {
options_model_h.value++ options_model_h.value++
} }
}else{ } else {
if(options_model_h.value<=0){ if (options_model_h.value <= 0) {
options_model_h.value=value_h_point.value.length-1 options_model_h.value = value_h_point.value.length - 1
}else{ } else {
options_model_h.value-- options_model_h.value--
} }
} }
} }
@ -935,26 +938,26 @@ export default defineComponent({
* v数据 * v数据
*/ */
const details_selsect_val = (details: any, type: string) => { const details_selsect_val = (details: any, type: string) => {
let spt = details.deltaY / 100 let spt = details.deltaY / 100
switch (type) { switch (type) {
case 'v': case 'v':
if (spt < 0) { if (spt < 0) {
value_v.value[options_model_v.value].y++ value_v.value[options_model_v.value].y++
} else { } else {
value_v.value[options_model_v.value].y-- value_v.value[options_model_v.value].y--
}
chang(options_model_v.value, value_v.value[options_model_v.value].y, "v")
break;
default:
if (spt < 0) {
value_h.value[options_model_h.value].x++
} else {
value_h.value[options_model_h.value].x--
}
chang(options_model_h.value, value_h.value[options_model_h.value].x, "h")
break;
} }
chang(options_model_v.value,value_v.value[options_model_v.value].y,"v")
break;
default:
if (spt < 0) {
value_h.value[options_model_h.value].x++
} else {
value_h.value[options_model_h.value].x--
}
chang(options_model_h.value,value_h.value[options_model_h.value].x,"h")
break;
}
} }

View File

@ -339,6 +339,7 @@ export default defineComponent({
value_point.value[index].x = Math.round(tmp.x) value_point.value[index].x = Math.round(tmp.x)
} }
send_value(-2,0,0) send_value(-2,0,0)
save_set_cache()
} }
const recalculate_coordinates = () => { const recalculate_coordinates = () => {
try { try {

View File

@ -35,6 +35,9 @@
:disable="value_point_amount <= 9" text-color="black" :label="$t('reduce control points')" /></div> :disable="value_point_amount <= 9" text-color="black" :label="$t('reduce control points')" /></div>
</div> </div>
<div class="q-pt-md q-px-md col-4"> <q-btn color="white" @click="resetall_all" text-color="black"
:label="$t('Reset all program control points')" /></div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-1"></div> <div class="col-1"></div>
@ -49,19 +52,13 @@
</div> </div>
<div class="q-pt-md col-2"> <div class="q-pt-md col-2">
<q-btn color="white" @click="reset(options_model, true, 'h')" text-color="black" :label="$t('reset')" /> <q-btn color="white" @click="reset(options_model, true, 'h')" text-color="black" :label="$t('reset')" />
</div> </div>
<!-- <div class="col-2 q-pt-md "> <div class="q-pt-md q-px-md col-3"> <q-btn color="white" @click="resetall" text-color="black"
<div><q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall')" /></div> :label="$t('reset all')+value_point_amount+$t('point')" /></div>
</div> -->
</div>
<div class="row">
<div class="col-1"></div>
<div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall" text-color="black"
:label="$t('Reset the current program control point')" /></div>
<div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall_all" text-color="black"
:label="$t('Reset all program control points')" /></div>
</div> </div>
</div> </div>
<q-dialog v-model="del_dialog"> <q-dialog v-model="del_dialog">
<q-card style="width: 700px; max-width: 80vw;"> <q-card style="width: 700px; max-width: 80vw;">
@ -419,6 +416,7 @@ export default defineComponent({
value_point.value[index].x = Math.trunc(tmp.x) value_point.value[index].x = Math.trunc(tmp.x)
} }
send_value(-1, 0, 0) send_value(-1, 0, 0)
save_set_cache()
} }
const resetall_all = () => { const resetall_all = () => {
for (let index = 0; index < value_point.value.length; index++) { for (let index = 0; index < value_point.value.length; index++) {
@ -659,7 +657,7 @@ export default defineComponent({
} }
} }
/** /**
* 滚轮改变数据 * 滚轮改变数据
*/ */
const details_selsect_val = (details: any, type: string) => { const details_selsect_val = (details: any, type: string) => {

View File

@ -499,4 +499,5 @@ export default {
"fusion out": "Out", "fusion out": "Out",
"Please enter the square number": "Please enter the square number", "Please enter the square number": "Please enter the square number",
"Change projector layout": "Change projector layout", "Change projector layout": "Change projector layout",
"reset all":"reset all"
}; };

View File

@ -765,5 +765,6 @@ export default {
normal: "普通", normal: "普通",
"fusion out": "出", "fusion out": "出",
"Please enter the square number":"请输入平方数", "Please enter the square number":"请输入平方数",
"Change projector layout":"更改投影机布局" "Change projector layout":"更改投影机布局",
"reset all":"重置所有"
}; };