钞小赢 3 anni fa
parent
commit
f6edd8d61c

+ 1 - 0
.env

@@ -5,6 +5,7 @@ VUE_APP_TITLE=D2Admin
5 5
 
6 6
 # 网络请求公用地址
7 7
 VUE_APP_API=/api/
8
+; VUE_APP_API=http://101.36.160.140:21023/
8 9
 
9 10
 # 仓库地址
10 11
 VUE_APP_REPO=https://github.com/d2-projects/d2-admin-start-kit

+ 1 - 2
.env.development

@@ -1,5 +1,4 @@
1 1
 # 开发环境
2 2
 
3 3
 # 页面 title 前缀
4
-VUE_APP_TITLE=数量监测智能眼系统
5
-
4
+VUE_APP_TITLE=数量监测智能眼系统

+ 1 - 0
src/api/index.js

@@ -5,6 +5,7 @@ import * as tools from './tools'
5 5
 
6 6
 const files = require.context('./modules', true, /\.api\.js$/)
7 7
 const generators = files.keys().map(key => files(key).default)
8
+console.log(files.keys(),"///")
8 9
 
9 10
 export default assign({}, ...map(generators, generator => generator({
10 11
   service,

+ 29 - 0
src/api/modules/paramManage/hardParam.api.js

@@ -0,0 +1,29 @@
1
+
2
+  //硬件参数
3
+export default ({request}) => ({
4
+  //左侧树
5
+
6
+//列表
7
+ hardParam(data = {}) {
8
+
9
+
10
+  return request({
11
+    url: `hdParemeter/getPage`,
12
+    method: 'post',
13
+    data
14
+  })
15
+
16
+  },
17
+
18
+  //新增
19
+  addHardParam(data = {}) {
20
+
21
+
22
+    return request({
23
+      url: `hdParemeter/save`,
24
+      method: 'post',
25
+      data
26
+    })
27
+  
28
+    }
29
+})

+ 0 - 11
src/api/paramManage/hardParam/index.js

@@ -1,11 +0,0 @@
1
-import * as request from '../../service.js'
2
-
3
-//硬件参数
4
-export function list(data) {
5
-    console.log(request,"..")
6
-    return request({
7
-      url: `hdParemeter/getPage`,
8
-      method: 'post',
9
-      data
10
-    })
11
-  }

+ 3 - 2
src/api/service.js

@@ -33,7 +33,7 @@ function createService () {
33 33
       } else {
34 34
         // 有 code 代表这是一个后端接口 可以进行进一步的判断
35 35
         switch (code) {
36
-          case 0:
36
+          case 200:
37 37
             // [ 示例 ] code === 0 代表没有错误
38 38
             return dataAxios.data
39 39
           case 'xxx':
@@ -83,7 +83,8 @@ function createRequestFunction (service) {
83 83
         'Content-Type': get(config, 'headers.Content-Type', 'application/json')
84 84
       },
85 85
       timeout: 5000,
86
-      baseURL: process.env.VUE_APP_API,
86
+      // baseURL: process.env.VUE_APP_API,
87
+      baseURL: '/api',
87 88
       data: {}
88 89
     }
89 90
     return service(Object.assign(configDefault, config))

+ 5 - 0
src/main.js

@@ -16,6 +16,11 @@ import { frameInRoutes } from '@/router/routes'
16 16
 import * as echarts from "echarts"
17 17
 Vue.prototype.$echarts = echarts
18 18
 
19
+
20
+// axios
21
+import axios from 'axios'
22
+Vue.prototype.$axios = axios;
23
+
19 24
 // 核心插件
20 25
 Vue.use(d2Admin)
21 26
 

+ 38 - 32
src/views/demo/parameManagement/hardwareParame/index.vue

@@ -73,7 +73,10 @@
73 73
                 </el-form-item>
74 74
               </el-form>
75 75
               <div class="addBtn">
76
-                <el-button type="primary" icon="el-icon-plus" @click="addTantou"
76
+                <el-button
77
+                  type="primary"
78
+                  icon="el-icon-plus"
79
+                  @click="addTantou()"
77 80
                   >新增激光探头</el-button
78 81
                 >
79 82
               </div>
@@ -98,11 +101,7 @@
98 101
                   align="center"
99 102
                 >
100 103
                 </el-table-column>
101
-                <el-table-column
102
-                  prop="port"
103
-                  label="设备编号"
104
-                  align="center"
105
-                >
104
+                <el-table-column prop="Port" label="设备编号" align="center">
106 105
                 </el-table-column>
107 106
                 <el-table-column prop="ipAdress" label="设备IP" align="center">
108 107
                 </el-table-column>
@@ -133,16 +132,16 @@
133 132
     </d2-container>
134 133
 
135 134
     <!-- //弹框 -->
136
-    <el-dialog title="新增探头" :visible.sync="dialogTantou" id="dialogStyle">
135
+    <el-dialog :title="title" :visible.sync="dialogTantou" id="dialogStyle">
137 136
       <el-form :model="dialog">
138 137
         <el-form-item label="设备名称:" :label-width="formLabelWidth">
139
-          <el-input v-model="dialog.name" autocomplete="off"></el-input>
138
+          <el-input v-model="dialog.deviceName" autocomplete="off"></el-input>
140 139
         </el-form-item>
141 140
         <el-form-item label="设备IP:" :label-width="formLabelWidth">
142
-          <el-input v-model="dialog.name" autocomplete="off"></el-input>
141
+          <el-input v-model="dialog.ipAdress" autocomplete="off"></el-input>
143 142
         </el-form-item>
144 143
         <el-form-item label="设备编码:" :label-width="formLabelWidth">
145
-          <el-input v-model="dialog.name" autocomplete="off"></el-input>
144
+          <el-input v-model="dialog.Port" autocomplete="off"></el-input>
146 145
         </el-form-item>
147 146
       </el-form>
148 147
       <div slot="footer" class="dialog-footer">
@@ -153,11 +152,13 @@
153 152
   </div>
154 153
 </template>
155 154
 <script>
156
-import { list } from "@/api/paramManage/hardParam";
155
+import api from "@/api";
157 156
 export default {
158 157
   name: "hardwareParame",
159 158
   data() {
160 159
     return {
160
+      //初始化弹框标题
161
+      title: "",
161 162
       //仓房id
162 163
       houseId: "",
163 164
       //设备名称
@@ -234,14 +235,15 @@ export default {
234 235
       hardwareList: [
235 236
         {
236 237
           deviceName: "",
237
-          port:"",
238
+          port: "",
238 239
           ipAdress: "",
239
-         
240 240
         },
241 241
       ],
242 242
       //弹框字段
243 243
       dialog: {
244
-        name: "",
244
+        deviceName: "",
245
+          port: "",
246
+          ipAdress: "",
245 247
       },
246 248
       //分页
247 249
 
@@ -264,7 +266,7 @@ export default {
264 266
     //获取列表数据
265 267
     getList() {
266 268
       var condition = {
267
-        houseId: null,
269
+        houseId: 1,
268 270
         deviceName: "",
269 271
       };
270 272
       condition = JSON.stringify(condition);
@@ -273,18 +275,21 @@ export default {
273 275
         pageSize: this.pagination.pageSize,
274 276
         condition: condition,
275 277
       };
276
-      list(data)
277
-      .then((res) => {
278
-        if (res.code == 200) {
279
-          this.hardwareList = res.data.records;
280
-          this.pagination.pageSize = res.data.size;
281
-          this.pagination.total = res.data.total;
282
-        }
283
-      })
284
-      .catch(err=>{
285
-        console.log(err)
286
-      });
278
+      api
279
+        .hardParam(data)
280
+        .then((res) => {
281
+          if (res.code == 200) {
282
+            this.hardwareList = res.data.records;
283
+            this.pagination.pageSize = res.data.size;
284
+            this.pagination.total = res.data.total;
285
+          }
286
+        })
287
+        .catch((err) => {
288
+          console.log(err);
289
+        });
287 290
     },
291
+    //新增
292
+    addList(){},
288 293
 
289 294
     filterNode(value, data) {
290 295
       if (!value) return true;
@@ -294,6 +299,7 @@ export default {
294 299
     reset() {},
295 300
     //新增
296 301
     addTantou() {
302
+      this.title = "新增硬件参数";
297 303
       this.dialogTantou = true;
298 304
     },
299 305
     //表格序号
@@ -304,21 +310,21 @@ export default {
304 310
     },
305 311
     //当前页改变时
306 312
     handleCurrentChange(val) {
307
-      this.pagination.curPage=val;
313
+      this.pagination.curPage = val;
308 314
       this.getList();
309 315
     },
310 316
     //每页显示的页数改变时
311 317
     handleSizeChange(val) {
312
-            this.pagination.pageSize = val
313
-      this.getList()
318
+      this.pagination.pageSize = val;
319
+      this.getList();
314 320
     },
315 321
     //弹框确定按钮
316 322
     determine() {},
317 323
   },
318
-  mounted(){
319
-    console.log('aaaa')
324
+  mounted() {
325
+    console.log("aaaa");
320 326
     this.getList();
321
-  }
327
+  },
322 328
 };
323 329
 </script>
324 330
 <style lang="scss" scoped>

+ 11 - 1
vue.config.js

@@ -38,7 +38,17 @@ module.exports = {
38 38
   lintOnSave: true,
39 39
   devServer: {
40 40
     publicPath, // 和 publicPath 保持一致
41
-    disableHostCheck: process.env.NODE_ENV === 'development' // 关闭 host check,方便使用 ngrok 之类的内网转发工具
41
+    disableHostCheck: process.env.NODE_ENV === 'development', // 关闭 host check,方便使用 ngrok 之类的内网转发工具
42
+    proxy: {
43
+      '/api': {
44
+        target: ' http://101.36.160.140:21023',
45
+        ws: true,
46
+        changeOrigin: true,
47
+        pathRewrite: {
48
+          '^/api': ''
49
+        }
50
+      }
51
+    }
42 52
   },
43 53
   css: {
44 54
     loaderOptions: {