智慧农业后台管理页面
shuishen
2022-07-29 e57c42d8338904f0045a72665f2ad43b5012cc53
map修改
8 files modified
1 files added
19650 ■■■■■ changed files
package-lock.json 17361 ●●●●● patch | view | raw | blame | history
package.json 3 ●●●●● patch | view | raw | blame | history
public/index.html 62 ●●●● patch | view | raw | blame | history
src/components/map/plotMap.vue 346 ●●●●● patch | view | raw | blame | history
src/main.js 113 ●●●●● patch | view | raw | blame | history
src/views/mapPattern/index.vue 735 ●●●● patch | view | raw | blame | history
src/views/process/process.vue 477 ●●●● patch | view | raw | blame | history
src/views/retrieval/retrieval.vue 531 ●●●● patch | view | raw | blame | history
vue.config.js 22 ●●●●● patch | view | raw | blame | history
package-lock.json
Diff too large
package.json
@@ -11,11 +11,13 @@
    "test:e2e": "vue-cli-service test:e2e"
  },
  "dependencies": {
    "@dvgis/dc-sdk": "^2.15.0",
    "avue-plugin-ueditor": "^0.1.4",
    "axios": "^0.18.0",
    "babel-polyfill": "^6.26.0",
    "classlist-polyfill": "^1.2.0",
    "crypto-js": "^4.0.0",
    "dom-to-image": "^2.6.0",
    "echarts": "^5.0.2",
    "element-china-area-data": "^5.0.2",
    "element-ui": "^2.15.6",
@@ -23,6 +25,7 @@
    "js-base64": "^2.5.1",
    "js-cookie": "^2.2.0",
    "js-md5": "^0.7.3",
    "leaflet": "^1.8.0",
    "mockjs": "^1.0.1-beta3",
    "node-gyp": "^5.0.6",
    "nprogress": "^0.2.0",
public/index.html
@@ -4,7 +4,7 @@
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv="X-UA-Compatible" content="chrome=1"/>
  <meta http-equiv="X-UA-Compatible" content="chrome=1" />
  <meta name="renderer" content="webkit">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
  <meta name="apple-mobile-web-app-capable" content="yes">
@@ -21,11 +21,10 @@
  <!-- 地图 -->
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <script src="libs/Cesium/Cesium.js"></script>
  <script type="text/javascript" src="js/drawTree.js"></script>
  <!-- Avue地图选点 -->
  <script type="text/javascript"
          src='https://webapi.amap.com/maps?v=1.4.11&key=7ab53b28352e55dc5754699add0ad862&plugin=AMap.PlaceSearch'></script>
    src='https://webapi.amap.com/maps?v=1.4.11&key=7ab53b28352e55dc5754699add0ad862&plugin=AMap.PlaceSearch'></script>
  <script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
  <script src="https://cdn.staticfile.org/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
  <script src="https://cdn.staticfile.org/xlsx/0.18.2/xlsx.full.min.js"></script>
@@ -64,7 +63,7 @@
      padding: 1em 0;
    }
    .avue-home__footer > a {
    .avue-home__footer>a {
      font-size: 12px;
      color: #ABABAB;
      text-decoration: none;
@@ -86,41 +85,42 @@
      color: #ABABAB;
      font-size: 12px;
    }
  </style>
</head>
<body>
<noscript>
  <strong>
    很抱歉,如果没有 JavaScript 支持,Saber 将不能正常工作。请启用浏览器的 JavaScript 然后继续。
  </strong>
</noscript>
<div id="app">
  <div class="avue-home">
    <div class="avue-home__main">
      <img class="avue-home__loading" src="<%= BASE_URL %>svg/loading-spin.svg" alt="loading">
      <div class="avue-home__title">
        正在加载资源
  <noscript>
    <strong>
      很抱歉,如果没有 JavaScript 支持,Saber 将不能正常工作。请启用浏览器的 JavaScript 然后继续。
    </strong>
  </noscript>
  <div id="app">
    <div class="avue-home">
      <div class="avue-home__main">
        <img class="avue-home__loading" src="<%= BASE_URL %>svg/loading-spin.svg" alt="loading">
        <div class="avue-home__title">
          正在加载资源
        </div>
        <div class="avue-home__sub-title d">
          初次加载资源可能需要较多时间 请耐心等待
        </div>
      </div>
      <div class="avue-home__sub-title d">
        初次加载资源可能需要较多时间 请耐心等待
      <div class="avue-home__footer">
        <a href="https://bladex.vip" target="_blank">
          https://bladex.vip </a>
      </div>
    </div>
    <div class="avue-home__footer">
      <a href="https://bladex.vip" target="_blank">
        https://bladex.vip </a>
    </div>
  </div>
</div>
<!-- built files will be auto injected -->
<script src="<%= BASE_URL %>util/aes.js" charset="utf-8"></script>
<script src="<%= BASE_URL %>cdn/vue/2.6.10/vue.min.js" charset="utf-8"></script>
<script src="<%= BASE_URL %>cdn/vuex/3.1.1/vuex.min.js" charset="utf-8"></script>
<script src="<%= BASE_URL %>cdn/vue-router/3.0.1/vue-router.min.js" charset="utf-8"></script>
<script src="<%= BASE_URL %>cdn/axios/1.0.0/axios.min.js" charset="utf-8"></script>
<script src="<%= BASE_URL %>cdn/element-ui/2.15.6/index.js" charset="utf-8"></script>
<script src="<%= BASE_URL %>cdn/avue/2.9.5/avue.min.js" charset="utf-8"></script>
<script src="<%= BASE_URL %>cdn/nutflow/wf-design-base/index.umd.min.js" charset="utf-8"></script>
  <!-- built files will be auto injected -->
  <script src="<%= BASE_URL %>util/aes.js" charset="utf-8"></script>
  <script src="<%= BASE_URL %>cdn/vue/2.6.10/vue.min.js" charset="utf-8"></script>
  <script src="<%= BASE_URL %>cdn/vuex/3.1.1/vuex.min.js" charset="utf-8"></script>
  <script src="<%= BASE_URL %>cdn/vue-router/3.0.1/vue-router.min.js" charset="utf-8"></script>
  <script src="<%= BASE_URL %>cdn/axios/1.0.0/axios.min.js" charset="utf-8"></script>
  <script src="<%= BASE_URL %>cdn/element-ui/2.15.6/index.js" charset="utf-8"></script>
  <script src="<%= BASE_URL %>cdn/avue/2.9.5/avue.min.js" charset="utf-8"></script>
  <script src="<%= BASE_URL %>cdn/nutflow/wf-design-base/index.umd.min.js" charset="utf-8"></script>
</body>
</html>
src/components/map/plotMap.vue
New file
@@ -0,0 +1,346 @@
/* eslint-disable camelcase */
<template>
    <div>
        <div id="viewer-container" style="height: 100%; width: 100%"></div>
    </div>
</template>
<script>
var farmRegionLayer = null
var plotRegionLayer = null
var farmLogoLayer = null
var addLayers = []
var addPlotLayers = []
export default {
    name: 'mapBox',
    data () {
        return {
        }
    },
    computed: {
    },
    mounted () {
        if (global.viewer != null) {
            global.viewer = null
        }
        function initViewer () {
            global.viewer = new global.DC.Viewer('viewer-container', {
                contextOptions: {
                    webgl: {
                        alpha: true,
                        stencil: true,
                        preserveDrawingBuffer: true
                    }
                },
                sceneMode: 2
            })
            farmRegionLayer = new global.DC.VectorLayer('farmRegionLayer')
            global.viewer.addLayer(farmRegionLayer)
            plotRegionLayer = new global.DC.VectorLayer('plotRegionLayer')
            global.viewer.addLayer(plotRegionLayer)
            farmLogoLayer = new global.DC.HtmlLayer('farmLogoLayer')
            global.viewer.addLayer(farmLogoLayer)
            if (global.DC.Namespace.Cesium.FeatureDetection.supportsImageRenderingPixelated()) { // 判断是否支持图像渲染像素化处理
                global.viewer.setOptions({
                    resolutionScale: window.devicePixelRatio
                })
            }
            // 影像
            global.viewer.imageryLayers.addImageryProvider(
                new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
                    url: 'http://t{s}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0',
                    subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
                    format: 'image/jpeg',
                    show: true,
                    maximumLevel: 18
                })
            )
            // http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengdom/MapServer
            global.viewer.imageryLayers.addImageryProvider(
                new global.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
                    url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengyjjddom/MapServer/WMTS',
                    // url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengdom/MapServer/WMTS',
                    layer: 'nanchengyjjddom',
                    style: 'default',
                    tileMatrixSetID: 'default028mm',
                    format: 'image/png',
                    tilingScheme: new global.DC.Namespace.Cesium.GeographicTilingScheme(),
                    maximumLevel: 19,
                    tileMatrixLabels: [
                        '0',
                        '1',
                        '2',
                        '3',
                        '4',
                        '5',
                        '6',
                        '7',
                        '8',
                        '9',
                        '10',
                        '11',
                        '12',
                        '13',
                        '14',
                        '15',
                        '16',
                        '17',
                        '18',
                        '19'
                    ]
                })
            )
            global.viewer.imageryLayers.addImageryProvider(
                new global.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
                    url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengdom/MapServer/WMTS',
                    // url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengdom/MapServer/WMTS',
                    layer: 'nanchengdom',
                    style: 'default',
                    tileMatrixSetID: 'default028mm',
                    format: 'image/png',
                    tilingScheme: new global.DC.Namespace.Cesium.GeographicTilingScheme(),
                    maximumLevel: 19,
                    tileMatrixLabels: [
                        '0',
                        '1',
                        '2',
                        '3',
                        '4',
                        '5',
                        '6',
                        '7',
                        '8',
                        '9',
                        '10',
                        '11',
                        '12',
                        '13',
                        '14',
                        '15',
                        '16',
                        '17',
                        '18',
                        '19'
                    ]
                })
            )
            // 矢量电子
            // global.viewer.imageryLayers.addImageryProvider(
            //     new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
            //         url: 'http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0',
            //         subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
            //         format: 'image/jpeg',
            //         show: true,
            //         maximumLevel: 18
            //     })
            // )
            // global.viewer.imageryLayers.addImageryProvider(
            //     new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
            //         url: 'http://t{s}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0',
            //         subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
            //         format: 'image/jpeg',
            //         show: true,
            //         maximumLevel: 18
            //     })
            // )
            global.viewer.camera.setView({
                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                    116.56705776, 27.42386903, 1800.0
                ),
                orientation: {
                    // 指向
                    heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
                    // 视角
                    pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
                    roll: 0.0
                }
            })
            // global.viewer.locationBar.enable = true
        }
        global.DC.ready(initViewer)
    },
    methods: {
        addPolygon (positions, item) {
            const that = this
            const center = this.getCenter(positions)
            const divIcon = new global.DC.DivIcon(
                new global.DC.Position(center[0], center[1], 0),
                `
                        <div class="farm-map-icon">
                            <img src="/img/icon/3858.png" alt="">
                            <div>${item.farmName}</div>
                        </div>
                        `
            )
            divIcon.attrParams = item
            farmLogoLayer.addOverlay(divIcon)
            divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
                that.$parent.showDetailPopup(e.overlay.attrParams)
            })
            const polygon = new global.DC.Polygon(positions)
            polygon.setStyle({
                material: global.DC.Namespace.Cesium.Color.fromBytes(
                    244, 157, 21,
                    200
                )
            })
            farmRegionLayer.addOverlay(polygon)
            addLayers.push({ center, name: item.farmName })
        },
        addPlotPolygon (positions, item) {
            const that = this
            const center = this.getCenter(positions)
            // const divIcon = new global.DC.DivIcon(
            //     new global.DC.Position(center[0], center[1], 0),
            //     `
            //             <div class="farm-map-icon">
            //                 <img src="/img/icon/3858.png" alt="">
            //                 // <div>${item.farmName}</div>
            //             </div>
            //             `
            // )
            // divIcon.attrParams = item
            // farmLogoLayer.addOverlay(divIcon)
            // divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
            //     that.$parent.showDetailPopup(e.overlay.attrParams)
            // })
            const polygon = new global.DC.Polygon(positions)
            polygon.attrParams = item
            polygon.setStyle({
                material: global.DC.Namespace.Cesium.Color.fromBytes(
                    129, 255, 84,
                    200
                )
            })
            polygon.on(global.DC.MouseEventType.CLICK, (e) => {
                that.$parent.plotDetailsPopupShow(e.overlay.attrParams)
            })
            plotRegionLayer.addOverlay(polygon)
            addPlotLayers.push({ center, name: item.landName })
        },
        setCenter (name) {
            let center
            addLayers.forEach(item => {
                if (name == item.name) {
                    center = item.center
                }
            })
            global.viewer.camera.flyTo({
                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                    center[0], center[1], 3000.0
                ),
                orientation: {
                    // 指向
                    heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
                    // 视角
                    pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
                    roll: 0.0
                }
            })
        },
        setPlotCenter (name) {
            let center
            addPlotLayers.forEach(item => {
                if (name == item.name) {
                    center = item.center
                }
            })
            global.viewer.camera.flyTo({
                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                    center[0], center[1], 3000.0
                ),
                orientation: {
                    // 指向
                    heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
                    // 视角
                    pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
                    roll: 0.0
                }
            })
        },
        // 经纬度测算中心位置
        getCenter (arr) {
            let centerLonLat = []
            if (arr.length) {
                const lon = []
                const lat = []
                const poly = []
                for (let i = 0, len = arr.length; i < len; i++) {
                    lon.push(arr[i][0])
                    lat.push(arr[i][1])
                }
                for (let i = 0, len = lon.length; i < len; i++) {
                    poly.push({
                        x: parseFloat(lon[i]),
                        y: parseFloat(lat[i]),
                        z: 0
                    })
                }
                const sortedLongitudeArray = poly.map(item => item.x).sort()
                const sortedLatitudeArray = poly.map(item => item.y).sort()
                const centerLongitude = ((parseFloat(sortedLongitudeArray[0]) + parseFloat(sortedLongitudeArray[sortedLongitudeArray.length - 1])) / 2).toFixed(14)
                const centerLatitude = ((parseFloat(sortedLatitudeArray[0]) + parseFloat(sortedLatitudeArray[sortedLatitudeArray.length - 1])) / 2).toFixed(14)
                console.log(centerLongitude, centerLatitude)
                centerLonLat = [Number(centerLongitude), Number(centerLatitude)]
            }
            return centerLonLat
        }
    }
}
</script>
<style lang="scss" scope>
.eagle-eye-map {
    position: fixed;
    right: 10px;
    bottom: 10px;
    border: 5px solid orange;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    z-index: 99;
    overflow: hidden;
}
</style>
src/main.js
@@ -1,78 +1,99 @@
import Vue from 'vue';
import axios from './router/axios';
import VueAxios from 'vue-axios';
import App from './App';
import router from './router/router';
import './permission'; // 权限
import './error'; // 日志
import './cache'; //页面缓存
import store from './store';
import Vue from 'vue'
import axios from './router/axios'
import VueAxios from 'vue-axios'
import App from './App'
import router from './router/router'
import './permission' // 权限
import './error' // 日志
import './cache' //页面缓存
import store from './store'
import { loadStyle } from './util/util'
import * as urls from '@/config/env';
import Element from 'element-ui';
import * as urls from '@/config/env'
import Element from 'element-ui'
import {
    iconfontUrl,
    iconfontVersion
} from '@/config/env';
import i18n from './lang'; // Internationalization
import './styles/common.scss';
import basicBlock from './components/basic-block/main';
import basicContainer from './components/basic-container/main';
import thirdRegister from './components/third-register/main';
import flowDesign from './components/flow-design/main';
import avueUeditor from 'avue-plugin-ueditor';
import website from '@/config/website';
import crudCommon from '@/mixins/crud';
} from '@/config/env'
import i18n from './lang' // Internationalization
import './styles/common.scss'
import basicBlock from './components/basic-block/main'
import basicContainer from './components/basic-container/main'
import thirdRegister from './components/third-register/main'
import flowDesign from './components/flow-design/main'
import avueUeditor from 'avue-plugin-ueditor'
import website from '@/config/website'
import crudCommon from '@/mixins/crud'
// 业务组件
import tenantPackage from './views/system/tenantpackage';
import tenantPackage from './views/system/tenantpackage'
import Map from './components/map/main';
import * as echarts from 'echarts';
Vue.prototype.$echarts = echarts;
Vue.component('Map', Map);
import Map from './components/map/main'
import plotMap from './components/map/plotMap'
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts
Vue.component('Map', Map)
Vue.component('plotMap', plotMap)
import DC from '@dvgis/dc-sdk/dist/dc.base.min' // 基础包
import DcCore from '@dvgis/dc-sdk/dist/dc.core.min' // 核心包
import DcChart from '@dvgis/dc-sdk/dist/dc.chart.min' // chart包
import DcMapv from '@dvgis/dc-sdk/dist/dc.mapv.min' // mapv包
import DcS3M from '@dvgis/dc-sdk/dist/dc.s3m.min' // DcS3M包
import '@dvgis/dc-sdk/dist/dc.core.min.css'
global.DC = DC // 将DC提升到全局变量,方便在工程中直接使用
global.viewer = null // 将viewer提升到全局变量,方便在工程中直接使用
global.echarts = echarts // 将DC提升到全局变量,方便在工程中直接使用
DC.use(DcCore) // 安装DC核心库
DC.use(DcChart) // 安装DC图标库,使用前确保echarts为全局函数
DC.use(DcMapv) // 安装Mapv库
DC.use(DcS3M) // 安装DcS3M库
// 注册全局crud驱动
window.$crudCommon = crudCommon;
window.$crudCommon = crudCommon
// 加载Vue拓展
Vue.use(router);
Vue.use(VueAxios, axios);
Vue.use(router)
Vue.use(VueAxios, axios)
Vue.use(Element, {
    i18n: (key, value) => i18n.t(key, value)
});
})
Vue.use(window.AVUE, {
    size: 'small',
    tableSize: 'small',
    calcHeight: 65,
    i18n: (key, value) => i18n.t(key, value)
});
})
// 注册全局容器
Vue.component('basicContainer', basicContainer);
Vue.component('basicBlock', basicBlock);
Vue.component('thirdRegister', thirdRegister);
Vue.component('avueUeditor', avueUeditor);
Vue.component('flowDesign', flowDesign);
Vue.component('tenantPackage', tenantPackage);
Vue.component('basicContainer', basicContainer)
Vue.component('basicBlock', basicBlock)
Vue.component('thirdRegister', thirdRegister)
Vue.component('avueUeditor', avueUeditor)
Vue.component('flowDesign', flowDesign)
Vue.component('tenantPackage', tenantPackage)
//加载全局组件选地图定位点,每个页面都要使用
import chousePoint from './components/mapOncePoint/chousePoint'
Vue.component("chousePoint", chousePoint);
Vue.component("chousePoint", chousePoint)
// 加载相关url地址
Object.keys(urls).forEach(key => {
    Vue.prototype[key] = urls[key];
});
    Vue.prototype[key] = urls[key]
})
// 加载NutFlow
Vue.use(window.WfDesignBase);
Vue.use(window.WfDesignBase)
// 加载website
Vue.prototype.website = website;
Vue.prototype.website = website
// 动态加载阿里云字体库
iconfontVersion.forEach(ele => {
    loadStyle(iconfontUrl.replace('$key', ele));
});
    loadStyle(iconfontUrl.replace('$key', ele))
})
Vue.config.productionTip = false;
Vue.config.productionTip = false
new Vue({
    router,
    store,
    i18n,
    render: h => h(App)
}).$mount('#app');
}).$mount('#app')
src/views/mapPattern/index.vue
@@ -1,413 +1,436 @@
<template>
  <div style="width: 1920px;
        height: 1080px;
        background: #FFFFFF;
        border-radius: 0px 0px 0px 0px;
        opacity: 1;">
    <div class="top">
      <div class="logo">
        <img src="../../../public/mg.png" />
      </div>
      <div class="farm-info">
        <div class="farm-name">
          <span>{{ farmInfo.farmName }}</span>
        </div>
        <div class="farm-area">
          <span>地块总面积:</span>
          <span style="font-size: 16px;font-weight: bold;">&nbsp;{{landAreaInfo.zarea}}亩</span>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <span>在田面积:</span>
          <span style="font-size: 16px;font-weight: bold;">&nbsp;{{landAreaInfo.sarea}}亩</span>
        </div>
      </div>
      <div class="out" @click="goToBack">
        <img src="../../../public/img/out.png" />
        <span>&nbsp;&nbsp;退出</span>
      </div>
    </div>
    <div class="down">
      <div class="farm-plant">
        <div class="title"><span>种养品种 · {{ this.page.total }}种</span></div>
        <div class="content">
          <div class="list-item" v-for="item in farmPlantList">
            <div class="item-img">
              <img :src="item.url" />
              <span>{{ item.strainName }}</span>
    <div style="position: relative; height: 100%;">
        <plot-map ref="plotMap" style="position: absolute; width: 100%; height: 100%;"></plot-map>
        <div class="top">
            <div class="logo">
                <img src="../../../public/mg.png" />
            </div>
            <div class="item-num">{{ item.area }}亩</div>
          </div>
        </div>
      </div>
      <div class="land-info">
        <div class="content">
          <span>有轮廓的地块:</span><span style="font-size: 26px;font-weight: bold;color: #5ABF78;"> &nbsp;{{landIsAreaStatistic[0]}}</span>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <span>无轮廓的地块:</span><span style="font-size: 26px;font-weight: bold;color: #E3B745;"> &nbsp;{{landIsAreaStatistic[1]}}</span>
        </div>
      </div>
      <div class="farm-land">
        <div class="title"><span>地块 · {{ this.pageLand.total }}种</span></div>
        <div class="content">
          <div class="list-item" v-for="item in landList">
            <div class="item-img">
              <img :src="item.url" />
              <span>{{ item.landName }}</span>
            <div class="farm-info">
                <div class="farm-name">
                    <span>{{ farmInfo.farmName }}</span>
                </div>
                <div class="farm-area">
                    <span>地块总面积:</span>
                    <span style="font-size: 16px;font-weight: bold;">&nbsp;{{landAreaInfo.zarea}}亩</span>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span>在田面积:</span>
                    <span style="font-size: 16px;font-weight: bold;">&nbsp;{{landAreaInfo.sarea}}亩</span>
                </div>
            </div>
            <div class="item-num">{{ item.landArea }}亩</div>
          </div>
            <div class="out" @click="goToBack">
                <img src="../../../public/img/out.png" />
                <span>&nbsp;&nbsp;退出</span>
            </div>
        </div>
      </div>
        <div class="farm-plant">
            <div class="title">
                <span>种养品种 · {{ this.page.total }}种</span>
            </div>
            <div class="content">
                <div class="list-item" v-for="(item, index) in farmPlantList" :key="index">
                    <div class="item-img">
                        <img :src="item.url" />
                        <span>{{ item.strainName }}</span>
                    </div>
                    <div class="item-num">{{ item.area }}亩</div>
                </div>
            </div>
        </div>
        <div class="land-info">
            <div class="content">
                <span>有轮廓的地块:</span>
                <span
                    style="font-size: 26px;font-weight: bold;color: #5ABF78;"
                >&nbsp;{{landIsAreaStatistic[0]}}</span>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <span>无轮廓的地块:</span>
                <span
                    style="font-size: 26px;font-weight: bold;color: #E3B745;"
                >&nbsp;{{landIsAreaStatistic[1]}}</span>
            </div>
        </div>
        <div class="farm-land">
            <div class="title">
                <span>地块 · {{ this.pageLand.total }}种</span>
            </div>
            <div class="content">
                <div class="list-item" v-for="(item, index) in landList" :key="index">
                    <div class="item-img">
                        <img :src="item.url" />
                        <span>{{ item.landName }}</span>
                    </div>
                    <div class="item-num">{{ item.landArea }}亩</div>
                </div>
            </div>
        </div>
    </div>
  </div>
