智慧农业后台管理页面
shuishen
2022-07-18 937ab15b5e62f83b2f190ece0134c4dffb784be5
Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/zhny_web
6 files modified
7 files added
2728 ■■■■ changed files
public/img/bg/mg.png patch | view | raw | blame | history
public/index.html 2 ●●● patch | view | raw | blame | history
public/mg.png patch | view | raw | blame | history
src/api/land/land.js 6 ●●●● patch | view | raw | blame | history
src/api/process/process.js 50 ●●●●● patch | view | raw | blame | history
src/api/retrieval/retrieval.js 50 ●●●●● patch | view | raw | blame | history
src/store/modules/user.js 2 ●●● patch | view | raw | blame | history
src/views/farmplant/farmproductstock.vue 1275 ●●●●● patch | view | raw | blame | history
src/views/farmplant/process.vue 796 ●●●●● patch | view | raw | blame | history
src/views/process/process.vue 254 ●●●●● patch | view | raw | blame | history
src/views/retrieval/retrieval.vue 281 ●●●●● patch | view | raw | blame | history
src/views/system/user.vue 2 ●●● patch | view | raw | blame | history
src/views/wel/index.vue 10 ●●●● patch | view | raw | blame | history
public/img/bg/mg.png
public/index.html
@@ -29,7 +29,7 @@
  <script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
  <script src="https://cdn.staticfile.org/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
  <script src="https://cdn.staticfile.org/xlsx/0.18.2/xlsx.full.min.js"></script>
  <link rel="icon" href="<%= BASE_URL %>favicon.png">
  <link rel="icon" href="<%= BASE_URL %>mg.png">
  <title>智慧农业综合管理平台</title>
  <style>
    html,
