2021-08-10 11:22:39 +08:00
|
|
|
<template>
|
2022-01-25 19:41:28 +08:00
|
|
|
<q-dialog
|
|
|
|
persistent
|
|
|
|
v-model="show_dialog"
|
|
|
|
@before-hide="resetData"
|
|
|
|
@keydown="
|
|
|
|
(evt) => {
|
2022-03-19 16:29:53 +08:00
|
|
|
if (!loading && evt.keyCode == 27) {
|
2022-01-25 19:41:28 +08:00
|
|
|
show_dialog = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>
|
2021-08-11 10:25:35 +08:00
|
|
|
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
|
2022-07-11 17:38:44 +08:00
|
|
|
<q-form ref="signal_source_form" @submit="onSubmit">
|
2021-08-11 10:25:35 +08:00
|
|
|
<q-card-section class="q-ma-none q-pa-sm">
|
|
|
|
<div class="row">
|
2021-08-17 17:17:51 +08:00
|
|
|
<div class="col-auto text-h6">
|
2021-08-11 10:25:35 +08:00
|
|
|
{{
|
|
|
|
type == 1
|
|
|
|
? $t("add signal source")
|
|
|
|
: type == 2
|
|
|
|
? $t("edit signal source")
|
2021-08-25 17:30:02 +08:00
|
|
|
: $t("add signal source")
|
2021-08-11 10:25:35 +08:00
|
|
|
}}
|
|
|
|
</div>
|
2021-08-17 17:17:51 +08:00
|
|
|
<q-space />
|
|
|
|
<div>
|
2021-08-11 10:25:35 +08:00
|
|
|
<q-btn
|
|
|
|
:loading="loading"
|
|
|
|
flat
|
|
|
|
round
|
|
|
|
icon="close"
|
|
|
|
color="red"
|
|
|
|
v-close-popup
|
|
|
|
>
|
|
|
|
<q-tooltip>
|
|
|
|
{{ $t("close") }}
|
|
|
|
</q-tooltip>
|
|
|
|
</q-btn>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</q-card-section>
|
|
|
|
|
|
|
|
<q-separator />
|
|
|
|
|
|
|
|
<q-card-section style="max-height: 50vh; width: 45vw" class="scroll">
|
|
|
|
<q-list>
|
2022-07-12 19:06:03 +08:00
|
|
|
<q-item v-if="/*type != 2*/ true">
|
2021-08-11 10:25:35 +08:00
|
|
|
<q-item-label>{{ $t("parent group") }}:</q-item-label>
|
|
|
|
</q-item>
|
2022-07-12 19:06:03 +08:00
|
|
|
<q-item v-if="/*type != 2*/ true" class="q-pa-none q-ma-none">
|
2021-08-11 10:25:35 +08:00
|
|
|
<q-item-section style="padding-right: 10px">
|
|
|
|
<q-tree
|
|
|
|
ref="tree"
|
|
|
|
class="scroll"
|
|
|
|
:class="loading ? 'disable_tree' : ''"
|
|
|
|
v-model:selected="selected"
|
|
|
|
:nodes="tree_nodes"
|
|
|
|
default-expand-all
|
|
|
|
node-key="uuid"
|
|
|
|
labelKey="name"
|
|
|
|
filter="group filter"
|
|
|
|
:filter-method="treeNodesFilter"
|
|
|
|
>
|
|
|
|
<template v-slot:default-header="prop">
|
|
|
|
<q-item
|
|
|
|
class="full-width"
|
|
|
|
:class="
|
|
|
|
prop.tree.selected == prop.key ? 'item-selected-bg' : ''
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<q-item-section avatar>
|
|
|
|
<q-icon
|
|
|
|
:name="'img:source_icon/group.png'"
|
|
|
|
color="orange"
|
|
|
|
size="28px"
|
|
|
|
class="q-mr-sm"
|
|
|
|
/>
|
|
|
|
</q-item-section>
|
|
|
|
<q-item-section>
|
|
|
|
<div class="text-weight-bold text-primary">
|
|
|
|
{{ prop.node.name }}
|
|
|
|
</div>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</template>
|
|
|
|
</q-tree>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
<q-item>
|
|
|
|
<q-item-section>
|
|
|
|
<q-input
|
|
|
|
:loading="loading"
|
|
|
|
:disable="loading"
|
|
|
|
filled
|
|
|
|
autofocus
|
|
|
|
v-model="item_data.name"
|
|
|
|
:label="$t('signal source name')"
|
|
|
|
:hint="$t('please input signal source name')"
|
|
|
|
lazy-rules
|
|
|
|
:rules="[
|
|
|
|
(val) =>
|
|
|
|
(val && val.length > 0) || $t('Please type something'),
|
|
|
|
]"
|
|
|
|
@keydown="
|
|
|
|
(evt) => {
|
|
|
|
if (evt.keyCode == 13) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template v-if="item_data.name" v-slot:append>
|
|
|
|
<q-icon
|
2021-08-20 16:46:41 +08:00
|
|
|
name="cancel"
|
2021-08-11 10:25:35 +08:00
|
|
|
@click.stop="item_data.name = null"
|
|
|
|
class="cursor-pointer"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</q-input>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
<q-item>
|
|
|
|
<q-item-section>
|
|
|
|
<q-select
|
|
|
|
:loading="loading"
|
|
|
|
:disable="loading"
|
|
|
|
filled
|
|
|
|
option-value="value"
|
|
|
|
option-label="label"
|
|
|
|
emit-value
|
|
|
|
map-options
|
|
|
|
v-model="item_data.window_type"
|
|
|
|
:options="signal_source_options"
|
|
|
|
:label="$t('signal source type')"
|
|
|
|
:hint="$t('please select signal source type')"
|
|
|
|
@update:model-value="onSelected"
|
|
|
|
@keydown="
|
|
|
|
(evt) => {
|
|
|
|
if (evt.keyCode == 13) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>
|
|
|
|
</q-select>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
<q-item>
|
|
|
|
<q-item-section>
|
|
|
|
<q-input
|
|
|
|
:loading="loading"
|
|
|
|
:disable="loading"
|
|
|
|
filled
|
2022-01-18 16:09:15 +08:00
|
|
|
@dblclick="
|
|
|
|
media_url_label.startsWith($t('file path')) &&
|
|
|
|
item_data.window_type == 'EwindowType::Image'
|
2022-06-20 15:45:31 +08:00
|
|
|
? doSelectImageFile()
|
2022-01-24 16:06:16 +08:00
|
|
|
: item_data.window_type == 'EwindowType::Clock'
|
|
|
|
? showClockDialog()
|
2022-05-25 16:52:05 +08:00
|
|
|
: item_data.window_type == 'EwindowType::Weather'
|
|
|
|
? showWeatherDialog()
|
2022-05-31 16:56:38 +08:00
|
|
|
: item_data.window_type == 'EwindowType::Timer'
|
|
|
|
? showTimerDialog()
|
2022-06-20 15:45:31 +08:00
|
|
|
: showVideoPlayListDialog()
|
2022-01-18 16:09:15 +08:00
|
|
|
"
|
2021-08-11 10:25:35 +08:00
|
|
|
v-model="item_data.media_url"
|
2022-05-19 11:35:58 +08:00
|
|
|
:readonly="
|
|
|
|
media_url_label.startsWith($t('file path')) ||
|
2022-05-25 16:52:05 +08:00
|
|
|
media_url_label.startsWith($t('clock')) ||
|
2022-05-31 16:56:38 +08:00
|
|
|
media_url_label.startsWith($t('weather')) ||
|
|
|
|
media_url_label.startsWith($t('timer'))
|
2022-05-19 11:35:58 +08:00
|
|
|
"
|
2021-08-11 10:25:35 +08:00
|
|
|
:label="media_url_label"
|
2021-08-20 16:46:41 +08:00
|
|
|
:hint="
|
2022-01-18 14:20:04 +08:00
|
|
|
media_url_label.startsWith($t('file path'))
|
|
|
|
? $t('dbclick select file')
|
2022-05-19 11:35:58 +08:00
|
|
|
: media_url_label.startsWith($t('clock'))
|
2022-07-11 17:38:44 +08:00
|
|
|
? $t('dbclick config ') + $t('clock')
|
2022-05-25 16:52:05 +08:00
|
|
|
: media_url_label.startsWith($t('weather'))
|
2022-07-11 17:38:44 +08:00
|
|
|
? $t('dbclick config ') + $t('weather')
|
2022-05-31 16:56:38 +08:00
|
|
|
: media_url_label.startsWith($t('timer'))
|
2022-07-11 17:38:44 +08:00
|
|
|
? $t('dbclick config ') + $t('timer')
|
|
|
|
: $t('please input ') +
|
2022-01-18 14:20:04 +08:00
|
|
|
media_url_label.substr(0, media_url_label.length - 1)
|
2021-08-20 16:46:41 +08:00
|
|
|
"
|
2021-08-11 10:25:35 +08:00
|
|
|
lazy-rules
|
|
|
|
:rules="[
|
|
|
|
(val) =>
|
2021-08-20 16:46:41 +08:00
|
|
|
(val && val.length > 0) ||
|
|
|
|
$t('Please type something') +
|
|
|
|
',' +
|
2022-07-11 17:38:44 +08:00
|
|
|
(media_url_label.startsWith($t('file path'))
|
|
|
|
? $t('dbclick select file')
|
|
|
|
: media_url_label.startsWith($t('clock'))
|
|
|
|
? $t('dbclick config ') + $t('clock')
|
|
|
|
: media_url_label.startsWith($t('weather'))
|
|
|
|
? $t('dbclick config ') + $t('weather')
|
|
|
|
: media_url_label.startsWith($t('timer'))
|
|
|
|
? $t('dbclick config ') + $t('timer')
|
|
|
|
: $t('please input ') +
|
|
|
|
media_url_label.substr(
|
|
|
|
0,
|
|
|
|
media_url_label.length - 1
|
|
|
|
)),
|
2021-08-11 10:25:35 +08:00
|
|
|
]"
|
|
|
|
@keydown="
|
|
|
|
(evt) => {
|
|
|
|
if (evt.keyCode == 13) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template v-if="item_data.media_url" v-slot:append>
|
|
|
|
<q-icon
|
2021-08-20 16:46:41 +08:00
|
|
|
name="cancel"
|
2021-08-11 10:25:35 +08:00
|
|
|
@click.stop="item_data.media_url = null"
|
|
|
|
class="cursor-pointer"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</q-input>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
<q-item
|
|
|
|
v-if="item_data && item_data.window_type == 'EwindowType::Rtsp'"
|
|
|
|
>
|
|
|
|
<q-item-section>
|
|
|
|
<q-input
|
|
|
|
:loading="loading"
|
|
|
|
:disable="loading"
|
|
|
|
filled
|
|
|
|
v-model="item_data.user_name"
|
|
|
|
:label="$t('user name')"
|
|
|
|
:hint="$t('please input user name')"
|
|
|
|
lazy-rules
|
|
|
|
@keydown="
|
|
|
|
(evt) => {
|
|
|
|
if (evt.keyCode == 13) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template v-if="item_data.user_name" v-slot:append>
|
|
|
|
<q-icon
|
2021-08-20 16:46:41 +08:00
|
|
|
name="cancel"
|
2021-08-11 10:25:35 +08:00
|
|
|
@click.stop="item_data.user_name = null"
|
|
|
|
class="cursor-pointer"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</q-input>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
<q-item
|
|
|
|
v-if="item_data && item_data.window_type == 'EwindowType::Rtsp'"
|
|
|
|
>
|
|
|
|
<q-item-section>
|
|
|
|
<q-input
|
|
|
|
:loading="loading"
|
|
|
|
:disable="loading"
|
|
|
|
filled
|
|
|
|
v-model="item_data.password"
|
|
|
|
:label="$t('password')"
|
|
|
|
:hint="$t('please input password')"
|
|
|
|
lazy-rules
|
|
|
|
@keydown="
|
|
|
|
(evt) => {
|
|
|
|
if (evt.keyCode == 13) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template v-if="item_data.password" v-slot:append>
|
|
|
|
<q-icon
|
2021-08-20 16:46:41 +08:00
|
|
|
name="cancel"
|
2021-08-11 10:25:35 +08:00
|
|
|
@click.stop="item_data.password = null"
|
|
|
|
class="cursor-pointer"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</q-input>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</q-list>
|
|
|
|
</q-card-section>
|
|
|
|
|
|
|
|
<q-separator />
|
|
|
|
|
|
|
|
<q-card-actions align="right">
|
|
|
|
<q-btn
|
|
|
|
:loading="loading"
|
|
|
|
flat
|
|
|
|
:label="$t('Cancel')"
|
2022-07-04 14:20:00 +08:00
|
|
|
no-caps
|
2021-08-11 10:25:35 +08:00
|
|
|
color="primary"
|
|
|
|
v-close-popup
|
|
|
|
/>
|
|
|
|
<q-btn
|
|
|
|
ref="accept"
|
|
|
|
flat
|
|
|
|
:label="$t('Accept')"
|
|
|
|
:loading="loading"
|
2022-07-04 14:20:00 +08:00
|
|
|
no-caps
|
2021-08-11 10:25:35 +08:00
|
|
|
color="primary"
|
|
|
|
type="submit"
|
|
|
|
/>
|
|
|
|
</q-card-actions>
|
|
|
|
</q-form>
|
|
|
|
</q-card>
|
2022-01-18 14:20:04 +08:00
|
|
|
<playlist-dialog ref="playlist_dialog" />
|
2022-01-18 16:09:15 +08:00
|
|
|
<file-manage-dialog ref="file_manage_dialog" />
|
2022-01-24 16:06:16 +08:00
|
|
|
<clock-signal-source-dialog ref="clock_dialog" />
|
2022-05-25 16:52:05 +08:00
|
|
|
<weather-signal-source-dialog ref="weather_dialog" />
|
2022-05-31 16:56:38 +08:00
|
|
|
<timer-signal-source-dialog ref="timer_dialog" />
|
2021-08-11 10:25:35 +08:00
|
|
|
</q-dialog>
|
2021-08-10 11:22:39 +08:00
|
|
|
</template>
|
|
|
|
|
2021-08-11 10:25:35 +08:00
|
|
|
<style scoped>
|
|
|
|
.disable_tree {
|
|
|
|
background: #9e9e9e;
|
|
|
|
cursor: wait;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2021-08-10 11:22:39 +08:00
|
|
|
<script lang="ts">
|
2021-08-11 10:25:35 +08:00
|
|
|
import {
|
|
|
|
defineComponent,
|
|
|
|
ref,
|
|
|
|
watch,
|
|
|
|
reactive,
|
|
|
|
onUnmounted,
|
|
|
|
computed,
|
2022-01-18 08:52:51 +08:00
|
|
|
nextTick,
|
2022-07-25 14:52:22 +08:00
|
|
|
Ref,
|
2021-08-11 10:25:35 +08:00
|
|
|
} from "vue";
|
|
|
|
import { useStore } from "src/store";
|
|
|
|
import GlobalData from "src/common/GlobalData";
|
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
import { useI18n } from "vue-i18n";
|
2022-01-18 14:20:04 +08:00
|
|
|
import { SignalSourceEntity } from "src/entities/SignalSourceEntity";
|
2022-01-18 16:09:15 +08:00
|
|
|
import FileManageDialog from "src/components/FileManageDialog.vue";
|
2022-01-18 14:20:04 +08:00
|
|
|
import PlaylistDialog from "src/components/PlaylistDialog.vue";
|
2022-01-24 16:06:16 +08:00
|
|
|
import ClockSignalSourceDialog from "src/components/ClockSignalSourceDialog.vue";
|
2022-05-25 16:52:05 +08:00
|
|
|
import WeatherSignalSourceDialog from "src/components/WeatherSignalSourceDialog.vue";
|
2022-05-31 16:56:38 +08:00
|
|
|
import TimerSignalSourceDialog from "src/components/TimerSignalSourceDialog.vue";
|
2022-05-25 16:52:05 +08:00
|
|
|
|
2022-01-18 16:09:15 +08:00
|
|
|
import FileEntity from "src/entities/FileEntity";
|
2022-06-20 15:45:31 +08:00
|
|
|
import FileSuffixHelper from "src/common/FileSuffixHelper";
|
2022-07-06 14:44:11 +08:00
|
|
|
import { Protocol } from "src/entities/WSProtocol";
|
2021-08-20 16:46:41 +08:00
|
|
|
|
2021-08-10 11:22:39 +08:00
|
|
|
export default defineComponent({
|
|
|
|
name: "ComponentSignalSourceDialog",
|
2022-05-25 16:52:05 +08:00
|
|
|
components: {
|
|
|
|
FileManageDialog,
|
|
|
|
PlaylistDialog,
|
|
|
|
ClockSignalSourceDialog,
|
|
|
|
WeatherSignalSourceDialog,
|
2022-05-31 16:56:38 +08:00
|
|
|
TimerSignalSourceDialog,
|
2022-05-25 16:52:05 +08:00
|
|
|
},
|
2021-08-10 11:22:39 +08:00
|
|
|
|
|
|
|
setup() {
|
2021-08-11 10:25:35 +08:00
|
|
|
let $store = useStore();
|
|
|
|
let $q = useQuasar();
|
|
|
|
let $t = useI18n();
|
|
|
|
|
|
|
|
let show_dialog = ref(false);
|
|
|
|
let type = ref(1);
|
|
|
|
let media_url_label = ref("URL");
|
|
|
|
let item_data: SignalSourceEntity = reactive(new SignalSourceEntity());
|
|
|
|
item_data.window_type = "EwindowType::Multimedia";
|
|
|
|
const selected: any = ref(null);
|
|
|
|
let loading = ref(false);
|
2022-01-18 14:20:04 +08:00
|
|
|
let playlist_dialog: any = ref(null);
|
2022-01-24 16:06:16 +08:00
|
|
|
let clock_dialog: any = ref(null);
|
2022-05-25 16:52:05 +08:00
|
|
|
let weather_dialog: any = ref(null);
|
2022-05-31 16:56:38 +08:00
|
|
|
let timer_dialog: any = ref(null);
|
2022-01-18 16:09:15 +08:00
|
|
|
let file_manage_dialog: any = ref(null);
|
2022-07-11 17:38:44 +08:00
|
|
|
const signal_source_form: any = ref(null);
|
2021-08-11 10:25:35 +08:00
|
|
|
|
|
|
|
let suppored_window_types = new Set<string>([
|
|
|
|
"EwindowType::Multimedia",
|
|
|
|
"EwindowType::Web",
|
|
|
|
"EwindowType::Image",
|
|
|
|
"EwindowType::Rtsp",
|
2022-01-24 16:06:16 +08:00
|
|
|
"EwindowType::Clock",
|
2022-05-25 16:52:05 +08:00
|
|
|
"EwindowType::Weather",
|
2022-05-31 16:56:38 +08:00
|
|
|
"EwindowType::Timer",
|
2021-08-11 10:25:35 +08:00
|
|
|
]);
|
|
|
|
|
2022-07-25 14:52:22 +08:00
|
|
|
const signal_source_options: Ref<any> = ref([]);
|
|
|
|
|
|
|
|
const build_signal_source_options = [
|
2021-08-11 10:25:35 +08:00
|
|
|
{
|
|
|
|
label: $t.t("multimedia file"),
|
|
|
|
value: "EwindowType::Multimedia",
|
|
|
|
},
|
|
|
|
{
|
2021-08-12 08:28:52 +08:00
|
|
|
label: $t.t("Web"),
|
2021-08-11 10:25:35 +08:00
|
|
|
value: "EwindowType::Web",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: $t.t("image"),
|
|
|
|
value: "EwindowType::Image",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: $t.t("rtsp"),
|
|
|
|
value: "EwindowType::Rtsp",
|
|
|
|
},
|
2022-01-24 16:06:16 +08:00
|
|
|
{
|
|
|
|
label: $t.t("clock"),
|
|
|
|
value: "EwindowType::Clock",
|
|
|
|
},
|
2022-07-06 14:44:11 +08:00
|
|
|
|
2022-05-31 16:56:38 +08:00
|
|
|
{
|
|
|
|
label: $t.t("timer"),
|
|
|
|
value: "EwindowType::Timer",
|
|
|
|
},
|
2021-08-11 10:25:35 +08:00
|
|
|
];
|
|
|
|
|
2022-07-07 14:49:47 +08:00
|
|
|
const refresh_signal_source_options = () => {
|
2022-07-25 14:52:22 +08:00
|
|
|
signal_source_options.value = [];
|
|
|
|
for (const item of build_signal_source_options) {
|
|
|
|
signal_source_options.value.push(item);
|
|
|
|
}
|
2022-07-07 14:49:47 +08:00
|
|
|
if (
|
|
|
|
($store.state.device_attribute & Protocol.EDeviceAttribute.CustomISV) ==
|
|
|
|
0
|
|
|
|
) {
|
2022-07-25 14:52:22 +08:00
|
|
|
signal_source_options.value.push({
|
2022-07-07 14:49:47 +08:00
|
|
|
label: $t.t("weather"),
|
|
|
|
value: "EwindowType::Weather",
|
|
|
|
});
|
|
|
|
} else {
|
2022-07-25 14:52:22 +08:00
|
|
|
const index = signal_source_options.value.findIndex(
|
|
|
|
(element: any) => element && element.value == "EwindowType::Weather"
|
2022-07-07 14:49:47 +08:00
|
|
|
);
|
|
|
|
if (index != -1) {
|
2022-07-25 14:52:22 +08:00
|
|
|
signal_source_options.value.splice(index, 1);
|
2022-07-07 14:49:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
refresh_signal_source_options();
|
|
|
|
|
|
|
|
watch(
|
|
|
|
() => $store.state.device_attribute,
|
|
|
|
(value) => {
|
|
|
|
refresh_signal_source_options();
|
|
|
|
}
|
|
|
|
);
|
2022-07-06 14:44:11 +08:00
|
|
|
|
2021-08-11 10:25:35 +08:00
|
|
|
const tree_nodes = computed({
|
|
|
|
get: () => $store.state.signal_source_tree,
|
|
|
|
set: (val) => {},
|
|
|
|
});
|
|
|
|
|
|
|
|
watch(
|
|
|
|
() => selected.value,
|
|
|
|
(newValue, oldValue) => {
|
|
|
|
if (newValue == null) {
|
|
|
|
selected.value = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
watch(
|
|
|
|
() => item_data.window_type,
|
|
|
|
(newValue, oldValue) => {
|
|
|
|
if (!suppored_window_types.has(newValue)) {
|
|
|
|
item_data.window_type = "EwindowType::Multimedia";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
const setMediaUrlLabel = (value: string) => {
|
|
|
|
switch (value) {
|
|
|
|
case "EwindowType::Web":
|
|
|
|
media_url_label.value = $t.t("http url") + ":";
|
|
|
|
break;
|
|
|
|
case "EwindowType::Rtsp":
|
|
|
|
media_url_label.value = $t.t("RTSP url") + ":";
|
|
|
|
break;
|
2022-05-19 11:35:58 +08:00
|
|
|
case "EwindowType::Clock":
|
|
|
|
media_url_label.value = $t.t("clock setting") + ":";
|
|
|
|
break;
|
2022-05-25 16:52:05 +08:00
|
|
|
case "EwindowType::Weather":
|
|
|
|
media_url_label.value = $t.t("weather setting") + ":";
|
|
|
|
break;
|
2022-05-31 16:56:38 +08:00
|
|
|
case "EwindowType::Timer":
|
|
|
|
media_url_label.value = $t.t("timer setting") + ":";
|
|
|
|
break;
|
2021-08-11 10:25:35 +08:00
|
|
|
default:
|
|
|
|
media_url_label.value = $t.t("file path") + ":";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const requestAddSignalSource = async () => {
|
|
|
|
item_data.group_uuid = selected.value;
|
2022-01-21 10:20:26 +08:00
|
|
|
|
2021-08-11 10:25:35 +08:00
|
|
|
let response = await GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.addSignalSource(item_data);
|
|
|
|
if (response) {
|
|
|
|
$q.notify({
|
|
|
|
color: response.success ? "positive" : "negative",
|
|
|
|
icon: response.success ? "done" : "warning",
|
|
|
|
message:
|
|
|
|
$t.t("add signal source") +
|
|
|
|
(response.success ? $t.t("success") : $t.t("fail")) +
|
|
|
|
"!",
|
|
|
|
position: "top",
|
2021-12-22 11:25:04 +08:00
|
|
|
timeout: 1500,
|
2021-08-11 10:25:35 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const requestEditSignalSource = async () => {
|
|
|
|
item_data.group_uuid = selected.value;
|
|
|
|
|
|
|
|
let response = await GlobalData.getInstance()
|
|
|
|
.getCurrentClient()
|
|
|
|
?.editSignalSource(item_data);
|
|
|
|
if (response) {
|
|
|
|
$q.notify({
|
|
|
|
color: response.success ? "positive" : "negative",
|
|
|
|
icon: response.success ? "done" : "warning",
|
|
|
|
message:
|
|
|
|
$t.t("edit signal source") +
|
|
|
|
(response.success ? $t.t("success") : $t.t("fail")) +
|
|
|
|
"!",
|
|
|
|
position: "top",
|
2021-12-22 11:25:04 +08:00
|
|
|
timeout: 1500,
|
2021-08-11 10:25:35 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-06-21 15:23:40 +08:00
|
|
|
const doSelectFile = async (
|
|
|
|
no_filter = true,
|
|
|
|
video_filter = false,
|
|
|
|
image_filter = false
|
|
|
|
) => {
|
2022-06-20 15:45:31 +08:00
|
|
|
if (!media_url_label.value.startsWith($t.t("file path"))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const obj = await file_manage_dialog.value.showDialogAsync(
|
|
|
|
"select",
|
2022-06-21 15:23:40 +08:00
|
|
|
no_filter,
|
|
|
|
video_filter,
|
|
|
|
image_filter
|
2022-06-20 15:45:31 +08:00
|
|
|
);
|
|
|
|
if (obj) {
|
|
|
|
interface __I {
|
|
|
|
path: string;
|
|
|
|
file: FileEntity;
|
|
|
|
}
|
|
|
|
let { path, file }: __I = obj;
|
|
|
|
if (path && file) {
|
|
|
|
item_data.media_url = path + "/" + file.name;
|
|
|
|
|
|
|
|
if (
|
|
|
|
!item_data.name ||
|
|
|
|
item_data.name.trim() == "" ||
|
|
|
|
item_data.name.trim() == $t.t("new signal source")
|
|
|
|
) {
|
|
|
|
nextTick(() => {
|
|
|
|
item_data.name = file.name;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-06-21 15:23:40 +08:00
|
|
|
const showPlaylistDialog = async (
|
|
|
|
no_filter = true,
|
|
|
|
video_filter = false
|
|
|
|
) => {
|
2022-06-20 15:45:31 +08:00
|
|
|
if (item_data.window_type != "EwindowType::Multimedia") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const result = await playlist_dialog.value.showDialogAsync(
|
|
|
|
item_data.media_url,
|
2022-06-21 15:23:40 +08:00
|
|
|
no_filter,
|
|
|
|
video_filter,
|
|
|
|
false
|
2022-06-20 15:45:31 +08:00
|
|
|
);
|
|
|
|
if (Array.isArray(result)) {
|
|
|
|
if (result.length) {
|
|
|
|
if (
|
|
|
|
!item_data.name ||
|
|
|
|
item_data.name.trim() == "" ||
|
|
|
|
item_data.name.trim() == $t.t("new signal source")
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
const temp_item = decodeURI(result[0].toString());
|
|
|
|
let index = temp_item.lastIndexOf("\\");
|
|
|
|
if (index == -1) {
|
|
|
|
index = temp_item.lastIndexOf("/");
|
|
|
|
}
|
|
|
|
if (index + 1 == temp_item.length) {
|
|
|
|
item_data.name = temp_item.substr(index);
|
|
|
|
} else if (index + 1 < temp_item.length) {
|
|
|
|
item_data.name = temp_item.substr(index + 1);
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
item_data.media_url = decodeURI(JSON.stringify(result));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-08-11 10:25:35 +08:00
|
|
|
return {
|
|
|
|
show_dialog,
|
|
|
|
type,
|
|
|
|
signal_source_options,
|
|
|
|
media_url_label,
|
|
|
|
item_data,
|
|
|
|
selected,
|
|
|
|
loading,
|
|
|
|
tree_nodes,
|
2022-01-18 14:20:04 +08:00
|
|
|
playlist_dialog,
|
2022-01-24 16:06:16 +08:00
|
|
|
clock_dialog,
|
2022-05-25 16:52:05 +08:00
|
|
|
weather_dialog,
|
2022-05-31 16:56:38 +08:00
|
|
|
timer_dialog,
|
2022-01-18 16:09:15 +08:00
|
|
|
file_manage_dialog,
|
2022-07-11 17:38:44 +08:00
|
|
|
signal_source_form,
|
|
|
|
|
2021-08-11 10:25:35 +08:00
|
|
|
showDialog(options: any) {
|
|
|
|
if (options) {
|
|
|
|
type.value = options.type ?? 1;
|
|
|
|
if (options.data && options.data.item_data) {
|
2021-08-12 08:28:52 +08:00
|
|
|
SignalSourceEntity.copy(
|
|
|
|
item_data,
|
|
|
|
JSON.parse(JSON.stringify(options.data.item_data))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (type.value == 2) {
|
|
|
|
selected.value = item_data.group_uuid;
|
|
|
|
} else {
|
|
|
|
selected.value = options.parent_node ?? "";
|
2022-01-18 14:20:04 +08:00
|
|
|
item_data.name = $t.t("new signal source");
|
2021-08-11 10:25:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (item_data) {
|
|
|
|
setMediaUrlLabel(item_data.window_type);
|
|
|
|
}
|
2022-01-18 14:20:04 +08:00
|
|
|
|
2021-08-11 10:25:35 +08:00
|
|
|
show_dialog.value = true;
|
|
|
|
},
|
|
|
|
resetData() {
|
|
|
|
loading.value = false;
|
|
|
|
selected.value = null;
|
2021-08-12 08:28:52 +08:00
|
|
|
SignalSourceEntity.copy(item_data);
|
2021-08-11 10:25:35 +08:00
|
|
|
type.value = 1;
|
|
|
|
},
|
|
|
|
treeNodesFilter(node: any, filter: any) {
|
|
|
|
return node.is_group && !node.item_data?.system_default;
|
|
|
|
},
|
|
|
|
onSelected(value: any) {
|
2022-07-11 17:38:44 +08:00
|
|
|
if (signal_source_form.value) {
|
|
|
|
signal_source_form.value.resetValidation();
|
|
|
|
}
|
2021-08-11 10:25:35 +08:00
|
|
|
setMediaUrlLabel(value as string);
|
|
|
|
},
|
|
|
|
async onSubmit() {
|
|
|
|
loading.value = true;
|
|
|
|
try {
|
|
|
|
await (type.value == 2
|
|
|
|
? requestEditSignalSource()
|
|
|
|
: requestAddSignalSource());
|
|
|
|
show_dialog.value = false;
|
|
|
|
} catch {}
|
|
|
|
loading.value = false;
|
|
|
|
},
|
2022-01-24 16:06:16 +08:00
|
|
|
async showClockDialog() {
|
|
|
|
if (item_data.window_type != "EwindowType::Clock") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const result = await clock_dialog.value.showDialogAsync(
|
|
|
|
item_data.media_url
|
|
|
|
);
|
2022-05-19 11:35:58 +08:00
|
|
|
if (result) {
|
|
|
|
item_data.media_url = decodeURI(result);
|
|
|
|
}
|
2022-01-24 16:06:16 +08:00
|
|
|
},
|
2022-05-25 16:52:05 +08:00
|
|
|
async showWeatherDialog() {
|
|
|
|
if (item_data.window_type != "EwindowType::Weather") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const result = await weather_dialog.value.showDialogAsync(
|
|
|
|
item_data.media_url
|
|
|
|
);
|
|
|
|
if (result) {
|
|
|
|
item_data.media_url = decodeURI(result);
|
|
|
|
}
|
|
|
|
},
|
2022-05-31 16:56:38 +08:00
|
|
|
async showTimerDialog() {
|
|
|
|
if (item_data.window_type != "EwindowType::Timer") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const result = await timer_dialog.value.showDialogAsync(
|
|
|
|
item_data.media_url
|
|
|
|
);
|
|
|
|
if (result) {
|
|
|
|
item_data.media_url = decodeURI(result);
|
|
|
|
}
|
|
|
|
},
|
2022-06-20 15:45:31 +08:00
|
|
|
async showVideoPlayListDialog() {
|
2022-06-21 15:23:40 +08:00
|
|
|
return showPlaylistDialog(false, true);
|
2022-06-20 15:45:31 +08:00
|
|
|
},
|
2022-06-21 15:23:40 +08:00
|
|
|
async showPlaylistDialog(no_filter = true, video_filter = false) {
|
|
|
|
return showPlaylistDialog(no_filter, video_filter);
|
2022-06-20 15:45:31 +08:00
|
|
|
},
|
|
|
|
async doSelectImageFile() {
|
2022-06-21 15:23:40 +08:00
|
|
|
return doSelectFile(false, false, true);
|
2021-08-20 16:46:41 +08:00
|
|
|
},
|
2022-06-21 15:23:40 +08:00
|
|
|
async doSelectFile(
|
|
|
|
no_filter = true,
|
|
|
|
video_filter = false,
|
|
|
|
image_filter = false
|
|
|
|
) {
|
|
|
|
return doSelectFile(no_filter, video_filter, image_filter);
|
2022-01-18 16:09:15 +08:00
|
|
|
},
|
2021-08-11 10:25:35 +08:00
|
|
|
};
|
2021-08-10 11:22:39 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|