hsshuxian 9 сар өмнө
parent
commit
027ec70a2c

+ 0 - 1
ems-ui/src/api/basecfg/component.js

@@ -14,7 +14,6 @@ export function listByDevice(deviceCode) {
   return request({
     url: '/ems/device/component/listByDevice?deviceCode=' + deviceCode,
     method: 'get',
-    params: deviceCode
   })
 }
 

+ 42 - 61
ems-ui/src/views/basecfg/device/index.vue

@@ -367,7 +367,14 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import {delAttr, getAttr, getObjAttr} from "@/api/basecfg/objAttribute";
 import {addAttrValueBatch} from "@/api/basecfg/objAttributeValue";
 import {getDevProcess} from "@/api/commonApi";
-import {addComponent, getComponent, listByDevice, listComponent, updateComponent} from "@/api/basecfg/component";
+import {
+  addComponent,
+  delComponent,
+  getComponent,
+  listByDevice,
+  listComponent,
+  updateComponent
+} from "@/api/basecfg/component";
 
 export default {
   name: 'Device',
@@ -463,12 +470,12 @@ export default {
         deviceCode: [
           {required: true, message: "设备code不能为空", trigger: "blur"}
         ],
-        // attrKey: [
-        //   {required: true, message: "属性标识不能为空", trigger: "blur"}
-        // ],
-        // attrName: [
-        //   {required: true, message: "属性名称不能为空", trigger: "blur"}
-        // ],
+        compoCode: [
+          { required: true, message: "部件编码不能为空", trigger: "blur" }
+        ],
+        psCode: [
+          { required: true, message: "工艺标签代码不能为空", trigger: "blur" }
+        ],
       },
     }
   },
@@ -509,7 +516,7 @@ export default {
     handleComponentUpdate(row) {
       this.componentReset();
       const id = row.id || this.ids
-      updateComponent(id).then(response => {
+      getComponent(id).then(response => {
         this.componentForm = response.data;
         this.componentOpen = true;
         this.title = "修改设备器件属性";
@@ -518,7 +525,7 @@ export default {
     handleComponentDelete(row) {
       const ids = row.id || this.ids;
       this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function() {
-        return delAttr(ids);
+        return delComponent(ids);
       }).then(() => {
         console.log("删除row",row.deviceCode);
         this.getComponentList(row.deviceCode);
@@ -549,9 +556,9 @@ export default {
       this.componentReset();
     },
     /**查询部件列表*/
-    getComponentList(){
-      listComponent(this.queryParams).then(response=>{
-        this.ComponentList=response.data
+    getComponentList(deviceCode){
+      listByDevice(deviceCode).then(response => {
+        this.ComponentList=response.data;
         console.log("查询部件列表",this.ComponentList)
       })
     },
@@ -645,9 +652,7 @@ export default {
       this.ComponentRow = row
       console.log("row",row)
       listByDevice(this.ComponentRow.deviceCode).then(response => {
-        const data=response.data;
-        console.log("data",data);
-        this.ComponentList=data
+        this.ComponentList=response.data;
       })
 
 
@@ -704,25 +709,6 @@ export default {
       });
     },
     /** 提交按钮 */
-    // submitForm () {
-    //   this.$refs['form'].validate(valid => {
-    //     if (valid) {
-    //       if (this.form.id != null) {
-    //         updateDevice(this.form).then(response => {
-    //           this.$modal.msgSuccess('修改成功')
-    //           this.open = false
-    //           this.getList()
-    //         })
-    //       } else {
-    //         addDevice(this.form).then(response => {
-    //           this.$modal.msgSuccess('新增成功')
-    //           this.open = false
-    //           this.getList()
-    //         })
-    //       }
-    //     }
-    //   })
-    // },
     submitForm() {
       // 重置 attrList 和 form.customAttrs
       if (!this.attrList) {
@@ -742,9 +728,9 @@ export default {
         if (existingIndex === -1) {
           // 如果attrKey不存在于dataToSubmit中,则添加
           dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 这里填写模型代码
-            objCode: this.form.deviceCode, // 这里填写设备代码
-            objType: 2, // 这里填写对象类型
+            modelCode: this.form.deviceModel, // 模型代码
+            objCode: this.form.deviceCode, // 设备代码
+            objType: 2, // 对象类型
             attrKey: attrKey,
             attrValue: attrValue,
             attrName: attrName
@@ -762,9 +748,9 @@ export default {
         if (existingIndex === -1) {
           // 如果attrKey不存在于dataToSubmit中,则添加
           dataToSubmit.push({
-            modelCode: '', // 这里填写模型代码
-            objCode: this.form.deviceCode, // 这里填写设备代码
-            objType: 2, // 这里填写对象类型
+            modelCode: '', // 模型代码
+            objCode: this.form.deviceCode, // 设备代码
+            objType: 2, // 对象类型
             attrKey: attrKey,
             attrValue: attrValue,
             attrName:attrName
@@ -974,47 +960,42 @@ export default {
 <style lang="scss" scoped>
 
 .divider {
-  border-bottom: 2px solid #ebeef5; /* 这是Element UI的默认边框颜色,你可以根据需要调整 */
-  margin: 10px 0; /* 这是横线与内容的间距,你可以根据需要调整 */
+  border-bottom: 2px solid #ebeef5;
+  margin: 10px 0;
 }
 .section-title {
-  font-size: 18px; /* 标题字体大小 */
-  font-weight: bold; /* 字体加粗 */
-  margin-top: 20px; /* 标题顶部间距 */
-  margin-bottom: 10px; /* 标题底部间距 */
+  font-size: 18px;
+  font-weight: bold;
+  margin-top: 20px;
+  margin-bottom: 10px;
 }
 .drawer-content {
   padding: 0 20px;
 }
 
-.divider {
-  border-bottom: 2px solid #ebeef5; /* 这是Element UI的默认边框颜色,你可以根据需要调整 */
-  margin: 10px 0; /* 这是横线与内容的间距,你可以根据需要调整 */
-}
 
 .section-title {
-  font-size: 18px; /* 标题字体大小 */
-  font-weight: bold; /* 字体加粗 */
+  font-size: 18px;
+  font-weight: bold;
 }
 
 .attr-list-container {
-  border: 1px solid #ccc; /* 给ul添加外框 */
-  padding: 10px; /* 内边距 */
-  margin: 10px 0; /* 外边距 */
-  font-weight: bold; /* 加粗标题 */
+  border: 1px solid #ccc;
+  padding: 10px;
+  margin: 10px 0;
+  font-weight: bold;
 }
 
 .attr-list-container h3 {
-  font-weight: bold; /* 加粗标题 */
+  font-weight: bold;
 }
 
 .attr-item {
-  list-style-type: none; /* 移除列表项前的默认符号 */
-  margin-bottom: 5px; /* 列表项之间的间距 */
+  list-style-type: none;
+  margin-bottom: 5px;
 }
-
 .attr-name {
-  font-weight: bold; /* 加粗属性名称 */
+  font-weight: bold;
 }
 
 </style>