Browse Source

样本库设备管理修改

chenminghua 3 years ago
parent
commit
3a1e7dbbeb
4 changed files with 56 additions and 62 deletions
  1. 1 1
      src/router/index.js
  2. 5 5
      src/views/layout/Menu.vue
  3. 50 51
      src/views/device/device.vue
  4. 0 5
      src/views/device/faultmode.vue

+ 1 - 1
src/router/index.js

@@ -941,7 +941,7 @@ const routes = [{
 	path: '/device/device', //设备管理
 	name: 'device',
 	component: () =>
-		import('../views/device/device.vue'),
+		import('../views/sampleDatabase/device/device.vue'),
 }
 
 	/***********************************************************其他************************************************************ */

+ 5 - 5
src/views/layout/Menu.vue

@@ -890,11 +890,6 @@ export default {
                   icon: "svg-wind-site",
                   path: "/others/ExportExcel",
                 },
-                {
-                  text: "设备管理",
-                  icon: "svg-wind-site",
-                  path: "/device/device",
-                },
               ],
             },
             {
@@ -987,6 +982,11 @@ export default {
               icon: "svg-报表管理",
               path: "/others/fault",
               children: [
+                 {
+                  text: "设备管理",
+                  icon: "svg-wind-site",
+                  path: "/device/device",
+                },
                 {
                   text: "故障训练样本库",
                   icon: "svg-matrix",

+ 50 - 51
src/views/device/device.vue

@@ -1,20 +1,22 @@
 <template>
   <div class="main deviceClass">
-    <el-card class="box-card-tree">
-      <button
-        class="btn green"
-        style="margin-bottom: 10px"
-        @click="handleTreeAdd()"
-      >
-        新增
-      </button>
-      <button
-        class="btn green"
-        @click="handleTreeDel()"
-        :disabled="state.isDel == ''"
-      >
-        删除
-      </button>
+    <el-card class="box-card-tree" style="height: 100%">
+      <div class="btnBox">
+        <button
+          class="btn green"
+          style="margin-bottom: 10px"
+          @click="handleTreeAdd()"
+        >
+          新增
+        </button>
+        <button
+          class="btn green"
+          @click="handleTreeDel()"
+          :disabled="state.isDel == ''"
+        >
+          删除
+        </button>
+      </div>
       <el-tree
         :data="state.treedata"
         :props="state.defaultProps"
@@ -25,9 +27,17 @@
       />
     </el-card>
     <el-card class="box-card">
-      <el-tabs type="card" class="tab">
-        <el-tab-pane label="传感点">
+      <el-tabs type="card" class="tab" v-model="activeTab">
+        <el-tab-pane label="传感点" name="sensepoint">
           <div class="devicemenu">
+            <el-input
+              style="width: 180px; margin: 0 10px 0 0"
+              v-model="state.SearchVal"
+              placeholder="筛选"
+              :prefix-icon="Search"
+              @input="filterSearch()"
+              size="small"
+            />
             <button
               class="btn"
               style="margin-bottom: 10px"
@@ -36,14 +46,7 @@
             >
               新增
             </button>
-            <el-input
-              style="width: 180px; margin: 0 10px"
-              v-model="state.SearchVal"
-              placeholder="筛选"
-              :prefix-icon="Search"
-              @input="fifterSearch()"
-              size="small"
-            />
+
             <button
               class="btn"
               size="mini"
@@ -77,13 +80,13 @@
                 v-model="state.SearchVal"
                 placeholder="筛选"
                 :prefix-icon="Search"
-                @input="fifterSearch()"
+                @input="filterSearch()"
                 size="small"
               />
             </el-col>
           </el-row> -->
           <el-table
-            :data="state.fifterSearchTableData"
+            :data="state.filterSearchTableData"
             stripe
             style="width: 100%"
             height="700"
@@ -169,6 +172,7 @@
         </el-tab-pane>
         <div class="pagination">
           <el-pagination
+            v-if="activeTab === 'sensepoint'"
             background
             layout="total, prev, pager, next"
             hide-on-single-page
@@ -178,10 +182,10 @@
             @current-change="handlePageChange"
           ></el-pagination>
         </div>
-        <el-tab-pane label="故障模式">
+        <el-tab-pane label="故障模式" name="faultmodel">
           <faultmode />
         </el-tab-pane>
-        <el-tab-pane label="基本信息" style="width: 50%">
+        <el-tab-pane label="基本信息" style="width: 50%" name="basicinfo">
           <el-form :model="state.desc" label-width="100px">
             <el-form-item label="结构编码">
               <el-input v-model="state.desc.code"></el-input>
@@ -462,6 +466,8 @@ import {
 let editVisible = ref(false); //传感点
 let treeVisible = ref(false); //传感点
 let editFormData = ref({});
+let activeTab = ref("sensepoint"); //table切换
+
 onMounted(() => {
   getData();
   getDeviceModel();
@@ -478,7 +484,7 @@ let state = reactive({
     },
   },
   pointTableData: [],
-  fifterSearchTableData: [],
+  filterSearchTableData: [],
   textarea: "",
   textarea1: "",
   treeCurClick: null,
@@ -546,12 +552,12 @@ provide(
   "cascaderdata",
   computed(() => state.cascaderdata)
 );
-//fifterSearch
-const fifterSearch = () => {
+//filterSearch
+const filterSearch = () => {
   if (state.SearchVal == "") {
-    return state.fifterSearchTableData = state.pointTableData;
+    return (state.filterSearchTableData = state.pointTableData);
   } else {
-    state.fifterSearchTableData = state.pointTableData.filter((e) => {
+    state.filterSearchTableData = state.pointTableData.filter((e) => {
       return (
         e.name.includes(state.SearchVal) |
         e.categorydata.includes(state.SearchVal) |
@@ -562,7 +568,6 @@ const fifterSearch = () => {
 };
 // tree click
 const handleNodeClick = (data) => {
-  console.log(data);
   state.isDel = data.children;
   state.desc = data.node;
   state.addFormData.structurecode = data.node.code;
@@ -579,7 +584,6 @@ const handleTreeAdd = () => {
 };
 // tree Del
 const handleTreeDel = () => {
-  console.warn(state.desc);
   if (state.isDel != null) {
     ElMessage.error(`不能删除该节点!!`);
     return;
@@ -589,7 +593,6 @@ const handleTreeDel = () => {
   })
     .then(async () => {
       const res = await treeDel(state.desc.id);
-      console.warn(res);
       if (res == 1) {
         ElMessage.success(`删除成功!`);
         getData();
@@ -601,9 +604,7 @@ const handleTreeDel = () => {
 };
 // delTreeBtn
 const delTreeBtn = async () => {
-  console.warn(state.treeDelVal);
   const res = await treeDel(state.treeDelVal);
-  console.warn(res);
   if (res == 1) {
     ElMessage.success(`删除成功!`);
     getData();
@@ -615,7 +616,6 @@ const delTreeBtn = async () => {
 //保存tree add
 const saveTreeAdd = async () => {
   const res = await treeAdd(state.treeAddFormData);
-  console.warn(res);
   if (res.status == 20000) {
     ElMessage.success(`操作成功!`);
     treeVisible.value = false;
@@ -632,9 +632,7 @@ const handleDelete = (row) => {
     type: "warning",
   })
     .then(async () => {
-      console.warn(row);
       const res = await delmetrics(row.id);
-      console.warn(res);
       if (res == 1) {
         ElMessage.success(`删除成功!`);
       } else {
@@ -650,9 +648,7 @@ const saveEdit = async () => {
 };
 //测点 add
 const postmetrics = async () => {
-  console.warn(editFormData.value);
   const res = await metrics(editFormData.value);
-  console.warn(res);
   if (res.status == 20000) {
     ElMessage.success(`操作成功!`);
     editVisible.value = false;
@@ -670,15 +666,12 @@ const getData = async () => {
   });
   const res = await tree();
   loading.close();
-  console.warn(res);
   state.treedata = res.children;
   state.cascaderdata = cascaderforEach(res);
-  console.warn(state.cascaderdata);
 };
 //deviceModelAdd 新增机型
 const deviceModelAdd = async () => {
   if (state.deviceModelSel == "") return;
-  console.warn();
   let obj = {
     deviceid: editFormData.value.deviceid,
     devicemodel: state.deviceModelSel,
@@ -693,13 +686,11 @@ const deviceModelAdd = async () => {
 const getDeviceModel = async () => {
   const res = await device_list();
   state.deviceModel = res;
-  console.warn(res);
 };
 ///// 基本信息
 
 const savedesc = async () => {
   const res = await treeAdd(state.desc);
-  console.warn(res);
   if (res.status == 20000) {
     ElMessage.success(`操作成功!`);
   } else {
@@ -711,12 +702,11 @@ const savedesc = async () => {
 // getPoint
 const getPoint = async (node) => {
   const res = await point(node.code, query.page, query.limit);
-  console.warn(res);
   pageTotal.value = res.total;
   state.pointTableData = res.records?.sort((a, b) => {
     return a.id - b.id;
   });
-  fifterSearch();
+  filterSearch();
 };
 // 递归解析基础数据
 const cascaderforEach = (val) => {
@@ -761,6 +751,7 @@ const handlePageChange = (val) => {
   query.page = val;
   getPoint(state.desc);
 };
+
 </script>
 <style lang="scss" scoped>
 .main {
@@ -773,6 +764,11 @@ const handlePageChange = (val) => {
     width: 20%;
     margin-right: 1%;
     overflow: auto;
+    .el-tree{
+      height: 100%;
+      overflow-y: scroll;
+      background: rgba(96, 103, 105, 0.2);
+    }
   }
   .box-card {
     flex: 1;
@@ -816,5 +812,8 @@ const handlePageChange = (val) => {
   .el-row {
     margin-bottom: 16px;
   }
+  .el-card__body {
+    height: calc(100% - 51px);
+  }
 }
 </style>

+ 0 - 5
src/views/device/faultmode.vue

@@ -169,7 +169,6 @@ import {
   faultmode_add_edit,
 } from "@/api/api.js";
 let cascaderdata = inject("cascaderdata");
-console.warn(cascaderdata);
 let editVisible = ref(false);
 let editFormData = ref({});
 onMounted(() => {
@@ -236,9 +235,7 @@ const handleDelete = (row) => {
     type: "warning",
   })
     .then(async () => {
-      console.warn(row);
       const res = await faultmode_delete(row.id);
-      console.warn(res);
       if (res == 1) {
         ElMessage.success(`删除成功!`);
       } else {
@@ -251,7 +248,6 @@ const handleDelete = (row) => {
 // 保存编辑
 const saveEdit = async () => {
   const res = await faultmode_add_edit(editFormData.value);
-  console.warn(res);
   if (res.status == 20000) {
     ElMessage.success(`操作成功!`);
     editVisible.value = false;
@@ -270,7 +266,6 @@ const getfaultmode = async () => {
   const res = await faultmode_windturbine();
   state.faultmodeTableData = res;
   loading.close();
-  console.warn(res);
 };
 // 批量导出
 const export2Excel = () => {