Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
980dd7af3a
|
@ -56,6 +56,8 @@ const iconKeys = [
|
||||||
'ArrowLeftOutlined',
|
'ArrowLeftOutlined',
|
||||||
'DownloadOutlined',
|
'DownloadOutlined',
|
||||||
'PauseOutlined',
|
'PauseOutlined',
|
||||||
|
'ControlOutlined',
|
||||||
|
'RedoOutlined',
|
||||||
'VideoCameraOutlined',
|
'VideoCameraOutlined',
|
||||||
'HistoryOutlined',
|
'HistoryOutlined',
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<template lang="">
|
||||||
|
<a-modal
|
||||||
|
title="查看"
|
||||||
|
ok-text="确认"
|
||||||
|
cancel-text="取消"
|
||||||
|
:visible="true"
|
||||||
|
width="500px"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
@ok="handleOk"
|
||||||
|
>
|
||||||
|
<span>失败原因:{{ data }}</span>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup name="TaskDetailSavePage">
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['change']);
|
||||||
|
|
||||||
|
const handleOk = () => {
|
||||||
|
handleCancel();
|
||||||
|
};
|
||||||
|
const handleCancel = () => {
|
||||||
|
emit('change', false);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
|
@ -0,0 +1,437 @@
|
||||||
|
<template>
|
||||||
|
<page-container>
|
||||||
|
<div>
|
||||||
|
<div class="state-container">
|
||||||
|
<div
|
||||||
|
class="state-body"
|
||||||
|
v-for="item in stateList"
|
||||||
|
:key="item.key"
|
||||||
|
>
|
||||||
|
<div class="state-content">
|
||||||
|
<div class="state-header">
|
||||||
|
<div class="state-title">
|
||||||
|
<a-badge
|
||||||
|
:text="item.name"
|
||||||
|
:color="colorMap.get(item.key)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="state-title-right">
|
||||||
|
<div>
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定批量重试?"
|
||||||
|
ok-text="确定"
|
||||||
|
cancel-text="取消"
|
||||||
|
@confirm="confirm"
|
||||||
|
v-if="
|
||||||
|
item.key === 'failed' &&
|
||||||
|
stateInfo?.mode?.value === 'push'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a href="#">批量重试</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="img">
|
||||||
|
<img
|
||||||
|
:src="buttonImg"
|
||||||
|
@click="handleRefresh(item.key)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="state-box">
|
||||||
|
<div
|
||||||
|
class="state-left"
|
||||||
|
:style="`color: ${colorMap.get(item.key)}`"
|
||||||
|
>
|
||||||
|
{{ state[item.key] }}
|
||||||
|
</div>
|
||||||
|
<img class="state-right" :src="item.img" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Search :columns="columns" target="search" @search="handleSearch" />
|
||||||
|
<JTable
|
||||||
|
ref="tableRef"
|
||||||
|
model="TABLE"
|
||||||
|
:columns="columns"
|
||||||
|
:request="history"
|
||||||
|
:defaultParams="{
|
||||||
|
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||||
|
terms: defaultParams,
|
||||||
|
}"
|
||||||
|
:params="params"
|
||||||
|
>
|
||||||
|
<template #createTime="slotProps">
|
||||||
|
<span>{{
|
||||||
|
moment(slotProps.createTime).format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
|
)
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
|
<template #productId="slotProps">
|
||||||
|
<span>{{ slotProps.productName }}</span>
|
||||||
|
</template>
|
||||||
|
<template #state="slotProps">
|
||||||
|
<a-badge
|
||||||
|
:text="slotProps.state.text"
|
||||||
|
:color="colorMap.get(slotProps.state.value)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #progress="slotProps">
|
||||||
|
<span>{{ slotProps.progress }}%</span>
|
||||||
|
</template>
|
||||||
|
<template #action="slotProps">
|
||||||
|
<a-space :size="16">
|
||||||
|
<a-tooltip
|
||||||
|
v-for="i in getActions(slotProps)"
|
||||||
|
:key="i.key"
|
||||||
|
v-bind="i.tooltip"
|
||||||
|
>
|
||||||
|
<a-popconfirm
|
||||||
|
v-if="i.popConfirm"
|
||||||
|
v-bind="i.popConfirm"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
:disabled="i.disabled"
|
||||||
|
style="padding: 0"
|
||||||
|
type="link"
|
||||||
|
><AIcon :type="i.icon"
|
||||||
|
/></a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-button
|
||||||
|
style="padding: 0"
|
||||||
|
type="link"
|
||||||
|
v-else
|
||||||
|
@click="i.onClick && i.onClick(slotProps)"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
:disabled="i.disabled"
|
||||||
|
style="padding: 0"
|
||||||
|
type="link"
|
||||||
|
><AIcon :type="i.icon"
|
||||||
|
/></a-button>
|
||||||
|
</a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</JTable>
|
||||||
|
<Save :data="current" v-if="visible" @change="saveChange" />
|
||||||
|
</div>
|
||||||
|
</page-container>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup name="TaskDetailPage">
|
||||||
|
import type { ActionsType } from '@/components/Table/index';
|
||||||
|
import {
|
||||||
|
taskById,
|
||||||
|
history,
|
||||||
|
historyCount,
|
||||||
|
queryProduct,
|
||||||
|
startTask,
|
||||||
|
startOneTask,
|
||||||
|
} from '@/api/device/firmware';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
import { getImage } from '@/utils/comm';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
import Save from './Save.vue';
|
||||||
|
const tableRef = ref<Record<string, any>>({});
|
||||||
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
const params = ref<Record<string, any>>({});
|
||||||
|
const taskId = route.params?.id as string;
|
||||||
|
const visible = ref(false);
|
||||||
|
const current = ref({});
|
||||||
|
const productOptions = ref([]);
|
||||||
|
|
||||||
|
const colorMap = new Map();
|
||||||
|
colorMap.set('waiting', '#FF9000');
|
||||||
|
colorMap.set('processing', '#4293FF');
|
||||||
|
colorMap.set('failed', '#F76F5D');
|
||||||
|
colorMap.set('success', '#24B276');
|
||||||
|
colorMap.set('canceled', '#999');
|
||||||
|
|
||||||
|
const stateList = [
|
||||||
|
{
|
||||||
|
key: 'waiting',
|
||||||
|
name: '等待升级',
|
||||||
|
img: getImage('/firmware/waiting.png'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'processing',
|
||||||
|
name: '升级中',
|
||||||
|
img: getImage('/firmware/loading.png'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'success',
|
||||||
|
name: '升级完成',
|
||||||
|
img: getImage('/firmware/finish.png'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'failed',
|
||||||
|
name: '升级失败',
|
||||||
|
img: getImage('/firmware/error.png'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'canceled',
|
||||||
|
name: '已停止',
|
||||||
|
img: getImage('/firmware/cancel.png'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const buttonImg = getImage('/firmware/button.png');
|
||||||
|
const state = ref({
|
||||||
|
waiting: 0,
|
||||||
|
processing: 0,
|
||||||
|
success: 0,
|
||||||
|
failed: 0,
|
||||||
|
canceled: 0,
|
||||||
|
});
|
||||||
|
const stateInfo = ref();
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '设备名称',
|
||||||
|
dataIndex: 'deviceName',
|
||||||
|
key: 'deviceName',
|
||||||
|
fixed: 'left',
|
||||||
|
width: 200,
|
||||||
|
ellipsis: true,
|
||||||
|
search: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '所属产品',
|
||||||
|
dataIndex: 'productId',
|
||||||
|
key: 'productId',
|
||||||
|
ellipsis: true,
|
||||||
|
width: 200,
|
||||||
|
scopedSlots: true,
|
||||||
|
// search: {
|
||||||
|
// type: 'select',
|
||||||
|
// options: productOptions,
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
key: 'createTime',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
width: 200,
|
||||||
|
scopedSlots: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '完成时间',
|
||||||
|
key: 'completeTime',
|
||||||
|
ellipsis: true,
|
||||||
|
dataIndex: 'completeTime',
|
||||||
|
search: {
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
scopedSlots: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '进度',
|
||||||
|
dataIndex: 'progress',
|
||||||
|
key: 'progress',
|
||||||
|
ellipsis: true,
|
||||||
|
scopedSlots: true,
|
||||||
|
width: 200,
|
||||||
|
search: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'state',
|
||||||
|
key: 'state',
|
||||||
|
ellipsis: true,
|
||||||
|
search: {
|
||||||
|
type: 'select',
|
||||||
|
options: stateList.map((item) => ({
|
||||||
|
value: item.key,
|
||||||
|
label: item.name,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
scopedSlots: true,
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 200,
|
||||||
|
scopedSlots: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const defaultParams = [
|
||||||
|
{
|
||||||
|
terms: [
|
||||||
|
{
|
||||||
|
column: 'taskId',
|
||||||
|
value: taskId,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
|
if (!data) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const Actions = [
|
||||||
|
{
|
||||||
|
key: 'eye',
|
||||||
|
text: '查看',
|
||||||
|
tooltip: {
|
||||||
|
title: '查看',
|
||||||
|
},
|
||||||
|
icon: 'EyeOutlined',
|
||||||
|
onClick: async () => {
|
||||||
|
handlEye(data.errorReason);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'try',
|
||||||
|
text: '重试',
|
||||||
|
tooltip: {
|
||||||
|
title: '重试',
|
||||||
|
},
|
||||||
|
icon: 'RedoOutlined',
|
||||||
|
onClick: async () => {
|
||||||
|
handlTry(data.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return Actions;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlAdd = () => {
|
||||||
|
current.value = {};
|
||||||
|
visible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlEye = (data: string) => {
|
||||||
|
current.value = data || '';
|
||||||
|
visible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlTry = async (id: string) => {
|
||||||
|
const res = await startOneTask([id]);
|
||||||
|
if (res.success) {
|
||||||
|
message.success('操作成功');
|
||||||
|
tableRef.value.reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const saveChange = (value: boolean) => {
|
||||||
|
visible.value = false;
|
||||||
|
current.value = {};
|
||||||
|
};
|
||||||
|
const confirm = async (e: MouseEvent) => {
|
||||||
|
const res = await startTask(taskId, ['failed']);
|
||||||
|
if (res.success) {
|
||||||
|
message.success('操作成功');
|
||||||
|
handleRefresh('failed');
|
||||||
|
tableRef.value.reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRefresh = async (key: string) => {
|
||||||
|
const terms = cloneDeep(defaultParams);
|
||||||
|
terms[0].terms.push({ column: 'state', value: key });
|
||||||
|
const res = await historyCount({ terms });
|
||||||
|
if (res.success) {
|
||||||
|
state.value[key] = res?.result || 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
stateList.forEach((item) => {
|
||||||
|
handleRefresh(item.key);
|
||||||
|
});
|
||||||
|
taskById(taskId).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
stateInfo.value = res?.result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
const handleSearch = (e: any) => {
|
||||||
|
params.value = e;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.state-container {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 148px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
padding: 24px 12px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
.state-body {
|
||||||
|
background: linear-gradient(
|
||||||
|
135.62deg,
|
||||||
|
#f6f7fd 22.27%,
|
||||||
|
rgba(255, 255, 255, 0.86) 91.82%
|
||||||
|
);
|
||||||
|
min-width: 185px;
|
||||||
|
max-width: 580px;
|
||||||
|
flex: 1px;
|
||||||
|
margin: 0 12px;
|
||||||
|
.state-content {
|
||||||
|
width: 100% -15px;
|
||||||
|
height: 100%;
|
||||||
|
margin: 15px 0 0 15px;
|
||||||
|
align-content: center;
|
||||||
|
|
||||||
|
.state-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 22px;
|
||||||
|
.state-title-right {
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
.img {
|
||||||
|
width: 22px;
|
||||||
|
margin: 0 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
img {
|
||||||
|
width: 22px;
|
||||||
|
margin-top: -5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.img:active {
|
||||||
|
border: 1px #40a9ff solid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.state-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.state-left {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 52px;
|
||||||
|
}
|
||||||
|
.state-right {
|
||||||
|
height: 100%;
|
||||||
|
flex: 1;
|
||||||
|
margin-top: -31px;
|
||||||
|
max-width: 120px;
|
||||||
|
max-height: 94px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -5,7 +5,11 @@
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
>
|
>
|
||||||
<template #addonAfter>
|
<template #addonAfter>
|
||||||
<AIcon type="EditOutlined" @click="onVisible" />
|
<AIcon
|
||||||
|
:class="data.view ? 'disabled' : ''"
|
||||||
|
type="EditOutlined"
|
||||||
|
@click="onVisible"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</a-input>
|
</a-input>
|
||||||
<a-modal
|
<a-modal
|
||||||
|
@ -78,6 +82,13 @@ import moment from 'moment';
|
||||||
type T = any;
|
type T = any;
|
||||||
const emit = defineEmits(['update:modelValue', 'change']);
|
const emit = defineEmits(['update:modelValue', 'change']);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const params = ref<Record<string, any>>({});
|
const params = ref<Record<string, any>>({});
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
@ -212,15 +223,18 @@ const cancelSelect = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
checkLable.value = _selectedRowKeys.value
|
checkLable.value = updateSelect(_selectedRowKeys.value);
|
||||||
.map((item) => checkAllDataMap.has(item) && checkAllDataMap.get(item))
|
|
||||||
.toString();
|
|
||||||
emit('update:modelValue', _selectedRowKeys.value);
|
emit('update:modelValue', _selectedRowKeys.value);
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateSelect = (selectedRowKeys: T[]) =>
|
||||||
|
selectedRowKeys
|
||||||
|
.map((item) => checkAllDataMap.has(item) && checkAllDataMap.get(item))
|
||||||
|
.toString();
|
||||||
|
|
||||||
const onVisible = () => {
|
const onVisible = () => {
|
||||||
visible.value = true;
|
!props.data.view && (visible.value = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
@ -236,6 +250,10 @@ onMounted(() => {
|
||||||
checkAllDataMap.set(item.id, item.name);
|
checkAllDataMap.set(item.id, item.name);
|
||||||
return item.id;
|
return item.id;
|
||||||
});
|
});
|
||||||
|
if (props.data.id) {
|
||||||
|
checkLable.value = updateSelect(props.data.deviceId);
|
||||||
|
emit('update:modelValue', props.data.deviceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -264,9 +282,8 @@ const handleSearch = (e: any) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.form {
|
.disabled {
|
||||||
.form-submit {
|
pointer-events: auto !important;
|
||||||
background-color: @primary-color !important;
|
cursor: not-allowed !important;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -15,17 +15,20 @@
|
||||||
:model="formData"
|
:model="formData"
|
||||||
name="basic"
|
name="basic"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
|
ref="formRef"
|
||||||
|
:rules="rules"
|
||||||
>
|
>
|
||||||
<a-row :gutter="[24, 0]">
|
<a-row :gutter="[24, 0]">
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="任务名称" v-bind="validateInfos.name">
|
<a-form-item label="任务名称" name="name">
|
||||||
<a-input
|
<a-input
|
||||||
placeholder="请输入任务名称"
|
placeholder="请输入任务名称"
|
||||||
v-model:value="formData.name"
|
v-model:value="formData.name"
|
||||||
|
:disabled="view"
|
||||||
/></a-form-item>
|
/></a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24"
|
<a-col :span="24"
|
||||||
><a-form-item label="推送方式" v-bind="validateInfos.mode">
|
><a-form-item label="推送方式" name="mode">
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="formData.mode"
|
v-model:value="formData.mode"
|
||||||
:options="[
|
:options="[
|
||||||
|
@ -37,18 +40,20 @@
|
||||||
show-search
|
show-search
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption"
|
||||||
@change="changeMode"
|
@change="changeMode"
|
||||||
|
:disabled="view"
|
||||||
/> </a-form-item
|
/> </a-form-item
|
||||||
></a-col>
|
></a-col>
|
||||||
<a-col :span="12" v-if="formData.mode === 'push'"
|
<a-col :span="12" v-if="formData.mode === 'push'"
|
||||||
><a-form-item
|
><a-form-item
|
||||||
label="响应超时时间"
|
label="响应超时时间"
|
||||||
v-bind="validateInfos.responseTimeoutSeconds"
|
name="responseTimeoutSeconds"
|
||||||
>
|
>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
placeholder="请输入响应超时时间(秒)"
|
placeholder="请输入响应超时时间(秒)"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:min="1"
|
:min="1"
|
||||||
:max="99999"
|
:max="99999"
|
||||||
|
:disabled="view"
|
||||||
v-model:value="
|
v-model:value="
|
||||||
formData.responseTimeoutSeconds
|
formData.responseTimeoutSeconds
|
||||||
" /></a-form-item
|
" /></a-form-item
|
||||||
|
@ -56,79 +61,59 @@
|
||||||
<a-col
|
<a-col
|
||||||
:span="formData.mode === 'push' ? 12 : 24"
|
:span="formData.mode === 'push' ? 12 : 24"
|
||||||
v-if="formData.mode === 'push' || formData.mode === 'pull'"
|
v-if="formData.mode === 'push' || formData.mode === 'pull'"
|
||||||
><a-form-item
|
><a-form-item label="升级超时时间" name="timeoutSeconds">
|
||||||
label="升级超时时间"
|
|
||||||
v-bind="validateInfos.timeoutSeconds"
|
|
||||||
>
|
|
||||||
<a-input-number
|
<a-input-number
|
||||||
placeholder="请输入升级超时时间(秒)"
|
placeholder="请输入升级超时时间(秒)"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:min="1"
|
:min="1"
|
||||||
:max="99999"
|
:max="99999"
|
||||||
|
:disabled="view"
|
||||||
v-model:value="
|
v-model:value="
|
||||||
formData.timeoutSeconds
|
formData.timeoutSeconds
|
||||||
" /></a-form-item
|
" /></a-form-item
|
||||||
></a-col>
|
></a-col>
|
||||||
<a-col :span="12" v-if="!!formData.mode"
|
<a-col :span="12" v-if="!!formData.mode"
|
||||||
><a-form-item
|
><a-form-item label="升级设备" name="releaseType">
|
||||||
label="升级设备"
|
|
||||||
v-bind="validateInfos.releaseType"
|
|
||||||
>
|
|
||||||
<a-radio-group
|
<a-radio-group
|
||||||
v-model:value="formData.releaseType"
|
v-model:value="formData.releaseType"
|
||||||
button-style="solid"
|
button-style="solid"
|
||||||
@change="changeShareCluster"
|
@change="changeShareCluster"
|
||||||
|
:disabled="view"
|
||||||
>
|
>
|
||||||
<a-radio value="all">所有设备</a-radio>
|
<a-radio value="all">所有设备</a-radio>
|
||||||
<a-radio value="part">选择设备</a-radio>
|
<a-radio value="part">选择设备</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12" v-if="formData.releaseType === 'part'"
|
<a-col :span="12" v-if="formData.releaseType === 'part'">
|
||||||
><a-form-item
|
<a-form-item label="选择设备" name="deviceId">
|
||||||
label="选择设备"
|
|
||||||
v-bind="validateInfos.deviceId"
|
|
||||||
>
|
|
||||||
<SelectDevices
|
<SelectDevices
|
||||||
v-model:modelValue="formData.deviceId"
|
v-model:modelValue="formData.deviceId"
|
||||||
:data="devicesData"
|
:data="data"
|
||||||
></SelectDevices> </a-form-item
|
></SelectDevices> </a-form-item
|
||||||
></a-col>
|
></a-col>
|
||||||
|
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item
|
<a-form-item label="说明" name="description">
|
||||||
label="说明"
|
|
||||||
v-bind="validateInfos.description"
|
|
||||||
>
|
|
||||||
<a-textarea
|
<a-textarea
|
||||||
placeholder="请输入说明"
|
placeholder="请输入说明"
|
||||||
v-model:value="formData.description"
|
v-model:value="formData.description"
|
||||||
:maxlength="200"
|
:maxlength="200"
|
||||||
:rows="3"
|
:rows="3"
|
||||||
showCount
|
showCount
|
||||||
|
:disabled="view"
|
||||||
/> </a-form-item
|
/> </a-form-item
|
||||||
></a-col>
|
></a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<!-- <SelectDevices v-if="visible" @change="saveChange"></SelectDevices> -->
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="TaskPage">
|
<script lang="ts" setup name="TaskPage">
|
||||||
import { message, Form } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
import { save, update, queryProduct } from '@/api/device/firmware';
|
import { queryProduct, saveTask } from '@/api/device/firmware';
|
||||||
import type { FormInstance } from 'ant-design-vue';
|
import type { FormInstance } from 'ant-design-vue';
|
||||||
import type { Properties } from '../../type';
|
|
||||||
import SelectDevices from './SelectDevices.vue';
|
import SelectDevices from './SelectDevices.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
console.log(111, route.query);
|
|
||||||
|
|
||||||
const loading = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
const productOptions = ref([]);
|
|
||||||
const visible = ref(false);
|
|
||||||
const devicesData = ref()
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -136,9 +121,16 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance>();
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const loading = ref(false);
|
||||||
|
const productOptions = ref([]);
|
||||||
const emit = defineEmits(['change']);
|
const emit = defineEmits(['change']);
|
||||||
|
|
||||||
const id = props.data.id;
|
const firmwareId = route.query.id;
|
||||||
|
const productId = route.query.productId;
|
||||||
|
const view = props.data.view;
|
||||||
|
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -146,98 +138,48 @@ const formData = ref({
|
||||||
responseTimeoutSeconds: '',
|
responseTimeoutSeconds: '',
|
||||||
timeoutSeconds: '',
|
timeoutSeconds: '',
|
||||||
releaseType: 'all',
|
releaseType: 'all',
|
||||||
deviceId: [],
|
deviceId: undefined,
|
||||||
description: '',
|
description: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const extraValue = ref({});
|
const rules = {
|
||||||
|
name: [
|
||||||
const validatorSign = async (_: Record<string, any>, value: string) => {
|
{ required: true, message: '请输入任务名称' },
|
||||||
// const { releaseType, url } = formData.value;
|
{ max: 64, message: '最多可输入64个字符' },
|
||||||
// if (value && !!releaseType && !!url && !extraValue.value) {
|
],
|
||||||
// return extraValue.value[releaseType] !== value
|
mode: [{ required: true, message: '请选择推送方式' }],
|
||||||
// ? Promise.reject('选择设备不一致,请检查文件是否上传正确')
|
responseTimeoutSeconds: [{ required: true, message: '请输入响应超时时间' }],
|
||||||
// : Promise.resolve();
|
timeoutSeconds: [{ required: true, message: '请输入升级超时时间' }],
|
||||||
// } else {
|
releaseType: [{ required: true }],
|
||||||
// return Promise.resolve();
|
deviceId: [{ required: true, message: '请选择设备' }],
|
||||||
// }
|
description: [{ max: 200, message: '最多可输入200个字符' }],
|
||||||
};
|
};
|
||||||
|
|
||||||
const { resetFields, validate, validateInfos } = useForm(
|
|
||||||
formData,
|
|
||||||
reactive({
|
|
||||||
name: [
|
|
||||||
{ required: true, message: '请输入任务名称' },
|
|
||||||
{ max: 64, message: '最多可输入64个字符' },
|
|
||||||
],
|
|
||||||
mode: [{ required: true, message: '请选择推送方式' }],
|
|
||||||
responseTimeoutSeconds: [
|
|
||||||
{ required: true, message: '请输入响应超时时间' },
|
|
||||||
],
|
|
||||||
timeoutSeconds: [{ required: true, message: '请输入升级超时时间' }],
|
|
||||||
releaseType: [{ required: true }],
|
|
||||||
deviceId: [
|
|
||||||
{ required: true, message: '请选择设备' },
|
|
||||||
{ validator: validatorSign },
|
|
||||||
],
|
|
||||||
description: [{ max: 200, message: '最多可输入200个字符' }],
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const filterOption = (input: string, option: any) => {
|
const filterOption = (input: string, option: any) => {
|
||||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeMode = (value) => {
|
|
||||||
console.log(111, value, formData.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onChange = () => {
|
|
||||||
visible.value = true;
|
|
||||||
};
|
|
||||||
const saveChange = () => {
|
|
||||||
visible.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
validate()
|
const params = await formRef.value?.validate();
|
||||||
.then(async (res) => {
|
loading.value = true;
|
||||||
// const product = productOptions.value.find(
|
const resp = await saveTask({
|
||||||
// (item) => item.value === res.mode,
|
...params,
|
||||||
// );
|
firmwareId,
|
||||||
// const productName = product.label || props.data?.url;
|
productId,
|
||||||
// const size = extraValue.value.length || props.data?.size;
|
});
|
||||||
// const params = {
|
loading.value = false;
|
||||||
// ...toRaw(formData.value),
|
resp.success && emit('change', true);
|
||||||
// properties: !!properties ? properties : [],
|
|
||||||
// productName,
|
|
||||||
// size,
|
|
||||||
// };
|
|
||||||
// loading.value = true;
|
|
||||||
// const response = !id
|
|
||||||
// ? await save(params)
|
|
||||||
// : await update({ ...props.data, ...params });
|
|
||||||
// if (response.status === 200) {
|
|
||||||
// message.success('操作成功');
|
|
||||||
// emit('change', true);
|
|
||||||
// }
|
|
||||||
// loading.value = false;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
onSubmit();
|
return view ? emit('change', false) : onSubmit();
|
||||||
};
|
};
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
emit('change', false);
|
emit('change', false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeSignMethod = () => {
|
const changeShareCluster = () => {
|
||||||
formData.value.deviceId = '';
|
formData.value.deviceId = undefined;
|
||||||
formData.value.url = '';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -256,16 +198,14 @@ watch(
|
||||||
() => props.data,
|
() => props.data,
|
||||||
(value) => {
|
(value) => {
|
||||||
if (value.id) {
|
if (value.id) {
|
||||||
formData.value = value;
|
formData.value = {
|
||||||
|
...value,
|
||||||
|
releaseType: value?.deviceId ? 'part' : 'all',
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true },
|
{ immediate: true, deep: true },
|
||||||
);
|
);
|
||||||
watch(
|
|
||||||
() => extraValue.value,
|
|
||||||
() => validate('deviceId'),
|
|
||||||
{ deep: true },
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -58,12 +58,14 @@
|
||||||
<Save v-if="visible" :data="current" @change="saveChange" />
|
<Save v-if="visible" :data="current" @change="saveChange" />
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="CertificatePage">
|
<script lang="ts" setup name="TaskPage">
|
||||||
import type { ActionsType } from '@/components/Table/index.vue';
|
import type { ActionsType } from '@/components/Table/index';
|
||||||
import { task, startTask, stopTask } from '@/api/device/firmware';
|
import { task, startTask, stopTask } from '@/api/device/firmware';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import Save from './Save/index.vue'
|
import Save from './Save/index.vue';
|
||||||
|
import { useMenuStore } from 'store/menu';
|
||||||
|
|
||||||
|
const menuStory = useMenuStore();
|
||||||
const tableRef = ref<Record<string, any>>({});
|
const tableRef = ref<Record<string, any>>({});
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -83,7 +85,6 @@ const columns = [
|
||||||
search: {
|
search: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
// scopedSlots: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '推送方式',
|
title: '推送方式',
|
||||||
|
@ -153,14 +154,14 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
|
|
||||||
const Actions = [
|
const Actions = [
|
||||||
{
|
{
|
||||||
key: 'edit',
|
key: 'details',
|
||||||
text: '详情',
|
text: '详情',
|
||||||
tooltip: {
|
tooltip: {
|
||||||
title: '详情',
|
title: '详情',
|
||||||
},
|
},
|
||||||
icon: 'EditOutlined',
|
icon: 'icon-details',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
handlEdit(data.id);
|
handlDetails(data.id);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -206,7 +207,7 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: 'PauseOutlined',
|
icon: 'ControlOutlined',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,21 +217,17 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
const handlAdd = () => {
|
const handlAdd = () => {
|
||||||
current.value = {};
|
current.value = {};
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlEye = (data: object) => {
|
const handlEye = (data: object) => {
|
||||||
current.value = toRaw(data);
|
current.value = toRaw({ ...data, view: true });
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlEdit = (id: string) => {
|
const handlDetails = (id: string) => {
|
||||||
// router.push({
|
// menuStory.jumpPage('device/Firmware/Task/Detail', { id });
|
||||||
// path: `/iot/link/certificate/detail/${id}`,
|
|
||||||
// query: { view: false },
|
|
||||||
// });
|
|
||||||
};
|
};
|
||||||
const saveChange = (value: FormDataType) => {
|
const saveChange = (value: boolean) => {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
current.value = {};
|
current.value = {};
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -248,9 +245,4 @@ const handleSearch = (e: any) => {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped></style>
|
||||||
.a {
|
|
||||||
// display: none;
|
|
||||||
visibility: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="AccessConfigPage">
|
<script lang="ts" setup name="AccessConfigPage">
|
||||||
import type { ActionsType } from '@/components/Table/index.vue';
|
import type { ActionsType } from '@/components/Table/index';
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
import {
|
import {
|
||||||
list,
|
list,
|
||||||
|
|
|
@ -59,8 +59,8 @@
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="CertificatePage">
|
<script lang="ts" setup name="CertificatePage">
|
||||||
import type { ActionsType } from '@/components/Table/index.vue';
|
import type { ActionsType } from '@/components/Table/index';
|
||||||
import { save, query, remove } from '@/api/link/certificate';
|
import { query, remove } from '@/api/link/certificate';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
const tableRef = ref<Record<string, any>>({});
|
const tableRef = ref<Record<string, any>>({});
|
||||||
|
|
|
@ -31,7 +31,9 @@
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="card-item-content">
|
<div class="card-item-content">
|
||||||
<h3 class="card-item-content-title card-item-content-title-a">
|
<h3
|
||||||
|
class="card-item-content-title card-item-content-title-a"
|
||||||
|
>
|
||||||
{{ slotProps.name }}
|
{{ slotProps.name }}
|
||||||
</h3>
|
</h3>
|
||||||
<a-row class="card-item-content-box">
|
<a-row class="card-item-content-box">
|
||||||
|
@ -148,7 +150,7 @@
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="AccessConfigPage">
|
<script lang="ts" setup name="AccessConfigPage">
|
||||||
import type { ActionsType } from '@/components/Table/index.vue';
|
import type { ActionsType } from '@/components/Table/index';
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
import { list, remove } from '@/api/link/protocol';
|
import { list, remove } from '@/api/link/protocol';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
@ -156,7 +158,6 @@ import Save from './Save/index.vue';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
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 visible = ref(false);
|
const visible = ref(false);
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="TypePage">
|
<script lang="ts" setup name="TypePage">
|
||||||
import type { ActionsType } from '@/components/Table/index.vue';
|
import type { ActionsType } from '@/components/Table/index'
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
import { supports, query, remove, start, shutdown } from '@/api/link/type';
|
import { supports, query, remove, start, shutdown } from '@/api/link/type';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
Loading…
Reference in New Issue