修复动态添加的一些错误

This commit is contained in:
shefengchun 2023-02-15 15:08:47 +08:00
parent dbecb1ff15
commit 12a940a55f
7 changed files with 80 additions and 24 deletions

View File

@ -67,7 +67,7 @@
<div class="col-1 q-pt-md "><q-btn color="white" <div class="col-1 q-pt-md "><q-btn color="white"
@click="add_dialog=true" text-color="black" @click="add_dialog=true" text-color="black"
:label="$t('add control points')" /></div> :label="$t('add control points')" /></div>
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" text-color="black" <div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" :disable="value_v_point_amount<=5" text-color="black"
:label="$t('reduce control points')" /></div> :label="$t('reduce control points')" /></div>
</div> </div>
<div class="row" v-show="now_v_h == 'level'"> <div class="row" v-show="now_v_h == 'level'">
@ -87,7 +87,7 @@
<div class="col-1 q-pt-md "><q-btn color="white" <div class="col-1 q-pt-md "><q-btn color="white"
@click="add_dialog=true" text-color="black" @click="add_dialog=true" text-color="black"
:label="$t('add control points')" /></div> :label="$t('add control points')" /></div>
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" text-color="black" <div class="col-1 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> :label="$t('reduce control points')" /></div>
</div> </div>
<div class="q-pt-md"> <q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall')" /></div> <div class="q-pt-md"> <q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall')" /></div>
@ -150,7 +150,8 @@ import {
computed, computed,
watch, watch,
nextTick, nextTick,
onBeforeUnmount onBeforeUnmount,
defineExpose
} from "vue"; } from "vue";
import { useStore } from "src/store"; import { useStore } from "src/store";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
@ -208,6 +209,8 @@ export default defineComponent({
}; };
const use_server_config = () => { const use_server_config = () => {
value_h_point_amount.value = 5
value_v_point_amount.value = 5
let a = 5 let a = 5
value_h.value = [] value_h.value = []
value_h_point.value = [] value_h_point.value = []
@ -256,8 +259,8 @@ export default defineComponent({
value_v_point.value = [] value_v_point.value = []
deepcopy(value_h.value, tmp.value_h) deepcopy(value_h.value, tmp.value_h)
deepcopy(value_v.value, tmp.value_v) deepcopy(value_v.value, tmp.value_v)
value_h_point_amount.value = Number(tmp.value_h_point_amount) value_h_point_amount.value = tmp.value_h_point_amount
value_v_point_amount.value = Number(tmp.value_v_point_amount) value_v_point_amount.value = tmp.value_v_point_amount
deepcopy(value_h_point.value, tmp.value_h_point) deepcopy(value_h_point.value, tmp.value_h_point)
deepcopy(value_v_point.value, tmp.value_v_point) deepcopy(value_v_point.value, tmp.value_v_point)
recalculate_coordinates() recalculate_coordinates()
@ -297,7 +300,7 @@ export default defineComponent({
use_server_config(); use_server_config();
use_set_cache(); use_set_cache();
options_value_h_point_amount.value = Object.keys(config.multi_hor_density) options_value_h_point_amount.value = Object.keys(config.multi_hor_density)
options_value_v_point_amount.value = Object.keys(config.multi_ver_density) options_value_v_point_amount.value = Object.keys(config.multi_ver_density)
setTimeout(() => { setTimeout(() => {
ste_status.value = 0; ste_status.value = 0;
}, 100); }, 100);
@ -339,6 +342,7 @@ export default defineComponent({
} else { } else {
set?.SetBlendingOption("blending_grids_select_ui", "ver_density") set?.SetBlendingOption("blending_grids_select_ui", "ver_density")
} }
save_set_cache()
}, { deep: true }) }, { deep: true })
watch(() => value_h_point_amount, (newval, oldval) => { watch(() => value_h_point_amount, (newval, oldval) => {
set?.SetBlendingOption("blending_grids_control_point_count", `${newval.value}`) set?.SetBlendingOption("blending_grids_control_point_count", `${newval.value}`)
@ -347,6 +351,7 @@ export default defineComponent({
} else { } else {
set?.SetBlendingOption("blending_grids_select_ui", "ver_density") set?.SetBlendingOption("blending_grids_select_ui", "ver_density")
} }
save_set_cache()
}, { deep: true }) }, { deep: true })
watch(() => options_model_h, (newval, oldval) => { watch(() => options_model_h, (newval, oldval) => {
@ -368,6 +373,7 @@ export default defineComponent({
const chang_point_amount = (val: number, type: string) => { const chang_point_amount = (val: number, type: string) => {
start_point(val, type) start_point(val, type)
save_set_cache()
} }
const dragStartHandle = ($event: any, index: number, type: string) => { const dragStartHandle = ($event: any, index: number, type: string) => {
@ -570,7 +576,7 @@ export default defineComponent({
let col = $store.getters.GetTheCurrentlySelectedCamera[1] let col = $store.getters.GetTheCurrentlySelectedCamera[1]
switch (type) { switch (type) {
case 'v': case 'v':
set?.AddBlendingCtrlPoint('ver_density', row, col, amount).then((res) => { set?.AddBlendingCtrlPoint('ver_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return if (res == null || typeof (res) == "undefined") return
update(res?.config) update(res?.config)
let tmp = JSON.parse(res?.config); let tmp = JSON.parse(res?.config);
@ -615,7 +621,7 @@ export default defineComponent({
}); });
break; break;
case 'h': case 'h':
set?.AddBlendingCtrlPoint('hor_density', row, col, amount).then((res) => { set?.AddBlendingCtrlPoint('hor_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return if (res == null || typeof (res) == "undefined") return
update(res?.config) update(res?.config)
let tmp = JSON.parse(res?.config); let tmp = JSON.parse(res?.config);
@ -700,7 +706,7 @@ export default defineComponent({
let col = $store.getters.GetTheCurrentlySelectedCamera[1] let col = $store.getters.GetTheCurrentlySelectedCamera[1]
switch (type) { switch (type) {
case 'v': case 'v':
set?.DelBlendingCtrlPoint('ver_density', row, col, amount).then((res) => { set?.DelBlendingCtrlPoint('ver_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return if (res == null || typeof (res) == "undefined") return
let tmp = JSON.parse(res?.config); let tmp = JSON.parse(res?.config);
let fortmp = null; let fortmp = null;
@ -747,7 +753,7 @@ export default defineComponent({
}); });
break; break;
case 'h': case 'h':
set?.DelBlendingCtrlPoint('hor_density', row, col, amount).then((res) => { set?.DelBlendingCtrlPoint('hor_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return if (res == null || typeof (res) == "undefined") return
let tmp = JSON.parse(res?.config); let tmp = JSON.parse(res?.config);
let fortmp = null; let fortmp = null;
@ -830,6 +836,11 @@ export default defineComponent({
let tmp = now_v_h.value == "vertical" ? "v" : "h" let tmp = now_v_h.value == "vertical" ? "v" : "h"
add_control_points(Number(now_amount.value), tmp); add_control_points(Number(now_amount.value), tmp);
} }
defineExpose({
now_v_h,
options_model_v,
options_model_h
});
return { return {
resetall, resetall,
div, div,
@ -860,7 +871,8 @@ export default defineComponent({
add, add,
del_dialog, del_dialog,
add_dialog, add_dialog,
now_amount now_amount,
set_cache
} }
} }
}) })

View File

@ -61,7 +61,8 @@ import {
computed, computed,
watch, watch,
nextTick, nextTick,
onBeforeUnmount onBeforeUnmount,
defineExpose
} from "vue"; } from "vue";
import { useStore } from "src/store"; import { useStore } from "src/store";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
@ -353,6 +354,9 @@ export default defineComponent({
} }
} }
defineExpose({
options_model,
});
return { return {
resetall, resetall,
div, div,

View File

@ -80,7 +80,7 @@
<div class="col-4 q-pt-sm"> <div class="col-4 q-pt-sm">
<q-item> <q-item>
<q-item-section avatar class="head_1"> <q-item-section avatar class="head_1">
{{ $t("center line color") }} {{ $t("center circle color") }}
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
<q-input v-model="color[2]" :rules="['anyColor']"> <q-input v-model="color[2]" :rules="['anyColor']">

View File

@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<div> <div>
<div class="row"> <div class="row" v-show="false">
<div class="col-1"></div> <div class="col-1"></div>
<div class="col-2 q-px-md"> <div class="col-2 q-px-md">
<div class="col-2"> <q-select class="q-pt-md" :label="$t('point amount')" <div class="col-2"> <q-select class="q-pt-md" :label="$t('point amount')"
@ -33,7 +33,7 @@
</div> </div>
<div class="col-2"> <div class="col-2">
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" text-color="black" <div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" :disable="value_point_amount<=9" text-color="black"
:label="$t('reduce control points')" /></div> :label="$t('reduce control points')" /></div>
</div> </div>
@ -97,7 +97,8 @@ import {
computed, computed,
watch, watch,
nextTick, nextTick,
onBeforeUnmount onBeforeUnmount,
defineExpose
} from "vue"; } from "vue";
import { useStore } from "src/store"; import { useStore } from "src/store";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
@ -158,6 +159,7 @@ export default defineComponent({
}; };
const use_server_config = () => { const use_server_config = () => {
value_point_amount.value=9
let a = 9 let a = 9
value.value = [] value.value = []
value_point.value = [] value_point.value = []
@ -241,6 +243,7 @@ export default defineComponent({
watch(() => value_point_amount, (newval, oldval) => { watch(() => value_point_amount, (newval, oldval) => {
set?.SetBlendingOption("blending_grids_control_point_count", `${newval.value}`) set?.SetBlendingOption("blending_grids_control_point_count", `${newval.value}`)
save_set_cache()
}, { deep: true }) }, { deep: true })
/** /**
@ -423,6 +426,7 @@ export default defineComponent({
} }
ste_status.value = 1; ste_status.value = 1;
tmpconfig = JSON.parse(JSON.stringify(fortmp)); tmpconfig = JSON.parse(JSON.stringify(fortmp));
config = JSON.parse(JSON.stringify(fortmp));
options_value_point_amount.value = [] options_value_point_amount.value = []
for (let key in tmpconfig.multi_curved_surface) { for (let key in tmpconfig.multi_curved_surface) {
options_value_point_amount.value.push(key) options_value_point_amount.value.push(key)
@ -449,6 +453,7 @@ export default defineComponent({
}); });
} }
const del_control_points = (amount: number) => { const del_control_points = (amount: number) => {
let tmp=amount
if (amount <= 9) return if (amount <= 9) return
let cardinality = Math.sqrt(amount) let cardinality = Math.sqrt(amount)
amount = (cardinality + -1) ** 2 amount = (cardinality + -1) ** 2
@ -456,7 +461,7 @@ export default defineComponent({
let row = $store.getters.GetTheCurrentlySelectedCamera[0] let row = $store.getters.GetTheCurrentlySelectedCamera[0]
let col = $store.getters.GetTheCurrentlySelectedCamera[1] let col = $store.getters.GetTheCurrentlySelectedCamera[1]
set?.DelBlendingCtrlPoint('9', row, col, amount).then((res) => { set?.DelBlendingCtrlPoint('9', row, col, Number(tmp)).then((res) => {
if (res == null || typeof (res) == "undefined") return if (res == null || typeof (res) == "undefined") return
let tmp = JSON.parse(res?.config); let tmp = JSON.parse(res?.config);
let fortmp = null; let fortmp = null;
@ -471,12 +476,13 @@ export default defineComponent({
} }
ste_status.value = 1; ste_status.value = 1;
tmpconfig = JSON.parse(JSON.stringify(fortmp)); tmpconfig = JSON.parse(JSON.stringify(fortmp));
config = JSON.parse(JSON.stringify(fortmp));
options_value_point_amount.value = [] options_value_point_amount.value = []
for (let key in tmpconfig.multi_curved_surface) { for (let key in tmpconfig.multi_curved_surface) {
options_value_point_amount.value.push(key) options_value_point_amount.value.push(key)
} }
value_point_amount.value = amount value_point_amount.value = 9
config = tmpconfig amount=9
$store.commit("setfusion_configuration", res?.config); $store.commit("setfusion_configuration", res?.config);
value.value = [] value.value = []
value_point.value = [] value_point.value = []
@ -494,8 +500,12 @@ export default defineComponent({
} }
value_point.value.push(tmp_point) value_point.value.push(tmp_point)
} }
}); });
} }
defineExpose({
options_model,
});
return { return {
resetall, resetall,
div, div,

View File

@ -70,7 +70,7 @@
]" /> ]" />
</div> </div>
<div style="min-height: 72vh"> <div style="min-height: 72vh">
<component :is="options" /> <component ref="child" :is="options" />
</div> </div>
</div> </div>
</div> </div>
@ -233,6 +233,7 @@ export default defineComponent({
const send_disable_blending_params = () => { const send_disable_blending_params = () => {
set?.SetBlendingOption(disable_blending_params_id.value, disable_blending_params.value ? "1" : "0"); set?.SetBlendingOption(disable_blending_params_id.value, disable_blending_params.value ? "1" : "0");
}; };
const child :any = ref(null);
const send_show_blending_grids = () => { const send_show_blending_grids = () => {
let tmp = "" let tmp = ""
switch (optionsstr.value) { switch (optionsstr.value) {
@ -246,7 +247,12 @@ export default defineComponent({
tmp = '9' tmp = '9'
break; break;
case 'DensityCorrection': case 'DensityCorrection':
tmp = 'density' if(child.value!.now_v_h=='vertical'){
tmp = 'ver_density'
}else{
tmp = 'hor_density'
}
break; break;
default: default:
break; break;
@ -254,6 +260,29 @@ export default defineComponent({
set?.SetBlendingOption("blending_grids_select_ui", tmp) set?.SetBlendingOption("blending_grids_select_ui", tmp)
set?.SetBlendingOption('blending_grids_select_projector', now_selsect_projector.value); set?.SetBlendingOption('blending_grids_select_projector', now_selsect_projector.value);
set?.SetBlendingOption(show_blending_grids_id.value, show_blending_grids.value ? "1" : "0"); set?.SetBlendingOption(show_blending_grids_id.value, show_blending_grids.value ? "1" : "0");
switch (optionsstr.value) {
case 'FusionLocale':
break;
case 'FourPointCalibration':
set?.SetBlendingOption("blending_grids_select_point", `4:${child.value!.options_model+1}`)
break;
case 'SurfaceCorrection':
set?.SetBlendingOption("blending_grids_select_point", `9:${child.value!.options_model+1}`)
break;
case 'DensityCorrection':
console.log(child.value!.now_v_h)
if(child.value!.now_v_h=='vertical'){
set?.SetBlendingOption("blending_grids_select_point", `${child.value!.options_model_v+1}`)
}else{
set?.SetBlendingOption("blending_grids_select_point", `${child.value!.options_model_h+1}`)
}
break;
default:
break;
}
}; };
const resetall = () => { const resetall = () => {
set?.ResetBlendingConfig().then((res) => { set?.ResetBlendingConfig().then((res) => {
@ -490,7 +519,8 @@ export default defineComponent({
record_times, record_times,
saveconfig, saveconfig,
isdebug, isdebug,
del_dialog del_dialog,
child
}; };
}, },
}); });

View File

@ -458,7 +458,7 @@ export default {
"vertical point ":"vertical point amount", "vertical point ":"vertical point amount",
"point amount":"point amount", "point amount":"point amount",
"add control points":"add control points", "add control points":"add control points",
"reduce control points":"reduce control points", "reduce control points":"delete control points",
"OK to delete you will lose the data you adjusted now":"OK to delete you will lose the data you adjusted now", "OK to delete you will lose the data you adjusted now":"OK to delete you will lose the data you adjusted now",
"Please enter the points you need to add":"Please enter the points you need to add", "Please enter the points you need to add":"Please enter the points you need to add",
"Whether to add control points":"Whether to add control points" "Whether to add control points":"Whether to add control points"

View File

@ -727,7 +727,7 @@ export default {
"vertical point":"垂直点数量", "vertical point":"垂直点数量",
"point amount":"点数量", "point amount":"点数量",
"add control points":"增加", "add control points":"增加",
"reduce control points":"减少", "reduce control points":"删除",
"OK to delete you will lose the data you adjusted now":"确定删除你将失去现在调整的数据", "OK to delete you will lose the data you adjusted now":"确定删除你将失去现在调整的数据",
"Please enter the points you need to add":"请输入你所需要添加的点数", "Please enter the points you need to add":"请输入你所需要添加的点数",
"Whether to add control points":"是否添加控制点" "Whether to add control points":"是否添加控制点"