智慧农业后台管理页面
Administrator
2022-05-24 b865b69466f1522ae2f1b17775a63bab681e5e96
农产品库存管理页面修改,新增农资管理页面
3 files modified
2 files added
1778 ■■■■ changed files
src/router/views/index.js 44 ●●●●● patch | view | raw | blame | history
src/views/farmplant/farmproductstock copy.vue 373 ●●●●● patch | view | raw | blame | history
src/views/farmplant/farmproductstock.vue 453 ●●●●● patch | view | raw | blame | history
src/views/stock/stockmanage.vue 867 ●●●●● patch | view | raw | blame | history
src/views/wel/index.vue 41 ●●●●● patch | view | raw | blame | history
src/router/views/index.js
@@ -106,20 +106,20 @@
                import ( /* webpackChunkName: "views" */ '@/views/wel/farmDetail')
        }]
    },
  {
    path: '/recovery',
    redirect: '/recovery/recovery',
    component: Layout,
    children: [{
      path: 'recovery',
      name: '采收记录',
      meta: {
        i18n: 'index',
      },
      component: () =>
        import ( /* webpackChunkName: "views" */ '@/views/recovery/recovery')
    }]
  },
    {
        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,
@@ -173,6 +173,20 @@
            },
            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')
        }]
    },
    {
@@ -246,4 +260,4 @@
                import ( /* webpackChunkName: "views" */ '@/views/farm/farm')
        }]
    },
]
]
src/views/farmplant/farmproductstock copy.vue
New file
@@ -0,0 +1,373 @@
<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
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
    </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: "auto",
        editBtn: true,
        delBtn: true,
        viewBtn: true,
        menuWidth: 200,
        menuAlign: "center",
        align: "center",
        selection: true,
        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/farmplant/farmproductstock.vue
@@ -1,37 +1,47 @@
<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
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
  <div class="body">
    <!-- <div class="search">
      <el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
        <el-form-item label="审批人">
          <el-input v-model="formInline.user" placeholder="审批人"></el-input>
        </el-form-item>
        <el-form-item label="活动区域">
          <el-select v-model="formInline.region" placeholder="活动区域">
            <el-option label="区域一" value="shanghai"></el-option>
            <el-option label="区域二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
      </el-form>
    </div> -->
    <div class="table">
      <div class="content">
        <div class="farm" v-for="(item, index) in data" :key="index">
          <div class="farm-img"><img :src="item.url" class="img" /></div>
          <!-- <div class="farm-img">
            <img src="../../../public/img/map.png" class="img" />
          </div> -->
          <div class="cai">{{item.strainName}}</div>
          <div class="area">库存量:<span>{{item.weight}}</span>公斤</div>
        </div>
      </div>
    </div>
    <div class="el-page">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.currentPage"
        :hide-on-single-page="value"
        :page-size="page.pageSize"
        background
        layout="total, prev, pager, next"
        :total="page.total"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
@@ -47,170 +57,20 @@
export default {
  data() {
    return {
      formInline: {
        user: "",
        region: "",
      },
      visible: true,
      form: {},
      query: {},
      loading: true,
      excelBox: false,
      value: true,
      page: {
        pageSize: 10,
        pageSize: 16,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        height: "auto",
        editBtn: true,
        delBtn: true,
        viewBtn: true,
        menuWidth: 200,
        menuAlign: "center",
        align: "center",
        selection: true,
        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"]),
@@ -231,128 +91,34 @@
    },
  },
  mounted() {},
  created(){
    this.initData();
    //初始化列表数据
    this.onLoad(this.page);
  },
  methods: {
    initData(){
      var that = this;
    onSubmit() {
      console.log("submit!");
    },
    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;
          }
      })
      // 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 = {};
    handleSizeChange(val) {
      this.page.pageSize = val;
      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);
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.onLoad(this.page);
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(
        page.currentPage,
        page.pageSize,
@@ -369,5 +135,82 @@
};
</script>
<style>
<style lang="scss" scoped>
.body {
  background-color: #fff;
  width: 98%;
  height: 95%;
  margin: 0 auto;
  .search {
    padding-top: 20px;
    padding-left: 30px;
  }
  .table {
    .content {
      width: 99%;
      height: auto;
      min-height: 630px;
      margin: 0 auto;
      word-wrap: break-word;
      word-break: break-all;
      .farm {
        width: 168px;
        height: 237px;
        background-color: #f7f9fb;
        border-radius: 5px;
        margin-left: 30px;
        margin-top: 30px;
        float: left;
        .farm-img {
          width: 168px;
          height: 168px;
          .img {
            width: 168px;
            height: 168px;
            border-radius: 8px 8px 0px 0px;
          }
        }
        .cai {
          text-align: center;
          font-size: 18px;
          font-weight: 550;
          margin-top: 8px;
          color: #5abf78;
        }
        .area {
          text-align: center;
          font-size: 14px;
          margin-top: 5px;
          color: #333333;
          span{
            font-size: 15px;
            color: #333333;
          }
        }
      }
    }
  }
  .el-page{
    padding-top: 30px;
    text-align: center;
  }
}
// .el-pagination.is-background .el-pager li:not(.disabled).active {
//     background-color: #5abf78 !important;
// }
// .el-pagination__total {
//     color: #5abf78 !important;
// }
</style>
src/views/stock/stockmanage.vue
New file
@@ -0,0 +1,867 @@
<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.stock_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
      <template slot-scope="{ type, size, row }" slot="menu">
        <el-button
          icon="el-icon-circle-plus-outline"
          @click="modifiedGrades(row)"
          :size="size"
          :type="type"
        >入库
        </el-button
        >
        <el-button
          icon="el-icon-edit-outline"
          @click="modifiedGrades1(row)"
          :size="size"
          :type="type"
        >出库
        </el-button
        >
          <el-button
            icon="el-icon-circle-plus-outline"
            type="text"
            size="mini"
            @click="start(row)"
            :size="size"
          >农资记录
          </el-button
          >
        <el-button
          icon="el-icon-circle-plus-outline"
          type="text"
          size="mini"
          @click="startc(row)"
          :size="size"
        >已出库农资
        </el-button
        >
      </template>
    </avue-crud>
    <el-dialog
      title="农资入库"
      :visible.sync="gradeBoxVisible"
      width="width"
      :modal="true"
      :modal-append-to-body="true"
      :append-to-body="true"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :before-close="dialogBeforeClose"
    >
      <div>
        <avue-form
          ref="formR"
          :option="option1"
          v-model="formR"
          @reset-change="emptytChange"
          @submit="submitR"
        >
        </avue-form>
      </div>
    </el-dialog>
    <el-dialog
      title="农资出库"
      :visible.sync="gradeBoxVisible1"
      width="width"
      :modal="true"
      :modal-append-to-body="true"
      :append-to-body="true"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :before-close="dialogBeforeClose"
    >
      <div>
        <avue-form
          ref="formC"
          :option="option2"
          v-model="formC"
          @reset-change="emptytChange"
          @submit="submitC"
        >
        </avue-form>
      </div>
    </el-dialog>
  </basic-container>
</template>
<script>
import {getList, getDetail, add, update, remove} from "@/api/stock/stock";
import {add1} from "@/api/stockrecord/stockrecord";
import {mapGetters} from "vuex";
export default {
  data() {
    return {
      form: {},
      formC: {},
      formR: {},
      specsValue1: '',
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      selectionList: [],
      option: {
        height: 'auto',
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        border: true,
        index: true,
        align: "center",
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "农资",
            prop: "stockId",
            span: 23,
            type: "select",
            dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            rules: [{
              required: true,
              message: "请输入农资",
              trigger: "blur"
            }]
          },
          {
            label: "农资类型",
            prop: "stype",
            addDisplay: false,
            searchLabelWidth: 80,
            searchSpan: 4,
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockType",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
          },
          {
            label: "厂家名称",
            prop: "factoryName",
            addDisplay: false,
          },
          {
            label: "规格",
            prop: "spn",
            addDisplay: false,
          },
          {
            label: "规格",
            hide: true,
            prop: "specs",
            span: 5,
            viewDisplay: false,
            rules: [{
              required: true,
              message: "请输入规格",
              trigger: "blur"
            }]
          },
          {
            label: "规格值1",
            hide: true,
            prop: "specsValue1",
            searchSpan: 4,
            span: 6,
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs1",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
            viewDisplay: false,
          },
          {
            label: "规格值2",
            hide: true,
            prop: "specsValue2",
            searchSpan: 4,
            span: 6,
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs2",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
            viewDisplay: false,
          },
          {
            label: "入库数量",
            span: 6,
            type: "number",
            prop: "amount",
            rules: [{
              required: true,
              message: "请输入入库数量",
              trigger: "blur"
            }]
          },
          {
            label: "是否库存",
            prop: "state",
            type: "select",
            searchSpan: 4,
            searchLabelWidth: 95,
            search: true,
            addDisplay: false,
            dicData: [
              {
                label: "有库存",
                value: "0"
              },
              {
                label: "无库存",
                value: "1"
              }
            ],
          },
          {
            label: "入库类型",
            prop: "type",
            type: "select",
            span: 12,
            searchSpan: 4,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockPurchase",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
            rules: [{
              required: true,
              message: "请输入入库类型",
              trigger: "blur"
            }]
          },
          {
            label: "入库时间",
            prop: "time",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            span: 11,
            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: "备注",
            type: "textarea",
            prop: "remarks",
            span: 23,
          },
        ]
      },
      option1: {
        height: 'auto',
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "农资",
            prop: "stockId1",
            span: 23,
            type: "select",
            disabled: true,
            dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            rules: [{
              required: true,
              message: "请输入农资",
              trigger: "blur"
            }]
          },
          {
            label: "规格",
            disabled: true,
            span: 6,
            prop: "spn",
            addDisplay: false,
          },
          {
            label: "规格",
            display: false,
            hide: true,
            prop: "specs1",
            span: 5,
            viewDisplay: false,
            rules: [{
              required: true,
              message: "请输入规格",
              trigger: "blur"
            }]
          },
          {
            label: "规格值1",
            display: false,
            hide: true,
            prop: "specsVal1",
            searchSpan: 4,
            span: 6,
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs1",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
          },
          {
            label: "类型",
            display: false,
            hide: true,
            prop: "stockType1",
          },
          {
            label: "规格值2",
            display: false,
            hide: true,
            prop: "specsVal2",
            searchSpan: 4,
            span: 6,
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs2",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
          },
          {
            label: "当前库存",
            disabled: true,
            span: 6,
            prop: "num",
          },
          {
            label: "入库数量",
            type: "number",
            span: 11,
            prop: "amount1",
          },
          {
            label: "入库类型",
            prop: "type1",
            type: "select",
            span: 12,
            searchSpan: 4,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockPurchase",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
            rules: [{
              required: true,
              message: "请输入入库类型",
              trigger: "blur"
            }]
          },
          {
            label: "入库时间",
            prop: "time1",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            span: 11,
            rules: [{
              required: true,
              message: "请输入入库时间",
              trigger: "blur"
            }]
          },
          {
            label: "单据、凭证照片",
            prop: "picture1",
            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: "备注",
            type: "textarea",
            prop: "remarks1",
            span: 23,
          },
        ]
      },
      option2: {
        height: 'auto',
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "农资",
            prop: "stockId1",
            span: 23,
            type: "select",
            disabled: true,
            dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            rules: [{
              required: true,
              message: "请输入农资",
              trigger: "blur"
            }]
          },
          {
            label: "规格",
            disabled: true,
            span: 6,
            prop: "spn",
            addDisplay: false,
          },
          {
            label: "规格",
            display: false,
            hide: true,
            prop: "specs1",
            span: 5,
            viewDisplay: false,
            rules: [{
              required: true,
              message: "请输入规格",
              trigger: "blur"
            }]
          },
          {
            label: "规格值1",
            display: false,
            hide: true,
            prop: "specsVal1",
            searchSpan: 4,
            span: 6,
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs1",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
          },
          {
            label: "类型",
            display: false,
            hide: true,
            prop: "stockType1",
          },
          {
            label: "规格值2",
            display: false,
            hide: true,
            prop: "specsVal2",
            searchSpan: 4,
            span: 6,
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs2",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
          },
          {
            label: "当前库存",
            disabled: true,
            span: 6,
            prop: "num",
          },
          {
            label: "出库数量",
            type: "number",
            span: 11,
            prop: "amount1",
          },
          {
            label: "出库类型",
            prop: "type1",
            type: "select",
            span: 12,
            searchSpan: 4,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockPurchase1",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            search: true,
            rules: [{
              required: true,
              message: "请输入出库类型",
              trigger: "blur"
            }]
          },
          {
            label: "入库时间",
            prop: "time1",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            span: 11,
            rules: [{
              required: true,
              message: "请输入入库时间",
              trigger: "blur"
            }]
          },
          {
            label: "单据、凭证照片",
            prop: "picture1",
            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: "备注",
            type: "textarea",
            prop: "remarks1",
            span: 23,
          },
        ]
      },
      gradeBoxVisible: false,
      gradeBoxVisible1: false,
      data: []
    };
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.stock_add, false),
        viewBtn: this.vaildData(this.permission.stock_view, false),
        delBtn: this.vaildData(this.permission.stock_delete, true),
        editBtn: this.vaildData(this.permission.stock_edit, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    }
  },
  methods: {
    //入库
    submitR(row, done, loading) {
      var that = this;
      add1(row).then(
        () => {
          that.onLoad(this.page);
          that.$refs.formR.resetFields();
          that.$message({
            type: "success",
            message: "操作成功!"
          });
          that.gradeBoxVisible = false;
          done();
        },
        error => {
          window.console.log(error);
          done();
        }
      );
    },
    //出库
    submitC(row, done, loading) {
      var that = this;
      add1(row).then(
        () => {
          that.onLoad(this.page);
          that.$refs.formC.resetFields();
          that.$message({
            type: "success",
            message: "操作成功!"
          });
          that.gradeBoxVisible1 = false;
          done();
        },
        error => {
          window.console.log(error);
          done();
        }
      );
    },
    // 往入库页面填充数据
    modifiedGrades(row) {
      this.formR = {
        id: null,
        stockId1: row.stockId,
        spn: row.spn,
        num: row.amount,
        type1: row.type,
        time1: row.time,
        specs1: row.specs,
        specsVal1: row.specsValue1,
        specsVal2: row.specsValue1,
        stockType1: 1,
      };
      this.gradeBoxVisible = true;
    },
    modifiedGrades1(row) {
      this.formC = {
        id: null,
        stockId1: row.stockId,
        spn: row.spn,
        num: row.amount,
        type1: row.type,
        time1: row.time,
        specs1: row.specs,
        specsVal1: row.specsValue1,
        specsVal2: row.specsValue1,
        stockType1: 0,
      };
      this.gradeBoxVisible1 = true;
    },
    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;
      }
      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();
    },
    //农事操作
    start(row) {
      this.$router.push({
        path: `/stockrecord`,
        query: row
      });
    },
    //已出库存农资
    startc(row) {
      this.$router.push({
        path: `/soldrecord`,
        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>
</style>
src/views/wel/index.vue
@@ -59,7 +59,7 @@
          <div class="farm" v-for="(item, index) in farmPlanList" :key="index">
            <div class="farm-img"><img :src="item.url" class="img" /></div>
            <div class="cai">{{ item.strainName }}</div>
            <div class="area">种植面积:{{ item.area }}亩</div>
            <div class="area">种植面积:<span>{{ item.area }}</span>亩</div>
            <div class="btn">
              <el-button plain size="small" @click="recovery(item)"
                ><span style="color: #5abf78">采收</span></el-button
@@ -127,10 +127,13 @@
        <div class="farming-divider" v-if="isFarmingDetail">
          <el-divider></el-divider>
        </div>
        <div class="farming-details" :v-if="isFarmingDetail" >
        <div class="farming-details" :v-if="isFarmingDetail">
          <div class="detail" v-for="(item, index) in farmingList" :key="index">
            <div class="detail-title">{{item.name}}</div>
            <div class="detail-number"><span>{{item.value}}</span>次</div>
            <div class="detail-title">{{ item.name }}</div>
            <div class="detail-number">
              <span>{{ item.value }}</span
              >次
            </div>
          </div>
        </div>
      </div>
@@ -138,8 +141,7 @@
        <div class="title">
          <div class="repertory-title">农资库存</div>
          <div class="detail">
            <el-link type="success" :underline="false">明细>></el-link
            >
            <el-link type="success" :underline="false">明细>></el-link>
          </div>
        </div>
        <div class="repertory-centont">
@@ -166,7 +168,7 @@
<script>
import { mapGetters } from "vuex";
import { getList, update } from "@/api/farmplant/farmplant";
import { getFarmingCount,getFarmingStatis } from "@/api/farm/farmingrecord";
import { getFarmingCount, getFarmingStatis } from "@/api/farm/farmingrecord";
import { selectCount } from "@/api/land/land";
import recovery from "./recovery.vue";
import land from "./land.vue";
@@ -222,7 +224,7 @@
      getFarmingCount().then((res) => {
        that.total = res.data.data;
        // that.total = 0;
        if(that.total>0){
        if (that.total > 0) {
          that.isFarmingDetail = true;
        }
      });
@@ -485,6 +487,12 @@
            text-align: center;
            font-size: 14px;
            margin-top: 5px;
            color: #333333;
            span {
              font-size: 15px;
              color: #333333;
            }
          }
          .btn {
@@ -573,7 +581,7 @@
      background-color: #fff;
      border-radius: 5px;
      height: auto;
          // white-space: nowrap;
      // white-space: nowrap;
      .title {
        padding-top: 20px;
@@ -658,7 +666,7 @@
            font-size: 14px;
            margin-right: 15px;
            span{
            span {
              font-size: 18px;
              font-weight: 550;
            }
@@ -684,20 +692,19 @@
        line-height: 30px;
        text-align: center;
        .repertory-title{
        .repertory-title {
          font-size: 24px;
          font-weight: 550;
          float: left;
          padding-left: 35%;
        }
        .detail{
        .detail {
        }
      }
      .repertory-centont{
        width:94%;
      .repertory-centont {
        width: 94%;
        margin: 0 auto;
        height: auto;
        word-wrap: break-word;
@@ -734,15 +741,13 @@
            font-size: 14px;
            margin-right: 15px;
            span{
            span {
              font-size: 18px;
              font-weight: 550;
            }
          }
        }
      }
    }
  }