public/mg.png
src/api/land/land.js
@@ -58,12 +58,12 @@
    })
}
export const selectCount = (deptId) => {
export const selectCount = (farmId) => {
    return request({
        url: '/api/land/land/selectCount',
        method: 'get',
        params: {
            deptId
          farmId
        }
    })
}
}
src/api/process/process.js
New file
@@ -0,0 +1,50 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/api/process/process/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getDetail = (id) => {
  return request({
    url: '/api/process/process/detail',
    method: 'get',
    params: {
      id
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/process/process/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const addjg = (row) => {
  return request({
    url: '/api/process/process/submit',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/process/process/submit',
    method: 'post',
    data: row
  })
}
src/api/retrieval/retrieval.js
New file
@@ -0,0 +1,50 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/api/retrieval/retrieval/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getDetail = (id) => {
  return request({
    url: '/api/retrieval/retrieval/detail',
    method: 'get',
    params: {
      id
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/retrieval/retrieval/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const addck = (row) => {
  return request({
    url: '/api/retrieval/retrieval/submit',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/retrieval/retrieval/submit',
    method: 'post',
    data: row
  })
}
src/store/modules/user.js
@@ -240,7 +240,7 @@
    },
    SET_USER_INFO: (state, userInfo) => {
      if (validatenull(userInfo.avatar)) {
        userInfo.avatar = "/img/bg/img-logo.png";
        userInfo.avatar = "/img/bg/mg.png";
      }
      state.userInfo = userInfo;
      setStore({name: 'userInfo', content: state.userInfo})
src/views/farmplant/farmproductstock.vue
@@ -23,8 +23,8 @@
          <!-- <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 class="cai">{{ item.strainName }}</div>
          <div class="area">库存量:<span>{{ item.weight }}</span>公斤</div>
          <div class="btn">
            <el-button style="width: 65px;" plain size="small" @click="openWindow(0,item)">
              <span style="color: #5abf78">销售</span></el-button
@@ -34,15 +34,14 @@
            </el-button
            >
          </div>
          <!--          <div class="btn">-->
          <!--            <el-button style="width: 65px;" plain size="small"-->
          <!--            ><span style="color: #5abf78">出库</span></el-button-->
          <!--            >-->
          <!--            <el-button style="width: 65px;" plain size="small">-->
          <!--              加工-->
          <!--            </el-button-->
          <!--            >-->
          <!--          </div>-->
          <div class="btn">
            <el-button style="width: 65px;" plain size="small" @click="openWindow(3,item)"
            ><span style="color: #5abf78">出库</span>
            </el-button>
            <el-button style="width: 65px;" plain size="small" @click="openWindow(2,item)">
              加工
            </el-button>
          </div>
        </div>
      </div>
    </div>
@@ -59,7 +58,7 @@
      >
      </el-pagination>
    </div>
    <!--销售-->
    <el-dialog
      title="农产品销售"
      :modal-append-to-body="false"
@@ -112,7 +111,7 @@
      <avue-form ref="form" v-model="form" :option="option">
        <template slot-scope="{disabled,size}" slot="name">
          <div>
            <el-tag type="success">{{form.name}}</el-tag>
            <el-tag type="success">{{ form.name }}</el-tag>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleDestination">
@@ -132,7 +131,7 @@
            <el-input type="number" placeholder="请输入销售数量" v-model="form.saleNum"><i slot="suffix"
                                                                                    style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
            <div style="text-align: right;color: #ffb218">可销售量:{{form.weight}}公斤</div>
            <div style="text-align: right;color: #ffb218">可销售量:{{ form.weight }}公斤</div>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="salePrice">
@@ -149,8 +148,7 @@
        </template>
      </avue-form>
    </el-dialog>
    <!--库存-->
    <el-dialog
      title="农产品库存损耗"
      :modal-append-to-body="false"
@@ -165,14 +163,15 @@
      <avue-form ref="form" v-model="formKC" :option="optionKC">
        <template slot-scope="{disabled,size}" slot="name">
          <div>
            <el-tag type="success">{{formKC.name}}</el-tag>
            <el-tag type="success">{{ formKC.name }}</el-tag>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入损耗数量" v-model="formKC.saleNum"><i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
            <el-input type="number" placeholder="请输入损耗数量" v-model="formKC.saleNum"><i slot="suffix"
                                                                                      style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
            <div style="text-align: right;color: #ffb218">库存量:{{formKC.weight}}公斤</div>
            <div style="text-align: right;color: #ffb218">库存量:{{ formKC.weight }}公斤</div>
          </div>
        </template>
        <template slot="menuForm">
@@ -183,458 +182,850 @@
        </template>
      </avue-form>
    </el-dialog>
    <!--加工-->
    <el-dialog
      title="加工产品"
      :modal-append-to-body="false"
      :append-to-body="true"
      :close-on-click-modal="false"
      @close="close"
      width="30%"
      :before-close="cleanJGData"
      :visible.sync="visibleJG"
      center
    >
      <avue-form ref="form" v-model="formJG" :option="optionJG">
        <template slot-scope="{disabled,size}" slot="name">
          <div>
            <el-tag type="success">{{ formJG.name }}</el-tag>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入加工数量" v-model="formJG.saleNum"><i slot="suffix"
                                                                                      style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
            <div style="text-align: right;color: #ffb218">库存量:{{ formJG.weight }}公斤</div>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="processNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入产品数量" v-model="formJG.processNum"><i slot="suffix"
                                                                                         style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
          </div>
        </template>
        <template slot="menuForm">
          <div style="text-align: center">
            <el-button style="width: 80px" plain @click="cleanKCData">取消</el-button>
            <el-button style="width: 80px" type="success" plain @click="submitJGloss">确认</el-button>
          </div>
        </template>
      </avue-form>
    </el-dialog>
    <!--出库-->
    <el-dialog
      title="出库产品"
      :modal-append-to-body="false"
      :append-to-body="true"
      :close-on-click-modal="false"
      :before-close="cleanCKData"
      @close="close"
      width="30%"
      :visible.sync="visibleCK"
      center
    >
      <avue-form ref="form" v-model="formCK" :option="optionCK">
        <template slot-scope="{disabled,size}" slot="name">
          <div>
            <el-tag type="success">{{ formCK.name }}</el-tag>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleDestination">
          <div>
            <el-cascader
              style="width: 100%;"
              placeholder="请选择出库去向"
              size="large"
              :options="optionck"
              @change="handleChangeck"
              v-model="saleDestination">
            </el-cascader>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入出库数量" v-model="formCK.saleNum"><i slot="suffix"
                                                                                      style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
            <div style="text-align: right;color: #ffb218">可出库量:{{ formCK.weight }}公斤</div>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="salePrice">
          <!--          <div style="margin-bottom: -20px">
                      <el-input type="number" placeholder="请输入销售价格" v-model="formCK.salePrice"><i slot="suffix"
                                                                                                style="font-style:normal;margin-right: 5px;">元/公斤</i>
                      </el-input>
                    </div>-->
        </template>
        <template slot="menuForm">
          <div style="text-align: center">
            <el-button style="width: 120px" type="success" plain @click="submitCK">出库</el-button>
          </div>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>
<script>
  import {
    getDetail,
    getList,
    update,
    remove,
    save,
  } from "@/api/farmplant/farmproductstock";
import {
  getDetail,
  getList,
  update,
  remove,
  save,
} from "@/api/farmplant/farmproductstock";
  import {
    add,addKC
  } from "@/api/sale/sale";
import {
  add, addKC
} from "@/api/sale/sale";
  import {getStrainList} from "@/api/farmplant/strain";
  import {mapGetters} from "vuex";
  import {regionData} from 'element-china-area-data'
import {
  addjg
} from "@/api/process/process";
  export default {
    data() {
      return {
        options: regionData,
        formInline: {
          user: "",
          region: "",
        },
        form: {
          name: "",
          strainId: "",
          saleTime: "",
          saleNum: "",
          saleDestination: "",
          city: "",
          county: "",
          salePrice: "",
          createUser: "",
          saleBrand: "",
        },
        //损耗字段
        formKC:{
          name: "",
          strainId: "",
          saleNum: "",
          remarks:"",
          reason:"0",
          lossTime:"",
        },
        visible: false,
        visibleKC: false,
        value: true,
        page: {
          pageSize: 16,
          currentPage: 1,
          total: 0,
        },
        option: {
          emptyBtn: false,
          submitBtn: false,
          gutter: 30,
          column: [
            {
              label: "种养品种",
              prop: "strainName",
              span: 24,
              disabled: true,
              rules: [
                {
                  required: true,
                  message: "请输入种养品种",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "销售时间",
              prop: "saleTime",
              type: "date",
              span: 24,
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              rules: [
                {
                  required: true,
                  message: "请选择销售时间",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "销售数量",
              prop: "saleNum",
              type: "number",
              span: 24,
              rules: [
                {
                  required: true,
                  message: "请输入销售数量",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "销售去向",
              prop: "saleDestination",
              span: 24,
              rules: [
                {
                  required: true,
                  message: "请选择销售去向",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "销售价格",
              prop: "salePrice",
              span: 24,
              type: "number",
            },
            {
              label: "品牌",
              prop: "saleBrand",
              span: 24,
            },
            {
              label: "操作人",
              prop: "name",
              span: 24,
              rules: [
                {
                  required: true,
                  message: "请输入操作人",
                  trigger: "blur",
                },
              ],
            },
          ]
        },
        optionKC: {
          emptyBtn: false,
          submitBtn: false,
          gutter: 30,
          column: [
            {
              label: "损耗品种",
              prop: "strainName",
              span: 24,
              disabled: true,
              rules: [
                {
                  required: true,
                  message: "请输入损耗品种",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "损耗时间",
              prop: "lossTime",
              type: "date",
              span: 24,
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              rules: [
                {
                  required: true,
                  message: "请选择损耗时间",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "损耗数量",
              prop: "saleNum",
              type: "number",
              span: 24,
              rules: [
                {
                  required: true,
                  message: "请输入损耗数量",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "损耗原因",
              prop: "reason",
              span: 24,
              type: "select",
              value: "0",
              dicData: [
                {
                  label: "库存损耗",
                  value: "0",
                }],
              rules: [
                {
                  required: true,
                  message: "请选择损耗原因",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "备注",
              prop: "remarks",
              span: 24,
            },
            {
              label: "操作人",
              prop: "name",
              span: 24,
              rules: [
                {
                  required: true,
                  message: "请输入操作人",
                  trigger: "blur",
                },
              ],
            },
          ]
        },
        selectionList: [],
        data: [],
      };
    },
    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(",");
import {
  addck
} from "@/api/retrieval/retrieval";
import {mapGetters} from "vuex";
import {regionData} from 'element-china-area-data'
export default {
  data() {
    return {
      options: regionData,
      optionck: regionData,
      formInline: {
        user: "",
        region: "",
      },
      form: {
        name: "",
        proid: "",
        landId: "",
        strainId: "",
        saleTime: "",
        saleNum: "",
        saleDestination: "",
        city: "",
        county: "",
        salePrice: "",
        createUser: "",
        saleBrand: "",
      },
      //出库
      formCK: {
        name: "",
        proid: "",
        landId: "",
        strainId: "",
        saleTime: "",
        saleNum: "",
        saleDestination: "",
        city: "",
        county: "",
        createUser: "",
        remarks: "",
      },
      //损耗字段
      formKC: {
        name: "",
        proid: "",
        landId: "",
        strainId: "",
        saleNum: "",
        remarks: "",
        reason: "0",
        lossTime: "",
      },
      //加工字段
      formJG: {
        name: "",
        proid: "",
        landId: "",
        strainId: "",
        saleNum: "",
        processNum: "",
        remarks: "",
        reason: "0",
        saleTime: "",
      },
      visible: false,
      visibleCK: false,
      visibleKC: false,
      visibleJG: false,
      value: true,
      page: {
        pageSize: 16,
        currentPage: 1,
        total: 0,
      },
      option: {
        emptyBtn: false,
        submitBtn: false,
        gutter: 30,
        column: [
          {
            label: "种养品种",
            prop: "strainName",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入种养品种",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售时间",
            prop: "saleTime",
            type: "date",
            span: 24,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择销售时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售数量",
            prop: "saleNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入销售数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售去向",
            prop: "saleDestination",
            span: 24,
            rules: [
              {
                required: true,
                message: "请选择销售去向",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售价格",
            prop: "salePrice",
            span: 24,
            type: "number",
          },
          {
            label: "品牌",
            prop: "saleBrand",
            span: 24,
          },
          {
            label: "操作人",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入操作人",
                trigger: "blur",
              },
            ],
          },
        ]
      },
      optionKC: {
        emptyBtn: false,
        submitBtn: false,
        gutter: 30,
        column: [
          {
            label: "损耗品种",
            prop: "strainName",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入损耗品种",
                trigger: "blur",
              },
            ],
          },
          {
            label: "损耗时间",
            prop: "lossTime",
            type: "date",
            span: 24,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择损耗时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "损耗数量",
            prop: "saleNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入损耗数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "损耗原因",
            prop: "reason",
            span: 24,
            type: "select",
            value: "0",
            dicData: [
              {
                label: "库存损耗",
                value: "0",
              }],
            rules: [
              {
                required: true,
                message: "请选择损耗原因",
                trigger: "blur",
              },
            ],
          },
          {
            label: "备注",
            prop: "remarks",
            span: 24,
          },
          {
            label: "操作人",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入操作人",
                trigger: "blur",
              },
            ],
          },
        ]
      },
      optionJG: {
        emptyBtn: false,
        submitBtn: false,
        gutter: 30,
        column: [
          {
            label: "加工品种",
            prop: "strainName",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入加工品种",
                trigger: "blur",
              },
            ],
          },
          {
            label: "加工时间",
            prop: "saleTime",
            type: "date",
            span: 24,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择加工时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "加工数量",
            prop: "saleNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入加工数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "加工产品",
            prop: "processId",
            span: 24,
            type: "tree",
            dicUrl: "/api/machining/machining/selectInfo",
            props: {
              label: "processName",
              value: "processId"
            },
            rules: [
              {
                required: true,
                message: "请输入加工产品",
                trigger: "blur",
              },
            ],
          },
          {
            label: "产品数量",
            prop: "processNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入产品数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "备注",
            prop: "remarks",
            span: 24,
          },
          {
            label: "操作人",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入操作人",
                trigger: "blur",
              },
            ],
          },
        ]
      },
      optionCK: {
        emptyBtn: false,
        submitBtn: false,
        gutter: 30,
        column: [
          {
            label: "出库品种",
            prop: "strainName",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入出库品种",
                trigger: "blur",
              },
            ],
          },
          {
            label: "出库时间",
            prop: "saleTime",
            type: "date",
            span: 24,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择出库时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "出库数量",
            prop: "saleNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入出库数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "出库去向",
            prop: "saleDestination",
            span: 24,
            rules: [
              {
                required: true,
                message: "请选择出库去向",
                trigger: "blur",
              },
            ],
          },
          {
            label: "备注",
            prop: "remarks",
            span: 24,
          },
          {
            label: "操作人",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入操作人",
                trigger: "blur",
              },
            ],
          },
        ]
      },
      selectionList: [],
      data: [],
    };
  },
  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() {
  },
  mounted() {
  },
  created() {
    this.initData();
    //初始化列表数据
    this.onLoad(this.page);
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    created() {
      this.initData();
      //初始化列表数据
    //销售
    submitSole() {
      var that = this;
      this.$refs.form.validate((vaild, done) => {
        if (vaild) {
          add(this.form).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            //提交完成,关闭窗口清空数据
            that.cleanData();
            done();
          }, error => {
            window.console.log(error);
            //提交失败,关闭窗口清空数据
            that.cleanData();
            done();
          });
        }
      })
    },
    //加工产品
    submitJGloss() {
      var that = this;
      this.$refs.form.validate((vaild, done) => {
        if (vaild) {
          addjg(this.formJG).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            //提交完成,关闭窗口清空数据
            that.cleanJGData();
            done();
          }, error => {
            window.console.log(error);
            //提交失败,关闭窗口清空数据
            that.cleanJGData();
            done();
          });
        }
      })
    },
    //库存消耗
    submitKCloss() {
      var that = this;
      this.$refs.form.validate((vaild, done) => {
        if (vaild) {
          addKC(this.formKC).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            //提交完成,关闭窗口清空数据
            that.cleanKCData();
            done();
          }, error => {
            window.console.log(error);
            //提交失败,关闭窗口清空数据
            that.cleanKCData();
            done();
          });
        }
      })
    },
    //出库
    submitCK() {
      var that = this;
      this.$refs.form.validate((vaild, done) => {
        if (vaild) {
          addck(this.formCK).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            //提交完成,关闭窗口清空数据
            that.cleanCKData();
            done();
          }, error => {
            window.console.log(error);
            //提交失败,关闭窗口清空数据
            that.cleanCKData();
            done();
          });
        }
      })
    },
    handleChange(value) {
      if (value != null) {
        this.form.saleDestination = value[0];
        this.form.city = value[1];
        this.form.county = value[2];
      }
    },
    handleChangeck(value) {
      if (value != null) {
        this.formCK.saleDestination = value[0];
        this.formCK.city = value[1];
        this.formCK.county = value[2];
      }
    },
    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;
      //   }
      // });
    },
    openWindow(index, data) {
      if (index == 0) {
        this.form.name = this.userInfo.nick_name;
        this.form.createUser = this.userInfo.user_id;
        this.form.weight = data.weight;
        this.form.proid = data.id;
        this.form.landId = data.landId;
        this.form.strainId = data.strainId;
        this.form.strainName = data.strainName;
        this.visible = true;
      } else if (index == 1) {
        this.formKC.name = this.userInfo.nick_name;
        this.formKC.createUser = this.userInfo.user_id;
        this.formKC.weight = data.weight;
        this.formKC.proid = data.id;
        this.formKC.landId = data.landId;
        this.formKC.strainId = data.strainId;
        this.formKC.strainName = data.strainName;
        this.visibleKC = true;
      } else if (index == 2) {
        this.formJG.name = this.userInfo.nick_name;
        this.formJG.createUser = this.userInfo.user_id;
        this.formJG.proid = data.id;
        this.formJG.landId = data.landId;
        this.formJG.weight = data.weight;
        this.formJG.strainId = data.strainId;
        this.formJG.strainName = data.strainName;
        this.visibleJG = true;
      } else if (index == 3) {
        this.formCK.name = this.userInfo.nick_name;
        this.formCK.createUser = this.userInfo.user_id;
        this.formCK.weight = data.weight;
        this.formCK.proid = data.id;
        this.formCK.landId = data.landId;
        this.formCK.strainId = data.strainId;
        this.formCK.strainName = data.strainName;
        this.visibleCK = true;
      }
    },
    cleanData() {
      var that = this;
      that.form.saleDestination = "";
      that.$refs.form.resetFields();
      that.visible = false;
    },
    cleanCKData() {
      var that = this;
      that.formCK.saleDestination = "";
      that.$refs.form.resetFields();
      that.visibleCK = false;
    },
    cleanKCData() {
      var that = this;
      that.$refs.form.resetFields();
      that.visibleKC = false;
    },
    cleanJGData() {
      var that = this;
      that.$refs.form.resetFields();
      that.visibleJG = false;
    },
    handleSizeChange(val) {
      this.page.pageSize = val;
      this.onLoad(this.page);
    },
    methods: {
      onSubmit() {
        console.log("submit!");
      },
      submitSole() {
        var that = this;
        this.$refs.form.validate((vaild, done) => {
          if (vaild) {
            add(this.form).then(() => {
              this.onLoad(this.page);
              this.$message({
                type: "success",
                message: "操作成功!"
              });
              //提交完成,关闭窗口清空数据
              that.cleanData();
              done();
            }, error => {
              window.console.log(error);
              //提交失败,关闭窗口清空数据
              that.cleanData();
              done();
            });
          }
        })
      },
      submitKCloss() {
        var that = this;
        this.$refs.form.validate((vaild, done) => {
          if (vaild) {
            addKC(this.formKC).then(() => {
              this.onLoad(this.page);
              this.$message({
                type: "success",
                message: "操作成功!"
              });
              //提交完成,关闭窗口清空数据
              that.cleanKCData();
              done();
            }, error => {
              window.console.log(error);
              //提交失败,关闭窗口清空数据
              that.cleanKCData();
              done();
            });
          }
        })
      },
      handleChange(value) {
        if (value != null) {
          this.form.saleDestination = value[0];
          this.form.city = value[1];
          this.form.county = value[2];
        }
      },
      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;
        //   }
        // });
      },
      openWindow(index, data) {
        if (index == 0) {
          this.form.name = this.userInfo.nick_name;
          this.form.createUser = this.userInfo.user_id;
          this.form.weight = data.weight;
          this.form.strainId = data.strainId;
          this.form.strainName = data.strainName;
          this.visible = true;
        } else if (index == 1) {
          this.formKC.name = this.userInfo.nick_name;
          this.formKC.createUser = this.userInfo.user_id;
          this.formKC.weight = data.weight;
          this.formKC.strainId = data.strainId;
          this.formKC.strainName = data.strainName;
          this.visibleKC = true;
        }
      },
      cleanData() {
        var that = this;
        that.form.saleDestination = "";
        that.$refs.form.resetFields();
        that.visible = false;
      },
      cleanKCData() {
        var that = this;
        that.$refs.form.resetFields();
        that.visibleKC = false;
      },
      handleSizeChange(val) {
        this.page.pageSize = val;
        this.onLoad(this.page);
      },
      handleCurrentChange(val) {
        this.page.currentPage = val;
        this.onLoad(this.page);
      },
      onLoad(page, params = {}) {
        params['tenantId'] = this.userInfo.tenant_id;
        params['deptId'] = this.userInfo.dept_id;
        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();
        });
      },
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.onLoad(this.page);
    },
  };
    onLoad(page, params = {}) {
      params['tenantId'] = this.userInfo.tenant_id;
      params['deptId'] = this.userInfo.dept_id;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    },
  },
};
</script>
<style lang="scss" scoped>
  .body {
    background-color: #fff;
    width: 98%;
    height: 95%;
    margin: 0 auto;
.body {
  background-color: #fff;
  width: 98%;
  height: 95%;
  margin: 0 auto;
    .search {
      padding-top: 20px;
      padding-left: 30px;
    }
  .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;
  .table {
    .content {
      width: 99%;
      height: auto;
      min-height: 630px;
      margin: 0 auto;
      word-wrap: break-word;
      word-break: break-all;
        .farm {
      .farm {
        width: 168px;
        height: 310px;
        /*height: 315px;*/
        background-color: #f7f9fb;
        border-radius: 5px;
        margin-left: 30px;
        margin-top: 30px;
        float: left;
        .farm-img {
          width: 168px;
          height: 283px;
          /*height: 315px;*/
          background-color: #f7f9fb;
          border-radius: 5px;
          margin-left: 30px;
          margin-top: 30px;
          float: left;
          height: 168px;
          .farm-img {
          .img {
            width: 168px;
            height: 168px;
            .img {
              width: 168px;
              height: 168px;
              border-radius: 8px 8px 0px 0px;
            }
            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;
            }
          }
          .btn {
            text-align: center;
            margin-top: 8px;
          }
        }
        .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;
          }
        }
        .btn {
          text-align: center;
          margin-top: 8px;
        }
      }
    }
    .el-page {
      padding-top: 30px;
      text-align: center;
    }
  }
  .el-page {
    padding-top: 30px;
    text-align: center;
  }
}
</style>
src/views/farmplant/process.vue
New file
@@ -0,0 +1,796 @@
<template>
  <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.tpurl" class="img"/></div>
          <!-- <div class="farm-img">
            <img src="../../../public/img/map.png" class="img" />
          </div> -->
          <div class="cai">{{ item.processName }}</div>
          <div class="area">库存量:<span>{{ item.processNum }}</span>公斤</div>
<!--          <div class="btn">-->
<!--            <el-button style="width: 65px;" plain size="small" @click="openWindow(0,item)">-->
<!--              <span style="color: #5abf78">销售</span></el-button-->
<!--            >-->
<!--            <el-button style="width: 65px;padding-left:8px" plain size="small" @click="openWindow(1,item)">-->
<!--              <span>库存损耗</span>-->
<!--            </el-button-->
<!--            >-->
<!--          </div>-->
<!--          <div class="btn">-->
<!--            <el-button style="width: 65px;" plain size="small"-->
<!--            ><span style="color: #5abf78">出库</span></el-button-->
<!--            >-->
<!--            <el-button style="width: 65px;" plain size="small" @click="openWindow(2,item)">-->
<!--              加工-->
<!--            </el-button>-->
<!--          </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>
    <el-dialog
      title="农产品销售"
      :modal-append-to-body="false"
      :append-to-body="true"
      :close-on-click-modal="false"
      :before-close="cleanData"
      @close="close"
      width="30%"
      :visible.sync="visible"
      center
    >
      <avue-form ref="form" v-model="form" :option="option">
        <template slot-scope="{disabled,size}" slot="name">
          <div>
            <el-tag type="success">{{ form.name }}</el-tag>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleDestination">
          <div>
            <el-cascader
              style="width: 100%;"
              placeholder="请选择销售去向"
              size="large"
              :options="options"
              @change="handleChange"
              v-model="saleDestination">
            </el-cascader>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入销售数量" v-model="form.saleNum"><i slot="suffix"
                                                                                    style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
            <div style="text-align: right;color: #ffb218">可销售量:{{ form.weight }}公斤</div>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="salePrice">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入销售价格" v-model="form.salePrice"><i slot="suffix"
                                                                                      style="font-style:normal;margin-right: 5px;">元/公斤</i>
            </el-input>
          </div>
        </template>
        <template slot="menuForm">
          <div style="text-align: center">
            <el-button style="width: 120px" type="success" plain @click="submitSole">销售</el-button>
          </div>
        </template>
      </avue-form>
    </el-dialog>
    <el-dialog
      title="农产品库存损耗"
      :modal-append-to-body="false"
      :append-to-body="true"
      :close-on-click-modal="false"
      @close="close"
      width="30%"
      :before-close="cleanKCData"
      :visible.sync="visibleKC"
      center
    >
      <avue-form ref="form" v-model="formKC" :option="optionKC">
        <template slot-scope="{disabled,size}" slot="name">
          <div>
            <el-tag type="success">{{ formKC.name }}</el-tag>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入损耗数量" v-model="formKC.saleNum"><i slot="suffix"
                                                                                      style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
            <div style="text-align: right;color: #ffb218">库存量:{{ formKC.weight }}公斤</div>
          </div>
        </template>
        <template slot="menuForm">
          <div style="text-align: center">
            <el-button style="width: 80px" plain @click="cleanKCData">取消</el-button>
            <el-button style="width: 80px" type="success" plain @click="submitKCloss">确认</el-button>
          </div>
        </template>
      </avue-form>
    </el-dialog>
    <el-dialog
      title="加工产品"
      :modal-append-to-body="false"
      :append-to-body="true"
      :close-on-click-modal="false"
      @close="close"
      width="30%"
      :before-close="cleanJGData"
      :visible.sync="visibleJG"
      center
    >
      <avue-form ref="form" v-model="formJG" :option="optionJG">
        <template slot-scope="{disabled,size}" slot="name">
          <div>
            <el-tag type="success">{{ formJG.name }}</el-tag>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="saleNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入加工数量" v-model="formJG.saleNum"><i slot="suffix"
                                                                                      style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
            <div style="text-align: right;color: #ffb218">库存量:{{ formJG.weight }}公斤</div>
          </div>
        </template>
        <template slot-scope="{disabled,size}" slot="processNum">
          <div style="margin-bottom: -20px">
            <el-input type="number" placeholder="请输入产品数量" v-model="formJG.processNum"><i slot="suffix"
                                                                                      style="font-style:normal;margin-right: 5px;">公斤</i>
            </el-input>
          </div>
        </template>
        <template slot="menuForm">
          <div style="text-align: center">
            <el-button style="width: 80px" plain @click="cleanKCData">取消</el-button>
            <el-button style="width: 80px" type="success" plain @click="submitJGloss">确认</el-button>
          </div>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>
<script>
import {
  getList,
} from "@/api/process/process";
import {
  add, addKC
} from "@/api/sale/sale";
import {
  addjg
} from "@/api/process/process";
import {mapGetters} from "vuex";
import {regionData} from 'element-china-area-data'
export default {
  data() {
    return {
      options: regionData,
      formInline: {
        user: "",
        region: "",
      },
      form: {
        name: "",
        proid:"",
        landId:"",
        strainId: "",
        saleTime: "",
        saleNum: "",
        saleDestination: "",
        city: "",
        county: "",
        salePrice: "",
        createUser: "",
        saleBrand: "",
      },
      //损耗字段
      formKC: {
        name: "",
        proid:"",
        landId:"",
        strainId: "",
        saleNum: "",
        remarks: "",
        reason: "0",
        lossTime: "",
      },
      //加工字段
      formJG: {
        name: "",
        proid:"",
        landId:"",
        strainId: "",
        saleNum: "",
        processNum: "",
        remarks: "",
        reason: "0",
        saleTime: "",
      },
      visible: false,
      visibleKC: false,
      visibleJG: false,
      value: true,
      page: {
        pageSize: 16,
        currentPage: 1,
        total: 0,
      },
      option: {
        emptyBtn: false,
        submitBtn: false,
        gutter: 30,
        column: [
          {
            label: "种养品种",
            prop: "strainName",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入种养品种",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售时间",
            prop: "saleTime",
            type: "date",
            span: 24,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择销售时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售数量",
            prop: "saleNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入销售数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售去向",
            prop: "saleDestination",
            span: 24,
            rules: [
              {
                required: true,
                message: "请选择销售去向",
                trigger: "blur",
              },
            ],
          },
          {
            label: "销售价格",
            prop: "salePrice",
            span: 24,
            type: "number",
          },
          {
            label: "品牌",
            prop: "saleBrand",
            span: 24,
          },
          {
            label: "操作人",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入操作人",
                trigger: "blur",
              },
            ],
          },
        ]
      },
      optionKC: {
        emptyBtn: false,
        submitBtn: false,
        gutter: 30,
        column: [
          {
            label: "损耗品种",
            prop: "strainName",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入损耗品种",
                trigger: "blur",
              },
            ],
          },
          {
            label: "损耗时间",
            prop: "lossTime",
            type: "date",
            span: 24,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择损耗时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "损耗数量",
            prop: "saleNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入损耗数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "损耗原因",
            prop: "reason",
            span: 24,
            type: "select",
            value: "0",
            dicData: [
              {
                label: "库存损耗",
                value: "0",
              }],
            rules: [
              {
                required: true,
                message: "请选择损耗原因",
                trigger: "blur",
              },
            ],
          },
          {
            label: "备注",
            prop: "remarks",
            span: 24,
          },
          {
            label: "操作人",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入操作人",
                trigger: "blur",
              },
            ],
          },
        ]
      },
      optionJG: {
        emptyBtn: false,
        submitBtn: false,
        gutter: 30,
        column: [
          {
            label: "加工品种",
            prop: "strainName",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入加工品种",
                trigger: "blur",
              },
            ],
          },
          {
            label: "加工时间",
            prop: "saleTime",
            type: "date",
            span: 24,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择加工时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "加工数量",
            prop: "saleNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入加工数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "加工产品",
            prop: "processId",
            span: 24,
            type: "tree",
            dicUrl: "/api/machining/machining/selectInfo",
            props: {
              label: "processName",
              value: "processId"
            },
            rules: [
              {
                required: true,
                message: "请输入加工产品",
                trigger: "blur",
              },
            ],
          },
          {
            label: "产品数量",
            prop: "processNum",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入产品数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "备注",
            prop: "remarks",
            span: 24,
          },
          {
            label: "操作人",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入操作人",
                trigger: "blur",
              },
            ],
          },
        ]
      },
      selectionList: [],
      data: [],
    };
  },
  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() {
  },
  created() {
    this.initData();
    //初始化列表数据
    this.onLoad(this.page);
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    submitSole() {
      var that = this;
      this.$refs.form.validate((vaild, done) => {
        if (vaild) {
          add(this.form).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            //提交完成,关闭窗口清空数据
            that.cleanData();
            done();
          }, error => {
            window.console.log(error);
            //提交失败,关闭窗口清空数据
            that.cleanData();
            done();
          });
        }
      })
    },
    //加工产品
    submitJGloss() {
      var that = this;
      this.$refs.form.validate((vaild, done) => {
        if (vaild) {
          addjg(this.formJG).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            //提交完成,关闭窗口清空数据
            that.cleanJGData();
            done();
          }, error => {
            window.console.log(error);
            //提交失败,关闭窗口清空数据
            that.cleanJGData();
            done();
          });
        }
      })
    },
    submitKCloss() {
      var that = this;
      this.$refs.form.validate((vaild, done) => {
        if (vaild) {
          addKC(this.formKC).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            //提交完成,关闭窗口清空数据
            that.cleanKCData();
            done();
          }, error => {
            window.console.log(error);
            //提交失败,关闭窗口清空数据
            that.cleanKCData();
            done();
          });
        }
      })
    },
    handleChange(value) {
      if (value != null) {
        this.form.saleDestination = value[0];
        this.form.city = value[1];
        this.form.county = value[2];
      }
    },
    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;
      //   }
      // });
    },
    openWindow(index, data) {
      if (index == 0) {
        this.form.name = this.userInfo.nick_name;
        this.form.createUser = this.userInfo.user_id;
        this.form.weight = data.weight;
        this.form.proid=data.id;
        this.form.landId=data.landId;
        this.form.strainId = data.strainId;
        this.form.strainName = data.strainName;
        this.visible = true;
      } else if (index == 1) {
        this.formKC.name = this.userInfo.nick_name;
        this.formKC.createUser = this.userInfo.user_id;
        this.formKC.weight = data.weight;
        this.formKC.proid=data.id;
        this.formKC.landId=data.landId;
        this.formKC.strainId = data.strainId;
        this.formKC.strainName = data.strainName;
        this.visibleKC = true;
      }
      else if (index == 2) {
        this.formJG.name = this.userInfo.nick_name;
        this.formJG.createUser = this.userInfo.user_id;
        this.formJG.proid=data.id;
        this.formJG.landId=data.landId;
        this.formJG.weight = data.weight;
        this.formJG.strainId = data.strainId;
        this.formJG.strainName = data.strainName;
        this.visibleJG = true;
      }
    },
    cleanData() {
      var that = this;
      that.form.saleDestination = "";
      that.$refs.form.resetFields();
      that.visible = false;
    },
    cleanKCData() {
      var that = this;
      that.$refs.form.resetFields();
      that.visibleKC = false;
    },
    cleanJGData() {
      var that = this;
      that.$refs.form.resetFields();
      that.visibleJG = false;
    },
    handleSizeChange(val) {
      this.page.pageSize = val;
      this.onLoad(this.page);
    },
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.onLoad(this.page);
    },
    onLoad(page, params = {}) {
      params['tenantId'] = this.userInfo.tenant_id;
      params['deptId'] = this.userInfo.dept_id;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.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: 240px;
        /*height: 315px;*/
        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;
          }
        }
        .btn {
          text-align: center;
          margin-top: 8px;
        }
      }
    }
  }
  .el-page {
    padding-top: 30px;
    text-align: center;
  }
}
</style>
src/views/process/process.vue
New file
@@ -0,0 +1,254 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.process_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/process/process";
  import {mapGetters} from "vuex";
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "品种id",
              prop: "strainId",
              rules: [{
                required: true,
                message: "请输入品种id",
                trigger: "blur"
              }]
            },
            {
              label: "加工时间",
              prop: "saleTime",
              rules: [{
                required: true,
                message: "请输入加工时间",
                trigger: "blur"
              }]
            },
            {
              label: "加工数量",
              prop: "saleNum",
              rules: [{
                required: true,
                message: "请输入加工数量",
                trigger: "blur"
              }]
            },
            {
              label: "加工产品id",
              prop: "processId",
              rules: [{
                required: true,
                message: "请输入加工产品id",
                trigger: "blur"
              }]
            },
            {
              label: "产品数量",
              prop: "processNum",
              rules: [{
                required: true,
                message: "请输入产品数量",
                trigger: "blur"
              }]
            },
            {
              label: "地块id",
              prop: "landId",
              rules: [{
                required: true,
                message: "请输入地块id",
                trigger: "blur"
              }]
            },
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.process_add, false),
          viewBtn: this.vaildData(this.permission.process_view, false),
          delBtn: this.vaildData(this.permission.process_delete, false),
          editBtn: this.vaildData(this.permission.process_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        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/retrieval/retrieval.vue
New file
@@ -0,0 +1,281 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.retrieval_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/retrieval/retrieval";
  import {mapGetters} from "vuex";
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "品种id",
              prop: "strainId",
              rules: [{
                required: true,
                message: "请输入品种id",
                trigger: "blur"
              }]
            },
            {
              label: "出库时间",
              prop: "saleTime",
              rules: [{
                required: true,
                message: "请输入出库时间",
                trigger: "blur"
              }]
            },
            {
              label: "出库数量",
              prop: "saleNum",
              rules: [{
                required: true,
                message: "请输入出库数量",
                trigger: "blur"
              }]
            },
            {
              label: "出库去向(省)",
              prop: "saleDestination",
              rules: [{
                required: true,
                message: "请输入出库去向(省)",
                trigger: "blur"
              }]
            },
            {
              label: "具体出库去向",
              prop: "saleDestination1",
              rules: [{
                required: true,
                message: "请输入具体出库去向",
                trigger: "blur"
              }]
            },
            {
              label: "出库备注",
              prop: "remarks",
              rules: [{
                required: true,
                message: "请输入出库备注",
                trigger: "blur"
              }]
            },
            {
              label: "出库去向(市)",
              prop: "city",
              rules: [{
                required: true,
                message: "请输入出库去向(市)",
                trigger: "blur"
              }]
            },
            {
              label: "出库去向(县)",
              prop: "county",
              rules: [{
                required: true,
                message: "请输入出库去向(县)",
                trigger: "blur"
              }]
            },
            {
              label: "地块id",
              prop: "landId",
              rules: [{
                required: true,
                message: "请输入地块id",
                trigger: "blur"
              }]
            },
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.retrieval_add, false),
          viewBtn: this.vaildData(this.permission.retrieval_view, false),
          delBtn: this.vaildData(this.permission.retrieval_delete, false),
          editBtn: this.vaildData(this.permission.retrieval_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        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/system/user.vue
@@ -510,7 +510,7 @@
                  prop: "farmId",
                  labelWidth:110,
                  type: "tree",
                  multiple: true,
                  // multiple: true,
                  dicData: [],
                  props: {
                    label: "farmName",
src/views/wel/index.vue
@@ -224,7 +224,7 @@
    //本年农事操作记录
    getFarmingCount() {
      var that = this;
      getFarmingCount(this.userInfo.dept_id).then((res) => {
      getFarmingCount(this.userInfo.farmId).then((res) => {
        that.total = res.data.data;
        // that.total = 0;
        if (that.total > 0) {
@@ -235,13 +235,13 @@
    //本年农事操作记录,分组统计
    getFarmingStatis() {
      var that = this;
      getFarmingStatis(this.userInfo.dept_id).then((res) => {
      getFarmingStatis(this.userInfo.farmId).then((res) => {
        that.farmingList = res.data.data;
      });
    },
    StockCount() {
      var that = this;
      StockCount(this.userInfo.dept_id).then((res) => {
      StockCount(this.userInfo.farmId).then((res) => {
        that.stockList= res.data.data;
        console.log(that.stockList)
      });
@@ -249,7 +249,7 @@
    //地块使用率统计
    getCountStatis() {
      var that = this;
      selectCount(this.userInfo.dept_id).then((res) => {
      selectCount(this.userInfo.farmId).then((res) => {
        var data = res.data.data;
        that.landInfo = data;
      });
@@ -263,7 +263,7 @@
        status: 1,
      };
      params['tenantId'] = this.userInfo.tenant_id;
      params['deptId'] = this.userInfo.dept_id;
      params['farmId'] = this.userInfo.farmId;
      getList(1, 10, Object.assign(params)).then((res) => {
        const data = res.data.data;
        this.farmPlanList = data.records;