Browse Source

修改bug

zhoupeng 1 year ago
parent
commit
ccebbe3ce9

+ 0 - 7
industry-admin/src/views/source/dataModel/addModel.vue

@@ -207,11 +207,6 @@ export default {
                             this.calcValResult = ''
                             this.$refs['dataModelForm'].resetFields()
                             this.$emit('getAllDataModel')
-                        }).catch((e) => {
-                            this.$message({
-                                message: e,
-                                type: 'success'
-                            })
                         })
                         return
                     }
@@ -224,8 +219,6 @@ export default {
                         this.calcValResult = ''
                         this.$refs['dataModelForm'].resetFields()
                         this.$emit('getAllDataModel')
-                    }).catch((e) => {
-
                     })
                 } else {
                     this.$message({

+ 9 - 28
industry-admin/src/views/source/dataModel/index.vue

@@ -19,7 +19,7 @@
               @click="handleReplace">新增值替换</el-button>
           </el-col>
           <el-col :span="1.5" style="margin-left: 15px">
-            <el-button type="danger" size="mini" plain icon="el-icon-circle-plus-outline" @click="handleAdd">
+            <el-button type="primary" size="mini" plain icon="el-icon-circle-plus-outline" @click="handleAdd">
               新增四则运算
             </el-button>
           </el-col>
@@ -30,25 +30,25 @@
           </el-col>
         </el-row>
         <!-- 表格数据信息 -->
-        <el-table :data="tableData" stripe border header-row-class-name="headBackground"
+        <el-table :data="tableData" stripe border height="62vh" header-row-class-name="headBackground"
           @selection-change="selectionLineChangeHandle">
           <el-table-column type="selection" width="55" align="center" />
           <el-table-column type="index" label="序号" width="60" fixed align="center" />
-          <el-table-column align="center" sortable="custom" label="名称" prop="remark" />
-          <el-table-column align="center" label="类型" sortable="custom" prop="modelType" width="120">
+          <el-table-column align="center" label="名称" prop="remark" />
+          <el-table-column align="center" label="类型" prop="modelType">
             <template slot-scope="scope">
               <span>{{ scope.row.modelType == 0 ? '四则运算' : '值替换' }}</span>
             </template>
           </el-table-column>
-          <el-table-column align="center" label="替换值①/表达式" sortable="custom" prop="operationRule" width="300" />
-          <el-table-column align="center" label="数据值①/数据值" prop="mathParameter" width="300">
+          <el-table-column align="center" label="替换值①/表达式" prop="operationRule" />
+          <el-table-column align="center" label="数据值①/数据值" prop="mathParameter">
             <template slot-scope="scope">
               <span>{{ scope.row.modelType == 0 ? scope.row.mathParameter : scope.row.replacingValue }}</span>
             </template>
           </el-table-column>
-          <el-table-column align="center" label="替换值②" sortable="custom" prop="operationRuleTwo" width="120" />
-          <el-table-column align="center" label="数据值②" prop="replacingValueTwo" width="120" />
-          <el-table-column align="center" label="创建时间" sortable prop="createTime" width="180" />
+          <el-table-column align="center" label="替换值②" prop="operationRuleTwo" />
+          <el-table-column align="center" label="数据值②" prop="replacingValueTwo" />
+          <el-table-column align="center" label="创建时间" prop="createTime" />
           <el-table-column label="操作" align="center" width="300">
             <template slot-scope="scope">
               <el-button v-if="scope.row.modelType == 0" size="mini" type="text" icon="el-icon-tickets"
@@ -173,8 +173,6 @@ export default {
         this.$refs.addModel.dataModelForm = res.data
         this.$refs.addModel.calcValResult = ''
         this.$refs.addModel.visible = true
-      }).catch((e) => {
-        showAlertWin(this, null, e)
       })
     },
     /** 编辑数据模型(值替换) */
@@ -184,8 +182,6 @@ export default {
         this.$refs.replaceModel.dataModelForm = res.data
         this.$refs.replaceModel.calcValResult = ''
         this.$refs.replaceModel.visible = true
-      }).catch((e) => {
-        showAlertWin(this, null, e)
       })
     },
     /** 测试数据模型值 */
@@ -203,11 +199,6 @@ export default {
             type: 'success'
           })
           this.getAllDataModel()
-        }).catch((e) => {
-          this.$message({
-            message: e,
-            type: 'warning'
-          })
         })
       })
     },
@@ -233,11 +224,6 @@ export default {
         }
         this.tableTotal = res.data.count
         this.tableData = res.data.dataModelList
-      }).catch((e) => {
-        this.$message({
-          message: e,
-          type: 'warning'
-        })
       })
     },
     /** 多选事件 */
@@ -266,11 +252,6 @@ export default {
           type: 'success'
         })
         this.getAllDataModel()
-      }).catch((e) => {
-        this.$message({
-          message: e,
-          type: 'warning'
-        })
       })
     }
   }

+ 8 - 10
industry-admin/src/views/source/dataSource/index.vue

@@ -80,15 +80,18 @@
             <el-input v-model.number='connForm.ipPort' type="text" auto-complete="off" placeholder="请输入端口号"
               oninput="value=value.replace(/[^0-9.]/g,'')"></el-input>
           </el-form-item>