</template>
<script>
import { mapGetters } from "vuex"
import { getList } from "@/api/farmplant/farmplant";
import { getList as getLandList, selectCount,getLandIsAreaStatistic } from "@/api/land/land";
import { getDetails } from "@/api/farm/farm";
import { getList } from "@/api/farmplant/farmplant"
import { getList as getLandList, selectCount, getLandIsAreaStatistic } from "@/api/land/land"
import { getDetails } from "@/api/farm/farm"
export default {
  components: {
  },
  data() {
    return {
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      pageLand: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      farmPlantList: [],
      landList: [],
      farmInfo: {},
      landAreaInfo:{},
      landIsAreaStatistic:null,
    }
    components: {
    },
    data () {
        return {
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            pageLand: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            farmPlantList: [],
            landList: [],
            farmInfo: {},
            landAreaInfo: {},
            landIsAreaStatistic: null,
        }
  },
  computed: {
    ...mapGetters(["userInfo"]),
  },
  created() {
    //获取种样品列表
    this.getFarmPlantList(this.page);
    //获取地块列表
    this.getLandList(this.pageLand);
    //获取农场信息
    this.getFarmInfo();
    //获取统计面积信息
    this.getLandCount();
    //获取地块轮廓统计信息
    this.getLandIsAreaStatistic();
  },
  methods: {
    //获取种养品列表
    getFarmPlantList(page, params = {}) {
      params['farmId'] = this.userInfo.farmId;
      this.loading = true;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.farmPlantList = data.records;
        this.loading = false;
        this.selectionClear();
      });
    },
    //获取地块列表
    getLandList(page, params = {}) {
      params['farmId'] = this.userInfo.farmId;
      params['tenantId'] = this.userInfo.tenant_id;
      this.loading = true;
      getLandList(
        page.currentPage,
        page.pageSize,
        Object.assign(params)
      ).then((res) => {
        const data = res.data.data;
        this.pageLand.total = data.total;
        this.landList = data.records;
        this.loading = false;
        this.selectionClear();
      });
    computed: {
        ...mapGetters(["userInfo"]),
    },
    //返回上一页
    goToBack() {
      this.$router.go(-1)
    created () {
        //获取种样品列表
        this.getFarmPlantList(this.page)
        //获取地块列表
        this.getLandList(this.pageLand)
        //获取农场信息
        this.getFarmInfo()
        //获取统计面积信息
        this.getLandCount()
        //获取地块轮廓统计信息
        this.getLandIsAreaStatistic()
    },
    //获取农场信息
    getFarmInfo() {
      var that = this;
      getDetails(this.userInfo.farmId).then(res => {
        that.farmInfo = res.data.data;
      })
    },
    //获取统计面积信息
    getLandCount() {
      selectCount(this.userInfo.farmId).then(res => {
        this.landAreaInfo = res.data.data;
      })
    },
    //获取地块轮廓统计信息
    getLandIsAreaStatistic(){
       getLandIsAreaStatistic(this.userInfo.farmId).then(res=>{
          this.landIsAreaStatistic = res.data.data;
       })
    methods: {
        //获取种养品列表
        getFarmPlantList (page, params = {}) {
            params['farmId'] = this.userInfo.farmId
            this.loading = true
            getList(
                page.currentPage,
                page.pageSize,
                Object.assign(params)
            ).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.farmPlantList = data.records
                this.loading = false
                // this.selectionClear()
            })
        },
        //获取地块列表
        getLandList (page, params = {}) {
            params['farmId'] = this.userInfo.farmId
            params['tenantId'] = this.userInfo.tenant_id
            this.loading = true
            getLandList(
                page.currentPage,
                page.pageSize,
                Object.assign(params)
            ).then((res) => {
                const data = res.data.data
                data.records.forEach(item => {
                    if (item.landRange != '' || item.landRange != null) {
                        item.landRange = item.landRange.replace(/POLYGON\(\(/g, '')
                        item.landRange = item.landRange.replace(/\)\)/g, '')
                        const arr = item.landRange.split(',')
                        var brr = []
                        arr.forEach(it => {
                            brr.push(it.split(' '))
                        })
                        this.$refs.plotMap.addPlotPolygon(brr, item)
                    }
                })
                this.pageLand.total = data.total
                this.landList = data.records
                this.loading = false
                // this.selectionClear()
            })
        },
        //返回上一页
        goToBack () {
            this.$router.go(-1)
        },
        //获取农场信息
        getFarmInfo () {
            var that = this
            getDetails(this.userInfo.farmId).then(res => {
                that.farmInfo = res.data.data
            })
        },
        //获取统计面积信息
        getLandCount () {
            selectCount(this.userInfo.farmId).then(res => {
                this.landAreaInfo = res.data.data
            })
        },
        //获取地块轮廓统计信息
        getLandIsAreaStatistic () {
            getLandIsAreaStatistic(this.userInfo.farmId).then(res => {
                this.landIsAreaStatistic = res.data.data
            })
        }
    }
  }
}
</script>
<style lang="scss" scope>
.top {
  width: 100%;
  height: 80px;
  background: #000000;
  border-radius: 0px 0px 0px 0px;
  opacity: 0.5;
  .logo {
    position: absolute;
    left: 36px;
    top: 12px;
    img {
      height: 55px;
    }
  }
  .farm-info {
    height: 100%;
    top: 0;
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9;
    .farm-name {
      width: 100%;
      height: 33px;
      font-size: 25px;
      font-weight: bold;
      color: #5ABF78;
      text-align: center;
      padding-top: 13px;
    .logo {
        position: absolute;
        left: 36px;
        top: 12px;
        img {
            height: 55px;
        }
    }
    .farm-area {
      width: 100%;
      height: 19px;
      font-size: 14px;
      font-weight: 400;
      color: #FFFFFF;
      text-align: center;
      padding-top: 6px;
    }
  }
    .farm-info {
        height: 100%;
        width: 100%;
  .out {
    width: 136px;
    height: 33px;
    line-height: 33px;
    background: rgba(236, 95, 89, 0.8000);
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    border: 1px solid #EC5F59;
    position: absolute;
    top: 24px;
    right: 33px;
    text-align: center;
    cursor: pointer;
        .farm-name {
            width: 100%;
            height: 33px;
            font-size: 25px;
            font-weight: bold;
            color: #5abf78;
            text-align: center;
            padding-top: 13px;
        }
    img {
      width: 12px;
      height: 18px;
      position: relative;
      top: 4px;
    }
    span {
      font-size: 14px;
      color: #FFFFFF;
      font-weight: 400;
    }
  }
}
.down {
  width: 100%;
  .farm-plant {
    width: 292px;
    height: 550px;
    position: absolute;
    left: 30px;
    top: 242px;
    .title {
      width: 292px;
      height: 50px;
      background: #5ABF78;
      border-radius: 4px 4px 0px 0px;
      opacity: 1;
      line-height: 50px;
      font-size: 17px;
      font-weight: bold;
      color: #FFFFFF;
      span {
        margin-left: 20px;
      }
    }
    .content {
      width: 292px;
      // height: 500px;
      background: #08551E;
      border-radius: 4px 4px 0px 0px;
      opacity: 0.9;
      padding-bottom: 30px;
      .list-item {
        width: 252px;
        margin: auto;
        display: flex;
        height: 64px;
        line-height: 64px;
        border-bottom: 1px solid #cccccc;
        flex-flow: row nowrap;
        justify-content: space-between;
        .item-img {
          margin-left: 5px;
          display: flex;
          img {
            margin-top: 12px;
            width: 40px;
            height: 40px;
            background: #2389EF;
            border-radius: 84px 84px 84px 84px;
            opacity: 1;
          }
          span {
            margin-left: 11px;
        .farm-area {
            width: 100%;
            height: 19px;
            font-size: 14px;
            font-weight: 400;
            color: #FFFFFF;
          }
            color: #ffffff;
            text-align: center;
            padding-top: 6px;
        }
        .item-num {
          font-size: 14px;
          font-weight: 400;
          color: #FFFFFF;
        }
      }
    }
    .out {
        width: 136px;
        height: 33px;
        line-height: 33px;
        background: rgba(236, 95, 89, 0.8);
        border-radius: 4px 4px 4px 4px;
        opacity: 1;
        border: 1px solid #ec5f59;
        position: absolute;
        top: 24px;
        right: 33px;
        text-align: center;
        cursor: pointer;
  }
        img {
            width: 12px;
            height: 18px;
            position: relative;
            top: 4px;
        }
  .land-info{
        span {
            font-size: 14px;
            color: #ffffff;
            font-weight: 400;
        }
    }
}
.land-info {
    width: 100%;
    position: absolute;
    top: 112px;
    .content{
      margin: auto;
      width: 431px;
      height: 56px;
      background: #000000;
      border-radius: 28px 28px 28px 28px;
      opacity: 0.5;
      display: flex;
      justify-content: center;
      align-items:center;
      font-size: 16px;
      font-weight: 400;
      color: #FFFFFF;
    .content {
        margin: auto;
        width: 431px;
        height: 56px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 28px 28px 28px 28px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 16px;
        font-weight: 400;
        color: #ffffff;
    }
  }
}
  .farm-land {
.farm-plant {
    position: absolute;
    left: 30px;
    top: 242px;
    z-index: 99;
    width: 292px;
    height: 550px;
    .title {
        width: 292px;
        height: 50px;
        background: #5abf78;
        border-radius: 4px 4px 0px 0px;
        opacity: 1;
        line-height: 50px;
        font-size: 17px;
        font-weight: bold;
        color: #ffffff;
        span {
            margin-left: 20px;
        }
    }
    .content {
        width: 292px;
        height: calc(100% - 50px);
        background: rgba(8, 85, 30, 0.9);
        // height: 500px;
        border-radius: 4px 4px 0px 0px;
        opacity: 0.9;
        padding-bottom: 30px;
        overflow-x: hidden;
        overflow-y: auto;
        .list-item {
            width: 252px;
            margin: auto;
            display: flex;
            height: 64px;
            line-height: 64px;
            border-bottom: 1px solid #cccccc;
            flex-flow: row nowrap;
            justify-content: space-between;
            .item-img {
                margin-left: 5px;
                display: flex;
                img {
                    margin-top: 12px;
                    width: 40px;
                    height: 40px;
                    background: #2389ef;
                    border-radius: 84px 84px 84px 84px;
                    opacity: 1;
                }
                span {
                    margin-left: 11px;
                    font-size: 14px;
                    font-weight: 400;
                    color: #ffffff;
                }
            }
            .item-num {
                font-size: 14px;
                font-weight: 400;
                color: #ffffff;
            }
        }
    }
}
.farm-land {
    position: absolute;
    right: 30px;
    top: 242px;
    .title {
      width: 292px;
      height: 50px;
      background: #5ABF78;
      border-radius: 4px 4px 0px 0px;
      opacity: 1;
      line-height: 50px;
      font-size: 17px;
      font-weight: bold;
      color: #FFFFFF;
    z-index: 99;
      span {
        margin-left: 20px;
      }
    width: 292px;
    height: 550px;
    .title {
        width: 292px;
        height: 50px;
        background: #5abf78;
        border-radius: 4px 4px 0px 0px;
        opacity: 1;
        line-height: 50px;
        font-size: 17px;
        font-weight: bold;
        color: #ffffff;
        span {
            margin-left: 20px;
        }
    }
    .content {
      width: 292px;
      // height: 500px;
      background: #08551E;
      border-radius: 4px 4px 0px 0px;
      opacity: 0.9;
      padding-bottom: 30px;
        width: 292px;
        height: calc(100% - 50px);
        background: rgba(8, 85, 30, 0.9);
        // height: 500px;
      .list-item {
        width: 252px;
        margin: auto;
        display: flex;
        height: 64px;
        line-height: 64px;
        border-bottom: 1px solid #cccccc;
        flex-flow: row nowrap;
        justify-content: space-between;
        border-radius: 4px 4px 0px 0px;
        opacity: 0.9;
        padding-bottom: 30px;
        .item-img {
          margin-left: 5px;
          display: flex;
        overflow-x: hidden;
        overflow-y: auto;
          img {
            margin-top: 12px;
            width: 40px;
            height: 40px;
            background: #2389EF;
            border-radius: 84px 84px 84px 84px;
            opacity: 1;
          }
        .list-item {
            width: 252px;
            margin: auto;
            display: flex;
            height: 64px;
            line-height: 64px;
            border-bottom: 1px solid #cccccc;
            flex-flow: row nowrap;
            justify-content: space-between;
          span {
            margin-left: 11px;
            font-size: 14px;
            font-weight: 400;
            color: #FFFFFF;
          }
            .item-img {
                margin-left: 5px;
                display: flex;
                img {
                    margin-top: 12px;
                    width: 40px;
                    height: 40px;
                    background: #2389ef;
                    border-radius: 84px 84px 84px 84px;
                    opacity: 1;
                }
                span {
                    margin-left: 11px;
                    font-size: 14px;
                    font-weight: 400;
                    color: #ffffff;
                }
            }
            .item-num {
                font-size: 14px;
                font-weight: 400;
                color: #ffffff;
            }
        }
        .item-num {
          font-size: 14px;
          font-weight: 400;
          color: #FFFFFF;
        }
      }
    }
  }
}
</style>
src/views/process/process.vue
@@ -1,253 +1,256 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.process_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud
            :option="option"
            :table-loading="loading"
            :data="data"
            :page.sync="page"
            :permission="permissionList"
            :before-open="beforeOpen"
            v-model="form"
            ref="crud"
            @row-update="rowUpdate"
            @row-save="rowSave"
            @row-del="rowDel"
            @search-change="searchChange"
            @search-reset="searchReset"
            @selection-change="selectionChange"
            @current-change="currentChange"
            @size-change="sizeChange"
            @refresh-change="refreshChange"
            @on-load="onLoad"
        >
            <template slot="menuLeft">
                <el-button
                    type="danger"
                    size="small"
                    icon="el-icon-delete"
                    plain
                    v-if="permission.process_delete"
                    @click="handleDelete"
                >删 除</el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/process/process";
  import {mapGetters} from "vuex";
import { getList, getDetail, addjg, update, remove } from "@/api/process/process"
import { mapGetters } from "vuex"
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "品种id",
              prop: "strainId",
              rules: [{
                required: true,
                message: "请输入品种id",
                trigger: "blur"
              }]
export default {
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: "加工时间",
              prop: "saleTime",
              rules: [{
                required: true,
                message: "请输入加工时间",
                trigger: "blur"
              }]
            selectionList: [],
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "品种id",
                        prop: "strainId",
                        rules: [{
                            required: true,
                            message: "请输入品种id",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "加工时间",
                        prop: "saleTime",
                        rules: [{
                            required: true,
                            message: "请输入加工时间",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "加工数量",
                        prop: "saleNum",
                        rules: [{
                            required: true,
                            message: "请输入加工数量",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "加工产品id",
                        prop: "processId",
                        rules: [{
                            required: true,
                            message: "请输入加工产品id",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "产品数量",
                        prop: "processNum",
                        rules: [{
                            required: true,
                            message: "请输入产品数量",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "地块id",
                        prop: "landId",
                        rules: [{
                            required: true,
                            message: "请输入地块id",
                            trigger: "blur"
                        }]
                    },
                ]
            },
            {
              label: "加工数量",
              prop: "saleNum",
              rules: [{
                required: true,
                message: "请输入加工数量",
                trigger: "blur"
              }]
            },
            {
              label: "加工产品id",
              prop: "processId",
              rules: [{
                required: true,
                message: "请输入加工产品id",
                trigger: "blur"
              }]
            },
            {
              label: "产品数量",
              prop: "processNum",
              rules: [{
                required: true,
                message: "请输入产品数量",
                trigger: "blur"
              }]
            },
            {
              label: "地块id",
              prop: "landId",
              rules: [{
                required: true,
                message: "请输入地块id",
                trigger: "blur"
              }]
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.process_add, false),
          viewBtn: this.vaildData(this.permission.process_view, false),
          delBtn: this.vaildData(this.permission.process_delete, false),
          editBtn: this.vaildData(this.permission.process_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.process_add, false),
                viewBtn: this.vaildData(this.permission.process_view, false),
                delBtn: this.vaildData(this.permission.process_delete, false),
                editBtn: this.vaildData(this.permission.process_edit, false)
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        rowSave (row, done, loading) {
            addjg(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                loading()
                window.console.log(error)
            })
        },
        rowUpdate (row, index, done, loading) {
            update(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                loading()
                console.log(error)
            })
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getDetail(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            this.loading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
};
</script>
<style>
src/views/retrieval/retrieval.vue
@@ -1,280 +1,283 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.retrieval_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud
            :option="option"
            :table-loading="loading"
            :data="data"
            :page.sync="page"
            :permission="permissionList"
            :before-open="beforeOpen"
            v-model="form"
            ref="crud"
            @row-update="rowUpdate"
            @row-save="rowSave"
            @row-del="rowDel"
            @search-change="searchChange"
            @search-reset="searchReset"
            @selection-change="selectionChange"
            @current-change="currentChange"
            @size-change="sizeChange"
            @refresh-change="refreshChange"
            @on-load="onLoad"
        >
            <template slot="menuLeft">
                <el-button
                    type="danger"
                    size="small"
                    icon="el-icon-delete"
                    plain
                    v-if="permission.retrieval_delete"
                    @click="handleDelete"
                >删 除</el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/retrieval/retrieval";
  import {mapGetters} from "vuex";
import { getList, getDetail, addck, update, remove } from "@/api/retrieval/retrieval"
import { mapGetters } from "vuex"
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "品种id",
              prop: "strainId",
              rules: [{
                required: true,
                message: "请输入品种id",
                trigger: "blur"
              }]
export default {
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: "出库时间",
              prop: "saleTime",
              rules: [{
                required: true,
                message: "请输入出库时间",
                trigger: "blur"
              }]
            selectionList: [],
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "品种id",
                        prop: "strainId",
                        rules: [{
                            required: true,
                            message: "请输入品种id",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "出库时间",
                        prop: "saleTime",
                        rules: [{
                            required: true,
                            message: "请输入出库时间",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "出库数量",
                        prop: "saleNum",
                        rules: [{
                            required: true,
                            message: "请输入出库数量",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "出库去向(省)",
                        prop: "saleDestination",
                        rules: [{
                            required: true,
                            message: "请输入出库去向(省)",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "具体出库去向",
                        prop: "saleDestination1",
                        rules: [{
                            required: true,
                            message: "请输入具体出库去向",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "出库备注",
                        prop: "remarks",
                        rules: [{
                            required: true,
                            message: "请输入出库备注",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "出库去向(市)",
                        prop: "city",
                        rules: [{
                            required: true,
                            message: "请输入出库去向(市)",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "出库去向(县)",
                        prop: "county",
                        rules: [{
                            required: true,
                            message: "请输入出库去向(县)",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "地块id",
                        prop: "landId",
                        rules: [{
                            required: true,
                            message: "请输入地块id",
                            trigger: "blur"
                        }]
                    },
                ]
            },
            {
              label: "出库数量",
              prop: "saleNum",
              rules: [{
                required: true,
                message: "请输入出库数量",
                trigger: "blur"
              }]
            },
            {
              label: "出库去向(省)",
              prop: "saleDestination",
              rules: [{
                required: true,
                message: "请输入出库去向(省)",
                trigger: "blur"
              }]
            },
            {
              label: "具体出库去向",
              prop: "saleDestination1",
              rules: [{
                required: true,
                message: "请输入具体出库去向",
                trigger: "blur"
              }]
            },
            {
              label: "出库备注",
              prop: "remarks",
              rules: [{
                required: true,
                message: "请输入出库备注",
                trigger: "blur"
              }]
            },
            {
              label: "出库去向(市)",
              prop: "city",
              rules: [{
                required: true,
                message: "请输入出库去向(市)",
                trigger: "blur"
              }]
            },
            {
              label: "出库去向(县)",
              prop: "county",
              rules: [{
                required: true,
                message: "请输入出库去向(县)",
                trigger: "blur"
              }]
            },
            {
              label: "地块id",
              prop: "landId",
              rules: [{
                required: true,
                message: "请输入地块id",
                trigger: "blur"
              }]
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.retrieval_add, false),
          viewBtn: this.vaildData(this.permission.retrieval_view, false),
          delBtn: this.vaildData(this.permission.retrieval_delete, false),
          editBtn: this.vaildData(this.permission.retrieval_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.retrieval_add, false),
                viewBtn: this.vaildData(this.permission.retrieval_view, false),
                delBtn: this.vaildData(this.permission.retrieval_delete, false),
                editBtn: this.vaildData(this.permission.retrieval_edit, false)
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        rowSave (row, done, loading) {
            addck(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                loading()
                window.console.log(error)
            })
        },
        rowUpdate (row, index, done, loading) {
            update(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                loading()
                console.log(error)
            })
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getDetail(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            this.loading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
};
</script>
<style>
vue.config.js
@@ -1,9 +1,29 @@
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const dvgisDist = './node_modules/@dvgis'
module.exports = {
    //路径前缀
    publicPath: "/",
    lintOnSave: true,
    productionSourceMap: false,
    chainWebpack: (config) => {
        config.plugin('copy').use(CopywebpackPlugin, [
            [
                {
                    from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
                    to: 'libs/dc-sdk/resources'
                }
                // {
                //     from: './public/wp',
                //     to: 'wp'
                // },
                // {
                //     from: './public/qx',
                //     to: 'qx'
                // }
            ]
        ])
        //忽略的打包文件
        config.externals({
            'vue': 'Vue',
@@ -26,7 +46,7 @@
        proxy: {
            '/api': {
                //本地服务接口地址
                // target: 'http://localhost:89',
                // target: 'http://192.168.0.126:89',
                //远程演示服务地址,可用于直接启动项目
                target: 'http://182.106.212.58:8013/api',
                ws: true,