xsh 3 年之前
父節點
當前提交
3936d102ed

二進制
src/assets/images/welcome.png


+ 1 - 1
src/components/HeaderElement.vue

@@ -37,7 +37,7 @@
             </div>
           </div>
           <el-divider direction="vertical"></el-divider>
-          <div class="user" style="width: 100px;">
+          <div class="user" style="width: 100px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden">
             <div>
               <i class="el-icon-user-solid" style="font-size: 28px"></i>
             </div>

+ 6 - 3
src/components/SideMenu.vue

@@ -61,7 +61,7 @@
             <span slot="title">{{ item.title }}</span>
             <template  v-for="list in item.children">
               <el-menu-item
-                v-if="item.ifShow"
+                v-if="list.ifShow"
                 :key="list.id"
                 :index="list.url"
               >{{ list.title }}</el-menu-item
@@ -78,7 +78,7 @@
 </template>
 
 <script>
-import { mapState } from "vuex";
+import { mapState, mapActions } from "vuex";
 import { getUserMenu } from "../utils/api";
 export default {
   name: "SideMenu",
@@ -149,6 +149,7 @@ export default {
     },
   },
   methods: {
+    ...mapActions(['setIsFarmListAsync']),
     init() {
       let params = {
         userId: localStorage.getItem("gold_UserId"),
@@ -164,7 +165,9 @@ export default {
             this.isShow = false;
           }
         }
-      });
+      }).finally(() => {
+        this.setIsFarmListAsync(true)
+      })
     },
     jump(item) {
       this.activeName = item.title;

+ 156 - 0
src/router/ChildrenRouters.js

@@ -29,6 +29,114 @@ const childrenRouters = [
     },
   },
 
+  /**
+   *
+   * 权限管理(政府)
+   *
+   * **/
+
+  {
+    path: '/sellAuth',
+    name: 'SellAuth',
+    component: () => import('../views/AuthMana/SellAuth.vue'),
+    meta: {
+      title: '售猪权限管理',
+      permission: 'sellAuth',
+      parentName: '权限管理'
+    }
+  },
+
+
+  /**
+   *
+   *
+   * 卖猪管理
+   *
+   * **/
+
+  {
+    path: '/sellEarTag',
+    name: 'SellEarTag',
+    component: () => import('../views/SellPig/SellEarTag.vue'),
+    meta: {
+      title: '售猪房耳标数据管理',
+      permission: 'sellEarTag',
+      parentName: '卖猪管理',
+      keepAlive: true
+    }
+  },
+  {
+    path: '/sellApply',
+    name: 'SellApply',
+    component: () => import('../views/SellPig/SellApply.vue'),
+    meta: {
+      title: '售猪申请管理',
+      permission: 'sellApply',
+      parentName: '卖猪管理'
+    }
+  },
+  {
+    path: '/sellRecord',
+    name: 'SellRecord',
+    component: () => import('../views/SellPig/SellRecord.vue'),
+    meta: {
+      title: '售猪记录管理',
+      permission: 'sellRecord',
+      parentName: '卖猪管理',
+      keepAlive:true
+    }
+  },
+
+  /**
+   *
+   * 汇总数据
+   *
+   * **/
+  {
+    path: '/collectSellPig',
+    name: 'CollectSellPig',
+    component: () => import('../views/CollectData/CollectSellPig.vue'),
+    meta: {
+      title: '售猪记录',
+      permission: 'collectSellPig',
+      parentName: '汇总数据',
+      keepAlive: true
+    }
+  },
+  {
+    path: '/collectInspec',
+    name: 'CollectInspec',
+    component: () => import('../views/CollectData/CollectInspec.vue'),
+    meta: {
+      title: '检疫记录',
+      permission: 'collectInspec',
+      parentName: '汇总数据',
+      keepAlive: true
+    }
+  },
+  {
+    path: '/collectButch',
+    name: 'CollectButch',
+    component: () => import('../views/CollectData/CollectButch.vue'),
+    meta: {
+      title: '屠宰检疫记录',
+      permission: 'collectButch',
+      parentName: '汇总数据',
+      keepAlive: true
+    }
+  },
+  {
+    path: '/collectEarTagDetail',
+    name: 'CollectEarTagDetail',
+    component: () => import('../views/eartag-admin/eartag-detail/EartagDetail.vue'),
+    meta: {
+      title: '耳标数据详情',
+      permission: 'collectEarTagDetail',
+      parentName: '汇总数据',
+      keepAlive: true
+    }
+  },
+
   /*
   *
   * 耳标管理
@@ -55,6 +163,17 @@ const childrenRouters = [
     }
   },
   {
+    path: '/farmData',
+    name: 'FarmData',
+    component: () => import('@/views/eartag-admin/FarmData/FarmData.vue'),
+    meta: {
+      title: '牧场数据',
+      permission: 'farmData',
+      parentName: '耳标管理',
+      keepAlive:true
+    }
+  },
+  {
     path: '/analysisRes',
     name: 'AnalysisRes',
     component: () => import('@/views/eartag-admin/analysis-res/AnalysisRes.vue'),
@@ -87,10 +206,47 @@ const childrenRouters = [
     meta: {
       title: '检疫管理',
       permission: 'vaccineAdmin',
+      parentName: '检疫管理',
+      keepAlive:true
+    }
+  },
+  {
+    path: '/vaccineEarTagDetail',
+    name: 'VaccineEarTagDetail',
+    component: () => import('@/views/eartag-admin/eartag-detail/EartagDetail.vue'),
+    meta: {
+      title: '耳标数据详情',
+      permission: 'vaccineEarTagDetail',
       parentName: '检疫管理'
     }
   },
 
+  /**
+   * 屠宰管理
+   *
+   * **/
+  {
+    path: '/butchAdmin',
+    name: 'ButchAdmin',
+    component: () => import('@/views/ButchAdmin/ButchAdmin.vue'),
+    meta: {
+      title: '屠宰管理',
+      permission: 'butchAdmin',
+      parentName: '屠宰管理',
+      keepAlive:true
+    }
+  },
+  {
+    path: '/butchEarTagDetail',
+    name: 'ButchEarTagDetail',
+    component: () => import('@/views/eartag-admin/eartag-detail/EartagDetail.vue'),
+    meta: {
+      title: '耳标数据详情',
+      permission: 'butchEarTagDetail',
+      parentName: '屠宰管理'
+    }
+  },
+
   /*
   *
   * 基础资料

+ 53 - 2
src/store/index.js

@@ -13,6 +13,7 @@ import {
   // getFarm
 } from '../utils/api'
 import { getEarFarmList } from "../utils/apis/eartag-data/eartagData";
+import { BaseALL } from "../utils/apis/sell-pig/sellPig";
 
 Vue.use(Vuex)
 
@@ -63,10 +64,28 @@ export default new Vuex.Store({
       {
         value: 9,
         label: '病死猪无害化'
+      },
+      {
+        value: 10,
+        label: '出栏'
+      },
+      {
+        value: 11,
+        label: '检疫部门检疫'
+      },
+      {
+        value: 12,
+        label: '屠宰部门检疫'
       }
     ],
     // 判断用户类型
     userType: 0,
+    // 指定页面缓存
+    keepAlive: [],
+    // 全部档案信息
+    recordList: [],
+    isMenu: false,
+    isFarmList: false
   },
   mutations: {
     setColor(state, data) {
@@ -89,7 +108,19 @@ export default new Vuex.Store({
     },
     SET_USERTYPE(state, data) {
       state.userType = data
-    }
+    },
+    SET_KEEPALIVE(state, keepAlive) {
+      state.keepAlive = keepAlive
+    },
+    SET_RECORDLIST(state, data) {
+      state.recordList = data
+    },
+    SET_ISMENU(state, data) {
+      state.isMenu = data
+    },
+    SET_ISFARMlIST(state, data) {
+      state.isFarmList = data
+    },
   },
   actions: {
     setModeAsync(context, data) {
@@ -107,6 +138,9 @@ export default new Vuex.Store({
     setUserTypeAsync(context, data) {
       context.commit('SET_USERTYPE', data)
     },
+    setIsFarmListAsync(context, data) {
+      context.commit('SET_ISFARMlIST', data)
+    },
     // 获取用户按钮权限
     GetButtons({ commit }) {
       return new Promise((resolve, reject) => {
@@ -136,11 +170,28 @@ export default new Vuex.Store({
           reject(error)
         })
       })
+    },
+    GetRecordList({ commit }) {
+      return new Promise((resolve, reject) => {
+        BaseALL().then(res => {
+          if(res && res.code === 10000) {
+            commit('SET_RECORDLIST', res.data)
+            resolve(res.data)
+          } else {
+            res && reject(new Error(res.message))
+          }
+        }).catch(error => {
+          reject(error)
+        }).finally(() => {
+          commit('SET_ISMENU', true)
+        })
+      })
     }
   },
   modules: {
   },
   getters: {
-    buttons: state => state.buttons
+    buttons: state => state.buttons,
+    keepAlive: state => state.keepAlive
   }
 })

+ 36 - 0
src/utils/apis/eartag-data/eartagData.js

@@ -16,3 +16,39 @@ export function getEarTagList (data) {
     data: data
   })
 }
+
+/** 根据牧场id拿到栋舍 **/
+export function listFarmPigpen(data) {
+  return axios({
+    url: 'anquisition/management/basepigpen/listFarmPigPen',
+    method: 'post',
+    data: data
+  })
+}
+
+/**  根据栋舍id拿到单元 **/
+export function listFarmUnit(data) {
+  return axios({
+    url: 'anquisition/management/basepigpen/listFarmUnit',
+    method: 'post',
+    data: data
+  })
+}
+
+/** 根据单元id拿到耳标 **/
+export function listFarmUnitEartagData(data) {
+  return axios({
+    url: 'anquisition/management/basepigpen/listFarmUnitEartagData',
+    method: 'post',
+    data: data
+  })
+}
+
+// 拿到所有东西
+export function getPigCount(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/getPigCount',
+    method: 'post',
+    data: data
+  })
+}

+ 101 - 0
src/utils/apis/sell-pig/sellPig.js

@@ -0,0 +1,101 @@
+import axios from '../../http';
+
+
+/** 拿到所有的基础档案资料 **/
+export function BaseALL() {
+  return axios({
+    url: '/eartag/baseFarmInfo/listAll',
+    method: 'get'
+  })
+}
+
+// 拿到卖猪房的耳标数据
+export function sellEarList(data) {
+  return axios({
+    url: '/anquisition/manager/eartagdata/listAllSell',
+    method: 'get',
+    params: data
+  })
+}
+
+// 判断该牧场是否可以提交售猪申请
+export function isSell(data) {
+  return axios({
+    url: '/eartag/baseFarmInfo/getSellStauts',
+    method: 'get',
+    params: data
+  })
+}
+
+/** 排除 **/
+export function addRemovePig(data) {
+  return axios({
+    url: '/eartag/bizSellPigRemove/addRemovePig',
+    method: 'post',
+    data: data
+  })
+}
+
+/** 移除排除 **/
+export function removeRemovePig(data) {
+  return axios({
+    url: '/eartag/bizSellPigRemove/removeRemovePig',
+    method: 'get',
+    params: data
+  })
+}
+
+/** 卖猪申请 **/
+export function addSellPig(data) {
+  return axios({
+    url: 'eartag/bizSellPigApplyEartag/addSellPig',
+    method: 'post',
+    data: data
+  })
+}
+
+/**  卖猪记录数量统计 **/
+export function sellCollect(data) {
+  return axios({
+    url: '/eartag/bizSellPigApply/sellPigRecordCollect',
+    method: 'get',
+    params: data
+  })
+}
+
+/** 卖猪记录 **/
+export function sellPigRecord(data) {
+  return axios({
+    url: '/eartag/bizSellPigApply/sellPigRecord',
+    method: 'post',
+    data: data
+  })
+}
+
+
+/** 步骤条 **/
+export function sellPigRecordManage(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/sellPigRecordManage',
+    method: 'get',
+    params: data
+  })
+}
+
+/** 暂存到提交 **/
+export function sellUpdate(data) {
+  return axios({
+    url: '/eartag/bizSellPigApply/update',
+    method: 'post',
+    data: data
+  })
+}
+
+/** 根据批次号拿到耳标 **/
+export function listByBatch(data) {
+  return axios({
+    url: '/eartag/bizSellPigApplyEartag/listByBatch',
+    method: 'get',
+    params: data
+  })
+}

+ 87 - 0
src/utils/apis/vaccineAdmin/vaccineAdmin.js

@@ -0,0 +1,87 @@
+import axios from '../../http'
+
+
+// 检疫拿到审批数量
+export function getInspecCollect(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/getInspecCollect',
+    method: 'get',
+    params: data
+  })
+}
+
+// 检疫拿到审批列表
+export function getInspecRecord(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/getInspecRecord',
+    method: 'post',
+    data: data
+  })
+}
+
+// 检疫审批
+export function inspecCheck(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/inspecCheck',
+    method: 'post',
+    data: data
+  })
+}
+
+// 检疫审批上传
+export function addInspection(data) {
+  return axios({
+    url: 'eartag/bizInspectionPhoto/addInspection',
+    method: 'post',
+    data: data
+  })
+}
+
+// 屠宰拿到审批数量
+export function getButchCollect(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/getBatchCollect',
+    method: 'get',
+    params: data
+  })
+}
+
+// 屠宰拿到审批列表
+export function getButchRecord(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/getBatchRecord',
+    method: 'post',
+    data: data
+  })
+}
+
+// 屠宰审批
+export function ButchCheck(data) {
+  return axios({
+    url: 'eartag/bizSellPigApply/batchCheck',
+    method: 'post',
+    data: data
+  })
+}
+
+// 屠宰审批上传
+export function addButch(data) {
+  return axios({
+    url: 'eartag/bizInspectionPhoto/addBatch',
+    method: 'post',
+    data: data
+  })
+}
+
+// 拿到图片
+export function getImg(data) {
+  return axios({
+    url: 'eartag/bizInspectionPhoto/listPic',
+    method: 'post',
+    data: data
+  })
+}
+
+
+
+

+ 12 - 2
src/utils/index.js

