系统设置菜单添加定时任务功能

This commit is contained in:
fangxiang 2022-05-07 16:37:45 +08:00
parent 97c74a0bc3
commit d47f61302c
12 changed files with 857 additions and 53 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "media_player_client", "name": "media_player_client",
"version": "1.4.3", "version": "1.4.4",
"description": "A Quasar Framework app", "description": "A Quasar Framework app",
"productName": "MediaPlayerClient", "productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>", "author": "fangxiang <fangxiang@cloudview.work>",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -11,6 +11,7 @@ import EventBus, { EventNamesDefine } from "./EventBus";
import { EdgeBlendingPoint } from "src/entities/EdgeBlendingEntities"; import { EdgeBlendingPoint } from "src/entities/EdgeBlendingEntities";
import { ExternalControlTableEntity } from "src/entities/ExternalControlTableEntity"; import { ExternalControlTableEntity } from "src/entities/ExternalControlTableEntity";
import { SerialPortConfigEntity } from "src/entities/SerialPortConfigEntity"; import { SerialPortConfigEntity } from "src/entities/SerialPortConfigEntity";
import TimingTaskEntity from "src/entities/TimingTaskEntity";
class _RpcInfo { class _RpcInfo {
send_timestamp: number; send_timestamp: number;
@ -1004,6 +1005,45 @@ export default class ClientConnection {
); );
} }
public async getTimingTasks() {
try {
return await this.doRpc<Protocol.GetTimingTasksResponseEntity>(
new Protocol.GetTimingTasksRequestEntity()
);
} catch (e) {
console.error(e);
}
}
public async addTimingTask(task: TimingTaskEntity) {
try {
return await this.doRpc<Protocol.AddTimingTaskResponseEntity>(
new Protocol.AddTimingTaskRequestEntity(task)
);
} catch (e) {
console.error(e);
}
}
public async editTimingTask(task: TimingTaskEntity) {
try {
return await this.doRpc<Protocol.EditTimingTaskResponseEntity>(
new Protocol.EditTimingTaskRequestEntity(task)
);
} catch (e) {
console.error(e);
}
}
public async deleteTimingTask(uuid: string) {
try {
return await this.doRpc<Protocol.DeleteTimingTaskResponseEntity>(
new Protocol.DeleteTimingTaskRequestEntity(uuid)
);
} catch (e) {
console.error(e);
}
}
public destory() { public destory() {
if (this.ws) { if (this.ws) {
this.ws.onclose = null; this.ws.onclose = null;

View File

@ -389,55 +389,7 @@ import { useQuasar, date as $date } from "quasar";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { StringKeyValueEntity } from "src/entities/StringKeyValueEntity"; import { StringKeyValueEntity } from "src/entities/StringKeyValueEntity";
import { PlanEntity } from "src/entities/PlanEntity"; import { PlanEntity } from "src/entities/PlanEntity";
import { EWeekDays } from "src/entities/EWeekDays";
enum EWeekDays {
EWeekNone = 0x00,
EWeekMonday = 0x01,
EWeekTuesday = 0x02,
EWeekWednesday = 0x04,
EWeekThursday = 0x08,
EWeekFriday = 0x10,
EWeekSaturday = 0x20,
EWeekSunday = 0x40,
EWeekAll = EWeekMonday |
EWeekTuesday |
EWeekWednesday |
EWeekThursday |
EWeekFriday |
EWeekSaturday |
EWeekSunday,
}
const _week_days_map = new Map<string, EWeekDays>([
["EWeekDays.EWeekNone", EWeekDays.EWeekNone],
["EWeekDays.EWeekMonday", EWeekDays.EWeekMonday],
["EWeekDays.EWeekTuesday", EWeekDays.EWeekTuesday],
["EWeekDays.EWeekWednesday", EWeekDays.EWeekWednesday],
["EWeekDays.EWeekThursday", EWeekDays.EWeekThursday],
["EWeekDays.EWeekFriday", EWeekDays.EWeekFriday],
["EWeekDays.EWeekSaturday", EWeekDays.EWeekSaturday],
["EWeekDays.EWeekSunday", EWeekDays.EWeekSunday],
["EWeekDays.EWeekAll", EWeekDays.EWeekAll],
]);
const eWeekDaysToStr = (week_days: EWeekDays) => {
let ret = "EWeekDays.EWeekNone";
_week_days_map.forEach((v, k, m) => {
if (v == week_days) {
ret = k;
}
});
return ret;
};
const getEWeekDays = (str: string) => {
try {
return _week_days_map.get(str);
} catch (e) {
return EWeekDays.EWeekNone;
}
};
const __MIN_DELAY = 10; const __MIN_DELAY = 10;

View File

@ -46,19 +46,26 @@
align="justify" align="justify"
narrow-indicator narrow-indicator
class="bg-grey-2 text-teal" class="bg-grey-2 text-teal"
@update:model-value="onTabChanged"
> >
<q-tab <q-tab
name="network" name="network"
:icon="/*language*/ 'img:new_icon/network_setting.png'" icon="img:new_icon/network_setting.png"
:label="$t('network setting')" :label="$t('network setting')"
:disable="loading" :disable="loading"
/> />
<q-tab <q-tab
name="graphics" name="graphics"
:icon="/*picture_in_picture_alt*/ 'img:new_icon/graphics_setting.png'" icon="img:new_icon/graphics_setting.png"
:label="$t('graphics setting')" :label="$t('graphics setting')"
:disable="loading" :disable="loading"
/> />
<q-tab
name="timing_task"
icon="img:new_icon/timing_task.png"
:label="$t('timing task')"
:disable="loading"
/>
<q-tab <q-tab
name="other" name="other"
icon="build" icon="build"
@ -399,6 +406,97 @@
</q-card> </q-card>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="timing_task" class="_panel">
<q-card class="fit">
<q-card-section>
<q-form ref="graphics_form" @submit="applyGraphics">
<q-list>
<div v-for="(item, index) of timing_tasks" :key="index">
<q-item clickable>
<q-item-section avatar>
<q-chip color="teal" text-color="white" icon="alarm">
{{ getTaskTypeName(item.task_type) }}
</q-chip>
</q-item-section>
<q-item-section>
<q-item-label>{{ item.task_name }}</q-item-label>
<q-item-label caption lines="2"
><span class="q-mr-md">{{ item.timing_time }}</span>
<span
class="q-mx-xs"
v-if="
item.timing_week_days & e_week_Days.EWeekMonday
"
>{{ $t("monday") }}</span
>
<span
class="q-mx-xs"
v-if="
item.timing_week_days & e_week_Days.EWeekTuesday
"
>{{ $t("tuesday") }}</span
>
<span
class="q-mx-xs"
v-if="
item.timing_week_days &
e_week_Days.EWeekWednesday
"
>{{ $t("wednesday") }}</span
>
<span
class="q-mx-xs"
v-if="
item.timing_week_days &
e_week_Days.EWeekThursday
"
>{{ $t("thursday") }}</span
>
<span
class="q-mx-xs"
v-if="
item.timing_week_days & e_week_Days.EWeekFriday
"
>{{ $t("friday") }}</span
>
<span
class="q-mx-xs"
v-if="
item.timing_week_days &
e_week_Days.EWeekSaturday
"
>{{ $t("saturday") }}</span
>
<span
class="q-mx-xs"
v-if="
item.timing_week_days & e_week_Days.EWeekSunday
"
>{{ $t("sunday") }}</span
>
</q-item-label>
</q-item-section>
<q-item-section avatar>
<q-btn
@click="deleteTimingTask(item)"
icon="delete"
color="red"
flat
round
>
<q-tooltip>
{{ $t("delete") }}{{ $t("timing task") }}
</q-tooltip>
</q-btn>
</q-item-section>
</q-item>
</div>
</q-list>
</q-form>
</q-card-section>
</q-card>
</q-tab-panel>
<q-tab-panel name="other" class="_panel"> <q-tab-panel name="other" class="_panel">
<q-card class="fit"> <q-card class="fit">
<q-scroll-area style="height: 55vh"> <q-scroll-area style="height: 55vh">
@ -792,28 +890,43 @@
<q-btn <q-btn
:loading="loading" :loading="loading"
flat flat
:label="$t('revert and exit')" no-caps
:label="tab == 'timing_task' ? $t('exit') : $t('revert and exit')"
color="primary" color="primary"
v-close-popup v-close-popup
/> />
<q-btn <q-btn
v-if="tab != 'timing_task'"
:loading="loading" :loading="loading"
flat flat
no-caps
:label="$t('revert')" :label="$t('revert')"
color="primary" color="primary"
@click="refresh_all" @click="refresh_all"
/> />
<q-btn <q-btn
v-if="tab != 'timing_task'"
:loading="loading" :loading="loading"
flat flat
no-caps
:label="$t('apply')" :label="$t('apply')"
color="primary" color="primary"
@click="apply" @click="apply"
/> />
<q-btn
v-else
:loading="loading"
flat
no-caps
:label="$t('add timing task')"
color="primary"
@click="addTimingTask"
/>
<q-btn <q-btn
v-if="false" v-if="false"
:loading="loading" :loading="loading"
flat flat
no-caps
:label="$t('apply and exit')" :label="$t('apply and exit')"
color="primary" color="primary"
@click="applyAndExit" @click="applyAndExit"
@ -821,6 +934,8 @@
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
<timing-task-dialog ref="timing_task_dialog" />
</template> </template>
<style scoped> <style scoped>
@ -854,11 +969,18 @@
import { defineComponent, ref, Ref, watch, computed } from "vue"; import { defineComponent, ref, Ref, watch, computed } from "vue";
import { useStore } from "src/store"; import { useStore } from "src/store";
import { useQuasar, SessionStorage } from "quasar"; import { useQuasar, SessionStorage } from "quasar";
import TimingTaskDialog from "src/components/TimingTaskDialog.vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData"; import GlobalData from "src/common/GlobalData";
import { HttpProtocol } from "src/entities/HttpProtocol"; import { HttpProtocol } from "src/entities/HttpProtocol";
import { date } from "quasar"; import { date } from "quasar";
import { Protocol } from "src/entities/WSProtocol"; import { Protocol } from "src/entities/WSProtocol";
import TimingTaskEntity, {
TimingTaskType,
} from "src/entities/TimingTaskEntity";
import { EWeekDays } from "src/entities/EWeekDays";
const _time_zones = [ const _time_zones = [
"UTC-12(Central Pacific)", "UTC-12(Central Pacific)",
@ -890,6 +1012,7 @@ const _time_zones = [
export default defineComponent({ export default defineComponent({
name: "ComponentSystemSettingDialog", name: "ComponentSystemSettingDialog",
components: { TimingTaskDialog },
setup() { setup() {
let $store = useStore(); let $store = useStore();
@ -899,6 +1022,8 @@ export default defineComponent({
let show_dialog = ref(false); let show_dialog = ref(false);
let loading = ref(false); let loading = ref(false);
const timing_task_dialog: Ref<any> = ref(null);
let tab = ref("network"); let tab = ref("network");
let auto_ip = ref($t.t("enable")); let auto_ip = ref($t.t("enable"));
@ -978,6 +1103,7 @@ export default defineComponent({
let system_muted = ref($t.t("off")); let system_muted = ref($t.t("off"));
let system_volume = ref(100); let system_volume = ref(100);
let output_audio_card_options = ref([ let output_audio_card_options = ref([
{ label: $t.t("all"), value: "all" },
{ label: "3.5mm", value: "3.5mm" }, { label: "3.5mm", value: "3.5mm" },
{ label: "HDMI1", value: "HDMI1" }, { label: "HDMI1", value: "HDMI1" },
]); ]);
@ -1012,6 +1138,8 @@ export default defineComponent({
let output_board_volume = ref(100); let output_board_volume = ref(100);
let output_board_mute = ref($t.t("on")); let output_board_mute = ref($t.t("on"));
const timing_tasks: Ref<TimingTaskEntity[]> = ref([]);
const refresh_network = () => { const refresh_network = () => {
const config = GlobalData.getInstance()?.applicationConfig; const config = GlobalData.getInstance()?.applicationConfig;
if (config) { if (config) {
@ -1357,8 +1485,24 @@ export default defineComponent({
GlobalData.getInstance().getCurrentClient()?.restoreOutputBoard(); GlobalData.getInstance().getCurrentClient()?.restoreOutputBoard();
}; };
const refreshTimingTasks = async () => {
try {
const response = await GlobalData.getInstance()
.getCurrentClient()
?.getTimingTasks();
if (response) {
timing_tasks.value = response.tasks;
}
} catch (e) {
console.error(e);
}
};
return { return {
show_dialog, show_dialog,
e_week_Days: ref(EWeekDays),
timing_task_dialog,
timing_tasks,
function_output_board_attribute, function_output_board_attribute,
loading, loading,
tab, tab,
@ -1426,6 +1570,100 @@ export default defineComponent({
await apply(); await apply();
show_dialog.value = false; show_dialog.value = false;
}, },
getTaskTypeName(index: number) {
let result = $t.t("unknow");
switch (index) {
case TimingTaskType.TaskPowerOn:
result = $t.t("power on");
break;
case TimingTaskType.TaskPowerOff:
result = $t.t("power off");
break;
}
return result;
},
async addTimingTask() {
if (timing_task_dialog.value) {
let success = false;
try {
const result = await timing_task_dialog.value.showDialogAsync();
if (result) {
const request_param = new TimingTaskEntity();
for (const rk of Object.keys(result)) {
if ((<any>request_param)[rk] !== undefined) {
(<any>request_param)[rk] = result[rk];
}
}
const response = await GlobalData.getInstance()
.getCurrentClient()
?.addTimingTask(request_param);
if (response && response.success) {
request_param.uuid = response.uuid;
timing_tasks.value.push(request_param);
success = true;
}
} else {
//
console.error("addTimingTask result is null!");
return;
}
} catch {
//
return;
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",
message:
$t.t("add") +
$t.t("timing task") +
(success ? $t.t("success") : $t.t("fail")) +
"!",
position: "top",
timeout: 2500,
});
}
},
async deleteTimingTask(item: TimingTaskEntity) {
let success = false;
if (item) {
try {
const response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteTimingTask(item.uuid);
if (response && response.success) {
const index = timing_tasks.value.findIndex(
(element) => element && element.uuid == item.uuid
);
if (index != -1) {
timing_tasks.value.splice(index, 1);
}
success = true;
}
} catch (e) {
console.error(e);
}
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",
message:
$t.t("delete") +
$t.t("timing task") +
(success ? $t.t("success") : $t.t("fail")) +
"!",
position: "top",
timeout: 2500,
});
},
onTabChanged(value: string) {
switch (value) {
case "timing_task":
refreshTimingTasks();
break;
}
},
isIpAddress(str: string) { isIpAddress(str: string) {
return ( return (
str == "localhost" || str == "localhost" ||

View File

@ -0,0 +1,375 @@
<template>
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (!loading && evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 50vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">
<div class="row">
<div class="col-auto text-h6">
{{ type == 1 ? $t("add") : type == 2 ? $t("edit") : $t("view")
}}{{ $t("timing task") }}
</div>
<q-space />
<div>
<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: 50vw" class="scroll">
<q-list>
<q-item>
<q-item-section avatar class="width_5_1">{{
$t("name") + ":"
}}</q-item-section>
<q-item-section>
<q-input
autofocus
:loading="loading"
:disable="loading"
filled
v-model="task_name"
:hint="$t('please input task name')"
lazy-rules
:rules="[
(val) =>
(val && val.length > 0) || $t('Please type something'),
]"
clearable
>
</q-input>
</q-item-section>
</q-item>
<q-item>
<q-item-section avatar class="width_5_1"
>{{ $t("task type") }}:</q-item-section
>
<q-item-section>
<q-select
v-model="timing_type"
:loading="loading"
:disable="loading"
:options="timing_type_options"
emit-value
map-options
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section avatar class="width_5_1">{{
$t("time") + ":"
}}</q-item-section>
<q-item-section>
<q-input
filled
v-model="timing_time"
:loading="loading"
mask="fulltime"
:rules="['fulltime']"
>
<template v-slot:append>
<q-icon name="access_time" class="cursor-pointer">
<q-popup-proxy
cover
transition-show="scale"
transition-hide="scale"
>
<q-time
v-model="timing_time"
with-seconds
format24h
now-btn
>
<div class="row items-center justify-end">
<q-btn
v-close-popup
:label="$t('close')"
color="primary"
flat
/>
</div>
</q-time>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</q-item-section>
</q-item>
<q-item>
<q-item-section avatar class="width_5_1">{{
$t("loop") + ":"
}}</q-item-section>
<q-item-section>
<div class="row">
<q-item-section>
<q-checkbox v-model="day1" :label="$t('monday')" />
</q-item-section>
<q-item-section>
<q-checkbox v-model="day2" :label="$t('tuesday')" />
</q-item-section>
<q-item-section>
<q-checkbox v-model="day3" :label="$t('wednesday')" />
</q-item-section>
<q-item-section>
<q-checkbox v-model="day4" :label="$t('thursday')" />
</q-item-section>
</div>
<div class="row">
<q-item-section>
<q-checkbox v-model="day5" :label="$t('friday')" />
</q-item-section>
<q-item-section>
<q-checkbox v-model="day6" :label="$t('saturday')" />
</q-item-section>
<q-item-section>
<q-checkbox v-model="day7" :label="$t('sunday')" />
</q-item-section>
<q-item-section> </q-item-section>
</div>
</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')"
color="primary"
v-close-popup
/>
<q-btn
ref="accept"
flat
:label="$t('Accept')"
:loading="loading"
type="submit"
color="primary"
/>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<style scoped>
.width_5_1 {
width: 20%;
}
</style>
<script lang="ts">
import { defineComponent, ref, watch, computed } from "vue";
import { useStore } from "src/store";
import GlobalData from "src/common/GlobalData";
import { useQuasar } from "quasar";
import { useI18n } from "vue-i18n";
import { api } from "boot/axios";
import { HttpProtocol } from "src/entities/HttpProtocol";
import TimingTaskEntity from "src/entities/TimingTaskEntity";
import { EWeekDays } from "src/entities/EWeekDays";
export default defineComponent({
name: "ComponentTimingTaskDialog",
setup() {
let $store = useStore();
let $q = useQuasar();
let $t = useI18n();
let type = ref(0);
let show_dialog = ref(false);
let loading = ref(false);
const timing_type_options = ref([
{
label: $t.t("power on"),
value: 1,
},
{
label: $t.t("power off"),
value: 2,
},
]);
const task_name = ref($t.t("new task"));
const timing_type = ref(1);
const timing_time = ref("00:09:00");
let enabled = true;
let ext_data = "";
let day1 = ref(true);
let day2 = ref(true);
let day3 = ref(true);
let day4 = ref(true);
let day5 = ref(true);
let day6 = ref(true);
let day7 = ref(true);
let _resolve: any = null;
let _reject: any = null;
const clean_promise = () => {
try {
if (_resolve && typeof _resolve == "function") {
_resolve(null);
} else if (_reject && typeof _reject == "function") {
_reject(null);
}
_resolve = null;
_reject = null;
} catch {}
};
return {
show_dialog,
timing_type_options,
timing_type,
timing_time,
task_name,
day1,
day2,
day3,
day4,
day5,
day6,
day7,
type,
loading,
showDialog() {
throw "please use showDialogAsync function";
},
showDialogAsync(_type: number, options: TimingTaskEntity) {
return new Promise((resolve, reject) => {
clean_promise();
type.value = _type ?? 1;
if (options) {
timing_type.value = options.task_type;
timing_time.value = options.timing_time;
task_name.value = options.task_name;
day1.value =
(options.timing_week_days & EWeekDays.EWeekMonday) == 0
? false
: true;
day2.value =
(options.timing_week_days & EWeekDays.EWeekTuesday) == 0
? false
: true;
day3.value =
(options.timing_week_days & EWeekDays.EWeekWednesday) == 0
? false
: true;
day4.value =
(options.timing_week_days & EWeekDays.EWeekThursday) == 0
? false
: true;
day5.value =
(options.timing_week_days & EWeekDays.EWeekFriday) == 0
? false
: true;
day6.value =
(options.timing_week_days & EWeekDays.EWeekSaturday) == 0
? false
: true;
day7.value =
(options.timing_week_days & EWeekDays.EWeekSunday) == 0
? false
: true;
}
_resolve = resolve;
_reject = reject;
show_dialog.value = true;
});
},
resetData() {
loading.value = false;
timing_type.value = 1;
timing_time.value = "00:09:00";
task_name.value = $t.t("new task");
day1.value = true;
day2.value = true;
day3.value = true;
day4.value = true;
day5.value = true;
day6.value = true;
day7.value = true;
enabled = true;
ext_data = "";
if (_reject) {
try {
_reject(null);
} catch {}
}
_resolve = null;
_reject = null;
},
async onSubmit() {
loading.value = true;
const data = new TimingTaskEntity();
data.enabled = enabled;
data.timing_time = timing_time.value;
data.timing_week_days = 0;
data.task_name = task_name.value;
if (day1.value) data.timing_week_days |= EWeekDays.EWeekMonday;
if (day2.value) data.timing_week_days |= EWeekDays.EWeekTuesday;
if (day3.value) data.timing_week_days |= EWeekDays.EWeekWednesday;
if (day4.value) data.timing_week_days |= EWeekDays.EWeekThursday;
if (day5.value) data.timing_week_days |= EWeekDays.EWeekFriday;
if (day6.value) data.timing_week_days |= EWeekDays.EWeekSaturday;
if (day7.value) data.timing_week_days |= EWeekDays.EWeekSunday;
data.task_type = timing_type.value;
data.ext_data = ext_data;
if (_resolve) {
try {
_resolve(data);
} catch {}
}
_resolve = null;
_reject = null;
loading.value = false;
show_dialog.value = false;
loading.value = false;
},
};
},
});
</script>

52
src/entities/EWeekDays.ts Normal file
View File

@ -0,0 +1,52 @@
enum EWeekDays {
EWeekNone = 0x00,
EWeekMonday = 0x01,
EWeekTuesday = 0x02,
EWeekWednesday = 0x04,
EWeekThursday = 0x08,
EWeekFriday = 0x10,
EWeekSaturday = 0x20,
EWeekSunday = 0x40,
EWeekAll = EWeekMonday |
EWeekTuesday |
EWeekWednesday |
EWeekThursday |
EWeekFriday |
EWeekSaturday |
EWeekSunday,
}
class EWeekDaysHelper {
static _week_days_map = new Map<string, EWeekDays>([
["EWeekDays::EWeekNone", EWeekDays.EWeekNone],
["EWeekDays::EWeekMonday", EWeekDays.EWeekMonday],
["EWeekDays::EWeekTuesday", EWeekDays.EWeekTuesday],
["EWeekDays::EWeekWednesday", EWeekDays.EWeekWednesday],
["EWeekDays::EWeekThursday", EWeekDays.EWeekThursday],
["EWeekDays::EWeekFriday", EWeekDays.EWeekFriday],
["EWeekDays::EWeekSaturday", EWeekDays.EWeekSaturday],
["EWeekDays::EWeekSunday", EWeekDays.EWeekSunday],
["EWeekDays::EWeekAll", EWeekDays.EWeekAll],
]);
static eWeekDaysToStr(week_days: EWeekDays) {
let ret = "EWeekDays::EWeekNone";
EWeekDaysHelper._week_days_map.forEach((v, k, m) => {
if (v == week_days) {
ret = k;
}
});
return ret;
}
static getEWeekDays(str: string) {
try {
return EWeekDaysHelper._week_days_map.get(str);
} catch (e) {
return EWeekDays.EWeekNone;
}
}
}
export { EWeekDays };

View File

@ -0,0 +1,16 @@
import BaseEntity from "./BaseEntity";
export default class TimingTaskEntity extends BaseEntity {
enabled = false;
task_name = "";
timing_time = "00:00:00";
timing_week_days: number = 0;
task_type = 0;
ext_data = "";
}
export enum TimingTaskType {
UnKnow = 0,
TaskPowerOn,
TaskPowerOff,
}

View File

@ -9,6 +9,7 @@ import { EdgeBlendingPoint } from "./EdgeBlendingEntities";
import { ExternalControlTableEntity } from "./ExternalControlTableEntity"; import { ExternalControlTableEntity } from "./ExternalControlTableEntity";
import { SerialPortConfigEntity } from "./SerialPortConfigEntity"; import { SerialPortConfigEntity } from "./SerialPortConfigEntity";
import { ConnectTableEntity } from "./ConnectTableEntity"; import { ConnectTableEntity } from "./ConnectTableEntity";
import TimingTaskEntity from "./TimingTaskEntity";
export namespace Protocol { export namespace Protocol {
export class Commands { export class Commands {
@ -382,19 +383,39 @@ export namespace Protocol {
public static get kRpcGetConnectionList() { public static get kRpcGetConnectionList() {
return Commands.PROTOCOL_PREFIX + "RpcGetConnectionList"; return Commands.PROTOCOL_PREFIX + "RpcGetConnectionList";
} }
public static get kRpcSetConnectionItem() { public static get kRpcSetConnectionItem() {
return Commands.PROTOCOL_PREFIX + "RpcSetConnectionItem"; return Commands.PROTOCOL_PREFIX + "RpcSetConnectionItem";
} }
public static get kWindowFullScreen() { public static get kWindowFullScreen() {
return Commands.PROTOCOL_PREFIX + "WindowFullScreen"; return Commands.PROTOCOL_PREFIX + "WindowFullScreen";
} }
public static get kSetDeviceAttribute() { public static get kSetDeviceAttribute() {
return Commands.PROTOCOL_PREFIX + "SetDeviceAttribute"; return Commands.PROTOCOL_PREFIX + "SetDeviceAttribute";
} }
public static get kRpcGetDeviceAttribute() { public static get kRpcGetDeviceAttribute() {
return Commands.PROTOCOL_PREFIX + "RpcGetDeviceAttribute"; return Commands.PROTOCOL_PREFIX + "RpcGetDeviceAttribute";
} }
public static get kRpcGetTimingTasks() {
return Commands.PROTOCOL_PREFIX + "RpcGetTimingTasks";
}
public static get kRpcDeleteTimingTask() {
return Commands.PROTOCOL_PREFIX + "RpcDeleteTimingTask";
}
public static get kRpcEditTimingTask() {
return Commands.PROTOCOL_PREFIX + "RpcEditTimingTask";
}
public static get kRpcAddTimingTask() {
return Commands.PROTOCOL_PREFIX + "RpcAddTimingTask";
}
static _all_commands = new Set([ static _all_commands = new Set([
Commands.kUnKnowCommand, Commands.kUnKnowCommand,
Commands.kSearchDevice, Commands.kSearchDevice,
@ -494,6 +515,10 @@ export namespace Protocol {
Commands.kWindowFullScreen, Commands.kWindowFullScreen,
Commands.kRpcGetDeviceAttribute, Commands.kRpcGetDeviceAttribute,
Commands.kSetDeviceAttribute, Commands.kSetDeviceAttribute,
Commands.kRpcAddTimingTask,
Commands.kRpcEditTimingTask,
Commands.kRpcDeleteTimingTask,
Commands.kRpcGetTimingTasks,
]); ]);
public static get AllCommands() { public static get AllCommands() {
return this._all_commands; return this._all_commands;
@ -2533,4 +2558,84 @@ export namespace Protocol {
this.command = Commands.kSetDeviceAttribute; this.command = Commands.kSetDeviceAttribute;
} }
} }
export class GetTimingTasksRequestEntity extends PacketEntity {
constructor(rpc_id = 0) {
super();
super.command = Commands.kRpcGetTimingTasks;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
}
timestamp = 0;
}
export class GetTimingTasksResponseEntity extends PacketEntity {
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
tasks: TimingTaskEntity[] = [];
}
export class AddTimingTaskRequestEntity extends PacketEntity {
constructor(task: TimingTaskEntity, rpc_id = 0) {
super();
super.command = Commands.kRpcAddTimingTask;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.task = task;
}
task: TimingTaskEntity;
}
export class AddTimingTaskResponseEntity extends PacketEntity {
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
uuid = "";
}
export class DeleteTimingTaskRequestEntity extends PacketEntity {
constructor(uuid: string, rpc_id = 0) {
super();
super.command = Commands.kRpcDeleteTimingTask;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.uuid = uuid;
}
uuid: string;
}
export class DeleteTimingTaskResponseEntity extends PacketEntity {
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
}
export class EditTimingTaskRequestEntity extends PacketEntity {
constructor(task: TimingTaskEntity, rpc_id = 0) {
super();
super.command = Commands.kRpcEditTimingTask;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.task = task;
}
task: TimingTaskEntity;
}
export class EditTimingTaskResponseEntity extends PacketEntity {
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
}
} }

View File

@ -18,6 +18,7 @@ export default {
"other setting": "Other", "other setting": "Other",
close: "Close", close: "Close",
logout: "Logout", logout: "Logout",
all: "All",
"window rect": "Window Size", "window rect": "Window Size",
"toolbar edit window rect": "Window Size", "toolbar edit window rect": "Window Size",
"edit window rect": "Window Size Adjust", "edit window rect": "Window Size Adjust",

View File

@ -498,4 +498,14 @@ export default {
"set device function": "设置设备功能成功", "set device function": "设置设备功能成功",
operator_play_signal_source: "信号源", operator_play_signal_source: "信号源",
"toolbar edit window rect": "窗口大小", "toolbar edit window rect": "窗口大小",
exit: "退出",
"add timing task": "添加定时任务",
"timing task": "定时任务",
"task type": "任务类型",
"please input task name": "请输入任务名称",
"task name": "任务名称",
add: "添加",
"new task": "新建任务",
all: "全部",
unknow: "未知",
}; };

View File

@ -143,6 +143,18 @@
> >
<q-popup-proxy> <q-popup-proxy>
<q-list class="shadow-2 text-primary"> <q-list class="shadow-2 text-primary">
<q-item
clickable
v-close-popup
@click="$refs.system_setting_dialog.showDialog()"
>
<q-item-section avatar>
<q-icon name="img:pad/toolbar/system_setting.png" />
</q-item-section>
<q-item-section>
{{ $t("system setting") }}
</q-item-section>
</q-item>
<q-item <q-item
clickable clickable
v-close-popup v-close-popup
@ -208,6 +220,7 @@
<subtitle-dialog ref="subtitle_dialog" /> <subtitle-dialog ref="subtitle_dialog" />
<advanced-debug-dialog ref="advanced_debug_dialog" /> <advanced-debug-dialog ref="advanced_debug_dialog" />
<window-rect-edit-dialog ref="window_rect_edit_dialog" /> <window-rect-edit-dialog ref="window_rect_edit_dialog" />
<system-setting-dialog ref="system_setting_dialog" />
</template> </template>
<script lang="ts"> <script lang="ts">
@ -221,6 +234,7 @@ import SubtitleDialog from "src/components/SubtitleDialog.vue";
import CenterControlDialog from "src/components/CenterControlDialog.vue"; import CenterControlDialog from "src/components/CenterControlDialog.vue";
import AdvancedDebugDialog from "src/components/AdvancedDebugDialog.vue"; import AdvancedDebugDialog from "src/components/AdvancedDebugDialog.vue";
import WindowRectEditDialog from "src/components/WindowRectEditDialog.vue"; import WindowRectEditDialog from "src/components/WindowRectEditDialog.vue";
import SystemSettingDialog from "src/components/SystemSettingDialog.vue";
import GlobalData from "src/common/GlobalData"; import GlobalData from "src/common/GlobalData";
import { Protocol } from "src/entities/WSProtocol"; import { Protocol } from "src/entities/WSProtocol";
@ -234,6 +248,7 @@ export default defineComponent({
SubtitleDialog, SubtitleDialog,
AdvancedDebugDialog, AdvancedDebugDialog,
WindowRectEditDialog, WindowRectEditDialog,
SystemSettingDialog,
}, },
setup() { setup() {
const $store = useStore(); const $store = useStore();