feat: 远程升级 加入权限
This commit is contained in:
parent
716387150a
commit
4e75bf94c6
|
@ -17,19 +17,21 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="state-title-right">
|
<div class="state-title-right">
|
||||||
<div>
|
<div class="state-button">
|
||||||
<a-popconfirm
|
<PermissionButton
|
||||||
title="确定批量重试?"
|
type="link"
|
||||||
ok-text="确定"
|
|
||||||
cancel-text="取消"
|
|
||||||
@confirm="confirm"
|
|
||||||
v-if="
|
v-if="
|
||||||
item.key === 'failed' &&
|
item.key === 'failed' &&
|
||||||
stateInfo?.mode?.value === 'push'
|
stateInfo?.mode?.value === 'push'
|
||||||
"
|
"
|
||||||
|
hasPermission="device/Firmware:update"
|
||||||
|
:popConfirm="{
|
||||||
|
title: `确定批量重试`,
|
||||||
|
onConfirm: confirm,
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<a href="#">批量重试</a>
|
批量重试
|
||||||
</a-popconfirm>
|
</PermissionButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="img">
|
<div class="img">
|
||||||
|
@ -85,37 +87,27 @@
|
||||||
<span>{{ slotProps.progress }}%</span>
|
<span>{{ slotProps.progress }}%</span>
|
||||||
</template>
|
</template>
|
||||||
<template #action="slotProps">
|
<template #action="slotProps">
|
||||||
<a-space :size="16">
|
<a-space>
|
||||||
<a-tooltip
|
<template
|
||||||
v-for="i in getActions(slotProps)"
|
v-for="i in getActions(slotProps)"
|
||||||
:key="i.key"
|
:key="i.key"
|
||||||
v-bind="i.tooltip"
|
|
||||||
>
|
>
|
||||||
<a-popconfirm
|
<PermissionButton
|
||||||
v-if="i.popConfirm"
|
:disabled="i.disabled"
|
||||||
v-bind="i.popConfirm"
|
:popConfirm="i.popConfirm"
|
||||||
>
|
:tooltip="{
|
||||||
<a-button
|
...i.tooltip,
|
||||||
:disabled="i.disabled"
|
}"
|
||||||
style="padding: 0"
|
style="padding: 0px"
|
||||||
type="link"
|
@click="i.onClick"
|
||||||
><AIcon :type="i.icon"
|
|
||||||
/></a-button>
|
|
||||||
</a-popconfirm>
|
|
||||||
<a-button
|
|
||||||
style="padding: 0"
|
|
||||||
type="link"
|
type="link"
|
||||||
v-else
|
:hasPermission="'device/Firmware:' + i.key"
|
||||||
@click="i.onClick && i.onClick(slotProps)"
|
|
||||||
>
|
>
|
||||||
<a-button
|
<template #icon
|
||||||
:disabled="i.disabled"
|
|
||||||
style="padding: 0"
|
|
||||||
type="link"
|
|
||||||
><AIcon :type="i.icon"
|
><AIcon :type="i.icon"
|
||||||
/></a-button>
|
/></template>
|
||||||
</a-button>
|
</PermissionButton>
|
||||||
</a-tooltip>
|
</template>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
</JTable>
|
</JTable>
|
||||||
|
@ -129,7 +121,6 @@ import {
|
||||||
taskById,
|
taskById,
|
||||||
history,
|
history,
|
||||||
historyCount,
|
historyCount,
|
||||||
queryProduct,
|
|
||||||
startTask,
|
startTask,
|
||||||
startOneTask,
|
startOneTask,
|
||||||
} from '@/api/device/firmware';
|
} from '@/api/device/firmware';
|
||||||
|
@ -138,8 +129,8 @@ import { getImage } from '@/utils/comm';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import Save from './Save.vue';
|
import Save from './Save.vue';
|
||||||
|
|
||||||
const tableRef = ref<Record<string, any>>({});
|
const tableRef = ref<Record<string, any>>({});
|
||||||
const router = useRouter();
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const params = ref<Record<string, any>>({});
|
const params = ref<Record<string, any>>({});
|
||||||
const taskId = route.params?.id as string;
|
const taskId = route.params?.id as string;
|
||||||
|
@ -286,7 +277,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
}
|
}
|
||||||
const Actions = [
|
const Actions = [
|
||||||
{
|
{
|
||||||
key: 'eye',
|
key: 'view',
|
||||||
text: '查看',
|
text: '查看',
|
||||||
tooltip: {
|
tooltip: {
|
||||||
title: '查看',
|
title: '查看',
|
||||||
|
@ -297,25 +288,23 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'try',
|
key: 'update',
|
||||||
text: '重试',
|
text: '重试',
|
||||||
tooltip: {
|
tooltip: {
|
||||||
title: '重试',
|
title: '重试',
|
||||||
},
|
},
|
||||||
icon: 'RedoOutlined',
|
icon: 'RedoOutlined',
|
||||||
onClick: async () => {
|
popConfirm: {
|
||||||
handlTry(data.id);
|
title: `确认重试?`,
|
||||||
|
onConfirm: async () => {
|
||||||
|
handlTry(data.id);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
return Actions;
|
return Actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlAdd = () => {
|
|
||||||
current.value = {};
|
|
||||||
visible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handlEye = (data: string) => {
|
const handlEye = (data: string) => {
|
||||||
current.value = data || '';
|
current.value = data || '';
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
|
@ -434,4 +423,8 @@ const handleSearch = (e: any) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.state-button {
|
||||||
|
margin-top: -5px;
|
||||||
|
margin-right: -12px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,9 +13,14 @@
|
||||||
:params="params"
|
:params="params"
|
||||||
>
|
>
|
||||||
<template #headerTitle>
|
<template #headerTitle>
|
||||||
<a-button type="primary" @click="handlAdd"
|
<PermissionButton
|
||||||
><AIcon type="PlusOutlined" />新增</a-button
|
type="primary"
|
||||||
|
@click="handlAdd"
|
||||||
|
hasPermission="device/Firmware:add"
|
||||||
>
|
>
|
||||||
|
<template #icon><AIcon type="PlusOutlined" /></template>
|
||||||
|
新增
|
||||||
|
</PermissionButton>
|
||||||
</template>
|
</template>
|
||||||
<template #mode="slotProps">
|
<template #mode="slotProps">
|
||||||
<span>{{ slotProps.mode.text }}</span>
|
<span>{{ slotProps.mode.text }}</span>
|
||||||
|
|
|
@ -13,9 +13,14 @@
|
||||||
:params="params"
|
:params="params"
|
||||||
>
|
>
|
||||||
<template #headerTitle>
|
<template #headerTitle>
|
||||||
<a-button type="primary" @click="handlAdd"
|
<PermissionButton
|
||||||
><plus-outlined />新增</a-button
|
type="primary"
|
||||||
|
@click="handlAdd"
|
||||||
|
hasPermission="device/Firmware:add"
|
||||||
>
|
>
|
||||||
|
<template #icon><AIcon type="PlusOutlined" /></template>
|
||||||
|
新增
|
||||||
|
</PermissionButton>
|
||||||
</template>
|
</template>
|
||||||
<template #productId="slotProps">
|
<template #productId="slotProps">
|
||||||
<span>{{ slotProps.productName }}</span>
|
<span>{{ slotProps.productName }}</span>
|
||||||
|
@ -28,37 +33,27 @@
|
||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #action="slotProps">
|
<template #action="slotProps">
|
||||||
<a-space :size="16">
|
<a-space>
|
||||||
<a-tooltip
|
<template
|
||||||
v-for="i in getActions(slotProps)"
|
v-for="i in getActions(slotProps)"
|
||||||
:key="i.key"
|
:key="i.key"
|
||||||
v-bind="i.tooltip"
|
|
||||||
>
|
>
|
||||||
<a-popconfirm
|
<PermissionButton
|
||||||
v-if="i.popConfirm"
|
:disabled="i.disabled"
|
||||||
v-bind="i.popConfirm"
|
:popConfirm="i.popConfirm"
|
||||||
>
|
:tooltip="{
|
||||||
<a-button
|
...i.tooltip,
|
||||||
:disabled="i.disabled"
|
}"
|
||||||
style="padding: 0"
|
style="padding: 0px"
|
||||||
type="link"
|
@click="i.onClick"
|
||||||
><AIcon :type="i.icon"
|
|
||||||
/></a-button>
|
|
||||||
</a-popconfirm>
|
|
||||||
<a-button
|
|
||||||
style="padding: 0"
|
|
||||||
type="link"
|
type="link"
|
||||||
v-else
|
:hasPermission="'device/Firmware:' + i.key"
|
||||||
@click="i.onClick && i.onClick(slotProps)"
|
|
||||||
>
|
>
|
||||||
<a-button
|
<template #icon
|
||||||
:disabled="i.disabled"
|
|
||||||
style="padding: 0"
|
|
||||||
type="link"
|
|
||||||
><AIcon :type="i.icon"
|
><AIcon :type="i.icon"
|
||||||
/></a-button>
|
/></template>
|
||||||
</a-button>
|
</PermissionButton>
|
||||||
</a-tooltip>
|
</template>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
</JTable>
|
</JTable>
|
||||||
|
@ -79,7 +74,6 @@ import type { FormDataType } from './type';
|
||||||
const menuStory = useMenuStore();
|
const menuStory = useMenuStore();
|
||||||
|
|
||||||
const tableRef = ref<Record<string, any>>({});
|
const tableRef = ref<Record<string, any>>({});
|
||||||
const router = useRouter();
|
|
||||||
const params = ref<Record<string, any>>({});
|
const params = ref<Record<string, any>>({});
|
||||||
|
|
||||||
const productOptions = ref([]);
|
const productOptions = ref([]);
|
||||||
|
@ -174,7 +168,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
key: 'FileTextOutlined',
|
key: 'view',
|
||||||
text: '升级任务',
|
text: '升级任务',
|
||||||
tooltip: {
|
tooltip: {
|
||||||
title: '升级任务',
|
title: '升级任务',
|
||||||
|
@ -185,7 +179,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'edit',
|
key: 'update',
|
||||||
text: '编辑',
|
text: '编辑',
|
||||||
tooltip: {
|
tooltip: {
|
||||||
title: '编辑',
|
title: '编辑',
|
||||||
|
@ -211,7 +205,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlUpdate = (data: FormDataType) => {
|
const handlUpdate = (data: Partial<Record<string, any>>) => {
|
||||||
menuStory.jumpPage(
|
menuStory.jumpPage(
|
||||||
'device/Firmware/Task',
|
'device/Firmware/Task',
|
||||||
{},
|
{},
|
||||||
|
@ -226,7 +220,7 @@ const handlAdd = () => {
|
||||||
current.value = {};
|
current.value = {};
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
};
|
};
|
||||||
const handlEdit = (data: FormDataType) => {
|
const handlEdit = (data: Partial<Record<string, any>>) => {
|
||||||
current.value = _.cloneDeep(data);
|
current.value = _.cloneDeep(data);
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue