Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
easy 2023-02-08 18:16:21 +08:00
commit 09a3873546
5 changed files with 150 additions and 19 deletions

View File

@ -0,0 +1,59 @@
.config .title {
width: 100%;
margin-bottom: 10px;
color: rgba(0, 0, 0, 0.8);
font-weight: 600;
}
.config .title::before {
margin-right: 10px;
background-color: #2810ff;
content: '|';
}
.config .item {
margin-bottom: 10px;
}
.config .item .context {
margin: 5px 0;
color: rgba(0, 0, 0, 0.8);
}
.info {
display: flex;
align-items: center;
justify-content: center;
height: 630px;
padding: 20px;
background-color: #e6e6e6;
}
.driver .driver-next-btn {
color: #fff !important;
font-size: 14px !important;
line-height: 22px !important;
text-shadow: 0 0 black !important;
background-color: #2f54eb !important;
}
.driver .driver-prev-btn {
font-size: 14px !important;
line-height: 22px !important;
background-color: #fff !important;
}
.driver .driver-prev-btn.driver-disabled {
display: none !important;
}
.driver .driver-close-btn {
padding: 5px 0 0 0 !important;
color: #828282 !important;
font-size: 14px !important;
background-color: #fff !important;
border: none !important;
}
.driver .driver-popover-description {
margin-bottom: 10px !important;
}
.driver .driver-popover-title {
display: flex !important;
justify-content: space-between !important;
}
.driver .driver-popover-title #guide {
margin-top: 3px;
font-size: 14px;
}

View File

@ -487,6 +487,7 @@ defineExpose({
.button-style {
background-color: #fff;
height: 66px;
overflow: hidden;
.card-content {
width: 100%;
.img-style {
@ -498,23 +499,35 @@ defineExpose({
right: -22px;
bottom: -22px;
z-index: 2;
width: 44px;
height: 44px;
color: #2f54eb;
// background-color: #2f54eb;
color: #fff;
background-color: @primary-color-active;
transform: rotate(-45deg);
> div {
position: relative;
height: 100%;
transform: rotate(45deg);
background-color: transparent;
> span {
position: absolute;
top: 6px;
left: 6px;
font-size: 12px;
}
}
}
&.checked {
position: relative;
color: @primary-color-active;
border-color: @primary-color-active;
> .checked-icon {
display: block;
}
}
}
// &:hover {
// color: #2f54eb;
// border: 1px solid #2f54eb;
// }
}
</style>

View File

@ -15,9 +15,19 @@
:params="params"
>
<template #headerTitle>
<a-button type="primary" @click="add"
><plus-outlined />新增</a-button
>
<a-space>
<a-button type="primary" @click="add"
><plus-outlined />新增</a-button
>
<a-upload
name="file"
accept=".json"
:showUploadList="false"
:before-upload="beforeUpload"
>
<a-button>导入</a-button>
</a-upload>
</a-space>
</template>
<template #deviceType="slotProps">
<div>{{ slotProps.deviceType.text }}</div>
@ -172,8 +182,10 @@ import {
addProduct,
editProduct,
queryProductId,
updateDevice,
} from '@/api/device/product';
import { isNoCommunity } from '@/utils/utils';
import { isNoCommunity, downloadObject } from '@/utils/utils';
import { omit } from 'lodash-es';
import { typeOptions } from '@/components/Search/util';
import Save from './Save/index.vue';
/**
@ -293,6 +305,17 @@ const getActions = (
},
icon: 'icon-xiazai',
onClick: () => {
const extra = omit(data, [
'transportProtocol',
'protocolName',
'accessId',
'accessName',
'accessProvider',
'messageProtocol',
]);
downloadObject(extra, '产品');
},
},
{
key: 'action',
@ -356,6 +379,42 @@ const add = () => {
saveRef.value.show(currentForm.value);
});
};
/**
* 导入
*/
const beforeUpload = (file: any) => {
const reader = new FileReader();
reader.readAsText(file);
reader.onload = async (result) => {
const text = result.target?.result;
console.log('text: ', text);
if (!file.type.includes('json')) {
message.error('请上传json格式文件');
return false;
}
try {
const data = JSON.parse(text || '{}');
//
data.state = 0;
if (Array.isArray(data)) {
message.error('请上传json格式文件');
return false;
}
delete data.state;
const res = await updateDevice(data);
if (res.status === 200) {
message.success('操作成功');
tableRef.value?.reload();
}
return true;
} catch {
message.error('请上传json格式文件');
}
return true;
};
return false;
};
/**
* 查看
*/

View File

@ -119,7 +119,7 @@
<Guide title="数据统计" />
<div class="static-info" style="min-height: 490px">
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="flow-info" style="width: 100%">
<div class="label">昨日流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
@ -137,7 +137,7 @@
/>
</div>
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="flow-info" style="width: 100%">
<div class="label">当月流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
@ -152,7 +152,7 @@
<LineChart :chartData="monthOptions" />
</div>
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="flow-info" style="width: 100%">
<div class="label">本年流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
@ -328,7 +328,7 @@ getDataTotal();
align-items: center;
padding: 20px;
.info {
.flow-info {
// width: 180px;
width: 28%;
.label {

View File

@ -7,7 +7,7 @@
<a-col :span="24"><Guide title="数据统计" /></a-col>
<a-col :span="8">
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="flow-info" style="width: 100%">
<div class="label">昨日流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
@ -27,7 +27,7 @@
</a-col>
<a-col :span="8">
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="flow-info" style="width: 100%">
<div class="label">当月流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
@ -44,7 +44,7 @@
</a-col>
<a-col :span="8">
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="flow-info" style="width: 100%">
<div class="label">本年流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
@ -279,7 +279,7 @@ getDataTotal();
align-items: center;
padding: 20px;
.info {
.flow-info {
// width: 180px;
width: 28%;
.label {