-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ Add batch installation application function
- Loading branch information
Showing
8 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/components/Device/components/BatchActions/AppInstall/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<template> | ||
<div class="" @click="handleClick"> | ||
<slot /> | ||
<AppInstallProxy ref="appInstallProxyRef" /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import AppInstallProxy from '$/components/Device/components/ControlBar/AppInstall/index.vue' | ||
import { sleep } from '$/utils' | ||
export default { | ||
components: { | ||
AppInstallProxy, | ||
}, | ||
props: { | ||
devices: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
methods: { | ||
async handleClick() { | ||
for (let index = 0; index < this.devices.length; index++) { | ||
const item = this.devices[index] | ||
await this.$refs.appInstallProxyRef.handleInstall(item) | ||
await sleep(2 * 1000) | ||
} | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<div class="flex items-center"> | ||
<component | ||
:is="item.component || 'div'" | ||
v-for="(item, index) in actionModel" | ||
:key="index" | ||
class="flex-none" | ||
v-bind="{ | ||
devices, | ||
...(item.command | ||
? { | ||
onClick: () => handleShell(item), | ||
} | ||
: {}), | ||
}" | ||
> | ||
<template #default="{ loading = false } = {}"> | ||
<el-button | ||
type="primary" | ||
plain | ||
:title="$t(item.tips || item.label)" | ||
:loading="loading" | ||
> | ||
<template #icon> | ||
<svg-icon | ||
v-if="item.svgIcon" | ||
:name="item.svgIcon" | ||
:class="item.iconClass" | ||
></svg-icon> | ||
<el-icon v-else-if="item.elIcon" :class="item.iconClass"> | ||
<component :is="item.elIcon" /> | ||
</el-icon> | ||
</template> | ||
{{ $t('common.batch') }}{{ $t(item.label) }} | ||
</el-button> | ||
</template> | ||
</component> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import AppInstall from './AppInstall/index.vue' | ||
export default { | ||
components: { | ||
AppInstall, | ||
}, | ||
props: { | ||
devices: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
data() { | ||
return { | ||
actionModel: [ | ||
{ | ||
label: 'device.control.install', | ||
svgIcon: 'install', | ||
component: 'AppInstall', | ||
}, | ||
], | ||
} | ||
}, | ||
methods: { | ||
handleShell() {}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters