浏览代码

2021-05-17

East 4 年之前
父节点
当前提交
89022430de

文件差异内容过多而无法显示
+ 1291 - 1182
package-lock.json


+ 2 - 1
package.json

@@ -17,6 +17,7 @@
     "axios": "0.17.1",
     "babel-plugin-component": "0.10.1",
     "babel-polyfill": "6.26.0",
+    "element-china-area-data": "^5.0.2",
     "element-ui": "2.8.2",
     "gulp": "4.0.2",
     "gulp-concat": "2.6.1",
@@ -46,7 +47,7 @@
     "babel-preset-stage-2": "6.22.0",
     "babel-register": "6.22.0",
     "chalk": "2.3.0",
-    "chromedriver": "2.27.2",
+    "chromedriver": "^2.27.2",
     "copy-webpack-plugin": "4.0.1",
     "cross-spawn": "5.0.1",
     "css-loader": "0.28.0",

+ 83 - 4
src/mock/modules/sys-menu.js

@@ -685,7 +685,7 @@ var navDataList = [
         'parentId': 43,
         'parentName': null,
         'name': '养殖场位置信息管理',
-        'url': 'pigfarm/pblocation',
+        'url': 'pigfarm/pflocation',
         'perms': null,
         'type': 1,
         'icon': '',
@@ -698,7 +698,7 @@ var navDataList = [
         'parentId': 43,
         'parentName': null,
         'name': '室内环境',
-        'url': 'pigfarm/pbindoor',
+        'url': 'pigfarm/pfindoor',
         'perms': null,
         'type': 1,
         'icon': '',
@@ -710,14 +710,93 @@ var navDataList = [
         'menuId': 47,
         'parentId': 43,
         'parentName': null,
-        'name': '室环境',
-        'url': 'pigfarm/pboutdoor',
+        'name': '室环境',
+        'url': 'pigfarm/pfoutdoor',
         'perms': null,
         'type': 1,
         'icon': '',
         'orderNum': 34,
         'open': null,
         'list': null
+      },
+      {
+        'menuId': 49,
+        'parentId': 43,
+        'parentName': null,
+        'name': '室外环境',
+        'url': 'pigfarm/pfwater',
+        'perms': null,
+        'type': 1,
+        'icon': '',
+        'orderNum': 35,
+        'open': null,
+        'list': null
+      }
+    ]
+  },
+  {
+    'menuId': 50,
+    'parentId': 0,
+    'parentName': null,
+    'name': '年猪健康信息管理',
+    'url': null,
+    'perms': null,
+    'type': 0,
+    'icon': 'role',
+    'orderNum': 40,
+    'open': null,
+    'list': [
+      {
+        'menuId': 51,
+        'parentId': 50,
+        'parentName': null,
+        'name': '体温数据',
+        'url': 'pighealth/phtemp',
+        'perms': null,
+        'type': 1,
+        'icon': '',
+        'orderNum': 41,
+        'open': null,
+        'list': null
+      },
+      {
+        'menuId': 52,
+        'parentId': 50,
+        'parentName': null,
+        'name': '采食数据',
+        'url': 'pighealth/phfeed',
+        'perms': null,
+        'type': 1,
+        'icon': '',
+        'orderNum': 42,
+        'open': null,
+        'list': null
+      },
+      {
+        'menuId': 53,
+        'parentId': 50,
+        'parentName': null,
+        'name': '轨迹数据',
+        'url': 'pighealth/phlocus',
+        'perms': null,
+        'type': 1,
+        'icon': '',
+        'orderNum': 43,
+        'open': null,
+        'list': null
+      },
+      {
+        'menuId': 54,
+        'parentId': 50,
+        'parentName': null,
+        'name': '视频数据',
+        'url': 'pighealth/phvideo',
+        'perms': null,
+        'type': 1,
+        'icon': '',
+        'orderNum': 44,
+        'open': null,
+        'list': null
       }
     ]
   }

+ 76 - 9
src/views/modules/basicdata/branch.vue

@@ -74,21 +74,32 @@
       :visible.sync="visible"
       @close="cancel">
       <el-form :model="form" ref="form" @keyup.enter.native="formSubmit()" label-width="80px">
-        <el-form-item label="牧场名称" prop="name">
+        <el-form-item label="牧场名称">
           <el-input v-model="form.name" placeholder="牧场名称"></el-input>
         </el-form-item>
-        <el-form-item label="管理员" prop="manager">
+        <el-form-item label="管理员">
           <el-input v-model="form.manager" placeholder="牧场管理员"></el-input>
         </el-form-item>
-        <el-form-item label="地址" prop="location">
-          <el-input v-model="form.location" placeholder="地址"></el-input>
+        <el-form-item label="省市区">
+          <el-cascader
+            size="large"
+            :options="options"
+            v-model="selectedOptions"
+            @change="getlocation" 
+            placeholder="请选择省市区"
+            style="width: 100%">
+          </el-cascader>
+        </el-form-item>
+        <el-form-item label="具体地址">
+          <el-input v-model="form.location2" placeholder="地址"></el-input>
         </el-form-item>
         <el-form-item label="日期" prop="buildTime">
           <el-date-picker
             v-model="form.buildTime"
             type="date" 
             value-format="yyyy-MM-dd" 
-            placeholder="选择日期">
+            placeholder="选择日期"
+            style="width: 100%">
           </el-date-picker>
         </el-form-item>
       </el-form>
@@ -100,6 +111,7 @@
   </div>
 </template>
 <script>
+import { regionData, CodeToText } from "element-china-area-data"
 export default {
   data () {
     return {
@@ -123,11 +135,14 @@ export default {
       visible: false,
       form: {
         id: '',
-        location: '',
+        location1: '',
+        location2: '',
         manager: '',
         name: '',
         buildTime: ''
-      }
+      },
+      options: regionData,
+      selectedOptions: []
     }
   },
   created () {
@@ -162,6 +177,16 @@ export default {
       this.pageIndex = 1
       this.getDataList()
     },
+    // 获取地址
+    getlocation () {
+      var loc = "";
+      this.form.location1 = ''
+      for (let i = 0; i < this.selectedOptions.length; i++) {
+        loc += CodeToText[this.selectedOptions[i]];
+        this.form.location1 += this.selectedOptions[i] + ','
+      }
+      console.log('当前地址为' + loc);
+    },
     // 当前页
     currentChangeHandle (val) {
       this.pageIndex = val
@@ -229,6 +254,10 @@ export default {
         if (!this.confirmComplete()) {
           return
         }
+        // 输入长度是否合法
+        if (!this.confirmLength()) {
+          return
+        }
         // 输入是否合法
         if (!this.confirmInput()) {
           return
@@ -263,6 +292,10 @@ export default {
         if (!this.confirmComplete(1)) {
           return
         }
+        // 输入长度是否合法
+        if (!this.confirmLength()) {
+          return
+        }
         // 输入是否合法
         if (!this.confirmInput()) {
           return
@@ -306,6 +339,7 @@ export default {
     },
     // 校验输入是否完整
     validComplete (val) {
+      this.form.location = this.form.location1 + this.form.location2
       val && (delete this.form.id, delete this.form.deleted, delete this.form.gmtCreate, delete this.form.gmtModified)
       for (let i in this.form) {
         if (!this.form[i].toString()) {
@@ -316,10 +350,11 @@ export default {
     },
     // 如不完整,则提示
     confirmComplete (val) {
+      console.log(this.form);
       if (this.validComplete(val)) {
         return true
       }
-      this.$confirm(`请输入完整`, '提示', {
+      this.$confirm(`所有项均为必填项`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
@@ -338,7 +373,15 @@ export default {
       if (reg.test(this.form.manager)) {
         return false
       }
-      if (reg.test(this.form.location)) {
+      // TODO:牧场管理-新增-地址的正则表达式
+      // 只允许中文、字母、标点输入
+      // if (reg.test(this.form.location)) {
+      //   return false
+      // }
+      console.log(this.form.location2);
+      const reg1 = /[^\a-\z\A-\Z\u4E00-\u9FA5\!\!]/g
+      console.log(reg1.test(this.form.location2));
+      if (reg1.test(this.form.location2)) {
         return false
       }
       return true
@@ -356,6 +399,30 @@ export default {
         console.log('输入不合法');
       }).catch(() => {})
       return false
+    },
+    // 长度校验
+    validLength () {
+      if (this.form.name.length > 50) {
+        return false
+      }
+      if (this.form.manager.length > 5) {
+        return false
+      }
+      return true
+    },
+    // 如长度不合法,则提示
+    confirmLength () {
+      if (this.validLength()) {
+        return true
+      }
+      this.$confirm(`牧场名称长度限制50,管理员姓名长度限制5`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        console.log('输入不合法');
+      }).catch(() => {})
+      return false
     }
   }
 }

+ 11 - 0
src/views/modules/pigfarm/pfwater.vue

@@ -0,0 +1,11 @@
+<template>
+  <div>
+    饮水指标
+  </div>
+</template>
+<script>
+export default {
+}
+</script>
+<style scoped>
+</style>

+ 11 - 0
src/views/modules/pighealth/phfeed.vue

@@ -0,0 +1,11 @@
+<template>
+  <div>
+    采食数据
+  </div>
+</template>
+<script>
+export default {
+}
+</script>
+<style scoped>
+</style>

+ 11 - 0
src/views/modules/pighealth/phlocus.vue

@@ -0,0 +1,11 @@
+<template>
+  <div>
+    轨迹数据
+  </div>
+</template>
+<script>
+export default {
+}
+</script>
+<style scoped>
+</style>

+ 11 - 0
src/views/modules/pighealth/phtemp.vue

@@ -0,0 +1,11 @@
+<template>
+  <div>
+    体温数据
+  </div>
+</template>
+<script>
+export default {
+}
+</script>
+<style scoped>
+</style>

+ 11 - 0
src/views/modules/pighealth/phvideo.vue

@@ -0,0 +1,11 @@
+<template>
+  <div>
+    视频数据
+  </div>
+</template>
+<script>
+export default {
+}
+</script>
+<style scoped>
+</style>