detail.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. <template>
  2. <div class="system-dic-container">
  3. <div class="content">
  4. <div class="cont_box">
  5. <div class="title">设备:{{ detail.name }}</div>
  6. <div class="pro-status"><span :class="developer_status == 2 ? 'on' : 'off'"></span>{{ developer_status == 2 ? '在线' : '离线' }}</div>
  7. <!-- <div class="pro-option" @click="CkOption">{{ developer_status == 2 ? '下线' : '上线' }}</div> -->
  8. </div>
  9. </div>
  10. <div class="content-box">
  11. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  12. <el-tab-pane label="运行状态" name="3">
  13. <div style=" display: flex; padding: 10px;flex-wrap: wrap;" >
  14. <div class="ant-card">
  15. <div class="ant-card-body">
  16. <div class="cardflex">
  17. <div>设备状态</div>
  18. <div @click="getrunData()" style="cursor: pointer;">
  19. <el-icon style="font-size: 18px;">
  20. <ele-Refresh />
  21. </el-icon>
  22. </div>
  23. </div>
  24. <div class="statusname" v-if="areaData.status==0">未启用</div>
  25. <div class="statusname" v-if="areaData.status==1">离线</div>
  26. <div class="statusname" v-if="areaData.status==2">在线</div>
  27. <div class="cardflex comtest">
  28. <div> 数据时间</div>
  29. <div>{{areaData.lastOnlineTime || '未启用'}}</div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="ant-card" v-for="(item, index) in areaData.properties" :key="index">
  34. <div class="ant-card-body">
  35. <div class="cardflex">
  36. <div>{{item.name}}</div>
  37. <div style="cursor: pointer;">
  38. <el-icon style="font-size: 18px;" @click="getrunData()">
  39. <ele-Refresh />
  40. </el-icon>
  41. <el-icon style="font-size: 18px; margin-left: 10px;" @click="onOpenListDetail(item)">
  42. <ele-Expand />
  43. </el-icon>
  44. </div>
  45. </div>
  46. <div class="statusname">{{item.value}}{{item.unit}}</div>
  47. <div class="">
  48. <devantd :json="item.list" :antdid="item.key" v-if="item.type=='int' || item.type=='float'"/>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </el-tab-pane>
  54. <el-tab-pane label="设备信息" name="1">
  55. <div class="pro-box">
  56. <div class="protitle">设备信息</div>
  57. <div>
  58. <el-button type="primary" @click="onOpenEditDic(detail)">编辑</el-button>
  59. </div>
  60. </div>
  61. <div class="ant-descriptions-view">
  62. <table>
  63. <tbody>
  64. <tr class="ant-descriptions-row">
  65. <th class="ant-descriptions-item-label ant-descriptions-item-colon">设备标识</th>
  66. <td class="ant-descriptions-item-content" colspan="1">{{ detail.key }}</td>
  67. <th class="ant-descriptions-item-label ant-descriptions-item-colon">设备名称</th>
  68. <td class="ant-descriptions-item-content" colspan="1">{{ detail.name }}</td>
  69. <th class="ant-descriptions-item-label ant-descriptions-item-colon">所属产品</th>
  70. <td class="ant-descriptions-item-content" colspan="1">{{ detail.productName }}</td>
  71. </tr>
  72. <tr class="ant-descriptions-row">
  73. <th class="ant-descriptions-item-label ant-descriptions-item-colon">消息协议</th>
  74. <td class="ant-descriptions-item-content" colspan="1">{{ prodetail.messageProtocol }}</td>
  75. <th class="ant-descriptions-item-label ant-descriptions-item-colon">链接协议</th>
  76. <td class="ant-descriptions-item-content" colspan="1">{{ prodetail.transportProtocol }}</td>
  77. <th class="ant-descriptions-item-label ant-descriptions-item-colon">设备类型</th>
  78. <td class="ant-descriptions-item-content" colspan="1">{{ prodetail.deviceType }}</td>
  79. </tr>
  80. <tr class="ant-descriptions-row">
  81. <th class="ant-descriptions-item-label ant-descriptions-item-colon">固件版本</th>
  82. <td class="ant-descriptions-item-content" colspan="1">{{ prodetail.version }}</td>
  83. <th class="ant-descriptions-item-label ant-descriptions-item-colon">注册时间</th>
  84. <td class="ant-descriptions-item-content" colspan="1">{{ prodetail.updatedAt }}</td>
  85. <th class="ant-descriptions-item-label ant-descriptions-item-colon">最后上线时间</th>
  86. <td class="ant-descriptions-item-content" colspan="1">{{ prodetail.lastOnlineTime || '' }}</td>
  87. </tr>
  88. <tr class="ant-descriptions-row">
  89. <th class="ant-descriptions-item-label ant-descriptions-item-colon">说明</th>
  90. <td class="ant-descriptions-item-content" colspan="5">{{ prodetail.desc }}</td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. </div>
  95. </el-tab-pane>
  96. <el-tab-pane label="物模型" name="2">
  97. <div class="wu-box">
  98. <el-tabs type="border-card" v-model="activetab" @tab-click="wuhandleClick">
  99. <el-tab-pane label="属性定义" name="attr">
  100. <div class="wu-title">
  101. <div class="title">属性定义</div>
  102. <div>
  103. <el-button type="primary" @click="onOpenEditAttr()">添加</el-button>
  104. </div>
  105. </div>
  106. <el-table style="width: 100%" :data="tableData.data" v-if="activetab == 'attr'">
  107. <el-table-column label="属性标识" align="center" prop="key" />
  108. <el-table-column label="属性名称" prop="name" :show-overflow-tooltip="true" />
  109. <el-table-column prop="valueType" label="数据类型" width="120" align="center">
  110. <template #default="scope">
  111. <span>{{ scope.row.valueType.type }}</span>
  112. </template>
  113. </el-table-column>
  114. <el-table-column prop="accessMode" label="是否只读" width="120" align="center">
  115. <template #default="scope">
  116. <el-tag type="info" size="small" v-if="scope.row.accessMode">只读</el-tag>
  117. <el-tag type="success" size="small" v-else>读写</el-tag>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="说明" prop="desc" :show-overflow-tooltip="true" />
  121. <el-table-column label="操作" width="300" align="center" fixed="right">
  122. <template #default="scope">
  123. <el-button size="small" text type="warning" @click="onEditAttr(scope.row)">修改</el-button>
  124. <el-button size="small" text type="danger" @click="onRowDel(scope.row.key, 'attr')">删除</el-button>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. </el-tab-pane>
  129. <el-tab-pane label="功能定义" name="fun">
  130. <div class="wu-title">
  131. <div class="title">功能定义</div>
  132. <div>
  133. <el-button type="primary" @click="onOpenEditFun()">添加</el-button>
  134. </div>
  135. </div>
  136. <el-table style="width: 100%" :data="tableData.data" v-if="activetab == 'fun'">
  137. <el-table-column label="功能标识" align="center" prop="key" />
  138. <el-table-column label="名称" prop="name" :show-overflow-tooltip="true" />
  139. <el-table-column label="描述" prop="desc" :show-overflow-tooltip="true" />
  140. <el-table-column label="操作" width="300" align="center" fixed="right">
  141. <template #default="scope">
  142. <el-button size="small" text type="warning" @click="onEditFun(scope.row)">修改</el-button>
  143. <el-button size="small" text type="danger" @click="onRowDel(scope.row.key, 'fun')">删除</el-button>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. </el-tab-pane>
  148. <el-tab-pane label="事件定义" name="event">
  149. <div class="wu-title">
  150. <div class="title">事件定义</div>
  151. <div>
  152. <el-button type="primary" @click="onOpenEditEvent()">添加</el-button>
  153. </div>
  154. </div>
  155. <el-table style="width: 100%" :data="tableData.data" v-if="activetab == 'event'">
  156. <el-table-column label="事件标识" align="center" prop="key" />
  157. <el-table-column label="名称" prop="name" :show-overflow-tooltip="true" />
  158. <el-table-column prop="level" label="事件级别" width="120" align="center">
  159. <template #default="scope">
  160. <el-tag type="primary" size="small" v-if="scope.row.level == 0">普通</el-tag>
  161. <el-tag type="warning" size="small" v-if="scope.row.level == 1">警告</el-tag>
  162. <el-tag type="danger" size="small" v-if="scope.row.level == 2">紧急</el-tag>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="描述" prop="desc" :show-overflow-tooltip="true" />
  166. <el-table-column label="操作" width="300" align="center" fixed="right">
  167. <template #default="scope">
  168. <el-button size="small" text type="warning" @click="onEditEvent(scope.row)">修改</el-button>
  169. <el-button size="small" text type="danger" @click="onRowDel(scope.row.key, 'event')">删除</el-button>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. </el-tab-pane>
  174. <el-tab-pane label="标签定义" name="tab">
  175. <div class="wu-title">
  176. <div class="title">标签定义</div>
  177. <div>
  178. <el-button type="primary" @click="onOpenEditTab()">添加</el-button>
  179. </div>
  180. </div>
  181. <el-table style="width: 100%" :data="tableData.data" v-if="activetab == 'tab'">
  182. <el-table-column label="属性标识" align="center" prop="key" />
  183. <el-table-column label="属性名称" prop="name" :show-overflow-tooltip="true" />
  184. <el-table-column prop="valueType" label="数据类型" width="120" align="center">
  185. <template #default="scope">
  186. <span>{{ scope.row.valueType.type }}</span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column prop="accessMode" label="是否只读" width="120" align="center">
  190. <template #default="scope">
  191. <el-tag type="info" size="small" v-if="scope.row.accessMode">只读</el-tag>
  192. <el-tag type="success" size="small" v-else>读写</el-tag>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="描述" prop="desc" :show-overflow-tooltip="true" />
  196. <el-table-column label="操作" width="300" align="center" fixed="right">
  197. <template #default="scope">
  198. <el-button size="small" text type="warning" @click="onEditTag(scope.row)">修改</el-button>
  199. <el-button size="small" text type="danger" @click="onRowDel(scope.row.key, 'tab')">删除</el-button>
  200. </template>
  201. </el-table-column>
  202. </el-table>
  203. </el-tab-pane>
  204. </el-tabs>
  205. <pagination v-show="tableData.total > 0" :total="tableData.total" v-model:page="tableData.param.pageNum" v-model:limit="tableData.param.pageSize" @pagination="getList" />
  206. </div>
  207. </el-tab-pane>
  208. <el-tab-pane label="日志管理" name="4">
  209. <div class="system-user-search mb15">
  210. <el-form :model="logtableData.param" ref="queryRef" :inline="true" label-width="68px">
  211. <el-form-item label="日志类型" prop="types">
  212. <el-select v-model="logtableData.param.types" placeholder="日志类型" clearable size="default">
  213. <el-option v-for="item in logTypeData" :key="item" :label="item" :value="item" />
  214. </el-select>
  215. </el-form-item>
  216. <el-form-item label="创建时间" prop="dateRange">
  217. <el-date-picker v-model="logtableData.param.dateRange" size="default" value-format="YYYY-MM-DD" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  218. </el-form-item>
  219. <el-form-item>
  220. <el-button size="default" type="primary" class="ml10" @click="getlog">
  221. <el-icon>
  222. <ele-Search />
  223. </el-icon>
  224. 查询
  225. </el-button>
  226. <el-button size="default" @click="resetQuery(queryRef)">
  227. <el-icon>
  228. <ele-Refresh />
  229. </el-icon>
  230. 重置
  231. </el-button>
  232. </el-form-item>
  233. </el-form>
  234. </div>
  235. <el-table style="width: 100%" :data="logtableData.data">
  236. <el-table-column label="类型" align="center" prop="type" />
  237. <el-table-column label="时间" prop="ts" :show-overflow-tooltip="true" />
  238. <el-table-column label="内容" prop="content" :show-overflow-tooltip="true" />
  239. <el-table-column label="操作" width="300" align="center" fixed="right">
  240. <template #default="scope">
  241. <el-button size="small" text type="warning" @click="onLogDetail(scope.row)">查看</el-button>
  242. </template>
  243. </el-table-column>
  244. </el-table>
  245. <pagination v-show="logtableData.total > 0" :total="logtableData.total" v-model:page="logtableData.param.pageNum" v-model:limit="logtableData.param.pageSize" @pagination="getlog" />
  246. </el-tab-pane>
  247. </el-tabs>
  248. </div>
  249. <EditDic ref="editDicRef" @typeList="typeList" />
  250. <EditAttr ref="editAttrRef" @typeList="getproperty" />
  251. <EditFun ref="editFunRef" @typeList="getfunction" />
  252. <EditEvent ref="editEventRef" @typeList="getevent" />
  253. <EditTab ref="editTabRef" @typeList="gettab" />
  254. <ListDic ref="listDicRef" />
  255. <el-dialog v-model="dialogVisible" title="返回Json数据" width="30%">
  256. <JsonViewer :value="jsonData" boxed sort theme="jv-dark" @click="onKeyclick" />
  257. <template #footer>
  258. <span class="dialog-footer">
  259. <el-button @click="dialogVisible = false">关闭</el-button>
  260. </span>
  261. </template>
  262. </el-dialog>
  263. </div>
  264. </template>
  265. <script lang="ts">
  266. import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue';
  267. import { ElMessageBox, ElMessage, FormInstance } from 'element-plus';
  268. import 'vue3-json-viewer/dist/index.css';
  269. import EditDic from '../product/component/editPro.vue';
  270. import EditAttr from '../product/component/editAttr.vue';
  271. import EditFun from '../product/component/editFun.vue';
  272. import EditEvent from '../product/component/editEvent.vue';
  273. import EditTab from '../product/component/editTab.vue';
  274. import devantd from '/@/components/devantd/index.vue';
  275. import ListDic from './component/list.vue';
  276. import { useRoute } from 'vue-router';
  277. import api from '/@/api/device';
  278. interface TableDataState {
  279. ids: number[];
  280. tableData: {
  281. data: [];
  282. total: number;
  283. loading: boolean;
  284. param: {
  285. pageNum: number;
  286. pageSize: number;
  287. name: string;
  288. deviceType: string;
  289. status: string;
  290. dateRange: string[];
  291. };
  292. };
  293. logtableData: {
  294. data: [];
  295. total: number;
  296. loading: boolean;
  297. param: {
  298. pageNum: number;
  299. pageSize: number;
  300. name: string;
  301. deviceType: string;
  302. status: string;
  303. dateRange: string[];
  304. };
  305. };
  306. }
  307. export default defineComponent({
  308. name: 'deviceEditPro',
  309. components: { EditDic, EditAttr, EditFun, EditEvent, EditTab, devantd, ListDic },
  310. setup(prop, context) {
  311. const route = useRoute();
  312. const editDicRef = ref();
  313. const editAttrRef = ref();
  314. const editFunRef = ref();
  315. const listDicRef=ref();
  316. const editEventRef = ref();
  317. const editTabRef = ref();
  318. const state = reactive<TableDataState>({
  319. areaData:[],
  320. isShowDialog: false,
  321. dialogVisible: false,
  322. logTypeData: [],
  323. jsonData: '',
  324. activeName: '3', // 分类数据
  325. activetab: 'attr', // 分类数据
  326. detail: [],
  327. prodetail: [],
  328. product_id: 0,
  329. developer_status: 0,
  330. tableData: {
  331. data: [],
  332. total: 0,
  333. loading: false,
  334. param: {
  335. pageNum: 1,
  336. productId: 0,
  337. pageSize: 10,
  338. status: '',
  339. dateRange: [],
  340. },
  341. },
  342. logtableData: {
  343. data: [],
  344. total: 0,
  345. loading: false,
  346. param: {
  347. pageNum: 1,
  348. productId: 0,
  349. pageSize: 10,
  350. status: '',
  351. dateRange: [],
  352. },
  353. },
  354. });
  355. onMounted(() => {
  356. const ids = route.params && route.params.id;
  357. api.instance.detail(ids).then((res: any) => {
  358. state.detail = res.data;
  359. state.developer_status = res.data.status;
  360. state.tableData.param.productId = res.data.product.id;
  361. state.product_id = res.data.product.id;
  362. getrunData();
  363. api.product.detail(res.data.product.id).then((res: any) => {
  364. state.prodetail = res.data;
  365. console.log(res.data);
  366. });
  367. //第一次加载
  368. api.model.property(state.tableData.param).then((res: any) => {
  369. state.tableData.data = res.Data;
  370. state.tableData.total = res.Total;
  371. });
  372. });
  373. });
  374. const onLogDetail = (row: TableDataRow) => {
  375. state.jsonData = JSON.parse(row.content);
  376. console.log(JSON.parse(row.content));
  377. state.dialogVisible = true;
  378. };
  379. //编辑属性
  380. const onEditAttr = (row: TableDataRow) => {
  381. editAttrRef.value.openDialog(row, state.product_id);
  382. };
  383. //编辑功能
  384. const onEditFun = (row: TableDataRow) => {
  385. editFunRef.value.openDialog(row, state.product_id);
  386. };
  387. //编辑事件
  388. const onEditEvent = (row: TableDataRow) => {
  389. editEventRef.value.openDialog(row, state.product_id);
  390. };
  391. //编辑标签
  392. const onEditTag = (row: TableDataRow) => {
  393. editTabRef.value.openDialog(row, state.product_id);
  394. };
  395. //打开添加属性弹窗
  396. const onOpenEditAttr = () => {
  397. editAttrRef.value.openDialog({ product_id: state.product_id, id: 0, accessMode: 0 });
  398. };
  399. //打开添加功能弹窗
  400. const onOpenEditFun = () => {
  401. editFunRef.value.openDialog({ product_id: state.product_id, id: 0 });
  402. };
  403. //打开添加事件弹窗
  404. const onOpenEditEvent = () => {
  405. editEventRef.value.openDialog({ product_id: state.product_id, id: 0, level: 0 });
  406. };
  407. //打开添加事件弹窗
  408. const onOpenEditTab = () => {
  409. editTabRef.value.openDialog({ product_id: state.product_id, id: 0, accessMode: 0 });
  410. };
  411. //查看日志列表
  412. const onOpenListDetail = (row: TableDataRow) => {
  413. listDicRef.value.openDialog(row, state.detail.id);
  414. };
  415. // 打开修改产品弹窗
  416. const onOpenEditDic = (row: TableDataRow) => {
  417. editDicRef.value.openDialog(row);
  418. };
  419. // 删除产品
  420. const onRowDel = (key, type) => {
  421. let msg = `此操作将永久删除该数据吗?,是否继续?`;
  422. if (key.length === 0) {
  423. ElMessage.error('请选择要删除的数据。');
  424. return;
  425. }
  426. ElMessageBox.confirm(msg, '提示', {
  427. confirmButtonText: '确认',
  428. cancelButtonText: '取消',
  429. type: 'warning',
  430. })
  431. .then(() => {
  432. if (type == 'attr') {
  433. api.model.propertydel(state.product_id, key).then(() => {
  434. ElMessage.success('删除成功');
  435. getproperty();
  436. });
  437. }
  438. if (type == 'fun') {
  439. api.model.functiondel(state.product_id, key).then(() => {
  440. ElMessage.success('删除成功');
  441. getfunction();
  442. });
  443. }
  444. if (type == 'event') {
  445. api.model.eventdel(state.product_id, key).then(() => {
  446. ElMessage.success('删除成功');
  447. getevent();
  448. });
  449. }
  450. if (type == 'tab') {
  451. api.model.tagdel(state.product_id, key).then(() => {
  452. ElMessage.success('删除成功');
  453. tagdel();
  454. });
  455. }
  456. })
  457. .catch(() => { });
  458. };
  459. //根据不同类型获取列表
  460. const getList = () => {
  461. switch (state.activetab) {
  462. case 'attr':
  463. getproperty();
  464. break;
  465. case 'fun':
  466. getfunction();
  467. break;
  468. case 'event':
  469. getevent();
  470. break;
  471. case 'tab':
  472. gettab();
  473. break;
  474. }
  475. };
  476. const getproperty = () => {
  477. api.model.property(state.tableData.param).then((res: any) => {
  478. state.tableData.data = res.Data;
  479. state.tableData.total = res.Total;
  480. });
  481. };
  482. const getfunction = () => {
  483. api.model.function(state.tableData.param).then((res: any) => {
  484. state.tableData.data = res.Data;
  485. state.tableData.total = res.Total;
  486. });
  487. };
  488. const getevent = () => {
  489. api.model.event(state.tableData.param).then((res: any) => {
  490. state.tableData.data = res.Data;
  491. state.tableData.total = res.Total;
  492. });
  493. };
  494. const gettab = () => {
  495. api.model.tag(state.tableData.param).then((res: any) => {
  496. state.tableData.data = res.Data;
  497. state.tableData.total = res.Total;
  498. });
  499. };
  500. const wuhandleClick = (tab: TabsPaneContext) => {
  501. state.activetab = tab.props.name;
  502. switch (tab.props.name) {
  503. case 'attr':
  504. getproperty();
  505. break;
  506. case 'fun':
  507. getfunction();
  508. break;
  509. case 'event':
  510. getevent();
  511. break;
  512. case 'tab':
  513. gettab();
  514. break;
  515. }
  516. };
  517. const handleClick = (tab: TabsPaneContext, event: Event) => {
  518. console.log(tab, event);
  519. if (tab.props.name == 4) {
  520. //获取日志
  521. getlog();
  522. getlogtype();
  523. } else if (tab.props.name == 2) {
  524. getList();
  525. } else if (tab.props.name == 3) {
  526. getrunData();
  527. }
  528. };
  529. const getrunData = () => {
  530. api.instance.getrun_status({ id: state.detail.id }).then((res: any) => {
  531. state.areaData = res
  532. let properties=state.areaData.properties;
  533. var temp = new Array();
  534. properties.forEach(function (item, index) {
  535. let datalist=item.list;
  536. temp[index] = [];
  537. var temps = new Array();
  538. datalist.forEach(function (a, b) {
  539. if(b<15){
  540. temps.push(a);
  541. }
  542. });
  543. temp[index]['name']=item.name
  544. temp[index]['key']=item.key
  545. temp[index]['type']=item.type
  546. temp[index]['unit']=item.unit
  547. temp[index]['value']=item.value
  548. temp[index]['list']=temps
  549. });
  550. state.areaData.properties=temp;
  551. });
  552. };
  553. const getlogtype = () => {
  554. api.instance.getlogcate({}).then((res: any) => {
  555. state.logTypeData = res.list;
  556. });
  557. };
  558. const getlog = () => {
  559. state.logtableData.param.deviceKey = state.detail.key;
  560. api.instance.getLogList(state.logtableData.param).then((res: any) => {
  561. console.log(res, '22222222');
  562. state.logtableData.data = res.list;
  563. state.logtableData.total = res.Total;
  564. });
  565. };
  566. const CkOption = () => {
  567. if (state.developer_status == 2) {
  568. api.instance.devoffline({ id: state.detail.id }).then((res: any) => {
  569. ElMessage.success('操作成功');
  570. state.developer_status = 1;
  571. });
  572. } else {
  573. api.instance.devonline({ id: state.detail.id }).then((res: any) => {
  574. ElMessage.success('操作成功');
  575. state.developer_status = 2;
  576. });
  577. }
  578. };
  579. const tinyAreas = () => {
  580. var data = state.data;
  581. const tinyArea = new TinyArea('container', {
  582. height: 60,
  583. autoFit: false,
  584. data,
  585. smooth: true,
  586. areaStyle: {
  587. fill: '#d6e3fd',
  588. },
  589. });
  590. tinyArea.render();
  591. }
  592. return {
  593. tinyAreas,
  594. editDicRef,
  595. editAttrRef,
  596. listDicRef,
  597. editFunRef,
  598. editEventRef,
  599. editTabRef,
  600. onOpenListDetail,
  601. getrunData,
  602. getlog,
  603. getlogtype,
  604. onLogDetail,
  605. CkOption,
  606. onRowDel,
  607. onEditFun,
  608. onEditEvent,
  609. onEditTag,
  610. onEditAttr,
  611. getList,
  612. getproperty,
  613. getfunction,
  614. getevent,
  615. gettab,
  616. wuhandleClick,
  617. onOpenEditTab,
  618. onOpenEditEvent,
  619. onOpenEditAttr,
  620. onOpenEditFun,
  621. onOpenEditDic,
  622. handleClick,
  623. ...toRefs(state),
  624. };
  625. },
  626. });
  627. </script>
  628. <style>
  629. .content {
  630. background: #fff;
  631. width: 100%;
  632. padding: 20px;
  633. }
  634. .content-box {
  635. background: #fff;
  636. width: 100%;
  637. padding: 20px;
  638. margin-top: 20px;
  639. }
  640. .cont_box {
  641. display: flex;
  642. }
  643. .cont_box .title {
  644. font-size: 24px;
  645. }
  646. .cont_box .pro-status {
  647. line-height: 40px;
  648. margin-left: 30px;
  649. }
  650. .cont_box .pro-status .on {
  651. background: #52c41a;
  652. }
  653. .cont_box .pro-status .off {
  654. background: #c41a1a;
  655. }
  656. .cont_box .pro-status span {
  657. position: relative;
  658. top: -1px;
  659. display: inline-block;
  660. width: 6px;
  661. height: 6px;
  662. vertical-align: middle;
  663. border-radius: 50%;
  664. margin-right: 5px;
  665. }
  666. .cont_box .pro-option {
  667. line-height: 40px;
  668. margin-left: 10px;
  669. color: #1890ff;
  670. cursor: pointer;
  671. }
  672. .content-box .pro-box {
  673. display: flex;
  674. padding: 10px;
  675. justify-content: space-between;
  676. }
  677. .content-box .pro-box .protitle {
  678. font-size: 18px;
  679. font-weight: bold;
  680. line-height: 35px;
  681. }
  682. .content-box .pro-box .buttonedit {
  683. border: 0px;
  684. color: #1890ff;
  685. }
  686. table {
  687. border-collapse: collapse;
  688. text-indent: initial;
  689. border-spacing: 2px;
  690. }
  691. tbody {
  692. box-sizing: border-box;
  693. display: table-row-group;
  694. vertical-align: middle;
  695. border-color: inherit;
  696. }
  697. tr {
  698. display: table-row;
  699. vertical-align: inherit;
  700. border-color: inherit;
  701. }
  702. .ant-descriptions-view {
  703. width: 100%;
  704. overflow: hidden;
  705. border-radius: 4px;
  706. }
  707. .ant-descriptions-view {
  708. border: 1px solid #e8e8e8;
  709. }
  710. .ant-descriptions-view table {
  711. width: 100%;
  712. table-layout: fixed;
  713. }
  714. .ant-descriptions-view > table {
  715. table-layout: auto;
  716. }
  717. .ant-descriptions-row {
  718. border-bottom: 1px solid #e8e8e8;
  719. }
  720. .ant-descriptions-item-label {
  721. color: rgba(0, 0, 0, 0.85);
  722. font-weight: 400;
  723. font-size: 14px;
  724. line-height: 1.5;
  725. }
  726. .ant-descriptions-item-label {
  727. padding: 16px 24px;
  728. border-right: 1px solid #e8e8e8;
  729. }
  730. .ant-descriptions-item-label {
  731. background-color: #fafafa;
  732. }
  733. .ant-descriptions-item-content {
  734. padding: 16px 24px;
  735. border-right: 1px solid #e8e8e8;
  736. display: table-cell;
  737. color: rgba(0, 0, 0, 0.65);
  738. font-size: 14px;
  739. line-height: 1.5;
  740. }
  741. .wu-box {
  742. border: #e8e8e8 solid 1px;
  743. padding: 20px;
  744. width: 100%;
  745. }
  746. .wu-box .wu-title {
  747. display: flex;
  748. flex-direction: row;
  749. justify-content: space-between;
  750. padding: 20px;
  751. border-bottom: #e8e8e8 1px solid;
  752. }
  753. .wu-box .wu-title .title {
  754. font-size: 18px;
  755. }
  756. .ant-card {
  757. box-sizing: border-box;
  758. margin: 10px;
  759. width: 23.2%;
  760. font-size: 14px;
  761. font-variant: tabular-nums;
  762. border: 1px solid var(--next-border-color-light);
  763. line-height: 1.5;
  764. list-style: none;
  765. font-feature-settings: 'tnum';
  766. position: relative;
  767. border-radius: 2px;
  768. transition: all 0.3s;
  769. }
  770. .ant-card-body {
  771. padding: 24px;
  772. zoom: 1;
  773. }
  774. .cardflex {
  775. display: flex;
  776. justify-content: space-between;
  777. }
  778. .statusname {
  779. font-size: 30px;
  780. margin-top: 10px;
  781. margin-bottom: 15px;
  782. }
  783. .comtest {
  784. margin-top: 20px;
  785. height: 30px;
  786. line-height: 30px;
  787. }
  788. </style>