rui.jiang 6 місяців тому
батько
коміт
0128048b06

+ 68 - 0
src/api/maintain.js

@@ -0,0 +1,68 @@
+import { jsonToFormData } from "@/utils/common";
+import request from "@/utils/request";
+
+// 部件维护
+export function getDictList(data) {
+  return request({
+    url: "/energy-manage-service/dict/getDictList",
+    method: "post",
+    data,
+  });
+}
+
+// 保存字段关系
+export function createUnitDict(data) {
+  return request({
+    url: "/energy-manage-service/api/unit/dict/createUnitDict",
+    method: "post",
+    data,
+  });
+}
+
+// 保存字段关系
+export function getUnitDictConstantsPage(data) {
+  return request({
+    url: "/energy-manage-service/api/unit/dict/getUnitDictConstantsPage",
+    method: "post",
+    data,
+  });
+}
+
+// 删除h字段关系
+export function delUnitDict(data) {
+  return request({
+    url: "/energy-manage-service/api/unit/dict/delUnitDict",
+    method: "post",
+    data,
+  });
+}
+
+
+// 维护属性
+export function createUnitDictProperty(data) {
+  return request({
+    url: "/energy-manage-service/api/unit/dict/createUnitDictProperty",
+    method: "post",
+    data,
+  });
+}
+
+
+// 新增属性
+export function getUnitDictConstantsList(data) {
+  return request({
+    url: "/energy-manage-service/api/unit/dict/getUnitDictConstantsList",
+    method: "post",
+    data,
+  });
+}
+
+// 新增属性
+export function delUnitDictProperty(data) {
+  return request({
+    url: "/energy-manage-service/api/unit/dict/delUnitDictProperty",
+    method: "post",
+    data,
+  });
+}
+

+ 140 - 120
src/views/health/vibration.vue

@@ -104,6 +104,7 @@
               ></i>
             </span>
           </div>
+
           <div
             class="subject"
             :class="{
@@ -116,7 +117,23 @@
               :id="item.id"
               class="line-chart"
               style="width: 100%; height: 260px"
-            ></div>
+            >
+            <div class="eigenvalue">
+              <h5>特征值</h5>
+              <p>有效值:</p>
+              <p>平均值:</p>
+              <p>最大值:</p>
+              <p>最小值:</p>
+              <p>峰值:</p>
+              <p>峰峰值:</p>
+              <p>波形因子:</p>
+              <p>脉冲指标:</p>
+              <p>裕度指标:</p>
+              <p>偏度指标:</p>
+              <p>峭度指标:</p>
+            </div>
+          </div>
+        
             <!-- <charts></charts> -->
           </div>
         </div>
