| | |
| | | :modal-append-to-body="false" |
| | | :append-to-body="true" |
| | | :close-on-click-modal="false" |
| | | destroy-on-close="true"> |
| | | destroy-on-close="true" |
| | | @close="close"> |
| | | |
| | | <avue-crud |
| | | :option="option" |
| | |
| | | @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> |
| | | <template slot="menuLeft" slot-scope="{size}"> |
| | | <el-button type="primary" :size="large" @click="overAllVisible = true">批量结束种养</el-button> |
| | | <el-dialog |
| | | title="确认结束种养" |
| | | title="批量结束种养时间" |
| | | :visible.sync="overAllVisible" |
| | | 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="overAllVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="overAll">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </template> |
| | | <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"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDetail, getList, update, remove, save } from "@/api/farmplant/farmplant" |
| | | import { getDetail, getList, update, remove, save,overAll } from "@/api/farmplant/farmplant" |
| | | import { getStrainList } from "@/api/farmplant/strain" |
| | | import { getLandList } from "@/api/land/land" |
| | | import { mapGetters } from "vuex" |
| | |
| | | recovery, |
| | | detection |
| | | }, |
| | | props: { |
| | | farmDetail:{ |
| | | type:Object |
| | | } |
| | | }, |
| | | // props: { |
| | | // farmDetail:{ |
| | | // type:Object |
| | | // } |
| | | // }, |
| | | data () { |
| | | return { |
| | | visible: true, |
| | | overVisible:false, |
| | | overAllVisible:false, |
| | | form: {}, |
| | | query: {}, |
| | | query: { |
| | | status:1 |
| | | }, |
| | | loading: true, |
| | | excelBox: false, |
| | | page: { |
| | |
| | | editBtn: false, |
| | | delBtn: false, |
| | | viewBtn: false, |
| | | header:false, |
| | | // header:false, |
| | | menuWidth: 100, |
| | | menuAlign: "center", |
| | | align: "center", |
| | |
| | | selectionFixed: false, |
| | | expandFixed: false, |
| | | menuFixed: false, |
| | | addBtn:false, |
| | | refreshBtn:false, |
| | | columnBtn:false, |
| | | searchShowBtn:false, |
| | | column: [ |
| | | { |
| | | label: "种养品", |
| | |
| | | //结束种养时的传输数据 |
| | | overData:"", |
| | | strainId:"", |
| | | farmId:"", |
| | | } |
| | | }, |
| | | created () { |
| | | this.endPlantTime = new Date() |
| | | // this.initData() |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | methods: { |
| | | //初始化数据 |
| | | initData(data){ |
| | | initData(data,farmId){ |
| | | var that = this |
| | | this.farmId = farmId |
| | | this.query.strainId = data.strainId |
| | | this.query.farmId = farmId |
| | | 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 |
| | | } |
| | | }) |
| | | // //获取农地数据 |
| | | // 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.onLoad(this.page) |
| | | }, |
| | | searchChange (params, done) { |
| | | if(params.transplanTimeStart !=""){ |
| | | if(params.transplanTimeStart !="" && params.transplanTimeStart !=null){ |
| | | 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 = {} |
| | | this.query.status = 1 |
| | | this.query.transplanTimeStart = "" |
| | | this.query.strainName = "" |
| | | this.query.strainId = "" |
| | | done() |
| | | }, |
| | | selectionChange (list) { |
| | |
| | | } |
| | | params['tenantId'] = this.userInfo.tenant_id |
| | | params['deptId'] = this.userInfo.dept_id |
| | | params['farmId'] = this.farmDetail.id |
| | | params['farmId'] = this.farmId |
| | | params['strainId'] = this.strainId |
| | | this.loading = true |
| | | getList( |
| | |
| | | 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) |
| | | if(this.endPlantTime == ""){ |
| | | this.$message({ |
| | | type: "error", |
| | | message: "请选择结束种养日期!", |
| | | }) |
| | | }else{ |
| | | this.overData.endPlantTime = this.endPlantTime |
| | | const data = { |
| | | id:this.overData.id, |
| | | status:2, |
| | | endPlantTime:this.overData.endPlantTime |
| | | } |
| | | }) |
| | | this.overVisible = false |
| | | update(data).then((res)=>{ |
| | | if(res.data.code == 200){ |
| | | this.onLoad(this.page, this.query) |
| | | } |
| | | }) |
| | | this.overVisible = false |
| | | } |
| | | }, |
| | | getData(row){ |
| | | this.overVisible = true |
| | |
| | | var array = date.split('-') |
| | | array[2]=array[2]-0+num |
| | | return array[0]+"-"+array[1]+"-"+array[2] |
| | | } |
| | | }, |
| | | close(){ |
| | | this.query.strainId="" |
| | | this.$parent.onLoad() |
| | | }, |
| | | overAll(){ |
| | | if(this.selectionList == 0){ |
| | | this.$message({ |
| | | type: "error", |
| | | message: "请至少选择一项!", |
| | | }) |
| | | }else{ |
| | | if(this.endPlantTime == ""){ |
| | | this.$message({ |
| | | type: "error", |
| | | message: "请选择结束种养时间!", |
| | | }) |
| | | }else{ |
| | | // this.selectionList.forEach((e)=>{ |
| | | // const data = { |
| | | // id:e.id, |
| | | // status:2, |
| | | // endPlantTime:this.endPlantTime |
| | | // } |
| | | // update(data).then((res)=>{ |
| | | |
| | | // }) |
| | | // }) |
| | | // for(let i=0;i<this.selectionList.length;i++){ |
| | | // const data = { |
| | | // id:this.selectionList[i].id, |
| | | // status:2, |
| | | // endPlantTime:this.endPlantTime |
| | | // } |
| | | // update(data).then((res)=>{ |
| | | |
| | | // }) |
| | | // this.onLoad(this.page, this.query) |
| | | // this.overAllVisible = false |
| | | // } |
| | | |
| | | var ids = [] |
| | | this.selectionList.forEach((e)=>{ |
| | | ids.push(e.id) |
| | | }) |
| | | var params={ |
| | | ids:ids, |
| | | endPlantTime:this.endPlantTime |
| | | } |
| | | overAll(params).then((res)=>{ |
| | | this.onLoad(this.page, this.query) |
| | | this.overAllVisible = false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |