智慧农业后台管理页面
Administrator
2022-05-30 d3f76a799401c8dd687dc786bfb656eaffba908a
农资库存页面调整,新增数据统计页面
4 files modified
4 files added
1884 ■■■■ changed files
src/router/views/index.js 614 ●●●● patch | view | raw | blame | history
src/styles/element-ui.scss 42 ●●●● patch | view | raw | blame | history
src/views/farm/farm.vue 26 ●●●● patch | view | raw | blame | history
src/views/statistics/farmplantarea.vue 379 ●●●●● patch | view | raw | blame | history
src/views/statistics/farmproductstockstatistics.vue 379 ●●●●● patch | view | raw | blame | history
src/views/statistics/statistics.vue 55 ●●●●● patch | view | raw | blame | history
src/views/statistics/stock.vue 379 ●●●●● patch | view | raw | blame | history
src/views/stock/stockmanage.vue 10 ●●●●● patch | view | raw | blame | history
src/router/views/index.js
@@ -1,305 +1,319 @@
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: '/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: '/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: '/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')
        }]
    },
]
src/styles/element-ui.scss
@@ -82,27 +82,27 @@
.el-pagination.is-background .el-pager li:not(.disabled):hover {
    color: #5abf78 !important;
}
// .avue-crud__right {
//     display: none;
// }
.farming-detail-box {
  .dv {
    .el-tabs {
      height: 100%;
      .el-tabs__header {
        .el-tabs__nav {
          transform: translateX(60px) !important;
    .dv {
        .el-tabs {
            height: 100%;
            .el-tabs__header {
                .el-tabs__nav {
                    transform: translateX(60px) !important;
                }
            }
            .el-tabs__content {
                height: calc(100% - 75px);
                overflow-y: auto;
            }
        }
      }
      .el-tabs__content {
        height: calc(100% - 75px);
        overflow-y: auto;
      }
    }
  }
  .el-dialog__body {
    position: relative;
    height: 60%;
  }
}
    .el-dialog__body {
        position: relative;
        height: 60%;
    }
}
src/views/farm/farm.vue
@@ -268,18 +268,18 @@
  top: 10px;
}
.el-collapse-item {
  padding-top: 15px !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;
}
// .tab {
//   position: relative;
//   // border: 1px solid red;
//   background-color: #fff;
//   height: 92%;
//   display: inline-block;
//   width: 100%;
//   overflow: hidden;
//   top: -10px;
// }
</style>
src/views/statistics/farmplantarea.vue
New file
@@ -0,0 +1,379 @@
<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"
    >
    </avue-crud>
  </basic-container>
