feat: 🚀 Add timing task entrance

This commit is contained in:
viarotel 2024-07-19 19:21:44 +08:00
parent 1bd37c24a6
commit 8393c854b3
13 changed files with 209 additions and 2 deletions

View File

@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
find "electron/resources/extra" -type f -exec git update-index --chmod=+x {} +

3
components.d.ts vendored
View File

@ -9,6 +9,7 @@ declare module 'vue' {
export interface GlobalComponents {
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
@ -25,6 +26,8 @@ declare module 'vue' {
ElLink: typeof import('element-plus/es')['ElLink']
ElOption: typeof import('element-plus/es')['ElOption']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSwitch: typeof import('element-plus/es')['ElSwitch']

View File

@ -0,0 +1,18 @@
<template>
<div class="" @click="handleClick(devices)">
<slot v-bind="{ loading }" />
</div>
</template>
<script setup>
const props = defineProps({
devices: {
type: Array,
default: () => [],
},
})
const loading = ref(false)
</script>
<style></style>

View File

@ -43,6 +43,7 @@ import Application from './Application/index.vue'
import Screenshot from './Screenshot/index.vue'
import FileManage from './FileManage/index.vue'
import Shell from './Shell/index.vue'
import Tasks from './Tasks/index.vue'
const props = defineProps({
devices: {
@ -72,6 +73,11 @@ const actionModel = [
svgIcon: 'command',
component: Shell,
},
{
label: 'device.control.task.name',
elIcon: 'Clock',
component: Tasks,
},
]
</script>

View File

@ -0,0 +1,97 @@
<template>
<el-dialog
v-model="visible"
title="定时任务"
width="60%"
class="el-dialog-beautify"
append-to-body
@closed="onClosed"
>
<ele-form-row :model="model" label-width="120px" class="!pr-[120px] !pt-4">
<ele-form-item-col label="任务类型" :span="24">
<el-select v-model="model.taskType" placeholder="请选择任务类型">
<el-option
v-for="item in taskModel"
:key="item.value"
:label="$t(item.label)"
:value="item.value"
>
</el-option>
</el-select>
</ele-form-item-col>
<ele-form-item-col label="定时器类型" :span="24">
<el-radio-group v-model="model.timerType">
<el-radio
v-for="(item, index) of timerModel"
:key="index"
:value="item.value"
>
{{ item.label }}
</el-radio>
</el-radio-group>
</ele-form-item-col>
</ele-form-row>
<template #footer>
<el-button @click="close">
取消
</el-button>
<el-button type="primary" @click="submit">
确定
</el-button>
</template>
</el-dialog>
</template>
<script setup>
const visible = ref(false)
const model = ref({
taskType: '',
timerType: 'timeout',
})
const taskModel = [
{
label: 'device.control.install',
value: 'install',
},
{
label: 'device.control.capture',
value: 'screenshot',
},
{
label: 'device.control.shell.name',
value: 'shell',
},
]
const timerModel = [
{
label: '单次',
value: 'timeout',
},
{
label: '周期',
value: 'interval',
},
]
function open() {
visible.value = true
}
function close() {
visible.value = false
}
function submit() {}
function onClosed() {}
defineExpose({
open,
close,
})
</script>
<style></style>

View File

@ -0,0 +1,28 @@
<template>
<div class="" @click="handleClick(device)">
<slot v-bind="{ loading }" />
<TaskDialog ref="taskDialogRef" />
</div>
</template>
<script setup>
import TaskDialog from './components/TaskDialog/index.vue'
const props = defineProps({
device: {
type: Array,
default: () => [],
},
})
const loading = ref(false)
const taskDialogRef = ref(null)
function handleClick(device) {
taskDialogRef.value.open(device)
}
</script>
<style></style>

View File

@ -73,6 +73,7 @@ import Rotation from './Rotation/index.vue'
import Volume from './Volume/index.vue'
import FileManage from './FileManage/index.vue'
import Shell from './Shell/index.vue'
import Tasks from './Tasks/index.vue'
export default {
components: {
@ -84,6 +85,7 @@ export default {
Volume,
FileManage,
Shell,
Tasks,
},
props: {
device: {
@ -157,6 +159,11 @@ export default {
component: 'Shell',
tips: 'device.control.shell.tips',
},
{
label: 'device.control.task.name',
elIcon: 'Clock',
component: 'Tasks',
},
{
label: 'device.control.gnirehtet',
elIcon: 'Link',

View File

@ -113,6 +113,7 @@
"device.control.shell.push.success": "Push script success",
"device.control.shell.enter": "Please enter the Enter key to confirm the execution of the script",
"device.control.shell.success": "Script execution successfully",
"device.control.task.name": "Timing Task",
"device.control.capture": "Screenshot",
"device.control.capture.progress": "Capturing screenshot for {deviceName}...",
"device.control.capture.success.message": "Open screenshot location?",

View File

@ -113,6 +113,7 @@
"device.control.shell.push.success": "推送脚本成功",
"device.control.shell.enter": "请输入回车键确认执行该脚本",
"device.control.shell.success": "脚本执行成功",
"device.control.task.name": "定时任务",
"device.control.capture": "截取屏幕",
"device.control.capture.progress": "正在截取 {deviceName} 的屏幕快照...",
"device.control.capture.success.message": "是否前往截屏位置进行查看?",

View File

@ -113,6 +113,7 @@
"device.control.shell.push.success": "推送腳本成功",
"device.control.shell.enter": "請輸入回車鍵確認執行該腳本",
"device.control.shell.success": "腳本執行成功",
"device.control.task.name": "定時任務",
"device.control.capture": "擷取螢幕",
"device.control.capture.progress": "正在擷取 {deviceName} 的螢幕快照...",
"device.control.capture.success.message": "是否前往截圖位置進行檢視?",

View File

@ -0,0 +1,21 @@
<template>
<el-col v-bind="{ ...$props }">
<el-form-item v-bind="{ ...$attrs }">
<slot />
</el-form-item>
</el-col>
</template>
<script>
import { ElCol } from 'element-plus'
export default {
name: 'ElFormItemCol',
inheritAttrs: false,
props: {
...ElCol.props,
},
}
</script>
<style></style>

View File

@ -0,0 +1,21 @@
<template>
<el-form v-bind="{ ...$props }">
<el-row v-bind="{ ...$attrs, size: $props.size }">
<slot />
</el-row>
</el-form>
</template>
<script>
import { ElForm } from 'element-plus'
export default {
name: 'ElFormRow',
inheritAttrs: false,
props: {
...ElForm.props,
},
}
</script>
<style></style>

View File

@ -11,6 +11,8 @@ import * as ElementPlusIcons from '@element-plus/icons-vue'
import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'
import EleIconLoading from './components/EleIconLoading/index.vue'
import EleFormRow from './components/EleFormRow/index.vue'
import EleFormItemCol from './components/EleFormItemCol/index.vue'
export default {
install(app) {
@ -29,5 +31,8 @@ export default {
app.use(ElMessage)
app.use(ElMessageBox)
app.use(ElLoading)
app.component('EleFormRow', EleFormRow)
app.component('EleFormItemCol', EleFormItemCol)
},
}