Bläddra i källkod

剩下的明天改 2021-07-14

East 4 år sedan
förälder
incheckning
2aa7c42ba0
38 ändrade filer med 465 tillägg och 2612 borttagningar
  1. 1 1
      src/views/common/login.vue
  2. 13 14
      src/views/modules/basic/breed.vue
  3. 12 12
      src/views/modules/basic/feeder.vue
  4. 18 16
      src/views/modules/basic/pigsty.vue
  5. 12 14
      src/views/modules/basic/treat.vue
  6. 14 15
      src/views/modules/basic/unit.vue
  7. 0 11
      src/views/modules/basicdata/bbox.vue
  8. 0 11
      src/views/modules/basicdata/borigin.vue
  9. 0 512
      src/views/modules/basicdata/bperiod.vue
  10. 0 518
      src/views/modules/basicdata/bpighouse.vue
  11. 0 570
      src/views/modules/basicdata/branch.vue
  12. 0 512
      src/views/modules/basicdata/bunit.vue
  13. 0 11
      src/views/modules/basicdata/bvariety.vue
  14. 24 2
      src/views/modules/breed/beartag.vue
  15. 1 1
      src/views/modules/breed/bfood.vue
  16. 6 0
      src/views/modules/breed/btrecord.vue
  17. 1 1
      src/views/modules/env/huan.vue
  18. 3 3
      src/views/modules/envir/ealarm.vue
  19. 21 16
      src/views/modules/health/hdisease.vue
  20. 34 17
      src/views/modules/health/hisolate.vue
  21. 21 16
      src/views/modules/health/htreat.vue
  22. 46 30
      src/views/modules/health/hvaccine.vue
  23. 52 31
      src/views/modules/monitor/areaAdmin.vue
  24. 52 31
      src/views/modules/monitor/camera.vue
  25. 50 28
      src/views/modules/monitor/cameraBrand.vue
  26. 15 11
      src/views/modules/pigbasic/pbbasic.vue
  27. 0 149
      src/views/modules/pigbasic/pbbasicLeft.vue
  28. 14 14
      src/views/modules/pigbasic/pbentry-add-or-update.vue
  29. 13 10
      src/views/modules/pigbasic/pbentry.vue
  30. 1 1
      src/views/modules/pigbasic/pbexit.vue
  31. 3 3
      src/views/modules/pigbasic/pbzhong.vue
  32. 1 1
      src/views/modules/sys/department-add-or-update.vue
  33. 10 7
      src/views/modules/sys/department.vue
  34. 1 1
      src/views/modules/sys/job-add-or-update.vue
  35. 11 7
      src/views/modules/sys/job.vue
  36. 13 13
      src/views/modules/sys/pasture.vue
  37. 1 1
      src/views/modules/sys/user-add-or-update.vue
  38. 1 1
      src/views/modules/sys/user.vue

+ 1 - 1
src/views/common/login.vue

@@ -77,7 +77,7 @@
                 'password': this.dataForm.password,
                 'uuid': this.dataForm.uuid,
                 'captcha': this.dataForm.captcha
