浏览代码

增加webaccess的页面

dongjh 1 年之前
父节点
当前提交
31bee4e4e0
共有 3 个文件被更改,包括 63 次插入56 次删除
  1. 2 2
      src/api/datacoll/webaccess.js
  2. 54 52
      src/views/modules_guAn/webaccess/index.vue
  3. 7 2
      src/views/system/DictItemList.vue

+ 2 - 2
src/api/datacoll/webaccess.js

@@ -3,7 +3,7 @@ import { axios } from '@/utils/request'
 // 获取设备参数值
 export function getWATagNameValues(query) {
   return axios({
-    url: '/tpm/datacoll/getWATagNameValues',
+    url: '/datacoll/webaccess/getWATagNameValues',
     method: 'get',
     params: query
   })
@@ -12,7 +12,7 @@ export function getWATagNameValues(query) {
 // 设置设备参数值
 export function setWATagNameValues(query) {
     return axios({
-      url: '/tpm/datacoll/setWATagNameValues',
+      url: '/datacoll/webaccess/setWATagNameValues',
       method: 'get',
       params: query
     })

+ 54 - 52
src/views/modules_guAn/webaccess/index.vue

@@ -1,77 +1,79 @@
+
 <template>
-  <div class="app-container home">
-    <el-row :gutter="20">
-      <el-col :sm="24" :lg="24">
-        <h1>webaccess测试</h1>
-      </el-col>
-    </el-row>
-    <el-row :gutter="20">
-      <el-col :sm="24" :lg="24">
-        <div>
-          <label for="tagname">设备参数名: </label>
-          <el-input v-model="tagname" type="text" style="width: 20%" /> &nbsp;
-          &nbsp;
-          <el-button @click="get" type="primary">获取参数值</el-button>
-          <!-- <el-button @click="exit" type="danger">断开</el-button> -->
-          <br />
-          <br />
-          <label for="tagvalue">设备参数值: </label>
-          <el-input v-model="tagvalue" type="text" style="width: 20%" /> &nbsp;
-          <el-button type="info" @click="set">设置参数值</el-button>
-          <br />
-          <br />
-          <el-input type="textarea" v-model="message" :rows="9" /> 返回内容
-          <br />
-          <br />
-        </div>
-      </el-col>
-    </el-row>
-  </div>
+  <a-form-model ref="form" :model="model" :rules="validatorRules">
+    <a-form-model-item label="设备参数名" :labelCol="labelCol" :wrapperCol="wrapperCol">
+      <a-input v-model="tagname" style="width: 20%" />
+      <template>
+        <el-button @click="get" icon="reload" type="primary">获取参数值</el-button>
+      </template>
+    </a-form-model-item>
+    <a-form-model-item label="设备参数值" :labelCol="labelCol" :wrapperCol="wrapperCol">
+      <a-input v-model="tagvalue" style="width: 20%" /> &nbsp;
+      <template>
+        <el-button type="info" icon="reload" @click="set">设置参数值</el-button>
+      </template>
+    </a-form-model-item>
+    <a-form-model-item label="返回内容" :labelCol="labelCol" :wrapperCol="wrapperCol">
+      <a-textarea v-model="message" rows="9" />
+    </a-form-model-item>
+  </a-form-model>
 </template>
 
 <script>
-import { getWATagNameValues, setWATagNameValues } from "@/api/datacoll/webaccess.js";
+import { getWATagNameValues, setWATagNameValues } from '@/api/datacoll/webaccess.js'
 export default {
-  name: "Index",
+  name: 'Index',
   data() {
     return {
-      tagname: "40001",
-      tagvalue: 1,
-      message: "",
-    };
+      model: {},
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+      tagname: '设备状态',
+      tagvalue: 2,
+      message: '',
+      confirmLoading: false,
+    }
   },
   methods: {
     get() {
-      if (this.tagname == "" || this.tagname == null) {
-        this.$modal.msgError("请输入设备参数名");
-        return false;
+      console.log('获取参数')
+      if (this.tagname == '' || this.tagname == null) {
+        this.$modal.msgError('请输入设备参数名')
+        return false
       }
       getWATagNameValues({ tagName: this.tagname }).then((response) => {
-        console.log(response);
-        this.message = response.msg;
-      });
+        console.log(response)
+        this.message = response.message
+      })
     },
     set() {
-      if (this.tagname == "" || this.tagname == null) {
-        this.$modal.msgError("请输入设备参数名");
-        return false;
+      console.log('设置参数')
+      if (this.tagname == '' || this.tagname == null) {
+        this.$modal.msgError('请输入设备参数名')
+        return false
       }
-      if (this.tagvalue == "" || this.tagvalue == null) {
-        this.$modal.msgError("请输入设备参数值");
-        return false;
+      if (this.tagvalue == '' || this.tagvalue == null) {
+        this.$modal.msgError('请输入设备参数值')
+        return false
       }
       setWATagNameValues({ tagName: this.tagname, tagValue: this.tagvalue }).then((response) => {
-        console.log(response.data);
-        this.message = response.data.msg;
-      });
+        console.log(response)
+        this.message = response.message
+      })
     },
     exit() {
       if (this.ws) {
-        this.ws.close();
-        this.ws = null;
+        this.ws.close()
+        this.ws = null
       }
     },
   },
-};
+}
 </script>
 

+ 7 - 2
src/views/system/DictItemList.vue

@@ -101,6 +101,11 @@
             dataIndex: 'itemValue',
           },
           {
+            title: '描述',
+            align: "center",
+            dataIndex: 'description',
+          },
+          {
             title: '操作',
             dataIndex: 'action',
             align: "center",
@@ -198,10 +203,10 @@
       // 抽屉的宽度随着屏幕大小来改变
       resetScreenSize() {
         let screenWidth = document.body.clientWidth;
-        if (screenWidth < 600) {
+        if (screenWidth < 800) {
           this.screenWidth = screenWidth;
         } else {
-          this.screenWidth = 600;
+          this.screenWidth = 800;
         }
       },
       //update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------