Ver código fonte

按钮权限添加

liujiejie 11 meses atrás
pai
commit
426f0b43f3

+ 1 - 1
src/api/dataManage.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2024-06-04 09:48:21
- * @LastEditTime: 2024-06-05 15:24:06
+ * @LastEditTime: 2024-07-05 15:34:58
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /dashengmag/performance-test/src/api/dataManage.js

+ 9 - 1
src/api/performance.js

@@ -1,12 +1,20 @@
 /*
  * @Author: your name
  * @Date: 2024-06-03 09:29:50
- * @LastEditTime: 2024-06-17 14:31:34
+ * @LastEditTime: 2024-07-05 15:35:24
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/api/performance。.js
  */
 import request from "@/utils/request";
+//自动生成批次名称
+export function createBatchName(data) {
+  return request({
+    url: "/energy-manage-service/windEnginBatch/createBatchName",
+    method: "post",
+    data,
+  });
+}
 //批次管理性能分析列表获取
 export function getBatchMagList(data) {
   return request({

+ 15 - 15
src/mixins/echartsMixin.js

@@ -4,8 +4,8 @@ const myMixin = {
     resize() {
       // 当宽高变化时就会执行
       //执行某些操作 重新改变图表, 同时传参,设置动画效果
-      this.myChart.resize({ animation: { duration: 1000 }})
-    }
+      this.myChart.resize({ animation: { duration: 1000 } });
+    },
   },
   //自定义指令,图表的宽度采用百分比,父盒子宽度变化,那图表盒子大小也变化了,但是图表不会重新绘制
   //原理:判断盒子本身宽度改变了,再调用echarts的resize方法重新绘制
@@ -15,30 +15,30 @@ const myMixin = {
       // 指令的名称
       bind(el, binding) {
         // el为绑定的元素,binding为绑定给指令的对象
-        let width = ''
-        let height = ''
+        let width = "";
+        let height = "";
         function isReize() {
           //这个方法可以获取元素的css样式对象
-          const style = document.defaultView.getComputedStyle(el)
+          const style = document.defaultView.getComputedStyle(el);
           //对比跟上次宽度是否改变,如果改变了
           if (width !== style.width || height !== style.height) {
             //调用resize方法
-            binding.value() // 关键
+            binding.value(); // 关键
           }
           //记录当前宽高
-          width = style.width
-          height = style.height
+          width = style.width;
+          height = style.height;
         }
         //设置监听器,每隔一段时间对比看看
-        el.__vueSetInterval__ = setInterval(isReize, 300)
+        el.__vueSetInterval__ = setInterval(isReize, 300);
       },
       //只调用一次,指令与元素解绑时调用
       unbind(el) {
         //清除定时器
-        clearInterval(el.__vueSetInterval__)
-      }
-    }
-  }
-}
+        clearInterval(el.__vueSetInterval__);
+      },
+    },
+  },
+};
 
-export { myMixin }
+export { myMixin };

+ 32 - 16
src/views/performance/batchMag.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2024-05-27 09:23:37
- * @LastEditTime: 2024-07-05 14:51:22
+ * @LastEditTime: 2024-07-05 16:03:11
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/batchMag.vue
@@ -179,7 +179,11 @@
               ></el-option>
             </el-select>
           </el-form-item>
-          <el-form-item label="批次名称" prop="batchName">
+          <el-form-item
+            label="批次名称"
+            prop="batchName"
+            v-if="title === '编辑'"
+          >
             <el-input
               v-model="ruleForm.batchName"
               placeholder="请输入批次名称"
@@ -210,6 +214,7 @@ import {
   queryCodeNum,
   onOrOffFieldBatch,
   deleteFieldBatch,
+  createBatchName,
 } from "@/api/performance.js";
 export default {
   data() {
@@ -363,21 +368,32 @@ export default {
           this.loadingView = true;
           switch (this.title) {
             case "新增":
-              addFieldBatch({ ...this.ruleForm, batchCode: undefined })
-                .then((res) => {
-                  this.$message({
-                    type: "success",
-                    message: res.msg,
-                  });
-                  // this.loading = false;
-                  this.getTableList();
-                  this.nuedialog = false;
-                  this.loadingView = false;
+              const obj = this.fieldCodeList.find(
+                (item) => item.codeNumber === this.ruleForm.fieldCode
+              );
+              const form = new FormData();
+              form.append("fieldName", obj.fieldName);
+              createBatchName(form).then((results) => {
+                addFieldBatch({
+                  ...this.ruleForm,
+                  batchName: results.data,
+                  batchCode: undefined,
                 })
-                .catch(() => {
-                  this.loadingView = false;
-                  // this.loading = false;
-                });
+                  .then((res) => {
+                    this.$message({
+                      type: "success",
+                      message: res.msg,
+                    });
+                    // this.loading = false;
+                    this.getTableList();
+                    this.nuedialog = false;
+                    this.loadingView = false;
+                  })
+                  .catch(() => {
+                    this.loadingView = false;
+                    // this.loading = false;
+                  });
+              });
 
               break;
             case "编辑":