-              })
+              }, false)
             }).then(({data}) => {
               if (data && data.code === 0) {
                 this.$cookie.set('token', data.token)

+ 13 - 14
src/views/modules/basic/breed.vue

@@ -57,12 +57,12 @@
           align="center"
           label="品种">
         </el-table-column>
-        <el-table-column
+        <!-- <el-table-column
           prop="origin"
           header-align="center"
           align="center"
           label="产地">
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column
           prop="remark"
           header-align="center"
@@ -83,7 +83,7 @@
             <el-button
               type="text"
               size="small"
-              @click="deleteHandle(scope.row.id)">
+              @click="deleteHandle(scope.row)">
               删除
             </el-button>
           </template>
@@ -219,30 +219,29 @@ export default {
     },
     // 选择n个牧场
     selectionChangeHandle(val) {
-      this.selectionDataList = [];
-      val.forEach((item) => {
-        this.selectionDataList.push(item.id);
-      });
+      this.selectionDataList = val
+      // val.forEach((item) => {
+      //   this.selectionDataList.push(item.id);
+      // });
     },
     // 删除n个牧场
-    deleteHandle(id) {
-      this.$confirm(`确定删除品种?`, "提示", {
+    deleteHandle(breed) {
+      let ids = breed? [breed.id]: this.selectionDataList.map(item => item.id)
+      let names = breed? [breed.name]: this.selectionDataList.map(item => item.name)
+      this.$confirm(`确定${breed ? '删除' : '批量删除'}品种${names.join()}?`, "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
       .then(() => {
         // 删除操作
-        if (id) {
-          this.selectionDataList.push(id);
-        }
-        if (this.selectionDataList.length <= 0) {
+        if (this.selectionDataList.length < 0) {
           return;
         }
         this.$http({
           url: this.$http.adornUrl("/management/basebloodline/delete"),
           method: "post",
-          data: this.$http.adornData(this.selectionDataList, false),
+          data: this.$http.adornData(ids, false),
         }).then((result) => {
           console.log(result);
           if (result.data.code === 0) {

+ 12 - 12
src/views/modules/basic/feeder.vue

@@ -106,7 +106,7 @@
                 <el-button
                   type="text"
                   size="small"
-                  @click="deleteHandle(scope.row.id)">
+                  @click="deleteHandle(scope.row)">
                   删除
                 </el-button>
               </template>
@@ -276,29 +276,29 @@ export default {
     },
     // 选择n个养殖员
     selectionChangeHandle (val) {
-      this.selectionDataList = []
-      val.forEach(item => {
-        this.selectionDataList.push(item.id)
-      });
+      this.selectionDataList = val
+      // val.forEach(item => {
+      //   this.selectionDataList.push(item.id)
+      // });
     },
     // 删除n个养殖员
-    deleteHandle (id) {
-      this.$confirm(`确定删除养殖员信息?`, '提示', {
+    deleteHandle (feeder) {
+      console.log(this.selectionDataList);
+      let ids = feeder? [feeder.id]: this.selectionDataList.map(item => item.id)
+      let names = feeder? [feeder.name]: this.selectionDataList.map(item => item.name)
+      this.$confirm(`确定${feeder ? '删除' : '批量删除'}名为${names.join()}的养殖员?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
         // 删除操作
-        if (id) {
-          this.selectionDataList.push(id)
-        }
-        if (this.selectionDataList.length <= 0) {
+        if (this.selectionDataList.length < 0) {
           return
         }
         this.$http({
           url: this.$http.adornUrl('/management/employee/delete'),
           method: 'post',
-          data: this.$http.adornData(this.selectionDataList, false)
+          data: this.$http.adornData(ids, false)
         }).then(result => {
           if (result.data.code === 0) {
             this.$message({

+ 18 - 16
src/views/modules/basic/pigsty.vue

@@ -11,7 +11,7 @@
             <el-form-item style="width: 180px">
               <el-input
                 v-model="dataForm.key"
-                placeholder="猪舍编号"
+                placeholder="猪舍"
                 clearable>
               </el-input>
             </el-form-item>
@@ -76,7 +76,7 @@
               prop="number"
               header-align="center"
               align="center"
-              label="猪舍编号">
+              label="猪舍">
             </el-table-column>
             <el-table-column
               prop="feederName"
@@ -98,7 +98,7 @@
                 <el-button
                   type="text"
                   size="small"
-                  @click="deleteHandle(scope.row.id)">
+                  @click="deleteHandle(scope.row)">
                   删除
                 </el-button>
               </template>
@@ -129,8 +129,8 @@
               label-width="80px"
               size="mini"
               style="margin-left: 20px;width: 500px">
-              <el-form-item label="猪舍编号" prop="number">
-                <el-input v-model="form.number" placeholder="猪舍编号"></el-input>
+              <el-form-item label="猪舍" prop="number">
+                <el-input v-model="form.number" placeholder="猪舍"></el-input>
               </el-form-item>
               <el-form-item label="养殖员" prop="feederId">
                 <el-select v-model="form.feederId" placeholder="请选择养殖员" style="width: 100%">
@@ -192,7 +192,7 @@ export default {
         //   { required: true, message: '所属牧场不能为空', trigger: ['blur', 'change'] }
         // ],
         number: [
-          { required: true, message: '猪舍编号不能为空', trigger: 'blur' }
+          { required: true, message: '猪舍不能为空', trigger: 'blur' }
         ],
         feederId: [
           { required: true, message: '养殖员不能为空', trigger: 'blur' }
@@ -260,6 +260,8 @@ export default {
           this.form[key] = row[key]
         }
       }
+      console.log(row);
+      console.log(this.form);
       // 新增时获取养殖员
       this.$http({
         url: this.$http.adornUrl("/management/employee/findAll"),
@@ -275,29 +277,29 @@ export default {
     },
     // 选择n个牧场
     selectionChangeHandle(val) {
-      this.selectionDataList = [];
-      val.forEach((item) => {
-        this.selectionDataList.push(item.id);
-      });
+      this.selectionDataList = val
+      // val.forEach((item) => {
+      //   this.selectionDataList.push(item.id);
+      // });
     },
     // 删除n个牧场
-    deleteHandle(id) {
-      this.$confirm(`确定删除猪舍?`, "提示", {
+    deleteHandle(pigsty) {
+      let ids = pigsty? [pigsty.id]: this.selectionDataList.map(item => item.id)
+      let names = pigsty? [pigsty.number]: this.selectionDataList.map(item => item.number)
+      console.log(this.selectionDataList);
+      this.$confirm(`确定${pigsty ? '删除' : '批量删除'}${names.join()}猪舍?`, "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       }).then(() => {
         // 删除操作
-        if (id) {
-          this.selectionDataList.push(id);
-        }
         if (this.selectionDataList.length <= 0) {
           return;
         }
         this.$http({
           url: this.$http.adornUrl("/management/pigsty/delete"),
           method: "post",
-          data: this.$http.adornData(this.selectionDataList, false),
+          data: this.$http.adornData(ids, false),
         }).then((result) => {
           console.log(result);
           if (result.data.code === 0) {

+ 12 - 14
src/views/modules/basic/treat.vue

@@ -75,7 +75,7 @@
             <el-button
               type="text"
               size="small"
-              @click="deleteHandle(scope.row.id)">
+              @click="deleteHandle(scope.row)">
               删除
             </el-button>
           </template>
@@ -219,32 +219,30 @@ export default {
       console.log(row);
       console.log(this.form);
     },
-    // 选择n个牧场
     selectionChangeHandle(val) {
-      this.selectionDataList = [];
-      val.forEach((item) => {
-        this.selectionDataList.push(item.id);
-      });
+      this.selectionDataList = val
+      // val.forEach((item) => {
+      //   this.selectionDataList.push(item.id);
+      // });
     },
-    // 删除n个牧场
-    deleteHandle(id) {
-      this.$confirm(`确定删除治疗方案?`, "提示", {
+    // 删除n个治疗方案
+    deleteHandle(treat) {
+      let ids = treat? [treat.id]: this.selectionDataList.map(item => item.id)
+      let names = treat? [treat.diseaseCode]: this.selectionDataList.map(item => item.diseaseCode)
+      this.$confirm(`确定${treat ? '删除' : '批量删除'}治疗方案${names.join()}?`, "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
       .then(() => {
         // 删除操作
-        if (id) {
-          this.selectionDataList.push(id);
-        }
-        if (this.selectionDataList.length <= 0) {
+        if (this.selectionDataList.length < 0) {
           return;
         }
         this.$http({
           url: this.$http.adornUrl("/management/healthtreatmentplan/delete"),
           method: "post",
-          data: this.$http.adornData(this.selectionDataList, false),
+          data: this.$http.adornData(ids, false),
         }).then((result) => {
           console.log(result);
           if (result.data.code === 0) {

+ 14 - 15
src/views/modules/basic/unit.vue

@@ -128,7 +128,7 @@
                 <el-button
                   type="text"
                   size="small"
-                  @click="deleteHandle(scope.row.id)">
+                  @click="deleteHandle(scope.row)">
                   删除
                 </el-button>
               </template>
@@ -268,8 +268,8 @@ export default {
         url: this.$http.adornUrl('/management/unit/list'),
         method: 'get',
         params: this.$http.adornParams({
-          page: 1,
-          limit: 10,
+          page: this.pageIndex,
+          limit: this.pageSize,
           keyword: this.dataForm.key || undefined,
           pigstyId: this.dataForm.pigstyId || undefined,
           periodId: this.dataForm.periodId || undefined,
@@ -439,29 +439,28 @@ export default {
     },
     // 选择n个牧场
     selectionChangeHandle (val) {
-      this.selectionDataList = []
-      val.forEach(item => {
-        this.selectionDataList.push(item.id)
-      });
+      this.selectionDataList = val
+      // val.forEach(item => {
+      //   this.selectionDataList.push(item.id)
+      // });
     },
-    // 删除n个牧场
-    deleteHandle (id) {
-      this.$confirm(`确定删除单元?`, '提示', {
+    // 删除n个单元
+    deleteHandle (unit) {
+      let ids = unit? [unit.id]: this.selectionDataList.map(item => item.id)
+      let names = unit? [unit.pigstyName + '猪舍' + unit.number]: this.selectionDataList.map(item => item.pigstyName + '猪舍' + item.number)
+      this.$confirm(`确定${unit ? '删除' : '批量删除'}${names.join()}单元?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
         // 删除操作
-        if (id) {
-          this.selectionDataList.push(id)
-        }
-        if (this.selectionDataList.length <= 0) {
+        if (this.selectionDataList.length < 0) {
           return
         }
         this.$http({
           url: this.$http.adornUrl('/management/unit/delete'),
           method: 'post',
-          data: this.$http.adornData(this.selectionDataList, false)
+          data: this.$http.adornData(ids, false)
         }).then(result => {
           if (result.data.code === 0) {
             this.resetForm()

+ 0 - 11
src/views/modules/basicdata/bbox.vue

@@ -1,11 +0,0 @@
-<template>
-  <div>
-    环控盒管理
-  </div>
-</template>
-<script>
-export default {
-}
-</script>
-<style scoped>
-</style>

+ 0 - 11
src/views/modules/basicdata/borigin.vue

@@ -1,11 +0,0 @@
-<template>
-  <div>
-    产地管理
-  </div>
-</template>
-<script>
-export default {
-}
-</script>
-<style scoped>
-</style>

+ 0 - 512
src/views/modules/basicdata/bperiod.vue

@@ -1,512 +0,0 @@
-<template>
-  <div class="bunit">
-    <el-form
-      :inline="true"
-      :model="dataForm"
-      @keyup.enter.native="getDataList()">
-      <el-form-item style="width: 500px">
-        <el-input
-          v-model="dataForm.key"
-          placeholder="请输入栏期编号/猪舍/牧场"
-          clearable style="width: 500px">
-        </el-input>
-      </el-form-item>
-      <el-form-item>
-        <el-button @click="getDataList()">查询</el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button v-if="isAuth('sys:role:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button v-if="isAuth('sys:role:delete')" type="danger" @click="deleteHandle()" :disabled="selectionDataList.length <= 0">批量删除</el-button>
-      </el-form-item>
-    </el-form>
-    <el-table
-      height="670"
-      :data="dataList"
-      @selection-change="selectionChangeHandle"
-      v-loading="dataListLoading"
-      style="width: 100%"
-      :row-class-name="tableRowClassName">
-      <el-table-column
-        type="selection"
-        header-align="center"
-        align="center"
-        width="50">
-      </el-table-column>
-      <el-table-column
-        prop="number"
-        header-align="center"
-        align="center"
-        label="栏期编号">
-      </el-table-column>
-      <el-table-column
-        prop="phNumber"
-        header-align="center"
-        align="center"
-        label="所属猪舍">
-      </el-table-column>
-      <el-table-column
-        prop="name"
-        header-align="center"
-        align="center"
-        label="所属牧场">
-      </el-table-column>
-      <el-table-column
-        header-align="center"
-        align="center"
-        label="操作">
-        <template slot-scope="scope">
-          <el-button v-if="isAuth('sys:user:update')" type="success" size="mini" @click="addOrUpdateHandle(scope.row)">修改</el-button>
-          <el-button v-if="isAuth('sys:user:delete')" type="danger" size="mini" @click="deleteHandle(scope.row.id)">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <div class="block">
-      <el-pagination
-        @size-change="sizeChangeHandle"
-        @current-change="currentChangeHandle"
-        :current-page="pageIndex"
-        :page-sizes="[10, 20, 30, 50, 100]"
-        :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="totalPage">
-      </el-pagination>
-    </div>
-    <el-dialog
-      :title="!form.id ? '新增' : '修改'"
-      :close-on-click-modal="false"
-      :visible.sync="visible"
-      @close="cancel">
-      <el-form :model="form" ref="form" @keyup.enter.native="formSubmit()" label-width="80px" :rules="dataRule">
-        <el-form-item label="所属牧场" prop="pastureId">
-          <el-select v-model="form.pastureId" placeholder="请选择所属牧场" @change="getPasture" style="width: 100%">
-            <el-option
-              v-for="item in pastureList"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="所属猪舍" prop="pigstyId">
-          <el-select v-model="form.pigstyId" placeholder="请选择所属猪舍" @change="getPigsty" style="width: 100%">
-            <el-option
-              v-for="item in phSelectedList"
-              :key="item.id"
-              :label="item.number"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="栏期编号" prop="number">
-          <el-input v-model="form.number" placeholder="请输入栏期编号"></el-input>
-        </el-form-item>
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="cancel">关闭</el-button>
-        <el-button type="primary" @click="formSubmit()">确定</el-button>
-      </span>
-    </el-dialog>
-  </div>
-</template>
-<script>
-export default {
-  data () {
-    return {
-      dataForm: {
-        key: ''
-      },
-      dataList: [
-        {
-          id: '',
-          number: '',
-          phNumber: '',
-          name: '',
-        }
-      ],
-      pageIndex: 1,
-      pageSize: 10,
-      totalPage: 0,
-      dataListLoading: false,
-      selectionDataList: [],
-      visible: false,
-      form: {
-        id: '',
-        number: '',
-        pastureId: '',
-        pigstyId: ''
-      },
-      pastureList: [], // 牧场list
-      pighouseList: [], // 猪舍list
-      phSelectedList: [], // 选择过牧场后的猪舍list
-      dataRule: {
-        pastureId: [
-          { required: true, message: '所属牧场不能为空', trigger: 'blur' }
-        ],
-        pigstyId: [
-          { required: true, message: '所属猪舍不能为空', trigger: 'blur' }
-        ],
-        number: [
-          { required: true, message: '单元编号不能为空', trigger: ['blur', 'change'] }
-          // TODO: 栏期编号长度校验
-          // TODO: 栏期编号正则校验
-        ]
-      }
-    }
-  },
-  activated () {
-    this.getDataList()
-  },
-  methods: {
-    // 获取数据列表
-    getDataList () {
-      this.dataListLoading = true
-      this.$http({
-        url: this.$http.adornUrl('/management/period/list'),
-        method: 'post',
-        params: this.$http.adornParams({
-          page: 1,
-          limit: 10,
-          keyword: this.dataForm.key
-        })
-      }).then(async ({ data }) => {
-        // 获取所有牧场
-        let pastureResult = await this.$http({
-          url: this.$http.adornUrl('/management/pasture/findAll'),
-          method: 'post'
-        })
-        pastureResult.data.all && (this.pastureList = pastureResult.data.all)
-        // 获取所有猪舍
-        let pighouseResult = await this.$http({
-          url: this.$http.adornUrl('/management/pigsty/findAll'),
-          method: 'post',
-          params: this.$http.adornParams({})
-        })
-        pighouseResult.data.all && (this.pighouseList = pighouseResult.data.all)
-        if (data && data.code === 0) {
-          this.dataList = data.page.list
-          this.totalPage = data.page.totalCount
-          // 牧场对应
-          this.dataList.forEach(item => {
-            for (let pasture of this.pastureList) {
-              if (item.pastureId === pasture.id) {
-                item.name = pasture.name
-                break
-              }
-            }
-          });
-          // 猪舍对应
-          this.dataList.forEach(item => {
-            for (let pighouse of this.pighouseList) {
-              if (item.pigstyId === pighouse.id) {
-                item.phNumber = pighouse.number
-                break
-              }
-            }
-          });
-          this.phSelectedList = this.pighouseList
-        } else {
-          this.dataList = []
-          this.totalPage = 0
-        }
-        this.dataListLoading = false
-      })
-    },
-    // 每页数
-    sizeChangeHandle (val) {
-      this.pageSize = val
-      this.pageIndex = 1
-      this.getDataList()
-    },
-    // 当前页
-    currentChangeHandle (val) {
-      this.pageIndex = val
-      this.getDataList()
-    },
-    // 获取到了牧场 → 限制猪舍
-    getPasture (val) {
-      this.phSelectedList = []
-      this.pighouseList.forEach(item => {
-        if (item.pastureId === val) {
-          this.phSelectedList.push(item)
-        }
-      });
-      // 如果已有选中的猪舍,且该猪舍不属于该牧场,则清空猪舍选择
-      let i;
-      for (i = 0; i < this.phSelectedList.length; i++) {
-        let item = this.phSelectedList[i];
-        if (item.id === this.form.pigstyId) {
-          break
-        }
-      }
-      if (i === this.phSelectedList.length) {
-        this.form.pigstyId = ''
-      }
-    },
-    // 获取到猪舍
-    getPigsty (val) {
-      //  → 反向确定牧场
-      for (let item of this.pighouseList) {
-        if (item.id === val) {
-          this.form.pastureId = item.pastureId
-          break
-        }
-      }
-      // → 先获取猪舍,没有确定牧场的情况下,限制猪舍
-      this.phSelectedList = []
-      this.pighouseList.forEach(item => {
-        if (item.pastureId === this.form.pastureId) {
-          this.phSelectedList.push(item)
-        }
-      });
-    },
-    // 新增 or 修改单元
-    addOrUpdateHandle (row) {
-      // 显示牧场新增 or 修改面板
-      this.visible = true
-      if (row) {
-        this.form.id = row.id
-        for (let key of Object.keys(this.form)) {
-          this.form[key] = row[key]
-        }
-      }
-      // 解决猪舍、牧场已删除,但该页面仍不变问题
-      this.$http({
-        url: this.$http.adornUrl("/management/pasture/findAll"),
-        method: "post"
-      }).then(async ({ data }) => {
-        if (data && data.code === 0) {
-          this.pastureList = data.all
-          // 获取猪舍
-          let pighouseResult = await this.$http({
-            url: this.$http.adornUrl('/management/pigsty/findAll'),
-            method: 'get',
-            params: this.$http.adornParams({})
-          })
-          pighouseResult.data.all && (this.pighouseList = pighouseResult.data.all)
-          this.phSelectedList = this.pighouseList
-          console.log(this.pighouseList);
-        }
-      })
-    },
-    // 选择n个牧场
-    selectionChangeHandle (val) {
-      this.selectionDataList = []
-      val.forEach(item => {
-        this.selectionDataList.push(item.id)
-      });
-    },
-    // 删除n个牧场
-    deleteHandle (id) {
-      this.$confirm(`确定删除栏期?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        // 删除操作
-        if (id) {
-          this.selectionDataList.push(id)
-        }
-        if (this.selectionDataList.length <= 0) {
-          return
-        }
-        this.$http({
-          url: this.$http.adornUrl('/management/period/delete'),
-          method: 'post',
-          data: this.$http.adornData(this.selectionDataList, false)
-        }).then(result => {
-          console.log(result);
-          if (result.data.code === 0) {
-            this.resetForm()
-            this.$message({
-              message: '成功删除栏期',
-              type: 'success',
-              duration: 1000
-            })
-            // pageIndex修正
-            this.totalPage -= this.selectionDataList.length
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex > pages? pages: this.pageIndex
-            this.pageIndex = this.pageIndex < 1? pages: this.pageIndex
-          } else {
-            this.$message.error('删除栏期失败');
-          }
-          this.selectionDataList = []
-        })
-      }).catch(() => {})
-    },
-    formSubmit () {
-      if (this.form.id) {
-        /** 修改 */
-        // 输入是否完整
-        if (!this.confirmComplete()) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-        // 进行修改操作
-        this.$http({
-          url: this.$http.adornUrl('/management/period/update'),
-          method: 'post',
-          data: this.$http.adornData({
-            id: this.form.id,
-            number: this.form.number,
-            pastureId: this.form.pastureId,
-            pigstyId: this.form.pigstyId
-          })
-        }).then(result => {
-          if (result.data.code === 0) {
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: '成功修改栏期信息',
-              type: 'success',
-              duration: 1000
-            })
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              this.$message({
-                message: `栏期编号 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error('修改栏期信息失败');
-          }
-        })
-      } else {
-        /** 新增 */
-        // 输入是否完整
-        if (!this.confirmComplete(1)) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-        // 进行新增操作
-        this.$http({
-          url: this.$http.adornUrl('/management/period/save'),
-          method: 'post',
-          data: this.$http.adornData({
-            number: this.form.number,
-            pastureId: this.form.pastureId,
-            pigstyId: this.form.pigstyId
-          })
-        }).then(result => {
-          if (result.data.code === 0) {
-            // 新增pageIndex的修正
-            this.totalPage++
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex < pages? pages: this.pageIndex
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: '成功添加栏期',
-              type: 'success',
-              duration: 1000
-            })
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              this.$message({
-                message: `栏期编号 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error('添加失败');
-          }
-        })
-      }
-    },
-    // 清空form
-    resetForm () {
-      for (let i in this.form) {
-        this.form[i] = ''
-      }
-      this.getDataList()
-    },
-    // 取消
-    cancel () {
-      this.visible = false
-      // 如果新增,则不保留form
-      if (this.form.id) {
-        this.resetForm()
-      }
-    },
-    // 校验输入是否完整
-    validComplete (val) {
-      val && (delete this.form.id)
-      console.log(this.form);
-      for (let i in this.form) {
-        if (!this.form[i].toString()) {
-          return false
-        }
-      }
-      return true
-    },
-    // 如不完整,则提示
-    confirmComplete (val) {
-      if (this.validComplete(val)) {
-        return true
-      }
-      this.$confirm(`请输入完整`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        console.log('牧场输入不完整')
-      }).catch(() => {})
-      return false
-    },
-    // 校验输入是否合法,此处只校验单元序号
-    validInput () {
-      // 只允许中文、英文、数字、-、_的输入,取反
-      const reg = /[^\a-\z\A-\Z0-9\u4E00-\u9FA5\_\-]/g
-      if (reg.test(this.form.number)) {
-        return false
-      }
-      return true
-    },
-    // 如不合法,则提示
-    confirmInput () {
-      if (this.validInput()) {
-        return true
-      }
-      this.$confirm(`只允许输入中英文、数字、-与_`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        console.log('单元序号输入不合法')
-      }).catch(() => {})
-      return false
-    },
-    getchange (val) {
-      console.log(val);
-    },
-    // 变色
-    tableRowClassName({row, rowIndex}) {
-      console.log(row);
-      if (rowIndex%2 === 0) {
-        return 'warning-row';
-      }
-      return '';
-    }
-  }
-}
-</script>
-<style>
-.el-table .warning-row {
-  background: #f0f9ed;
-}
-</style>

+ 0 - 518
src/views/modules/basicdata/bpighouse.vue

@@ -1,518 +0,0 @@
-<template>
-  <div class="bpighouse">
-    <el-form
-      :inline="true"
-      :model="dataForm"
-      @keyup.enter.native="getDataList()">
-      <el-form-item style="width: 500px">
-        <el-input
-          v-model="dataForm.key"
-          placeholder="请输入猪舍编号/牧场/养殖员"
-          clearable style="width: 500px">
-        </el-input>
-      </el-form-item>
-      <el-form-item>
-        <el-button @click="getDataList()">查询</el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button
-          v-if="isAuth('sys:role:save')"
-          type="primary"
-          @click="addOrUpdateHandle()">
-          新增
-        </el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button
-          v-if="isAuth('sys:role:delete')"
-          type="danger"
-          @click="deleteHandle()"
-          :disabled="selectionDataList.length <= 0">
-          批量删除
-        </el-button>
-      </el-form-item>
-    </el-form>
-    <el-table
-      height="670"
-      :data="dataList"
-      @selection-change="selectionChangeHandle"
-      v-loading="dataListLoading"
-      style="width: 100%"
-      :row-class-name="tableRowClassName">
-      <el-table-column
-        type="selection"
-        header-align="center"
-        align="center"
-        width="50">
-      </el-table-column>
-      <el-table-column
-        prop="number"
-        header-align="center"
-        align="center"
-        label="猪舍编号">
-      </el-table-column>
-      <el-table-column
-        prop="name"
-        header-align="center"
-        align="center"
-        label="所属牧场">
-      </el-table-column>
-      <el-table-column
-        prop="feeder"
-        header-align="center"
-        align="center"
-        label="养殖员">
-      </el-table-column>
-      <el-table-column
-        header-align="center"
-        align="center"
-        label="操作">
-        <template slot-scope="scope">
-          <el-button
-            v-if="isAuth('sys:user:update')"
-            type="success"
-            size="mini"
-            @click="addOrUpdateHandle(scope.row)">
-            修改
-          </el-button>
-          <el-button
-            v-if="isAuth('sys:user:delete')"
-            type="danger"
-            size="mini"
-            @click="deleteHandle(scope.row.id)">
-            删除
-          </el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <div class="block">
-      <el-pagination
-        @size-change="sizeChangeHandle"
-        @current-change="currentChangeHandle"
-        :current-page="pageIndex"
-        :page-sizes="[10, 20, 30, 50, 100]"
-        :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="totalPage">
-      </el-pagination>
-    </div>
-    <el-dialog
-      :title="!form.id ? '新增' : '修改'"
-      :close-on-click-modal="false"
-      :visible.sync="visible"
-      @close="cancel">
-      <el-form
-        :rules="dataRule"
-        :model="form"
-        ref="form"
-        @keyup.enter.native="formSubmit()"
-        label-width="80px">
-        <el-form-item label="所属牧场" prop="pastureId">
-          <el-select v-model="form.pastureId" placeholder="请选择所属牧场" style="width: 100%">
-            <el-option
-              v-for="item in pastureList"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="猪舍编号" prop="number">
-          <el-input v-model="form.number" placeholder="猪舍编号"></el-input>
-        </el-form-item>
-        <el-form-item label="养殖员" prop="feederId">
-          <el-select v-model="form.feederId" placeholder="请选择养殖员" style="width: 100%">
-            <el-option
-              v-for="item in employeeList"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="cancel">关闭</el-button>
-        <el-button type="primary" @click="formSubmit()">确定</el-button>
-      </span>
-    </el-dialog>
-  </div>
-</template>
-<script>
-export default {
-  data() {
-    return {
-      dataForm: {
-        key: "",
-      },
-      dataList: [
-        {
-          buildTime: "",
-          id: "",
-          location: "",
-          manager: "",
-          name: "",
-        },
-      ],
-      pageIndex: 1,
-      pageSize: 10,
-      totalPage: 0,
-      dataListLoading: false,
-      selectionDataList: [],
-      visible: false,
-      form: {
-        id: "",
-        number: "",
-        pastureId: "",
-        feederId: "",
-      },
-      pastureList: [], // 牧场list
-      employeeList: [], // 养殖员list
-      // TODO: 猪舍编号长度
-      dataRule: {
-        pastureId: [
-          { required: true, message: '所属牧场不能为空', trigger: 'blur' }
-        ],
-        number: [
-          { required: true, message: '猪舍编号不能为空', trigger: ['blur', 'change'] }
-        ],
-        feederId: [
-          { required: true, message: '养殖员不能为空', trigger: 'blur' }
-        ]
-      }
-    }
-  },
-  mounted() {
-    this.getDataList();
-  },
-  methods: {
-    // 获取数据列表
-    getDataList() {
-      this.dataListLoading = true;
-      this.$http({
-        url: this.$http.adornUrl("/management/pigsty/list"),
-        method: "post",
-        params: this.$http.adornParams({
-          page: this.pageIndex,
-          limit: this.pageSize,
-          keyword: this.dataForm.key
-        })
-      }).then(async ({ data }) => {
-        let pastureResult = await this.$http({
-          url: this.$http.adornUrl("/management/pasture/findAll"),
-          method: "post"
-        });
-        pastureResult.data.all && (this.pastureList = pastureResult.data.all)
-        let employeeResult = await this.$http({
-          url: this.$http.adornUrl("/management/employee/findAll"),
-          method: "get",
-          params: this.$http.adornParams({})
-        });
-        employeeResult.data.all && (this.employeeList = employeeResult.data.all)
-        console.log(this.employeeList);
-        if (data && data.code === 0) {
-          this.dataList = data.page.list;
-          this.totalPage = data.page.totalCount;
-          this.dataList.forEach((item) => {
-            for (let pasture of this.pastureList) {
-              if (item.pastureId === pasture.id) {
-                item["name"] = pasture.name;
-                break;
-              }
-            }
-            for (let feeder of this.employeeList) {
-              if (parseInt(item.feederId) === feeder.id) {
-                item.feederId = parseInt(item.feederId)
-                item["feeder"] = feeder.name
-                break
-              }
-            }
-          })
-        } else {
-          this.dataList = []
-          this.totalPage = 0
-        }
-        this.dataListLoading = false
-      })
-    },
-    // 每页数
-    sizeChangeHandle(val) {
-      this.pageSize = val;
-      this.pageIndex = 1;
-      this.getDataList();
-    },
-    // 当前页
-    currentChangeHandle(val) {
-      this.pageIndex = val;
-      this.getDataList();
-    },
-    // 新增 or 修改牧场
-    addOrUpdateHandle(row) {
-      // 显示猪舍新增 or 修改面板
-      this.visible = true;
-      if (row) {
-        this.form.id = row.id
-        for (let key of Object.keys(this.form)) {
-          this.form[key] = row[key]
-        }
-      }
-      // 获取牧场
-      this.$http({
-        url: this.$http.adornUrl("/management/pasture/findAll"),
-        method: "post"
-      }).then(async ({ data }) => {
-        if (data && data.code === 0) {
-          this.pastureList = data.all
-          // 获取养殖员
-          let employeeResult = await this.$http({
-            url: this.$http.adornUrl("/management/employee/findAll"),
-            method: "get",
-            params: this.$http.adornParams({})
-          });
-          employeeResult.data.all && (this.employeeList = employeeResult.data.all)
-        }
-      })
-    },
-    // 选择n个牧场
-    selectionChangeHandle(val) {
-      this.selectionDataList = [];
-      val.forEach((item) => {
-        this.selectionDataList.push(item.id);
-      });
-    },
-    // 删除n个牧场
-    deleteHandle(id) {
-      this.$confirm(`确定删除牧场?`, "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-      .then(() => {
-        // 删除操作
-        if (id) {
-          this.selectionDataList.push(id);
-        }
-        if (this.selectionDataList.length <= 0) {
-          return;
-        }
-        this.$http({
-          url: this.$http.adornUrl("/management/pigsty/delete"),
-          method: "post",
-          data: this.$http.adornData(this.selectionDataList, false),
-        }).then((result) => {
-          console.log(result);
-          if (result.data.code === 0) {
-            this.$message({
-              message: "成功删除猪舍",
-              type: "success",
-              duration: 1000,
-            })
-            // pageIndex修正
-            this.totalPage -= this.selectionDataList.length
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex > pages? pages: this.pageIndex
-            this.pageIndex = this.pageIndex < 1? pages: this.pageIndex
-          } else {
-            // this.$message.error('删除失败:' + result.data.msg)
-            this.$confirm(result.data.msg, '删除失败', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning'
-            }).then(() => {
-              console.log('猪舍编号输入不合法')
-            }).catch(() => {})
-          }
-          this.resetForm();
-          this.selectionDataList = [];
-        });
-      })
-      .catch(() => {});
-    },
-    formSubmit() {
-      if (this.form.id) {
-        /** 修改 */
-        // 输入是否完整
-        if (!this.confirmComplete()) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-          // 进行修改操作
-        this.$http({
-          url: this.$http.adornUrl("/management/pigsty/update"),
-          method: "post",
-          data: this.$http.adornData({
-            id: this.form.id,
-            number: this.form.number,
-            pastureId: this.form.pastureId,
-            feederId: this.form.feederId,
-          }),
-        }).then((result) => {
-          if (result.data.code === 0) {
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: "成功修改猪舍信息",
-              type: "success",
-              duration: 1000,
-            })
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              let pasture = ''
-              for (let item of this.pastureList) {
-                if (this.form.pastureId === item.id) {
-                  pasture = item.name
-                  break
-                }
-              }
-              this.$message({
-                message: `${pasture}中猪舍编号 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error("修改猪舍信息失败");
-          }
-        })
-      } else {
-        /** 新增 */
-        // 输入是否完整
-        if (!this.confirmComplete(1)) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-        // 进行新增操作
-        this.$http({
-          url: this.$http.adornUrl("/management/pigsty/save"),
-          method: "post",
-          data: this.$http.adornData({
-            number: this.form.number,
-            pastureId: this.form.pastureId,
-            feederId: this.form.feederId,
-          }),
-        }).then((result) => {
-          if (result.data.code === 0) {
-            // 新增pageIndex的修正
-            this.totalPage++
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex < pages? pages: this.pageIndex
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: "成功添加猪舍",
-              type: "success",
-              duration: 1000,
-            });
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              let pasture = ''
-              for (let item of this.pastureList) {
-                if (this.form.pastureId === item.id) {
-                  pasture = item.name
-                  break
-                }
-              }
-              this.$message({
-                message: `${pasture}中猪舍编号 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error("添加猪舍失败");
-          }
-        })
-      }
-    },
-    // 清空form
-    resetForm() {
-      for (let i in this.form) {
-        this.form[i] = "";
-      }
-      this.getDataList();
-    },
-    // 取消
-    cancel() {
-      this.visible = false
-      // 如果新增,则不保留form
-      if (this.form.id) {
-        this.resetForm()
-      }
-    },
-    // 校验输入是否完整
-    validComplete (val) {
-      val && (delete this.form.id)
-      for (let i in this.form) {
-        if (!this.form[i].toString()) {
-          return false
-        }
-      }
-      return true
-    },
-    // 如不完整,则提示
-    confirmComplete (val) {
-      if (this.validComplete(val)) {
-        return true
-      }
-      this.$confirm(`请输入完整`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        console.log('牧场输入不完整')
-      }).catch(() => {})
-      return false
-    },
-    // 校验输入是否合法,此处只校验猪舍编号
-    validInput () {
-      // 只允许中文、英文、数字、-、_的输入,取反
-      const reg = /[^\a-\z\A-\Z0-9\u4E00-\u9FA5\_\-]/g
-      if (reg.test(this.form.number)) {
-        return false
-      }
-      return true
-    },
-    // 如不合法,则提示
-    confirmInput () {
-      if (this.validInput()) {
-        return true
-      }
-      this.$confirm(`只允许输入中英文、数字、-与_`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        console.log('猪舍编号输入不合法')
-      }).catch(() => {})
-      return false
-    },
-    getchange (val) {
-      console.log(val);
-    },
-    // 变色
-    tableRowClassName({row, rowIndex}) {
-      console.log(row);
-      if (rowIndex%2 === 0) {
-        return 'warning-row';
-      }
-      return '';
-    }
-    // TODO: 猪舍编号的长度校验
-  }
-}
-</script>
-<style scoped>
-.el-table .warning-row {
-  background: #f0f9ed;
-}
-</style>

+ 0 - 570
src/views/modules/basicdata/branch.vue

@@ -1,570 +0,0 @@
-<template>
-  <div class="branch">
-    <el-form
-      :inline="true"
-      :model="dataForm"
-      @keyup.enter.native="getDataList()">
-      <el-form-item style="width: 500px">
-        <el-input
-          v-model="dataForm.key"
-          placeholder="请输入名称/地址/负责人/建立日期"
-          clearable style="width: 500px">
-        </el-input>
-      </el-form-item>
-      <el-form-item>
-        <el-button @click="getDataList()">查询</el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button v-if="isAuth('sys:role:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button v-if="isAuth('sys:role:delete')" type="danger" @click="deleteHandle()" :disabled="selectionDataList.length <= 0">批量删除</el-button>
-      </el-form-item>
-    </el-form>
-    <el-table
-      height="670"
-      :data="dataList"
-      @selection-change="selectionChangeHandle"
-      v-loading="dataListLoading"
-      style="width: 100%"
-      :row-class-name="tableRowClassName">
-      <el-table-column
-        type="selection"
-        header-align="center"
-        align="center"
-        width="50">
-      </el-table-column>
-      <el-table-column
-        prop="name"
-        header-align="left"
-        align="left"
-        label="名称">
-      </el-table-column>
-      <el-table-column
-        prop="frontLocation"
-        header-align="left"
-        align="left"
-        label="地址">
-        <!-- <template slot-scope="scope">
-          {{ comLocation(scope.row.location) }}
-          {{scope.row.location}}
-        </template> -->
-      </el-table-column>
-      <el-table-column
-        prop="manager"
-        header-align="center"
-        align="center"
-        label="负责人"
-        width="150">
-      </el-table-column>
-      <el-table-column
-        prop="buildTime"
-        header-align="center"
-        align="center"
-        :show-overflow-tooltip="true"
-        label="建立日期"
-        width="150">
-      </el-table-column>
-      <el-table-column
-        header-align="center"
-        align="center"
-        label="操作">
-        <template slot-scope="scope">
-          <el-button v-if="isAuth('sys:user:update')" type="success" size="mini" @click="addOrUpdateHandle(scope.row)">修改</el-button>
-          <el-button v-if="isAuth('sys:user:delete')" type="danger" size="mini" @click="deleteHandle(scope.row.id)">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <div class="block">
-      <el-pagination
-        @size-change="sizeChangeHandle"
-        @current-change="currentChangeHandle"
-        :current-page="pageIndex"
-        :page-sizes="[10, 20, 30, 50, 100]"
-        :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="totalPage">
-      </el-pagination>
-    </div>
-    <el-dialog
-      :title="!form.id ? '新增' : '修改'"
-      :close-on-click-modal="false"
-      :visible.sync="visible"
-      @close="cancel">
-      <el-form :model="form" :rules="dataRule" ref="form" @keyup.enter.native="formSubmit()" label-width="80px">
-        <el-form-item label="牧场名称" prop="name">
-          <el-input v-model="form.name" placeholder="牧场名称"></el-input>
-        </el-form-item>
-        <!-- FIXME: 管理员下拉 -->
-        <el-form-item label="管理员" prop="manager">
-          <el-input v-model="form.manager" placeholder="牧场管理员"></el-input>
-        </el-form-item>
-        <el-form-item label="省市区" prop="selectedOptions">
-          <el-cascader
-            size="large"
-            :options="options"
-            v-model="form.selectedOptions"
-            @change="getlocation" 
-            placeholder="请选择省市区"
-            style="width: 100%">
-          </el-cascader>
-        </el-form-item>
-        <el-form-item label="具体地址" prop="location2">
-          <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="选择建立日期"
-            style="width: 100%">
-          </el-date-picker>
-        </el-form-item>
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="cancel">关闭</el-button>
-        <el-button type="primary" @click="formSubmit()">确定</el-button>
-      </span>
-    </el-dialog>
-  </div>
-</template>
-<script>
-import { regionData, CodeToText } from "element-china-area-data"
-export default {
-  data () {
-    return {
-      dataForm: {
-        key: ''
-      },
-      dataList: [
-        {
-          buildTime: '',
-          id: '',
-          location: '',
-          manager: '',
-          name: '',
-        }
-      ],
-      pageIndex: 1,
-      pageSize: 10,
-      totalPage: 0,
-      dataListLoading: false,
-      selectionDataList: [],
-      visible: false,
-      form: {
-        id: '',
-        location1: '',
-        location2: '',
-        manager: '',
-        name: '',
-        buildTime: '',
-        selectedOptions: [],
-        loc: ''
-      },
-      options: regionData,
-      selectedOptions: [],
-      loc: '',
-      dataRule: { // 校验规则
-        name: [
-          { required: true, message: '牧场名称不能为空', trigger: 'blur' },
-          { min: 1, max: 50, message: '长度在 1 到 50 个字符之间', trigger: ['blur', 'change'] },
-          { type: 'string' , message: '只允许输入中英文、数字、-与_', pattern: /[\w\u4E00-\u9FA5\-]+$/g }
-        ],
-        manager: [
-          { required: true, message: '管理员不能为空', trigger: 'blur' },
-          { min: 1, max: 5, message: '长度在 1 到 5 个字符之间', trigger: ['blur', 'change'] },
-          { type: 'string' , message: '只允许输入中英文、数字、-与_', pattern: /[\w\u4E00-\u9FA5\-]+$/g }
-        ],
-        selectedOptions: [
-          { required: true, message: '省市区不能为空', trigger: 'blur' }
-        ],
-        location2: [
-          { required: true, message: '具体地址不能为空', trigger: 'blur' },
-          { type : 'string' , message: '只允许输入中英文、数字、_、!与!的输入', pattern: /[\w\u4E00-\u9FA5\!\!]+$/g }
-        ],
-        buildTime: [
-          { required: true, message: '日期不能为空', trigger: 'blur' }
-        ]
-      }
-    }
-  },
-  activated () {
-    this.getDataList()
-  },
-  methods: {
-    // 变色
-    tableRowClassName({row, rowIndex}) {
-      console.log(row);
-      if (rowIndex%2 === 0) {
-        return 'warning-row';
-      }
-      return '';
-    },
-    comLocation(location) {
-      let arr = location.split(",")
-      let loc = ''
-      if (arr.length === 1) {
-        return location
-      }
-      for (let i = 0; i < arr.length - 1; i++) {
-        loc += CodeToText[arr[i]]
-      }
-      loc += arr[arr.length - 1]
-      return loc
-    },
-    // 获取数据列表
-    getDataList () {
-      this.dataListLoading = true
-      this.$http({
-        url: this.$http.adornUrl('/management/pasture/list'),
-        method: 'post',
-        params: this.$http.adornParams({
-          page: this.pageIndex,
-          limit: this.pageSize,
-          keyword: this.dataForm.key
-        })
-      }).then(({ data }) => {
-        if (data && data.code === 0) {
-          this.dataList = data.page.list
-          this.totalPage = data.page.totalCount
-        } else {
-          this.dataList = []
-          this.totalPage = 0
-        }
-        this.dataListLoading = false
-      })
-    },
-    // 每页数
-    sizeChangeHandle (val) {
-      this.pageSize = val
-      this.pageIndex = 1
-      this.getDataList()
-    },
-    // 获取地址
-    getlocation () {
-      var loc = "";
-      this.form.location1 = ''
-      for (let i = 0; i < this.form.selectedOptions.length; i++) {
-        loc += CodeToText[this.form.selectedOptions[i]]
-        this.form.location1 += this.form.selectedOptions[i] + ','
-      }
-      this.loc = loc
-      console.log(loc);
-    },
-    // 当前页
-    currentChangeHandle (val) {
-      this.pageIndex = val
-      this.getDataList()
-    },
-    // 新增 or 修改牧场
-    addOrUpdateHandle (row) {
-      // 显示牧场新增 or 修改面板
-      this.visible = true
-      if (row) {
-        let location = row.location
-        let arr = location.split(",")
-        this.form.selectedOptions = []
-        if (arr.length === 1) {
-          return
-        }
-        this.form.location1 = ''
-        for (let i = 0; i < arr.length - 1; i++) {
-          this.form.selectedOptions.push(arr[i])
-          this.form.location1 += arr[i] + ','
-        }
-        this.form.buildTime = row.buildTime
-        this.form.id = row.id
-        this.form.manager = row.manager
-        this.form.name = row.name 
-        this.form.location2 = arr[arr.length - 1]
-      }
-    },
-    // 选择n个牧场
-    selectionChangeHandle (val) {
-      this.selectionDataList = []
-      val.forEach(item => {
-        this.selectionDataList.push(item.id)
-      });
-    },
-    // 删除n个牧场
-    deleteHandle (id) {
-      this.$confirm(`确定删除牧场?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        // 删除操作
-        if (id) {
-          this.selectionDataList.push(id)
-        }
-        if (this.selectionDataList.length <= 0) {
-          return
-        }
-        this.$http({
-          url: this.$http.adornUrl('/management/pasture/delete'),
-          method: 'post',
-          data: this.$http.adornData(this.selectionDataList, false)
-        }).then(result => {
-          if (result.data.code === 0) {
-            this.$message({
-              message: '成功删除牧场',
-              type: 'success',
-              duration: 1000
-            })
-            // pageIndex修正
-            this.totalPage -= this.selectionDataList.length
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex > pages? pages: this.pageIndex
-            this.pageIndex = this.pageIndex < 1? pages: this.pageIndex
-          } else {
-            this.$confirm(result.data.msg, '删除失败', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning'
-            }).then(() => {
-              console.log('牧场删除失败');
-            }).catch(() => {})
-          }
-          this.resetForm()
-          this.selectionDataList = []
-        })
-      }).catch(() => {})
-    },
-    formSubmit () {
-      if (this.form.id) {
-        /** 修改 */
-        // 输入是否完整
-        if (!this.confirmComplete()) {
-          return
-        }
-        // 输入长度是否合法
-        if (!this.confirmLength()) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-        // 进行修改操作
-        this.$http({
-          url: this.$http.adornUrl('/management/pasture/update'),
-          method: 'post',
-          data: this.$http.adornData({
-            id: this.form.id,
-            location: this.form.location,
-            manager: this.form.manager,
-            name: this.form.name,
-            buildTime: this.form.buildTime,
-            frontLocation: this.form.loc
-          })
-        }).then(result => {
-          if (result.data.code === 0) {
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: '成功修改牧场信息',
-              type: 'success',
-              duration: 1000
-            })
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              this.$message({
-                message: `牧场名称 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error(result.data.msg);
-          }
-        })
-      } else {
-        /** 新增 */
-        // 输入是否完整
-        if (!this.confirmComplete(1)) {
-          return
-        }
-        // 输入长度是否合法
-        if (!this.confirmLength()) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-        // 进行新增操作
-        this.$http({
-          url: this.$http.adornUrl('/management/pasture/save'),
-          method: 'post',
-          data: this.$http.adornData({
-            location: this.form.location,
-            manager: this.form.manager,
-            name: this.form.name,
-            buildTime: this.form.buildTime,
-            frontLocation: this.form.loc
-          })
-        }).then(result => {
-          if (result.data.code === 0) {
-            // 新增pageIndex的修正
-            this.totalPage++
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex < pages? pages: this.pageIndex
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: '成功添加牧场',
-              type: 'success',
-              duration: 1000
-            })
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              this.$message({
-                message: `牧场名称 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error(result.data.msg)
-          }
-        })
-      }
-    },
-    // 清空form
-    resetForm () {
-      for (let i in this.form) {
-        this.form[i] = ''
-      }
-      this.form.selectedOptions = []
-      this.getDataList()
-    },
-    // 取消
-    cancel () {
-      this.visible = false
-      // 如果新增,则不保留form
-      if (this.form.id) {
-        this.resetForm()
-      }
-    },
-    // 校验输入是否完整
-    validComplete (val) {
-      var loc = "";
-      this.form.location1 = ''
-      for (let i = 0; i < this.form.selectedOptions.length; i++) {
-        loc += CodeToText[this.form.selectedOptions[i]]
-        this.form.location1 += this.form.selectedOptions[i] + ','
-      }
-      this.loc = loc
-      this.form.location = this.form.location1 + this.form.location2
-      this.form.loc = this.loc + this.form.location2
-      val && (delete this.form.id)
-      for (let i in this.form) {
-        if (!this.form[i].toString()) {
-          return false
-        }
-      }
-      return true
-    },
-    // 如不完整,则提示
-    confirmComplete (val) {
-      if (this.validComplete(val)) {
-        return true
-      }
-      this.$confirm(`所有项均为必填项`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        console.log('牧场输入不完整');
-      }).catch(() => {})
-      return false
-    },
-    // 校验输入是否合法
-    validInput () {
-      // 只允许中文、英文、数字、-、_的输入,取反
-      const reg = /[^\w\u4E00-\u9FA5\_\-]/g
-      if (reg.test(this.form.name)) {
-        return 0
-      }
-      if (reg.test(this.form.manager)) {
-        return 1
-      }
-      // 只允许中文、英文、下划线、!、!的输入
-      const a = /[^\w\u4E00-\u9FA5\!\!]/g
-      if (a.test(this.form.location2)) {
-        return 2
-      }
-      // 不允许纯数字、字母的出现
-      const b = /^[\w]*([a-zA-Z][0-9]|[0-9][a-zA-Z])[\w]*$/
-      // 不允许纯符号的出现
-      const c = /^[\_\-\!\!]*[\_\-\!\!]*$/
-      if (b.test(this.form.name) || b.test(this.form.manager) || b.test(this.form.location2) || c.test(this.form.name) || c.test(this.form.manager) || c.test(this.form.location2)) {
-        return 3
-      }
-      // 建立日期不得大于今日
-      let build = new Date(this.form.buildTime)
-      let now = new Date()
-      if (build > now) {
-        console.log('建立日期有误');
-        return 4
-      }
-      return 5
-    },
-    // 如不合法,则提示
-    confirmInput () {
-      if (this.validInput() === 5) {
-        return true
-      }
-      let msg = [
-        '牧场名称只允许中英文、数字、-、_的输入',
-        '管理员只允许中英文、数字、-、_的输入',
-        '具体地址只允许中英文、数字、_、!与!的输入',
-        '不允许输入纯数字、纯字母或纯符号',
-        '建立日期选择有误'
-      ]
-      this.$confirm(msg[this.validInput()], '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        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
-    }
-  }
-}
-</script>
-<style>
-.el-table .warning-row {
-  background: #f0f9ed;
-}
-</style>

+ 0 - 512
src/views/modules/basicdata/bunit.vue

@@ -1,512 +0,0 @@
-<template>
-  <div class="bunit">
-    <el-form
-      :inline="true"
-      :model="dataForm"
-      @keyup.enter.native="getDataList()">
-      <el-form-item style="width: 500px">
-        <el-input
-          v-model="dataForm.key"
-          placeholder="请输入单元编号/猪舍/牧场"
-          clearable style="width: 500px">
-        </el-input>
-      </el-form-item>
-      <el-form-item>
-        <el-button @click="getDataList()">查询</el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button v-if="isAuth('sys:role:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
-      </el-form-item>
-      <el-form-item>
-        <el-button v-if="isAuth('sys:role:delete')" type="danger" @click="deleteHandle()" :disabled="selectionDataList.length <= 0">批量删除</el-button>
-      </el-form-item>
-    </el-form>
-    <el-table
-      height="670"
-      :data="dataList"
-      @selection-change="selectionChangeHandle"
-      v-loading="dataListLoading"
-      style="width: 100%"
-      :row-class-name="tableRowClassName">
-      <el-table-column
-        type="selection"
-        header-align="center"
-        align="center"
-        width="50">
-      </el-table-column>
-      <el-table-column
-        prop="number"
-        header-align="center"
-        align="center"
-        label="单元编号">
-      </el-table-column>
-      <el-table-column
-        prop="phNumber"
-        header-align="center"
-        align="center"
-        label="所属猪舍">
-      </el-table-column>
-      <el-table-column
-        prop="name"
-        header-align="center"
-        align="center"
-        label="所属牧场">
-      </el-table-column>
-      <el-table-column
-        header-align="center"
-        align="center"
-        label="操作">
-        <template slot-scope="scope">
-          <el-button v-if="isAuth('sys:user:update')" type="success" size="mini" @click="addOrUpdateHandle(scope.row)">修改</el-button>
-          <el-button v-if="isAuth('sys:user:delete')" type="danger" size="mini" @click="deleteHandle(scope.row.id)">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <div class="block">
-      <el-pagination
-        @size-change="sizeChangeHandle"
-        @current-change="currentChangeHandle"
-        :current-page="pageIndex"
-        :page-sizes="[10, 20, 30, 50, 100]"
-        :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="totalPage">
-      </el-pagination>
-    </div>
-    <el-dialog
-      :title="!form.id ? '新增' : '修改'"
-      :close-on-click-modal="false"
-      :visible.sync="visible"
-      @close="cancel">
-      <el-form :model="form" ref="form" @keyup.enter.native="formSubmit()" label-width="80px" :rules="dataRule">
-        <el-form-item label="所属牧场" prop="pastureId">
-          <el-select v-model="form.pastureId" placeholder="请选择所属牧场" @change="getPasture" style="width: 100%">
-            <el-option
-              v-for="item in pastureList"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="所属猪舍" prop="pigstyId">
-          <el-select v-model="form.pigstyId" placeholder="请选择所属猪舍" @change="getPigsty" style="width: 100%">
-            <el-option
-              v-for="item in phSelectedList"
-              :key="item.id"
-              :label="item.number"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="单元编号" prop="number">
-          <el-input v-model="form.number" placeholder="请输入单元编号"></el-input>
-        </el-form-item>
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="cancel">关闭</el-button>
-        <el-button type="primary" @click="formSubmit()">确定</el-button>
-      </span>
-    </el-dialog>
-  </div>
-</template>
-<script>
-export default {
-  data () {
-    return {
-      dataForm: {
-        key: ''
-      },
-      dataList: [
-        {
-          id: '',
-          number: '',
-          phNumber: '',
-          name: '',
-        }
-      ],
-      pageIndex: 1,
-      pageSize: 10,
-      totalPage: 0,
-      dataListLoading: false,
-      selectionDataList: [],
-      visible: false,
-      form: {
-        id: '',
-        number: '',
-        pastureId: '',
-        pigstyId: ''
-      },
-      pastureList: [], // 牧场list
-      pighouseList: [], // 猪舍list
-      phSelectedList: [], // 选择过牧场后的猪舍list
-      dataRule: {
-        pastureId: [
-          { required: true, message: '所属牧场不能为空', trigger: 'blur' }
-        ],
-        pigstyId: [
-          { required: true, message: '所属猪舍不能为空', trigger: 'blur' }
-        ],
-        number: [
-          { required: true, message: '单元编号不能为空', trigger: ['blur', 'change'] }
-          // TODO: 单元编号长度校验
-          // TODO: 单元编号正则校验
-        ]
-      }
-    }
-  },
-  activated () {
-    this.getDataList()
-  },
-  methods: {
-    // 获取数据列表
-    getDataList () {
-      this.dataListLoading = true
-      this.$http({
-        url: this.$http.adornUrl('/management/unit/list'),
-        method: 'post',
-        params: this.$http.adornParams({
-          page: 1,
-          limit: 10,
-          keyword: this.dataForm.key
-        })
-      }).then(async ({ data }) => {
-        // 获取所有牧场
-        let pastureResult = await this.$http({
-          url: this.$http.adornUrl('/management/pasture/findAll'),
-          method: 'post'
-        })
-        pastureResult.data.all && (this.pastureList = pastureResult.data.all)
-        // 获取所有猪舍
-        let pighouseResult = await this.$http({
-          url: this.$http.adornUrl('/management/pigsty/findAll'),
-          method: 'get',
-          params: this.$http.adornParams({})
-        })
-        pighouseResult.data.all && (this.pighouseList = pighouseResult.data.all)
-        if (data && data.code === 0) {
-          this.dataList = data.page.list
-          this.totalPage = data.page.totalCount
-          // 牧场对应
-          this.dataList.forEach(item => {
-            for (let pasture of this.pastureList) {
-              if (item.pastureId === pasture.id) {
-                item.name = pasture.name
-                break
-              }
-            }
-          });
-          // 猪舍对应
-          this.dataList.forEach(item => {
-            for (let pighouse of this.pighouseList) {
-              if (item.pigstyId === pighouse.id) {
-                item.phNumber = pighouse.number
-                break
-              }
-            }
-          });
-          this.phSelectedList = this.pighouseList
-        } else {
-          this.dataList = []
-          this.totalPage = 0
-        }
-        this.dataListLoading = false
-      })
-    },
-    // 每页数
-    sizeChangeHandle (val) {
-      this.pageSize = val
-      this.pageIndex = 1
-      this.getDataList()
-    },
-    // 当前页
-    currentChangeHandle (val) {
-      this.pageIndex = val
-      this.getDataList()
-    },
-    // 获取到了牧场 → 限制猪舍
-    getPasture (val) {
-      this.phSelectedList = []
-      this.pighouseList.forEach(item => {
-        if (item.pastureId === val) {
-          this.phSelectedList.push(item)
-        }
-      });
-      // 如果已有选中的猪舍,且该猪舍不属于该牧场,则清空猪舍选择
-      let i;
-      for (i = 0; i < this.phSelectedList.length; i++) {
-        let item = this.phSelectedList[i];
-        if (item.id === this.form.pigstyId) {
-          break
-        }
-      }
-      if (i === this.phSelectedList.length) {
-        this.form.pigstyId = ''
-      }
-    },
-    // 获取到猪舍
-    getPigsty (val) {
-      //  → 反向确定牧场
-      for (let item of this.pighouseList) {
-        if (item.id === val) {
-          this.form.pastureId = item.pastureId
-          break
-        }
-      }
-      // → 先获取猪舍,没有确定牧场的情况下,限制猪舍
-      this.phSelectedList = []
-      this.pighouseList.forEach(item => {
-        if (item.pastureId === this.form.pastureId) {
-          this.phSelectedList.push(item)
-        }
-      });
-    },
-    // 新增 or 修改单元
-    addOrUpdateHandle (row) {
-      // 显示牧场新增 or 修改面板
-      this.visible = true
-      if (row) {
-        for (let key of Object.keys(this.form)) {
-          this.form[key] = row[key]
-        }
-        this.form.id = row.id
-      }
-      // 解决猪舍、牧场已删除,但该页面仍不变问题
-      this.$http({
-        url: this.$http.adornUrl("/management/pasture/findAll"),
-        method: "post"
-      }).then(async ({ data }) => {
-        if (data && data.code === 0) {
-          this.pastureList = data.all
-          // 获取猪舍
-          let pighouseResult = await this.$http({
-            url: this.$http.adornUrl('/management/pigsty/findAll'),
-            method: 'get',
-            params: this.$http.adornParams({})
-          })
-          pighouseResult.data.all && (this.pighouseList = pighouseResult.data.all)
-          this.phSelectedList = this.pighouseList
-          console.log(this.pighouseList);
-        }
-      })
-    },
-    // 选择n个牧场
-    selectionChangeHandle (val) {
-      this.selectionDataList = []
-      val.forEach(item => {
-        this.selectionDataList.push(item.id)
-      });
-    },
-    // 删除n个牧场
-    deleteHandle (id) {
-      this.$confirm(`确定删除单元?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        // 删除操作
-        if (id) {
-          this.selectionDataList.push(id)
-        }
-        if (this.selectionDataList.length <= 0) {
-          return
-        }
-        this.$http({
-          url: this.$http.adornUrl('/management/unit/delete'),
-          method: 'post',
-          data: this.$http.adornData(this.selectionDataList, false)
-        }).then(result => {
-          console.log(result);
-          if (result.data.code === 0) {
-            this.resetForm()
-            this.$message({
-              message: '成功删除单元',
-              type: 'success',
-              duration: 1000
-            })
-            // pageIndex修正
-            this.totalPage -= this.selectionDataList.length
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex > pages? pages: this.pageIndex
-            this.pageIndex = this.pageIndex < 1? pages: this.pageIndex
-          } else {
-            this.$message.error('删除单元失败');
-          }
-          this.selectionDataList = []
-        })
-      }).catch(() => {})
-    },
-    formSubmit () {
-      if (this.form.id) {
-        /** 修改 */
-        // 输入是否完整
-        if (!this.confirmComplete()) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-        // 进行修改操作
-        this.$http({
-          url: this.$http.adornUrl('/management/unit/update'),
-          method: 'post',
-          data: this.$http.adornData({
-            id: this.form.id,
-            number: this.form.number,
-            pastureId: this.form.pastureId,
-            pigstyId: this.form.pigstyId
-          })
-        }).then(result => {
-          if (result.data.code === 0) {
-            // 新增pageIndex的修正
-            this.totalPage++
-            let pages = Math.ceil(this.totalPage / this.pageSize)
-            this.pageIndex = this.pageIndex < pages? pages: this.pageIndex
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: '成功修改单元信息',
-              type: 'success',
-              duration: 1000
-            })
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              this.$message({
-                message: `单元编号 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error('修改单元信息失败');
-          }
-        })
-      } else {
-        /** 新增 */
-        // 输入是否完整
-        if (!this.confirmComplete(1)) {
-          return
-        }
-        // 输入是否合法
-        if (!this.confirmInput()) {
-          return
-        }
-        // 进行新增操作
-        this.$http({
-          url: this.$http.adornUrl('/management/unit/save'),
-          method: 'post',
-          data: this.$http.adornData({
-            number: this.form.number,
-            pastureId: this.form.pastureId,
-            pigstyId: this.form.pigstyId
-          })
-        }).then(result => {
-          if (result.data.code === 0) {
-            this.resetForm();
-            this.visible = false;
-            this.$message({
-              message: '成功添加单元',
-              type: 'success',
-              duration: 1000
-            })
-          } else {
-            if (result.data.code === 600) {
-              let msg = result.data.msg.split('-')
-              this.$message({
-                message: `单元编号 <p style="color:#333; display:inline">${msg[0]}</p> 已经存在!`,
-                type: "error",
-                duration: 1000,
-                dangerouslyUseHTMLString: true
-              })
-              return
-            }
-            this.$message.error('添加失败');
-          }
-        })
-      }
-    },
-    // 清空form
-    resetForm () {
-      for (let i in this.form) {
-        this.form[i] = ''
-      }
-      this.getDataList()
-    },
-    // 取消
-    cancel () {
-      this.visible = false
-      // 如果新增,则不保留form
-      if (this.form.id) {
-        this.resetForm()
-      }
-    },
-    // 校验输入是否完整
-    validComplete (val) {
-      val && (delete this.form.id)
-      console.log(this.form);
-      for (let i in this.form) {
-        if (!this.form[i].toString()) {
-          return false
-        }
-      }
-      return true
-    },
-    // 如不完整,则提示
-    confirmComplete (val) {
-      if (this.validComplete(val)) {
-        return true
-      }
-      this.$confirm(`请输入完整`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        console.log('牧场输入不完整')
-      }).catch(() => {})
-      return false
-    },
-    // 校验输入是否合法,此处只校验单元序号
-    validInput () {
-      // 只允许中文、英文、数字、-、_的输入,取反
-      const reg = /[^\a-\z\A-\Z0-9\u4E00-\u9FA5\_\-]/g
-      if (reg.test(this.form.number)) {
-        return false
-      }
-      return true
-    },
-    // 如不合法,则提示
-    confirmInput () {
-      if (this.validInput()) {
-        return true
-      }
-      this.$confirm(`只允许输入中英文、数字、-与_`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        console.log('单元序号输入不合法')
-      }).catch(() => {})
-      return false
-    },
-    getchange (val) {
-      console.log(val);
-    },
-    // 变色
-    tableRowClassName({row, rowIndex}) {
-      console.log(row);
-      if (rowIndex%2 === 0) {
-        return 'warning-row';
-      }
-      return '';
-    }
-  }
-}
-</script>
-<style>
-.el-table .warning-row {
-  background: #f0f9ed;
-}
-</style>

+ 0 - 11
src/views/modules/basicdata/bvariety.vue

@@ -1,11 +0,0 @@
-<template>
-  <div>
-    品种管理
-  </div>
-</template>
-<script>
-export default {
-}
-</script>
-<style scoped>
-</style>

+ 24 - 2
src/views/modules/breed/beartag.vue

@@ -109,7 +109,6 @@
                 align="right"
                 start-placeholder="开始时间"
                 end-placeholder="结束时间"
-                :default-time="['08:00:00', '16:00:00']"
                 @change="timeChange"
                 value-format="yyyy-MM-dd HH:mm:ss">
               </el-date-picker>
@@ -296,7 +295,7 @@
         unitSelectedList: [], // 根据栋舍限制的单元
         labelPosition: 'right',
         dialogVisible: false, // 控制 耳标信息dialog 的显示
-        time: [] // 查看耳标信息时要传入的值
+        time: [new Date(new Date().getTime() - 7*3600*1000*24), new Date()] // 查看耳标信息时要传入的值,默认七天之内的数据
       }
     },
     components: {
@@ -308,6 +307,29 @@
     methods: {
       // 获取数据列表
       getDataList (val) {
+        // Date.prototype.format = function(fmt) { 
+        //   var o = { 
+        //     "M+" : this.getMonth()+1,                 //月份 
+        //     "d+" : this.getDate(),                    //日 
+        //     "h+" : this.getHours(),                   //小时 
+        //     "m+" : this.getMinutes(),                 //分 
+        //     "s+" : this.getSeconds(),                 //秒 
+        //     "q+" : Math.floor((this.getMonth()+3)/3), //季度 
+        //     "S" : this.getMilliseconds()             //毫秒 
+        //   }; 
+        //   if(/(y+)/.test(fmt)) {
+        //     fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
+        //   }
+        //   for(var k in o) {
+        //     if(new RegExp("("+ k +")").test(fmt)){
+        //       fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
+        //     }
+        //   }
+        //   return fmt; 
+        // }
+        // let now = new Date()
+        // this.time[0] = new Date(now.getTime() - 7*24*3600*1000).format('yyyy-MM-dd hh:mm:ss')
+        // this.time[1] = now.format('yyyy-MM-dd hh:mm:ss')
         this.dataListLoading = true
         
         // 对 新增or删除 操作,当前页为最后一页

+ 1 - 1
src/views/modules/breed/bfood.vue

@@ -186,7 +186,7 @@
         let names = id? [this.dataList.filter(item => item.id === id)[0].ingredients]: this.dataListSelections.map(item => {
           return item.ingredients
         })
-        this.$confirm(`确定对[饲料名称=${names.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
+        this.$confirm(`确定${id ? '删除' : '批量删除'}饲料配方${names.join(',')}?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'

+ 6 - 0
src/views/modules/breed/btrecord.vue

@@ -134,6 +134,12 @@
               align="center"
               label="操作人员">
             </el-table-column>
+            <el-table-column
+              prop="transDate"
+              header-align="center"
+              align="center"
+              label="操作时间">
+            </el-table-column>
           </el-table>
           <el-pagination
             @size-change="sizeChangeHandle"

+ 1 - 1
src/views/modules/env/huan.vue

@@ -199,7 +199,7 @@
         var ids = id ? [id] : this.dataListSelections.map(item => {
           return item.deviceId
         })
-        this.$confirm(`确定对[设备编号=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
+        this.$confirm(`确定${id ? '删除' : '批量删除'}编号${ids.join(',')}]的设备?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'

+ 3 - 3
src/views/modules/envir/ealarm.vue

@@ -108,13 +108,13 @@
               prop="thresholdType"
               header-align="center"
               align="center"
-              label="参数阈值">
+              label="参数名称">
             </el-table-column>
             <el-table-column
               prop="thresholdValue"
               header-align="center"
               align="center"
-              label="参数名称">
+              label="参数阈值">
             </el-table-column>
             <el-table-column
               header-align="center"
@@ -357,7 +357,7 @@
         var ids = id ? [id] : this.dataListSelections.map(item => {
           return item.id
         })
-        this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
+        this.$confirm(`确定${id ? '删除' : '批量删除'}报警设置?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'

+ 21 - 16
src/views/modules/health/hdisease.vue

@@ -55,7 +55,9 @@
               </el-button>
               <el-button
                   icon="el-icon-delete"
-                  @click="delAll">
+                  @click="delAll"
+                  type="danger"
+                  :disabled="selectList.length <= 0">
                 删 除
               </el-button>
             </el-form-item>
@@ -400,9 +402,11 @@ export default {
     },
     // 批量删除
     delAll () {
+      let ids = this.selectList.map(item => item.id)
+      let eartags = this.selectList.map(item => item.pigId)
       if (this.selectList.length > 0) {
         let that = this
-        this.$confirm('此操作将永久删除这些数据, 是否继续?', '提示', {
+        this.$confirm(`确定批量删除耳标号${eartags.join(',')}的猪只的疾病诊断?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -410,16 +414,16 @@ export default {
           that.$http({
             url: that.$http.adornUrl('/management/healthmedicalrecord/delete'),
             method: 'post',
-            data: that.$http.adornData(that.selectList, false)
+            data: that.$http.adornData(ids, false)
+          }).then(res => {
+            if (res.data.code === 0) {
+              this.$message.success('删除成功!')
+              this.init()
+              this.selectList = []
+            } else {
+              this.$message.error(res.data.msg)
+            }
           })
-              .then(res => {
-                if (res.data.code === 0) {
-                  this.$message.success('删除成功!')
-                  this.init()
-                } else {
-                  this.$message.error(res.data.msg)
-                }
-              })
         }).catch(() => {
           this.$message({
             type: 'info',
@@ -431,10 +435,10 @@ export default {
       }
     },
     selectionChangeHandle (val) {
-      this.selectList = []
-      val.forEach(item => {
-        this.selectList.push(item.id)
-      })
+      this.selectList = val
+      // val.forEach(item => {
+      //   this.selectList.push(item.id)
+      // })
     },
     addOrUpdateHandle (row) {
       this.visible = true
@@ -456,8 +460,9 @@ export default {
     },
     deleteHandle (id) {
       let ids = [id]
+      let eartag = this.tableData.filter(item => item.id === id)[0].pigId
       let that = this
-      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+      this.$confirm(`确定删除耳标号${eartag}的猪只的疾病诊断?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'

+ 34 - 17
src/views/modules/health/hisolate.vue

@@ -26,7 +26,11 @@
               <el-button icon="el-icon-plus" @click="visibleDialog = true">新 增</el-button>
             </el-form-item>
             <el-form-item>
-              <el-button icon="el-icon-delete" @click="delAll">批量删除</el-button>
+              <el-button 
+                icon="el-icon-delete" 
+                @click="delAll" 
+                type="danger"
+                :disabled="selectList.length <= 0">删 除</el-button>
             </el-form-item>
           </el-form>
           <el-table
@@ -203,7 +207,17 @@ export default {
         medicalRecordId: '',
         pigCode: ''
       },
-      dataRule: {},
+      dataRule: {
+        pigId: [
+          { required: true, message: '猪只耳标不能为空', trigger: 'blur' }
+        ],
+        diseaseName: [
+          { required: true, message: '疾病名称不能为空', trigger: 'blur' }
+        ],
+        doctorId: [
+          { required: true, message: '操作人不能为空', trigger: 'blur' }
+        ]
+      },
       eartag: ''
     }
   },
@@ -261,10 +275,10 @@ export default {
       this.eartag = row.pigCode
     },
     selectionChangeHandle (val) {
-      this.selectList = []
-      val.forEach(item => {
-        this.selectList.push(item.id)
-      })
+      this.selectList = val
+      // val.forEach(item => {
+      //   this.selectList.push(item.id)
+      // })
     },
     dataFormSubmit () {
       this.$refs['dataForm'].validate((valid) => {
@@ -311,8 +325,9 @@ export default {
     },
     deleteHandle (id) {
       let ids = [id]
+      let eartag = this.tableData.filter(item => item.id === id)[0].pigCode
       let that = this
-      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+      this.$confirm(`确定删除耳标号${eartag}的猪只的隔离管理?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
@@ -353,9 +368,11 @@ export default {
     },
     // 批量删除
     delAll () {
+      let ids = this.selectList.map(item => item.id)
+      let eartags = this.selectList.map(item => item.pigCode)
       if (this.selectList.length > 0) {
         let that = this
-        this.$confirm('此操作将永久删除这些数据, 是否继续?', '提示', {
+        this.$confirm(`确定批量删除耳标号${eartags.join(',')}的猪只的隔离管理?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -363,16 +380,16 @@ export default {
           that.$http({
             url: that.$http.adornUrl('/management/healthisolationrecord/delete'),
             method: 'post',
-            data: that.$http.adornData(that.selectList, false)
+            data: that.$http.adornData(ids, false)
+          }).then(res => {
+            if (res.data.code === 0) {
+              this.$message.success('删除成功!')
+              this.init()
+              this.selectList = []
+            } else {
+              this.$message.error(res.data.msg)
+            }
           })
-              .then(res => {
-                if (res.data.code === 0) {
-                  this.$message.success('删除成功!')
-                  this.init()
-                } else {
-                  this.$message.error(res.data.msg)
-                }
-              })
         }).catch(() => {
           this.$message({
             type: 'info',

+ 21 - 16
src/views/modules/health/htreat.vue

@@ -55,7 +55,9 @@
 <!--              </el-button>-->
               <el-button
                   icon="el-icon-delete"
-                  @click="delAll">
+                  @click="delAll" 
+                  type="danger"
+                  :disabled="selectList.length <= 0">
                 删 除
               </el-button>
             </el-form-item>
@@ -409,9 +411,11 @@ export default {
     },
     // 批量删除
     delAll () {
+      let ids = this.selectList.map(item => item.id)
+      let eartags = this.selectList.map(item => item.pigId)
       if (this.selectList.length > 0) {
         let that = this
-        this.$confirm('此操作将永久删除这些数据, 是否继续?', '提示', {
+        this.$confirm(`确定批量删除耳标号${eartags.join(',')}的猪只的治疗结果?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -419,16 +423,16 @@ export default {
           that.$http({
             url: that.$http.adornUrl('/management/healthmedicalrecord/delete'),
             method: 'post',
-            data: that.$http.adornData(that.selectList, false)
+            data: that.$http.adornData(ids, false)
+          }).then(res => {
+            if (res.data.code === 0) {
+              this.$message.success('删除成功!')
+              this.init()
+              this.selectList = []
+            } else {
+              this.$message.error(res.data.msg)
+            }
           })
-              .then(res => {
-                if (res.data.code === 0) {
-                  this.$message.success('删除成功!')
-                  this.init()
-                } else {
-                  this.$message.error(res.data.msg)
-                }
-              })
         }).catch(() => {
           this.$message({
             type: 'info',
@@ -440,10 +444,10 @@ export default {
       }
     },
     selectionChangeHandle (val) {
-      this.selectList = []
-      val.forEach(item => {
-        this.selectList.push(item.id)
-      })
+      this.selectList = val
+      // val.forEach(item => {
+      //   this.selectList.push(item.id)
+      // })
     },
     addOrUpdateHandle (row) {
       this.visible = true
@@ -465,8 +469,9 @@ export default {
     },
     deleteHandle (id) {
       let ids = [id]
+      let eartag = this.tableData.filter(item => item.id === id)[0].pigId
       let that = this
-      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+      this.$confirm(`确定删除耳标号${eartag}的猪只的疾病诊断?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'

+ 46 - 30
src/views/modules/health/hvaccine.vue

@@ -250,10 +250,10 @@ export default {
       })
     },
     selectionChangeHandle (val) {
-      this.selectList = []
-      val.forEach(item => {
-        this.selectList.push(item.id)
-      })
+      this.selectList = val
+      // val.forEach(item => {
+      //   this.selectList.push(item.id)
+      // })
     },
     // 修改
     addOrUpdateHandle (row) {
@@ -267,19 +267,26 @@ export default {
     },
     deleteHandle (id) {
       let ids = [id]
-      this.$http({
-        url: this.$http.adornUrl('/management/healthimmunerecord/delete'),
-        method: 'post',
-        data: this.$http.adornData(ids, false)
-      })
-      .then(res => {
-        if (res.data.code === 0) {
-          this.$message.success('删除成功!')
-          this.init()
-        } else {
-          this.$message.error(res.data.msg)
-        }
-      })
+      let eartag = this.tableData.filter(item => item.id === id)[0].pigId
+      this.$confirm(`确定删除耳标号${eartag}的猪只的疫苗记录?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.$http({
+          url: this.$http.adornUrl('/management/healthimmunerecord/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        })
+        .then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功')
+            this.init()
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
+      }).catch(() => {})
     },
     onChangeMan (id) {
       let man = {}
@@ -322,19 +329,28 @@ export default {
       this.searchForm.earTag = ''
     },
     delAll () {
-      this.$http({
-        url: this.$http.adornUrl('/management/healthimmunerecord/delete'),
-        method: 'post',
-        data: this.$http.adornData(this.selectList, false)
-      })
-      .then(res => {
-        if (res.data.code === 0) {
-          this.$message.success('删除成功')
-          this.init()
-        } else {
-          this.$message.error(res.data.msg)
-        }
-      })
+      let ids = this.selectList.map(pig => pig.id)
+      let eartags = this.selectList.map(pig => pig.pigId)
+      this.$confirm(`确定批量删除耳标号${eartags.join(',')}的猪只的疫苗记录?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.$http({
+          url: this.$http.adornUrl('/management/healthimmunerecord/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        })
+        .then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功')
+            this.init()
+            this.selectList = []
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
+      }).catch(() => {})
     },
     // 关闭模态框
     onCancel () {

+ 52 - 31
src/views/modules/monitor/areaAdmin.vue

@@ -83,7 +83,7 @@
                   v-if="isAuth('sys:user:delete')"
                   type="text"
                   size="medium"
-                  @click="deleteHandle(scope.row.id)"
+                  @click="deleteHandle(scope.row)"
                   style="color: rgb(24,144,255)">
                 删除
               </el-button>
@@ -164,19 +164,30 @@ export default {
       this.form.keyword = ''
     },
     delAll () {
-      this.$http({
-        url: this.$http.adornUrl('/management/pasturearea/delete'),
-        method: 'post',
-        data: this.$http.adornData(this.selectList, false)
+      let ids = this.selectList.map(item => item.id)
+      let names = this.selectList.map(item => item.name)
+      this.$confirm(`确定批量删除${names.join()}区域?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 删除操作
+        if (this.selectList.length < 0) {
+          return
+        }
+        this.$http({
+          url: this.$http.adornUrl('/management/pasturearea/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        }).then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功')
+            this.init()
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
       })
-          .then(res => {
-            if (res.data.code === 0) {
-              this.$message.success('删除成功')
-              this.init()
-            } else {
-              this.$message.error(res.data.msg)
-            }
-          })
     },
     sizeChange (val) {
       this.limit = val
@@ -207,10 +218,10 @@ export default {
       })
     },
     selectionChangeHandle (val) {
-      this.selectList = []
-      val.forEach(item => {
-        this.selectList.push(item.id)
-      })
+      this.selectList = val
+      // val.forEach(item => {
+      //   this.selectList.push(item.id)
+      // })
     },
     addOrUpdateHandle (row) {
       this.dataForm = {
@@ -219,21 +230,31 @@ export default {
       }
       this.visible = true
     },
-    deleteHandle (id) {
-      let ids = [id]
-      this.$http({
-        url: this.$http.adornUrl('/management/pasturearea/delete'),
-        method: 'post',
-        data: this.$http.adornData(ids, false)
+    deleteHandle (area) {
+      let ids = [area.id]
+      let name = area.name
+      this.$confirm(`确定删除${name}区域?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 删除操作
+        if (this.selectList.length < 0) {
+          return
+        }
+        this.$http({
+          url: this.$http.adornUrl('/management/pasturearea/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        }).then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功!')
+            this.init()
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
       })
-          .then(res => {
-            if (res.data.code === 0) {
-              this.$message.success('删除成功!')
-              this.init()
-            } else {
-              this.$message.error(res.data.msg)
-            }
-          })
     },
     dataFormSubmit () {
       this.$refs['dataForm'].validate((valid) => {

+ 52 - 31
src/views/modules/monitor/camera.vue

@@ -124,7 +124,7 @@
                     v-if="isAuth('sys:user:delete')"
                     type="text"
                     size="medium"
-                    @click="deleteHandle(scope.row.id)"
+                    @click="deleteHandle(scope.row)"
                     style="color: rgb(24,144,255)">
                   删除
                 </el-button>
@@ -294,19 +294,30 @@ export default {
       this.form.keyword = ''
     },
     delAll () {
-      this.$http({
-        url: this.$http.adornUrl('/management/camerainfo/delete'),
-        method: 'post',
-        data: this.$http.adornData(this.selectList, false)
+      let ids = this.selectList.map(item => item.id)
+      let names = this.selectList.map(item => item.name)
+      this.$confirm(`确定批量删除${names.join()}摄像头?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 删除操作
+        if (this.selectList.length < 0) {
+          return
+        }
+        this.$http({
+          url: this.$http.adornUrl('/management/camerainfo/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        }).then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功')
+            this.init()
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
       })
-          .then(res => {
-            if (res.data.code === 0) {
-              this.$message.success('删除成功')
-              this.init()
-            } else {
-              this.$message.error(res.data.msg)
-            }
-          })
     },
     sizeChange (val) {
       this.limit = val
@@ -358,10 +369,10 @@ export default {
       })
     },
     selectionChangeHandle (val) {
-      this.selectList = []
-      val.forEach(item => {
-        this.selectList.push(item.id)
-      })
+      this.selectList = val
+      // val.forEach(item => {
+      //   this.selectList.push(item.id)
+      // })
     },
     addOrUpdateHandle (row) {
       this.dataForm = {
@@ -378,21 +389,31 @@ export default {
       }
       this.visible = true
     },
-    deleteHandle (id) {
-      let ids = [id]
-      this.$http({
-        url: this.$http.adornUrl('/management/camerainfo/delete'),
-        method: 'post',
-        data: this.$http.adornData(ids, false)
+    deleteHandle (camera) {
+      let ids = [camera.id]
+      let name = camera.name
+      this.$confirm(`确定删除${name}摄像头?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 删除操作
+        if (this.selectList.length < 0) {
+          return
+        }
+        this.$http({
+          url: this.$http.adornUrl('/management/camerainfo/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        }).then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功!')
+            this.init()
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
       })
-          .then(res => {
-            if (res.data.code === 0) {
-              this.$message.success('删除成功!')
-              this.init()
-            } else {
-              this.$message.error(res.data.msg)
-            }
-          })
     },
     dataFormSubmit () {
       this.$refs['dataForm'].validate((valid) => {

+ 50 - 28
src/views/modules/monitor/cameraBrand.vue

@@ -190,19 +190,31 @@ export default {
       this.form.keyword = ''
     },
     delAll () {
-      this.$http({
-        url: this.$http.adornUrl('/management/camerabrand/delete'),
-        method: 'post',
-        data: this.$http.adornData(this.selectList, false)
+      let ids = this.selectList.map(item => item.id)
+      let names = this.selectList.map(item => item.brandName)
+      this.$confirm(`确定批量删除${names.join()}摄像头品牌?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 删除操作
+        if (this.selectList.length < 0) {
+          return
+        }
+        this.$http({
+          url: this.$http.adornUrl('/management/camerabrand/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        }).then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功')
+            this.init()
+            this.selectionDataList = []
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
       })
-          .then(res => {
-            if (res.data.code === 0) {
-              this.$message.success('删除成功')
-              this.init()
-            } else {
-              this.$message.error(res.data.msg)
-            }
-          })
     },
     sizeChange (val) {
       this.limit = val
@@ -233,10 +245,10 @@ export default {
           })
     },
     selectionChangeHandle (val) {
-      this.selectList = []
-      val.forEach(item => {
-        this.selectList.push(item.id)
-      })
+      this.selectList = val
+      // val.forEach(item => {
+      //   this.selectList.push(item.id)
+      // })
     },
     addOrUpdateHandle (row) {
       this.dataForm = {
@@ -250,19 +262,29 @@ export default {
     },
     deleteHandle (id) {
       let ids = [id]
-      this.$http({
-        url: this.$http.adornUrl('/management/camerabrand/delete'),
-        method: 'post',
-        data: this.$http.adornData(ids, false)
+      let name = this.dataList.filter(item => item.id === id)[0].brandName
+      this.$confirm(`确定删除${name}摄像头品牌?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 删除操作
+        if (this.selectList.length < 0) {
+          return
+        }
+        this.$http({
+          url: this.$http.adornUrl('/management/camerabrand/delete'),
+          method: 'post',
+          data: this.$http.adornData(ids, false)
+        }).then(res => {
+          if (res.data.code === 0) {
+            this.$message.success('删除成功')
+            this.init()
+          } else {
+            this.$message.error(res.data.msg)
+          }
+        })
       })
-          .then(res => {
-            if (res.data.code === 0) {
-              this.$message.success('删除成功!')
-              this.init()
-            } else {
-              this.$message.error(res.data.msg)
-            }
-          })
     },
     dataFormSubmit () {
       this.$refs['dataForm'].validate((valid) => {

+ 15 - 11
src/views/modules/pigbasic/pbbasic.vue

@@ -106,10 +106,10 @@
         <div class="rect rect-table">
           <el-form size="mini" :inline="true">
             <el-form-item>
-              <el-button 
+              <!-- <el-button 
                 icon="el-icon-plus">
                 新 增
-              </el-button>
+              </el-button> -->
               <el-button 
                 icon="el-icon-delete"
                 type="danger"
@@ -479,7 +479,8 @@ export default {
         periodId: '',
         pigstyId: '',
         unitId: ''
-      }
+      },
+      eartags: [] // 被删除的猪只耳标
     }
   },
   activated() {
@@ -896,10 +897,12 @@ export default {
       val.forEach((item) => {
         this.selectionDataList.push(item.id);
       });
+      this.eartags = val.map(pig => pig.eartag)
     },
     // 删除n个猪
     deleteHandle(id) {
-      this.$confirm(`确定删除年猪?`, "提示", {
+      this.eartags = id? [this.dataList.filter(pig => pig.id === id)[0].eartag]: this.eartags
+      this.$confirm(`确定删除耳标号${this.eartags.join()}的猪只?`, "提示", {
         showCancelButton: true,
         showConfirmButton: true,
         cancelButtonClass: 'cancelButton',
@@ -931,14 +934,15 @@ export default {
               });
               this.getDataList()
               // pageIndex修正
-              this.totalPage -= this.selectionDataList.length;
-              let pages = Math.ceil(this.totalPage / this.pageSize);
-              this.pageIndex = this.pageIndex > pages ? pages : this.pageIndex;
-              this.pageIndex = this.pageIndex < 1 ? pages : this.pageIndex;
+              // this.totalPage -= this.selectionDataList.length;
+              // let pages = Math.ceil(this.totalPage / this.pageSize);
+              // this.pageIndex = this.pageIndex > pages ? pages : this.pageIndex;
+              // this.pageIndex = this.pageIndex < 1 ? pages : this.pageIndex;
             } else {
               this.$message.error("删除年猪失败");
             }
             this.selectionDataList = [];
+            this.eartags = []
           });
         })
         .catch(() => {});
@@ -1035,9 +1039,9 @@ export default {
         }).then((result) => {
           if (result.data.code === 0) {
             // 新增pageIndex的修正
-            this.totalPage++;
-            let pages = Math.ceil(this.totalPage / this.pageSize);
-            this.pageIndex = this.pageIndex < pages ? pages : this.pageIndex;
+            // this.totalPage++;
+            // let pages = Math.ceil(this.totalPage / this.pageSize);
+            // this.pageIndex = this.pageIndex < pages ? pages : this.pageIndex;
             // this.resetForm();
             // this.visible = false;
             this.$message({

+ 0 - 149
src/views/modules/pigbasic/pbbasicLeft.vue

@@ -1,149 +0,0 @@
-<template>
-  <div class="pbbasic-left">
-    <el-tree
-      :data="data"
-      :props="defaultProps"
-      @node-click="handleNodeClick">
-    </el-tree>
-  </div>
-</template>
-<script>
-export default {
-  data() {
-    return {
-      data: [
-        {
-          label: "一级 1",
-          children: [
-            {
-              label: "二级 1-1",
-              children: [
-                {
-                  label: "三级 1-1-1",
-                },
-              ],
-            },
-          ],
-        },
-        {
-          label: "一级 2",
-          children: [
-            {
-              label: "二级 2-1",
-              children: [
-                {
-                  label: "三级 2-1-1",
-                },
-              ],
-            },
-            {
-              label: "二级 2-2",
-              children: [
-                {
-                  label: "三级 2-2-1",
-                },
-              ],
-            },
-          ],
-        },
-        {
-          label: "一级 3",
-          children: [
-            {
-              label: "二级 3-1",
-              children: [
-                {
-                  label: "三级 3-1-1",
-                },
-              ],
-            },
-            {
-              label: "二级 3-2",
-              children: [
-                {
-                  label: "三级 3-2-1",
-                },
-              ],
-            },
-          ],
-        },
-      ],
-      defaultProps: {
-        children: "children",
-        label: "label",
-      },
-    };
-  },
-  mounted() {
-    this.getDataList()
-  },
-  methods: {
-    handleNodeClick(data) {
-      console.log(data)
-      this.$emit('getPigs', data)
-    },
-    // 获取初始数据
-    getDataList () {
-      // 获取所有牧场
-      this.$http({
-        url: this.$http.adornUrl("/management/farm/findAll"),
-        method: "post"
-      }).then(async ({ data }) => {
-        // 获取所有猪舍
-        let pighouseResult = await this.$http({
-          url: this.$http.adornUrl("/management/pigsty/findAll"),
-          method: "get",
-          params: this.$http.adornParams({})
-        })
-        let pighouseList = []
-        pighouseResult.data.all && (pighouseList = pighouseResult.data.all)
-        // 获取所有单元
-        let unitResult = await this.$http({
-          url: this.$http.adornUrl("/management/unit/findAll"),
-          method: "post",
-        })
-        let unitList = []
-        unitResult.data.all && (unitList = unitResult.data.all)
-        // 组合牧场、猪舍、单元
-        this.data = []
-        data.all.forEach(pasture => {
-          let item = {
-            id: pasture.id,
-            label: pasture.name,
-            children: [],
-            order: 0
-          }
-          pighouseList.forEach(pighouse => {
-            let pitem = {
-              id: pighouse.id,
-              label: pighouse.number,
-              children: [],
-              order: 1
-            }
-            unitList.forEach(unit => {
-              let uitem = {
-                id: unit.id,
-                label: unit.number,
-                order: 2
-              }
-              if (unit.pigstyId === pighouse.id) {
-                pitem.children.push(uitem)
-              }
-            })
-            if (pighouse.farmId === pasture.id) {
-              item.children.push(pitem)
-            }
-          })
-          this.data.push(item)
-        })
-        console.log(this.data);
-      })
-    }
-  },
-};
-</script>
-<style scoped>
-/deep/.el-tree-node__expand-icon {
-  color: #000 !important;
-} 
-</style>

+ 14 - 14
src/views/modules/pigbasic/pbentry-add-or-update.vue

@@ -216,11 +216,11 @@
         // periodSelectedList: [], // 栏期SelectedList
         healthStatus: [
           {
-            value: 1,
+            value: true,
             label: '健康'
           },
           {
-            value: 0,
+            value: false,
             label: '不健康'
           }
         ],
@@ -259,24 +259,24 @@
         })
         if (pigs.length) {
           this.$http({
-            url: this.$http.adornUrl(`/management/yearpigbase/info/${pigs[0].id}`),
+            url: this.$http.adornUrl(`/management/lairagerecord/info/${pigs[0].id}`),
             method: "get",
             params: this.$http.adornParams({})
           }).then(({data}) => {
             // this.dataForm.id = pigs.map(item => item.id)
             // this.dataForm.eartag = pigs.eartag.join()
-            this.dataForm.pigstyId = data.yearPigBase.pigstyId
-            this.dataForm.unitId = data.yearPigBase.unitId
+            this.dataForm.pigstyId = data.lairageRecord.pigstyId
+            this.dataForm.unitId = data.lairageRecord.unitId
             // this.dataForm.periodId = data.yearPigBase.periodId
-            this.dataForm.sex = data.yearPigBase.sex
-            this.dataForm.birthday = data.yearPigBase.birthday
-            this.dataForm.healthStatus = data.yearPigBase.healthStatus
-            this.dataForm.weight = data.yearPigBase.weight
+            this.dataForm.sex = data.lairageRecord.sex
+            this.dataForm.birthday = data.lairageRecord.birthday
+            this.dataForm.healthStatus = data.lairageRecord.healthStatus
+            this.dataForm.weight = data.lairageRecord.weight
             // this.dataForm.originPlace = data.yearPigBase.originPlace
-            this.dataForm.breed = data.yearPigBase.breed
-            this.dataForm.outFenceStatus = data.yearPigBase.outFenceStatus
-            this.dataForm.motherEartag = data.yearPigBase.motherEartag
-            this.dataForm.fatherEartag = data.yearPigBase.fatherEartag
+            this.dataForm.breed = data.lairageRecord.breed
+            this.dataForm.outFenceStatus = data.lairageRecord.outFenceStatus
+            this.dataForm.motherEartag = data.lairageRecord.motherEartag
+            this.dataForm.fatherEartag = data.lairageRecord.fatherEartag
           })
         }
         this.$http({
@@ -357,7 +357,7 @@
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
             this.$http({
-              url: this.$http.adornUrl(`${!this.dataForm.id ?'/management/yearpigbase/batchLairage': '/management/yearpigbase/update'}`),
+              url: this.$http.adornUrl(`${!this.dataForm.id ?'/management/lairagerecord/batchLairage': '/management/lairagerecord/update'}`),
               method: 'post',
               data: this.$http.adornData({
                 'id': this.dataForm.id || undefined,

+ 13 - 10
src/views/modules/pigbasic/pbentry.vue

@@ -231,15 +231,15 @@
                 <el-button
                   type="text"
                   size="medium"
+                  @click="addOrUpdateHandle(scope.row)"
                   style="color: rgb(24,144,255)">
-                  查看
+                  修改
                 </el-button>
-                <el-button
+                <el-button 
                   type="text"
                   size="medium"
-                  @click="addOrUpdateHandle(scope.row)"
-                  style="color: rgb(24,144,255)">
-                  修改
+                  @click="deleteHandle(scope.row)">
+                  删除
                 </el-button>
               </template>
             </el-table-column>
@@ -355,7 +355,7 @@
           this.pageIndex = Math.ceil(total / this.pageSize)
         }
         this.$http({
-          url: this.$http.adornUrl('/management/yearpigbase/list'),
+          url: this.$http.adornUrl('/management/lairagerecord/list'),
           method: 'get',
           params: this.$http.adornParams({
             'page': this.pageIndex,
@@ -511,18 +511,21 @@
         })
       },
       // 删除
-      deleteHandle (id) {
-        var ids = id ? [id] : this.dataListSelections.map(item => {
+      deleteHandle (pig) {
+        var ids = pig ? [pig.id] : this.dataListSelections.map(item => {
+          return item.id
+        })
+        let eartags = pig ? [pig.eartag] : this.dataListSelections.map(item => {
           return item.eartag
         })
         let delLength = this.dataListSelections.length
-        this.$confirm(`确定对[耳标=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
+        this.$confirm(`确定${pig ? '删除' : '批量删除'}耳标号${eartags.join(',')}的猪只?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
           this.$http({
-            url: this.$http.adornUrl('/management/yearpigbase/delete'),
+            url: this.$http.adornUrl('management/lairagerecord/delete'),
             method: 'post',
             data: this.$http.adornData(ids, false)
           }).then(({data}) => {

+ 1 - 1
src/views/modules/pigbasic/pbexit.vue

@@ -512,7 +512,7 @@
         var eartags = pig ? [pig.eartag] : this.dataListSelections.map(item => {
           return item.eartag
         })
-        this.$confirm(`确定对[耳标=${eartags.join(',')}]进行[${pig ? '出栏' : '批量出栏'}]操作?`, '提示', {
+        this.$confirm(`确定${pig ? '出栏' : '批量出栏'}耳标号${eartags.join(',')}的猪只?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'

+ 3 - 3
src/views/modules/pigbasic/pbzhong.vue

@@ -28,7 +28,7 @@
                 </el-option>
               </el-select>
             </el-form-item>
-            <el-form-item style="width: 140px">
+            <!-- <el-form-item style="width: 140px">
               <el-select placeholder="源产地" v-model="form.origin">
                 <el-option
                   v-for="item in originList"
@@ -37,7 +37,7 @@
                   :value="item.value">
                 </el-option>
               </el-select>
-            </el-form-item>
+            </el-form-item> -->
             <!-- <el-form-item style="width: 140px">
               <el-select placeholder="健康状态" v-model="form.healthStatus">
                 <el-option
@@ -513,7 +513,7 @@
           return item.eartagNo
         })
         console.log(eartags);
-        this.$confirm(`确定对[耳标=${eartags.join(',')}]进行[${pig ? '删除' : '批量删除'}]操作?`, '提示', {
+        this.$confirm(`确定${pig ? '删除' : '批量删除'}耳标${eartags.join(',')}的猪只?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'

+ 1 - 1
src/views/modules/sys/department-add-or-update.vue

@@ -47,7 +47,7 @@
           ],
           departmentCode: [
             { required: true, message: '部门代码不能为空', trigger: 'blur' },
-            { type: 'string' , message: '以BM开头,后接三位数字', pattern: /^BM[0-9]{3}$/ }
+            // { type: 'string' , message: '以BM开头,后接三位数字', pattern: /^BM[0-9]{3}$/ }
           ],
           leader: [
             { required: true, message: '部门负责人不能为空', trigger: 'blur' },

+ 10 - 7
src/views/modules/sys/department.vue

@@ -81,7 +81,7 @@
               label="操作">
               <template slot-scope="scope">
                 <el-button v-if="isAuth('sys:role:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
-                <el-button v-if="isAuth('sys:role:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
+                <el-button v-if="isAuth('sys:role:delete')" type="text" size="small" @click="deleteHandle(scope.row)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -182,11 +182,14 @@
         })
       },
       // 删除
-      deleteHandle (id) {
-        var ids = id ? [id] : this.dataListSelections.map(item => {
+      deleteHandle (dep) {
+        var ids = dep? [dep.id] : this.dataListSelections.map(item => {
           return item.id
         })
-        this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
+        let names = dep? [dep.departmentName] : this.dataListSelections.map(item => {
+          return item.departmentName
+        })
+        this.$confirm(`确定${dep ?'删除' : '批量删除'}${names.join()}部门?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -197,13 +200,13 @@
             data: this.$http.adornData(ids, false)
           }).then(({data}) => {
             if (data && data.code === 0) {
+              this.getDataList()
               this.$message({
                 message: '操作成功',
                 type: 'success',
                 duration: 1500,
-                onClose: () => {
-                  this.getDataList()
-                }
+                // onClose: () => {
+                // }
               })
             } else {
               this.$message.error(data.msg)

+ 1 - 1
src/views/modules/sys/job-add-or-update.vue

@@ -43,7 +43,7 @@
           ],
           jobCode: [
             { required: true, message: '岗位代码不能为空', trigger: 'blur' },
-            { type: 'string' , message: '以GW开头,后接三位数字', pattern: /^GW[0-9]{3}$/ }
+            // { type: 'string' , message: '以GW开头,后接三位数字', pattern: /^GW[0-9]{3}$/ }
           ]
         }
       }

+ 11 - 7
src/views/modules/sys/job.vue

@@ -75,7 +75,7 @@
               label="操作">
               <template slot-scope="scope">
                 <el-button v-if="isAuth('sys:job:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
-                <el-button v-if="isAuth('sys:job:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
+                <el-button v-if="isAuth('sys:job:delete')" type="text" size="small" @click="deleteHandle(scope.row)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -175,11 +175,14 @@
         })
       },
       // 删除
-      deleteHandle (id) {
-        var ids = id ? [id] : this.dataListSelections.map(item => {
+      deleteHandle (job) {
+        let ids = job ? [job.id] : this.dataListSelections.map(item => {
           return item.id
         })
-        this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
+        let names = job ? [job.jobName] : this.dataListSelections.map(item => {
+          return item.jobName
+        })
+        this.$confirm(`确定${job ?'删除' : '批量删除'}${names.join()}岗位?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -190,13 +193,14 @@
             data: this.$http.adornData(ids, false)
           }).then(({data}) => {
             if (data && data.code === 0) {
+              this.getDataList()
               this.$message({
                 message: '操作成功',
                 type: 'success',
                 duration: 1500,
-                onClose: () => {
-                  this.getDataList()
-                }
+                // onClose: () => {
+                //   this.getDataList()
+                // }
               })
             } else {
               this.$message.error(data.msg)

+ 13 - 13
src/views/modules/sys/pasture.vue

@@ -75,7 +75,7 @@
           align="left"
           label="地址">
           <template slot-scope="scope">
-            {{ scope.row.frontLocation.split(',').join('') }}
+            {{ scope.row.frontLocation? scope.row.frontLocation.split(',').join(''): '' }}
           </template>
         </el-table-column>
         <el-table-column
@@ -99,7 +99,7 @@
           label="操作">
           <template slot-scope="scope">
             <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button>
-            <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
+            <el-button type="text" size="small" @click="deleteHandle(scope.row)">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -319,29 +319,29 @@ export default {
     },
     // 选择n个牧场
     selectionChangeHandle (val) {
-      this.selectionDataList = []
-      val.forEach(item => {
-        this.selectionDataList.push(item.id)
-      });
+      this.selectionDataList = val
+      // val.forEach(item => {
+      //   this.selectionDataList.push(item.id)
+      // });
     },
     // 删除n个牧场
-    deleteHandle (id) {
-      this.$confirm(`确定删除牧场?`, '提示', {
+    deleteHandle (pasture) {
+      let ids = pasture? [pasture.id]: this.selectionDataList.map(item => item.id)
+      let names = pasture? [pasture.name]: this.selectionDataList.map(item => item.name)
+      console.log(names);
+      this.$confirm(`确定${pasture ? '删除' : '批量删除'}${names.join()}牧场?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
         // 删除操作
-        if (id) {
-          this.selectionDataList.push(id)
-        }
-        if (this.selectionDataList.length <= 0) {
+        if (this.selectionDataList.length < 0) {
           return
         }
         this.$http({
           url: this.$http.adornUrl('/management/farm/delete'),
           method: 'post',
-          data: this.$http.adornData(this.selectionDataList, false)
+          data: this.$http.adornData(ids, false)
         }).then(result => {
           if (result.data.code === 0) {
             this.$message({

+ 1 - 1
src/views/modules/sys/user-add-or-update.vue

@@ -169,7 +169,7 @@
           address: '',
           remarks: '',
           roleIdList: [],
-          status: ''
+          status: 1
         },
         dataRule: {
           username: [

+ 1 - 1
src/views/modules/sys/user.vue

@@ -274,7 +274,7 @@
             'jobCode': this.form.jobCode,
             'sex': this.form.gender,
             'farmId': this.farmId
-          })
+          }, false)
         }).then(async({data}) => {
           console.log(data);
           // 部门select