-          <el-form-item label="是否匿名:" prop="isAnonymous" required v-if="connForm.connType.type != 'opc_da_real' && connForm.connType.type !='modbus_real'">
+          <el-form-item label="是否匿名:" prop="isAnonymous" required
+            v-if="connForm.connType.type != 'opc_da_real' && connForm.connType.type != 'modbus_real'">
             <el-radio-group v-model="connForm.isAnonymous">
               <el-radio v-for="dict in isAnonymous" :key="dict.value" :label="dict.value">{{ dict.key }}</el-radio>
             </el-radio-group>
           </el-form-item>
-          <el-form-item label='帐号:' prop="ipUserName" v-if="connForm.isAnonymous != 1 && connForm.connType.type !='modbus_real'">
+          <el-form-item label='帐号:' prop="ipUserName"
+            v-if="connForm.isAnonymous != 1 && connForm.connType.type != 'modbus_real'">
             <el-input v-model='connForm.ipUserName' type="text" auto-complete="off" placeholder="请输入帐号"></el-input>
           </el-form-item>
-          <el-form-item label='密码:' prop="ipPassword" key="ipPassword" v-if="connForm.isAnonymous != 1 && connForm.connType.type !='modbus_real'">
+          <el-form-item label='密码:' prop="ipPassword" key="ipPassword"
+            v-if="connForm.isAnonymous != 1 && connForm.connType.type != 'modbus_real'">
             <el-input v-model='connForm.ipPassword' clearable type="password" auto-complete="new-password"
               placeholder="请输入密码"></el-input>
           </el-form-item>
@@ -280,11 +283,6 @@ export default {
         }
         this.tableTotal = res.data.count
         this.tableData = res.data.dataSourceList
-      }).catch((e) => {
-        this.$message({
-          message: e,
-          type: 'warning'
-        })
       })
     },
     /** 添加数据源配置 */
@@ -400,7 +398,7 @@ export default {
         return
       }
       if (!this.datasourceForm.datasourceName || !this.datasourceForm.datasourceName.trim()) {
-        this.showMsg("数据源名称不能为空!", "数据源名称不能为空!")
+        this.showMsg("数据源名称不能为空!")
         return
       }
       this.$refs['datasourceForm'].validate(valid => {
@@ -485,7 +483,7 @@ export default {
           if (showMsg) this.showMsg('从站id不能为空!')
           return false
         }
-      }else {
+      } else {
         if (!this.connForm.ipPort) {
           if (showMsg) this.showMsg('端口号不能为空!')
           return false

+ 11 - 9
industry-admin/src/views/source/itemGroup/itemChoose.vue

@@ -1,8 +1,8 @@
 <template>
     <div>
         <!-- 数据项选择 -->
-        <el-dialog v-if="visible" :title="title" width="30%" custom-class="dialog-med" top="10vh" center :before-close="dialogClose"
-            :visible.sync="visible" :close-on-click-modal="false" :append-to-body="true">
+        <el-dialog v-if="visible" :title="title" width="30%" custom-class="dialog-med" top="10vh" center
+            :before-close="dialogClose" :visible.sync="visible" :close-on-click-modal="false" :append-to-body="true">
             <el-form ref="itemGroupForm" :model="itemGroupForm" :rules="groupRules" label-width="80px">
                 <el-form-item label="组名称" prop="groupName">
                     <el-input v-model="itemGroupForm.groupName" type="text" auto-complete="off" maxlength="20"
@@ -39,7 +39,7 @@
         <ItemChooseTree ref="itemChooseTree" @saveItemChoose="saveItemChoose"></ItemChooseTree>
 
         <!-- modbus协议       -->
-        <modbus-list ref="modbusList"/>
+        <modbus-list ref="modbusList" />
     </div>
 </template>
 
@@ -54,7 +54,7 @@ import ModbusList from "./model/modbusList.vue";
 
 export default {
     components: {
-      ModbusList,
+        ModbusList,
         ItemChooseTree
     },
     data() {
@@ -116,12 +116,12 @@ export default {
                 return
             }
             const dataSources = this.dataSourceList;
-          for (let i = 0; i < dataSources.length; i++) {
-            if (dataSources[i].id === this.itemGroupForm.dataSourceId && dataSources[i].dataSourceTypeKey === 'modbus_real') {
-              this.$refs.modbusList.initPage(this.itemGroupForm.itemList)
-              return;
+            for (let i = 0; i < dataSources.length; i++) {
+                if (dataSources[i].id === this.itemGroupForm.dataSourceId && dataSources[i].dataSourceTypeKey === 'modbus_real') {
+                    this.$refs.modbusList.initPage(this.itemGroupForm.itemList)
+                    return;
+                }
             }
-          }
             const loading = showLoading(this, "加载中,请稍候···");
             //获取根节点的树信息
             getNextAllItem(this.itemGroupForm.dataSourceId, null).then((res) => {
@@ -156,6 +156,8 @@ export default {
                 );
                 this.$refs.itemChooseTree.title = '选择数据项'
                 this.$refs.itemChooseTree.visible = true
+                this.$refs.itemChooseTree.dataSourceId = this.itemGroupForm.dataSourceId
+                this.$refs.itemChooseTree.dataSourceList = this.dataSourceList
                 this.$refs.itemChooseTree.isSelectAllItem = false
                 this.$refs.itemChooseTree.itemList = this.itemGroupForm.itemList
                 let arr = [];