智慧农业后台管理页面
guanqb
2022-08-31 b8ef6f8946de7dc00d9711eb6ba9d1aefe24cde1
Merge branch 'master' of http://192.168.0.105:10010/r/zhny_web
30 files modified
1 files added
1077 ■■■■■ changed files
src/api/farmplant/farmplant.js 11 ●●●●● patch | view | raw | blame | history
src/api/land/land.js 10 ●●●●● patch | view | raw | blame | history
src/api/remote/remote.js 22 ●●●●● patch | view | raw | blame | history
src/api/user.js 5 ●●●●● patch | view | raw | blame | history
src/components/map/plotMap.vue 3 ●●●● patch | view | raw | blame | history
src/main.js 3 ●●●●● patch | view | raw | blame | history
src/page/index/index.vue 1 ●●●● patch | view | raw | blame | history
src/page/index/top/index.vue 2 ●●● patch | view | raw | blame | history
src/page/index/top/top-search2.vue 135 ●●●● patch | view | raw | blame | history
src/page/login/userlogin.vue 23 ●●●●● patch | view | raw | blame | history
src/router/axios.js 5 ●●●●● patch | view | raw | blame | history
src/store/modules/user.js 36 ●●●●● patch | view | raw | blame | history
src/util/eventBus.js 2 ●●●●● patch | view | raw | blame | history
src/util/store.js 11 ●●●● patch | view | raw | blame | history
src/views/farm/stockUseInfo.vue 2 ●●●●● patch | view | raw | blame | history
src/views/farmplant/farmplant.vue 1 ●●●● patch | view | raw | blame | history
src/views/farmplant/inventorylist.vue 5 ●●●● patch | view | raw | blame | history
src/views/farmplant/processlist.vue 2 ●●● patch | view | raw | blame | history
src/views/farmplant/retrievallist.vue 2 ●●● patch | view | raw | blame | history
src/views/farmplant/salelist.vue 6 ●●●● patch | view | raw | blame | history
src/views/land/LandDetail.vue 608 ●●●● patch | view | raw | blame | history
src/views/land/cs.vue 20 ●●●● patch | view | raw | blame | history
src/views/mapPattern/index.vue 7 ●●●● patch | view | raw | blame | history
src/views/recovery/recovery.vue 8 ●●●●● patch | view | raw | blame | history
src/views/remote/remote.vue 12 ●●●●● patch | view | raw | blame | history
src/views/statistics/farmplantarea.vue 2 ●●● patch | view | raw | blame | history
src/views/statistics/farmproductstockstatistics.vue 2 ●●● patch | view | raw | blame | history
src/views/statistics/stock.vue 2 ●●● patch | view | raw | blame | history
src/views/wel/index.vue 62 ●●●●● patch | view | raw | blame | history
src/views/wel/plant.vue 57 ●●●● patch | view | raw | blame | history
vue.config.js 10 ●●●●● patch | view | raw | blame | history
src/api/farmplant/farmplant.js
@@ -22,6 +22,17 @@
        }
    })
}
export const getStrainCountYM = (current, size, params) => {
    return request({
        url: '/api/farmPlant/strainCountYM',
        method: 'get',
        params: {
            ...params,
            current,
            size,
        }
    })
}
export const remove = (ids) => {
    return request({
        url: '/api/farmPlant/remove',
src/api/land/land.js
@@ -20,6 +20,16 @@
  })
}
export const getLandListNoPage = (params) => {
  return request({
    url: '/api/land/land/getLandList',
    method: 'get',
    params: {
      ...params,
    }
  })
}
export const getDetail = (id) => {
  return request({
    url: '/api/land/land/details',
src/api/remote/remote.js
@@ -12,6 +12,28 @@
  })
}
export const getPage = (current, size, params) => {
  return request({
    url: '/api/remote/remote/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getSensing = (type) => {
  return request({
    url: '/api/remote/remote/getSensings',
    method: 'get',
    params:{
      type:type
    }
  })
}
export const getDetail = (id) => {
  return request({
    url: '/api/remote/remote/detail',
src/api/user.js
@@ -1,6 +1,11 @@
import request from '@/router/axios';
import website from "@/config/website";
export const loginInfoByToken = () => request({
  url: '/api/blade-auth/getuser/token',
  method: 'get',
});
export const loginByUsername = (tenantId, deptId, roleId, username, password, type, key, code) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
src/components/map/plotMap.vue
@@ -242,7 +242,7 @@
                position += `${item[0]}, ${item[1]};`
            })
            console.log(position, 565656)
            // console.log(position, 565656)
            const polyline = new global.DC.Polyline(position)
            polyline.setStyle({
@@ -323,7 +323,6 @@
                that.drawLandPolyLine(positions)
            })
            console.log(item, 123)
            plotRegionLayer.addOverlay(polygon)
            addPlotLayers.push({ center, name: item.landName, id: item.id })
src/main.js
@@ -89,6 +89,9 @@
    loadStyle(iconfontUrl.replace('$key', ele))
})
Vue.prototype.$EventBus = new Vue()
Vue.config.productionTip = false
new Vue({
src/page/index/index.vue
@@ -38,6 +38,7 @@
  import {validatenull} from "@/util/validate";
  import {calcDate} from "@/util/date.js";
  import {getStore} from "@/util/store.js";
  import {Message} from "element-ui";
  export default {
    components: {
src/page/index/top/index.vue
@@ -87,7 +87,7 @@
                    ></i>
                </div>
            </el-tooltip>
            <img class="top-bar__img" :src="userInfo.avatar" />
            <img class="top-bar__img" :src="'/zhny-web/' + userInfo.avatar" />
            <el-dropdown>
                <span class="el-dropdown-link">
                    {{userInfo.userName}}
src/page/index/top/top-search2.vue
@@ -1,86 +1,95 @@
<template>
  <el-select class="top-search" v-model="farm.id" placeholder="请选择所属农场" filterable @change="farmChange">
  <el-select
    class="top-search"
    v-model="farm.id"
    placeholder="请选择所属农场"
    filterable
    @change="farmChange"
  >
    <el-option
      v-for="item in farmList"
      :key="item.id"
      :label="item.farmName"
      :value="item.id">
      :value="item.id"
    >
    </el-option>
  </el-select>
</template>
<script>
  import config from "../sidebar/config.js";
  import {mapGetters} from "vuex";
  import {getFarmList} from "@/api/farm/farm";
import config from "../sidebar/config.js";
import { mapGetters } from "vuex";
import { getFarmList } from "@/api/farm/farm";
  export default {
    data() {
      return {
        config: config,
        value: "",
        farm:{id:11},
        farmList:[]
      };
    },
    created() {
      let ids = ''
      if (this.userInfo.role_name != "administrator") {
        ids = this.userInfo.farmId
      }
      let params = {
        ids : ids
      }
      getFarmList(params).then(res => {
        this.farmList = res.data.data
      })
      this.$nextTick(() => {
        this.farm.id = parseInt(this.userInfo.farmId.split(',')[0])
        this.$store.commit("SET_FARMID", this.farm.id )
      })
    },
    computed: {
      ...mapGetters(['userInfo', '$farmId'])
    },
    methods: {
export default {
  name: "top-search",
  data() {
    return {
      config: config,
      value: "",
      farm: { id: 11 },
      farmList: [],
    };
  },
  created() {
    this.$EventBus.$on("setFarmId", this.farmChange);
      farmChange(data) {
        this.farm.id = data
        this.$store.commit("SET_FARMID", data)
      }
    let ids = "";
    if (this.userInfo.role_name != "administrator") {
      ids = this.userInfo.farmId;
    }
  };
    let params = {
      ids: ids,
    };
    getFarmList(params).then((res) => {
      this.farmList = res.data.data;
    });
    this.$nextTick(() => {
      this.farm.id = parseInt(this.userInfo.farmId.split(",")[0]);
      this.$store.commit("SET_FARMID", this.farm.id);
    });
  },
  computed: {
    ...mapGetters(["userInfo", "$farmId"]),
  },
  methods: {
    farmChange(data) {
      this.farm.id = data;
      this.$store.commit("SET_FARMID", data);
    },
  },
};
</script>
<style lang="scss">
  .my-autocomplete {
    li {
      line-height: normal;
      padding: 7px;
.my-autocomplete {
  li {
    line-height: normal;
    padding: 7px;
      .icon {
        margin-right: 5px;
        display: inline-block;
        vertical-align: middle;
      }
    .icon {
      margin-right: 5px;
      display: inline-block;
      vertical-align: middle;
    }
      .name {
        display: inline-block;
        text-overflow: ellipsis;
        overflow: hidden;
        vertical-align: middle;
      }
    .name {
      display: inline-block;
      text-overflow: ellipsis;
      overflow: hidden;
      vertical-align: middle;
    }
      .addr {
        padding-top: 5px;
        width: 100%;
        font-size: 12px;
        color: #b4b4b4;
      }
    .addr {
      padding-top: 5px;
      width: 100%;
      font-size: 12px;
      color: #b4b4b4;
    }
      .highlighted .addr {
        color: #ddd;
      }
    .highlighted .addr {
      color: #ddd;
    }
  }
}
</style>
src/page/login/userlogin.vue
@@ -72,8 +72,9 @@
<script>
  import {mapGetters} from "vuex";
  import {info} from "@/api/system/tenant";
  import {getCaptcha} from "@/api/user";
  import {getCaptcha, loginInfoByToken} from "@/api/user";
  import {getTopUrl} from "@/util/util";
  import {Message} from "element-ui";
  export default {
    name: "userlogin",
@@ -170,6 +171,11 @@
      this.refreshCode();
    },
    mounted() {
      //统一登录有没有登录
      const token = window.sessionStorage.getItem('token')
      if (token) {
        this.loginInfoByToken();
      }
    },
    watch: {
      'loginForm.deptId'() {
@@ -263,6 +269,21 @@
            this.$parent.$refs.login.style.backgroundImage = `url(${data.data.backgroundUrl})`;
          }
        })
      },
      // 统一登陆获取用户
      loginInfoByToken() {
        const loading = this.$loading({
          lock: true,
          text: '登录中,请稍后。。。',
          spinner: "el-icon-loading"
        });
        this.$store.dispatch("loginInfoByToken").then(() => {
          this.$router.push({path: this.tagWel.value});
          loading.close();
        }).catch(() => {
          loading.close();
          this.refreshCode();
        });
      }
    }
  };
src/router/axios.js
@@ -39,6 +39,11 @@
  if (getToken() && !isToken) {
    config.headers[website.tokenHeader] = 'bearer ' + getToken()
  }
  // 获取统一登录携带的token
  const tokensso = window.sessionStorage.getItem('token')
  if (tokensso) {
    config.headers[website.tokenHeader] = 'bearer ' + tokensso
  }
  //headers中配置text请求
  if (config.text === true) {
    config.headers["Content-Type"] = "text/plain";
src/store/modules/user.js
@@ -4,7 +4,15 @@
import {isURL, validatenull} from '@/util/validate'
import {deepClone} from '@/util/util'
import website from '@/config/website'
import {loginByUsername, loginBySocial, getUserInfo, logout, refreshToken, getButtons} from '@/api/user'
import {
  loginByUsername,
  loginBySocial,
  getUserInfo,
  logout,
  refreshToken,
  getButtons,
  loginInfoByToken
} from '@/api/user'
import {getTopMenu, getRoutes} from '@/api/system/menu'
import md5 from 'js-md5'
@@ -46,6 +54,30 @@
    $farmId: 0
  },
  actions: {
    loginInfoByToken({commit}) {
      return new Promise((resolve,reject) => {
        loginInfoByToken().then(res => {
          const data = res.data
          if (data.code == 200) {
            commit('SET_TOKEN', data.data.access_token)
            commit('SET_REFRESH_TOKEN', data.data.refresh_token)
            commit('SET_TENANT_ID', data.data.tenant_id)
            commit('SET_USER_INFO', data.data)
            commit('DEL_ALL_TAG')
            commit('CLEAR_LOCK')
          } else {
            Message({
              message: data.error_description,
              type: 'error'
            })
          }
          resolve();
        }).catch(error => {
          reject(error);
        })
      })
    },
    //根据用户名登录
    LoginByUsername({commit}, userInfo) {
      return new Promise((resolve, reject) => {
@@ -244,7 +276,7 @@
    },
    SET_USER_INFO: (state, userInfo) => {
      if (validatenull(userInfo.avatar)) {
        userInfo.avatar = "/img/bg/mg.png";
        userInfo.avatar = "/zhny-web/img/bg/mg.png";
      }
      state.userInfo = userInfo;
      setStore({name: 'userInfo', content: state.userInfo})
src/util/eventBus.js
New file
@@ -0,0 +1,2 @@
import Vue from 'vue'
export const EventBus = new Vue()
src/util/store.js
@@ -13,6 +13,14 @@
        content,
        type,
    } = params;
    if (name == 'token') {
        window.sessionStorage.setItem('token', content);
        window.localStorage.setItem('token', content);
    }
    if (name == 'refreshToken') {
        window.sessionStorage.setItem('refresh_token', content);
        window.localStorage.setItem('refresh_token', content);
    }
    name = keyName + name
    let obj = {
        dataType: typeof (content),
@@ -26,7 +34,6 @@
/**
 * 获取localStorage
 */
export const getStore = (params = {}) => {
    let {
        name,
@@ -118,4 +125,4 @@
        window.localStorage.clear()
    }
}
}
src/views/farm/stockUseInfo.vue
@@ -211,13 +211,11 @@
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            console.log(params)
            this.loading = true
            var datas = this.$route.query.id
            params.landId = datas
            params['tenantId'] = this.userInfo.tenant_id
            params['farmId'] = this.$farmId
            console.log(params)
            if (this.landId) {
                params['landId'] = this.landId
            }
src/views/farmplant/farmplant.vue
@@ -675,6 +675,7 @@
    methods: {
        //初始化数据
        initData () {
            console.log(this.$farmId,66666666666)
            var that = this
            //获取农地数据
            getLandList(this.$farmId).then((res) => {
src/views/farmplant/inventorylist.vue
@@ -65,7 +65,7 @@
                        hide: true,
                        display: true,
                        type: "select",
                        dicUrl: 'api/strain/strain-tree',
                        dicUrl: '/api/strain/strain-tree',
                        props: {
                            label: "strainName",
                            value: "id"
@@ -126,6 +126,9 @@
                     //单位处理
                    this.data.forEach((e)=>{
                        e.saleNum = e.saleNum + " 公斤"
                        if(e.type == 1){
                            e.proName = e.proName+"("+e.strainName+")"
                        }
                    })
                    this.page.total = res.data.data.total
                    this.loading = false
src/views/farmplant/processlist.vue
@@ -67,7 +67,7 @@
                        hide: true,
                        display: false,
                        type: "select",
                        dicUrl: 'api/strain/strain-tree',
                        dicUrl: '/api/strain/strain-tree',
                        props: {
                            label: "strainName",
                            value: "id"
src/views/farmplant/retrievallist.vue
@@ -65,7 +65,7 @@
                        hide: true,
                        display: true,
                        type: "select",
                        dicUrl: 'api/strain/strain-tree',
                        dicUrl: '/api/strain/strain-tree',
                        props: {
                            label: "strainName",
                            value: "id"
src/views/farmplant/salelist.vue
@@ -65,7 +65,7 @@
                        hide: true,
                        display: false,
                        type: "select",
                        dicUrl: 'api/strain/strain-tree',
                        dicUrl: '/api/strain/strain-tree',
                        props: {
                            label: "strainName",
                            value: "id"
@@ -126,12 +126,16 @@
            this.loading = true
            params['farmId'] = this.$farmId
            getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then((res) => {
                console.log(res)
                if (res.data.code == 200) {
                    this.data = res.data.data.records
                    //单位处理
                    this.data.forEach((e)=>{
                        e.saleNum = e.saleNum + " 公斤"
                        e.salePrice = e.salePrice + " 元/公斤"
                        if(e.type == 1){
                            e.proName = e.proName+"("+e.strainName+")"
                        }
                    })
                    this.page.total = res.data.data.total
                    this.loading = false
src/views/land/LandDetail.vue
@@ -1,357 +1,369 @@
<template>
    <div class="wraaper-box farming-detail-box">
        <div class="dd">
            <div class="da">
                <!--                <div class="land-img" @click="mod(usePolygons)">-->
                <div class="land-img">
                    <img v-if="url" :src="url" class="landimg" />
                    <img v-else src="../../../public/img/bg/noimage.jpg" class="landimg" />
                </div>
                <div class="cent">
                    <div class="l">{{ landName }}</div>
                    <div class="ln">{{ dic }}</div>
                </div>
                <div class="dc">占地面积:{{ landArea }}{{ dica }}</div>
                <div class="dck">所属农场:{{ deptname }}</div>
                <div class="edit">
                    <el-button @click="btnGrounpShow = !btnGrounpShow" icon="el-icon-menu"></el-button>
                    <div v-show="btnGrounpShow" class="btn-grounp">
                        <el-button size="small" @click="DelLand(delId)">删除地块</el-button>
                        <el-button size="small" @click="land">编辑地块</el-button>
                    </div>
                </div>
            </div>
            <div class="dv">
                <el-tabs v-model="activeName" @tab-click="handleClick">
                    <!-- 种植记录 -->
                    <el-tab-pane label="种养品种" name="tab1">
                        <farmplant></farmplant>
                    </el-tab-pane>
                    <!-- 农事记录 -->
                    <el-tab-pane label="农事记录" name="tab2">
                        <farming></farming>
                    </el-tab-pane>
                    <!-- 采收记录 -->
                    <el-tab-pane label="采收记录" name="tab3">
                        <recovery></recovery>
                    </el-tab-pane>
                    <!-- 农资记录 -->
                    <el-tab-pane label="农资使用记录" name="tab4">
                        <stockUseInfo></stockUseInfo>
                    </el-tab-pane>
                </el-tabs>
            </div>
  <div class="wraaper-box farming-detail-box">
    <div class="dd">
      <div class="da">
        <!--                <div class="land-img" @click="mod(usePolygons)">-->
        <div class="land-img">
          <img v-if="url" :src="url" class="landimg" />
          <img
            v-else
            src="../../../public/img/bg/noimage.jpg"
            class="landimg"
          />
        </div>
        <div class="cent">
          <div class="l">{{ landName }}</div>
          <div class="ln">{{ dic }}</div>
        </div>
        <div class="dc">占地面积:{{ landArea }}{{ dica }}</div>
        <div class="dck">所属农场:{{ deptname }}</div>
        <!--        <el-dialog-->
        <!--            title="地块位置"-->
        <!--            class="current-map-box"-->
        <!--            :visible.sync="gradeBoxVisible1"-->
        <!--            :modal="true"-->
        <!--            :modal-append-to-body="true"-->
        <!--            :append-to-body="true"-->
        <!--            :close-on-click-modal="false"-->
        <!--            :close-on-press-escape="false"-->
        <!--            :before-close="dialogBeforeClose"-->
        <!--        >-->
        <!--            <getMapDataInThere ref="getMapData" id="getMapData" @setMapData="setMapData"></getMapDataInThere>-->
        <!--            <el-button class="save" type="success" @click="upLand()">保存</el-button>-->
        <!--        </el-dialog>-->
        <landUpdate v-if="landVisible" ref="landUpdate" id="landUpdate"></landUpdate>
        <div class="edit">
          <el-button
            @click="btnGrounpShow = !btnGrounpShow"
            icon="el-icon-menu"
          ></el-button>
          <div v-show="btnGrounpShow" class="btn-grounp">
            <el-button size="small" @click="DelLand(delId)">删除地块</el-button>
            <el-button style="margin-left:0px" size="small" @click="land">编辑地块</el-button>
          </div>
        </div>
      </div>
      <div class="dv">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <!-- 种植记录 -->
          <el-tab-pane label="种养品种" name="tab1">
            <farmplant></farmplant>
          </el-tab-pane>
          <!-- 农事记录 -->
          <el-tab-pane label="农事记录" name="tab2">
            <farming></farming>
          </el-tab-pane>
          <!-- 采收记录 -->
          <el-tab-pane label="采收记录" name="tab3">
            <recovery></recovery>
          </el-tab-pane>
          <!-- 农资记录 -->
          <el-tab-pane label="农资使用记录" name="tab4">
            <stockUseInfo></stockUseInfo>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
    <!--        <el-dialog-->
    <!--            title="地块位置"-->
    <!--            class="current-map-box"-->
    <!--            :visible.sync="gradeBoxVisible1"-->
    <!--            :modal="true"-->
    <!--            :modal-append-to-body="true"-->
    <!--            :append-to-body="true"-->
    <!--            :close-on-click-modal="false"-->
    <!--            :close-on-press-escape="false"-->
    <!--            :before-close="dialogBeforeClose"-->
    <!--        >-->
    <!--            <getMapDataInThere ref="getMapData" id="getMapData" @setMapData="setMapData"></getMapDataInThere>-->
    <!--            <el-button class="save" type="success" @click="upLand()">保存</el-button>-->
    <!--        </el-dialog>-->
    <landUpdate
      v-if="landVisible"
      ref="landUpdate"
      id="landUpdate"
    ></landUpdate>
  </div>
</template>
<script>
import { mapGetters } from "vuex"
import farmplant from "@/views/farmplant/farmplant.vue"
import farming from "@/views/farm/farmingrecord.vue"
import recovery from "@/views/recovery/recovery.vue"
import stockUseInfo from "@/views/farm/stockUseInfo.vue"
import getMapDataInThere from "./getMapDataInThere.vue"
import { getList, remove, update } from "@/api/land/land"
import landUpdate from "./landUpdate"
import { mapGetters } from "vuex";
import farmplant from "@/views/farmplant/farmplant.vue";
import farming from "@/views/farm/farmingrecord.vue";
import recovery from "@/views/recovery/recovery.vue";
import stockUseInfo from "@/views/farm/stockUseInfo.vue";
import getMapDataInThere from "./getMapDataInThere.vue";
import { getList, remove, update } from "@/api/land/land";
import landUpdate from "./landUpdate";
import topSearch2Vue from "../../page/index/top/top-search2.vue";
export default {
    components: {
        farmplant,
        farming,
        recovery,
        stockUseInfo,
        landUpdate,
        getMapDataInThere
  components: {
    farmplant,
    farming,
    recovery,
    stockUseInfo,
    landUpdate,
    getMapDataInThere,
  },
  data() {
    return {
      farmId: "",
      activeName: "tab1",
      url: "",
      dica: "",
      deptname: "",
      landUnit: "",
      delId: "",
      landArea: "",
      usePolygons: "",
      dic: "",
      formC: {},
      gradeBoxVisible1: false,
      landVisible: false,
      option2: {
        index: true,
        tip: false,
        searchMenuSpan: 6,
        height: 583,
        menuWidth: 300,
        border: true,
        align: "center",
        selection: true,
        column: [
          {
            label: "路线展示",
            labelWidth: "0",
            prop: "line",
            className: "mapClass",
            hide: true,
            display: true,
            span: 24,
            formslot: true,
            addDisplay: true,
          },
        ],
      },
      btnGrounpShow: false,
    };
  },
  computed: {
    ...mapGetters(["userInfo", "permission", "polygons", "$farmId"]),
  },
  created() {
    this.$nextTick(() => {
        this.$EventBus.$emit("setFarmId", this.$route.query.farmId-0);
    });
  },
  methods: {
    //圈地
    land() {
      this.landVisible = true;
      this.$nextTick(() => {
        this.$refs.landUpdate.init();
      });
    },
    data () {
        return {
            farmId: "",
            activeName: "tab1",
            url: "",
            dica: "",
            deptname: "",
            landUnit: "",
            delId: "",
            landArea: "",
            usePolygons: "",
            dic: "",
            formC: {},
            gradeBoxVisible1: false,
            landVisible: false,
            option2: {
                index: true,
                tip: false,
                searchMenuSpan: 6,
                height: 583,
                menuWidth: 300,
                border: true,
                align: "center",
                selection: true,
                column: [
                    {
                        label: "路线展示",
                        labelWidth: "0",
                        prop: "line",
                        className: "mapClass",
                        hide: true,
                        display: true,
                        span: 24,
                        formslot: true,
                        addDisplay: true
                    }
                ],
            },
            btnGrounpShow: false
        }
    openLandUpdate(page, params = {}) {
      // getList(1, 10, Object.assign(params, this.query)).then(res => {
      //   const data = res.data.data
      //
      //   this.farmPlanList = data.records
      // })
    },
    computed: {
        ...mapGetters(["userInfo", "permission", "polygons"]),
    mod(usePolygons) {
      this.gradeBoxVisible1 = true;
      this.$refs.getMapData.draw(usePolygons);
    },
    created () {
    setMapData(val) {
      this.LineData = val[0];
      this.PointData = val[1];
    },
    methods: {
        //圈地
        land () {
            this.landVisible = true
            this.$nextTick(() => {
                this.$refs.landUpdate.init()
            })
        },
        openLandUpdate (page, params = {}) {
            console.log('11111111111refreshOnLoad')
            // getList(1, 10, Object.assign(params, this.query)).then(res => {
            //   const data = res.data.data
            //
            //   this.farmPlanList = data.records
            // })
        },
        mod (usePolygons) {
            this.gradeBoxVisible1 = true
            this.$refs.getMapData.draw(usePolygons)
        },
        setMapData (val) {
            this.LineData = val[0]
            this.PointData = val[1]
        },
        //删除地块
        DelLand (delId) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(delId)
                })
                .then(() => {
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    var arr = [];
                    this.$store.state.tags.tagList.forEach((item) => {
                      if (item.label != "地块详情") {
                        arr.push(item);
                      }
                    });
                    this.$store.state.tags.tagList = arr;
                    this.$router.back()
                })
        },
        //修改地块
        upLand () {
            var params = {}
            if (this.polygons.length == 0) {
                //没有面的数据
                this.$refs.getMapData.isCheck = true
                // loading()
            } else {
                //如果有值,空间坐标转换
                let pol = this.polygons
                let polLength = this.polygons.length - 1
                let usePolygons = ""
                for (let k in pol) {
                    usePolygons += pol[k].lng + "," + pol[k].lat
                    if (k != polLength) {
                        usePolygons += ";"
                    }
                }
                //设置坐标点
                params.userId = this.userInfo.user_id
                params.landRange = usePolygons
                params.id = this.delId,
                    params.landUnit = this.landUnit
    //删除地块
    DelLand(delId) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(delId);
        })
        .then(() => {
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          var arr = [];
          this.$store.state.tags.tagList.forEach((item) => {
            if (item.label != "地块详情") {
              arr.push(item);
            }
            // update(params).then(() => {
            //   that.$refs.form.resetFields();
            //   that.visible = false;
            //   this.$message({
            //     type: "success",
            //     message: "操作成功!"
            //   });
            //   done();
            // }, error => {
            //   loading();
            //   window.console.log(error);
            // });
        }
          });
          this.$store.state.tags.tagList = arr;
          this.$router.back();
        });
    },
    watch: {
        '$route.query': {
            immediate: true,
            handler (newData, oldData) {
                this.url = this.$route.query.url
                this.landName = this.$route.query.landName
                this.dic = this.$route.query.dic
                this.landArea = this.$route.query.landArea
                this.dica = this.$route.query.dica
                this.deptname = this.$route.query.deptname
                this.delId = this.$route.query.id
                this.landUnit = this.$route.query.landUnit
                // this.form = res.data.data;
                this.usePolygons = this.$route.query.landRange
                    .split("POLYGON((")[1]
                    .split("))")[0]
                    .split(",")
            }
    //修改地块
    upLand() {
      var params = {};
      if (this.polygons.length == 0) {
        //没有面的数据
        this.$refs.getMapData.isCheck = true;
        // loading()
      } else {
        //如果有值,空间坐标转换
        let pol = this.polygons;
        let polLength = this.polygons.length - 1;
        let usePolygons = "";
        for (let k in pol) {
          usePolygons += pol[k].lng + "," + pol[k].lat;
          if (k != polLength) {
            usePolygons += ";";
          }
        }
        //设置坐标点
        params.userId = this.userInfo.user_id;
        params.landRange = usePolygons;
        (params.id = this.delId), (params.landUnit = this.landUnit);
      }
      // update(params).then(() => {
      //   that.$refs.form.resetFields();
      //   that.visible = false;
      //   this.$message({
      //     type: "success",
      //     message: "操作成功!"
      //   });
      //   done();
      // }, error => {
      //   loading();
      //   window.console.log(error);
      // });
    },
}
  },
  watch: {
    "$route.query": {
      immediate: true,
      handler(newData, oldData) {
        this.url = this.$route.query.url;
        this.landName = this.$route.query.landName;
        this.dic = this.$route.query.dic;
        this.landArea = this.$route.query.landArea;
        this.dica = this.$route.query.dica;
        this.deptname = this.$route.query.deptname;
        this.delId = this.$route.query.id;
        this.landUnit = this.$route.query.landUnit;
        // this.form = res.data.data;
        this.usePolygons = this.$route.query.landRange
          // .split("POLYGON((")[1]
          // .split("))")[0]
          .split(",");
      },
    },
  },
};
</script>
<style scoped lang="scss">
#getMapData {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    width: 100%;
    height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: 100%;
  height: 100%;
}
.wraaper-box {
    padding: 0 !important;
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    height: calc(100% - 40px);
  padding: 0 !important;
  position: absolute;
  top: 40px;
  left: 0;
  width: 100%;
  height: calc(100% - 40px);
}
.land-img {
    width: 200px;
    height: 200px;
    margin-top: 25px;
    margin-left: 60px;
    float: left;
  width: 200px;
  height: 200px;
  margin-top: 25px;
  margin-left: 60px;
  float: left;
}
.cent {
    width: 250px;
    height: 40px;
    margin-top: 25px;
    margin-left: 40px;
    float: left;
    text-align: center;
    line-height: 40px;
  width: 250px;
  height: 40px;
  margin-top: 25px;
  margin-left: 40px;
  float: left;
  text-align: center;
  line-height: 40px;
}
.l {
    width: 120px;
    height: 40px;
    float: left;
    text-align: center;
    line-height: 40px;
  width: 120px;
  height: 40px;
  float: left;
  text-align: center;
  line-height: 40px;
}
.ln {
    width: 120px;
    height: 40px;
    margin-left: 2px;
    float: left;
    text-align: center;
    line-height: 40px;
    display: inline-block;
    vertical-align: 1px;
    border-radius: 3px;
  width: 120px;
  height: 40px;
  margin-left: 2px;
  float: left;
  text-align: center;
  line-height: 40px;
  display: inline-block;
  vertical-align: 1px;
  border-radius: 3px;
}
.dc {
    width: 151px;
    margin-top: 20px;
    margin-left: 340px;
    width: 175px;
  width: 151px;
  margin-top: 20px;
  margin-left: 340px;
  width: 175px;
}
.dck {
    width: 151px;
    margin-left: 340px;
    width: 175px;
  width: 151px;
  margin-left: 340px;
  width: 175px;
}
.landimg {
    width: 200px;
    height: 200px;
  width: 200px;
  height: 200px;
}
.dd {
    padding: 10px;
    wdith: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  padding: 10px;
  wdith: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.da {
    position: relative;
    width: 100%;
    line-height: 60px;
    background: #fff;
  position: relative;
  width: 100%;
  line-height: 60px;
  background: #fff;
    .edit {
        position: absolute;
        top: 25px;
        right: 60px;
  .edit {
    position: absolute;
    top: 25px;
    right: 60px;
        .btn-grounp {
            padding: 0 10px;
            position: absolute;
            top: 40px;
            right: 60px;
            background: #fff;
            box-shadow: 0 0 10px 1px #ccc;
        }
    .btn-grounp {
      padding: 0 10px;
      position: absolute;
      top: 40px;
      right: 60px;
      background: #fff;
      box-shadow: 0 0 10px 1px #ccc;
    }
  }
}
.dv {
    flex: 1;
    line-height: 60px;
    background: #fff;
    width: 100%;
    overflow: hidden;
  flex: 1;
  line-height: 60px;
  background: #fff;
  width: 100%;
  overflow: hidden;
}
</style>
src/views/land/cs.vue
@@ -143,14 +143,24 @@
    watch: {
        '$farmId': {
            handler (newName, oldName) {
                this.farm.id = newName
                // this.farm.id = newName
                //地块页面
                this.onLoad()
                setTimeout(() => {
                    this.onLoad()
                }, 100);
            }
        }
    },
    created () {
        this.farm.id = this.$farmId
        this.$EventBus.$on('getFarmObj', (farmObj)=>{
            // this.$nextTick(() => {
            //     this.$EventBus.$emit("setFarmId", farmObj.id);
            // });
            setTimeout(() => {
                this.$EventBus.$emit("setFarmId", farmObj.id);
            }, 100);
        })
        this.onLoad(this.page)
    },
    methods: {
@@ -204,7 +214,7 @@
            if (typeof (page) == "undefined") {
                page = this.page
            }
            Object.assign(params, { farmId: this.farm.id })
            Object.assign(params, { farmId: this.$farmId })
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
@@ -322,7 +332,7 @@
                    left: 1;
                    bottom: 0;
                    margin: auto;
                    width: 80px;
                    width: 120px;
                    height: 24px;
                    line-height: 24px;
                    border: 1px solid #64c3a4;
src/views/mapPattern/index.vue
@@ -255,8 +255,11 @@
                    }
                })
                this.plotPlantBreed = arr
                arr.forEach((e)=>{
                    e.area = e.area.toFixed(3)
                })
                this.plotPlantBreed = arr
                this.loading = false
@@ -300,6 +303,7 @@
        },
        //返回上一页
        goToBack () {
            this.$EventBus.$emit("getFarmObj", this.farmInfo);
            this.$router.go(-1)
        },
        //获取农场信息
@@ -352,7 +356,6 @@
            }
            if (this.$refs.showCP) {
                console.log(1)
                let isSelf = this.$refs.showCP.contains(e.target)
                if (!isSelf) {
                    this.plotClickNum = 0
src/views/recovery/recovery.vue
@@ -85,6 +85,7 @@
                        span: 12,
                        type: "tree",
                        dicData: [],
                        hide:true,
                        props: {
                            label: "strainName",
                            value: "id"
@@ -100,6 +101,13 @@
                        disabled: true,
                    },
                    {
                        label: "采收品种",
                        prop: "strainName",
                        span: 12,
                        labelWidth: 145,
                        disabled: true,
                    },
                    {
                        label: "采收地块",
                        span: 12,
                        labelWidth: 145,
src/views/remote/remote.vue
@@ -35,7 +35,7 @@
</template>
<script>
import { getList, getDetail, add, update, remove } from "@/api/remote/remote"
import { getList,getPage, getDetail, add, update, remove } from "@/api/remote/remote"
import { mapGetters } from "vuex"
export default {
@@ -116,13 +116,17 @@
                                value: 1
                            },
                            {
                                label: "有机基地",
                                label: "有机种植基地",
                                value: 2
                            },
                            {
                                label: "绿色基地",
                                label: "田南村绿色基地",
                                value: 3
                            },
                            {
                                label:"育秧中心",
                                value: 4
                            }
                        ],
                        rules: [{
                            required: true,
@@ -175,7 +179,7 @@
                        }]
                    },
                    {
                        label: "是否展示",
                        label: "默认展示",
                        prop: "reType",
                        type: "select",
                        searchSpan: 4,
src/views/statistics/farmplantarea.vue
@@ -112,7 +112,7 @@
                        span: 12,
                        hide: true,
                        search: true,
                        searchSpan: 6,
                        searchSpan: 7,
                        searchLabelWidth: 110,
                        searchRange: true,
                        searchValue: [this.getStartTime(), this.getEndTime()],
src/views/statistics/farmproductstockstatistics.vue
@@ -192,7 +192,7 @@
            span: 12,
            hide: true,
            search: true,
            searchSpan: 6,
            searchSpan: 7,
            searchLabelWidth: 110,
            searchRange: true,
            searchValue: [this.getStartTime(), this.getEndTime()],
src/views/statistics/stock.vue
@@ -130,7 +130,7 @@
            span: 12,
            hide: true,
            search: true,
            searchSpan: 6,
            searchSpan: 7,
            searchLabelWidth: 110,
            searchRange: true,
            searchValue: [this.getStartTime(), this.getEndTime()],
src/views/wel/index.vue
@@ -53,8 +53,8 @@
                            </div>
                        </div>
                    </div>
                    <div class="map-view">
                        <img src="../../../public/img/map.png" />
                    <div class="map-view" @click="goToMapModel">
                        <img src="../../../public/img/map.png"  />
                        <div class="title">农场地图→</div>
                    </div>
                </div>
@@ -74,6 +74,24 @@
                        <div class="btn">
                            <el-button plain size="small" @click="recovery(item)">
                                <span style="color: #5abf78">采收</span>
                            </el-button>
                            <!-- <el-button plain size="small" @click="over(item.id)">结束</el-button> -->
                            <el-button plain size="small" @click="over(item)">结束</el-button>
                        </div>
                    </div>
                    <!-- 秧苗 -->
                    <div class="farm" v-for="(item, index) in farmPlanListYM" :key="index">
                        <div class="farm-img" @click="recoveryDetail(item)">
                            <img :src="item.url" class="img" />
                        </div>
                        <div class="cai">{{ item.strainName }}(秧苗)</div>
                        <div class="area">
                            种植面积:
                            <span>{{ item.area }}</span>亩
                        </div>
                        <div class="btn">
                            <el-button plain size="small" @click="plant(item)">
                                <span style="color: #5abf78">移栽</span>
                            </el-button>
                            <!-- <el-button plain size="small" @click="over(item.id)">结束</el-button> -->
                            <el-button plain size="small" @click="over(item)">结束</el-button>
@@ -184,7 +202,7 @@
<script>
import { mapGetters } from "vuex"
import { getList, update,getStrainCount } from "@/api/farmplant/farmplant"
import { getList, update,getStrainCount,getStrainCountYM } from "@/api/farmplant/farmplant"
import { getFarmingCount, getFarmingStatis } from "@/api/farm/farmingrecord"
import { selectCount } from "@/api/land/land"
import { StockCount } from "@/api/stock/stock"
@@ -219,6 +237,7 @@
            total: 0,
            farmingCount: 0,
            farmPlanList: [],
            farmPlanListYM:[],
            recoveryVisible: false,
            overVisible:false,
            landVisible: false,
@@ -235,6 +254,17 @@
        ...mapGetters(["userInfo","$farmId"]),
    },
  created () {
        this.$EventBus.$on('getFarmObj', (farmObj)=>{
            // this.$nextTick(() => {
            //     this.$EventBus.$emit("setFarmId", farmObj.id);
            // });
            setTimeout(() => {
                this.$EventBus.$emit("setFarmId", farmObj.id);
            }, 100);
        })
        //初始化农场信息
        // let farmId = this.userInfo.$farmId
        this.farm.id = this.$farmId
@@ -248,12 +278,15 @@
        //本年农事操作记录,分组
        this.getFarmingStatis()
        this.StockCount()
    },
  watch: {
    '$farmId':{
      handler (newName, oldName) {
        this.farm.id = newName
          //农场概览 地块使用率
        setTimeout(() => {
        //农场概览 地块使用率
        this.getCountStatis ()
        //本年农事操作记录
        this.getFarmingCount()
@@ -262,6 +295,8 @@
        this.StockCount()
        //当前农场种养品种
        this.onLoad()
        }, 100);
      }
    }
  },
@@ -356,6 +391,14 @@
                    e.area = fixed.fixedNum(e.area)
                })
            })
            getStrainCountYM(1, 100, Object.assign(params)).then((res) => {
                const data = res.data.data.records
                this.farmPlanListYM = data
                this.farmPlanListYM.forEach((e)=>{
                    e.area = fixed.fixedNum(e.area)
                })
            })
        },
        //采收
        recovery (data) {
@@ -402,10 +445,10 @@
            })
        },
        //种植
        plant () {
        plant (item) {
            this.plantVisible = true
            this.$nextTick(() => {
                this.$refs.plant.init()
                this.$refs.plant.init(item)
            })
        },
        //农事操作
@@ -484,6 +527,13 @@
                query: data,
            })
        },
        //进入地图模式
        goToMapModel () {
            this.$router.push({
                path: `/mapPattern`,
                // query: row,
            })
        }
    },
};
</script>
src/views/wel/plant.vue
@@ -15,9 +15,9 @@
<script>
import { mapState } from "vuex";
import { getLandList } from "@/api/land/land";
import { getLandList,getLandListNoPage } from "@/api/land/land";
import { getStrainList } from "@/api/farmplant/strain";
import { save } from "@/api/farmplant/farmplant";
import { save,getList } from "@/api/farmplant/farmplant";
import { getFarmList } from "../../api/farm/farm";
export default {
  data() {
@@ -30,7 +30,7 @@
        gutter: 30,
        column: [
          {
            label: "品种",
            label: "种类",
            prop: "strainId",
            labelWidth:110,
            type:"tree",
@@ -48,7 +48,7 @@
            ],
          },
          {
            label: "品种描述",
            label: "品种",
            prop: "varieties",
            labelWidth:110,
            // rules: [
@@ -170,7 +170,7 @@
              },
            ],
          },
                    {
          {
            label: "秧苗来源农场",
            prop: "farmId",
            type: "tree",
@@ -296,9 +296,8 @@
    }),
  },
  watch: {
  "form.plantingWay": {
    "form.plantingWay": {
      handler(val) {
        console.log("plantingWay",val)
        var farmColumn = this.findObject(this.option.column,"farmId")
        var landColumn = this.findObject(this.option.column,"otherLandId")
        if(val != 0 ){
@@ -312,6 +311,19 @@
      },
      immediate: true,
    },
    "$farmId":{
      handler(val){
        this.form.farmId = this.$farmId
        //获取农地数据
        getLandList(this.$farmId).then((res)=>{
            if(res.data.code==200){
              var landIdcolumn = this.findObject(this.option.column,"landId");
              this.landList = res.data.data;
              landIdcolumn.dicData = res.data.data;
            }
        })
      }
    }
  },
  methods: {
    //计算当前时间
@@ -330,7 +342,7 @@
        //秒 getSeconds():(0 ~ 59)
        var second = date.getSeconds();
        //赋值
        this.form['time'] = year + '-'
        this.form['transplanTime'] = year + '-'
                          + this.addZero(month) + '-'
                          + this.addZero(day) + ' '
                          + this.addZero(hour) + ':'
@@ -341,12 +353,37 @@
      return s < 10 ? ('0' + s) : s;
    },
    //初始化
    init() {
    init(item) {
      var that = this;
      this.form['operator'] = this.userInfo.user_id;
      //计算当前时间
      this.getNowTime();
      var strainColumn = that.findObject(that.option.column,"strainId");
      var otherLandColumn = that.findObject(that.option.column,"otherLandId");
      if(item.strainId){
        that.form.strainId = item.strainId
        strainColumn.disabled = true
      }else{
        strainColumn.disabled = false
        that.form.farmId = that.$farmId
      }
      var params = {}
        params['tenantId'] = this.userInfo.tenant_id
        params['farmId'] = this.$farmId
        params['strainId'] = item.strainId
        // params['plantingWay'] = "2"
        getLandListNoPage(params).then((res)=>{
          var landArr = []
          res.data.data.forEach(e => {
            landArr.push({
              id:e.landId,
              landName:e.landName
            })
          });
          otherLandColumn.dicData = landArr
        })
      this.visible = true;
      var that = this;
      //获取农地数据
      getLandList(this.$farmId).then((res)=>{
          if(res.data.code==200){
vue.config.js
@@ -4,7 +4,7 @@
module.exports = {
    //路径前缀
    publicPath: "/",
    publicPath: "/zhny-web",
    lintOnSave: true,
    productionSourceMap: false,
    chainWebpack: (config) => {
@@ -39,13 +39,15 @@
    },
    //开发模式反向代理配置,生产模式请使用Nginx部署并配置反向代理
    devServer: {
        // 本地配置host生效
        disableHostCheck:true,
        port: 1888,
        proxy: {
            '/api': {
                //本地服务接口地址
                // target: 'http://192.168.0.126:89',
                target: 'http://192.168.0.207:89',
                //远程演示服务地址,可用于直接启动项目
                target: 'http://182.106.212.58:8013/api',
                // target: 'http://182.106.212.58:8013/api',
                ws: true,
                pathRewrite: {
                    '^/api': '/'
@@ -53,4 +55,4 @@
            }
        }
    }
}
}