@@ -180,127 +197,133 @@ export default {
     },
 
     renderChart(containerId, data = []) {
-    // 获取特定的图表容器
-    const chartDom = document.getElementById(containerId);
-    if (!chartDom) {
-      console.error(`Container with id ${containerId} not found`);
-      return;
-    }
+      // 获取特定的图表容器
+      const chartDom = document.getElementById(containerId);
+      if (!chartDom) {
+        console.error(`Container with id ${containerId} not found`);
+        return;
+      }
 
-    // 检查是否已经存在 ECharts 实例,如果存在则销毁它
-    if (chartDom.__echarts_instance__) {
-      echarts.dispose(chartDom);
-    }
+      // 检查是否已经存在 ECharts 实例,如果存在则销毁它
+      if (chartDom.__echarts_instance__) {
+        echarts.dispose(chartDom);
+      }
 
-    // 初始化 ECharts 实例
-    const myChart = echarts.init(chartDom);
+      // 初始化 ECharts 实例
+      const myChart = echarts.init(chartDom);
 
-    // 定义默认的数据
-    let base = +new Date(1968, 9, 3);
-    let oneDay = 24 * 3600 * 1000;
-    let date = [];
-    let defaultData = [Math.random() * 300];
-    for (let i = 1; i < 200; i++) {
-      const now = new Date((base += oneDay));
-      date.push(
-        [now.getFullYear(), now.getMonth() + 1, now.getDate()].join("/")
-      );
-      defaultData.push(
-        Math.round((Math.random() - 0.5) * 20 + defaultData[i - 1])
-      );
-    }
+      // 定义默认的数据
+      let base = +new Date(1968, 9, 3);
+      let oneDay = 24 * 3600 * 1000;
+      let date = [];
+      let defaultData = [Math.random() * 300];
+      for (let i = 1; i < 200; i++) {
+        const now = new Date((base += oneDay));
+        date.push(
+          [now.getFullYear(), now.getMonth() + 1, now.getDate()].join("/")
+        );
+        defaultData.push(
+          Math.round((Math.random() - 0.5) * 20 + defaultData[i - 1])
+        );
+      }
 
-    // 使用传入的数据或默认数据
-    const chartData = data.length > 0 ? data : defaultData;
+      // 使用传入的数据或默认数据
+      const chartData = data.length > 0 ? data : defaultData;
 
-    // 配置选项
-    const option = {
-      toolbox: {
-        feature: {
-          dataZoom: { yAxisIndex: "none" },
-          restore: {},
-          saveAsImage: {},
-          myCustomTool: {
-            show: true,
-            title: "上一条",
-            icon: `image://${require("@/assets/analyse/08.png")}`,
-            onclick: () => this.previousRow(containerId), // 传递当前图表的 ID
-          },
-          myCustomTool2: {
-            show: true,
-            title: "下一条",
-            icon: `image://${require("@/assets/analyse/09.png")}`,
-            onclick: () => this.nextRow(containerId), // 传递当前图表的 ID
-          },
-          myCustomTool3: {
-            show: true,
-            title: "特征值",
-            icon: `image://${require("@/assets/analyse/10.png")}`,
-            onclick: () => alert("自定义按钮被点击!"),
+      // 配置选项
+      const option = {
+        toolbox: {
+          feature: {
+            dataZoom: { yAxisIndex: "none" },
+            restore: {},
+            saveAsImage: {},
+            myCustomTool: {
+              show: true,
+              title: "上一条",
+              icon: `image://${require("@/assets/analyse/08.png")}`,
+              onclick: () => this.previousRow(containerId), // 传递当前图表的 ID
+            },
+            myCustomTool2: {
+              show: true,
+              title: "下一条",
+              icon: `image://${require("@/assets/analyse/09.png")}`,
+              onclick: () => this.nextRow(containerId), // 传递当前图表的 ID
+            },
+            myCustomTool3: {
+              show: true,
+              title: "特征值",
+              icon: `image://${require("@/assets/analyse/10.png")}`,
+              onclick: () => alert("自定义按钮被点击!"),
+            },
           },
         },
-      },
-      xAxis: {
-        type: "category",
-        boundaryGap: false,
-        data: date,
-      },
-      yAxis: {
-        type: "value",
-        boundaryGap: [0, "100%"],
-      },
-      series: [
-        {
-          name: "数据系列",
-          type: "line",
-          symbol: "none",
-          sampling: "lttb",
-          itemStyle: { color: "rgb(255, 70, 131)" },
-          areaStyle: {
-            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-              { offset: 0, color: "rgb(255, 158, 68)" },
-              { offset: 1, color: "rgb(255, 70, 131)" },
-            ]),
+        xAxis: {
+          type: "category",
+          boundaryGap: false,
+          data: date,
+        },
+        yAxis: {
+          type: "value",
+          boundaryGap: [0, "100%"],
+        },
+        tooltip: {
+          trigger: "axis",
+          position: function (pt) {
+            return [pt[0], "10%"];
           },
-          data: chartData,
         },
-      ],
-    };
+        series: [
+          {
+            name: "数据系列",
+            type: "line",
+            symbol: "none",
+            sampling: "lttb",
+            itemStyle: { color: "rgb(255, 70, 131)" },
+            areaStyle: {
+              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                { offset: 0, color: "rgb(255, 158, 68)" },
+                { offset: 1, color: "rgb(255, 70, 131)" },
+              ]),
+            },
+            data: chartData,
+          },
+        ],
+      };
 
-    // 设置图表选项
-    myChart.setOption(option);
+      // 设置图表选项
+      myChart.setOption(option);
 
-    // 监听窗口大小变化,调整图表大小
-    window.addEventListener('resize', () => {
-      myChart.resize();
-    });
-  },
+      // 监听窗口大小变化,调整图表大小
+      window.addEventListener("resize", () => {
+        myChart.resize();
+      });
+    },
 
     // 上一条
     previousRow(chartId) {
       if (this.currentIndex > 0) {
-        this.currentIndex--; 
+        this.currentIndex--;
       } else {
-        this.currentIndex = this.tableData.length - 1; 
+        this.currentIndex = this.tableData.length - 1;
       }
-      this.selectRow(chartId); 
+      this.selectRow(chartId);
     },
 
     // 下一条
     nextRow(chartId) {
       if (this.currentIndex < this.tableData.length - 1) {
-        this.currentIndex++; 
+        this.currentIndex++;
       } else {
-        this.currentIndex = 0; 
+        this.currentIndex = 0;
       }
-      this.selectRow(chartId); 
+      this.selectRow(chartId);
     },
     selectRow(chartId) {
       const row = this.tableData[this.currentIndex];
       this.handleCurrentChange(row);
       this.setCurrent(row);
       this.$nextTick(() => {
-        this.renderChart(chartId); 
+        this.renderChart(chartId);
       });
     },
 
@@ -313,7 +336,7 @@ export default {
         1: "时域图",
         2: "频谱图",
         3: "包络谱图",
-        4: "趋势图",
+        // 4: "趋势图",
       };
       if (nameMap[type]) {
         const newItem = {
@@ -332,33 +355,7 @@ export default {
       });
     },
 
-    generate(type) {
-      if (!this.currentRow) {
-        this.$message.warning("请先选择数据");
-        return;
-      }
-      const nameMap = {
-        1: "时域图",
-        2: "频谱图",
-        3: "包络谱图",
-        4: "趋势图",
-      };
-      if (nameMap[type]) {
-        const newItem = {
-          name: nameMap[type],
-          isMinimized: false,
-          id: `chart-${Date.now()}`, // 使用唯一 ID
-        };
-        this.fourList.push(newItem);
-        if (this.fourList.length > 4) {
-          this.fourList.shift();
-        }
-      }
-      this.$nextTick(() => {
-        const newChart = this.fourList[this.fourList.length - 1];
-        this.renderChart(newChart.id); // 为新图表渲染数据
-      });
-    },
+ 
 
     // 缩小
     lessen(index) {
@@ -443,7 +440,10 @@ export default {
   padding: 0 10px;
   display: flex;
   justify-content: space-between;
+  position: relative;
 }
+
+
 .subject {
   height: 280px;
   transition: all 0.3s ease;
@@ -485,4 +485,24 @@ export default {
   width: 100%;
   height: 280px;
 }
+
+
+.line-chart{
+  position: relative;
+}
+.eigenvalue {
+  position: absolute;
+  top: 0;
+  right: 0;
+  font-size: 10px;
+  width: 100px;
+  border: 1px solid black;
+  padding: 5px;
+  background: #fff;
+  z-index: 99
+  h5 {
+    line-height: 16px;
+    height: 16px;
+  }
+}
 </style>

+ 4 - 4
src/views/ledger/componentBJ/chilunxiang.vue

@@ -29,10 +29,10 @@
 
     </div>
     <!-- LLS -->
-    <p class="locationP">
+    <!-- <p class="locationP">
       <i @click="addLSS" class="el-icon-plus"></i>
       <i v-if="lssList.length > 1" @click="delLSS" class="el-icon-minus"></i>
-    </p>
+    </p> -->
     <div class="message">
       <p class="caption">
         <span class="capSpan1">LSS低速轴</span>
@@ -262,10 +262,10 @@
     </div>
 
     <!-- 高速轴 -->
-    <p class="locationP">
+    <!-- <p class="locationP">
       <i @click="addhigh" class="el-icon-plus"></i>
       <i v-if="high.length > 1" @click="delhigh" class="el-icon-minus"></i>
-    </p>
+    </p> -->
     <div class="message">
       <p class="caption">
         <span class="capSpan1">高速轴</span>

+ 177 - 45
src/views/ledger/maintain.vue

@@ -4,28 +4,41 @@
       <div class="condition">
         <p>部件名称:</p>
         <el-input v-model="nameOfparts" size="small"></el-input>
-        <el-button type="primary" size="small">查询</el-button>
+        <el-button type="primary" @click="GETquery" size="small"
+          >查询</el-button
+        >
       </div>
       <el-button plain size="small" @click="newly">新增</el-button>
     </div>
     <div class="assemblyList">
       <el-table :data="tableData" border style="width: 100%">
-        <el-table-column prop="date" label="部件模块"> </el-table-column>
-        <el-table-column prop="name" label="部件名称"> </el-table-column>
-        <el-table-column prop="name" label="部件编码"> </el-table-column>
-        <el-table-column prop="name" label="维护时间"> </el-table-column>
+        <el-table-column prop="unitModuleName" label="部件模块">
+        </el-table-column>
+        <el-table-column prop="contentsName" label="部件名称">
+        </el-table-column>
+        <el-table-column prop="contentsType" label="部件编码">
+        </el-table-column>
+        <el-table-column prop="updateTime" label="维护时间"> </el-table-column>
         <el-table-column fixed="right" label="操作">
           <template slot-scope="scope">
             <el-button @click="handleClick(scope.row)" type="text" size="small"
               >编辑</el-button
             >
-            <el-button @click="handleClick(scope.row)" type="text" size="small"
+            <el-button
+              v-if="scope.row.associatedFunctionType === 1"
+              @click="ONallocation(scope.row)"
+              type="text"
+              size="small"
               >部件配置</el-button
             >
-            <el-button @click="handleClick(scope.row)" type="text" size="small"
+            <el-button
+              v-if="scope.row.associatedFunctionType === 2"
+              @click="ONbrand(scope.row)"
+              type="text"
+              size="small"
               >品牌维护</el-button
             >
-            <el-button @click="handleClick(scope.row)" type="text" size="small"
+            <el-button @click="ONdelete(scope.row)" type="text" size="small"
               >删除</el-button
             >
           </template>
@@ -43,9 +56,9 @@
         部件模块:<el-select v-model="modulevalue" placeholder="请选择">
           <el-option
             v-for="item in moduleoptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
+            :key="item.contentsValue"
+            :label="item.contentsName"
+            :value="item.contentsValue"
           >
           </el-option>
         </el-select>
@@ -54,20 +67,25 @@
         部件名称:<el-select v-model="namevalue" placeholder="请选择">
           <el-option
             v-for="item in nameoptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
+            :key="item.contentsValue"
+            :label="item.contentsName"
+            :value="item.contentsValue"
+          >
+          </el-option>
+        </el-select>
+      </p>
+      <p style="margin-bottom: 20px">
+        功能类型:<el-select v-model="functionvalue" placeholder="请选择">
+          <el-option
+            v-for="item in functionoptions"
+            :key="item.contentsValue"
+            :label="item.contentsName"
+            :value="item.contentsValue"
           >
           </el-option>
         </el-select>
       </p>
-      <el-checkbox
-        style="display: block"
-        v-model="checked"
-        :true-label="1"
-        :false-label="0"
-        >品牌/型号</el-checkbox
-      >
+
       <div class="button-container">
         <el-button
           class="but"
@@ -142,8 +160,8 @@
       <div class="drawersDIV">
         <el-input size="small" v-model="drawervalue"></el-input>
         <el-button size="small" @click="newtype('2')">新增</el-button>
-        <el-table :data="tableData" border style="width: 100%">
-          <el-table-column prop="name" label="型号"> </el-table-column>
+        <el-table :data="nothaveData" border style="width: 100%">
+          <el-table-column prop="contentsName" label="型号"> </el-table-column>
           <el-table-column fixed="right" label="操作" width="100">
             <template slot-scope="scope">
               <el-button
@@ -152,7 +170,9 @@
                 size="small"
                 >编辑</el-button
               >
-              <el-button type="text" size="small">删除</el-button>
+              <el-button type="text" @click="DELshuxing(scope.row)" size="small"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -166,7 +186,8 @@
       :before-close="handleClose"
     >
       <p class="maintain">
-        类型:<span class="one"><el-input size="small"></el-input></span
+        类型:<span class="one"
+          ><el-input v-model="bujianval" size="small"></el-input></span
         ><span class="Sptwo">
           <el-button
             class="but"
@@ -183,6 +204,16 @@
 </template>
   
   <script>
+import {
+  getDictList,
+  createUnitDict,
+  getUnitDictConstantsPage,
+  delUnitDict,
+  createUnitDictProperty,
+  getUnitDictConstantsList,
+  delUnitDictProperty,
+} from "@/api/maintain.js";
+import { log } from "plotly.js-dist";
 export default {
   data() {
     return {
@@ -197,31 +228,140 @@ export default {
       moduleoptions: [],
       namevalue: "",
       nameoptions: [],
+      functionvalue: "",
+      functionoptions: [],
       checked: "0",
       drawervalue: "",
       brand: "",
       guige: "",
+      rowList: {},
+      bujianval: "",
+      nothaveData: [],
     };
   },
+  created() {
+    this.GETquery();
+  },
   methods: {
+    // 获取属性
+    GETmokuai() {
+      getDictList({ dictType: 3 }).then((res) => {
+        this.moduleoptions = res.data;
+      });
+      getDictList({ dictType: 4 }).then((res) => {
+        this.nameoptions = res.data;
+      });
+      getDictList({ dictType: 5 }).then((res) => {
+        this.functionoptions = res.data;
+      });
+    },
+    // 新增属性
+    handleConfirm() {
+      const params = {
+        associatedFunctionType: this.functionvalue,
+        contentsDictKey: this.namevalue,
+        contentsName:
+          this.nameoptions.find((item) => item.contentsValue === this.namevalue)
+            ?.contentsName || "", // 赋值nameoptions当前选中的label
+        unitModule: this.modulevalue,
+        parentId: 0,
+      };
+
+      createUnitDict(params).then((res) => {
+        if (res.status == true) {
+          this.$message({
+            message: "恭喜你,这是一条成功消息",
+            type: "success",
+          });
+          this.dialogVisible = false;
+          this.GETquery();
+        }
+      });
+    },
+    // 查询
+    GETquery() {
+      const params = {
+        contentsName: this.nameOfparts,
+        pageNum: 1,
+        pageSize: 10,
+      };
+      getUnitDictConstantsPage(params).then((res) => {
+        this.tableData = res.data.list;
+      });
+    },
+    // 删除属性
+    ONdelete(row) {
+      const params = {
+        contentsType: row.contentsType,
+        id: row.id,
+      };
+      delUnitDict(params).then((res) => {
+        this.tableData = this.tableData.filter((item) => item.id !== row.id);
+        this.$message({
+          type: "success",
+          message: "删除成功!",
+        });
+      });
+    },
+    // 非关联
+    ONallocation(row) {
+      this.rowList = row;
+      this.notdrawer = true;
+      getUnitDictConstantsList({
+        contentsType: this.rowList.contentsType,
+      }).then((res) => {
+        this.nothaveData = res.data;
+      });
+    },
+
+    submit(type) {
+      if (type === "1") {
+        const params = {
+          contentsName: this.bujianval,
+          contentsType: this.rowList.contentsType,
+          parentId: this.rowList.id,
+          unitModule: this.rowList.unitModule,
+          contentsDictKey: 0,
+        };
+        createUnitDictProperty(params).then((res) => {
+          this.maintainVisible = false;
+          getUnitDictConstantsList({
+            contentsType: this.rowList.contentsType,
+          }).then((res) => {
+            this.nothaveData = res.data;
+          });
+        });
+      } else if (type === "2") {
+        this.relevanceVisible = false;
+      }
+    },
+
+    DELshuxing(row) {
+      const params = {
+        updateBy: row.updateBy,
+        id: row.id,
+      };
+      delUnitDictProperty(params).then((res) => {
+        this.nothaveData = this.nothaveData.filter(
+          (item) => item.id !== row.id
+        );
+      });
+    },
+
+    ONbrand(row) {
+      this.drawer = true;
+      console.log("row", row);
+    },
+
     newly() {
       this.dialogVisible = true;
+      this.GETmokuai();
     },
+
     handleClose() {
       this.dialogVisible = false;
     },
-    handleConfirm() {
-      this.dialogVisible = false;
 
-      if (this.checked == "0") {
-        console.log(this.checked);
-        this.notdrawer = true;
-      }
-      if (this.checked == "1") {
-        console.log(this.checked);
-        this.drawer = true;
-      }
-    },
     handleClick() {},
     newtype(type) {
       if (type === "1") {
@@ -230,13 +370,6 @@ export default {
         this.maintainVisible = true;
       }
     },
-    submit(type) {
-      if (type === "1") {
-        this.maintainVisible = false;
-      } else if (type === "2") {
-        this.relevanceVisible = false;
-      }
-    },
   },
 };
 </script>
@@ -272,12 +405,11 @@ export default {
 .drawers {
   .drawersDIV {
     padding: 0 20px;
+    margin-bottom: 20px;
   }
   .el-input {
     width: 220px;
     margin-right: 20px;
-  }
-  .el-button {
     margin-bottom: 20px;
   }
 }

+ 2 - 2
vue.config.js

@@ -63,10 +63,10 @@ module.exports = {
     // contentBase: path.join(__dirname, "public"),
     proxy: {
       "/api": {
-        // target: "http://192.168.5.4:16200", // 石月
+        target: "http://192.168.5.4:16200", // 石月
         // target: "http://192.168.50.235:16200", //内网
         // target: "http://192.168.5.15:16200",
-        target: "http://106.120.102.238:16600", //外网
+        // target: "http://106.120.102.238:16600", //外网
         //  target: "http://10.96.137.5",
         changeOrigin: true,
         pathRewrite: {