Browse Source

调整基础问题

FinalYu 2 years ago
parent
commit
9ecd033879

+ 12 - 5
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -129,7 +129,7 @@
           <div slot="label">频率设置</div>
           <div class="cy-form">
             <el-form ref="groupRateForm" :label-position="labelPosition" :model='groupRateForm' label-width='100px'>
-              <el-form-item label='读取模式' prop="readMode">
+              <el-form-item label='读取模式' prop="readMode" :required="true">
                 <el-select v-model="groupRateForm.readMode" placeholder="请选择读取模式" style="width: 100%;" @change="readModeChange">
                   <el-option
                       v-for="dict in readModeList"
@@ -139,13 +139,13 @@
                   ></el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="模式值" prop="modeValue" v-if="groupRateForm.readMode != '1'">
+              <el-form-item label="模式值" prop="modeValue" v-if="groupRateForm.readMode != '1'" :required="true">
                 <el-input v-model="groupRateForm.modeValue" placeholder="请输入模式值"
                           oninput="value=value.replace(/[^0-9.]/g,'')">
                   <template slot="append" v-if="groupRateForm.readMode == '0'">秒</template>
                 </el-input>
               </el-form-item>
-              <el-form-item label='取值模式' prop="valueMode">
+              <el-form-item label='取值模式' prop="valueMode" :required="true">
                 <el-select v-model="groupRateForm.valueMode" placeholder="请选择取值模式" style="width: 100%;">
                   <el-option
                       v-for="dict in valueModeList"
@@ -155,7 +155,7 @@
                   ></el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label='读取时期' prop="valuePeriod">
+              <el-form-item label='读取时期' prop="valuePeriod" :required="true">
                 <el-time-picker
                     is-range
                     :editable="false"
@@ -640,7 +640,7 @@ export default {
     /** 保存数据组 */
     handleSave() {
       this.$refs['groupBasicForm'].validate(valid => {
-        if (valid && this.checkParams()) {
+        if (this.checkParams() && valid) {
           // 参数封装
           let params = JSON.parse(JSON.stringify(this.groupBasicForm))
           params.readMode = this.groupRateForm.readMode
@@ -862,6 +862,13 @@ export default {
     },
     /** 参数检查 */
     checkParams() {
+      if (!this.groupBasicForm.groupName) {
+        this.$message({
+          message: '组名称不能为空!',
+          type: 'warning'
+        })
+        return false
+      }
       if (this.groupBasicForm.itemList.length == 0) {
         this.$message({
           message: '请添加数据项!',

+ 1 - 1
chuanyi_client2/src/components/HeaderPersonal/index.vue

@@ -9,8 +9,8 @@
       </div>
       <el-dropdown-menu slot="dropdown">
         <!--          <el-dropdown-item>详细信息</el-dropdown-item>-->
+        <el-dropdown-item @click.native="reloadPage">首页</el-dropdown-item>
         <el-dropdown-item @click.native="updateUserPwd">修改密码</el-dropdown-item>
-        <el-dropdown-item @click.native="reloadPage">刷新页面</el-dropdown-item>
         <el-dropdown-item @click.native="checkApplicationUpdate">关于我们</el-dropdown-item>
         <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
       </el-dropdown-menu>

+ 68 - 49
chuanyi_client2/src/components/LeftMenu/index.vue

@@ -98,7 +98,7 @@
         :title="connDialogTitle"
         width="500px"
         center
-        :before-close="handleClose"
+        :before-close="handleCloseByConn"
         :visible.sync="connDialogVisible"
         :close-on-click-modal="false"
         :append-to-body="true">
@@ -407,57 +407,70 @@ export default {
         }
       })
     },
-    /** 连接事件:type 1 测试连接 2 确定 3 保存 */
-    handleConnect(type) {
-      // 已有链接编辑:未改变点击保存直接关闭弹出层
-      if (this.chooseConnServer) {
-        this.chooseConnServer = null
-        this.handleCancel()
-        return
+    checkDataSourceParam(type) {
+      // 已有链接编辑且数据未改变
+      if (type == 3 && this.chooseConnServer && !this.$refs['connForm']) {
+        this.connForm = JSON.parse(JSON.stringify(this.chooseConnServer))
+        this.connForm.connType = {
+          'type' : this.chooseConnServer.dataSourceTypeKey,
+          'id': this.chooseConnServer.typeId
+        }
+      }
+      // 判断驱动类型
+      if (this.connForm.connType.type == 'opc_da_real') {
+        if (!this.connForm.clsId) {
+          this.$message({
+            message: '请选择驱动!',
+            type: 'warning'
+          })
+          return false
+        }
       }
-      // 未配置服务连接信息
-      if (!this.$refs['connForm']) {
+      // 判断基础数据
+      if (!this.connForm.ipAddress) {
         this.$message({
           message: '请检查配置信息!',
           type: 'warning'
         })
+        return false
+      }
+      return true
+    },
+    /** 连接事件:type 1 测试连接 2 确定 3 保存 */
+    handleConnect(type) {
+      if (!this.checkDataSourceParam(type)) {
         return
       }
-      this.$refs['connForm'].validate(valid => {
-        if (valid) {
-          // 参数封装
-          let params = JSON.parse(JSON.stringify(this.connForm))
-          params.dataSourceName = this.datasourceForm.datasourceName
-          params.dataSourceDescribe = this.datasourceForm.desc
-          if (params.isAnonymous == 1) {
-            params.ipPassword = ''
-            params.ipUserName = ''
-          } else {
-            if (!this.chooseConnServer || (this.chooseConnServer
-                && this.connForm.ipPassword != this.chooseConnServer.ipPassword)) {
-              params.ipPassword = encrypt(this.connForm.ipPassword, getPubKey())
-            }
-          }
-          if (this.chooseConnServer) {
-            params.typeId = this.chooseConnServer.typeId
-          } else if (this.chooseServerType) {
-            params.typeId = this.chooseServerType.id
-          }
-          // 接口请求
-          if (type == 1) {
-            this.testConnect(params)
-          } else if (type == 3) {
-            this.saveConnect(params)
-          } else {
-            this.connDialogVisible = false
-          }
-        } else {
-          this.$message({
-            message: '请检查配置信息!',
-            type: 'warning'
-          })
+      this.handleWithConnect(type)
+    },
+    /** 处理连接 */
+    handleWithConnect(type) {
+      // 参数封装
+      let params = JSON.parse(JSON.stringify(this.connForm))
+      params.dataSourceName = this.datasourceForm.datasourceName
+      params.dataSourceDescribe = this.datasourceForm.desc
+      if (params.isAnonymous == 1) {
+        params.ipPassword = ''
+        params.ipUserName = ''
+      } else {
+        if (!this.chooseConnServer || (this.chooseConnServer
+            && this.connForm.ipPassword != this.chooseConnServer.ipPassword)) {
+          params.ipPassword = encrypt(this.connForm.ipPassword, getPubKey())
         }
-      })
+      }
+      if (this.chooseConnServer) {
+        params.typeId = this.chooseConnServer.typeId
+      } else if (this.chooseServerType) {
+        params.typeId = this.chooseServerType.id
+      }
+      // 接口请求
+      if (type == 1) {
+        this.testConnect(params)
+      } else if (type == 3) {
+        this.saveConnect(params)
+      } else {
+        this.connDialogVisible = false
+      }
     },
     /** 测试连接 */
     testConnect(params) {
@@ -496,8 +509,7 @@ export default {
             confirmButtonText: '确定',
             callback: action => {
               this.handleCancel()
-              // 刷新右侧数据源类型列表
-              this.getMyDatasourceList()
+              this.initConfigForm()
             }
           })
           return
@@ -555,9 +567,10 @@ export default {
           }).catch((e) => {
             loading.close()
             console.error(e)
-            this.$message({
-              message: '驱动获取失败!',
-              type: 'warning'
+            this.$alert(e, '驱动获取失败!', {
+              confirmButtonText: '确定',
+              callback: action => {
+              }
             })
           })
         }
@@ -588,12 +601,18 @@ export default {
           this.clearDatasourceBg()
           if (this.$refs['connForm']) this.$refs['connForm'].resetFields()
           this.$refs['datasourceForm'].resetFields()
+          this.chooseConnServer = null
+          this.chooseServerType = null
           this.connDialogVisible = false
           this.datasourceDialogVisible = false
           break
       }
     },
     /** 弹出层关闭事件 */
+    handleCloseByConn(done) {
+      this.handleCancel("conn")
+    },
+    /** 弹出层关闭事件 */
     handleClose(done) {
       this.$refs['datasourceForm'].resetFields()
       done()

+ 5 - 5
chuanyi_client2/src/utils/request.js

@@ -19,8 +19,8 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 const service = axios.create({
     // axios中请求配置有baseURL选项,表示请求URL公共部分
     // baseURL: "http://192.168.2.106:8081",
-    // baseURL: "http://192.168.1.226:8081",
-    baseURL: "http://127.0.0.1:8081",
+    baseURL: "http://192.168.1.226:8081",
+    // baseURL: "http://127.0.0.1:8081",
     // 超时
     timeout: 30000
 })
@@ -103,9 +103,9 @@ service.interceptors.response.use(res => {
         } else if (code === 500) {
             return Promise.reject(new Error(msg))
         } else if (code !== 200) {
-            Notification.error({
-                title: msg
-            })
+            // Notification.error({
+            //     title: msg
+            // })
             return Promise.reject(new Error(res.data.msg))
         } else {
             return res.data

+ 5 - 2
chuanyi_client2/src/views/data_model/index.vue

@@ -57,7 +57,7 @@
 
     <!-- 新增数据模型 -->
     <el-dialog
-        title="新增数据模型"
+        :title="dialogDataModelTitle"
         width="80%"
         top="10vh"
         center
@@ -69,7 +69,7 @@
         <el-form-item label="四则运算表达式" prop="operationRule">
           <el-input v-model="dataModelForm.operationRule" placeholder="请输入四则运算表达式"></el-input>
           <span style="font-size: 12px;">
-            提示:四则运算支持的符号&nbsp;【<b>+</b>】、【<b>-</b>】、【<b>*</b>】、【<b>/</b>】、【<b>()</b>】,真实数据值使用固定字符串&nbsp;【<b>calcVal</b>】
+            提示:四则运算支持的英文符号&nbsp;【<b>+</b>】、【<b>-</b>】、【<b>*</b>】、【<b>/</b>】、【<b>()</b>】,真实数据值使用固定字符串&nbsp;【<b>calcVal</b>】
           </span>
         </el-form-item>
         <el-form-item label="备注" prop="remark">
@@ -133,6 +133,7 @@ export default {
     return {
       breadcrumbList: ['数据模型'],
       dialogDataModelVisible: false,
+      dialogDataModelTitle: '新增数据模型',
       tablePage: 1,
       tableLimit: 10,
       tableTotal: 0,
@@ -160,10 +161,12 @@ export default {
   methods: {
     /** 新增数据模型 */
     handleAdd() {
+      this.dialogDataModelTitle = '新增数据模型'
       this.dialogDataModelVisible = true
     },
     /** 编辑数据模型 */
     handleEdit(index, row) {
+      this.dialogDataModelTitle = '编辑数据模型'
       this.dataModelForm = row
       this.dialogDataModelVisible = true
     },

+ 4 - 3
chuanyi_client2/src/views/group_item/index.vue

@@ -27,16 +27,17 @@
       </el-table-column>
       <el-table-column v-if="groupRunStatus" prop="dataValue" label="数据项值" align="center" width="120">
       </el-table-column>
-      <el-table-column v-if="!groupRunStatus" prop="describe" label="描述" align="center" width="120">
+      <el-table-column v-if="!groupRunStatus" prop="describe" label="描述" align="center" width="150">
         <template slot-scope="scope" v-if="scope.row.describe">
-          <el-tag type="primary" disable-transitions>{{ scope.row.describe }}</el-tag>
+<!--          <el-tag type="primary" disable-transitions>{{ scope.row.describe }}</el-tag>-->
+          <span>{{ scope.row.describe }}</span>
         </template>
       </el-table-column>
       <el-table-column prop="dataSourceName" label="数据源名称" align="center" width="200">
       </el-table-column>
       <el-table-column v-if="groupRunStatus" prop="createTime" label="运行时间" align="center" width="120">
       </el-table-column>
-      <el-table-column v-if="!groupRunStatus" fixed="right" label="操作" width="100">
+      <el-table-column v-if="!groupRunStatus" label="操作" align="center" width="100">
         <template slot-scope="scope">
           <el-button type="text" size="small" @click="handleClickByEdit(scope.row)">编辑</el-button>
         </template>

+ 14 - 5
chuanyi_client2/src/views/my_report/index.vue

@@ -16,7 +16,7 @@
         <div class="cy-list">
           <ul v-if="reportDataList.length > 0">
             <li v-for="item in reportDataList">
-              <i class="el-icon-delete"
+              <i v-if="uid == item.userId" class="el-icon-delete"
                  style="float: right; margin-top: -10px; margin-right: -10px; cursor: pointer;"
                  @click="removeReportItem(item)"></i>
               <div class="cy-item-name" @click="handleReportNodeClick(item)" :title="item.reportTableName">{{ item.reportTableName }}</div>
@@ -26,8 +26,10 @@
               </div>
               <div style="display: flex; float: right;">
                 <div class="cy-item-val" style="width: 60px;">自动报表</div>
-                <el-switch :value="item.isAutoReport == '1'" active-color="#13ce66"
-                           @change="switchChangeEvent($event, item)"></el-switch>
+                <el-switch v-if="item.isAutoReport == '2'" :value="true" active-color="#13ce66"
+                           disabled></el-switch>
+                <el-switch v-else :value="item.isAutoReport == '1'" active-color="#13ce66"
+                           @change="switchChangeEvent($event, item)" :disabled="uid != item.userId"></el-switch>
               </div>
               <div class="cy-list-item">{{ item.createTime }}</div>
             </li>
@@ -192,12 +194,19 @@ import Print from 'print-js'
 import {getUsername} from '@/utils/auth'
 import {exportExcel} from '@/utils/export'
 import {getAllUserGroup} from "@/api/user";
+import {mapGetters} from "vuex";
 
 export default {
   name: "index",
   components: {
     BreadcrumbView
   },
+  computed: {
+    ...mapGetters([
+      'name',
+      'uid'
+    ])
+  },
   data() {
     return {
       breadcrumbList: ['我的报表'],
@@ -1141,9 +1150,9 @@ export default {
 
           .cy-list-item {
             font-size: 12px;
-            float: right;
-            margin-top: 5px;
             color: #f6f6f6;
+            width: 100%;
+            display: flex;
           }
         }
       }