From cfd4f52e81902b4efd2081e6dd9ca64cc98139b0 Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Mon, 01 Aug 2022 15:20:24 +0800
Subject: [PATCH] 地块详情添加农资使用记录
---
src/views/farm/stockUseInfo.vue | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 224 insertions(+), 0 deletions(-)
diff --git a/src/views/farm/stockUseInfo.vue b/src/views/farm/stockUseInfo.vue
new file mode 100644
index 0000000..27ec78a
--- /dev/null
+++ b/src/views/farm/stockUseInfo.vue
@@ -0,0 +1,224 @@
+<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"
+ @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,
+ getListByNz,
+} from "@/api/farm/farmingrecord"
+import { getLandList } from "@/api/land/land"
+import { getUserList } from "@/api/system/user"
+import { selectStockFa } from "@/api/stockfactory/stockfactory"
+import { mapGetters } from "vuex"
+export default {
+ data () {
+ return {
+ visible: true,
+ form: {},
+ query: {},
+ loading: true,
+ excelBox: false,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ landId: 0,
+ landList: [36],
+ option: {
+ tip: false,
+ height: 520,
+ editBtn: false,
+ delBtn: false,
+ viewBtn: false,
+ header:false,
+ menuWidth: 200,
+ menuAlign: "center",
+ align: "center",
+ selection: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ indexFixed: false,
+ // selectionFixed: false,
+ // expandFixed: false,
+ // menuFixed: false,
+ menu:false,
+ column: [
+
+ {
+ label: "所属地块",
+ prop: "landId",
+ searchSpan: 4,
+ search: true,
+ type: "select",
+ hide: true,
+ dicData: [],
+ props: {
+ label: "landName",
+ value: "id",
+ },
+ change: (val) => {
+ this.landId = val.value
+ },
+ labelWidth: 110,
+ rules: [
+ {
+ required: true,
+ message: "请选择所属地块",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "所属地块",
+ prop: "landName",
+ display: false,
+ },
+ {
+ label: "品种",
+ prop: "strainName",
+ display: false,
+ },
+ {
+ label: "农资及用量",
+ prop: "content",
+ display: false,
+ },
+ {
+ label: "农资使用时间",
+ prop: "time",
+ display: false,
+ },
+ {
+ label: "厂家",
+ prop: "factoryName",
+ display: false,
+ }
+ ],
+ },
+ data: [],
+ }
+ },
+ created () {
+ this.initData()
+ },
+ computed: {
+ ...mapGetters(["permission", "userInfo"]),
+ ids () {
+ let ids = []
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id)
+ })
+ return ids.join(",")
+ },
+ },
+ mounted () {
+ },
+ methods: {
+ getType () {
+ return this.type
+ },
+ //初始化数据
+ initData () {
+ var that = this
+ //获取农地地块数据
+ getLandList(this.userInfo.dept_id).then((res) => {
+ if (res.data.code == 200) {
+ var landIdcolumn = that.findObject(that.option.column, "landId")
+ that.landList = res.data.data
+ landIdcolumn.dicData = res.data.data
+ }
+ })
+
+ },
+ 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
+ var datas = this.$route.query.id
+ params.landId = datas
+ params['tenantId'] = this.userInfo.tenant_id
+ params['deptId'] = this.userInfo.dept_id
+ if (this.landId) {
+ params['landId'] = this.landId
+ }
+ getListByNz(
+ 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>
--
Gitblit v1.9.3