智慧农业后台管理页面
xiebin
2022-08-02 e1bd6ba743a490547ef768c80f158a10aadcb953
地块详情添加采收和种植结束功能
2 files modified
43 ■■■■■ changed files
src/views/farmplant/farmplant.vue 41 ●●●●● patch | view | raw | blame | history
src/views/land/LandDetail.vue 2 ●●● patch | view | raw | blame | history
src/views/farmplant/farmplant.vue
@@ -30,6 +30,8 @@
                >删 除</el-button>
            </template>
            <template slot-scope="{ type, size, row }" slot="menu">
              <el-button icon="el-icon-check" :size="size" :type="type" @click="recovery(row)">采 收</el-button>
              <el-button icon="el-icon-error" :size="size" :type="type" @click="over(row.id)">结 束</el-button>
                <el-button
                    :type="type"
                    :size="size"
@@ -40,7 +42,10 @@
        </avue-crud>
        <!-- 检测报告 -->
        <detection v-if="detectionVisible" ref="detection"></detection>
        <!-- 弹窗, 采收 -->
        <recovery v-if="recoveryVisible" ref="recovery"></recovery>
    </basic-container>
</template>
<script>
@@ -49,8 +54,10 @@
import { getLandList } from "@/api/land/land"
import { mapGetters } from "vuex"
import detection from "./detection.vue"
import recovery from "../wel/recovery.vue"
export default {
    components: {
        recovery,
        detection
    },
    props: [
@@ -58,6 +65,7 @@
    ],
    data () {
        return {
            recoveryVisible: false,
            detectionVisible: false,
            visible: true,
            form: {},
@@ -79,7 +87,7 @@
                delBtn: true,
                viewBtn: true,
                header:false,
                menuWidth: 280,
                menuWidth: 580,
                menuAlign: "center",
                align: "center",
                selection: true,
@@ -115,7 +123,6 @@
                        hide: true,
                        labelWidth: 110,
                        type: "tree",
                        // dicUrl: `/api/strain/strain-tree?strainType=0`,
                        dicData: [],
                        props: {
                            label: "strainName",
@@ -715,6 +722,36 @@
                this.$refs.detection.init(row.id)
            })
        },
        //采收
        recovery (data) {
          this.recoveryVisible = true
          this.$nextTick(() => {
            this.$refs.recovery.init(data)
          })
        },
        //结束种植
        over (id) {
            var that = this
            that.$confirm("确定结束当前种植的农产品?", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            })
            .then(() => {
                const data = {
                  id: id,
                  status: 2,
                }
                return update(data)
            })
            .then(() => {
                that.onLoad(this.page, this.query)
                that.$message({
                  type: "success",
                  message: "操作成功!",
                })
            })
        },
    },
};
</script>
src/views/land/LandDetail.vue
@@ -17,7 +17,7 @@
                    <el-button @click="btnGrounpShow = !btnGrounpShow" icon="el-icon-menu"></el-button>
                    <div v-show="btnGrounpShow" class="btn-grounp">
                        <el-button @click="DelLand(delId)">删除地块</el-button>
                        <el-button size="small" @click="DelLand(delId)">删除地块</el-button>
                        <el-button size="small" @click="land">编辑地块</el-button>
                    </div>
                </div>