结束种养可选择结束时间,首页结束种养按钮点击后列表
2 files modified
1 files added
| | |
| | | </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 icon="el-icon-error" :size="size" :type="type" @click="over(row.id)">结 束</el-button> --> |
| | | <el-button icon="el-icon-error" :size="size" :type="type" @click="getData(row)">结 束</el-button> |
| | | |
| | | <el-dialog |
| | | title="确认结束种养" |
| | | :visible.sync="overVisible" |
| | | width="30%" |
| | | append-to-body="true"> |
| | | <div class="block"> |
| | | <span class="demonstration">结束时间</span> |
| | | <el-date-picker |
| | | v-model="endPlantTime" |
| | | type="date" |
| | | placeholder="选择日期" |
| | | value-format="yyyy-MM-dd" |
| | | align="center"> |
| | | </el-date-picker> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="overVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="over">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <el-button |
| | | :type="type" |
| | | :size="size" |
| | |
| | | recoveryVisible: false, |
| | | detectionVisible: false, |
| | | visible: true, |
| | | overVisible:false, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | |
| | | ], |
| | | }, |
| | | data: [], |
| | | endPlantTime:"", |
| | | //结束种养时的传输数据 |
| | | overData:"" |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | 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: "操作成功!", |
| | | // }) |
| | | // }) |
| | | // }, |
| | | //结束种植 |
| | | over (id) { |
| | | var that = this |
| | | that.$confirm("确定结束当前种植的农产品?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | const data = { |
| | | id: id, |
| | | status: 2, |
| | | over(){ |
| | | this.overData.endPlantTime = this.endPlantTime |
| | | const data = { |
| | | id:this.overData.id, |
| | | status:2, |
| | | endPlantTime:this.overData.endPlantTime |
| | | } |
| | | update(data).then((res)=>{ |
| | | if(res.data.code == 200){ |
| | | this.onLoad(this.page, this.query) |
| | | } |
| | | return update(data) |
| | | }) |
| | | .then(() => { |
| | | that.onLoad(this.page, this.query) |
| | | that.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | }) |
| | | this.overVisible = false |
| | | }, |
| | | getData(row){ |
| | | this.overVisible = true |
| | | this.overData = row |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | <el-button plain size="small" @click="recovery(item)"> |
| | | <span style="color: #5abf78">采收</span> |
| | | </el-button> |
| | | <el-button plain size="small" @click="over(item.id)">结束</el-button> |
| | | <!-- <el-button plain size="small" @click="over(item.id)">结束</el-button> --> |
| | | <el-button plain size="small" @click="over(item)">结束</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | <!-- 弹窗, 采收 --> |
| | | <recovery v-if="recoveryVisible" ref="recovery" :farmDetail="farm"></recovery> |
| | | <!-- 弹窗,结束种养--> |
| | | <over v-if="overVisible" ref="over" :farmDetail="farm"></over> |
| | | <!-- 圈地 --> |
| | | <land v-if="landVisible" ref="land"></land> |
| | | <!-- 种养品 --> |
| | |
| | | import { StockCount } from "@/api/stock/stock" |
| | | import {getFarmList} from "@/api/farm/farm"; |
| | | import recovery from "./recovery.vue" |
| | | import over from "./over.vue" |
| | | import land from "./land.vue" |
| | | import plant from "./plant.vue" |
| | | import farming from "./farming.vue" |
| | |
| | | export default { |
| | | components: { |
| | | recovery, |
| | | over, |
| | | land, |
| | | plant, |
| | | farming, |
| | |
| | | farmingCount: 0, |
| | | farmPlanList: [], |
| | | recoveryVisible: false, |
| | | overVisible:false, |
| | | landVisible: false, |
| | | plantVisible: false, |
| | | farmingVisible: false, |
| | |
| | | this.$refs.recovery.init(data) |
| | | }) |
| | | }, |
| | | //结束种植 |
| | | over (id) { |
| | | var that = this |
| | | this.$confirm("确定结束当前种植的农产品?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | //结束种养 |
| | | over(data) { |
| | | this.overVisible = true |
| | | this.$nextTick(() => { |
| | | this.$refs.over.initData(data) |
| | | }) |
| | | .then(() => { |
| | | const data = { |
| | | id: id, |
| | | status: 2, |
| | | } |
| | | return update(data) |
| | | }) |
| | | .then(() => { |
| | | that.onLoad() |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | }) |
| | | }, |
| | | //结束种植 |
| | | // over (id) { |
| | | // var that = this |
| | | // this.$confirm("确定结束当前种植的农产品?", { |
| | | // confirmButtonText: "确定", |
| | | // cancelButtonText: "取消", |
| | | // type: "warning", |
| | | // }) |
| | | // .then(() => { |
| | | // const data = { |
| | | // id: id, |
| | | // status: 2, |
| | | // } |
| | | // return update(data) |
| | | // }) |
| | | // .then(() => { |
| | | // that.onLoad() |
| | | // this.$message({ |
| | | // type: "success", |
| | | // message: "操作成功!", |
| | | // }) |
| | | // }) |
| | | // }, |
| | | //圈地 |
| | | land () { |
| | | this.landVisible = true |
| New file |
| | |
| | | <template> |
| | | <el-dialog |
| | | v-if="visible" |
| | | title="确认结束种养" |
| | | :visible.sync="visible" |
| | | width="80%" |
| | | :modal-append-to-body="false" |
| | | :append-to-body="true" |
| | | :close-on-click-modal="false" |
| | | destroy-on-close="true"> |
| | | |
| | | <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" |
| | | > |
| | | <template slot-scope="{ type, size, row }" slot="menu"> |
| | | <el-button icon="el-icon-error" :size="size" :type="type" @click="getData(row)">结 束</el-button> |
| | | <el-dialog |
| | | title="确认结束种养" |
| | | :visible.sync="overVisible" |
| | | width="30%" |
| | | append-to-body="true"> |
| | | <div class="block"> |
| | | <span class="demonstration">结束时间</span> |
| | | <el-date-picker |
| | | v-model="endPlantTime" |
| | | type="date" |
| | | placeholder="选择日期" |
| | | value-format="yyyy-MM-dd" |
| | | align="center"> |
| | | </el-date-picker> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="overVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="over">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </template> |
| | | </avue-crud> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDetail, getList, update, remove, save } from "@/api/farmplant/farmplant" |
| | | import { getStrainList } from "@/api/farmplant/strain" |
| | | import { getLandList } from "@/api/land/land" |
| | | import { mapGetters } from "vuex" |
| | | import detection from "../farmplant/detection.vue" |
| | | import recovery from "./recovery.vue" |
| | | export default { |
| | | components: { |
| | | recovery, |
| | | detection |
| | | }, |
| | | props: { |
| | | farmDetail:{ |
| | | type:Object |
| | | } |
| | | }, |
| | | data () { |
| | | return { |
| | | visible: true, |
| | | overVisible:false, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | excelBox: false, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | selectionList: [], |
| | | landList: [], |
| | | landId: 0, |
| | | option: { |
| | | tip: false, |
| | | height: 520, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | viewBtn: false, |
| | | header:false, |
| | | menuWidth: 100, |
| | | menuAlign: "center", |
| | | align: "center", |
| | | selection: true, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | indexFixed: false, |
| | | selectionFixed: false, |
| | | expandFixed: false, |
| | | menuFixed: false, |
| | | column: [ |
| | | { |
| | | label: "种养品", |
| | | prop: "strainId", |
| | | hide: true, |
| | | labelWidth: 110, |
| | | type: "tree", |
| | | dicData: [], |
| | | props: { |
| | | label: "strainName", |
| | | value: "id" |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择种养品", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "种养品名称", |
| | | prop: "strainName", |
| | | search: true, |
| | | searchSpan: 5, |
| | | searchLabelWidth: 110, |
| | | display: false, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入种养品", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "品种", |
| | | prop: "varieties", |
| | | // search:true, |
| | | // searchSpan:5, |
| | | labelWidth: 110, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入种养品名称", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "种养品图片", |
| | | prop: "url", |
| | | type: "upload", |
| | | listType: "picture-img", |
| | | width: 100, |
| | | labelWidth: 110, |
| | | display: false, |
| | | }, |
| | | { |
| | | label: "所属地块", |
| | | prop: "landName", |
| | | display: false, |
| | | }, |
| | | { |
| | | label: "所属地块", |
| | | prop: "landId", |
| | | searchSpan: 4, |
| | | type: "tree", |
| | | hide: true, |
| | | dicData: [], |
| | | props: { |
| | | label: "landName", |
| | | value: "id" |
| | | }, |
| | | labelWidth: 110, |
| | | change: (val) => { |
| | | this.landId = val.value |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择所属地块", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "种植标准", |
| | | prop: "plant", |
| | | // search:true, |
| | | // searchSpan:4, |
| | | labelWidth: 110, |
| | | type: "select", |
| | | dicData: [ |
| | | { |
| | | label: "有机", |
| | | value: "0" |
| | | }, |
| | | { |
| | | label: "绿色", |
| | | value: "1" |
| | | }, |
| | | { |
| | | label: "无公害", |
| | | value: "2" |
| | | }, |
| | | { |
| | | label: "普通", |
| | | value: "3" |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择种植标准", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "种植方式", |
| | | prop: "plantingWay", |
| | | // search:true, |
| | | // searchSpan:4, |
| | | type: "select", |
| | | labelWidth: 110, |
| | | dicData: [ |
| | | { |
| | | label: "移栽", |
| | | value: "0" |
| | | }, |
| | | { |
| | | label: "直播", |
| | | value: "1" |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择种植方式", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "作业方式", |
| | | prop: "jobWay", |
| | | // search:true, |
| | | // searchSpan:4, |
| | | labelWidth: 110, |
| | | type: "select", |
| | | dicData: [ |
| | | { |
| | | label: "人工", |
| | | value: "0" |
| | | }, |
| | | { |
| | | label: "机械", |
| | | value: "1" |
| | | }, |
| | | ], |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入作业方式", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "移栽时间", |
| | | prop: "transplanTimeStart", |
| | | search:true, |
| | | searchValue:"", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | labelWidth: 110, |
| | | width:82, |
| | | hide:true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择移栽时间", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "移栽时间", |
| | | prop: "transplanTime", |
| | | searchValue:"", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | labelWidth: 110, |
| | | width:82, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择移栽时间", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "预计采收时间", |
| | | prop: "recoveryTime", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | hide: true, |
| | | labelWidth: 110, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: "请选预计采收时间", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "预计亩产", |
| | | prop: "per", |
| | | labelWidth: 110, |
| | | hide: true, |
| | | type: "number", |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: "请输入预计亩产", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "株数", |
| | | prop: "plantNumber", |
| | | labelWidth: 110, |
| | | type: "number", |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: "请输入株数", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "株间距", |
| | | prop: "plantSpacing", |
| | | labelWidth: 110, |
| | | type: "number", |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: "请输入株间距", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | // { |
| | | // label: "投苗时间", |
| | | // prop: "seedingTime", |
| | | // type: "date", |
| | | // format: "yyyy-MM-dd", |
| | | // valueFormat: "yyyy-MM-dd", |
| | | // labelWidth:110, |
| | | // hide:true, |
| | | // rules: [ |
| | | // { |
| | | // required: true, |
| | | // message: "请选择投苗时间", |
| | | // trigger: "blur", |
| | | // }, |
| | | // ], |
| | | // display:false, |
| | | // }, |
| | | // { |
| | | // label: "养殖数量", |
| | | // prop: "breed", |
| | | // labelWidth:110, |
| | | // type:"number", |
| | | // hide:true, |
| | | // rules: [ |
| | | // { |
| | | // required: true, |
| | | // message: "请输入养殖数量", |
| | | // trigger: "blur", |
| | | // }, |
| | | // ], |
| | | // display:false, |
| | | // }, |
| | | { |
| | | label: "种植状态", |
| | | prop: "status", |
| | | searchValue:"1", |
| | | search: true, |
| | | searchSpan: 4, |
| | | labelWidth: 110, |
| | | type: "select", |
| | | dicData: [ |
| | | { |
| | | label: "种植中", |
| | | value: "1" |
| | | }, |
| | | { |
| | | label: "已结束", |
| | | value: "2" |
| | | }, |
| | | ], |
| | | display: false, |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | endPlantTime:"", |
| | | //结束种养时的传输数据 |
| | | overData:"", |
| | | strainId:"", |
| | | } |
| | | }, |
| | | 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(",") |
| | | }, |
| | | }, |
| | | methods: { |
| | | //初始化数据 |
| | | initData(data){ |
| | | var that = this |
| | | this.strainId = data.strainId |
| | | that.visible = true; |
| | | var params={ |
| | | status:"1" |
| | | } |
| | | this.onLoad(this.page,params) |
| | | //获取农地数据 |
| | | getLandList(that.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 |
| | | } |
| | | }) |
| | | //获取农产品数据 |
| | | getStrainList(0).then((res) => { |
| | | if (res.data.code == 200) { |
| | | var strainId = that.findObject(that.option.column, "strainId") |
| | | strainId.dicData = res.data.data |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | searchReset () { |
| | | this.query = {} |
| | | this.onLoad(this.page) |
| | | }, |
| | | searchChange (params, done) { |
| | | if(params.transplanTimeStart !=""){ |
| | | params['transplanTimeEnd']=this.getEndDate(params.transplanTimeStart,1) |
| | | } |
| | | this.query = params |
| | | console.log(this.query) |
| | | this.page.currentPage = 1 |
| | | this.onLoad(this.page, params) |
| | | this.query = {} |
| | | 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 = {}) { |
| | | var datas = this.$route.query.id |
| | | params.landId = datas |
| | | if (this.landId) { |
| | | params['landId'] = this.landId |
| | | } |
| | | params['tenantId'] = this.userInfo.tenant_id |
| | | params['deptId'] = this.userInfo.dept_id |
| | | params['farmId'] = this.farmDetail.id |
| | | params['strainId'] = this.strainId |
| | | 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() |
| | | }) |
| | | }, |
| | | // 结束种植 |
| | | // 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: "操作成功!", |
| | | // }) |
| | | // }) |
| | | // }, |
| | | //结束种植 |
| | | over(){ |
| | | this.overData.endPlantTime = this.endPlantTime |
| | | const data = { |
| | | id:this.overData.id, |
| | | status:2, |
| | | endPlantTime:this.overData.endPlantTime |
| | | } |
| | | update(data).then((res)=>{ |
| | | if(res.data.code == 200){ |
| | | this.onLoad(this.page, this.query) |
| | | } |
| | | }) |
| | | this.overVisible = false |
| | | }, |
| | | getData(row){ |
| | | this.overVisible = true |
| | | this.overData = row |
| | | }, |
| | | getEndDate(date,num){ |
| | | var array = date.split('-') |
| | | array[2]=array[2]-0+num |
| | | return array[0]+"-"+array[1]+"-"+array[2] |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |