shaun-sheep 4 years ago
parent
commit
34a72f1bc5

+ 6 - 6
config/dev.env.js

@@ -4,14 +4,14 @@ const prodEnv = require('./prod.env')
 
 module.exports = merge(prodEnv, {
     NODE_ENV: '"development"',
-    // BASE_URL: '"http://172.16.44.215"', //测试iframe地址
-    // SSO_SERVER: '"http://172.16.44.235:8081"', //测试环境
+    BASE_URL: '"http://172.16.44.215"', //测试iframe地址
+    SSO_SERVER: '"http://172.16.44.235:8081"', //测试环境
     // BASE_URL: '"http://192.168.20.236"', //(新)测试iframe地址
     // SSO_SERVER: '"http://192.168.20.236:8086"', //(新)测试环境
-    // MQTT_SERVICE: '"ws://172.16.42.210:61614/stomp/"' //MQ测试环境地址
-    SSO_SERVER: '"http://sso.sagacloud.cn"',  //正式环境
-    BASE_URL: '"http://mbi.sagacloud.cn"', //线上iframe地址
-    MQTT_SERVICE: '"ws://adm.sagacloud.cn/stomp/"' //MQ正式环境地址
+    MQTT_SERVICE: '"ws://172.16.42.210:61614/stomp/"' //MQ测试环境地址
+    // SSO_SERVER: '"http://sso.sagacloud.cn"',  //正式环境
+    // BASE_URL: '"http://mbi.sagacloud.cn"', //线上iframe地址
+    // MQTT_SERVICE: '"ws://adm.sagacloud.cn/stomp/"' //MQ正式环境地址
 })
 
 

+ 189 - 189
config/index.js

@@ -10,197 +10,197 @@ module.exports = {
     assetsSubDirectory: 'static',
     assetsPublicPath: '/',
 
-    proxyTable: {//正式环境
-      '/admin': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/admin": "/"
-        }
-      },
-      '/api': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/api": "/"
-        }
-      },
-      '/data-platform-3': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn/',
-        // 如果要代理 websockets
-        ws: true,
-        // 将主机标头的原点更改为目标URL
-        changeOrigin: false
-      },
-      '/business-space': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/business-space": "/dp-auxiliary/business-space/"
-        }
-      },
-      '/pointconfig': {
-        // 目标 API 地址
-        target: 'http://mbi.sagacloud.cn:8080/',
-        // 如果要代理 websockets
-        ws: true,
-        // 将主机标头的原点更改为目标URL
-        changeOrigin: false
-      },
-      '/venders-dp': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/venders-dp": "/dp-auxiliary/venders-dp/"
-        }
-      },
-      '/venders': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/venders": "/dp-auxiliary/venders/"
-        }
-      },
-      '/ScanBuilding': {
-        // 目标 API 地址
-        target: 'http://mbi.sagacloud.cn:8080/',
-        // 如果要代理 websockets
-        ws: true,
-        // 将主机标头的原点更改为目标URL
-        changeOrigin: false
-      },
-      '/scanbuilding-2': {
-        // 目标 API 地址
-        target: 'http://mbi.sagacloud.cn:8080/',
-        // 如果要代理 websockets
-        ws: true,
-        // 将主机标头的原点更改为目标URL
-        changeOrigin: false
-      },
-      '/image-service': {
-        // 目标 API 地址
-        target: 'http://api.sagacloud.cn',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/image-service": "/dp-auxiliary/image-service/"
-        }
-      },
-      '/modelapi': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-          "^/modelapi": "/revit-algorithm/"
-        }
-      },
-      '/schedulerapi': {
-        target: 'http://mbi.sagacloud.cn:8080',
-        changeOrigin: true,
-        pathRewrite: {
-            "^/schedulerapi": "/scheduler/"
-        }
-      },
-    },
-
-    // proxyTable: {
-    //     '/admin': {
-    //         target: 'http://172.16.44.235:8080',
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/admin": "/"
-    //         }
-    //     },
-    //     '/api': {
-    //         target: 'http://172.16.44.235:8080',
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/api": "/"
-    //         }
-    //     },
-    //     '/data-platform-3': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/business-space': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/pointconfig': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.44.235:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/venders-dp': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/venders': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/ScanBuilding': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.44.235:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    // '/scanbuilding-2': {
-    //   // 目标 API 地址
-    //   target: 'http://mbi.sagacloud.cn:8080/',
-    //   // 如果要代理 websockets
-    //   ws: true,
-    //   // 将主机标头的原点更改为目标URL
-    //   changeOrigin: false
-    // },
-    //     '/image-service': {
-    //         // 目标 API 地址
-    //         target: 'http://172.16.42.210:8080/',
-    //         // 如果要代理 websockets
-    //         ws: true,
-    //         // 将主机标头的原点更改为目标URL
-    //         changeOrigin: false
-    //     },
-    //     '/modelapi': {
-    //         target: 'http://172.16.42.210:8082',
-    //         // target: 'http://192.168.20.218:8082',//景灏
-    //         changeOrigin: true,
-    //         pathRewrite: {
-    //             "^/modelapi": "/"
-    //         }
-    //     },
-    //     '/schedulerapi': {
-    //       target: 'http://172.16.42.210:8081',
-    //       changeOrigin: true,
-    //       pathRewrite: {
-    //           "^/schedulerapi": "/"
-    //       }
-    //     },
+    // proxyTable: {//正式环境
+    //   '/admin': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/admin": "/"
+    //     }
+    //   },
+    //   '/api': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/api": "/"
+    //     }
+    //   },
+    //   '/data-platform-3': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn/',
+    //     // 如果要代理 websockets
+    //     ws: true,
+    //     // 将主机标头的原点更改为目标URL
+    //     changeOrigin: false
+    //   },
+    //   '/business-space': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/business-space": "/dp-auxiliary/business-space/"
+    //     }
+    //   },
+    //   '/pointconfig': {
+    //     // 目标 API 地址
+    //     target: 'http://mbi.sagacloud.cn:8080/',
+    //     // 如果要代理 websockets
+    //     ws: true,
+    //     // 将主机标头的原点更改为目标URL
+    //     changeOrigin: false
+    //   },
+    //   '/venders-dp': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/venders-dp": "/dp-auxiliary/venders-dp/"
+    //     }
+    //   },
+    //   '/venders': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/venders": "/dp-auxiliary/venders/"
+    //     }
+    //   },
+    //   '/ScanBuilding': {
+    //     // 目标 API 地址
+    //     target: 'http://mbi.sagacloud.cn:8080/',
+    //     // 如果要代理 websockets
+    //     ws: true,
+    //     // 将主机标头的原点更改为目标URL
+    //     changeOrigin: false
+    //   },
+    //   '/scanbuilding-2': {
+    //     // 目标 API 地址
+    //     target: 'http://mbi.sagacloud.cn:8080/',
+    //     // 如果要代理 websockets
+    //     ws: true,
+    //     // 将主机标头的原点更改为目标URL
+    //     changeOrigin: false
+    //   },
+    //   '/image-service': {
+    //     // 目标 API 地址
+    //     target: 'http://api.sagacloud.cn',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/image-service": "/dp-auxiliary/image-service/"
+    //     }
+    //   },
+    //   '/modelapi': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //       "^/modelapi": "/revit-algorithm/"
+    //     }
+    //   },
+    //   '/schedulerapi': {
+    //     target: 'http://mbi.sagacloud.cn:8080',
+    //     changeOrigin: true,
+    //     pathRewrite: {
+    //         "^/schedulerapi": "/scheduler/"
+    //     }
+    //   },
     // },
 
+    proxyTable: {
+        '/admin': {
+            target: 'http://172.16.44.235:8080',
+            changeOrigin: true,
+            pathRewrite: {
+                "^/admin": "/"
+            }
+        },
+        '/api': {
+            target: 'http://172.16.44.235:8080',
+            changeOrigin: true,
+            pathRewrite: {
+                "^/api": "/"
+            }
+        },
+        '/data-platform-3': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/business-space': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/pointconfig': {
+            // 目标 API 地址
+            target: 'http://172.16.44.235:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/venders-dp': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/venders': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/ScanBuilding': {
+            // 目标 API 地址
+            target: 'http://172.16.44.235:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+    '/scanbuilding-2': {
+      // 目标 API 地址
+      target: 'http://mbi.sagacloud.cn:8080/',
+      // 如果要代理 websockets
+      ws: true,
+      // 将主机标头的原点更改为目标URL
+      changeOrigin: false
+    },
+        '/image-service': {
+            // 目标 API 地址
+            target: 'http://172.16.42.210:8080/',
+            // 如果要代理 websockets
+            ws: true,
+            // 将主机标头的原点更改为目标URL
+            changeOrigin: false
+        },
+        '/modelapi': {
+            target: 'http://172.16.42.210:8082',
+            // target: 'http://192.168.20.218:8082',//景灏
+            changeOrigin: true,
+            pathRewrite: {
+                "^/modelapi": "/"
+            }
+        },
+        '/schedulerapi': {
+          target: 'http://172.16.42.210:8081',
+          changeOrigin: true,
+          pathRewrite: {
+              "^/schedulerapi": "/"
+          }
+        },
+    },
+
     // Various Dev Server settings
     host: '0.0.0.0', // can be overwritten by process.env.HOST
     port: 28080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined

+ 18 - 9
src/components/config_point/ip_input.vue

@@ -1,14 +1,23 @@
 <template>
     <ul class="ipAdress">
-        <template v-for="(item,index) in ipAdress">
-            <li class="saga-border bg-write" :key="index">
-                <input type="text" @input="checkIpVal(item,index)" @keyup="turnIpPOS(item,index,$event)" v-model="item.value" ref="ipInput" @blur="setDefaultVal(item)">
-            </li>
-            <span v-if="!!value && index == 3" v-show="ProtocolType != 'opc'">:</span>
-            <li v-if="!!value && index == 3" v-show="ProtocolType != 'opc'" class="saga-border bg-write">
-                <input type="text" @input="checkIpVal(value[0],4)" @keyup="turnIpPOS(value[0],4,$event)" v-model="value[0].value" ref="ipInput" @blur="setDefaultVal(value)">
-            </li>
-        </template>
+<!--        <template v-for="(item,index) in ipAdress">-->
+<!--            <li class="saga-border bg-write" :key="index">-->
+<!--                <input type="text" @input="checkIpVal(item,index)" @keyup="turnIpPOS(item,index,$event)" v-model="item.value" ref="ipInput" @blur="setDefaultVal(item)">-->
+<!--            </li>-->
+<!--            <span v-if="!!value && index == 3" v-show="ProtocolType != 'opc'">:</span>-->
+<!--            <li v-if="!!value && index == 3" v-show="ProtocolType != 'opc'" class="saga-border bg-write">-->
+<!--                <input type="text" @input="checkIpVal(value[0],4)" @keyup="turnIpPOS(value[0],4,$event)" v-model="value[0].value" ref="ipInput" @blur="setDefaultVal(value)">-->
+<!--            </li>-->
+<!--        </template>-->
+      <template v-for="(item,index) in ipAdress">
+        <li class="saga-border bg-write" :key="index">
+          <input type="text" @input="checkIpVal(item,index)" @keyup="turnIpPOS(item,index,$event)" v-model="item.value" ref="ipInput" @blur="setDefaultVal(item)">
+        </li>
+        <span v-if="!!value && index == 3">:</span>
+        <li v-if="!!value && index == 3" class="saga-border bg-write">
+          <input type="text" @input="checkIpVal(value[0],4)" @keyup="turnIpPOS(value[0],4,$event)" v-model="value[0].value" ref="ipInput" @blur="setDefaultVal(value)">
+        </li>
+      </template>
     </ul>
 </template>
 <script>

+ 310 - 0
src/views/point/config_point/edit_origin/dialog.vue

@@ -0,0 +1,310 @@
+<template>
+  <el-dialog :visible.sync="dialogVisible" :title="title" class="edit-origin-dialog">
+    <el-form style="width:400px;" :model="formData" class="dcenter" label-width="120px">
+      <!--                <el-form-item label="">-->
+      <!--                    <el-input v-model="formData.Name" placeholder="请输入数据源名称"></el-input>-->
+      <!--                </el-form-item>-->
+      <el-form-item label="接口名称">
+        <el-input v-model="formData.Name" placeholder="请输入接口名称"></el-input>
+      </el-form-item>
+      <!--            <el-input type="textarea" class="edit-textarea dcenter block" v-model="formData.Description" placeholder="请维护数据源说明"></el-input>-->
+      <el-form-item label="协议类型">
+        <el-select v-model="formData.ProtocolType" filterable @change="handleChangeProtocolType"
+                   placeholder="请选择">
+          <el-option v-for="item in options" :key="item.value" :label="item.label"
+                     :value="item.value"></el-option>
+        </el-select>
+      </el-form-item>
+      <!--                <el-form-item label="主机IP地址" v-if="formData.ProtocolType != 'common'">-->
+      <!--                    <ip-input :ip="formData.ProtocolInfo.Ip" :port="formData.ProtocolInfo.Port" :ProtocolType="formData.ProtocolType" @change="changeItem" @deletePort="deletePort"></ip-input>-->
+      <!--                </el-form-item>  -->
+      <el-form-item label="通讯地址/端口" v-if="formData.ProtocolType != 'common'">
+        <ip-input :ip="formData.ProtocolInfo.Ip" :port="formData.ProtocolInfo.Port"
+                  :ProtocolType="formData.ProtocolType" @change="changeItem" @deletePort="deletePort"></ip-input>
+      </el-form-item>
+      <template v-if="formData.ProtocolType == 'opc'">
+        <el-form-item label="用户名">
+          <el-input v-model="formData.ProtocolInfo.User"></el-input>
+        </el-form-item>
+        <el-form-item label="密码">
+          <el-input v-model="formData.ProtocolInfo.Password"></el-input>
+        </el-form-item>
+        <el-form-item label="ProgId">
+          <el-input v-model="formData.ProtocolInfo.ProgId"></el-input>
+        </el-form-item>
+      </template>
+
+      <el-form-item label="采集间隔(s)" v-if="formData.ProtocolType != 'ems-collect'">
+        <el-input-number v-model="formData.CollectInterval" controls-position="right" :min="10"></el-input-number>
+      </el-form-item>
+      <el-form-item label="通讯模式" v-if="formData.ProtocolType != 'common'  && formData.ProtocolType != 'ems-collect' ">
+        <el-select filterable>
+          <el-option></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="网络类型">
+        <el-select v-model="formData.wangluo" filterable @change="handleChangeNetType" placeholder="请选择">
+          <el-option v-for="item in netOptons" :key="item.value" :label="item.label"
+                     :value="item.value"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="描述">
+        <el-input type="textarea" v-model="formData.Description" :autosize="{ minRows: 4, maxRows: 4}"
+                  placeholder="请输入描述内容,200个字以内"></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button :disabled="formData.wangluo =='jianjie'?true:false">测试</el-button>
+        <el-button>取消</el-button>
+        <el-button type="primary">保存</el-button>
+      </el-form-item>
+      <el-form-item label="测试日志">
+        <el-input type="textarea" v-model="formData.ceshi" :autosize="{ minRows: 4, maxRows: 4}"
+                  disabled></el-input>
+      </el-form-item>
+      <!--      <el-form-item label="用户名/密码" v-if="(passWordArr.indexOf(formData.ProtocolType) > -1)">-->
+      <!--        <el-input v-model="formData.ProtocolInfo.User" style="display:inline-block;width:100px;"></el-input>-->
+      <!--        -->
+      <!--        <el-input v-model="formData.ProtocolInfo.Password" style="display:inline-block;width:100px;"></el-input>-->
+      <!--      </el-form-item>-->
+      <!--      <el-form-item label="ProgId" v-if="formData.ProtocolType == 'opc'">-->
+      <!--        <el-input v-model="formData.ProtocolInfo.ProgId" style="display:inline-block;width:100px;"></el-input>-->
+      <!--      </el-form-item>-->
+      <el-form-item label="属性详情" v-if="formData.ProtocolType == 'common'">
+        <el-input type="textarea" :autosize="{ minRows: 8, maxRows: 8}" v-model="ProtocolInfo"
+                  placeholder="请输入json格式数据" style="display:inline-block;width:400px;"></el-input>
+      </el-form-item>
+
+    </el-form>
+
+  </el-dialog>
+</template>
+
+<script>
+  import ipInput from "@/components/config_point/ip_input"
+  // import bread from "components/common/bread_crumb"
+  import tools from "@/utils/tools"
+  import {createDataSource, queryDataSource, updateDataSource} from "@/fetch/point_http"
+  import {mapGetters} from "vuex";
+
+  export default {
+    computed: {
+      ...mapGetters("layout", [
+        "projectId"
+      ])
+    },
+    data() {
+      return {
+        dialogVisible: false,
+        title: '',
+        passWordArr: ['mqtt', 'amqp', 'opc'],
+        formData: {
+          ProtocolType: "", //协议类型
+          ProtocolStandarded: true,
+          Name: "",
+          ProtocolInfo: {
+            Ip: "", //ip
+            Port: "", //端口号,有些协议类型没有该信息
+            User: "", //用户名
+            Password: "", //密码
+            ProgId: "", //progId
+          },
+          Description: "",
+          CollectInterval: 10
+        },
+        ProtocolInfo: "",//自定义协议信息
+        options: [{
+          value: 'modbus-tcp',
+          label: 'Modbus TCP'
+        }, {
+          value: 'bacnet-ip',
+          label: 'BACNet IP'
+        }, {
+          value: 'opc',
+          label: 'OPC'
+        }, {
+          value: 'knx',
+          label: 'KNX'
+        }, {
+          value: 'mqtt',
+          label: 'MQTT'
+        }, {
+          value: 'amqp',
+          label: 'AMQP'
+        }, {
+          value: 'lora',
+          label: 'LoRa'
+        }, {
+          value: 'ems-collect',
+          label: 'ems-collect'
+        }, {
+          value: 'common',
+          label: '其他'
+        }],
+        netOptons: [
+          {
+            value: 'zhilian',
+            label: '直连'
+          }, {
+            value: 'jianjie',
+            label: '间接'
+          },
+        ],
+        // id: this.$route.query.key
+      }
+    },
+    components: {
+      ipInput,
+      // bread
+    },
+    // created() {
+    //   this.$store.dispatch('setBreadcrumb', [{
+    //     label: '系统集成',
+    //     path: '/point/pointsetting'
+    //   }, {
+    //     label: '子系统点位接入',
+    //     path: '/point/pointsetting'
+    //   }, {
+    //     label: this.id ? '编辑数据源' : '添加数据源'
+    //   }])
+    // },
+    // mounted() {
+    //   console.log(this.id)
+    //   if (!!this.id) {
+    //     this.getDataSouse()
+    //   }
+    // },
+    methods: {
+      openDialog(obj) {
+        this.dialogVisible = true
+        this.title = obj ? '编辑数据源' : '添加数据源'
+        this.getDataSouse(obj)
+
+      },
+      changeItem(ip, port) {
+        this.formData.ProtocolInfo.Ip = ip
+        this.formData.ProtocolInfo.Port = port
+      },
+      handleChangeProtocolType(val) {//切换协议类型
+        switch (val) {
+          case 'modbus-tcp':
+          case 'bacnet-ip':
+          case 'knx':
+          case 'lora':
+            break
+          case 'opc' :
+            break
+          case 'mqtt':
+          case 'amqp':
+            break
+          case 'ems-collect':
+            break
+          case 'common':
+            this.formData.ProtocolStandarded = false
+            break
+
+        }
+        // if (val == 'common') {
+        //   this.formData.ProtocolStandarded = false
+        // } else {
+        //   this.formData.ProtocolStandarded = true
+        // }
+      },
+      handleChangeNetType(val) { //网络类型
+        console.log(val)
+
+      },
+      getDataSouse(item) {
+        this.formData = {}
+        let param = {
+          Filters: {
+            Id: item.Id
+          },
+          "PageNumber": 1,
+          "PageSize": 50,
+          "Projection": []
+        }
+        queryDataSource(param, res => {
+
+          let data = res.Content[0]
+          data.ProtocolType = data.ProtocolType == '其他' ? 'common' : data.ProtocolType
+          this.formData = data
+          if (!this.formData.ProtocolInfo) {
+            //信息点为空时
+
+            this.formData.ProtocolInfo = {
+              "Ip": "", //ip
+              "Port": "",
+              "User": "", //用户名
+              "Password": "", //密码
+              "ProgId": "", //progId
+            }
+          } else {
+            //有信息点时
+            this.ProtocolInfo = JSON.stringify(data.ProtocolInfo)
+            debugger
+          }
+          this.handleChangeProtocolType(data.ProtocolType)
+        })
+      },
+      btnClick() {
+        console.log(this.formData, "form")
+        let param = tools.deepCopy(this.formData)
+        tools.delObjKey(param, "CreateTime")
+        tools.delObjKey(param, "LastUpdate")
+        if (param.ProtocolType == 'common') {
+          try {
+            let ProtocolInfo = JSON.parse(this.ProtocolInfo)
+            param.ProtocolInfo = ProtocolInfo
+          } catch (err) {
+            this.$message.error("属性详情格式错误!")
+            return false
+          }
+        }
+        if (!!this.id) {
+          console.log(param.ProtocolInfo.Port)
+          if (param.ProtocolInfo.hasOwnProperty("Port") && param.ProtocolInfo.Port == "") {
+            delete param.ProtocolType.Port
+          }
+          updateDataSource({
+            Content: [param],
+            Projection: []
+          }, res => {
+            console.log(res, 'res')
+            this.$router.push({
+              path: '/point/pointsetting'
+            })
+            this.$message.success("更新成功!")
+          })
+        } else {
+          // param.ProjectId = this.projectId
+          console.log(param, "param")
+          createDataSource(param, res => {
+            console.log(res)
+            this.$router.push({
+              path: '/point/pointsetting'
+            })
+            this.$message.success("创建成功!")
+          })
+        }
+      },
+      deletePort() {
+        this.formData.ProtocolInfo.Port = ""
+      }
+    },
+    watch: {
+      projectId() {
+        this.$router.push({
+          path: '/point/pointsetting'
+        })
+      }
+    }
+  }
+</script>
+
+<style scoped lang="less">
+  .edit-origin-dialog {
+    /deep/ .el-select > .el-input {
+      width: 282px;
+    }
+  }
+</style>

+ 112 - 53
src/views/point/config_point/edit_origin/index.vue

@@ -6,34 +6,69 @@
             <el-button class="btn" @click="btnClick">{{ id? '保存修改': '新建'}}</el-button>
         </div>
         <div class="content-view">
-            <el-form label-width="10px" style="width:400px;" :model="formData" class="dcenter">
-                <el-form-item label="">
-                    <el-input v-model="formData.Name" placeholder="请输入数据源名称"></el-input>
-                </el-form-item>
-            </el-form>
-            <el-input type="textarea" class="edit-textarea dcenter block" v-model="formData.Description" placeholder="请维护数据源说明"></el-input>
-            <el-form label-width="120px" style="width:400px;" :model="formData" class="dcenter">
-                <el-form-item label="协议类型">
-                    <el-select v-model="formData.ProtocolType" filterable @change="handleChangeProtocolType" placeholder="请选择">
-                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="主机IP地址" v-if="formData.ProtocolType != 'common'">
-                    <ip-input :ip="formData.ProtocolInfo.Ip" :port="formData.ProtocolInfo.Port" :ProtocolType="formData.ProtocolType" @change="changeItem" @deletePort="deletePort"></ip-input>
-                </el-form-item>
-                <el-form-item label="用户名/密码" v-if="(passWordArr.indexOf(formData.ProtocolType) > -1)">
-                    <el-input v-model="formData.ProtocolInfo.User" style="display:inline-block;width:100px;"></el-input>/
-                    <el-input v-model="formData.ProtocolInfo.Password" style="display:inline-block;width:100px;"></el-input>
-                </el-form-item>
-                <el-form-item label="ProgId" v-if="formData.ProtocolType == 'opc'">
-                    <el-input v-model="formData.ProtocolInfo.ProgId" style="display:inline-block;width:100px;"></el-input>
-                </el-form-item>
-                <el-form-item label="属性详情" v-if="formData.ProtocolType == 'common'">
-                    <el-input type="textarea" :autosize="{ minRows: 8, maxRows: 8}" v-model="ProtocolInfo"  placeholder="请输入json格式数据" style="display:inline-block;width:400px;"> </el-input>
-                </el-form-item>
-                <el-form-item label="采集间隔时间">
-                    <el-input-number v-model="formData.CollectInterval" controls-position="right" @change="handleChange" :min="10"></el-input-number>&nbsp;&nbsp;s
-                </el-form-item>
+          <el-form style="width:400px;" :model="formData" class="dcenter" label-width="120px">
+            <!--                <el-form-item label="">-->
+            <!--                    <el-input v-model="formData.Name" placeholder="请输入数据源名称"></el-input>-->
+            <!--                </el-form-item>-->
+            <el-form-item label="接口名称">
+              <el-input v-model="formData.Name" placeholder="请输入接口名称"></el-input>
+            </el-form-item>
+            <!--            <el-input type="textarea" class="edit-textarea dcenter block" v-model="formData.Description" placeholder="请维护数据源说明"></el-input>-->
+            <el-form-item label="协议类型">
+              <el-select v-model="formData.ProtocolType" filterable @change="handleChangeProtocolType"
+                         placeholder="请选择">
+                <el-option v-for="item in options" :key="item.value" :label="item.label"
+                           :value="item.value"></el-option>
+              </el-select>
+            </el-form-item>
+            <!--                <el-form-item label="主机IP地址" v-if="formData.ProtocolType != 'common'">-->
+            <!--                    <ip-input :ip="formData.ProtocolInfo.Ip" :port="formData.ProtocolInfo.Port" :ProtocolType="formData.ProtocolType" @change="changeItem" @deletePort="deletePort"></ip-input>-->
+            <!--                </el-form-item>  -->
+            <el-form-item label="通讯地址/端口" v-if="formData.ProtocolType != 'common'">
+              <ip-input :ip="formData.ProtocolInfo.Ip" :port="formData.ProtocolInfo.Port"
+                        :ProtocolType="formData.ProtocolType" @change="changeItem" @deletePort="deletePort"></ip-input>
+            </el-form-item>
+            <el-form-item label="采集间隔(s)" v-if="formData.ProtocolType != 'ems-collect'">
+              <el-input-number v-model="formData.CollectInterval" controls-position="right" :min="10"></el-input-number>
+            </el-form-item>
+            <el-form-item label="通讯模式"
+                          v-if="formData.ProtocolType != 'common'  && formData.ProtocolType != 'ems-collect' ">
+              <el-select filterable>
+                <el-option></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="网络类型">
+              <el-select v-model="formData.wangluo" filterable @change="handleChangeNetType" placeholder="请选择">
+                <el-option v-for="item in netOptons" :key="item.value" :label="item.label"
+                           :value="item.value"></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="描述">
+              <el-input type="textarea" v-model="formData.Description" :autosize="{ minRows: 4, maxRows: 4}"
+                        placeholder="请输入描述内容,200个字以内"></el-input>
+            </el-form-item>
+            <el-form-item>
+              <el-button :disabled="formData.wangluo =='jianjie'?true:false">测试</el-button>
+              <el-button>取消</el-button>
+              <el-button type="primary">保存</el-button>
+            </el-form-item>
+            <el-form-item label="测试日志">
+              <el-input type="textarea" v-model="formData.ceshi" :autosize="{ minRows: 4, maxRows: 4}"
+                        disabled></el-input>
+            </el-form-item>
+            <el-form-item label="用户名/密码" v-if="(passWordArr.indexOf(formData.ProtocolType) > -1)">
+              <el-input v-model="formData.ProtocolInfo.User" style="display:inline-block;width:100px;"></el-input>
+              /
+              <el-input v-model="formData.ProtocolInfo.Password" style="display:inline-block;width:100px;"></el-input>
+            </el-form-item>
+            <el-form-item label="ProgId" v-if="formData.ProtocolType == 'opc'">
+              <el-input v-model="formData.ProtocolInfo.ProgId" style="display:inline-block;width:100px;"></el-input>
+            </el-form-item>
+            <el-form-item label="属性详情" v-if="formData.ProtocolType == 'common'">
+              <el-input type="textarea" :autosize="{ minRows: 8, maxRows: 8}" v-model="ProtocolInfo"
+                        placeholder="请输入json格式数据" style="display:inline-block;width:400px;"></el-input>
+            </el-form-item>
+
             </el-form>
         </div>
     </div>
@@ -97,6 +132,15 @@
           value: 'common',
           label: '其他'
         }],
+        netOptons: [
+          {
+            value: 'zhilian',
+            label: '直连'
+          }, {
+            value: 'jianjie',
+            label: '间接'
+          },
+        ],
         id: this.$route.query.key
       }
     },
@@ -150,7 +194,12 @@
             //   this.formData.ProtocolStandarded = true
             // }
           },
+          handleChangeNetType(val) { //网络类型
+            console.log(val)
+
+          },
           getDataSouse() {
+            debugger
             let param = {
               Filters: {
                 Id: this.id
@@ -175,9 +224,7 @@
                 this.ProtocolInfo = JSON.stringify(data.ProtocolInfo)
               }
               this.formData = data
-              if(data) {
 
-              }
               data.ProtocolType = data.ProtocolType == '其他' ? 'common':data.ProtocolType
               this.handleChangeProtocolType( data.ProtocolType)
               console.log(this.formData, "formData")
@@ -228,36 +275,48 @@
                 this.formData.ProtocolInfo.Port = ""
             }
         },
-        watch: {
-            projectId(){
-                this.$router.push({
-                    path: '/point/pointsetting'
-                })
-            }
-        }
+    watch: {
+      projectId() {
+        this.$router.push({
+          path: '/point/pointsetting'
+        })
+      }
     }
+  }
 </script>
 <style lang="scss">