</template>
<script>
import {
  getDetail,
  getList,
  update,
  remove,
  save,
} from "@/api/farmplant/farmproductstock";
import { getStrainList } from "@/api/farmplant/strain";
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      visible: true,
      form: {},
      query: {},
      loading: true,
      excelBox: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        height: 520,
        editBtn: false,
        addBtn: false,
        delBtn: true,
        viewBtn: true,
        menuWidth: 200,
        menuAlign: "center",
        align: "center",
        selection: false,
        showSummary: true,
        indexFixed: false,
        selectionFixed: false,
        expandFixed: false,
        menuFixed: false,
        menu:false,
        sumColumnList: [
          {
            label: "合计",
            name: "strainId",
          },
          {
            name: "weight",
            type: "sum",
          },
        ],
        column: [
          {
            label: "农产品名称",
            prop: "strainId",
            span: 12,
            search: true,
            searchSpan: 4,
            searchLabelWidth: 100,
            type: "tree",
            dicData: [],
            props: {
              label: "strainName",
              value: "id",
            },
            labelWidth: 145,
            rules: [
              {
                required: true,
                message: "请输入农产品名称",
                trigger: "blur",
              },
            ],
            disabled: true,
          },
          {
            label: "农产品图片",
            prop: "url",
            span: 12,
            addDisplay: false,
            editDisplay: false,
            type: "upload",
            dataType: "string",
            listType: "picture-card",
            labelWidth: 145,
            rules: [
              {
                required: true,
                message: "请上传农产品图片",
                trigger: "click",
              },
            ],
          },
          {
            label: "库存重量/公斤",
            prop: "weight",
            tip: "公斤",
            span: 12,
            labelWidth: 145,
            controls: false,
            type: "number",
            rules: [
              {
                required: true,
                message: "请输入库存重量 公斤",
                trigger: "click",
              },
            ],
          },
          {
            label: "采收时间",
            prop: "time",
            addDisplay: false,
            editDisplay: false,
            span: 12,
            labelWidth: 145,
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            rules: [
              {
                required: true,
                message: "请选择采收时间",
                trigger: "click",
              },
            ],
          },
          // {
          //   label: "操作人",
          //   prop: "operator",
          //   type: "tree",
          //   dicData: [],
          //   props: {
          //     label: "realName",
          //     value: "id",
          //   },
          //   span: 12,
          //   labelWidth: 145,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入操作人",
          //       trigger: "click",
          //     },
          //   ],
          // },
          {
            label: "产品等级",
            prop: "leaves",
            span: 12,
            labelWidth: 145,
            search: true,
            searchSpan: 4,
            type: "select",
            dicData: [
              {
                label: "一等品",
                value: "0",
              },
              {
                label: "二等品",
                value: "1",
              },
              {
                label: "三等品",
                value: "2",
              },
              {
                label: "四等品",
                value: "3",
              },
              {
                label: "五等品",
                value: "4",
              },
            ],
            rules: [
              {
                required: true,
                message: "请输入产品等级",
                trigger: "click",
              },
            ],
          },
        ],
      },
      data: [],
    };
  },
  created() {
    this.initData();
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    // permissionList() {
    //   return {
    //     addBtn: this.vaildData(this.permission.social_add, true),
    //     viewBtn: this.vaildData(this.permission.social_view, false),
    //     delBtn: this.vaildData(this.permission.social_delete, false),
    //     editBtn: this.vaildData(this.permission.social_edit, false),
    //   };
    // },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  mounted() {},
  methods: {
    initData() {
      var that = this;
      //获取农产品数据
      getStrainList(0).then((res) => {
        if (res.data.code == 200) {
          var strainId = that.findObject(that.option.column, "strainId");
          strainId.dicData = res.data.data;
        }
      });
    },
    //新增
    rowSave(row, done, loading) {
      row["strainType"] = 0;
      save(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();
      });
    },
  },
};
</script>
<style>
</style>
src/views/statistics/farmproductstockstatistics.vue
New file
@@ -0,0 +1,379 @@
<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"
    >
    </avue-crud>
  </basic-container>
