瀏覽代碼

1、新增运行状态刷新

yukai 3 年之前
父節點
當前提交
314d3c082c

+ 1 - 0
src/api/device/index.ts

@@ -31,6 +31,7 @@ export default {
     getLogList: (params: object) => get('/product/log/search', params),
     getlogcate: (params: object) => get('/product/log/type', params),
     getrun_status: (params: object) => get('/product/device/run_status', params),
+    getLogDetail: (params: object) => get('/product/device/property/list', params),
   },
   dept: {
     getList: (params: object) => get('/system/dept/tree', params),

+ 4 - 1
src/views/datahub/source/component/editNode.vue

@@ -349,10 +349,13 @@ export default defineComponent({
 							//getOrgIdArr(parents, childNode,treeData[key])
 							break
 						} else {
+							
 							if (treeData[key] instanceof Object) {
 							//	没找到,遍历该节点的子节点
-								parents.push(key)
+								parents.push(key)	
+							
 								getOrgIdArr(parents, childNode, treeData[key])
+								
 								break
 							}
 						}

+ 1 - 1
src/views/datahub/source/index.vue

@@ -89,7 +89,7 @@
 						>
 							<span>详情</span>
 						</router-link>
-						<el-button size="small" text type="success" @click="onOpenList(scope.row)">数据记录</el-button>
+						<el-button size="small" text type="success" @click="onOpenList(scope.row)"  v-if="scope.row.status==1">数据记录</el-button>
 						<el-button size="small" text type="warning" @click="onOpenEdit(scope.row)" v-if="scope.row.status==0">修改</el-button>
 						<el-button size="small" text type="danger" @click="onRowDel(scope.row)" v-if="scope.row.status==0">删除</el-button>
 					</template>

+ 147 - 0
src/views/device/instance/component/list.vue

@@ -0,0 +1,147 @@
+<template>
+	<div class="system-edit-dic-container">
+		<el-dialog  v-model="isShowDialog" :show-close="false"  width="75%" :fullscreen="dialogFullScreen">
+		 <template #header="{ close, titleId, titleClass }">
+      <div class="my-header">
+        <h4 :id="titleId" :class="titleClass">数据记录</h4>
+		 
+		 <div>
+            <i class="iconfont "  :class="!dialogFullScreen ? 'icon-fullscreen' : 'icon-tuichuquanping'"   @click="quanping"  style="font-size: 22px;cursor: pointer;"></i>
+			<i class="el-icon"  @click="close" style="font-size: 22px;cursor: pointer;    margin-left: 10px; position: relative; top: 3px;"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-029747aa=""><path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg></i>
+			
+		</div>
+      </div>
+    </template>
+
+			<el-table :data="tableData.data" style="width: 100%"  v-loading="tableData.loading">
+				<el-table-column label="时间" prop="ts" :show-overflow-tooltip="true" />
+				<el-table-column label="属性值" prop="value" :show-overflow-tooltip="true" />
+			</el-table>
+			<pagination
+				v-show="tableData.total > 0"
+				:total="tableData.total"
+				v-model:page="tableData.param.pageNum"
+				v-model:limit="tableData.param.pageSize"
+				@pagination="typeList"
+			/>
+		</el-dialog>
+	</div>
+</template>
+
+<script lang="ts">
+import { reactive, toRefs, defineComponent, ref, unref } from 'vue';
+import { Close } from '@element-plus/icons-vue';
+
+import api from '/@/api/device';
+import { ElMessage } from 'element-plus';
+
+interface DicState {
+	isShowDialog: boolean;
+}
+
+// 定义接口来定义对象的类型
+interface TableDataRow {
+	id: number;
+	name: string;
+	key: string;
+
+	createBy: string;
+}
+interface TableDataState {
+	ids: number[];
+	tableData: {
+		data: Array<TableDataRow>;
+		total: number;
+		loading: boolean;
+		param: {
+			pageNum: number;
+			pageSize: number;
+			id: number;
+		};
+	};
+}
+
+export default defineComponent({
+	name: 'deviceEditPro',
+	setup(prop, { emit }) {
+		const formRef = ref<HTMLElement | null>(null);
+		const state = reactive<DicState>({
+			isShowDialog: false,
+		    dialogFullScreen: false,
+			tableData: {
+				data: [],
+				total: 0,
+				loading: false,
+				param: {
+					pageNum: 1,
+					pageSize: 10,
+					id: 0,
+					propertyKey:'',
+				},
+			},
+		});
+		// 打开弹窗
+		const openDialog = (row: RuleFormState | null,devid) => {
+			resetForm();
+			if (row) {
+				console.log(row);
+				state.tableData.param.id = devid;
+				state.tableData.param.propertyKey=row.key
+				typeList();
+
+			}
+			state.isShowDialog = true;
+		};
+
+		const typeList = () => {
+			state.tableData.loading = true;
+			api.instance.getLogDetail(state.tableData.param).then((res: any) => {
+				state.tableData.data = res.List;
+				state.tableData.total = res.Total;
+				//state.ruleForm = res.data.dictType
+			}).finally(() => (state.tableData.loading = false));
+
+		};
+		const resetForm = () => {
+			state.tableData= {
+				data: [],
+				total: 0,
+				loading: false,
+				param: {
+					pageNum: 1,
+					pageSize: 10,
+				},
+			}
+		};
+		// 关闭弹窗
+		const closeDialog = () => {
+			state.isShowDialog = false;
+		};
+		const quanping=()=>{
+			state.dialogFullScreen = state.dialogFullScreen?false:true;
+		}
+		// 取消
+		const onCancel = () => {
+			closeDialog();
+		};
+
+		return {
+            Close,
+			quanping,
+			typeList,
+			openDialog,
+			closeDialog,
+			onCancel,
+			formRef,
+			...toRefs(state),
+		};
+	},
+});
+</script>
+<style scoped>
+.my-header {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+}
+</style>

+ 19 - 5
src/views/device/instance/detail.vue

@@ -177,7 +177,7 @@
 								<div class="cardflex">
 									<div>设备状态</div>
 									<div @click="getrunData()" style="cursor: pointer;">
-										<el-icon>
+										<el-icon style="font-size: 18px;">
 											<ele-Refresh />
 										</el-icon>
 									</div>
@@ -197,10 +197,13 @@
 							<div class="ant-card-body">
 								<div class="cardflex">
 									<div>{{item.name}}</div>
-									<div @click="getrunData()" style="cursor: pointer;">
-										<el-icon >
+									<div style="cursor: pointer;">
+										<el-icon  style="font-size: 18px;"  @click="getrunData()">
 											<ele-Refresh />
 										</el-icon>
+										<el-icon  style="font-size: 18px;    margin-left: 10px;" @click="onOpenListDetail(item)">
+											<ele-Expand />
+										</el-icon>
 									</div>
 								</div>
 
@@ -279,6 +282,7 @@
 		<EditFun ref="editFunRef" @typeList="getfunction" />
 		<EditEvent ref="editEventRef" @typeList="getevent" />
 		<EditTab ref="editTabRef" @typeList="gettab" />
+		<ListDic ref="listDicRef"  />
 
 		<el-dialog v-model="dialogVisible" title="返回Json数据" width="30%">
 			<JsonViewer :value="jsonData" boxed sort theme="jv-dark" @click="onKeyclick" />
@@ -303,6 +307,8 @@ import EditFun from '../product/component/editFun.vue';
 import EditEvent from '../product/component/editEvent.vue';
 import EditTab from '../product/component/editTab.vue';
 import devantd from '/@/components/devantd/index.vue';
+import ListDic from './component/list.vue';
+
 
 import { useRoute } from 'vue-router';
 
@@ -339,13 +345,14 @@ interface TableDataState {
 }
 export default defineComponent({
 	name: 'deviceEditPro',
-	components: { EditDic, EditAttr, EditFun, EditEvent, EditTab,devantd },
+	components: { EditDic, EditAttr, EditFun, EditEvent, EditTab,devantd,ListDic },
 
 	setup(prop, context) {
 		const route = useRoute();
 		const editDicRef = ref();
 		const editAttrRef = ref();
 		const editFunRef = ref();
+		const listDicRef=ref();
 		const editEventRef = ref();
 		const editTabRef = ref();
 		const state = reactive<TableDataState>({
@@ -451,6 +458,11 @@ export default defineComponent({
 			editTabRef.value.openDialog({ product_id: state.product_id, id: 0, accessMode: 0 });
 		};
 
+		//查看日志列表
+		const onOpenListDetail=(row: TableDataRow)=>{
+			listDicRef.value.openDialog(row, state.detail.id);
+		};
+
 		// 打开修改产品弹窗
 		const onOpenEditDic = (row: TableDataRow) => {
 			editDicRef.value.openDialog(row);
@@ -628,9 +640,11 @@ export default defineComponent({
 			tinyAreas,
 			editDicRef,
 			editAttrRef,
+			listDicRef,
 			editFunRef,
 			editEventRef,
 			editTabRef,
+			onOpenListDetail,
 			getrunData,
 			getlog,
 			getlogtype,
@@ -789,7 +803,7 @@ tr {
 .ant-card {
 	box-sizing: border-box;
 	margin: 10px;
-	width: 23.9%;
+	width: 23.8%;
 	color: rgba(0, 0, 0, 0.65);
 	font-size: 14px;
 	font-variant: tabular-nums;