@@ -25,8 +25,6 @@ export function timeDate(timestamp) {
 export const Debounce = (fn, t) => {
   let delay = t || 500;
   let timer;
-  console.log(fn)
-  console.log(typeof fn)
   return function () {
     let args = arguments;
     if(timer){
@@ -76,3 +74,15 @@ export function getFilter(list, target) {
   })
   return targetList.concat(childrenList)
 }
+
+
+/** 封装成promise **/
+export function fetch(api) {
+  return new Promise((resolve, reject) => {
+    api.then(res => {
+      resolve(res)
+    }).catch(err => {
+      reject(err)
+    })
+  })
+}

+ 151 - 0
src/views/AuthMana/SellAuth.vue

@@ -0,0 +1,151 @@
+<template>
+  <div>
+    <search-cpn
+      v-bind="searchConfig"
+      @handleSearch="handleSearchEvent"
+      @clearEvent="handleClearEvent"
+    >
+      <!-- 位置 -->
+      <template #location="scope">
+        <el-cascader
+          :options="options"
+          v-model="searchForm2.location"
+          :props="{ checkStrictly: true }"
+          :placeholder="scope.item.placeholder"
+          style="width: 100%"
+          clearable
+        >
+        </el-cascader>
+      </template>
+    </search-cpn>
+    <br/>
+    <new-table :title="'牧场列表'" :list-data="tableData" :table-items="tableItems" :shows="showsItems">
+      <template #location="scope">
+        <span v-location="{ data: scope.row.location }"></span>
+      </template>
+      <template #sellStatus="scope">
+        <el-switch v-model="scope.row.sellStatus" @change="setSellStatus(scope.row, $event)"></el-switch>
+      </template>
+    </new-table>
+  </div>
+</template>
+
+<script>
+import SearchCpn from "../../components/search-cpn/SearchCpn";
+import NewTable from "../../components/newTable/NewTable";
+import { regionData } from "element-china-area-data";
+import { baseFarmList, baseFarmEdit } from "../../utils/apis/basic-data/archivesAdmin";
+
+export default {
+  name: "SellAuth",
+  components: {
+    SearchCpn,
+    NewTable
+  },
+  data() {
+    return {
+      searchConfig: {},
+      searchForm1: {
+        farmName: undefined,
+        type: 2,
+      },
+      searchForm2: {
+        location: [],
+      },
+      formItemProp: [
+        {
+          label: '名称:',
+          type: 'input',
+          field: 'farmName',
+          placeholder: '请输入名称',
+        },
+        {
+          label: '位置:',
+          type: 'custom',
+          field: 'location',
+          slotName: 'location',
+          placeholder: '请选择位置'
+        },
+      ],
+      options: regionData,
+      searchForm: {
+        farmName: undefined,
+        type: 2,
+        location: undefined,
+      },
+      pageNo: 1,
+      pageSize: 20,
+      tableData: [],
+      tableItems: [
+        {
+          prop: 'farmName',
+          label: "牧场名称",
+          slotName: 'farmName'
+        },
+        {
+          prop: 'location',
+          label: "牧场位置",
+          slotName: 'location'
+        },
+        {
+          prop: 'sellStatus',
+          label: '是否禁用售猪',
+          slotName: 'sellStatus'
+        }
+      ],
+      showsItems: {
+        // showSelect: true
+      },
+    }
+  },
+  created() {
+    this.searchConfig =  { formItemProp: this.formItemProp, searchForm: this.searchForm1 };
+  },
+  methods: {
+    handleSearchEvent(value) {
+      this.searchForm = {
+        ...value,
+        location: this.searchForm2.location.join(","),
+      }
+      this.initBaseFarm()
+    },
+    handleClearEvent() {
+      this.searchForm2.location = [];
+    },
+    initBaseFarm() {
+      let params = {
+        current: this.pageNo,
+        size: this.pageSize,
+        ...this.searchForm
+      }
+      baseFarmList(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData = res.data.records
+        }
+      })
+    },
+    setSellStatus(data, e) {
+      console.log(data, e)
+      let params = {
+        sellStatus: e,
+        id: data.id
+      }
+      baseFarmEdit(params).then(res => {
+        console.log(res)
+        if(res.code === 10000) {
+          this.$message.success('修改成功!')
+        } else {
+          this.$message.error('修改失败')
+        }
+      })
+    }
+  },
+  mounted() {
+    this.initBaseFarm()
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 707 - 0
src/views/ButchAdmin/ButchAdmin.vue

@@ -0,0 +1,707 @@
+<template>
+  <div style="padding: 20px">
+    <el-row :gutter="20">
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center" >
+            <div style="width: 150px;">
+              总审批数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{inspecNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px;">
+              未审批数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{accomplishNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px; ">
+              审批合格数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{qualifiedNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px;">
+              审批不合格数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{unQualifiedNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+    </el-row>
+    <br/>
+    <el-tabs type="border-card" v-model="activeName">
+      <el-tab-pane label="全部" name="0">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #inspecOrgId="scope">
+            <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus === 1">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.recordStatus === 3">
+                <el-tag type="success">屠宰合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 5">
+                <el-tag type="danger">屠宰不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+      <el-tab-pane label="未审批" name="1">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #inspecOrgId="scope">
+            <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus === 1">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.inspecFlowStatus === 2">
+                <el-tag type="success">屠宰合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 5">
+                <el-tag type="danger">屠宰不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+      <el-tab-pane label="审批合格" name="2">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #inspecOrgId="scope">
+            <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus === 1">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.inspecFlowStatus === 2">
+                <el-tag type="success">屠宰合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 5">
+                <el-tag type="danger">屠宰不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+      <el-tab-pane label="审批不合格" name="3">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #inspecOrgId="scope">
+            <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus === 1">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.inspecFlowStatus === 2">
+                <el-tag type="success">屠宰合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 5">
+                <el-tag type="danger">屠宰不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+    </el-tabs>
+    <el-dialog title="审批批次" :visible.sync="dialogFormVisible" :close-on-click-modal="false" :modal="false">
+      <el-row :gutter="20">
+        <el-col :span="8">
+          <div class="box">检疫部门填报数量:{{realEartagNum}}</div>
+        </el-col>
+        <el-col :span="8">
+          <div class="box">检疫自动采集数量:{{autoEartagNum}}</div>
+        </el-col>
+        <el-col :span="8">
+          <div class="box">屠宰自动采集数量:{{exTotal}}</div>
+        </el-col>
+
+      </el-row>
+      <br>
+      <new-table :table-items="tableItems1" :list-data="tableData1">
+        <template #status="scope">
+          <template v-if="scope.row.status === 1">
+            <el-tag type="danger" style="font-size: 18px">不一致</el-tag>
+          </template>
+          <template v-else>
+            <el-tag type="success" style="font-size: 18px">一致</el-tag>
+          </template>
+        </template>
+        <template #handler="scope">
+          <el-button type="text" @click="jump(scope.row)">查看详情</el-button>
+        </template>
+      </new-table>
+      <el-dialog
+        width="30%"
+        title="审批单"
+        :visible.sync="innerVisible"
+        append-to-body>
+        <el-form :rules="rules" ref="ruleForm" :model="form" :label-width="formLabelWidth">
+          <el-form-item label="是否合格" prop="isUp">
+            <el-radio-group v-model="form.isUp">
+              <el-radio v-for="item in upList" :key="item.value" :label="item.value"  border>{{item.label}}</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item label="检疫数量" prop="number">
+            <el-input type="number" v-model="form.number"></el-input>
+          </el-form-item>
+          <el-form-item label="上传检疫凭证">
+            <el-upload
+              action="#"
+              list-type="picture-card"
+              :file-list="fileList"
+              :on-change="beforeAvatarUpload"
+              :auto-upload="false">
+              <i class="el-icon-plus"></i>
+              <div slot="file" slot-scope="{file}">
+                <img
+                  class="el-upload-list__item-thumbnail"
+                  :src="file.url" alt=""
+                >
+                <span class="el-upload-list__item-actions">
+                    <span
+                      class="el-upload-list__item-delete"
+                      @click="handleRemove(file)"
+                    >
+                      <i class="el-icon-delete"></i>
+                    </span>
+                  </span>
+              </div>
+            </el-upload>
+          </el-form-item>
+          <el-form-item label="备注">
+            <el-input
+              type="textarea"
+              :rows="2"
+              placeholder="请输入内容"
+              v-model="form.inspec_remark">
+            </el-input>
+          </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="innerVisible = false">取 消</el-button>
+          <el-button type="primary" @click="add">提 交 审 批</el-button>
+        </div>
+      </el-dialog>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormVisible = false">取 消</el-button>
+        <el-button type="primary" @click="open">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog title="批次详情" :visible.sync="textShow" :close-on-click-modal="false">
+      <el-form>
+        <el-form-item label="批次编号">{{selectItem.batchNo}}</el-form-item>
+        <el-form-item label="申请时间">{{selectItem.sellTime}}</el-form-item>
+        <el-form-item label="申请牧场名称">{{getFarmName(selectItem.farmId)}}</el-form-item>
+        <el-form-item label="检疫处理时间">{{selectItem.inspecTime}}</el-form-item>
+        <el-form-item label="检疫处理结果">
+            <el-tag type="success">检疫合格</el-tag>
+            <el-button style="margin-left: 5px" size="mini" type="primary" v-if="inspecImgList.length > 0"  @click="openImg(1)">查看图片</el-button>
+        </el-form-item>
+        <el-form-item label="屠宰处理时间">{{selectItem.butcherTime}}</el-form-item>
+        <el-form-item label="屠宰处理结果">
+          <template v-if="selectItem.recordStatus === 3">
+            <el-tag type="success">屠宰合格</el-tag>
+            <el-button v-if="butchImgList.length > 0" style="margin-left: 5px" size="mini" type="primary"  @click="openImg(2)">查看图片</el-button>
+          </template>
+          <template v-if="selectItem.recordStatus === 5">
+            <el-tag type="danger">屠宰不合格</el-tag>
+            <el-button v-if="butchImgList.length > 0" style="margin-left: 5px" size="mini" type="primary"  @click="openImg(2)">查看图片</el-button>
+          </template>
+        </el-form-item>
+      </el-form>
+      <el-dialog title="查看图片" :visible.sync="imgShow" append-to-body :close-on-click-modal="false">
+        <img v-for="item in imgList" :src="'http://122.112.212.35:8092' + item.photoPath" :key="item.id" alt="">
+      </el-dialog>
+    </el-dialog>
+    <el-dialog title="批次下耳标数据" :visible.sync="earShow" :close-on-click-modal="false" :modal="false" >
+      <new-table :table-items="tableItems2" :list-data="tableData1">
+        <template #handler="scope">
+          <el-button type="text" @click="jump(scope.row)">查看详情</el-button>
+        </template>
+      </new-table>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import NewTable from "../../components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
+import { CodeToText } from "element-china-area-data";
+import { mapState } from "vuex";
+import {
+  addButch,
+  getButchCollect,
+  getButchRecord,
+  ButchCheck,
+  getImg
+} from "../../utils/apis/vaccineAdmin/vaccineAdmin";
+import {getPigCount} from "../../utils/apis/eartag-data/eartagData";
+export default {
+  name: "ButchAdmin",
+  components: {
+    NewTable,
+    TableFooter
+  },
+  computed: {
+    ...mapState(['recordList'])
+  },
+  data() {
+    return {
+      activeName: '0',
+      tableItems: [
+        {
+          label: '批次编号',
+          prop: 'batchNo',
+          slotName: 'batchNo'
+        },
+        {
+          label: '申请时间',
+          prop: 'sellTime'
+        },
+        {
+          label: '申请牧场',
+          slotName: 'farmName',
+        },
+        {
+          label: '申请牧场位置',
+          slotName: 'farmLocation'
+        },
+        {
+          label: '检疫数量',
+          prop: 'realEartagNum'
+        },
+        {
+          label: '检疫部门',
+          slotName: 'inspecOrgId',
+        },
+        {
+          label: '检疫时间',
+          prop: 'inspecTime'
+        },
+        {
+          label: '运输车辆',
+          prop: 'plateNumber',
+        },
+        {
+          label: '处理状态',
+          slotName: 'status'
+        },
+        {
+          label: '处理时间',
+          prop: 'butcherTime'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData: [
+        {}
+      ],
+      dialogFormVisible: false,
+      formLabelWidth: '80px',
+      form: {
+        isUp: 1,
+        number: '',
+        inspec_remark: ''
+      },
+      rules: {
+        isUp: [
+          { required: true, message: '请选择是否合格', trigger: 'change' }
+        ],
+        number: [
+          { required: true, message: '请填写检疫数量', trigger: 'blur' }
+        ]
+      },
+      tableItems1: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '耳标状态',
+          slotName: 'status'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableItems2: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData1: [],
+      innerVisible: false,
+      upList: [
+        {
+          label: '不合格',
+          value: 0
+        },
+        {
+          label: '合格',
+          value: 1
+        },
+      ],
+      farmId: localStorage.getItem('gold_lastFarmId'),
+      accomplishNum: 0,
+      inspecNum: 0,
+      qualifiedNum: 0,
+      unQualifiedNum: 0,
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+      farmList: [],
+      exTotal: 0,
+      autoEartagNum: 0,
+      realEartagNum: 0,
+      abnormal: 0,
+      fileList: [],
+      batchNo: '',
+      textShow: false,
+      selectItem: {},
+      earShow: false,
+      inspecImgList: [],
+      butchImgList: [],
+      imgShow: false,
+      imgList: [],
+    }
+  },
+  watch: {
+    activeName() {
+      this.pageNum = 1;
+      this.initList();
+    }
+  },
+  methods: {
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.initList();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.initList();
+    },
+    init() {
+      let params = {
+        farmId: this.farmId
+      }
+      getButchCollect(params).then(res => {
+        if(res.code === 10000) {
+          this.accomplishNum = res.data.accomplishNum;
+          this.inspecNum = res.data.inspecNum;
+          this.qualifiedNum = res.data.qualifiedNum;
+          this.unQualifiedNum = res.data.unQualifiedNum;
+        }
+      })
+    },
+    initList() {
+      let params = {
+        farmId: this.farmId,
+        type: this.activeName,
+        current: this.pageNum,
+        size: this.pageSize
+      }
+      getButchRecord(params).then(res => {
+        if (res.code === 10000) {
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    look(row) {
+      this.textShow = true;
+      this.selectItem = row;
+      let params = {
+        types: '1,2',
+        batchNo: row.batchNo
+      }
+      getImg(params).then(res => {
+        if(res.code === 10000) {
+          this.inspecImgList = [];
+          this.butchImgList = [];
+          if(res.data.length > 0) {
+            res.data.forEach(item => {
+              if(item.photoType === 1) {
+                this.inspecImgList.push(item)
+              } else {
+                this.butchImgList.push(item)
+              }
+            })
+          }
+        }
+      })
+    },
+    onConfirm(row) {
+      this.dialogFormVisible = true
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      this.batchNo = row.batchNo
+      ButchCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          this.exTotal = res.data.inspecAutoNum;
+          this.autoEartagNum = res.data.autoEartagNum;
+          this.realEartagNum = res.data.realEartagNum;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    open() {
+      this.innerVisible = true;
+    },
+    // 拿到牧场名称
+    getFarmName(id) {
+      let str = '';
+      this.recordList.forEach(item => {
+        if(item.id == id) {
+          str = item.farmName
+        }
+      })
+      return str
+    },
+    // 拿到牧场位置
+    getFarmLocation(id) {
+      let str = '';
+      this.recordList.forEach(item => {
+        if(item.id == id) {
+          str = item.location
+        }
+      })
+      let strValue = '';
+      let arr = str.split(',');
+      arr.forEach(item => {
+        strValue+= CodeToText[item]
+      })
+
+      return strValue
+    },
+    // 去耳标详情
+    jump(item) {
+      this.$store.commit('SET_KEEPALIVE', ['ButchAdmin'])
+      this.$router.push({
+        path: "/butchEarTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+    },
+    beforeAvatarUpload(file, fileList) {
+      const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png';
+      if(isJPG === false) {
+        this.$message.error('请上传正确的图片格式:jpg或png格式')
+        return false;
+      } else {
+        this.fileList.push(file)
+      }
+    },
+    handleRemove(file) {
+      if(this.fileList.length > 1) {
+        this.fileList = this.fileList.filter(item => {
+          return item.name == file.name
+        }).map(item => {
+          return item
+        })
+      } else {
+        this.fileList = [];
+      }
+    },
+    // 审批上传
+    add() {
+      let params = new FormData();
+      params.append('farmId', this.farmId);
+      if(this.fileList.length > 0) {
+        this.fileList.forEach((item) => {
+          params.append('files', item.raw)
+          // arr.push(item.raw)
+        })
+      }
+      // params.append('files', arr);
+      params.append('batchNo', this.batchNo )
+      params.append('inspecRealNum', parseInt(this.form.number))
+      params.append('inspecStatus', parseInt(this.form.isUp))
+      params.append('inspecRemark', this.form.inspec_remark)
+      addButch(params).then(res => {
+        if(res.code === 10000) {
+          this.$message.success('审批成功!')
+          this.init()
+          this.initList();
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.innerVisible = false;
+        this.dialogFormVisible = false;
+        this.fileList = [];
+        this.batchNo = '';
+        this.form = {
+          isUp: 1,
+          number: '',
+          inspec_remark: ''
+        }
+      })
+    },
+    openEartag(row) {
+      this.earShow = true;
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      ButchCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    openImg(num) {
+      this.imgShow = true
+      if(num === 1) {
+        this.imgList = this.inspecImgList
+      } else {
+        this.imgList = this.butchImgList
+      }
+    }
+  },
+  mounted() {
+    this.init()
+    this.initList();
+    // this.recordList.forEach(item => {
+    //   if(item.type === 2) {
+    //     this.farmList.push(item);
+    //   }
+    // })
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/butchEarTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['ButchAdmin'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+}
+</script>
+
+<style scoped>
+.flex-center {
+  width: 100%;
+  height: 60px;
+  line-height: 60px;
+  display: flex;
+  text-align: center;
+  align-items: center;
+}
+.box {
+  width: 100%;
+  height: 50px;
+  border: 1px solid #ddd;
+  text-align: center;
+  line-height: 48px;
+  font-size: 24px;
+}
+</style>

+ 694 - 0
src/views/CollectData/CollectButch.vue

@@ -0,0 +1,694 @@
+<template>
+  <div>
+    <template v-if="userItem.type === 0 && type === 1">
+      <new-table v-loading="loading" :title="'牧场信息'" :table-items="farmListItems" :list-data="farmListData">
+        <template #farmName="scope">
+          <span class="fontColor" @click="goFarm(2, scope.row)">{{scope.row.farmName}}</span>
+        </template>
+        <template #location="scope">
+          <span>{{locationText(scope.row.location)}}</span>
+        </template>
+      </new-table>
+    </template>
+    <template v-if="type === 2">
+      <el-button v-if="userItem.type === 0" type="primary" icon="el-icon-arrow-left" @click="back(1)">返回上一级</el-button>
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center" >
+              <div style="width: 150px;">
+                总审批数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{inspecNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px;">
+                未审批数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{accomplishNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px; ">
+                审批合格数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{qualifiedNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px;">
+                审批不合格数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{unQualifiedNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+      </el-row>
+      <br/>
+      <el-tabs type="border-card" v-model="activeName">
+        <el-tab-pane label="全部" name="0">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #inspecOrgId="scope">
+              <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus === 1">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.recordStatus === 3">
+                  <el-tag type="success">屠宰合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 5">
+                  <el-tag type="danger">屠宰不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler="scope">
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>-->
+              <el-button type="text"  @click="look(scope.row)">查看详情</el-button>
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+        <el-tab-pane label="未审批" name="1">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #inspecOrgId="scope">
+              <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus === 1">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.inspecFlowStatus === 2">
+                  <el-tag type="success">屠宰合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 5">
+                  <el-tag type="danger">屠宰不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler="scope">
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>-->
+<!--              <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>-->
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+        <el-tab-pane label="审批合格" name="2">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #inspecOrgId="scope">
+              <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus === 1">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.inspecFlowStatus === 2">
+                  <el-tag type="success">屠宰合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 5">
+                  <el-tag type="danger">屠宰不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler="scope">
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>-->
+              <el-button type="text"  @click="look(scope.row)">查看详情</el-button>
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+        <el-tab-pane label="审批不合格" name="3">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #inspecOrgId="scope">
+              <span>{{getFarmName(parseInt(scope.row.inspecOrgId))}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus === 1">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.inspecFlowStatus === 2">
+                  <el-tag type="success">屠宰合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 5">
+                  <el-tag type="danger">屠宰不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler="scope">
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 1" @click="onConfirm(scope.row)">去审批</el-button>-->
+              <el-button type="text" @click="look(scope.row)">查看详情</el-button>
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+      </el-tabs>
+      <el-dialog title="批次详情" :visible.sync="textShow" :close-on-click-modal="false">
+        <el-form>
+          <el-form-item label="批次编号">{{selectItem.batchNo}}</el-form-item>
+          <el-form-item label="申请时间">{{selectItem.sellTime}}</el-form-item>
+          <el-form-item label="申请牧场名称">{{getFarmName(selectItem.farmId)}}</el-form-item>
+          <el-form-item label="检疫处理时间">{{selectItem.inspecTime}}</el-form-item>
+          <el-form-item label="检疫处理结果">
+            <el-tag type="success">检疫合格</el-tag>
+            <el-button style="margin-left: 5px" size="mini" type="primary" v-if="inspecImgList.length > 0"  @click="openImg(1)">查看图片</el-button>
+          </el-form-item>
+          <el-form-item label="屠宰处理时间">{{selectItem.butcherTime}}</el-form-item>
+          <el-form-item label="屠宰处理结果">
+            <template v-if="selectItem.recordStatus === 3">
+              <el-tag type="success">屠宰合格</el-tag>
+              <el-button v-if="butchImgList.length > 0" style="margin-left: 5px" size="mini" type="primary"  @click="openImg(2)">查看图片</el-button>
+            </template>
+            <template v-if="selectItem.recordStatus === 5">
+              <el-tag type="danger">屠宰不合格</el-tag>
+              <el-button v-if="butchImgList.length > 0" style="margin-left: 5px" size="mini" type="primary"  @click="openImg(2)">查看图片</el-button>
+            </template>
+          </el-form-item>
+        </el-form>
+        <el-dialog title="查看图片" :visible.sync="imgShow" append-to-body :close-on-click-modal="false">
+          <img v-for="item in imgList" :src="'http://122.112.212.35:8092' + item.photoPath" :key="item.id" alt="">
+        </el-dialog>
+      </el-dialog>
+      <el-dialog title="批次下耳标数据" :visible.sync="earShow" :close-on-click-modal="false" :modal="false" >
+        <new-table :table-items="tableItems2" :list-data="tableData1">
+          <template #handler="scope">
+            <el-button type="text" @click="jump(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+      </el-dialog>
+    </template>
+  </div>
+</template>
+
+<script>
+import {CodeToText} from "element-china-area-data";
+import NewTable from "../../components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
+import {mapState} from "vuex";
+import {getPigCount} from "../../utils/apis/eartag-data/eartagData";
+import {
+  addButch,
+  ButchCheck,
+  getButchCollect,
+  getButchRecord,
+  getImg
+} from "../../utils/apis/vaccineAdmin/vaccineAdmin";
+export default {
+  name: "CollectButch",
+  components: {
+    NewTable,
+    TableFooter
+  },
+  computed: {
+    ...mapState(['recordList'])
+  },
+  data() {
+    return {
+      farmListData: [],
+      farmListItems: [
+        {
+          label: '检疫单位',
+          slotName: 'farmName'
+        },
+        {
+          label: '单位位置',
+          slotName: 'location'
+        },
+        {
+          label: '检疫次数',
+          prop: 'count'
+        }
+      ],
+      userItem: null,
+      // 1 牧场级, 2 栋舍级, 3单元级, 4耳标级
+      type: null,
+      loading: false,
+      farmId: null,
+      must: true,
+      activeName: '0',
+      tableItems: [
+        {
+          label: '批次编号',
+          prop: 'batchNo',
+          slotName: 'batchNo'
+        },
+        {
+          label: '申请时间',
+          prop: 'sellTime'
+        },
+        {
+          label: '申请牧场',
+          slotName: 'farmName',
+        },
+        {
+          label: '申请牧场位置',
+          slotName: 'farmLocation'
+        },
+        {
+          label: '检疫数量',
+          prop: 'realEartagNum'
+        },
+        {
+          label: '检疫部门',
+          slotName: 'inspecOrgId',
+        },
+        {
+          label: '检疫时间',
+          prop: 'inspecTime'
+        },
+        {
+          label: '运输车辆',
+          prop: 'plateNumber',
+        },
+        {
+          label: '处理状态',
+          slotName: 'status'
+        },
+        {
+          label: '处理时间',
+          prop: 'butcherTime'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData: [
+        {}
+      ],
+      dialogFormVisible: false,
+      formLabelWidth: '80px',
+      form: {
+        isUp: 1,
+        number: '',
+        inspec_remark: ''
+      },
+      rules: {
+        isUp: [
+          { required: true, message: '请选择是否合格', trigger: 'change' }
+        ],
+        number: [
+          { required: true, message: '请填写检疫数量', trigger: 'blur' }
+        ]
+      },
+      tableItems1: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '耳标状态',
+          slotName: 'status'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableItems2: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData1: [],
+      innerVisible: false,
+      upList: [
+        {
+          label: '不合格',
+          value: 0
+        },
+        {
+          label: '合格',
+          value: 1
+        },
+      ],
+      accomplishNum: 0,
+      inspecNum: 0,
+      qualifiedNum: 0,
+      unQualifiedNum: 0,
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+      farmList: [],
+      exTotal: 0,
+      autoEartagNum: 0,
+      realEartagNum: 0,
+      abnormal: 0,
+      fileList: [],
+      batchNo: '',
+      textShow: false,
+      selectItem: {},
+      earShow: false,
+      inspecImgList: [],
+      butchImgList: [],
+      imgShow: false,
+      imgList: [],
+      quarterList: [],
+      butchList: [],
+    }
+  },
+  watch: {
+    type(newVal) {
+      if(newVal === 1 && this.must) {
+        this.pageNum = 1;
+        this.initFarm();
+      } else if(newVal === 2  && this.must) {
+        this.pageNum = 1;
+        this.init();
+        this.initList()
+      }
+    },
+    activeName() {
+      this.pageNum = 1;
+      this.initList();
+    }
+  },
+  methods: {
+    goFarm(num, row) {
+      this.farmId = row.farmId;
+      this.must = true;
+      this.type = num;
+    },
+    locationText(text) {
+      const arr = text.split(',');
+      let str = '';
+      arr.forEach(item => {
+        str += CodeToText[item];
+      })
+      return str
+    },
+    // 上一级
+    back(num) {
+      this.must = false;
+      this.type = num;
+    },
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.initList();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.initList();
+    },
+    initFarm() {
+      let params = {
+        type: 1
+      }
+      getPigCount(params).then(res => {
+        if(res.code === 10000) {
+          this.farmListData = res.data;
+        }
+      })
+    },
+    init() {
+      let params = {
+        farmId: this.farmId
+      }
+      getButchCollect(params).then(res => {
+        if(res.code === 10000) {
+          this.accomplishNum = res.data.accomplishNum;
+          this.inspecNum = res.data.inspecNum;
+          this.qualifiedNum = res.data.qualifiedNum;
+          this.unQualifiedNum = res.data.unQualifiedNum;
+        }
+      })
+    },
+    initList() {
+      let params = {
+        farmId: this.farmId,
+        type: this.activeName,
+        current: this.pageNum,
+        size: this.pageSize
+      }
+      getButchRecord(params).then(res => {
+        if (res.code === 10000) {
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    look(row) {
+      this.textShow = true;
+      this.selectItem = row;
+      let params = {
+        types: '1,2',
+        batchNo: row.batchNo
+      }
+      getImg(params).then(res => {
+        if(res.code === 10000) {
+          this.inspecImgList = [];
+          this.butchImgList = [];
+          if(res.data.length > 0) {
+            res.data.forEach(item => {
+              if(item.photoType === 1) {
+                this.inspecImgList.push(item)
+              } else {
+                this.butchImgList.push(item)
+              }
+            })
+          }
+        }
+      })
+    },
+    onConfirm(row) {
+      this.dialogFormVisible = true
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      this.batchNo = row.batchNo
+      ButchCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          this.exTotal = res.data.inspecAutoNum;
+          this.autoEartagNum = res.data.autoEartagNum;
+          this.realEartagNum = res.data.realEartagNum;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    open() {
+      this.innerVisible = true;
+    },
+    // 拿到牧场名称
+    getFarmName(id) {
+      let str = '';
+      this.recordList.forEach(item => {
+        if(item.id == id) {
+          str = item.farmName
+        }
+      })
+      return str
+    },
+    // 拿到牧场位置
+    getFarmLocation(id) {
+      let str = '';
+      this.recordList.forEach(item => {
+        if(item.id == id) {
+          str = item.location
+        }
+      })
+      let strValue = '';
+      let arr = str.split(',');
+      arr.forEach(item => {
+        strValue+= CodeToText[item]
+      })
+
+      return strValue
+    },
+    // 去耳标详情
+    jump(item) {
+      this.$store.commit('SET_KEEPALIVE', ['CollectButch'])
+      this.$router.push({
+        path: "/collectEarTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+    },
+    beforeAvatarUpload(file, fileList) {
+      const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png';
+      if(isJPG === false) {
+        this.$message.error('请上传正确的图片格式:jpg或png格式')
+        return false;
+      } else {
+        this.fileList.push(file)
+      }
+    },
+    handleRemove(file) {
+      if(this.fileList.length > 1) {
+        this.fileList = this.fileList.filter(item => {
+          return item.name == file.name
+        }).map(item => {
+          return item
+        })
+      } else {
+        this.fileList = [];
+      }
+    },
+    // 审批上传
+    add() {
+      let params = new FormData();
+      params.append('farmId', this.farmId);
+      if(this.fileList.length > 0) {
+        this.fileList.forEach((item) => {
+          params.append('files', item.raw)
+          // arr.push(item.raw)
+        })
+      }
+      // params.append('files', arr);
+      params.append('batchNo', this.batchNo )
+      params.append('inspecRealNum', parseInt(this.form.number))
+      params.append('inspecStatus', parseInt(this.form.isUp))
+      params.append('inspecRemark', this.form.inspec_remark)
+      addButch(params).then(res => {
+        if(res.code === 10000) {
+          this.$message.success('审批成功!')
+          this.init()
+          this.initList();
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.innerVisible = false;
+        this.dialogFormVisible = false;
+        this.fileList = [];
+        this.batchNo = '';
+        this.form = {
+          isUp: 1,
+          number: '',
+          inspec_remark: ''
+        }
+      })
+    },
+    openEartag(row) {
+      this.earShow = true;
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      ButchCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    openImg(num) {
+      this.imgShow = true
+      if(num === 1) {
+        this.imgList = this.inspecImgList
+      } else {
+        this.imgList = this.butchImgList
+      }
+    }
+  },
+  created() {
+    this.userItem = JSON.parse(localStorage.getItem('gold_UserItem'));
+  },
+  mounted() {
+    this.recordList.forEach(item => {
+      if(item.type === 1) {
+        this.butchList.push(item)
+      } else if(item.type === 3) {
+        this.quarterList.push(item)
+      }
+    })
+    if(this.userItem.type === 0) {
+      this.type = 1;
+    } else {
+      this.farmId = localStorage.getItem('gold_lastFarmId');
+      this.type = 2;
+      // this.init()
+    }
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/collectEarTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['CollectButch'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+}
+</script>
+
+<style scoped>
+.fontColor {
+  cursor: pointer;
+  color: #009cff;
+}
+</style>

+ 665 - 0
src/views/CollectData/CollectInspec.vue

@@ -0,0 +1,665 @@
+<template>
+  <div style="padding: 20px">
+    <template v-if="userItem.type === 0 && type === 1">
+      <new-table v-loading="loading" :title="'牧场信息'" :table-items="farmListItems" :list-data="farmListData">
+        <template #farmName="scope">
+          <span class="fontColor" @click="goFarm(2, scope.row)">{{scope.row.farmName}}</span>
+        </template>
+        <template #location="scope">
+          <span>{{locationText(scope.row.location)}}</span>
+        </template>
+      </new-table>
+    </template>
+    <template v-if="type === 2">
+      <el-button v-if="userItem.type === 0" type="primary" icon="el-icon-arrow-left" @click="back(1)">返回上一级</el-button>
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center" >
+              <div style="width: 150px;">
+                总审批数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{inspecNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px;">
+                未审批数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{accomplishNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px; ">
+                审批合格数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{qualifiedNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px;">
+                审批不合格数量
+              </div>
+              <div style="flex: 1; font-size: 28px; font-weight: 500">{{unQualifiedNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+      </el-row>
+      <br/>
+      <el-tabs type="border-card" v-model="activeName">
+        <el-tab-pane label="全部" name="0">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus === 0">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.inspecFlowStatus > 0">
+                  <el-tag type="success">检疫合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 4">
+                  <el-tag type="danger">检疫不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler="scope">
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>-->
+              <el-button type="text" v-if="scope.row.inspecFlowStatus != 0"  @click="look(scope.row)">查看详情</el-button>
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+        <el-tab-pane label="未审批" name="1">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus === 0">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.inspecFlowStatus > 0">
+                  <el-tag type="success">检疫合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 4">
+                  <el-tag type="danger">检疫不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler>
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>-->
+<!--              <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>-->
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+        <el-tab-pane label="审批合格" name="2">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus > 0">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.inspecFlowStatus === 1">
+                  <el-tag type="success">检疫合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 4">
+                  <el-tag type="danger">检疫不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler="scope">
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>-->
+              <el-button type="text"  @click="look(scope.row)">查看详情</el-button>
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+        <el-tab-pane label="审批不合格" name="3">
+          <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+            <template #batchNo="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+            </template>
+            <template #farmName="scope">
+              <span>{{getFarmName(scope.row.farmId)}}</span>
+            </template>
+            <template #farmLocation="scope">
+              <span>{{getFarmLocation(scope.row.farmId)}}</span>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.inspecFlowStatus === 0">
+                <el-tag type="warning">未处理</el-tag>
+              </template>
+              <template v-else>
+                <template v-if="scope.row.inspecFlowStatus > 0">
+                  <el-tag type="success">检疫合格</el-tag>
+                </template>
+                <template v-if="scope.row.recordStatus === 4">
+                  <el-tag type="danger">检疫不合格</el-tag>
+                </template>
+              </template>
+            </template>
+            <template #handler="scope">
+<!--              <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>-->
+              <el-button type="text"  @click="look(scope.row)">查看详情</el-button>
+            </template>
+          </new-table>
+          <table-footer
+            :size="pageSize"
+            :totals="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"></table-footer>
+        </el-tab-pane>
+      </el-tabs>
+      <el-dialog title="批次详情" :visible.sync="textShow" :close-on-click-modal="false">
+        <el-form>
+          <el-form-item label="批次编号">{{selectItem.batchNo}}</el-form-item>
+          <el-form-item label="申请时间">{{selectItem.sellTime}}</el-form-item>
+          <el-form-item label="申请牧场名称">{{getFarmName(selectItem.farmId)}}</el-form-item>
+          <el-form-item label="处理时间">{{selectItem.inspecTime}}</el-form-item>
+          <el-form-item label="处理结果">
+            <template v-if="selectItem.inspecFlowStatus === 1">
+              <el-tag type="success">检疫合格</el-tag>
+              <el-button style="margin-left: 5px" size="mini" type="primary" v-if="inspecImgList.length > 0"  @click="openImg(1)">查看图片</el-button>
+            </template>
+            <template v-if="selectItem.recordStatus === 4">
+              <el-tag type="danger">检疫不合格</el-tag>
+              <el-button style="margin-left: 5px" size="mini" type="primary" v-if="inspecImgList.length > 0"  @click="openImg(1)">查看图片</el-button>
+            </template>
+          </el-form-item>
+        </el-form>
+        <el-dialog title="查看图片" :visible.sync="imgShow" append-to-body :close-on-click-modal="false">
+          <img v-for="item in imgList" :src="'http://122.112.212.35:8092' + item.photoPath" :key="item.id" alt="">
+        </el-dialog>
+      </el-dialog>
+      <el-dialog title="批次下耳标数据" :visible.sync="earShow" :close-on-click-modal="false" :modal="false">
+        <new-table :table-items="tableItems2" :list-data="tableData1">
+          <template #handler="scope">
+            <el-button type="text" @click="jump(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+      </el-dialog>
+    </template>
+  </div>
+</template>
+
+<script>
+import {CodeToText} from "element-china-area-data";
+import NewTable from "../../components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
+import {mapState} from "vuex";
+import {
+  addInspection,
+  getImg,
+  getInspecCollect,
+  getInspecRecord,
+  inspecCheck
+} from "../../utils/apis/vaccineAdmin/vaccineAdmin";
+import {getPigCount} from "../../utils/apis/eartag-data/eartagData";
+
+export default {
+  name: "CollectInspec",
+  components: {
+    NewTable,
+    TableFooter
+  },
+  computed: {
+    ...mapState(['recordList'])
+  },
+  data() {
+    return {
+      farmListData: [],
+      farmListItems: [
+        {
+          label: '检疫单位',
+          slotName: 'farmName'
+        },
+        {
+          label: '单位位置',
+          slotName: 'location'
+        },
+        {
+          label: '检疫次数',
+          prop: 'count'
+        }
+      ],
+      userItem: null,
+      // 1 牧场级, 2 栋舍级, 3单元级, 4耳标级
+      type: null,
+      loading: false,
+      farmId: null,
+      must: true,
+      activeName: '0',
+      tableItems: [
+        {
+          label: '批次编号',
+          prop: 'batchNo',
+          slotName: 'batchNo'
+        },
+        {
+          label: '申请时间',
+          prop: 'sellTime'
+        },
+        {
+          label: '申请牧场',
+          slotName: 'farmName',
+        },
+        {
+          label: '申请牧场位置',
+          slotName: 'farmLocation'
+        },
+        {
+          label: '检疫数量',
+          prop: 'realEartagNum'
+        },
+        {
+          label: '运输车辆',
+          prop: 'plateNumber',
+        },
+        {
+          label: '处理状态',
+          slotName: 'status'
+        },
+        {
+          label: '处理时间',
+          prop: 'inspecTime'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData: [
+        {}
+      ],
+      dialogFormVisible: false,
+      formLabelWidth: '80px',
+      form: {
+        isUp: 1,
+        number: '',
+        inspec_remark: ''
+      },
+      rules: {
+        isUp: [
+          { required: true, message: '请选择是否合格', trigger: 'change' }
+        ],
+        number: [
+          { required: true, message: '请填写检疫数量', trigger: 'blur' }
+        ]
+      },
+      tableItems1: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '耳标状态',
+          slotName: 'status'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableItems2: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData1: [],
+      innerVisible: false,
+      upList: [
+        {
+          label: '不合格',
+          value: 0
+        },
+        {
+          label: '合格',
+          value: 1
+        },
+      ],
+      accomplishNum: 0,
+      inspecNum: 0,
+      qualifiedNum: 0,
+      unQualifiedNum: 0,
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+      farmList: [],
+      exTotal: 0,
+      autoEartagNum: 0,
+      realEartagNum: 0,
+      abnormal: 0,
+      fileList: [],
+      batchNo: '',
+      textShow: false,
+      selectItem: {},
+      earShow: false,
+      inspecImgList: [],
+      imgShow: false,
+      imgList: [],
+      quarterList: [],
+      butchList: [],
+    }
+  },
+  watch: {
+    type(newVal) {
+      if(newVal === 1 && this.must) {
+        this.pageNum = 1;
+        this.initFarm();
+      } else if(newVal === 2  && this.must) {
+        this.pageNum = 1;
+        this.init();
+        this.initList()
+      }
+    },
+    activeName() {
+      this.pageNum = 1;
+      this.initList();
+    }
+  },
+  methods: {
+    goFarm(num, row) {
+      this.farmId = row.farmId;
+      this.must = true;
+      this.type = num;
+    },
+    locationText(text) {
+      const arr = text.split(',');
+      let str = '';
+      arr.forEach(item => {
+        str += CodeToText[item];
+      })
+      return str
+    },
+    // 上一级
+    back(num) {
+      this.must = false;
+      this.type = num;
+    },
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.initList();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.initList();
+    },
+    init() {
+      let params = {
+        farmId: this.farmId
+      }
+      getInspecCollect(params).then(res => {
+        if(res.code === 10000) {
+          this.accomplishNum = res.data.accomplishNum;
+          this.inspecNum = res.data.inspecNum;
+          this.qualifiedNum = res.data.qualifiedNum;
+          this.unQualifiedNum = res.data.unQualifiedNum;
+        }
+      })
+    },
+    initList() {
+      let params = {
+        farmId: this.farmId,
+        type: this.activeName,
+        current: this.pageNum,
+        size: this.pageSize
+      }
+      getInspecRecord(params).then(res => {
+        if (res.code === 10000) {
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    look(row) {
+      this.textShow = true;
+      this.selectItem = row;
+      let params = {
+        types: '1',
+        batchNo: row.batchNo
+      }
+      getImg(params).then(res => {
+        if(res.code === 10000) {
+          this.inspecImgList = [];
+          if(res.data.length > 0) {
+            res.data.forEach(item => {
+              if(item.photoType === 1) {
+                this.inspecImgList.push(item)
+              }
+            })
+          }
+        }
+      })
+    },
+    onConfirm(row) {
+      this.dialogFormVisible = true
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      this.batchNo = row.batchNo
+      inspecCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          this.exTotal = res.data.inspecAutoNum;
+          this.autoEartagNum = res.data.autoEartagNum;
+          this.realEartagNum = res.data.realEartagNum;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    open() {
+      this.innerVisible = true;
+    },
+    // 拿到牧场名称
+    getFarmName(id) {
+      let str = '';
+      this.farmList.forEach(item => {
+        if(item.id == id) {
+          str = item.farmName
+        }
+      })
+      return str
+    },
+    // 拿到牧场位置
+    getFarmLocation(id) {
+      let str = '';
+      this.farmList.forEach(item => {
+        if(item.id == id) {
+          str = item.location
+        }
+      })
+      let strValue = '';
+      let arr = str.split(',');
+      arr.forEach(item => {
+        strValue+= CodeToText[item]
+      })
+
+      return strValue
+    },
+    // 去耳标详情
+    jump(item) {
+      this.$store.commit('SET_KEEPALIVE', ['CollectInspec'])
+      this.$router.push({
+        path: "/collectEarTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+    },
+    beforeAvatarUpload(file, fileList) {
+      const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png';
+      if(isJPG === false) {
+        this.$message.error('请上传正确的图片格式:jpg或png格式')
+        return false;
+      } else {
+        this.fileList.push(file)
+      }
+      console.log(fileList)
+    },
+    handleRemove(file) {
+      if(this.fileList.length > 1) {
+        this.fileList = this.fileList.filter(item => {
+          return item.name == file.name
+        }).map(item => {
+          return item
+        })
+      } else {
+        this.fileList = [];
+      }
+    },
+    // 审批上传
+    add() {
+      let params = new FormData();
+      params.append('farmId', this.farmId);
+      if(this.fileList.length > 0) {
+        this.fileList.forEach((item) => {
+          params.append('files', item.raw)
+          // arr.push(item.raw)
+        })
+      }
+      // params.append('files', arr);
+      params.append('batchNo', this.batchNo )
+      params.append('inspecRealNum', parseInt(this.form.number))
+      params.append('inspecStatus', parseInt(this.form.isUp))
+      params.append('inspecRemark', this.form.inspec_remark)
+      addInspection(params).then(res => {
+        if(res.code === 10000) {
+          this.$message.success('审批成功!')
+          this.init()
+          this.initList();
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.innerVisible = false;
+        this.dialogFormVisible = false;
+        this.fileList = [];
+        this.batchNo = '';
+        this.form = {
+          isUp: 1,
+          number: '',
+          inspec_remark: ''
+        }
+      })
+    },
+    openEartag(row) {
+      this.earShow = true;
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      inspecCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    openImg(num) {
+      this.imgShow = true
+      if(num === 1) {
+        this.imgList = this.inspecImgList
+      }
+    },
+    initFarm() {
+      let params = {
+        type: 3
+      }
+      getPigCount(params).then(res => {
+        if(res.code === 10000) {
+          this.farmListData = res.data;
+        }
+      })
+    }
+  },
+  created() {
+    this.userItem = JSON.parse(localStorage.getItem('gold_UserItem'));
+  },
+  mounted() {
+    this.recordList.forEach(item => {
+      if(item.type === 1) {
+        this.butchList.push(item)
+      } else if(item.type === 3) {
+        this.quarterList.push(item)
+      }
+    })
+    if(this.userItem.type === 0) {
+      this.type = 1;
+    } else {
+      this.farmId = localStorage.getItem('gold_lastFarmId');
+      this.type = 2;
+      // this.init()
+    }
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/collectEarTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['CollectInspec'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+}
+</script>
+
+<style scoped>
+.fontColor {
+  cursor: pointer;
+  color: #009cff;
+}
+</style>

+ 705 - 0
src/views/CollectData/CollectSellPig.vue

@@ -0,0 +1,705 @@
+<template>
+  <div style="padding: 20px">
+    <template v-if="userItem.type === 0 && type === 1">
+      <new-table v-loading="loading" :title="'牧场信息'" :table-items="farmListItems" :list-data="farmListData">
+        <template #farmName="scope">
+          <span class="fontColor" @click="goFarm(2, scope.row)">{{scope.row.farmName}}</span>
+        </template>
+        <template #location="scope">
+          <span>{{locationText(scope.row.location)}}</span>
+        </template>
+      </new-table>
+    </template>
+    <template v-if="type === 2">
+      <el-button v-if="userItem.type === 0" type="primary" icon="el-icon-arrow-left" @click="back(1)">返回上一级</el-button>
+      <br/>
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center" >
+              <div style="width: 150px;">
+                总申请数量
+              </div>
+              <div style="flex: 1">{{allPigNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px;">
+                已完成数量
+              </div>
+              <div style="flex: 1;">{{completedNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px;">
+                进行中数量
+              </div>
+              <div style="flex: 1;">{{underwayNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="6">
+          <el-card style="min-height: 100px">
+            <div class="flex-center">
+              <div style="width: 150px;">
+                失败数量
+              </div>
+              <div style="flex: 1;">{{failNum}}</div>
+            </div>
+          </el-card>
+        </el-col>
+      </el-row>
+      <br/>
+      <el-tabs type="border-card" v-model="activeName">
+        <el-tab-pane label="全部" name="0">
+          <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+            <template #handle="scope">
+              <el-button v-if="scope.row.recordStatus !== 0" type="text" @click="open(scope.row)">查看</el-button>
+<!--              <el-button type="primary" v-else @click="onConfirm(scope.row)">提交申请</el-button>-->
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.recordStatus === 0">
+                <el-tag>暂存</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 1">
+                <el-tag type="warning">进行中</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 2">
+                <el-tag type="warning">取消</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 3">
+                <el-tag  type="success">已完成 </el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+                <el-tag type="danger">检疫失败</el-tag>
+              </template>
+            </template>
+            <template #quarter="scope">
+              <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+            </template>
+            <template #butch="scope">
+              <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+            </template>
+            <template #autoEartagNum="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+            </template>
+          </NewTable>
+          <TableFooter
+            :size="pageSize"
+            :total="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"
+          ></TableFooter>
+        </el-tab-pane>
+        <el-tab-pane label="未提交" name="1">
+          <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+            <template #handle="scope">
+<!--              <el-button type="primary" @click="onConfirm(scope.row)">提交申请</el-button>-->
+              <el-button type="text" @click="open(scope.row)">查看</el-button>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.recordStatus === 0">
+                <el-tag>暂存</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 1">
+                <el-tag type="warning">进行中</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 2">
+                <el-tag type="warning">取消</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 3">
+                <el-tag  type="success">已完成 </el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+                <el-tag type="danger">检疫失败</el-tag>
+              </template>
+            </template>
+            <template #quarter="scope">
+              <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+            </template>
+            <template #butch="scope">
+              <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+            </template>
+            <template #autoEartagNum="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+            </template>
+          </NewTable>
+          <TableFooter
+            :size="pageSize"
+            :total="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"
+          ></TableFooter>
+        </el-tab-pane>
+        <el-tab-pane label="进行中" name="2">
+          <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+            <template #handle="scope">
+              <el-button type="text" @click="open(scope.row)">查看</el-button>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.recordStatus === 0">
+                <el-tag>暂存</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 1">
+                <el-tag type="warning">进行中</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 2">
+                <el-tag type="warning">取消</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 3">
+                <el-tag  type="success">已完成 </el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+                <el-tag type="danger">检疫失败</el-tag>
+              </template>
+            </template>
+            <template #quarter="scope">
+              <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+            </template>
+            <template #butch="scope">
+              <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+            </template>
+            <template #autoEartagNum="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+            </template>
+          </NewTable>
+          <TableFooter
+            :size="pageSize"
+            :total="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"
+          ></TableFooter>
+        </el-tab-pane>
+        <el-tab-pane label="已完成" name="3">
+          <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+            <template #handle="scope">
+              <el-button type="text" @click="open(scope.row)">查看</el-button>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.recordStatus === 0">
+                <el-tag>暂存</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 1">
+                <el-tag type="warning">进行中</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 2">
+                <el-tag type="warning">取消</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 3">
+                <el-tag  type="success">已完成 </el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+                <el-tag type="danger">检疫失败</el-tag>
+              </template>
+            </template>
+            <template #quarter="scope">
+              <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+            </template>
+            <template #butch="scope">
+              <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+            </template>
+            <template #autoEartagNum="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+            </template>
+          </NewTable>
+
+          <TableFooter
+            :size="pageSize"
+            :total="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"
+          ></TableFooter>
+        </el-tab-pane>
+        <el-tab-pane label="失败" name="4">
+          <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+            <template #handle="scope">
+              <el-button type="text" @click="open(scope.row)">查看</el-button>
+            </template>
+            <template #status="scope">
+              <template v-if="scope.row.recordStatus === 0">
+                <el-tag>暂存</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 1">
+                <el-tag type="warning">进行中</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 2">
+                <el-tag type="warning">取消</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 3">
+                <el-tag  type="success">已完成 </el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+                <el-tag type="danger">检疫失败</el-tag>
+              </template>
+            </template>
+            <template #quarter="scope">
+              <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+            </template>
+            <template #butch="scope">
+              <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+            </template>
+            <template #autoEartagNum="scope">
+              <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+            </template>
+          </NewTable>
+          <TableFooter
+            :size="pageSize"
+            :total="total"
+            @sizeChange="sizeChange"
+            @pageChange="pageChange"
+          ></TableFooter>
+        </el-tab-pane>
+      </el-tabs>
+      <!-- 查看步骤条   -->
+      <el-dialog center :close-on-click-modal="false" :visible.sync="dialogFormVisible">
+        <el-steps :active="now"  finish-status="success" :process-status="openList.recordStatus > 3 ? 'error' : 'success'">
+          <el-step v-for="(item, i) in stepList" :key="i" :title="item.title" :description="item.subTitle"></el-step>
+        </el-steps>
+        <el-form>
+          <el-form-item label-width="80" label="检疫部门">
+            <span>{{getFarmName(openList.inspecOrgId)}}</span>
+          </el-form-item>
+          <el-form-item label-width="80" label="屠宰部门">
+            <span>{{getFarmName(openList.butcherOrgId)}}</span>
+          </el-form-item>
+          <el-form-item label-width="80" label="实际数量">
+            <span>{{openList.realEartagNum}}</span>
+          </el-form-item>
+          <el-form-item label-width="80" label="运输车辆">
+            <span>{{openList.plateNumber}}</span>
+          </el-form-item>
+          <el-form-item label-width="80" label="检疫部门检疫结果">
+            <template v-if="openList.inspecTime">
+              <template v-if="openList.recordStatus === 4">
+                <el-tag type="danger">检疫失败</el-tag>
+                <el-button type="text" @click="openChildren">查看图片</el-button>
+              </template>
+              <template v-else>
+                <el-tag type="success">检疫成功</el-tag>
+                <el-button type="text" @click="openChildren">查看图片</el-button>
+              </template>
+            </template>
+            <template v-else>
+              <el-tag>暂未检疫</el-tag>
+            </template>
+          </el-form-item>
+          <el-form-item label-width="80" label="屠宰部门检疫结果">
+            <template v-if="openList.butcherTime">
+              <template v-if="openList.recordStatus === 5">
+                <el-tag type="danger">检疫失败</el-tag>
+                <el-button type="text" @click="openChildren">查看图片</el-button>
+              </template>
+              <template v-else>
+                <el-tag type="success">检疫成功</el-tag>
+                <el-button type="text" @click="openChildren">查看图片</el-button>
+              </template>
+            </template>
+            <template v-else>
+              <el-tag>暂未检疫</el-tag>
+            </template>
+          </el-form-item>
+        </el-form>
+        <el-dialog width="30%" title="内层 Dialog" :visible.sync="innerVisible" append-to-body></el-dialog>
+      </el-dialog>
+      <!--  暂存  -->
+      <el-dialog width="30%" :close-on-click-modal="false" title="查看耳标" :visible.sync="isShow" :modal="false">
+        <NewTable :height="300" :title="'耳标数据'" :list-data="tableData1" :table-items="tableItems2">
+          <template #handler="scope">
+            <el-button type="text" @click="go(scope.row)">查看详情</el-button>
+          </template>
+        </NewTable>
+      </el-dialog>
+    </template>
+  </div>
+</template>
+
+<script>
+import NewTable from "../../components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
+import {mapState} from "vuex";
+import {
+  listByBatch,
+  sellCollect,
+  sellPigRecord,
+  sellPigRecordManage,
+  sellUpdate
+} from "../../utils/apis/sell-pig/sellPig";
+import {CodeToText} from "element-china-area-data";
+import {getPigCount} from "../../utils/apis/eartag-data/eartagData";
+export default {
+  name: "CollectSellPig",
+  components: {
+    NewTable,
+    TableFooter
+  },
+  data() {
+    return {
+      farmListData: [],
+      farmListItems: [
+        {
+          label: '牧场名称',
+          slotName: 'farmName'
+        },
+        {
+          label: '牧场位置',
+          slotName: 'location'
+        },
+        {
+          label: '卖猪次数',
+          prop: 'count'
+        }
+      ],
+      userItem: null,
+      // 1 牧场级, 2 栋舍级, 3单元级, 4耳标级
+      type: null,
+      loading: false,
+      farmId: null,
+      must: true,
+      formLabelWidth: '80px',
+      tableItems: [
+        {
+          label: '批次编号',
+          prop: 'batchNo'
+        },
+        {
+          label: '申请时间',
+          prop: 'sellTime'
+        },
+        {
+          label: '状态',
+          slotName: 'status'
+        },
+        {
+          label: '检疫部门',
+          slotName: 'quarter'
+        },
+        {
+          label: '屠宰部门',
+          slotName: 'butch',
+        },
+        {
+          label: '耳标数量',
+          slotName: 'autoEartagNum'
+        },
+        {
+          label: '操作',
+          slotName: 'handle'
+        },
+      ],
+      tableData: [
+        {
+          id: 1,
+        }
+      ],
+      dialogFormVisible: false,
+      innerVisible: false,
+      stepList: [],
+      //
+      now: 1,
+      activeName: '0',
+      allPigNum: 0,
+      completedNum: 0,
+      failNum: 0,
+      underwayNum: 0,
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+      statusList: [
+        {
+          id: 1,
+          name: '暂存'
+        },
+        {
+          id: 2,
+          name: '进行中'
+        },
+        {
+          id: 3,
+          name: '取消'
+        },
+        {
+          id: 4,
+          name: '已完成'
+        },
+        {
+          id: 5,
+          name: '检疫失败'
+        },
+        {
+          id: 6,
+          name: '屠宰失败'
+        },
+      ],
+      openList: {},
+      // 排除的的展示
+      tableData1: [
+      ],
+      tableItems1: [
+        {
+          prop: 'earmark',
+          label: '耳标号',
+          slotName: 'earmark'
+        },
+      ],
+      tableItems2: [
+        {
+          prop: 'earmark',
+          label: '耳标号',
+          slotName: 'earmark'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      form: {
+        butchId: '',
+        quarterId: '',
+        number: '',
+        transport: ''
+      },
+      rules: {
+        number: [
+          { required: true, message: '实际数量不能为空', trigger: 'blur' },
+        ],
+        transport: [
+          { required: true, message: '运输车辆不能为空', trigger: 'blur' },
+        ],
+        butchId: [
+          { required: true, message: '请选择屠宰部门', trigger: 'change' }
+        ],
+        quarterId:[
+          { required: true, message: '请选择检疫部门', trigger: 'change' }
+        ]
+      },
+      quarterList: [],
+      butchList: [],
+      confirmShow: false,
+      batchNo: '',
+      isShow: false
+    }
+  },
+  computed: {
+    ...mapState(['recordList'])
+  },
+  watch: {
+    type(newVal) {
+      if(newVal === 1 && this.must) {
+        this.pageNum = 1;
+        this.initFarm();
+      } else if(newVal === 2  && this.must) {
+        this.pageNum = 1;
+        this.init()
+        this.initTable()
+      }
+    },
+    activeName() {
+      this.pageNum = 1;
+      this.initTable();
+    }
+  },
+  methods: {
+    goFarm(num, row) {
+      this.farmId = row.farmId;
+      this.must = true;
+      this.type = num;
+    },
+    locationText(text) {
+      const arr = text.split(',');
+      let str = '';
+      arr.forEach(item => {
+        str += CodeToText[item];
+      })
+      return str
+    },
+    // 上一级
+    back(num) {
+      this.must = false;
+      this.type = num;
+    },
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.initTable();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.initTable();
+    },
+    open(item) {
+      this.dialogFormVisible = true
+      this.openList = item;
+      let params = {
+        batchNo: item.batchNo
+      }
+      sellPigRecordManage(params).then(res => {
+        if(res.code === 10000) {
+          this.stepList = res.data.data;
+          this.now = res.data.now;
+        }
+      })
+    },
+    openChildren() {
+      this.innerVisible = true
+    },
+    init() {
+      let params = {
+        farmId: this.farmId
+      }
+      console.log(params)
+      sellCollect(params).then(res => {
+        if(res.code === 10000) {
+          this.allPigNum = res.data.allPigNum;
+          this.completedNum = res.data.completedNum;
+          this.failNum = res.data.failNum;
+          this.underwayNum = res.data.underwayNum;
+        }
+      })
+    },
+    initTable() {
+      let params = {
+        current: this.pageNum,
+        size: this.pageSize,
+        type: this.activeName,
+        farmId: this.farmId
+      }
+      console.log(params)
+      sellPigRecord(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    getFarmName(id) {
+      let str = ''
+      this.recordList.forEach(item => {
+        if(item.id == id) {
+          str = item.farmName
+        }
+      })
+      return str
+    },
+    onConfirm(item) {
+      this.confirmShow = true;
+      let params = {
+        batchNo: item.batchNo
+      }
+      listByBatch(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data;
+        }
+      })
+      this.form = {
+        butchId: parseInt(item.butcherOrgId),
+        quarterId: parseInt(item.inspecOrgId),
+        number: item.realEartagNum,
+        transport: item.plateNumber
+      }
+      this.batchNo = item.id;
+    },
+    add(formName, num) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          let params = {
+            id: this.batchNo,
+            recordStatus: num
+          }
+          sellUpdate(params).then(res => {
+            if(res.code === 10000) {
+              this.$message.success('提交成功!')
+              this.init()
+            } else {
+              this.$message.error('提交失败')
+            }
+          }).finally(() => {
+            this.batchNo = '';
+            this.form = {
+              butchId: '',
+              quarterId: '',
+              number: '',
+              transport: ''
+            }
+            this.confirmShow = false;
+            this.tableData1 = [];
+          })
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    jump(item) {
+      this.isShow = true;
+      let params = {
+        batchNo: item.batchNo
+      }
+      listByBatch(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data;
+        }
+      })
+    },
+    go(item) {
+      this.$store.commit('SET_KEEPALIVE', ['CollectSellPig'])
+      this.$router.push({
+        path: "/collectEarTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+    },
+    initFarm() {
+      let params = {
+        type: 2
+      }
+      getPigCount(params).then(res => {
+        if(res.code === 10000) {
+          this.farmListData = res.data;
+        }
+      })
+    }
+  },
+  created() {
+    this.userItem = JSON.parse(localStorage.getItem('gold_UserItem'));
+  },
+  mounted() {
+    this.recordList.forEach(item => {
+      if(item.type === 1) {
+        this.butchList.push(item)
+      } else if(item.type === 3) {
+        this.quarterList.push(item)
+      }
+    })
+    if(this.userItem.type === 0) {
+      this.type = 1;
+    } else {
+      this.farmId = localStorage.getItem('gold_lastFarmId');
+      this.type = 2;
+      // this.init()
+    }
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/collectEarTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['CollectSellPig'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+}
+</script>
+
+<style scoped>
+.fontColor {
+  cursor: pointer;
+  color: #009cff;
+}
+</style>

+ 1 - 2
src/views/Login/Login.vue

@@ -73,7 +73,6 @@ export default {
           localStorage.setItem('gold_UserItem', JSON.stringify(res.data));
           this.$message.success('登录成功');
           getFarmId().then(res => {
-            if(res.code === 10000) {
               this.setFarmIdAsync(res.data);
               localStorage.setItem('gold_lastFarmId', res.data);
               let url = this.$route.query.redirect;
@@ -82,7 +81,7 @@ export default {
               } else {
                 this.$router.replace('/');
               }
-            }
+
           })
         } else {
           this.$message.error(res.message);

+ 25 - 9
src/views/MainLayout.vue

@@ -17,11 +17,23 @@
         </div>
         <div class="operant" id="operant">
           <!--  没有绑定不让其进去  -->
-          <template v-if="hasPerm(routerSite + ':look')">
-            <router-view></router-view>
+          <template v-if="hasPerm(routerSite + ':look') && isMenu && isFarmList">
+            <keep-alive :include="keepAlive">
+              <router-view v-if="$route.meta.keepAlive"></router-view>
+            </keep-alive>
+            <router-view v-if="!$route.meta.keepAlive" />
           </template>
           <template v-else>
-            <el-empty :image-size="200" description="暂无权限查看,请联系管理员"></el-empty>
+            <a-result
+              status="403"
+              title="无权限"
+              sub-title="对不起, 暂无权限查看,请联系管理员"
+            >
+              <template #extra>
+                <el-button type="primary" @click="goHome">回首页</el-button>
+              </template>
+            </a-result>
+<!--            <el-empty :image-size="200" description="暂无权限查看,请联系管理员"></el-empty>-->
           </template>
         </div>
       </el-main>
@@ -34,11 +46,13 @@ import HeaderElement from "../components/HeaderElement";
 import SideMenu from "../components/SideMenu";
 import { findOne } from '../utils/api';
 import { mapActions, mapState } from 'vuex';
+import { Result } from 'ant-design-vue'
 export default {
   name: "MainLayout",
   components: {
     HeaderElement,
-    SideMenu
+    SideMenu,
+    'a-result': Result
   },
   data() {
     return {
@@ -48,17 +62,16 @@ export default {
     }
   },
   computed: {
-    ...mapState(['color'])
+    ...mapState(['color', 'keepAlive', 'isFarmList', 'isMenu'])
   },
   methods: {
-    ...mapActions(['setModeAsync', 'setColorAsync', 'GetButtons', 'GetFarm', 'setUserNameAsync', 'setUserTypeAsync']),
+    ...mapActions(['setModeAsync', 'setColorAsync', 'GetButtons', 'GetFarm', 'setUserNameAsync', 'setUserTypeAsync', 'GetRecordList']),
     init() {
       let params = {
         id: localStorage.getItem('gold_UserId'),
       }
       findOne(params).then(res => {
         if(res.code === 10000) {
-          console.log(res);
           this.setModeAsync(res.data.mode);
           this.setColorAsync(res.data.color);
           this.setUserNameAsync(res.data.userName)
@@ -70,17 +83,20 @@ export default {
       this.routerName = data.name;
       this.routerSite = data.router;
     },
+    goHome() {
+      this.$router.replace('/')
+    },
     refresh() {
       location.reload();
     }
   },
-  mounted() {
+  created() {
     this.routerName = this.$route.meta.title;
     this.routerSite = this.$route.meta.permission;
-    console.log(this.routerSite)
     this.GetButtons();
     this.GetFarm();
     this.init();
+    this.GetRecordList();
   }
 }
 </script>

+ 348 - 0
src/views/SellPig/SellApply.vue

@@ -0,0 +1,348 @@
+<template>
+  <div>
+    <NewTable  v-loading="isShow" :title="'耳标数据'" :list-data="tableData" :table-items="tableItems" :shows="tableShow" @selectionChange="selectionChange">
+      <template #right>
+        <el-button type="primary" size="mini" @click="delVisible = true">查看排除的耳标</el-button>
+      </template>
+      <template #earTemp="scope">
+        <el-tag style="width: 65px;">{{ scope.row.earTemp }}℃</el-tag>
+      </template>
+      <template #envTemp="scope">
+        <span>{{ scope.row.envTemp }}℃</span>
+      </template>
+      <template #rssi="scope">
+        <span>-{{ scope.row.rssi }}db</span>
+      </template>
+      <template #stage="scope">
+        <span>{{ stageList[scope.row.stage - 1].label }}</span>
+      </template>
+      <template #dong="scope">
+        <span>{{ scope.row.penName }}{{ scope.row.unitName }}</span>
+      </template>
+    </NewTable>
+    <div style="float: right; margin-right: 10px">
+      <el-button type="warning" size="mini" @click="del">排除</el-button>
+      <el-button type="primary" size="mini" @click="onConfirm">确定</el-button>
+    </div>
+    <el-dialog width="30%" :close-on-click-modal="false" title="出售申请" :visible.sync="dialogFormVisible">
+      <NewTable :height="300" :title="'耳标数据'" :list-data="tableData1" :table-items="tableItems1"></NewTable>
+      <el-form size="mini" :model="form" :rules="rules" ref="ruleForm">
+        <el-form-item label="检疫部门" :label-width="formLabelWidth" prop="quarterId">
+          <el-select v-model="form.quarterId">
+            <el-option v-for="(item, i) in quarterList" :key="i" :label="item.farmName" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="屠宰部门" :label-width="formLabelWidth" prop="butchId">
+          <el-select v-model="form.butchId">
+            <el-option v-for="(item, i) in butchList" :key="i" :label="item.farmName" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="实际数量" :label-width="formLabelWidth" prop="number">
+          <el-input autocomplete="off" v-model="form.number"></el-input>
+        </el-form-item>
+        <el-form-item label="运输车辆" :label-width="formLabelWidth" prop="transport">
+          <el-input autocomplete="off" v-model="form.transport"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="add('ruleForm',0)">暂存</el-button>
+        <el-button type="primary" @click="add('ruleForm',1)">提交申请</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog title="排除的耳标" :visible.sync="delVisible"  :close-on-click-modal="false">
+      <new-table :title="'排除耳标数据'" :list-data="sellTable" :table-items="tableItems" :shows="tableShow" @selectionChange="selectionChange1">
+        <template #earTemp="scope">
+          <el-tag style="width: 65px;">{{ scope.row.earTemp }}℃</el-tag>
+        </template>
+        <template #envTemp="scope">
+          <span>{{ scope.row.envTemp }}℃</span>
+        </template>
+        <template #rssi="scope">
+          <span>-{{ scope.row.rssi }}db</span>
+        </template>
+        <template #stage="scope">
+          <span>{{ stageList[scope.row.stage - 1].label }}</span>
+        </template>
+        <template #dong="scope">
+          <span>{{ scope.row.penName }}{{ scope.row.unitName }}</span>
+        </template>
+      </new-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="delVisible = false">取消</el-button>
+        <el-button type="primary" @click="remove">移除</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import NewTable from "../../components/newTable/NewTable";
+import { isSell , sellEarList, addRemovePig, removeRemovePig, addSellPig } from "../../utils/apis/sell-pig/sellPig";
+import { fetch } from "../../utils";
+import {mapState} from "vuex";
+
+export default {
+  name: "SellApply",
+  components: {
+    NewTable
+  },
+  computed: {
+    ...mapState(['stageList', 'recordList'])
+  },
+  data() {
+    return {
+      formLabelWidth: '80px',
+      tableData: [],
+      tableItems: [
+        {
+          prop: 'time',
+          label: '采集时间',
+          slotName: 'time'
+        },
+        {
+          prop: 'eartagNo',
+          label: '耳标号',
+          slotName: 'eartagNo'
+        },
+        {
+          label: "耳根温度",
+          minWidth: "50",
+          slotName: "earTemp",
+        },
+        {
+          label: "环境温度",
+          minWidth: "50",
+          slotName: "envTemp",
+        },
+        {
+          prop: "exercise",
+          label: "运动量",
+          minWidth: "50",
+          slotName: "exercise",
+        },
+        {
+          prop: "bat",
+          label: "电池电量",
+          minWidth: "50",
+          slotName: "bat",
+        },
+        {
+          label: "信号强度",
+          minWidth: "50",
+          slotName: "rssi",
+        },
+        {
+          label: "阶段",
+          minWidth: "50",
+          slotName: "stage",
+        },
+        {
+          label: "栋舍",
+          minWidth: "100",
+          slotName: "dong",
+        },
+        {
+          prop: "deviceCode",
+          label: "采集器编码",
+          minWidth: "100",
+          slotName: "deviceCode",
+        },
+      ],
+      tableShow: {
+        showSelect: true
+      },
+      // 排除的的展示
+      tableData1: [
+      ],
+      tableItems1: [
+        {
+          prop: 'eartagNo',
+          label: '耳标号',
+          slotName: 'eartagNo'
+        },
+      ],
+      dialogFormVisible: false,
+      isSells: true,
+      isShow: true,
+      sellTable: [],
+      selectList: [],
+      farmId: localStorage.getItem('gold_lastFarmId'),
+      delVisible: false,
+      // 屠宰
+      butchList: [],
+      // 检疫
+      quarterList: [],
+      form: {
+        butchId: '',
+        quarterId: '',
+        number: '',
+        transport: ''
+      },
+      rules: {
+        number: [
+          { required: true, message: '实际数量不能为空', trigger: 'blur' },
+        ],
+        transport: [
+          { required: true, message: '运输车辆不能为空', trigger: 'blur' },
+        ],
+        butchId: [
+          { required: true, message: '请选择屠宰部门', trigger: 'change' }
+        ],
+        quarterId:[
+          { required: true, message: '请选择检疫部门', trigger: 'change' }
+        ]
+      }
+    }
+  },
+  methods: {
+    onConfirm() {
+      if(this.isSells) {
+        this.$message.error('当前牧场已禁用卖猪申请!请联系政府部门!');
+      } else {
+        if(this.selectList.length > 0) {
+          this.dialogFormVisible = true
+          this.tableData1 = this.selectList;
+        } else {
+          this.$message.error('请勾选需要售猪的耳标!')
+        }
+      }
+    },
+    async init() {
+      let params= {
+        farmId: this.farmId
+      }
+      let res = await fetch(isSell(params));
+      if (res.code === 10000) {
+        this.isSells = res.data;
+      }
+      let res1 = await fetch(sellEarList({current: 1, size: 200, farmId: this.farmId }))
+      this.isShow = false;
+      this.tableData = [];
+      this.sellTable = [];
+      if(res1.code === 10000) {
+        res1.data.records.forEach(item => {
+          if(item.sellStatus === 0) {
+            this.tableData.push(item);
+          } else {
+            this.sellTable.push(item);
+          }
+        })
+      } else {
+        this.$message.error(res.msg)
+      }
+    },
+    selectionChange(value) {
+      this.selectList = []
+      this.selectList = value;
+    },
+    selectionChange1(value) {
+      this.selectList = []
+      this.selectList = value;
+    },
+    // 排除
+    del() {
+      if(this.selectList.length > 0) {
+        let arr = [];
+        this.selectList.forEach(item => {
+          arr.push(item.eartagNo)
+        })
+        let str = arr.join(',');
+        let params = {
+          earmark: str,
+          farmId: this.farmId,
+        }
+        addRemovePig(params).then(res => {
+          if(res.code === 10000) {
+            this.$message.success('排除成功!');
+            this.init();
+          } else {
+            this.$message.error('排除失败!')
+          }
+        })
+      } else {
+        this.$message.error('请勾选需要排除的耳标')
+      }
+    },
+    remove() {
+      if(this.selectList.length > 0) {
+        let arr = [];
+        this.selectList.forEach(item => {
+          arr.push(item.eartagNo)
+        })
+        let str = arr.join(',');
+        let params = {
+          earmark: str,
+        }
+        removeRemovePig(params).then(res => {
+          if(res.code === 10000) {
+            if(res.code === 10000) {
+              this.$message.success('移除成功!');
+              this.init();
+            } else {
+              this.$message.error('移除失败!')
+            }
+          }
+        }).finally(() => {
+          this.delVisible = false;
+        })
+      }else {
+        this.$message.error('请勾选需要移除的耳标')
+      }
+    },
+    // 提交
+    add(formName, num) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          let arr = [];
+          this.tableData1.forEach(item => {
+            arr.push(item.eartagNo)
+          })
+          let str = arr.join(',')
+          let params = {
+            farmId: this.farmId,
+            plateNumber: this.form.transport,
+            realEartagNum: this.form.number,
+            recordStatus: num,
+            inspecOrgId: this.form.quarterId,
+            butcherOrgId: this.form.butchId,
+            eartagNos: str
+          }
+          addSellPig(params).then(res => {
+            if(res.code === 10000) {
+              this.$message.success(res.message)
+              this.init();
+            } else {
+              this.$message.error(res.message)
+            }
+          }).finally(() => {
+            this.tableData1 = [];
+            this.dialogFormVisible = false
+          })
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 重置
+    // reset() {
+    //   this.$refs.table.clearSelection();
+    //   this.selectList = [];
+    // }
+  },
+  created() {
+    this.init()
+    this.recordList.forEach(item => {
+      if(item.type === 1) {
+        this.butchList.push(item)
+      } else if(item.type === 3) {
+        this.quarterList.push(item)
+      }
+    })
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 180 - 0
src/views/SellPig/SellEarTag.vue

@@ -0,0 +1,180 @@
+<template>
+  <div>
+    <NewTable v-loading="tableLoading" :title="'耳标数据'" :list-data="tableData" :table-items="tableItems" @selectionChange="selectionChange">
+      <template #earTemp="scope">
+        <el-tag style="width: 65px;">{{ scope.row.earTemp }}℃</el-tag>
+      </template>
+      <template #envTemp="scope">
+        <span>{{ scope.row.envTemp }}℃</span>
+      </template>
+      <template #rssi="scope">
+        <span>-{{ scope.row.rssi }}db</span>
+      </template>
+      <template #stage="scope">
+        <span>{{ stageList[scope.row.stage - 1].label }}</span>
+      </template>
+      <template #dong="scope">
+        <span>{{ scope.row.penName }}{{ scope.row.unitName }}</span>
+      </template>
+      <template #hander="scope">
+        <el-button size="mini" type="text" @click="jump(scope.row)"
+        >查看详情</el-button
+        >
+      </template>
+    </NewTable>
+    <table-footer
+      :totals="total"
+      :size="pageSize"
+      @sizeChange="sizeChange"
+      @pageChange="pageChange"></table-footer>
+  </div>
+</template>
+
+<script>
+import NewTable from "../../components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
+import { sellEarList } from "../../utils/apis/sell-pig/sellPig";
+import { mapState } from "vuex";
+
+export default {
+  name: "SellEarTag",
+  components: {
+    NewTable,
+    TableFooter
+  },
+  computed: {
+    ...mapState(['stageList'])
+  },
+  data() {
+    return {
+      tableLoading: false,
+      tableData: [],
+      tableItems: [
+        {
+          prop: 'time',
+          label: '采集时间',
+          slotName: 'time'
+        },
+        {
+          prop: 'eartagNo',
+          label: '耳标号',
+          slotName: 'eartagNo'
+        },
+        {
+          label: "耳根温度",
+          minWidth: "50",
+          slotName: "earTemp",
+        },
+        {
+          label: "环境温度",
+          minWidth: "50",
+          slotName: "envTemp",
+        },
+        {
+          prop: "exercise",
+          label: "运动量",
+          minWidth: "50",
+          slotName: "exercise",
+        },
+        {
+          prop: "bat",
+          label: "电池电量",
+          minWidth: "50",
+          slotName: "bat",
+        },
+        {
+          label: "信号强度",
+          minWidth: "50",
+          slotName: "rssi",
+        },
+        {
+          label: "阶段",
+          minWidth: "50",
+          slotName: "stage",
+        },
+        {
+          label: "栋舍",
+          minWidth: "100",
+          slotName: "dong",
+        },
+        {
+          prop: "deviceCode",
+          label: "采集器编码",
+          minWidth: "100",
+          slotName: "deviceCode",
+        },
+        {
+          label: "操作",
+          minWidth: "50",
+          slotName: "hander",
+        },
+      ],
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+      pigpenId: '',
+      farmId: localStorage.getItem('gold_lastFarmId')
+    }
+  },
+  methods: {
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.init();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.init();
+    },
+    init() {
+      this.tableLoading = true;
+      let params = {
+        current: this.pageNum,
+        size: this.pageSize,
+        farmId: this.farmId
+      }
+      if(this.pigpenId !== '') {
+        params.pigpenId = this.pigpenId
+      }
+      sellEarList(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.tableLoading = false;
+      })
+    },
+    jump(item) {
+      this.$store.commit('SET_KEEPALIVE', ['SellEarTag'])
+      this.$router.push({
+        path: "/earTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+    },
+    selectionChange(data) {
+      console.log(data)
+    }
+  },
+  mounted() {
+    this.init()
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/earTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['SellEarTag'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 648 - 0
src/views/SellPig/SellRecord.vue

@@ -0,0 +1,648 @@
+<template>
+  <div class="sellRecord">
+    <el-row :gutter="20">
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center" >
+            <div style="width: 150px;">
+              总申请数量
+            </div>
+            <div style="flex: 1">{{allPigNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px;">
+              已完成数量
+            </div>
+            <div style="flex: 1;">{{completedNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px;">
+              进行中数量
+            </div>
+            <div style="flex: 1;">{{underwayNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px;">
+              失败数量
+            </div>
+            <div style="flex: 1;">{{failNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+    </el-row>
+    <br/>
+    <el-tabs type="border-card" v-model="activeName">
+      <el-tab-pane label="全部" name="0">
+        <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+          <template #handle="scope">
+            <el-button v-if="scope.row.recordStatus !== 0" type="text" @click="open(scope.row)">查看</el-button>
+            <el-button type="primary" v-else @click="onConfirm(scope.row)">提交申请</el-button>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.recordStatus === 0">
+              <el-tag>暂存</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 1">
+              <el-tag type="warning">进行中</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 2">
+              <el-tag type="warning">取消</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 3">
+              <el-tag  type="success">已完成 </el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+              <el-tag type="danger">检疫失败</el-tag>
+            </template>
+          </template>
+          <template #quarter="scope">
+            <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+          </template>
+          <template #butch="scope">
+            <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+          </template>
+          <template #autoEartagNum="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+          </template>
+        </NewTable>
+        <TableFooter
+          :size="pageSize"
+          :total="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"
+        ></TableFooter>
+      </el-tab-pane>
+      <el-tab-pane label="未提交" name="1">
+        <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+          <template #handle="scope">
+            <el-button type="primary" @click="onConfirm(scope.row)">提交申请</el-button>
+<!--            <el-button type="text" @click="open">查看</el-button>-->
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.recordStatus === 0">
+              <el-tag>暂存</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 1">
+              <el-tag type="warning">进行中</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 2">
+              <el-tag type="warning">取消</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 3">
+              <el-tag  type="success">已完成 </el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+              <el-tag type="danger">检疫失败</el-tag>
+            </template>
+          </template>
+          <template #quarter="scope">
+            <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+          </template>
+          <template #butch="scope">
+            <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+          </template>
+          <template #autoEartagNum="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+          </template>
+        </NewTable>
+        <TableFooter
+          :size="pageSize"
+          :total="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"
+        ></TableFooter>
+      </el-tab-pane>
+      <el-tab-pane label="进行中" name="2">
+        <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+          <template #handle="scope">
+            <el-button type="text" @click="open(scope.row)">查看</el-button>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.recordStatus === 0">
+              <el-tag>暂存</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 1">
+              <el-tag type="warning">进行中</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 2">
+              <el-tag type="warning">取消</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 3">
+              <el-tag  type="success">已完成 </el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+              <el-tag type="danger">检疫失败</el-tag>
+            </template>
+          </template>
+          <template #quarter="scope">
+            <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+          </template>
+          <template #butch="scope">
+            <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+          </template>
+          <template #autoEartagNum="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+          </template>
+        </NewTable>
+        <TableFooter
+          :size="pageSize"
+          :total="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"
+        ></TableFooter>
+      </el-tab-pane>
+      <el-tab-pane label="已完成" name="3">
+        <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+          <template #handle="scope">
+            <el-button type="text" @click="open(scope.row)">查看</el-button>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.recordStatus === 0">
+              <el-tag>暂存</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 1">
+              <el-tag type="warning">进行中</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 2">
+              <el-tag type="warning">取消</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 3">
+              <el-tag  type="success">已完成 </el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+              <el-tag type="danger">检疫失败</el-tag>
+            </template>
+          </template>
+          <template #quarter="scope">
+            <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+          </template>
+          <template #butch="scope">
+            <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+          </template>
+          <template #autoEartagNum="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+          </template>
+        </NewTable>
+
+        <TableFooter
+          :size="pageSize"
+          :total="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"
+        ></TableFooter>
+      </el-tab-pane>
+      <el-tab-pane label="失败" name="4">
+        <NewTable :title="'售猪记录'" :table-items="tableItems" :list-data="tableData">
+          <template #handle="scope">
+            <el-button type="text" @click="open(scope.row)">查看</el-button>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.recordStatus === 0">
+              <el-tag>暂存</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 1">
+              <el-tag type="warning">进行中</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 2">
+              <el-tag type="warning">取消</el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 3">
+              <el-tag  type="success">已完成 </el-tag>
+            </template>
+            <template v-if="scope.row.recordStatus === 4 || scope.row.recordStatus === 5">
+              <el-tag type="danger">检疫失败</el-tag>
+            </template>
+          </template>
+          <template #quarter="scope">
+            <span>{{getFarmName(scope.row.inspecOrgId)}}</span>
+          </template>
+          <template #butch="scope">
+            <span>{{getFarmName(scope.row.butcherOrgId)}}</span>
+          </template>
+          <template #autoEartagNum="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="jump(scope.row)">{{scope.row.autoEartagNum}}</span>
+          </template>
+        </NewTable>
+        <TableFooter
+          :size="pageSize"
+          :total="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"
+        ></TableFooter>
+      </el-tab-pane>
+    </el-tabs>
+    <!-- 查看步骤条   -->
+    <el-dialog center :close-on-click-modal="false" :visible.sync="dialogFormVisible">
+      <el-steps :active="now"  finish-status="success" :process-status="openList.recordStatus > 3 ? 'error' : 'success'">
+        <el-step v-for="(item, i) in stepList" :key="i" :title="item.title" :description="item.subTitle"></el-step>
+      </el-steps>
+      <el-form>
+        <el-form-item label-width="80" label="检疫部门">
+          <span>{{getFarmName(openList.inspecOrgId)}}</span>
+        </el-form-item>
+        <el-form-item label-width="80" label="屠宰部门">
+          <span>{{getFarmName(openList.butcherOrgId)}}</span>
+        </el-form-item>
+        <el-form-item label-width="80" label="实际数量">
+          <span>{{openList.realEartagNum}}</span>
+        </el-form-item>
+        <el-form-item label-width="80" label="运输车辆">
+          <span>{{openList.plateNumber}}</span>
+        </el-form-item>
+        <el-form-item label-width="80" label="检疫部门检疫结果">
+          <template v-if="openList.inspecTime">
+            <template v-if="openList.recordStatus === 4">
+              <el-tag type="danger">检疫失败</el-tag>
+              <el-button type="text" @click="openChildren">查看图片</el-button>
+            </template>
+            <template v-else>
+              <el-tag type="success">检疫成功</el-tag>
+              <el-button type="text" @click="openChildren">查看图片</el-button>
+            </template>
+          </template>
+          <template v-else>
+            <el-tag>暂未检疫</el-tag>
+          </template>
+        </el-form-item>
+        <el-form-item label-width="80" label="屠宰部门检疫结果">
+          <template v-if="openList.butcherTime">
+            <template v-if="openList.recordStatus === 5">
+              <el-tag type="danger">检疫失败</el-tag>
+              <el-button type="text" @click="openChildren">查看图片</el-button>
+            </template>
+            <template v-else>
+              <el-tag type="success">检疫成功</el-tag>
+              <el-button type="text" @click="openChildren">查看图片</el-button>
+            </template>
+          </template>
+          <template v-else>
+            <el-tag>暂未检疫</el-tag>
+          </template>
+        </el-form-item>
+      </el-form>
+      <el-dialog width="30%" title="内层 Dialog" :visible.sync="innerVisible" append-to-body></el-dialog>
+    </el-dialog>
+    <!--  暂存  -->
+    <el-dialog width="30%" :close-on-click-modal="false" title="出售申请" :visible.sync="confirmShow">
+      <NewTable :height="300" :title="'耳标数据'" :list-data="tableData1" :table-items="tableItems1"></NewTable>
+      <el-form size="mini" :model="form" :rules="rules" ref="ruleForm">
+        <el-form-item label="检疫部门" :label-width="formLabelWidth" prop="butchId">
+          <el-select v-model="form.butchId" disabled>
+            <el-option v-for="(item, i) in quarterList" :key="i" :label="item.farmName" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="屠宰部门" :label-width="formLabelWidth" prop="quarterId">
+          <el-select v-model="form.quarterId" disabled>
+            <el-option v-for="(item, i) in butchList" :key="i" :label="item.farmName" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="实际数量" :label-width="formLabelWidth" prop="number">
+          <el-input autocomplete="off" disabled v-model="form.number"></el-input>
+        </el-form-item>
+        <el-form-item label="运输车辆" :label-width="formLabelWidth" prop="transport">
+          <el-input autocomplete="off" disabled v-model="form.transport"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="add('ruleForm',1)">提交申请</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog width="30%" :close-on-click-modal="false" title="查看耳标" :visible.sync="isShow">
+      <NewTable :height="300" :title="'耳标数据'" :list-data="tableData1" :table-items="tableItems2">
+        <template #handler="scope">
+          <el-button type="text" @click="go(scope.row)">查看详情</el-button>
+        </template>
+      </NewTable>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import NewTable from "../../components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
+import { sellCollect, sellPigRecord, sellPigRecordManage, sellUpdate, listByBatch } from "../../utils/apis/sell-pig/sellPig";
+import { mapState } from "vuex";
+
+export default {
+  name: "SellRecord",
+  components: {
+    NewTable,
+    TableFooter
+  },
+  data() {
+    return {
+      formLabelWidth: '80px',
+      tableItems: [
+        {
+          label: '批次编号',
+          prop: 'batchNo'
+        },
+        {
+          label: '申请时间',
+          prop: 'sellTime'
+        },
+        {
+          label: '状态',
+          slotName: 'status'
+        },
+        {
+          label: '检疫部门',
+          slotName: 'quarter'
+        },
+        {
+          label: '屠宰部门',
+          slotName: 'butch',
+        },
+        {
+          label: '耳标数量',
+          slotName: 'autoEartagNum'
+        },
+        {
+          label: '操作',
+          slotName: 'handle'
+        },
+      ],
+      tableData: [
+        {
+          id: 1,
+        }
+      ],
+      dialogFormVisible: false,
+      innerVisible: false,
+      stepList: [],
+      //
+      now: 1,
+      activeName: '0',
+      farmId: localStorage.getItem('gold_lastFarmId'),
+      allPigNum: 0,
+      completedNum: 0,
+      failNum: 0,
+      underwayNum: 0,
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+      statusList: [
+        {
+          id: 1,
+          name: '暂存'
+        },
+        {
+          id: 2,
+          name: '进行中'
+        },
+        {
+          id: 3,
+          name: '取消'
+        },
+        {
+          id: 4,
+          name: '已完成'
+        },
+        {
+          id: 5,
+          name: '检疫失败'
+        },
+        {
+          id: 6,
+          name: '屠宰失败'
+        },
+      ],
+      openList: {},
+      // 排除的的展示
+      tableData1: [
+      ],
+      tableItems1: [
+        {
+          prop: 'earmark',
+          label: '耳标号',
+          slotName: 'earmark'
+        },
+      ],
+      tableItems2: [
+        {
+          prop: 'earmark',
+          label: '耳标号',
+          slotName: 'earmark'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      form: {
+        butchId: '',
+        quarterId: '',
+        number: '',
+        transport: ''
+      },
+      rules: {
+        number: [
+          { required: true, message: '实际数量不能为空', trigger: 'blur' },
+        ],
+        transport: [
+          { required: true, message: '运输车辆不能为空', trigger: 'blur' },
+        ],
+        butchId: [
+          { required: true, message: '请选择屠宰部门', trigger: 'change' }
+        ],
+        quarterId:[
+          { required: true, message: '请选择检疫部门', trigger: 'change' }
+        ]
+      },
+      quarterList: [],
+      butchList: [],
+      confirmShow: false,
+      batchNo: '',
+      isShow: false
+    }
+  },
+  computed: {
+    ...mapState(['recordList'])
+  },
+  watch: {
+    activeName() {
+      this.pageNum = 1;
+      this.initTable();
+    }
+  },
+  methods: {
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.initTable();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.initTable();
+    },
+    open(item) {
+      this.dialogFormVisible = true
+      this.openList = item;
+      let params = {
+        batchNo: item.batchNo
+      }
+      sellPigRecordManage(params).then(res => {
+        if(res.code === 10000) {
+          this.stepList = res.data.data;
+          this.now = res.data.now;
+        }
+      })
+    },
+    openChildren() {
+      this.innerVisible = true
+    },
+    init() {
+      let params = {
+        farmId: this.farmId
+      }
+      sellCollect(params).then(res => {
+        if(res.code === 10000) {
+          this.allPigNum = res.data.allPigNum;
+          this.completedNum = res.data.completedNum;
+          this.failNum = res.data.failNum;
+          this.underwayNum = res.data.underwayNum;
+        }
+      })
+    },
+    initTable() {
+      let params = {
+        current: this.pageNum,
+        size: this.pageSize,
+        type: this.activeName,
+        farmId: this.farmId
+      }
+      sellPigRecord(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    getFarmName(id) {
+      let str = ''
+      this.recordList.forEach(item => {
+        if(item.id == id) {
+          str = item.farmName
+        }
+      })
+      return str
+    },
+    onConfirm(item) {
+      this.confirmShow = true;
+      let params = {
+        batchNo: item.batchNo
+      }
+      listByBatch(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data;
+        }
+      })
+      this.form = {
+        butchId: parseInt(item.butcherOrgId),
+        quarterId: parseInt(item.inspecOrgId),
+        number: item.realEartagNum,
+        transport: item.plateNumber
+      }
+      this.batchNo = item.id;
+    },
+    add(formName, num) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          let params = {
+            id: this.batchNo,
+            recordStatus: num
+          }
+          sellUpdate(params).then(res => {
+            if(res.code === 10000) {
+              this.$message.success('提交成功!')
+              this.init()
+            } else {
+              this.$message.error('提交失败')
+            }
+          }).finally(() => {
+            this.batchNo = '';
+            this.form = {
+              butchId: '',
+              quarterId: '',
+              number: '',
+              transport: ''
+            }
+            this.confirmShow = false;
+            this.tableData1 = [];
+          })
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    jump(item) {
+      this.isShow = true;
+      let params = {
+        batchNo: item.batchNo
+      }
+      listByBatch(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data;
+        }
+      })
+    },
+    go(item) {
+      this.$store.commit('SET_KEEPALIVE', ['SellRecord'])
+      this.$router.push({
+        path: "/earTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+      this.isShow = false;
+    }
+  },
+  mounted() {
+    this.init()
+    this.initTable()
+    this.recordList.forEach(item => {
+      if(item.type === 1) {
+        this.butchList.push(item)
+      } else if(item.type === 3) {
+        this.quarterList.push(item)
+      }
+    })
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/earTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['SellRecord'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+}
+</script>
+
+<style scoped>
+  .sellRecord {
+    box-sizing: border-box;
+    padding: 20px;
+  }
+  .flex-center {
+    width: 100%;
+    height: 60px;
+    line-height: 60px;
+    display: flex;
+    text-align: center;
+  }
+</style>

+ 1 - 1
src/views/basic-data/house-admin/HouseAdmin.vue

@@ -166,7 +166,7 @@ export default {
 
     this.tableConfig = {
       propList,
-      permission: "archivesAdmin",
+      permission: "houseAdmin",
       requests: {
         list: basePigpenList,
         del: basePigpenDel,

+ 10 - 10
src/views/basic-data/house-admin/config/table.config.js

@@ -13,11 +13,11 @@ export const propList = [
     slotName: 'pigpenName',
     align: 'left'
   },
-  {
-    label: '猪舍温度',
-    prop: 'pigpenTemp',
-    slotName: 'pigpenTemp'
-  },
+  // {
+  //   label: '猪舍温度',
+  //   prop: 'pigpenTemp',
+  //   slotName: 'pigpenTemp'
+  // },
   {
     label: '猪舍状态',
     prop: 'tempAnomaly',
@@ -28,11 +28,11 @@ export const propList = [
     prop: 'stage',
     slotName: 'stage'
   },
-  {
-    label: '创建时间',
-    prop: 'creatTime',
-    slotName: 'creatTime'
-  },
+  // {
+  //   label: '创建时间',
+  //   prop: 'creatTime',
+  //   slotName: 'creatTime'
+  // },
   {
     label: '操作',
     slotName: 'handler',

+ 7 - 575
src/views/dashboard/dashboard.vue

@@ -1,587 +1,19 @@
 <template>
   <div class="box">
-    <el-skeleton style="width: 100%;" :rows="6" animated :loading="loading">
-      <div class="header">
-        <el-row :gutter="20">
-          <el-col v-for="(item, i) in iconList" :key="i" :span="6">
-            <el-card class="box-card">
-              <div class="card-flex">
-                <div class="flex-left">
-                  <i
-                    :class="[item.icon]"
-                    :style="{ fontSize: '72px', color: color }"
-                  ></i>
-                </div>
-                <div class="flex-right">
-                  <p :style="{ marginBottom: '8px', color: color }">
-                    {{ item.name }}
-                  </p>
-                  <p>{{ item.num }}{{ item.unit }}</p>
-                </div>
-              </div>
-            </el-card>
-          </el-col>
-        </el-row>
+    <el-card :bordered="false" style="display: flex;justify-content:center;height: 100%" >
+      <div style="margin:100px auto;">
+        <img src="../../assets/images/welcome.png" class="logo" alt="logo">
       </div>
-    </el-skeleton>
-    <br />
-    <!--    <div class="pending">-->
-    <!--      <div class="title" :style="{color: color}">待处理事务</div>-->
-    <!--      <div class="fens">-->
-    <!--        <el-row :gutter="40">-->
-    <!--          <el-col v-for="item in elements" :key="item.id" :span="8">-->
-    <!--            <div class="fens-text">-->
-    <!--              <span>{{item.name}}</span>-->
-    <!--              <el-tag  effect="dark" type="danger" style="float: right">{{item.data}}</el-tag>-->
-    <!--            </div>-->
-    <!--          </el-col>-->
-    <!--        </el-row>-->
-    <!--      </div>-->
-    <!--    </div>-->
-    <!--    <br/>-->
-    <div class="pending">
-      <div class="title" :style="{ color: color }">
-        <span>猪舍温湿度</span>
-        <el-button
-          type="text"
-          style="float: right; margin-right: 25px"
-          @click="jump(1)"
-          >详情</el-button
-        >
-      </div>
-      <x-form
-        :formItems="formItems"
-        :day="day"
-        @setDay="setDay"
-        @setChange="setChange"
-        @onClickType="onClickType"
-      ></x-form>
-      <el-skeleton
-        style="width: 100%;"
-        :rows="10"
-        animated
-        :loading="tempLoading"
-      >
-        <div style="width: 100%; height: 400px">
-          <chart-wsd
-            v-if="TempAndHumList.humidities.length > 0"
-            :data="TempAndHumList"
-          ></chart-wsd>
-          <el-empty
-            v-else
-            description="暂无数据"
-            style="width: 100%;"
-          ></el-empty>
-        </div>
-      </el-skeleton>
-    </div>
-    <br />
-    <div class="pending">
-      <div class="title" :style="{ color: color }">
-        <span>水量消耗</span>
-        <el-button
-          type="text"
-          style="float: right; margin-right: 25px"
-          @click="jump(2)"
-          >详情</el-button
-        >
-      </div>
-      <x-form
-        :formItems="formItems"
-        :day="day1"
-        @setDay="setDay1"
-        @setChange="setChange1"
-        @onClickType="onClickType1"
-      ></x-form>
-
-      <div class="pen-flex" v-if="waterList.length > 0">
-        <div class="pen-left">
-          <div class="water">
-            <p>上月用水量</p>
-            <p>{{ monthWater }}t</p>
-            <p>
-              <i
-                v-if="Number(monthWeekPercent) > 0"
-                class="el-icon-caret-top"
-                style="color: red"
-              ></i>
-              <i v-else class="el-icon-caret-bottom" style="color: #1ABC9C"></i>
-              <span
-                :style="{
-                  color: Number(monthWeekPercent) > 0 ? 'red' : '#1ABC9C',
-                }"
-                >{{ monthWeekPercent }}%</span
-              >
-              &nbsp;
-              <span style="font-size: 16px; color: #CFDBED">环比上月</span>
-            </p>
-          </div>
-          <div class="water">
-            <p>上周用水量</p>
-            <p>{{ weekWater }}t</p>
-            <p>
-              <i
-                v-if="Number(weekWeekPercent) > 0"
-                class="el-icon-caret-top"
-                style="color: red"
-              ></i>
-              <i v-else class="el-icon-caret-bottom" style="color: #1ABC9C"></i>
-              <span
-                :style="{
-                  color: Number(weekWeekPercent) > 0 ? 'red' : '#1ABC9C',
-                }"
-                >{{ weekWeekPercent }}%</span
-              >
-              &nbsp;
-              <span style="font-size: 16px; color: #CFDBED">环比上周</span>
-            </p>
-          </div>
-        </div>
-        <div style="width: 85%; height: 400px">
-          <chart-water :dataValue="waterList" :room="waterRoom"></chart-water>
-        </div>
-      </div>
-      <div v-else>
-        <el-empty description="暂无数据" style="width: 100%;"></el-empty>
-      </div>
-    </div>
-    <br />
-    <!--    <div class="pending">-->
-    <!--      <div class="title" :style="{color: color}">-->
-    <!--        <span>电量消耗</span>-->
-    <!--        <el-button type="text" style="float: right; margin-right: 25px">详情</el-button>-->
-    <!--      </div>-->
-    <!--      <x-form :formItems="formItems" :day="day2" @setDay="setDay2" @setChange="setChange2" @onClickType="onClickType2"></x-form>-->
-    <!--      <div class="pen-flex">-->
-    <!--        <div class="pen-left">-->
-    <!--          <div class="water">-->
-    <!--            <p>本月用电量</p>-->
-    <!--            <p>10000KW·h</p>-->
-    <!--            <p>-->
-    <!--              <i class="el-icon-caret-top" style="color: red"></i>-->
-    <!--              <span style="color: red">10%</span>-->
-    <!--              &nbsp;-->
-    <!--              <span style="font-size: 16px; color: #CFDBED">环比上月</span>-->
-    <!--            </p>-->
-    <!--          </div>-->
-    <!--          <div class="water">-->
-    <!--            <p>本周用电量</p>-->
-    <!--            <p>10000KW·h</p>-->
-    <!--            <p>-->
-    <!--              <i class="el-icon-caret-bottom" style="color: #1ABC9C"></i>-->
-    <!--              <span style="color: #1ABC9C">10%</span>-->
-    <!--              &nbsp;-->
-    <!--              <span style="font-size: 16px; color: #CFDBED">同比上周</span>-->
-    <!--            </p>-->
-    <!--          </div>-->
-    <!--        </div>-->
-    <!--        <div style="width: 85%; height: 400px">-->
-    <!--          <chart-dl></chart-dl>-->
-    <!--        </div>-->
-    <!--      </div>-->
-    <!--    </div>-->
-    <!--    <br/>-->
-    <div class="pending">
-      <div class="title" :style="{ color: color }">
-        <span>卖猪统计</span>
-        <el-button
-          type="text"
-          style="float: right; margin-right: 25px"
-          @click="jump(4)"
-          >详情</el-button
-        >
-      </div>
-    </div>
+    </el-card>
   </div>
 </template>
 
 <script>
-import XForm from "../../components/XForm";
-import { mapState } from "vuex";
-import ChartWsd from "./chart/ChartWsd";
-// import ChartDl from "./chart/ChartDl";
-import ChartWater from "./chart/ChartWater";
-import ChartPig from "./chart/ChartPig";
-import {
-  getByFloor,
-  getByRoom,
-  getListClientHome,
-  getListWater,
-  getSchool,
-  getUid,
-} from "../../utils/api";
-import { timeDate } from "../../utils";
-import axios from "axios";
+
+
 export default {
   name: "dashboard",
-  components: {
-    ChartWsd,
-    ChartWater,
-    ChartPig,
-    XForm,
-  },
-  data() {
-    return {
-      dialogVisible: false,
-      iconList: [
-        {
-          icon: "el-icon-s-order",
-          name: "今日报警总数",
-          num: 0,
-          unit: "条",
-        },
-        {
-          icon: "el-icon-shopping-bag-1",
-          name: "昨日卖猪总数",
-          num: 0,
-          unit: "头",
-        },
-        {
-          icon: "el-icon-coin",
-          name: "昨日卖猪金额",
-          num: 0,
-          unit: "元",
-        },
-        {
-          icon: "el-icon-finished",
-          name: "近7天卖猪总数",
-          num: 0,
-          unit: "头",
-        },
-      ],
-      elements: [
-        {
-          id: 1,
-          name: "事件提醒",
-          data: 10,
-        },
-        {
-          id: 2,
-          name: "事件提醒",
-          data: 10,
-        },
-        {
-          id: 3,
-          name: "事件提醒",
-          data: 10,
-        },
-        {
-          id: 4,
-          name: "事件提醒",
-          data: 10,
-        },
-        {
-          id: 5,
-          name: "事件提醒",
-          data: 10,
-        },
-        {
-          id: 6,
-          name: "事件提醒",
-          data: 10,
-        },
-      ],
-      dateRange: [],
-      formItems: [
-        {
-          id: 1,
-          type: "select",
-          label: "栋舍:",
-          placeholder: "请选择栋舍",
-          field: "floorId",
-          options: [],
-          col: 4,
-        },
-        {
-          id: 2,
-          type: "select",
-          label: "楼层:",
-          placeholder: "请选择楼层",
-          field: "uid",
-          options: [],
-          col: 4,
-        },
-        {
-          id: 10,
-          type: "select",
-          label: "单元:",
-          placeholder: "请选择单元",
-          field: "unitId",
-          options: [],
-          col: 4,
-        },
-        {
-          id: 4,
-          type: "text",
-          text: "本周",
-          value: 2,
-          col: 1,
-        },
-        {
-          id: 5,
-          type: "text",
-          text: "本月",
-          value: 3,
-          col: 1,
-        },
-        {
-          id: 6,
-          type: "datepicker",
-          placeholder: [],
-          field: "value1",
-          col: 6,
-        },
-        {
-          id: 8,
-          type: "button",
-          text: "查询",
-          col: 1,
-          click: "search",
-        },
-        // {
-        //   id: 7,
-        //   type: 'button',
-        //   text: '导出数据',
-        //   col: 2,
-        //   click: 'derive'
-        // }
-      ],
-      day: 2,
-      day1: 2,
-      TempAndHumList: {
-        humidities: [],
-      },
-      waterList: [],
-      waterRoom: "",
-      weekWater: 0,
-      weekWeekPercent: 0,
-      monthWater: 0,
-      monthWeekPercent: 0,
-      loading: false,
-      tempLoading: false,
-      waterLoading: false,
-    };
-  },
-  computed: {
-    ...mapState(["color"]),
-  },
-  methods: {
-    setDay(data) {
-      this.day = data.type;
-      let data1 = data.data;
-      if (data1.unitId) {
-        let end = timeDate(new Date().getTime());
-        let params = {
-          roomId: data1.unitId,
-          endDate: end,
-          type: this.day,
-        };
-        getByRoom(params).then((res) => {
-          if (res.code === 10000) {
-            // this.tempList = {
-            //   name: res.data.roomName,
-            //   list: res.data.semperatures
-            // }
-            // this.humList = {
-            //   name: res.data.roomName,
-            //   list: res.data.humidities
-            // }
-            this.TempAndHumList = res.data;
-          }
-          // getListWater(params).then(res => {
-          //   if(res.code === 10000) {
-          //     this.waterList = res.data.data;
-          //     this.waterRoom = res.data.room;
-          //   }
-          // })
-        });
-      } else {
-        this.$message.error("请选择栋舍楼层单元查询");
-      }
-    },
-    setDay1(data) {
-      this.day1 = data.type;
-      let data1 = data.data;
-      if (data1.unitId) {
-        let end = timeDate(new Date().getTime());
-        let params = {
-          roomId: data1.unitId,
-          endDate: end,
-          type: this.day1,
-        };
-        getListWater(params).then((res) => {
-          if (res.code === 10000) {
-            this.waterList = res.data.data;
-            this.waterRoom = res.data.room;
-          }
-        });
-      } else {
-        this.$message.error("请选择栋舍楼层单元查询");
-      }
-    },
-    getSchool() {
-      getSchool({}).then((res) => {
-        if (res.code === 10000) {
-          res.data.forEach((item) => {
-            item.value = item.id;
-            item.label = item.floorName;
-          });
-          this.formItems[0].options = res.data;
-        }
-      });
-    },
-    setChange(item) {
-      if (item.type === "floorId") {
-        let params = {
-          floorId: item.data,
-        };
-        getByFloor(params).then((res) => {
-          res.data.forEach((item) => {
-            item.value = item.uid;
-            item.label = item.alias;
-          });
-          this.formItems[1].options = res.data;
-        });
-      } else if (item.type === "uid") {
-        let params = {
-          uid: item.data,
-        };
-        getUid(params).then((res) => {
-          res.data.forEach((item) => {
-            item.value = item.id;
-            item.label = item.roomName;
-          });
-          this.formItems[2].options = res.data;
-        });
-      }
-    },
-    setChange1(item) {
-      if (item.type === "floorId") {
-        let params = {
-          floorId: item.data,
-        };
-        getByFloor(params).then((res) => {
-          res.data.forEach((item) => {
-            item.value = item.uid;
-            item.label = item.alias;
-          });
-          this.formItems[1].options = res.data;
-        });
-      } else if (item.type === "uid") {
-        let params = {
-          uid: item.data,
-        };
-        getUid(params).then((res) => {
-          res.data.forEach((item) => {
-            item.value = item.id;
-            item.label = item.roomName;
-          });
-          this.formItems[2].options = res.data;
-        });
-      }
-    },
-    onClickType(data) {
-      if (data.type === "search") {
-        let data1 = data.data;
-        if (data1.unitId) {
-          let params;
-          if (data1.value1.length > 0) {
-            params = {
-              roomId: data1.unitId,
-              startDate: data1.value1[0],
-              endDate: data1.value1[1],
-              type: 4,
-            };
-          } else {
-            this.$message.error("请选择时间区间查询");
-          }
-          getByRoom(params).then((res) => {
-            if (res.code === 10000) {
-              this.TempAndHumList = res.data;
-            }
-          });
-        } else {
-          this.$message.error("请选择栋舍楼层单元查询");
-        }
-      }
-    },
-    onClickType1(data) {
-      if (data.type === "search") {
-        let data1 = data.data;
-        if (data1.unitId) {
-          let params;
-          if (data1.value1.length > 0) {
-            params = {
-              roomId: data1.unitId,
-              startDate: data1.value1[0],
-              endDate: data1.value1[1],
-              type: 4,
-            };
-          } else {
-            this.$message.error("请选择时间区间查询");
-          }
-          getListWater(params).then((res) => {
-            if (res.code === 10000) {
-              this.waterList = res.data.data;
-              this.waterRoom = res.data.room;
-            }
-          });
-        } else {
-          this.$message.error("请选择栋舍楼层单元查询");
-        }
-      }
-    },
-    getTempAndHum() {
-      let that = this;
-      axios
-        .all([
-          getListClientHome({}),
-          getByRoom({ type: 2 }),
-          getListWater({ type: 2 }),
-        ])
-        .then(
-          axios.spread(function(res1, res2, res3) {
-            that.loading = false;
-            that.tempLoading = false;
-            that.waterLoading = false;
-            if (res1.code === 10000) {
-              const { money, quantity, warning, weekQuantity } =
-                res1.data || {};
-              that.iconList[0].num = warning;
-              that.iconList[1].num = quantity;
-              that.iconList[2].num = money;
-              that.iconList[3].num = weekQuantity;
-              // that.incon
-            }
-            if (res2.code === 10000) {
-              that.TempAndHumList = res2.data;
-            }
-            if (res3.code === 10000) {
-              that.waterList = res3.data.data;
-              that.waterRoom = res3.data.room;
-              that.weekWater = res3.data.weekWater;
-              that.weekWeekPercent = res3.data.weekWeekPercent;
-              that.monthWater = res3.data.monthWater;
-              that.monthWeekPercent = res3.data.monthWeekPercent;
-            }
-          })
-        );
-    },
-    jump(num) {
-      if (num === 1) {
-        this.$router.push("/pigHouseEnv");
-      } else if (num === 2) {
-        this.$router.push("/drinkWater");
-      } else if (num === 4) {
-        this.$router.push("/analysis");
-      }
-    },
-  },
-  mounted() {
-    this.getSchool();
-    this.getTempAndHum();
-  },
-};
+}
 </script>
 
 <style scoped>

+ 345 - 0
src/views/eartag-admin/FarmData/FarmData.vue

@@ -0,0 +1,345 @@
+<template>
+  <div style="padding: 20px">
+    <template v-if="userItem.type === 0 && type === 1">
+      <new-table v-loading="loading" :title="'牧场信息'" :table-items="tableItems1" :list-data="tableData1">
+        <template #farmName="scope">
+          <span class="fontColor" @click="goFarm(2, scope.row)">{{scope.row.farmName}}</span>
+        </template>
+        <template #location="scope">
+          <span>{{locationText(scope.row.location)}}</span>
+        </template>
+      </new-table>
+    </template>
+    <template v-if="type === 2">
+      <el-button v-if="userItem.type === 0" type="primary" icon="el-icon-arrow-left" @click="back(1)">返回上一级</el-button>
+      <new-table v-loading="loading" :title="'栋舍信息'" :table-items="tableItems2" :list-data="tableData2">
+        <template #pigpenName="scope">
+          <span class="fontColor" @click="next(3, scope.row)">
+            {{scope.row.pigpenName}}
+          </span>
+        </template>
+      </new-table>
+    </template>
+    <template v-if="type === 3">
+      <el-button type="primary" icon="el-icon-arrow-left" @click="back(2)">返回上一级</el-button>
+      <new-table v-loading="loading" :title="'单元信息'" :table-items="tableItems3" :list-data="tableData3">
+        <template #pigpenName="scope">
+           <span class="fontColor" @click="next(4, scope.row)">
+            {{scope.row.pigpenName}}
+          </span>
+        </template>
+      </new-table>
+    </template>
+    <template v-if="type === 4">
+      <el-button type="primary" icon="el-icon-arrow-left" @click="back(3)">返回上一级</el-button>
+      <new-table v-loading="loading" :title="'耳标信息'" :table-items="tableItems4" :list-data="tableData4">
+        <template #earTemp="scope">
+          <el-tag style="width: 65px;">{{ scope.row.earTemp }}℃</el-tag>
+        </template>
+        <template #envTemp="scope">
+          <span>{{ scope.row.envTemp }}℃</span>
+        </template>
+        <template #rssi="scope">
+          <span>-{{ scope.row.rssi }}db</span>
+        </template>
+        <template #stage="scope">
+          <span>{{ stageList[scope.row.stage - 1].label }}</span>
+        </template>
+        <template #dong="scope">
+          <span>{{ scope.row.penName }}{{ scope.row.unitName }}</span>
+        </template>
+        <template #hander="scope">
+          <el-button size="mini" type="text" @click="jump(scope.row)"
+          >查看详情</el-button
+          >
+        </template>
+      </new-table>
+      <table-footer
+        :totals="total"
+        :size="pageSize"
+        @sizeChange="sizeChange"
+        @pageChange="pageChange"></table-footer>
+    </template>
+  </div>
+</template>
+
+<script>
+import {
+  getEarFarmList,
+  listFarmPigpen,
+  listFarmUnit,
+  listFarmUnitEartagData
+} from "../../../utils/apis/eartag-data/eartagData";
+import NewTable from "../../../components/newTable/NewTable";
+import TableFooter from "../../../components/TableFooter";
+import {mapState} from "vuex";
+import { CodeToText } from "element-china-area-data";
+
+export default {
+  name: "FarmData",
+  components: {
+    NewTable,
+    TableFooter
+  },
+  computed: {
+    ...mapState(['stageList'])
+  },
+  data() {
+    return {
+      userItem: null,
+      // 1 牧场级, 2 栋舍级, 3单元级, 4耳标级
+      type: null,
+      farmId: null,
+      tableData1: [],
+      tableItems1: [
+        {
+          label: '牧场名称',
+          prop: 'farmName',
+          slotName: 'farmName'
+        },
+        {
+          label: '位置',
+          prop: 'location',
+          slotName: 'location'
+        },
+      ],
+      tableData2: [],
+      tableItems2: [
+        {
+          label: '栋舍',
+          slotName: 'pigpenName'
+        }
+      ],
+      tableData3: [],
+      tableItems3: [
+        {
+          slotName: 'pigpenName',
+          label: '单元'
+        }
+      ],
+      tableData4: [],
+      tableItems4: [
+        {
+          prop: 'time',
+          label: '采集时间',
+          slotName: 'time'
+        },
+        {
+          prop: 'eartagNo',
+          label: '耳标号',
+          slotName: 'eartagNo'
+        },
+        {
+          label: "耳根温度",
+          minWidth: "50",
+          slotName: "earTemp",
+        },
+        {
+          label: "环境温度",
+          minWidth: "50",
+          slotName: "envTemp",
+        },
+        {
+          prop: "exercise",
+          label: "运动量",
+          minWidth: "50",
+          slotName: "exercise",
+        },
+        {
+          prop: "bat",
+          label: "电池电量",
+          minWidth: "50",
+          slotName: "bat",
+        },
+        {
+          label: "信号强度",
+          minWidth: "50",
+          slotName: "rssi",
+        },
+        {
+          label: "阶段",
+          minWidth: "50",
+          slotName: "stage",
+        },
+        {
+          label: "栋舍",
+          minWidth: "100",
+          slotName: "dong",
+        },
+        {
+          prop: "deviceCode",
+          label: "采集器编码",
+          minWidth: "100",
+          slotName: "deviceCode",
+        },
+        {
+          label: "操作",
+          minWidth: "50",
+          slotName: "hander",
+        },
+      ],
+      loading: false,
+      rowId: '',
+      // 必须为true 才能请求接口(watch)
+      must: true,
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+    }
+  },
+  watch: {
+    type(newVal) {
+      if(newVal === 1 && this.must) {
+        this.pageNum = 1;
+        this.initFarm();
+      } else if(newVal === 2  && this.must) {
+        this.init();
+      } else if(newVal === 3  && this.must) {
+        this.initUnit();
+      } else if(newVal === 4  && this.must) {
+        this.pageNum = 1;
+        this.initEar();
+      }
+    }
+  },
+  methods: {
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.initEar();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.initEar();
+    },
+    // 拿到牧场列表
+    initFarm() {
+      this.loading = true;
+      let params = {
+        type: 2
+      }
+      getEarFarmList(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data;
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.loading = false;
+      })
+    },
+    // 获取栋舍
+    init() {
+      this.loading = true;
+      let params = {
+        farmId: parseInt(this.farmId)
+      }
+      listFarmPigpen(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData2 = res.data;
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.loading = false;
+      })
+    },
+    goFarm(num, row) {
+      this.must = true;
+      this.type = num;
+      this.farmId = row.id;
+    },
+    // 下一级
+    next(num, row) {
+      this.must = true;
+      this.type = num;
+      this.rowId = row.id;
+    },
+    // 上一级
+    back(num) {
+      this.must = false;
+      this.type = num;
+    },
+    // 获取单元
+    initUnit() {
+      this.loading = true
+      let params = {
+        penId: this.rowId
+      }
+      listFarmUnit(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData3 = res.data;
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.loading = false;
+      })
+    },
+    // 获取耳标
+    initEar(){
+      this.loading = true;
+      let params = {
+        unitid: this.rowId,
+        pageNo: this.pageNum,
+        pageSize: this.pageSize
+      }
+      listFarmUnitEartagData(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData4 = res.data.records;
+          this.total = res.data.total;
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.loading = false;
+      })
+    },
+    locationText(text) {
+      const arr = text.split(',');
+      let str = '';
+      arr.forEach(item => {
+        str += CodeToText[item];
+      })
+      return str
+    },
+    jump(item) {
+      this.$store.commit('SET_KEEPALIVE', ['FarmData'])
+      this.$router.push({
+        path: "/earTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+    },
+  },
+  created() {
+    this.userItem = JSON.parse(localStorage.getItem('gold_UserItem'));
+  },
+  mounted() {
+    if(this.userItem.type === 0) {
+      this.type = 1;
+    } else {
+      this.farmId = localStorage.getItem('gold_lastFarmId');
+      this.type = 2;
+      // this.init()
+    }
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/earTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['FarmData'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+}
+</script>
+
+<style scoped>
+  .fontColor {
+    cursor: pointer;
+    color: #009cff;
+  }
+</style>

+ 669 - 4
src/views/vaccine-admin/VaccineAdmin.vue

@@ -7,11 +7,676 @@
  * @FilePath: \goldenPig\src\views\vaccine-admin\VaccineAdmin.vue
 -->
 <template>
-  <div>
-    检疫管理
+  <div style="padding: 20px">
+    <el-row :gutter="20">
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center" >
+            <div style="width: 150px;">
+              总审批数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{inspecNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px;">
+              未审批数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{accomplishNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px; ">
+              审批合格数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{qualifiedNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="6">
+        <el-card style="min-height: 100px">
+          <div class="flex-center">
+            <div style="width: 150px;">
+              审批不合格数量
+            </div>
+            <div style="flex: 1; font-size: 28px; font-weight: 500">{{unQualifiedNum}}</div>
+          </div>
+        </el-card>
+      </el-col>
+    </el-row>
+    <br/>
+    <el-tabs type="border-card" v-model="activeName">
+      <el-tab-pane label="全部" name="0">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus === 0">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.inspecFlowStatus > 0">
+                <el-tag type="success">检疫合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4">
+                <el-tag type="danger">检疫不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+      <el-tab-pane label="未审批" name="1">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus === 0">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.inspecFlowStatus > 0">
+                <el-tag type="success">检疫合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4">
+                <el-tag type="danger">检疫不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+      <el-tab-pane label="审批合格" name="2">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus > 0">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.inspecFlowStatus === 1">
+                <el-tag type="success">检疫合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4">
+                <el-tag type="danger">检疫不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+      <el-tab-pane label="审批不合格" name="3">
+        <new-table :title="'审批列表'" :table-items="tableItems" :list-data="tableData">
+          <template #batchNo="scope">
+            <span style="color: #66b1ff; cursor: pointer" @click="openEartag(scope.row)">{{scope.row.batchNo}}</span>
+          </template>
+          <template #farmName="scope">
+            <span>{{getFarmName(scope.row.farmId)}}</span>
+          </template>
+          <template #farmLocation="scope">
+            <span>{{getFarmLocation(scope.row.farmId)}}</span>
+          </template>
+          <template #status="scope">
+            <template v-if="scope.row.inspecFlowStatus === 0">
+              <el-tag type="warning">未处理</el-tag>
+            </template>
+            <template v-else>
+              <template v-if="scope.row.inspecFlowStatus > 0">
+                <el-tag type="success">检疫合格</el-tag>
+              </template>
+              <template v-if="scope.row.recordStatus === 4">
+                <el-tag type="danger">检疫不合格</el-tag>
+              </template>
+            </template>
+          </template>
+          <template #handler="scope">
+            <el-button type="primary" size="mini" v-if="scope.row.inspecFlowStatus === 0" @click="onConfirm(scope.row)">去审批</el-button>
+            <el-button type="text" v-else @click="look(scope.row)">查看详情</el-button>
+          </template>
+        </new-table>
+        <table-footer
+          :size="pageSize"
+          :totals="total"
+          @sizeChange="sizeChange"
+          @pageChange="pageChange"></table-footer>
+      </el-tab-pane>
+    </el-tabs>
+    <el-dialog title="审批批次" :visible.sync="dialogFormVisible" :close-on-click-modal="false" :modal="false">
+      <el-row :gutter="20">
+        <el-col :span="8">
+          <div class="box">牧场填报数量:{{realEartagNum}}</div>
+        </el-col>
+        <el-col :span="8">
+          <div class="box">牧场自动采集数量:{{autoEartagNum}}</div>
+        </el-col>
+        <el-col :span="8">
+          <div class="box">检疫自动采集数量:{{exTotal}}</div>
+        </el-col>
+      </el-row>
+      <br>
+      <new-table :table-items="tableItems1" :list-data="tableData1">
+        <template #status="scope">
+          <template v-if="scope.row.status === 1">
+            <el-tag type="danger" style="font-size: 18px">不一致</el-tag>
+          </template>
+          <template v-else>
+            <el-tag type="success" style="font-size: 18px">一致</el-tag>
+          </template>
+        </template>
+        <template #handler="scope">
+          <el-button type="text" @click="jump(scope.row)">查看详情</el-button>
+        </template>
+      </new-table>
+      <el-dialog
+        width="30%"
+        title="审批单"
+        :visible.sync="innerVisible"
+        append-to-body>
+          <el-form :rules="rules" ref="ruleForm" :model="form" :label-width="formLabelWidth">
+            <el-form-item label="是否合格" prop="isUp">
+              <el-radio-group v-model="form.isUp">
+                <el-radio v-for="item in upList" :key="item.value" :label="item.value"  border>{{item.label}}</el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <el-form-item label="检疫数量" prop="number">
+              <el-input type="number" v-model="form.number"></el-input>
+            </el-form-item>
+            <el-form-item label="上传检疫凭证">
+              <el-upload
+                action="#"
+                list-type="picture-card"
+                :file-list="fileList"
+                :on-change="beforeAvatarUpload"
+                :auto-upload="false">
+                <i class="el-icon-plus"></i>
+                <div slot="file" slot-scope="{file}">
+                  <img
+                    class="el-upload-list__item-thumbnail"
+                    :src="file.url" alt=""
+                  >
+                  <span class="el-upload-list__item-actions">
+                    <span
+                      class="el-upload-list__item-delete"
+                      @click="handleRemove(file)"
+                    >
+                      <i class="el-icon-delete"></i>
+                    </span>
+                  </span>
+                </div>
+              </el-upload>
+            </el-form-item>
+            <el-form-item label="备注">
+              <el-input
+                type="textarea"
+                :rows="2"
+                placeholder="请输入内容"
+                v-model="form.inspec_remark">
+              </el-input>
+            </el-form-item>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button @click="innerVisible = false">取 消</el-button>
+            <el-button type="primary" @click="add">提 交 审 批</el-button>
+          </div>
+      </el-dialog>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormVisible = false">取 消</el-button>
+        <el-button type="primary" @click="open">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog title="批次详情" :visible.sync="textShow" :close-on-click-modal="false">
+      <el-form>
+        <el-form-item label="批次编号">{{selectItem.batchNo}}</el-form-item>
+        <el-form-item label="申请时间">{{selectItem.sellTime}}</el-form-item>
+        <el-form-item label="申请牧场名称">{{getFarmName(selectItem.farmId)}}</el-form-item>
+        <el-form-item label="处理时间">{{selectItem.inspecTime}}</el-form-item>
+        <el-form-item label="处理结果">
+          <template v-if="selectItem.inspecFlowStatus === 1">
+            <el-tag type="success">检疫合格</el-tag>
+            <el-button style="margin-left: 5px" size="mini" type="primary" v-if="inspecImgList.length > 0"  @click="openImg(1)">查看图片</el-button>
+          </template>
+          <template v-if="selectItem.recordStatus === 4">
+            <el-tag type="danger">检疫不合格</el-tag>
+            <el-button style="margin-left: 5px" size="mini" type="primary" v-if="inspecImgList.length > 0"  @click="openImg(1)">查看图片</el-button>
+          </template>
+        </el-form-item>
+      </el-form>
+      <el-dialog title="查看图片" :visible.sync="imgShow" append-to-body :close-on-click-modal="false">
+        <img v-for="item in imgList" :src="'http://122.112.212.35:8092' + item.photoPath" :key="item.id" alt="">
+      </el-dialog>
+    </el-dialog>
+    <el-dialog title="批次下耳标数据" :visible.sync="earShow" :close-on-click-modal="false" :modal="false">
+      <new-table :table-items="tableItems2" :list-data="tableData1">
+        <template #handler="scope">
+          <el-button type="text" @click="jump(scope.row)">查看详情</el-button>
+        </template>
+      </new-table>
+    </el-dialog>
   </div>
 </template>
 <script>
-export default {};
+import NewTable from "../../components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
+import {
+  getInspecCollect,
+  getInspecRecord,
+  inspecCheck,
+  addInspection,
+  getImg
+} from "../../utils/apis/vaccineAdmin/vaccineAdmin";
+import { CodeToText } from "element-china-area-data";
+import { mapState } from "vuex";
+
+export default {
+  name: 'VaccineAdmin',
+  components: {
+    NewTable,
+    TableFooter
+  },
+  computed: {
+    ...mapState(['recordList'])
+  },
+  data() {
+    return {
+      activeName: '0',
+      tableItems: [
+        {
+          label: '批次编号',
+          prop: 'batchNo',
+          slotName: 'batchNo'
+        },
+        {
+          label: '申请时间',
+          prop: 'sellTime'
+        },
+        {
+          label: '申请牧场',
+          slotName: 'farmName',
+        },
+        {
+          label: '申请牧场位置',
+          slotName: 'farmLocation'
+        },
+        {
+          label: '检疫数量',
+          prop: 'realEartagNum'
+        },
+        {
+          label: '运输车辆',
+          prop: 'plateNumber',
+        },
+        {
+          label: '处理状态',
+          slotName: 'status'
+        },
+        {
+          label: '处理时间',
+          prop: 'inspecTime'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData: [
+        {}
+      ],
+      dialogFormVisible: false,
+      formLabelWidth: '80px',
+      form: {
+        isUp: 1,
+        number: '',
+        inspec_remark: ''
+      },
+      rules: {
+        isUp: [
+          { required: true, message: '请选择是否合格', trigger: 'change' }
+        ],
+        number: [
+          { required: true, message: '请填写检疫数量', trigger: 'blur' }
+        ]
+      },
+      tableItems1: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '耳标状态',
+          slotName: 'status'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableItems2: [
+        {
+          label: '耳标号',
+          prop: 'eartagNo'
+        },
+        {
+          label: '操作',
+          slotName: 'handler'
+        }
+      ],
+      tableData1: [],
+      innerVisible: false,
+      upList: [
+        {
+          label: '不合格',
+          value: 0
+        },
+        {
+          label: '合格',
+          value: 1
+        },
+      ],
+      farmId: localStorage.getItem('gold_lastFarmId'),
+      accomplishNum: 0,
+      inspecNum: 0,
+      qualifiedNum: 0,
+      unQualifiedNum: 0,
+      pageNum: 1,
+      pageSize: 20,
+      total: 0,
+      farmList: [],
+      exTotal: 0,
+      autoEartagNum: 0,
+      realEartagNum: 0,
+      abnormal: 0,
+      fileList: [],
+      batchNo: '',
+      textShow: false,
+      selectItem: {},
+      earShow: false,
+      inspecImgList: [],
+      imgShow: false,
+      imgList: [],
+    }
+  },
+  watch: {
+    activeName() {
+      this.pageNum = 1;
+      this.initList();
+    }
+  },
+  methods: {
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.initList();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum = val;
+      this.initList();
+    },
+    init() {
+      let params = {
+        farmId: this.farmId
+      }
+      getInspecCollect(params).then(res => {
+        if(res.code === 10000) {
+          this.accomplishNum = res.data.accomplishNum;
+          this.inspecNum = res.data.inspecNum;
+          this.qualifiedNum = res.data.qualifiedNum;
+          this.unQualifiedNum = res.data.unQualifiedNum;
+        }
+      })
+    },
+    initList() {
+      let params = {
+        farmId: this.farmId,
+        type: this.activeName,
+        current: this.pageNum,
+        size: this.pageSize
+      }
+      getInspecRecord(params).then(res => {
+        if (res.code === 10000) {
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    look(row) {
+      this.textShow = true;
+      this.selectItem = row;
+      let params = {
+        types: '1',
+        batchNo: row.batchNo
+      }
+      getImg(params).then(res => {
+        if(res.code === 10000) {
+          this.inspecImgList = [];
+          if(res.data.length > 0) {
+            res.data.forEach(item => {
+              if(item.photoType === 1) {
+                this.inspecImgList.push(item)
+              }
+            })
+          }
+        }
+      })
+    },
+    onConfirm(row) {
+      this.dialogFormVisible = true
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      this.batchNo = row.batchNo
+      inspecCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          this.exTotal = res.data.inspecAutoNum;
+          this.autoEartagNum = res.data.autoEartagNum;
+          this.realEartagNum = res.data.realEartagNum;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    open() {
+      this.innerVisible = true;
+    },
+    // 拿到牧场名称
+    getFarmName(id) {
+      let str = '';
+      this.farmList.forEach(item => {
+        if(item.id == id) {
+          str = item.farmName
+        }
+      })
+      return str
+    },
+    // 拿到牧场位置
+    getFarmLocation(id) {
+      let str = '';
+      this.farmList.forEach(item => {
+        if(item.id == id) {
+          str = item.location
+        }
+      })
+      let strValue = '';
+      let arr = str.split(',');
+      arr.forEach(item => {
+        strValue+= CodeToText[item]
+      })
+
+      return strValue
+    },
+    // 去耳标详情
+    jump(item) {
+      this.$store.commit('SET_KEEPALIVE', ['VaccineAdmin'])
+      this.$router.push({
+        path: "/vaccineEarTagDetail",
+        query: {
+          id: item.eartagNo,
+        },
+      });
+    },
+    beforeAvatarUpload(file, fileList) {
+      const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png';
+      if(isJPG === false) {
+        this.$message.error('请上传正确的图片格式:jpg或png格式')
+        return false;
+      } else {
+        this.fileList.push(file)
+      }
+      console.log(fileList)
+    },
+    handleRemove(file) {
+      if(this.fileList.length > 1) {
+        this.fileList = this.fileList.filter(item => {
+          return item.name == file.name
+        }).map(item => {
+          return item
+        })
+      } else {
+        this.fileList = [];
+      }
+    },
+    // 审批上传
+    add() {
+      let params = new FormData();
+      params.append('farmId', this.farmId);
+      if(this.fileList.length > 0) {
+        this.fileList.forEach((item) => {
+          params.append('files', item.raw)
+          // arr.push(item.raw)
+        })
+      }
+      // params.append('files', arr);
+      params.append('batchNo', this.batchNo )
+      params.append('inspecRealNum', parseInt(this.form.number))
+      params.append('inspecStatus', parseInt(this.form.isUp))
+      params.append('inspecRemark', this.form.inspec_remark)
+      addInspection(params).then(res => {
+        if(res.code === 10000) {
+          this.$message.success('审批成功!')
+          this.init()
+          this.initList();
+        } else {
+          this.$message.error(res.msg)
+        }
+      }).finally(() => {
+        this.innerVisible = false;
+        this.dialogFormVisible = false;
+        this.fileList = [];
+        this.batchNo = '';
+        this.form = {
+          isUp: 1,
+          number: '',
+          inspec_remark: ''
+        }
+      })
+    },
+    openEartag(row) {
+      this.earShow = true;
+      let params = {
+        batchNo: row.batchNo,
+        farmId: this.farmId
+      }
+      inspecCheck(params).then(res => {
+        if(res.code === 10000) {
+          this.tableData1 = res.data.eartagNos;
+          // this.abnormal = res.data.abnormal;
+        }
+      })
+    },
+    openImg(num) {
+      this.imgShow = true
+      if(num === 1) {
+        this.imgList = this.inspecImgList
+      }
+    }
+  },
+  mounted() {
+    this.init()
+    this.initList();
+    this.recordList.forEach(item => {
+      if(item.type === 2) {
+        this.farmList.push(item);
+      }
+    })
+  },
+  beforeRouteLeave(to, from, next) {
+    if(to.path.indexOf('/vaccineEarTagDetail') > -1) {
+      this.$store.commit('SET_KEEPALIVE', ['VaccineAdmin'])
+    } else {
+      this.$store.commit('SET_KEEPALIVE', [''])
+    }
+    next()
+  }
+};
 </script>
-<style scoped></style>
+<style scoped>
+  .flex-center {
+    width: 100%;
+    height: 60px;
+    line-height: 60px;
+    display: flex;
+    text-align: center;
+    align-items: center;
+  }
+  .box {
+    width: 100%;
+    height: 50px;
+    border: 1px solid #ddd;
+    text-align: center;
+    line-height: 48px;
+    font-size: 24px;
+  }
+</style>