修复动态添加时重置全部方案数据错误 优化细节

This commit is contained in:
shefengchun 2023-02-23 17:10:51 +08:00
parent 5c7ac2a7d0
commit 800dfec98d
5 changed files with 185 additions and 30 deletions

View File

@ -50,12 +50,12 @@
</div>
<div>
<div class="row" v-show="now_v_h == 'vertical'">
<div class="row q-py-md" v-show="now_v_h == 'vertical'">
<div class="col-1"></div>
<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
v-model="value_v_point_amount" :options="options_value_v_point_amount" emit-value map-options /></div>
<div class="col-2 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;value_point_amount_tmp_v=value_v_point_amount}" text-color="black"
:label="$t('add control points')" /></div>
<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>
@ -82,12 +82,12 @@
</div>
<div>
<div class="row" v-show="now_v_h == 'level'">
<div class="row q-py-md" 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"
<div class="col-2 q-pt-md "><q-btn color="white" @click="add_dialog = true;value_point_amount_tmp_h=value_h_point_amount" 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>
@ -134,7 +134,7 @@
</q-card>
</q-dialog>
<q-dialog v-model="add_dialog">
<!-- <q-dialog v-model="add_dialog">
<q-card style="width: 700px; max-width: 80vw;">
<q-card-section>
<div class="text-h6">{{ $t('Whether to add control points') }}</div>
@ -147,6 +147,32 @@
<q-btn flat :label="$t('ok')" @click="add" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog> -->
<q-dialog position="bottom" v-model="add_dialog">
<q-card style="width: 700px; max-width: 80vw;">
<q-card-section>
<div class="text-h6">{{ $t('Whether to add control points') }}</div>
</q-card-section>
<q-card-section class="q-pt-none">
<div class="row">
<div v-if="now_v_h=='vertical'" class="col-10"><q-input filled v-model="value_v_point_amount" min="3" disable type="number"
:label="$t('Please enter the points you need to add')" @update:model-value="(val: any) => { }" />
</div>
<div v-else class="col-10"><q-input filled v-model="value_h_point_amount" min="3" disable type="number"
:label="$t('Please enter the points you need to add')" @update:model-value="(val: any) => { }" />
</div>
<div class="col-1 q-pa-sm"> <q-btn color="white" text-color="black" label="↑"
@click="() => {now_v_h=='vertical'?preview_v(Number(value_v_point_amount)+1):preview_h(Number(value_h_point_amount)+1)}" /> </div>
<div class="col-1 q-pa-sm"> <q-btn color="white" text-color="black" label="↓"
@click="() => {now_v_h=='vertical'?preview_v(Number(value_v_point_amount)-1):preview_h(Number(value_h_point_amount)-1)}" /></div>
</div>
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat :label="$t('Cancel')" @click="()=>{now_v_h=='vertical'?preview_v(value_point_amount_tmp_v):preview_h(value_point_amount_tmp_h)}" color="primary" v-close-popup />
<q-btn flat :label="$t('ok')" @click="add" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
</template>
@ -603,6 +629,7 @@ export default defineComponent({
const resetall_all = () => {
switch (now_v_h.value) {
case 'vertical':
let tmp =value_v_point_amount.value
for (let key in config.multi_ver_density) {
for (let index = 0; index < config.multi_ver_density[key].length; index++) {
config.multi_ver_density[key][index].x = config.multi_ver_density[key][index].def_x
@ -610,11 +637,12 @@ export default defineComponent({
}
start_point(Number(key), 'v')
}
value_v_point_amount.value = 5
start_point(Number(5), 'v')
value_v_point_amount.value = tmp
start_point(Number(tmp), 'v')
send_value(-2, 'v', 0);
break;
case 'level':
let tmpp =value_h_point_amount.value
for (let key in config.multi_hor_density) {
for (let index = 0; index < config.multi_hor_density[key].length; index++) {
config.multi_hor_density[key][index].x = config.multi_hor_density[key][index].def_x
@ -622,8 +650,8 @@ export default defineComponent({
}
start_point(Number(key), 'h')
}
value_h_point_amount.value = 5
start_point(Number(5), 'h')
value_h_point_amount.value = tmpp
start_point(Number(tmpp), 'h')
send_value(-2, 'h', 0);
break;
default:
@ -636,6 +664,8 @@ export default defineComponent({
let tmpconfig: any = null
let row = $store.getters.GetTheCurrentlySelectedCamera[0]
let col = $store.getters.GetTheCurrentlySelectedCamera[1]
switch (type) {
case 'v':
set?.AddBlendingCtrlPoint('ver_density', row, col, Number(amount)).then((res) => {
@ -788,9 +818,6 @@ export default defineComponent({
}
value_v_point_amount.value = Number(options_value_v_point_amount.value[options_value_v_point_amount.value.length - 1])
amount = Number(options_value_v_point_amount.value[options_value_v_point_amount.value.length - 1])
// console.log(tmpconfig.multi_ver_density)
// console.log(value_v_point_amount.value)
// console.log(amount,'a')
$store.commit("setfusion_configuration", res?.config);
value_v.value = []
value_v_point.value = []
@ -894,7 +921,8 @@ export default defineComponent({
}
const add = () => {
let tmp = now_v_h.value == "vertical" ? "v" : "h"
add_control_points(Number(now_amount.value), tmp);
let amount = now_v_h.value == "vertical" ? value_v_point_amount.value : value_h_point_amount.value
add_control_points(Number(amount), tmp);
}
/**
@ -961,12 +989,76 @@ export default defineComponent({
}
const preview_v = (val: number) => {
val = Number(val)
if (val < 5) return
let width = allconfig.projector_width / (val - 1)
let height = allconfig.projector_height / (val - 1)
value_v.value = []
value_v_point.value = []
for (let index = 0; index < val; index++) {
let y = allconfig.projector_height - height * index
let x = width * index
let tmp: DensityCorrectionPoint = { x, y, def_x: x, def_y: y, control_point: index + 1 };
value_v.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_v_point.value.push(tmp_point)
}
value_v_point_amount.value = val
options_model_v.value = 1
}
const preview_h = (val: number) => {
val = Number(val)
if (val < 5) return
let width = allconfig.projector_width / (val - 1)
let height = allconfig.projector_height / (val - 1)
value_h.value = []
value_h_point.value = []
for (let index = 0; index < val; index++) {
let y = allconfig.projector_height - height * index
let x = width * index
let tmp: DensityCorrectionPoint = { x, y, def_x: x, def_y: y, control_point:index + 1 };
value_h.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_h_point.value.push(tmp_point)
}
value_h_point_amount.value = val
options_model_h.value = 1
}
/**
* 在增加时 实现回退
*/
const value_point_amount_tmp_v = ref(0)
const value_point_amount_tmp_h = ref(0)
defineExpose({
now_v_h,
options_model_v,
options_model_h
});
return {
config,
value_point_amount_tmp_v,
value_point_amount_tmp_h,
preview_v,
preview_h,
resetall,
div,
max,

View File

@ -17,7 +17,7 @@
</div>
</div>
<div>
<div class="row">
<div class="row q-py-xl">
<div class="col-1"></div>
<div class="col-2 q-px-md">
<div class="col-2"> <q-select class="q-pt-md" :label="$t('point amount')"
@ -26,7 +26,7 @@
</div>
</div>
<div class="col-2">
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { add_dialog = true }" text-color="black"
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { add_dialog = true;value_point_amount_tmp=value_point_amount }" text-color="black"
:label="$t('add control points')" /></div>
</div>
<div class="col-2">
@ -95,7 +95,7 @@
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat :label="$t('Cancel')" color="primary" v-close-popup />
<q-btn flat :label="$t('Cancel')" @click="()=>{preview(Math.sqrt(value_point_amount_tmp))}" color="primary" v-close-popup />
<q-btn flat :label="$t('ok')" @click="add" color="primary" v-close-popup />
</q-card-actions>
</q-card>
@ -419,6 +419,7 @@ export default defineComponent({
save_set_cache()
}
const resetall_all = () => {
let amount_tmp=value_point_amount.value
for (let index = 0; index < value_point.value.length; index++) {
value.value[index].x = value.value[index].def_x
value.value[index].y = value.value[index].def_y
@ -435,8 +436,8 @@ export default defineComponent({
}
start_point(Number(key))
}
value_point_amount.value = 9
start_point(Number(9))
value_point_amount.value = amount_tmp
start_point(Number(value_point_amount.value))
}
const recalculate_coordinates = () => {
@ -480,7 +481,7 @@ export default defineComponent({
}
ste_status.value = 1;
tmpconfig = JSON.parse(JSON.stringify(fortmp));
config = JSON.parse(JSON.stringify(fortmp));
config = fortmp
options_value_point_amount.value = []
for (let key in tmpconfig.multi_curved_surface) {
options_value_point_amount.value.push(key)
@ -680,11 +681,15 @@ export default defineComponent({
}
chang(options_model.value,"","")
}
/**
* 在增加时 实现回退
*/
const value_point_amount_tmp=ref(0)
defineExpose({
options_model,
});
return {
value_point_amount_tmp,
details_selsect,
resetall_all,
resetall,

View File

@ -50,10 +50,10 @@
<div>
<div class="col-3 q-px-md"> <q-select class="q-pt-md " :label="$t('change resolution')"
@update:model-value="(val) => { set_resolution(val) }" :dense="true" filled v-model="now_resolution"
@update:model-value="(val) => { dialog(val,set_resolution) }" :dense="true" filled v-model="now_resolution"
:options="options_resolution" emit-value map-options /></div>
<div class="col-3 q-px-md"> <q-select class="q-pt-md " :label="$t('Change projector layout')"
@update:model-value="(val) => { send_projectorlayout(val) }" :dense="true" filled v-model="now_select_projectorlayout"
@update:model-value="(val) => { dialog(val,send_projectorlayout) }" :dense="true" filled v-model="now_select_projectorlayout"
:options="projectorlayout" emit-value map-options /></div>
</div>
<div class="col-12" style="text-align: center">
@ -165,6 +165,22 @@
</q-card>
</q-dialog>
<q-dialog v-model="confirm">
<q-card style="width: 700px; max-width: 80vw;">
<q-card-section>
<div class="text-h6">{{ $t('Do you confirm the modification') }}</div>
</q-card-section>
<q-card-section class="q-pt-none">
{{ $t('Whether to delete') + name_to_be_deleted }}
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat :label="$t('Cancel')" @click="re_match_data" color="primary" v-close-popup />
<q-btn flat :label="$t('ok')" @click="trigger_dialog" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
</q-dialog>
</template>
@ -450,7 +466,11 @@ export default defineComponent({
clear_sessionStorage()
}, 500);
//getconfig()
options.value = "FusionLocale"
if (config.value.col == 1 && config.value.row == 1) {
optionsstr.value = "FourPointCalibration"
} else {
optionsstr.value = "FusionLocale";
}
};
/**
@ -488,8 +508,12 @@ export default defineComponent({
config.value.col = tmp.col;
config.value.row = tmp.row;
$store.commit("setfusion_configuration", res?.config);
config.value.col=tmp.col
config.value.row=tmp.row
if(config.value.col==1&&config.value.row==1){
optionsstr.value = "FourPointCalibration"
}else{
optionsstr.value = "FusionLocale";
}
allconfig = JSON.parse($store.state.fusion_configuration);
if(allconfig.resolution){
for (let index = 0; index < allconfig.resolution.length; index++) {
@ -511,7 +535,7 @@ export default defineComponent({
});
get_scenes()
set?.SetBlendingOption("blending_grids_select_ui", "blending")
optionsstr.value = "FusionLocale";
}, 1000);
});
const save_cover_name = ref("")
@ -624,13 +648,13 @@ export default defineComponent({
const btn_options = computed(() => {
let tmp=[]
tmp.push({label: $t.t('FourPointCalibration'), value: 'FourPointCalibration'})
tmp.push({label: $t.t('SurfaceCorrection'),value: 'SurfaceCorrection',})
if(now_select_projectorlayout.value!=0){
tmp.push({ label: $t.t('FusionLocale'), value: 'FusionLocale' })
}else{
optionsstr.value = "FourPointCalibration";
}
tmp.push({label: $t.t('FourPointCalibration'), value: 'FourPointCalibration'})
tmp.push({label: $t.t('SurfaceCorrection'),value: 'SurfaceCorrection',})
tmp.push({label: $t.t('DensityCorrection'),value: 'DensityCorrection',})
tmp.push({ label: $t.t('GridSettings'), value: 'GridSettings' })
return tmp
@ -643,7 +667,39 @@ export default defineComponent({
let col = allconfig.projectors.length
return {col}
})
/**
* 弹窗
* 浅拷贝
*/
const confirm=ref(false)
let dialog_data:any=null
const dialog=(parameter:any,fun:any)=>{
confirm.value=true
dialog_data={parameter,fun}
}
const trigger_dialog=()=>{
dialog_data.fun(dialog_data.parameter)
}
const re_match_data=()=>{
let tmp=allconfig
for (let index = 0; index < options_resolution.value.length; index++) {
let arr = options_resolution.value[index].label.split('*');
if(tmp.projector_width==Number(arr[0])&&tmp.projector_height==Number(arr[1])){
now_resolution.value=index
}
}
for (let index = 0; index < projectorlayout.length; index++) {
let arr = projectorlayout[index].label.split('x');
if(tmp.row==Number(arr[0])&&tmp.col==Number(arr[1])){
now_select_projectorlayout.value=index
}
}
}
return {
re_match_data,
trigger_dialog,
confirm,
dialog,
currently_selected_projector,
name_to_be_deleted,
dialog_del_scenes,

View File

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

View File

@ -766,5 +766,6 @@ export default {
"fusion out": "出",
"Please enter the square number":"请输入平方数",
"Change projector layout":"更改投影机布局",
"reset all":"重置所有"
"reset all":"重置所有",
"Do you confirm the modification":"是否确认修改"
};