</template>
<script>
import {
  getDetail,
  getList,
  update,
  remove,
  save,
} from "@/api/farmplant/farmproductstock";
import { getStrainList } from "@/api/farmplant/strain";
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      visible: true,
      form: {},
      query: {},
      loading: true,
      excelBox: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        height: 520,
        editBtn: false,
        addBtn: false,
        delBtn: true,
        viewBtn: true,
        menuWidth: 200,
        menuAlign: "center",
        align: "center",
        selection: false,
        showSummary: true,
        indexFixed: false,
        selectionFixed: false,
        expandFixed: false,
        menuFixed: false,
        menu:false,
        sumColumnList: [
          {
            label: "合计",
            name: "strainId",
          },
          {
            name: "weight",
            type: "sum",
          },
        ],
        column: [
          {
            label: "农产品名称",
            prop: "strainId",
            span: 12,
            search: true,
            searchSpan: 4,
            searchLabelWidth: 100,
            type: "tree",
            dicData: [],
            props: {
              label: "strainName",
              value: "id",
            },
            labelWidth: 145,
            rules: [
              {
                required: true,
                message: "请输入农产品名称",
                trigger: "blur",
              },
            ],
            disabled: true,
          },
          {
            label: "农产品图片",
            prop: "url",
            span: 12,
            addDisplay: false,
            editDisplay: false,
            type: "upload",
            dataType: "string",
            listType: "picture-card",
            labelWidth: 145,
            rules: [
              {
                required: true,
                message: "请上传农产品图片",
                trigger: "click",
              },
            ],
          },
          {
            label: "库存重量/公斤",
            prop: "weight",
            tip: "公斤",
            span: 12,
            labelWidth: 145,
            controls: false,
            type: "number",
            rules: [
              {
                required: true,
                message: "请输入库存重量 公斤",
                trigger: "click",
              },
            ],
          },
          {
            label: "采收时间",
            prop: "time",
            addDisplay: false,
            editDisplay: false,
            span: 12,
            labelWidth: 145,
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            rules: [
              {
                required: true,
                message: "请选择采收时间",
                trigger: "click",
              },
            ],
          },
          // {
          //   label: "操作人",
          //   prop: "operator",
          //   type: "tree",
          //   dicData: [],
          //   props: {
          //     label: "realName",
          //     value: "id",
          //   },
          //   span: 12,
          //   labelWidth: 145,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入操作人",
          //       trigger: "click",
          //     },
          //   ],
          // },
          {
            label: "产品等级",
            prop: "leaves",
            span: 12,
            labelWidth: 145,
            search: true,
            searchSpan: 4,
            type: "select",
            dicData: [
              {
                label: "一等品",
                value: "0",
              },
              {
                label: "二等品",
                value: "1",
              },
              {
                label: "三等品",
                value: "2",
              },
              {
                label: "四等品",
                value: "3",
              },
              {
                label: "五等品",
                value: "4",
              },
            ],
            rules: [
              {
                required: true,
                message: "请输入产品等级",
                trigger: "click",
              },
            ],
          },
        ],
      },
      data: [],
    };
  },
  created() {
    this.initData();
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    // permissionList() {
    //   return {
    //     addBtn: this.vaildData(this.permission.social_add, true),
    //     viewBtn: this.vaildData(this.permission.social_view, false),
    //     delBtn: this.vaildData(this.permission.social_delete, false),
    //     editBtn: this.vaildData(this.permission.social_edit, false),
    //   };
    // },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  mounted() {},
  methods: {
    initData() {
      var that = this;
      //获取农产品数据
      getStrainList(0).then((res) => {
        if (res.data.code == 200) {
          var strainId = that.findObject(that.option.column, "strainId");
          strainId.dicData = res.data.data;
        }
      });
    },
    //新增
    rowSave(row, done, loading) {
      row["strainType"] = 0;
      save(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();
      });
    },
  },
};
</script>
<style>
</style>
src/views/statistics/statistics.vue
New file
@@ -0,0 +1,55 @@
<template>
  <div class="statistics-body">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <!-- 种植记录 -->
      <el-tab-pane label="农资出入库统计" name="tab1">
        <stock
        ></stock>
      </el-tab-pane>
      <!-- 农事记录 -->
      <el-tab-pane label="产量统计" name="tab2">
        <farmproductstockstatistics
        ></farmproductstockstatistics>
      </el-tab-pane>
      <!-- 采收记录 -->
      <el-tab-pane label="播种面积统计" name="tab3">
        <farmplantarea
        ></farmplantarea>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import stock from "./stock.vue";
import farmproductstockstatistics from "./farmproductstockstatistics.vue";
import farmplantarea from "./farmplantarea.vue";
import { mapGetters } from "vuex";
export default {
  components: {
    stock,
    farmproductstockstatistics,
    farmplantarea
  },
  data() {
    return {
      farmId:"",
      activeName: "tab1",
    };
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
  },
  created(){
    // this.activeName = this.$route.query.activeName;
  },
  methods: {
  },
  watch: {},
};
</script>
<style lang="scss" scoped>
</style>
src/views/statistics/stock.vue
New file
@@ -0,0 +1,379 @@
<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"
    >
    </avue-crud>
  </basic-container>
</template>
<script>
import {
  getDetail,
  getList,
  update,
  remove,
  save,
} from "@/api/farmplant/farmproductstock";
import { getStrainList } from "@/api/farmplant/strain";
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      visible: true,
      form: {},
      query: {},
      loading: true,
      excelBox: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        height: 520,
        editBtn: false,
        addBtn: false,
        delBtn: true,
        viewBtn: true,
        menuWidth: 200,
        menuAlign: "center",
        align: "center",
        selection: false,
        showSummary: true,
        indexFixed: false,
        selectionFixed: false,
        expandFixed: false,
        menuFixed: false,
        menu:false,
        sumColumnList: [
          {
            label: "合计",
            name: "strainId",
          },
          {
            name: "weight",
            type: "sum",
          },
        ],
        column: [
          {
            label: "农产品名称",
            prop: "strainId",
            span: 12,
            search: true,
            searchSpan: 4,
            searchLabelWidth: 100,
            type: "tree",
            dicData: [],
            props: {
              label: "strainName",
              value: "id",
            },
            labelWidth: 145,
            rules: [
              {
                required: true,
                message: "请输入农产品名称",
                trigger: "blur",
              },
            ],
            disabled: true,
          },
          {
            label: "农产品图片",
            prop: "url",
            span: 12,
            addDisplay: false,
            editDisplay: false,
            type: "upload",
            dataType: "string",
            listType: "picture-card",
            labelWidth: 145,
            rules: [
              {
                required: true,
                message: "请上传农产品图片",
                trigger: "click",
              },
            ],
          },
          {
            label: "库存重量/公斤",
            prop: "weight",
            tip: "公斤",
            span: 12,
            labelWidth: 145,
            controls: false,
            type: "number",
            rules: [
              {
                required: true,
                message: "请输入库存重量 公斤",
                trigger: "click",
              },
            ],
          },
          {
            label: "采收时间",
            prop: "time",
            addDisplay: false,
            editDisplay: false,
            span: 12,
            labelWidth: 145,
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            rules: [
              {
                required: true,
                message: "请选择采收时间",
                trigger: "click",
              },
            ],
          },
          // {
          //   label: "操作人",
          //   prop: "operator",
          //   type: "tree",
          //   dicData: [],
          //   props: {
          //     label: "realName",
          //     value: "id",
          //   },
          //   span: 12,
          //   labelWidth: 145,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入操作人",
          //       trigger: "click",
          //     },
          //   ],
          // },
          {
            label: "产品等级",
            prop: "leaves",
            span: 12,
            labelWidth: 145,
            search: true,
            searchSpan: 4,
            type: "select",
            dicData: [
              {
                label: "一等品",
                value: "0",
              },
              {
                label: "二等品",
                value: "1",
              },
              {
                label: "三等品",
                value: "2",
              },
              {
                label: "四等品",
                value: "3",
              },
              {
                label: "五等品",
                value: "4",
              },
            ],
            rules: [
              {
                required: true,
                message: "请输入产品等级",
                trigger: "click",
              },
            ],
          },
        ],
      },
      data: [],
    };
  },
  created() {
    this.initData();
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    // permissionList() {
    //   return {
    //     addBtn: this.vaildData(this.permission.social_add, true),
    //     viewBtn: this.vaildData(this.permission.social_view, false),
    //     delBtn: this.vaildData(this.permission.social_delete, false),
    //     editBtn: this.vaildData(this.permission.social_edit, false),
    //   };
    // },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  mounted() {},
  methods: {
    initData() {
      var that = this;
      //获取农产品数据
      getStrainList(0).then((res) => {
        if (res.data.code == 200) {
          var strainId = that.findObject(that.option.column, "strainId");
          strainId.dicData = res.data.data;
        }
      });
    },
    //新增
    rowSave(row, done, loading) {
      row["strainType"] = 0;
      save(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();
      });
    },
  },
};
</script>
<style>
</style>
src/views/stock/stockmanage.vue
@@ -983,7 +983,7 @@
  }
  .content {
    padding-top: 20px;
    padding-top: 10px;
    width: 98%;
    height: auto;
    min-height: 630px;
@@ -995,6 +995,7 @@
      box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.05);
      opacity: 1;
      height: 151px;
      margin-top: 15px;
      .left {
        width: 78%;
@@ -1086,8 +1087,8 @@
            font-size: 20px;
            font-weight: bold;
            color: #333333;
            height: 60px;
            line-height: 60px;
            height: 50px;
            line-height: 50px;
          }
          .param-cen1 {
@@ -1131,6 +1132,7 @@
          font-size: 26px;
          color: #5abf78;
          float: left;
          width: 220px;
          .num {
            font-size: 29px;
@@ -1152,7 +1154,7 @@
          display: flex;
          flex-direction: column;
          justify-content: center;
          padding-left: 100px;
          // padding-left: 100px;
          .in {
            width: 67px;