From 335f9ce8a5efb5be1c8d7c422d2beee6fd77cd97 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 08 Jul 2022 10:13:42 +0800
Subject: [PATCH] 多农场修改
---
src/store/modules/common.js | 4
src/views/farm/farmInfoDetail.vue | 305 +++++++++++
src/router/views/index.js | 667 +++++++++++++------------
src/api/farm/farm.js | 6
src/views/farm/farmReport.vue | 2
src/views/farm/farm.vue | 554 ++++++++++++--------
6 files changed, 986 insertions(+), 552 deletions(-)
diff --git a/src/api/farm/farm.js b/src/api/farm/farm.js
index dda7036..0040bb2 100644
--- a/src/api/farm/farm.js
+++ b/src/api/farm/farm.js
@@ -46,12 +46,12 @@
}
})
}
-export const getDetails = (deptId) => {
+export const getDetails = (id) => {
return request({
url: '/api/farm/details',
method: 'get',
params: {
- deptId
+ id
}
})
-}
+}
\ No newline at end of file
diff --git a/src/router/views/index.js b/src/router/views/index.js
index 7f8e3c5..f0ecb6b 100644
--- a/src/router/views/index.js
+++ b/src/router/views/index.js
@@ -1,333 +1,344 @@
import Layout from '@/page/index/'
export default [{
- path: '/wel',
- component: Layout,
- redirect: '/wel/index',
- children: [{
- path: 'index',
- name: '首页',
- meta: {
- i18n: 'dashboard'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/wel/index')
- }, {
- path: 'dashboard',
- name: '控制台',
- meta: {
- i18n: 'dashboard',
- menu: false,
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/wel/dashboard')
- }]
-}, {
- path: '/test',
- component: Layout,
- redirect: '/test/index',
- children: [{
- path: 'index',
- name: '测试页',
- meta: {
- i18n: 'test'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/util/test')
- }]
-},
- {
- path: '/framing',
- redirect: '/farmplant/farmplant',
- component: Layout,
- children: [{
- path: 'index',
- name: '农事操作',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/farm/farmPaper')
- }]
- },
- {
- path: '/stockrecord',
- redirect: '/stockrecord/stockrecord',
- component: Layout,
- children: [{
- path: 'stockrecord',
- name: '农资记录',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/stockrecord/stockrecord')
- }]
- },
- {
- path: '/farmingrecord',
- redirect: '/farm/farmingrecord',
- component: Layout,
- children: [{
- path: 'farmingrecord',
- name: '农事记录',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/farm/farmingrecord')
- }]
- },
- {
- path: '/soldrecord',
- redirect: '/soldrecord/soldrecord',
- component: Layout,
- children: [{
- path: 'soldrecord',
- name: '已出库待使用农资',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/soldrecord/soldrecord')
- }]
- },
- {
- path: '/farmDetail',
- redirect: '/wel/farmDetail',
- component: Layout,
- children: [{
- path: '/farmDetail',
- name: '操作记录',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/wel/farmDetail')
- }]
- },
- {
- path: '/LandDetail',
- redirect: '/land/LandDetail',
- component: Layout,
- children: [{
- path: '/LandDetail',
- name: '地块详情',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/land/LandDetail')
- }]
- },
- {
- path: '/stockout',
- redirect: '/stock/stockout',
- component: Layout,
- children: [{
- path: '/stockout',
- name: '已出资待使用农资',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/stock/stockout')
- }]
- },
- {
- path: '/landMap',
- redirect: '/land/landMap',
- component: Layout,
- children: [{
- path: '/landMap',
- name: '地块位置',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/land/landMap')
- }]
- },
- {
- path: '/recovery',
- redirect: '/recovery/recovery',
- component: Layout,
- children: [{
- path: 'recovery',
- name: '采收记录',
- meta: {
- i18n: 'index',
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/recovery/recovery')
- }]
- },
- {
- path: '/dict-horizontal',
- component: Layout,
- redirect: '/dict-horizontal/index',
- children: [{
- path: 'index',
- name: '字典管理',
- meta: {
- i18n: 'dict'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal')
- }]
- }, {
- path: '/dict-vertical',
- component: Layout,
- redirect: '/dict-vertical/index',
- children: [{
- path: 'index',
- name: '字典管理',
- meta: {
- i18n: 'dict'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical')
- }]
- },
- {
- path: '/land',
- component: Layout,
- redirect: '/land/index',
- children: [{
- path: 'index',
- name: '地块管理',
- meta: {
- i18n: 'land'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/land/cs')
- }]
- },
- {
- path: '/task',
- component: Layout,
- redirect: '/task/index',
- children: [{
- path: 'index',
- name: '任务管理',
- meta: {
- i18n: 'task'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/task/task')
- }]
- },
- {
- path: '/farmproductstock',
- component: Layout,
- redirect: '/farmproductstock/index',
- children: [{
- path: 'index',
- name: '农产品库存管理',
- meta: {
- i18n: 'farmproductstock'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/farmplant/farmproductstock')
- }]
- },
- {
- path: '/stockmanage',
- component: Layout,
- redirect: '/stockmanage/index',
- children: [{
- path: 'index',
- name: '农资库存管理',
- meta: {
- i18n: 'stockmanage'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/stock/stockmanage')
- }]
- },
- {
- path: '/statistics',
- component: Layout,
- redirect: '/statistics/index',
- children: [{
- path: 'index',
- name: '数据统计',
- meta: {
- i18n: 'statistics'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/statistics/statistics')
- }]
- },
- {
- path: '/traceability',
- component: Layout,
- redirect: '/traceability/index',
- children: [{
- path: 'index',
- name: '溯源码管理',
- meta: {
- i18n: 'traceability'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/traceability/traceability')
- }]
- },
- {
- path: '/info',
- component: Layout,
- redirect: '/info/index',
- children: [{
- path: 'index',
- name: '个人信息',
- meta: {
- i18n: 'info'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/system/userinfo')
- }]
- }, {
- path: '/work/process/leave',
- component: Layout,
- redirect: '/work/process/leave/form',
- children: [{
- path: 'form/:processDefinitionId',
- name: '请假流程',
- meta: {
- i18n: 'work'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
+ path: '/wel',
+ component: Layout,
+ redirect: '/wel/index',
+ children: [{
+ path: 'index',
+ name: '首页',
+ meta: {
+ i18n: 'dashboard'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/wel/index')
+ }, {
+ path: 'dashboard',
+ name: '控制台',
+ meta: {
+ i18n: 'dashboard',
+ menu: false,
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/wel/dashboard')
+ }]
}, {
- path: 'handle/:taskId/:processInstanceId/:businessId',
- name: '处理请假流程',
- meta: {
- i18n: 'work'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
+ path: '/test',
+ component: Layout,
+ redirect: '/test/index',
+ children: [{
+ path: 'index',
+ name: '测试页',
+ meta: {
+ i18n: 'test'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/util/test')
+ }]
+ },
+ {
+ path: '/framing',
+ redirect: '/farmplant/farmplant',
+ component: Layout,
+ children: [{
+ path: 'index',
+ name: '农事操作',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/farm/farmPaper')
+ }]
+ },
+ {
+ path: '/stockrecord',
+ redirect: '/stockrecord/stockrecord',
+ component: Layout,
+ children: [{
+ path: 'stockrecord',
+ name: '农资记录',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/stockrecord/stockrecord')
+ }]
+ },
+ {
+ path: '/farmingrecord',
+ redirect: '/farm/farmingrecord',
+ component: Layout,
+ children: [{
+ path: 'farmingrecord',
+ name: '农事记录',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/farm/farmingrecord')
+ }]
+ },
+ {
+ path: '/soldrecord',
+ redirect: '/soldrecord/soldrecord',
+ component: Layout,
+ children: [{
+ path: 'soldrecord',
+ name: '已出库待使用农资',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/soldrecord/soldrecord')
+ }]
+ },
+ {
+ path: '/farmDetail',
+ redirect: '/wel/farmDetail',
+ component: Layout,
+ children: [{
+ path: '/farmDetail',
+ name: '操作记录',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/wel/farmDetail')
+ }]
+ },
+ {
+ path: '/LandDetail',
+ redirect: '/land/LandDetail',
+ component: Layout,
+ children: [{
+ path: '/LandDetail',
+ name: '地块详情',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/land/LandDetail')
+ }]
+ },
+ {
+ path: '/stockout',
+ redirect: '/stock/stockout',
+ component: Layout,
+ children: [{
+ path: '/stockout',
+ name: '已出资待使用农资',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/stock/stockout')
+ }]
+ },
+ {
+ path: '/landMap',
+ redirect: '/land/landMap',
+ component: Layout,
+ children: [{
+ path: '/landMap',
+ name: '地块位置',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/land/landMap')
+ }]
+ },
+ {
+ path: '/recovery',
+ redirect: '/recovery/recovery',
+ component: Layout,
+ children: [{
+ path: 'recovery',
+ name: '采收记录',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/recovery/recovery')
+ }]
+ },
+
+ {
+ path: '/dict-horizontal',
+ component: Layout,
+ redirect: '/dict-horizontal/index',
+ children: [{
+ path: 'index',
+ name: '字典管理',
+ meta: {
+ i18n: 'dict'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal')
+ }]
}, {
- path: 'detail/:processInstanceId/:businessId',
- name: '请假流程详情',
- meta: {
- i18n: 'work'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/detail')
- }]
- },
- {
- path: '/farm',
- component: Layout,
- redirect: '/farm/index',
- children: [{
- path: 'index',
- name: '农场信息管理',
- meta: {
- i18n: 'farm'
- },
- component: () =>
- import ( /* webpackChunkName: "views" */ '@/views/farm/farm')
- }]
- },
-]
+ path: '/dict-vertical',
+ component: Layout,
+ redirect: '/dict-vertical/index',
+ children: [{
+ path: 'index',
+ name: '字典管理',
+ meta: {
+ i18n: 'dict'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical')
+ }]
+ },
+ {
+ path: '/land',
+ component: Layout,
+ redirect: '/land/index',
+ children: [{
+ path: 'index',
+ name: '地块管理',
+ meta: {
+ i18n: 'land'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/land/cs')
+ }]
+ },
+ {
+ path: '/task',
+ component: Layout,
+ redirect: '/task/index',
+ children: [{
+ path: 'index',
+ name: '任务管理',
+ meta: {
+ i18n: 'task'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/task/task')
+ }]
+ },
+ {
+ path: '/farmproductstock',
+ component: Layout,
+ redirect: '/farmproductstock/index',
+ children: [{
+ path: 'index',
+ name: '农产品库存管理',
+ meta: {
+ i18n: 'farmproductstock'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/farmplant/farmproductstock')
+ }]
+ },
+ {
+ path: '/stockmanage',
+ component: Layout,
+ redirect: '/stockmanage/index',
+ children: [{
+ path: 'index',
+ name: '农资库存管理',
+ meta: {
+ i18n: 'stockmanage'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/stock/stockmanage')
+ }]
+ },
+ {
+ path: '/statistics',
+ component: Layout,
+ redirect: '/statistics/index',
+ children: [{
+ path: 'index',
+ name: '数据统计',
+ meta: {
+ i18n: 'statistics'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/statistics/statistics')
+ }]
+ },
+ {
+ path: '/traceability',
+ component: Layout,
+ redirect: '/traceability/index',
+ children: [{
+ path: 'index',
+ name: '溯源码管理',
+ meta: {
+ i18n: 'traceability'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/traceability/traceability')
+ }]
+ },
+ {
+ path: '/info',
+ component: Layout,
+ redirect: '/info/index',
+ children: [{
+ path: 'index',
+ name: '个人信息',
+ meta: {
+ i18n: 'info'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/system/userinfo')
+ }]
+ }, {
+ path: '/work/process/leave',
+ component: Layout,
+ redirect: '/work/process/leave/form',
+ children: [{
+ path: 'form/:processDefinitionId',
+ name: '请假流程',
+ meta: {
+ i18n: 'work'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
+ }, {
+ path: 'handle/:taskId/:processInstanceId/:businessId',
+ name: '处理请假流程',
+ meta: {
+ i18n: 'work'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
+ }, {
+ path: 'detail/:processInstanceId/:businessId',
+ name: '请假流程详情',
+ meta: {
+ i18n: 'work'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/detail')
+ }]
+ },
+ {
+ path: '/farm',
+ component: Layout,
+ redirect: '/farm/index',
+ children: [{
+ path: 'index',
+ name: '农场信息管理',
+ meta: {
+ i18n: 'farm'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/farm/farm')
+ },
+ {
+ path: 'farmInfoDetail',
+ name: '农场详情信息',
+ meta: {
+ i18n: 'index',
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/farm/farmInfoDetail')
+ }
+ ]
+ },
+]
\ No newline at end of file
diff --git a/src/store/modules/common.js b/src/store/modules/common.js
index f486046..d8cbec8 100644
--- a/src/store/modules/common.js
+++ b/src/store/modules/common.js
@@ -29,6 +29,7 @@
website: website,
//面的集和点
polygons: [],
+ polygonsFarm: ''
},
mutations: {
setpolygon: (state, data) => {
@@ -37,6 +38,9 @@
setpolygonsFarm: (state, data) => {
state.polygonsFarm = data;
},
+ clear_polygonsFarm: (state) => {
+ state.polygonsFarm = '';
+ },
SET_LANGUAGE: (state, language) => {
state.language = language
setStore({
diff --git a/src/views/farm/farm.vue b/src/views/farm/farm.vue
index 73b048f..3a00a56 100644
--- a/src/views/farm/farm.vue
+++ b/src/views/farm/farm.vue
@@ -1,217 +1,209 @@
<template>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <!-- 基本信息 -->
- <el-tab-pane label="基本信息" name="tab1">
- <basic-container>
- <avue-form
- ref="form"
- v-model="objBase"
- :option="optionBase"
- @submit="submitBase"
- >
- <!-- 地图插入 -->
- <template slot-scope="{}" slot="position">
- <getMapDataInThere
- ref="getMapData"
- id="getMapData"
- @setMapData="setMapData"
- ></getMapDataInThere>
- </template>
- </avue-form>
- </basic-container>
- </el-tab-pane>
- <!-- 检测报告信息 -->
- <el-tab-pane label="检测报告信息" name="tab2">
- <farmReport
- :farmId="farmId"
- ></farmReport>
- </el-tab-pane>
- <!-- 认证证书信息 -->
- <el-tab-pane label="认证证书信息" name="tab3">
- <farmPaper
- :farmId="farmId"
- ></farmPaper>
- </el-tab-pane>
- </el-tabs>
+ <basic-container>
+ <avue-crud
+ class="tablesss"
+ :before-open="beforeOpen"
+ :option="option"
+ :data="data"
+ :page.sync="page"
+ v-model="form"
+ ref="crud"
+ :permission="permissionList"
+ @on-load="onLoad"
+ :table-loading="loading"
+ @row-save="rowSave"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @row-update="rowUpdate"
+ @row-del="rowDel"
+ @selection-change="selectionChange"
+ @refresh-change="refreshChange"
+ >
+ <template slot="menuLeft">
+ <el-button
+ type="danger"
+ size="small"
+ plain
+ icon="el-icon-delete"
+ v-if="permission.farm_delete"
+ @click="handleDelete"
+ >删 除
+ </el-button>
+ </template>
+ <!-- 地图插入 -->
+ <template slot-scope="{ type, disabled }" slot="lineForm">
+ <getMapDataInThere
+ ref="getMapData"
+ id="getMapData"
+ @setMapData="setMapData"
+ ></getMapDataInThere>
+ </template>
+ <template slot-scope="{ type, size, row }" slot="menu">
+ <el-button
+ icon="el-icon-view"
+ type="text"
+ size="mini"
+ @click="goToFarmDetail(row)"
+ :size="size"
+ >查看
+ </el-button>
+ </template>
+ </avue-crud>
+ </basic-container>
</template>
<script>
import getMapDataInThere from "./getMapDataInThere.vue";
-import farmPaper from "./farmPaper.vue";
-import farmReport from "./farmReport.vue";
-import { update, getDetails } from "@/api/farm/farm";
+
+import { getList,add,update, remove,getDetails } from "@/api/farm/farm";
import { mapGetters } from "vuex";
export default {
components: {
- getMapDataInThere,
- farmPaper,
- farmReport
+ getMapDataInThere
},
data() {
return {
- farmId:"",
- activeName: "tab1",
- objBase: {},
- optionBase: {
- emptyBtn: false,
- submitText: "保存",
- gutter: 30,
- group: [
- {
- icon: "",
- label: "农场基本信息",
- collapse: true,
- prop: "group1",
- column: [
- {
- label: "",
- labelWidth: 20,
- type: "title",
- prop: "title",
- span: 24,
- styles: {
- fontSize: "24px",
- },
- },
- {
- label: "农场名称",
- prop: "farmName",
- span: 12,
- labelWidth: 145,
- rules: [
- {
- required: true,
- message: "请输入农场名称",
- trigger: "blur",
- },
- ],
- },
- {
- label: "农场地址",
- prop: "farmAddress",
- span: 12,
- labelWidth: 145,
- width: 110,
- rules: [
- {
- required: true,
- message: "请输入农场地址",
- trigger: "click",
- },
- ],
- },
- {
- label: "农场面积",
- prop: "farmArea",
- span: 12,
- labelWidth: 145,
- width: 110,
- rules: [
- {
- required: true,
- message: "请输入农场面积",
- trigger: "click",
- },
- ],
- },
- ],
- },
- {
- icon: "",
- label: "农场介绍",
- prop: "group2",
- column: [
- {
- label: "口号",
- prop: "slogan",
- span: 12,
- labelWidth: 145,
- rules: [
- {
- required: true,
- message: "请输入口号",
- trigger: "blur",
- },
- ],
- },
- {
- label: "介绍",
- type: "textarea",
- prop: "introduce",
- span: 24,
- labelWidth: 145,
- rules: [
- {
- required: true,
- message: "请输入介绍",
- trigger: "blur",
- },
- ],
- },
- {
- label: "农场环境图片",
- prop: "picture",
- type: "upload",
- labelWidth: 145,
- dataType: "string",
- span: 24,
- limit: 5,
- listType: "picture-card",
- tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
- canvasOption: {
- text: "",
- ratio: 1.0,
- },
- propsHttp: {
- res: "data",
- url: "url"
- },
- action: "/api/blade-resource/oss/endpoint/put-files"
- },
- {
- label: "农场位置",
- prop: "position",
- className: "mapClass",
- span: 24,
- formslot: true,
- labelWidth: 145,
- },
- ],
- },
- ],
+ loading: true,
+ selectionList: [],
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
},
+ form: {},
+ query: {},
+ data: [],
+ option: {
+ index: true,
+ tip: false,
+ addBtn: true,
+ searchMenuSpan: 6,
+ height: 583,
+ menuWidth: 300,
+ border: true,
+ viewBtn:false,
+ align: "center",
+ selection: true,
+ column: [
+ {
+ label: "农场名称",
+ search: true,
+ prop: "farmName",
+ labelWidth: 145,
+ rules: [{
+ required: true,
+ message: "请输入农场名称",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "农场地址",
+ prop: "farmAddress",
+ rules: [{
+ required: true,
+ message: "请输入农场地址",
+ trigger: "blur"
+ }],
+ labelWidth: 145,
+ overHidden:true
+ },
+
+ {
+ label: "农场面积",
+ prop: "farmArea",
+ labelWidth: 145,
+ rules: [{
+ required: true,
+ message: "请输入农场面积",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "口号",
+ prop: "slogan",
+ labelWidth: 145,
+ rules: [{
+ required: true,
+ message: "请输入农场口号",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "介绍",
+ prop: "introduce",
+ type:"textarea",
+ span: 24,
+ labelWidth: 145,
+ rules: [{
+ required: true,
+ message: "请输入农场介绍",
+ trigger: "blur"
+ }],
+ overHidden:true
+ },
+ {
+ label: "农场环境图片",
+ prop: "picture",
+ type: "upload",
+ labelWidth: 145,
+ dataType: "string",
+ span: 24,
+ limit: 5,
+ listType: "picture-card",
+ tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
+ canvasOption: {
+ text: "",
+ ratio: 1.0,
+ },
+ propsHttp: {
+ res: "data",
+ url: "url"
+ },
+ action: "/api/blade-resource/oss/endpoint/put-files"
+ },
+ {
+ label: "路线展示",
+ labelWidth: 145,
+ prop: "line",
+ className: "mapClass",
+ hide: true,
+ display: true,
+ span: 24,
+ formslot: true,
+ addDisplay: true
+ }
+ ],
+ }
};
+ },
+ created() {
+ // this.getRailLazyTree();
},
computed: {
...mapGetters(["userInfo", "permission", "polygonsFarm"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.farm_delete, false),
+ viewBtn: this.vaildData(this.permission.farm_delete, false),
+ delBtn: this.vaildData(this.permission.farm_delete, false),
+ editBtn: this.vaildData(this.permission.farm_delete, false)
+ };
+ },
+ ids() {
+ let ids = [];
+ this.selectionList.forEach(ele => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ }
},
mounted() {
- var that = this;
- this.$nextTick(() => {
- getDetails(this.userInfo.dept_id).then((res) => {
- console.log( res.data.data,123)
- if (res.data.code == 200) {
- that.objBase = res.data.data;
- that.farmId = that.objBase.id;
- let usePolygons = that.objBase.position
- .split("POLYGON((")[1]
- .split("))")[0]
- .split(",");
- for (let k in usePolygons) {
- usePolygons[k] = {
- lng: +usePolygons[k].split(" ")[0],
- lat: +usePolygons[k].split(" ")[1],
- };
- }
- this.$refs.getMapData.draw(usePolygons);
- }
- });
- });
},
methods: {
- //农场基本信息提交
- submitBase(form, loading, done) {
+ rowSave(row, done, loading) {
+ row['tenantId'] = this.userInfo.tenant_id;
+ row['deptId'] = this.userInfo.dept_id;
if (this.polygonsFarm.length == 0) {
//没有面的数据
this.$refs.getMapData.isCheck = true;
@@ -228,10 +220,41 @@
}
}
//设置坐标点
- form.position = usePolygons;
+ row.position = usePolygons;
+ }
+ add(row).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ done();
+ }, error => {
+ loading();
+ window.console.log(error);
+ });
+ },
+ rowUpdate(row, index, done, loading) {
+ if (this.polygonsFarm.length == 0) {
+ //没有面的数据
+ this.$refs.getMapData.isCheck = true;
+ loading();
+ } else {
+ //如果有值,空间坐标转换
+ let pol = this.polygonsFarm;
+ let polLength = this.polygonsFarm.length - 1;
+ let usePolygons = "";
+ for (let k in pol) {
+ usePolygons += pol[k].lng + "," + pol[k].lat;
+ if (k != polLength) {
+ usePolygons += ";";
+ }
+ }
+ //设置坐标点
+ row.position = usePolygons;
}
// 修改
- update(form).then((res) => {
+ update(row).then((res) => {
if (res.data.success) {
this.$message({
message: "操作成功",
@@ -248,39 +271,130 @@
}
});
},
- setMapData(val) {
- this.LineData = val[0];
- this.PointData = val[1];
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ });
},
- },
- watch: {},
+ 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) {
+ //先清空面的数据
+ this.$store.commit('clear_polygonsFarm');
+ if (["edit", "view"].includes(type)) {
+ getDetails(this.form.id).then((res) => {
+ if (res.data.code == 200) {
+ this.form = res.data.data;
+ let usePolygons = this.form.position
+ .split("POLYGON((")[1]
+ .split("))")[0]
+ .split(",");
+ for (let k in usePolygons) {
+ usePolygons[k] = {
+ lng: +usePolygons[k].split(" ")[0],
+ lat: +usePolygons[k].split(" ")[1],
+ };
+ }
+ this.$refs.getMapData.draw(usePolygons);
+ }
+ });
+ }
+ done();
+ },
+ //查看农场详情
+ goToFarmDetail(row) {
+ this.$router.push({
+ path: `/farm/farmInfoDetail`,
+ query: row
+ });
+ },
+ 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 lang="scss" scoped>
+<style lang="scss">
+
.mapClass div label {
display: none;
}
-#getMapData {
- width: 80%;
- position: relative;
- height: 500px;
- top: 10px;
+.mapClassMain {
+ padding-left: 5rem !important;
}
-// .el-collapse-item {
-// padding-top: 15px !important;
-// }
-// .tab {
-// position: relative;
-// // border: 1px solid red;
-// background-color: #fff;
-// height: 92%;
-// display: inline-block;
-// width: 100%;
-// overflow: hidden;
-// top: -10px;
-// }
-</style>
+#getMapData {
+ width: calc(100% + 90px);
+ position: relative;
+ left: -90px;
+ height: 400px;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/farm/farmInfoDetail.vue b/src/views/farm/farmInfoDetail.vue
new file mode 100644
index 0000000..36f7e8b
--- /dev/null
+++ b/src/views/farm/farmInfoDetail.vue
@@ -0,0 +1,305 @@
+<template>
+ <el-tabs v-model="activeName" @tab-click="handleClick">
+ <!-- 基本信息 -->
+ <el-tab-pane label="基本信息" name="tab1">
+ <basic-container>
+ <avue-form
+ ref="form"
+ v-model="objBase"
+ :option="optionBase"
+ @submit="submitBase"
+ >
+ <!-- 地图插入 -->
+ <template slot-scope="{}" slot="position">
+ <getMapDataInThere
+ ref="getMapData"
+ id="getMapData"
+ @setMapData="setMapData"
+ ></getMapDataInThere>
+ </template>
+ </avue-form>
+ </basic-container>
+ </el-tab-pane>
+ <!-- 检测报告信息 -->
+ <el-tab-pane label="检测报告信息" name="tab2">
+ <farmReport
+ :farmId="farmId"
+ ></farmReport>
+ </el-tab-pane>
+ <!-- 认证证书信息 -->
+ <el-tab-pane label="认证证书信息" name="tab3">
+ <farmPaper
+ :farmId="farmId"
+ ></farmPaper>
+ </el-tab-pane>
+ </el-tabs>
+</template>
+
+<script>
+import getMapDataInThere from "./getMapDataInThere.vue";
+import farmPaper from "./farmPaper.vue";
+import farmReport from "./farmReport.vue";
+import { update, getDetails } from "@/api/farm/farm";
+import { mapGetters } from "vuex";
+
+export default {
+ components: {
+ getMapDataInThere,
+ farmPaper,
+ farmReport
+ },
+ data() {
+ return {
+ farmId:"",
+ activeName: "tab1",
+ objBase: {},
+ optionBase: {
+ emptyBtn: false,
+ submitText: "保存",
+ gutter: 30,
+ group: [
+ {
+ icon: "",
+ label: "农场基本信息",
+ collapse: true,
+ prop: "group1",
+ column: [
+ {
+ label: "",
+ labelWidth: 20,
+ type: "title",
+ prop: "title",
+ span: 24,
+ styles: {
+ fontSize: "24px",
+ },
+ },
+ {
+ label: "农场名称",
+ prop: "farmName",
+ span: 12,
+ labelWidth: 145,
+ rules: [
+ {
+ required: true,
+ message: "请输入农场名称",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "农场地址",
+ prop: "farmAddress",
+ span: 12,
+ labelWidth: 145,
+ width: 110,
+ rules: [
+ {
+ required: true,
+ message: "请输入农场地址",
+ trigger: "click",
+ },
+ ],
+ },
+ {
+ label: "农场面积",
+ prop: "farmArea",
+ span: 12,
+ labelWidth: 145,
+ width: 110,
+ rules: [
+ {
+ required: true,
+ message: "请输入农场面积",
+ trigger: "click",
+ },
+ ],
+ },
+ ],
+ },
+ {
+ icon: "",
+ label: "农场介绍",
+ prop: "group2",
+ column: [
+ {
+ label: "口号",
+ prop: "slogan",
+ span: 12,
+ labelWidth: 145,
+ rules: [
+ {
+ required: true,
+ message: "请输入口号",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "介绍",
+ type: "textarea",
+ prop: "introduce",
+ span: 24,
+ labelWidth: 145,
+ rules: [
+ {
+ required: true,
+ message: "请输入介绍",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "农场环境图片",
+ prop: "picture",
+ type: "upload",
+ labelWidth: 145,
+ dataType: "string",
+ span: 24,
+ limit: 5,
+ listType: "picture-card",
+ tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
+ canvasOption: {
+ text: "",
+ ratio: 1.0,
+ },
+ propsHttp: {
+ res: "data",
+ url: "url"
+ },
+ action: "/api/blade-resource/oss/endpoint/put-files"
+ },
+ {
+ label: "农场位置",
+ prop: "position",
+ className: "mapClass",
+ span: 24,
+ formslot: true,
+ labelWidth: 145,
+ },
+ ],
+ },
+ ],
+ },
+ };
+ },
+ computed: {
+ ...mapGetters(["userInfo", "permission", "polygonsFarm"]),
+ },
+ created(){
+ this.farmId = this.$route.query.id;
+ },
+ mounted() {
+ var flag = false,
+ i = 0,
+ ind = null;
+ this.$store.state.tags.tagList.forEach((item, index) => {
+ if (item.label == "农场详情信息") {
+ if (flag == false) {
+ ind = index;
+ flag = true;
+ }
+ i++;
+ }
+ });
+ if (i > 1) {
+ this.$store.state.tags.tagList.splice(ind, 1);
+ }
+ var that = this;
+ //先清空面的数据
+ this.$store.commit('clear_polygonsFarm');
+ this.$nextTick(() => {
+ getDetails(this.$route.query.id).then((res) => {
+ if (res.data.code == 200) {
+ that.objBase = res.data.data;
+ that.farmId = that.objBase.id;
+ let usePolygons = that.objBase.position
+ .split("POLYGON((")[1]
+ .split("))")[0]
+ .split(",");
+ for (let k in usePolygons) {
+ usePolygons[k] = {
+ lng: +usePolygons[k].split(" ")[0],
+ lat: +usePolygons[k].split(" ")[1],
+ };
+ }
+ this.$refs.getMapData.draw(usePolygons);
+ }
+ });
+ });
+ },
+ methods: {
+ //农场基本信息提交
+ submitBase(form, loading, done) {
+ if (this.polygonsFarm.length == 0) {
+ //没有面的数据
+ this.$refs.getMapData.isCheck = true;
+ loading();
+ } else {
+ //如果有值,空间坐标转换
+ let pol = this.polygonsFarm;
+ let polLength = this.polygonsFarm.length - 1;
+ let usePolygons = "";
+ for (let k in pol) {
+ usePolygons += pol[k].lng + "," + pol[k].lat;
+ if (k != polLength) {
+ usePolygons += ";";
+ }
+ }
+ //设置坐标点
+ form.position = usePolygons;
+ }
+ // 修改
+ update(form).then((res) => {
+ if (res.data.success) {
+ this.$message({
+ message: "操作成功",
+ type: "success",
+ });
+ this.refreshChange();
+ done();
+ } else {
+ this.$message({
+ message: "操作失败",
+ type: "warning",
+ });
+ done();
+ }
+ });
+ },
+ setMapData(val) {
+ this.LineData = val[0];
+ this.PointData = val[1];
+ },
+ },
+ watch: {},
+};
+</script>
+
+<style lang="scss" scoped>
+.mapClass div label {
+ display: none;
+}
+
+#getMapData {
+ width: 80%;
+ position: relative;
+ height: 500px;
+ top: 10px;
+}
+
+// .el-collapse-item {
+// padding-top: 15px !important;
+// }
+
+// .tab {
+// position: relative;
+// // border: 1px solid red;
+// background-color: #fff;
+// height: 92%;
+// display: inline-block;
+// width: 100%;
+// overflow: hidden;
+// top: -10px;
+// }
+</style>
diff --git a/src/views/farm/farmReport.vue b/src/views/farm/farmReport.vue
index 712bc80..5b48fbf 100644
--- a/src/views/farm/farmReport.vue
+++ b/src/views/farm/farmReport.vue
@@ -155,7 +155,7 @@
methods: {
//新增
rowSave(row, done, loading) {
- row["deptId"] = this.userInfo.dept_id;
+ row["deptId"] = this.farmId;
row["type"] = 1;
save(row).then(
() => {
--
Gitblit v1.9.3