special_video 改为自由设置宫格行列,增加窗口大小调整对话框

This commit is contained in:
fangxiang 2022-10-14 14:51:56 +08:00
parent a41fd4dec0
commit 0ebd503dda
6 changed files with 87 additions and 53 deletions

View File

@ -44,9 +44,23 @@
<q-item>
<q-item-section>
<q-select
:label="$t('layout')"
:options="select_options"
v-model="layout"
:label="$t('wall row')"
:options="[1, 2, 3, 4, 5, 6, 7, 8, 9]"
v-model="wall_row"
:error="has_error"
:error-message="error_message"
>
</q-select>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-select
:label="$t('wall col')"
:options="[1, 2, 3, 4, 5, 6, 7, 8, 9]"
v-model="wall_col"
:error="has_error"
:error-message="error_message"
>
</q-select>
</q-item-section>
@ -109,31 +123,10 @@ export default defineComponent({
let show_dialog = ref(false);
let loading = ref(false);
let layout = ref("1X3");
const row_values: number[] = [];
const col_values: number[] = [];
const select_options: string[] = [];
//
{
const target_row_col_values = [3, 4, 5, 6];
for (let i = 0; i < target_row_col_values.length; ++i) {
row_values.push(1);
col_values.push(target_row_col_values[i]);
select_options.push(row_values[i] + "X" + col_values[i]);
}
for (let i = 0; i < target_row_col_values.length; ++i) {
row_values.push(target_row_col_values[i]);
col_values.push(1);
select_options.push(
row_values[target_row_col_values.length + i] +
"X" +
col_values[target_row_col_values.length + i]
);
}
}
const wall_row = ref(1);
const wall_col = ref(4);
const has_error = ref(false);
const error_message = ref("");
const rotation_options = ref(["0", "90", "180", "270"]);
const rotation = ref("0");
@ -142,37 +135,79 @@ export default defineComponent({
GlobalData.getInstance()?.applicationConfig
?.special_video_layout_rotation ?? "0";
const check_wall_col_row = (
col: number,
row: number,
show_tooltip: boolean = true
) => {
if (col * row > 9) {
if (show_tooltip) {
const message =
$t.t("row multiply column should be less than or equal to ") +
9 +
"!";
$q.notify({
type: "warning",
message: message,
position: "top",
timeout: 2000,
});
has_error.value = true;
error_message.value = message;
}
return false;
}
return true;
};
watch(
() => wall_row.value,
(nv, ov) => {
if (check_wall_col_row(wall_col.value, nv, false)) {
if (has_error.value) {
has_error.value = false;
}
}
}
);
watch(
() => wall_col.value,
(nv, ov) => {
if (check_wall_col_row(nv, wall_row.value, false)) {
if (has_error.value) {
has_error.value = false;
}
}
}
);
return {
show_dialog,
loading,
layout,
select_options,
wall_row,
wall_col,
rotation_options,
rotation,
has_error,
error_message,
showDialog() {
show_dialog.value = true;
let col = parseInt(
wall_col.value = parseInt(
(GlobalData.getInstance().applicationConfig?.wall_col ?? 1).toString()
);
if (isNaN(col)) {
col = 1;
if (isNaN(wall_col.value)) {
wall_col.value = 1;
}
let row = parseInt(
wall_row.value = parseInt(
(GlobalData.getInstance().applicationConfig?.wall_row ?? 4).toString()
);
if (isNaN(row)) {
row = 4;
}
layout.value = row + "X" + col;
const v = select_options.find(
(element) => element && element == layout.value
);
if (!v) {
layout.value = "1X4";
if (isNaN(wall_row.value)) {
wall_row.value = 4;
}
rotation.value =
@ -186,12 +221,10 @@ export default defineComponent({
async onSubmit() {
loading.value = true;
try {
const index = select_options.findIndex((e) => e && e == layout.value);
if (index != -1) {
// console.log(row_values[index] + "X" + col_values[index]);
if (check_wall_col_row(wall_col.value, wall_row.value)) {
GlobalData.getInstance()
.getCurrentClient()
?.setWallRowCol(row_values[index], col_values[index]);
?.setWallRowCol(wall_row.value, wall_col.value);
switch (rotation.value) {
case "0":
case "90":
@ -207,9 +240,9 @@ export default defineComponent({
?.setSpecialVideoLayoutRotation("0");
break;
}
}
show_dialog.value = false;
show_dialog.value = false;
}
} catch {}
loading.value = false;
},

View File

@ -46,7 +46,6 @@
<q-item
clickable
v-close-popup
v-if="!$store.state.isSpecialVideo()"
:disable="$props.disable"
@click="$emit('edit_rect', $props.window.window_id)"
>

View File

@ -373,4 +373,6 @@ export default {
system: "System",
"clean browser cache command send success":
"Clean Browser Cache Command Send Success",
"row multiply column should be less than or equal to ":
"Row Multiply Column Should Be Less Than Or Equal To ",
};

View File

@ -645,4 +645,6 @@ export default {
"clean browser cache": "清空浏览器缓存",
system: "系统",
"clean browser cache command send success": "清除浏览器缓存指令发送成功",
"row multiply column should be less than or equal to ":
"行乘以列的值不能大于",
};

View File

@ -141,7 +141,6 @@
icon="img:pad/toolbar/edit_window_rect.png"
:label="$t('toolbar edit window rect')"
class="col-auto"
v-if="!$store.state.isSpecialVideo()"
@click="editRect"
/>

View File

@ -183,7 +183,6 @@
stretch
no-caps
flat
v-if="!$store.state.isSpecialVideo()"
stack
:disable="plan_running || !$store.state.power_state"
:icon="/*vertical_align_bottom*/ 'img:new_icon/edit_window_rect.png'"