This commit is contained in:
GGJ
2024-08-21 08:43:36 +08:00
6 changed files with 100 additions and 15 deletions

View File

@@ -51,7 +51,6 @@
<PopupPwd ref="popupPwd" />
<AdminInfo ref="popupAdminInfo" />
<!-- <TerminalVue /> -->
</div>
</template>
@@ -69,6 +68,7 @@ import html2canvas from 'html2canvas'
import PopupPwd from './popup/password.vue'
import AdminInfo from './popup/adminInfo.vue'
import { useNavTabs } from '@/stores/navTabs'
const adminInfo = useAdminInfo()
const navTabs = useNavTabs()
const configStore = useConfig()
@@ -114,6 +114,8 @@ const handleCommand = (key: string) => {
break
case 'layout':
navTabs.closeTabs()
window.localStorage.clear()
adminInfo.reset()
router.push({ name: 'login' })
break
default:

View File

@@ -47,6 +47,46 @@ export const useAdminInfo = defineStore('adminInfo', {
dataFill(state: AdminInfo) {
this.$state = { ...this.$state, ...state }
},
reset() {
this.$state = {
access_token: '',
token_type: '',
refresh_token: '',
expires_in: 0,
scope: '',
nickname: '',
userType: 0,
deptIndex: '',
userIndex: '',
client_id: '',
headSculpture: '',
jti: '',
name: '',
deptId: '',
phone: '',
email: '',
limitIpStart: '',
limitIpEnd: '',
limitTime: '',
casualUser: 0,
type: 0,
smsNotice: 0,
emailNotice: 0,
role: [],
devCode: '',
id: '',
loginName: '',
state: 0,
registerTime: '',
loginTime: '',
deptName: '',
areaId: '',
areaName: '',
deptLevel: 0,
roleList: [],
roleCode: []
}
},
removeToken() {
this.access_token = ''
this.refresh_token = ''

View File

@@ -13,11 +13,21 @@
<DatePicker ref="datePickerRef"></DatePicker>
</el-form-item>
<el-form-item label="值类型">
<el-select v-model="form.dataLevel">
<el-select v-model="form.dataLevel" :disabled="props.dataLevel == 'Primary'">
<el-option value="Primary" label="一次值"></el-option>
<el-option value="Secondary" label="二次值"></el-option>
</el-select>
</el-form-item>
<el-form-item label="数据类型" label-width="80px">
<el-select v-model="form.statMethod" placeholder="请选择值类型">
<el-option
v-for="item in typeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-Search" @click="init">查询</el-button>
</el-form-item>
@@ -36,11 +46,15 @@ import MyEchart from '@/components/echarts/MyEchart.vue'
interface Props {
detail: anyObj
dataLevel: string
}
const props = withDefaults(defineProps<Props>(), {
detail: () => {
return {}
},
dataLevel: () => {
return ''
}
})
const datePickerRef = ref()
@@ -54,26 +68,52 @@ const form: any = reactive({
remark: '',
routeName: '',
sort: 100,
type: 0,
dataLevel: ''
dataLevel: '',
statMethod: 'avg'
})
const typeOptions = [
{
name: '平均值',
id: 'avg'
},
{
name: '最大值',
id: 'max'
},
{
name: '最小值',
id: 'min'
},
{
name: 'CP95值',
id: 'cp95'
}
]
const echartsData = ref<any>(null)
const dialogVisible = ref(false)
const loading = ref(true)
onMounted(() => {
form.dataLevel = props.detail.dataLevel
if (props.dataLevel == 'Secondary') {
form.dataLevel = 'Primary'
}else{
form.dataLevel=props.dataLevel
}
init()
})
const init = () => {
echartsData.value = null
loading.value = true
console.log(props.detail.children, 'props.detail.children')
let statisticalParams = props.detail.children
statisticalParams[0].statMethod = form.statMethod
getDeviceDataTrend({
devId: props.detail.devId,
endTime: datePickerRef.value.timeValue[1],
lineId: props.detail.lineId,
startTime: datePickerRef.value.timeValue[0],
statisticalParams: props.detail.children,
dataLevel: form.dataLevel
statisticalParams: statisticalParams,
dataLevel: form.dataLevel,
statMethod: form.statMethod
}).then(res => {
if (res.data.length && res.data[0].length) {
let arr: any[] = []

View File

@@ -91,7 +91,7 @@
<DatePicker ref="datePickerRef"></DatePicker>
</el-form-item>
<el-form-item label="值类型">
<el-select v-model="formInline.dataLevel">
<el-select v-model="formInline.dataLevel" :disabled="dataLevel == 'Primary'">
<el-option value="Primary" label="一次值"></el-option>
<el-option value="Secondary" label="二次值"></el-option>
</el-select>
@@ -248,7 +248,7 @@
</el-tabs>
</div>
<el-empty v-else description="请选择设备" class="device-control-right" />
<Detail ref="detailRef" :detail="detail" @close="detail = null" v-if="detail"></Detail>
<Detail ref="detailRef" :detail="detail" @close="detail = null" :dataLevel="dataLevel" v-if="detail"></Detail>
<!-- 离线数据导入组件 -->
<offLineDataImport ref="offLineDataImportRef"></offLineDataImport>
<!-- 解析列表 -->
@@ -382,6 +382,9 @@ const nodeClick = async (e: anyObj) => {
deviceData.value = res.data
formInline.dataLevel = res.data.dataLevel
dataLevel.value = res.data.dataLevel
if (dataLevel.value == 'Secondary') {
formInline.dataLevel = 'Primary'
}
if (!res.data.dataSetList) {
dataSet.value = ''
tableData.value = []

View File

@@ -66,7 +66,7 @@
@cancel="cancelDelete"
>
<template #reference>
<el-button type="danger" text size="small">删除</el-button>
<el-button type="danger" text >删除</el-button>
</template>
</el-popconfirm>
</template>

View File

@@ -5,8 +5,8 @@
<div class="device-manage-right" v-if="deviceData">
<el-descriptions value="small" title="方案信息" class="mb10" :column="2" border>
<template #extra>
<el-button size="small" type="primary" @click="handleOpen(0, '')">新增方案</el-button>
<el-button type="primary" size="small" icon="el-icon-Download" @click="handleExport">
<el-button type="primary" @click="handleOpen(0, '')">新增方案</el-button>
<el-button type="primary" icon="el-icon-Download" @click="handleExport">
数据导出
</el-button>
</template>
@@ -83,10 +83,10 @@
{{ item.location }}
</el-descriptions-item>
<!-- <el-descriptions-item label="操作" width="160"> -->
<!-- <el-button type="primary" size="small" icon="el-icon-EditPen" @click="handleOpen(3)">
<!-- <el-button type="primary" icon="el-icon-EditPen" @click="handleOpen(3)">
修改
</el-button> -->
<!-- <el-button type="primary" size="small" icon="el-icon-InfoFilled" @click="openDevice">
<!-- <el-button type="primary" icon="el-icon-InfoFilled" @click="openDevice">
数据绑定
</el-button> -->
<!-- </el-descriptions-item> -->
@@ -150,7 +150,7 @@
</el-form-item>
</el-form>
<div class="history_searchBtn">
<el-button type="primary" size="small" icon="el-icon-Search" @click="init()">查询</el-button>
<el-button type="primary" icon="el-icon-Search" @click="init()">查询</el-button>
</div>
</div>
<div class="history_chart" v-loading="loading" v-show="echartsData">