-    .margin-view {
-        height: 60px;
-    }
-    .btn-view {
-        overflow: hidden;
-        .btn {
-            float: right;
-            margin-right: 40px;
-        }
+  .margin-view {
+    height: 60px;
+  }
+
+  .btn-view {
+    overflow: hidden;
+
+    .btn {
+      float: right;
+      margin-right: 40px;
     }
+  }
     .content-view {
         width: 928px;
         margin: auto;
-        .edit-textarea {
-            margin: 8px 0 22px 0;
-            height: 117px;
-            textarea {
-                height: 100%;
-                background-color: #EEFAFF;
-            }
+
+      .edit-textarea {
+        margin: 8px 0 22px 0;
+        height: 117px;
+
+        textarea {
+          height: 100%;
+          background-color: #EEFAFF;
         }
+      }
+    }
+</style>
+<style lang="less" scoped>
+  .content-view {
+
+    /deep/ .el-select > .el-input {
+      width: 282px;
     }
+  }
 </style>

+ 37 - 36
src/views/point/config_point/index.vue

@@ -27,38 +27,38 @@
                 </div> -->
             <!-- </el-scrollbar> -->
         </div>
+      <dataSourceDialog ref="dialog"></dataSourceDialog>
     </div>
 </template>
 <script>
-    import "@/assets/scss/point/point_config/common.scss"
-    import "@/assets/scss/point/point_config/reset.scss"
-    import dataOrigin from "@/components/config_point/data_origin"
-    import {
-        mapGetters,
-        mapActions
-    } from "vuex";
-    import { queryDataSourceCount,synchronizeProj } from "@/fetch/point_http"
-    export default {
-        components: {
-            dataOrigin
-        },
-        data() {
-            return {
-                projectName: "项目名称",
-                list: [],
-                isLoading: false
-            }
-        },
-        computed: {
-            ...mapGetters("layout", [
-                "projectId"
-            ])
-        },
-        created() {},
-        mounted() {
-            console.log(this.projectId)
-            this.getList()
-        },
+  import "@/assets/scss/point/point_config/common.scss"
+  import "@/assets/scss/point/point_config/reset.scss"
+  import dataOrigin from "@/components/config_point/data_origin"
+  import {mapGetters} from "vuex";
+  import {queryDataSourceCount, synchronizeProj} from "@/fetch/point_http"
+import dataSourceDialog from "./edit_origin/dialog";
+  export default {
+    components: {
+      dataOrigin,dataSourceDialog
+    },
+    data() {
+      return {
+        projectName: "项目名称",
+        list: [],
+        isLoading: false
+      }
+    },
+    computed: {
+      ...mapGetters("layout", [
+        "projectId"
+      ])
+    },
+    created() {
+    },
+    mounted() {
+      console.log(this.projectId)
+      this.getList()
+    },
         methods: {
             //同步数据
             sameData(){
@@ -84,13 +84,14 @@
                 })
             },
             goEdit(item) {
-                console.log(item)
-                this.$router.push({
-                    path: "editDataSouce",
-                    query: {
-                        key: item.Id
-                    }
-                })
+              console.log(item)
+              this.$refs.dialog.openDialog(item)
+              // this.$router.push({
+              //     path: "editDataSouce",
+              //     query: {
+              //         key: item.Id
+              //     }
+              // })
             },
           del(item) {