webpackJsonp([2],{"9bBU":function(e,t,r){r("mClu");var a=r("FeBl").Object;e.exports=function(e,t,r){return a.defineProperty(e,t,r)}},C4MV:function(e,t,r){e.exports={default:r("9bBU"),__esModule:!0}},LGkI:function(e,t,r){var a=r("zUBE");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);r("rjj0")("1380a6a4",a,!0)},bOdI:function(e,t,r){"use strict";t.__esModule=!0;var a,i=r("C4MV"),n=(a=i)&&a.__esModule?a:{default:a};t.default=function(e,t,r){return t in e?(0,n.default)(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},mClu:function(e,t,r){var a=r("kM2E");a(a.S+a.F*!r("+E39"),"Object",{defineProperty:r("evD5").f})},rYNc:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r("Xxa5"),i=r.n(a),n=r("BO1k"),o=r.n(n),l=r("exGp"),s=r.n(l),d=r("bOdI"),c=r.n(d),h={data:function(){return c()({searchForm:{earTag:"",gender:"",breeding:"",health:"",breedStatus:"",period:"",pighouse:"",unit:""},dataList:[],pageIndex:1,pageSize:10,totalPage:0,dataListLoading:!1,selectionDataList:[],visible:!1,form:{id:"",unitId:"",weight:"",whereDidYouGo:"",dayAge:"",eartag:"",healthStatus:"",breed:"",birthday:"",sex:"",pigstyId:"",periodId:"",farmId:""},pighouseList:[],phSelectedList:[],unitList:[],unSelectedList:[],periodList:[],peSelectedList:[],health:[{value:!0,label:"健康"},{value:!1,label:"不健康"}],sex:[{value:"公",label:"公"},{value:"母",label:"母"}],row:{},dataRule:{farmId:[{required:!0,message:"牧场不能为空",trigger:"blur"}],pigstyId:[{required:!0,message:"猪舍不能为空",trigger:"blur"}],unitId:[{required:!0,message:"单元不能为空",trigger:"blur"}],periodId:[{required:!0,message:"栏期不能为空",trigger:"blur"}],eartag:[{required:!0,message:"耳标不能为空",trigger:"blur"}],sex:[{required:!0,message:"性别不能为空",trigger:"blur"}],birthday:[{required:!0,message:"出生日期不能为空",trigger:"blur"}],healthStatus:[],weight:[],breed:[{required:!0,message:"品种不能为空",trigger:"blur"}]},labelPosition:"right"},"searchForm",{earTag:"",sex:"",breed:"",health:""})},mounted:function(){this.getDataList()},methods:{getPigs:function(e){console.log(e)},getDataList:function(){var e,t=this;console.log(this.$store.state.user.id),console.log(this.$store.state.user.name),console.log(this.$cookie.get("token")),this.dataListLoading=!0,this.$http({url:this.$http.adornUrl("/management/yearpigbase/list"),method:"get",params:this.$http.adornParams({page:this.pageIndex,limit:this.pageSize,keywords:""})}).then((e=s()(i.a.mark(function e(r){var a,n,l,s=r.data;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.$http({url:t.$http.adornUrl("/management/pigsty/findAll"),method:"get",params:t.$http.adornParams({})});case 2:return(a=e.sent).data.all&&(t.pighouseList=a.data.all),e.next=6,t.$http({url:t.$http.adornUrl("/management/unit/findAll"),method:"get",params:t.$http.adornParams({})});case 6:return(n=e.sent).data.all&&(t.unitList=n.data.all),e.next=10,t.$http({url:t.$http.adornUrl("/management/period/findAll"),method:"get",params:t.$http.adornParams({})});case 10:(l=e.sent).data.all&&(t.periodList=l.data.all),s&&0===s.code?(t.dataList=s.page.list,t.totalPage=s.page.totalCount,console.log(s.page.list),t.dataList.forEach(function(e){var r=!0,a=!1,i=void 0;try{for(var n,l=o()(t.unitList);!(r=(n=l.next()).done);r=!0){var s=n.value;if(e.unitId===s.id){e.unitNumber=s.number,e.farmId=s.farmId,e.pigstyId=s.pigstyId;break}}}catch(e){a=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw i}}}),t.dataList.forEach(function(e){var r=!0,a=!1,i=void 0;try{for(var n,l=o()(t.pighouseList);!(r=(n=l.next()).done);r=!0){var s=n.value;if(e.pigstyId===s.id){e.phNumber=s.number;break}}}catch(e){a=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw i}}}),t.dataList.forEach(function(e){var r=!0,a=!1,i=void 0;try{for(var n,l=o()(t.periodList);!(r=(n=l.next()).done);r=!0){var s=n.value;if(e.periodId===s.id){e.periodNumber=s.number;break}}}catch(e){a=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw i}}}),t.phSelectedList=t.pighouseList,t.unSelectedList=t.unitList,t.peSelectedList=t.periodList):(t.dataList=[],t.totalPage=0),t.dataListLoading=!1;case 14:case"end":return e.stop()}},e,t)})),function(t){return e.apply(this,arguments)}))},sizeChangeHandle:function(e){this.pageSize=e,this.pageIndex=1,this.getDataList()},currentChangeHandle:function(e){this.pageIndex=e,this.getDataList()},expandChange:function(e){e!==this.row&&(this.$refs.table.toggleRowExpansion(this.row,!1),this.row=e),console.log(e)},tableRowClassName:function(e){e.row;return e.rowIndex%2==0?"warning-row":""},changeBirth:function(e){var t=new Date(e),r=(new Date).getTime()-t.getTime();r<0&&this.$confirm("出生日期有误","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){console.log("还没出生呢...")}).catch(function(){}),this.form.dayAge=parseInt(r/864e5)},changeDay:function(e){var t=new Date,r=new Date(t.setDate(t.getDate()-e)),a=r.getMonth()<9?"0"+(r.getMonth()+1):r.getMonth()+1,i=r.getDate()<10?"0"+r.getDate():r.getDate();this.form.birthday=r.getFullYear()+"-"+a+"-"+i},getPasture:function(e){var t=this;this.phSelectedList=[],this.pighouseList.forEach(function(r){r.farmId===e&&t.phSelectedList.push(r)});var r=this.pigstyByYid(this.form.pigstyId);r&&r.farmId!==e&&(this.form.pigstyId=""),this.unSelectedList=[],this.unitList.forEach(function(r){r.farmId===e&&t.unSelectedList.push(r)});var a=this.UnitByIid(this.form.unitId);a&&a.farmId!==e&&(this.form.unitId=""),this.peSelectedList=[],this.periodList.forEach(function(r){r.farmId===e&&t.peSelectedList.push(r)});var i=this.periodByJid(this.form.periodId);i&&i.farmId!==e&&(this.form.periodId="")},getPigsty:function(e){var t=this,r=this.pigstyByYid(this.form.pigstyId);this.form.farmId=r.farmId,this.phSelectedList=this.xidYlist(r.farmId),this.unSelectedList=[],this.unitList.forEach(function(r){r.pigstyId===e&&t.unSelectedList.push(r)});var a=this.UnitByIid(this.form.unitId);a&&a.pigstyId!==e&&(this.form.unitId=""),this.peSelectedList=[],this.periodList.forEach(function(r){r.pigstyId===e&&t.peSelectedList.push(r)});var i=this.periodByJid(this.form.periodId);i&&i.pigstyId!==e&&(this.form.periodId="")},getUnit:function(e){var t=this.UnitByIid(e);this.form.farmId=t.farmId,this.form.pigstyId=t.pigstyId,this.phSelectedList=this.xidYlist(t.farmId),this.unSelectedList=this.yidIlist(t.pigstyId),this.peSelectedList=this.yidJlist(t.pigstyId);var r=this.periodByJid(this.form.periodId);r&&r.pigstyId!==t.pigstyId&&(this.form.periodId="")},xidYlist:function(e){var t=[];return this.pighouseList.forEach(function(r){r.farmId===e&&t.push(r)}),t},yidJlist:function(e){var t=[];return this.periodList.forEach(function(r){r.pigstyId===e&&t.push(r)}),t},yidIlist:function(e){var t=[];return this.unitList.forEach(function(r){r.pigstyId===e&&t.push(r)}),t},pigstyByYid:function(e){var t=!0,r=!1,a=void 0;try{for(var i,n=o()(this.pighouseList);!(t=(i=n.next()).done);t=!0){var l=i.value;if(l.id===e)return l}}catch(e){r=!0,a=e}finally{try{!t&&n.return&&n.return()}finally{if(r)throw a}}return null},periodByJid:function(e){var t=!0,r=!1,a=void 0;try{for(var i,n=o()(this.periodList);!(t=(i=n.next()).done);t=!0){var l=i.value;if(l.id===e)return l}}catch(e){r=!0,a=e}finally{try{!t&&n.return&&n.return()}finally{if(r)throw a}}return null},UnitByIid:function(e){var t=!0,r=!1,a=void 0;try{for(var i,n=o()(this.unitList);!(t=(i=n.next()).done);t=!0){var l=i.value;if(l.id===e)return l}}catch(e){r=!0,a=e}finally{try{!t&&n.return&&n.return()}finally{if(r)throw a}}return null},getPeriod:function(e){var t=this.periodByJid(e);this.form.farmId=t.farmId,this.form.pigstyId=t.pigstyId,this.phSelectedList=this.xidYlist(t.farmId),this.unSelectedList=this.yidIlist(t.pigstyId),this.peSelectedList=this.yidJlist(t.pigstyId);var r=this.UnitByIid(this.form.unitId);r&&r.pigstyId!==t.pigstyId&&(this.form.unitId="")},addOrUpdateHandle:function(e){this.visible=!0,e&&(this.form=e)},selectionChangeHandle:function(e){var t=this;this.selectionDataList=[],e.forEach(function(e){t.selectionDataList.push(e.id)})},deleteHandle:function(e){var t=this;this.$confirm("确定删除年猪?","提示",{showCancelButton:!0,showConfirmButton:!0,cancelButtonClass:"cancelButton",confirmButtonClass:"confirmButton",confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){e&&t.selectionDataList.push(e),t.selectionDataList.length<=0||t.$http({url:t.$http.adornUrl("/management/yearpigbase/delete"),method:"post",data:t.$http.adornData(t.selectionDataList,!1)}).then(function(e){if(0===e.data.code){t.getDataList(),t.resetForm(),t.$message({message:"成功删除年猪",type:"success",duration:1e3}),t.totalPage-=t.selectionDataList.length;var r=Math.ceil(t.totalPage/t.pageSize);t.pageIndex=t.pageIndex>r?r:t.pageIndex,t.pageIndex=t.pageIndex<1?r:t.pageIndex}else t.$message.error("删除年猪失败");t.selectionDataList=[]})}).catch(function(){})},formSubmit:function(){var e=this;if(this.form.id){if(!this.confirmInput())return;this.$http({url:this.$http.adornUrl("/management/yearpigbase/update"),method:"post",data:this.$http.adornData({id:this.form.id,unitId:this.form.unitId,dayAge:parseInt(this.form.dayAge),eartag:this.form.eartag,healthStatus:this.form.healthStatus,weight:parseFloat(this.form.weight),whereDidYouGo:this.form.whereDidYouGo,breed:this.form.breed,birthday:this.form.birthday,sex:this.form.sex,periodId:this.form.periodId,pigstyId:this.form.pigstyId,farmId:parseInt(this.$cookie.get("formFarmId"))})}).then(function(t){if(0===t.data.code)e.resetForm(),console.log(t),console.log(e.form),e.visible=!1,e.$message({message:"成功修改年猪信息",type:"success",duration:1e3});else{if(600===t.data.code)return void e.$message.error(t.data.msg);e.$message.error("修改年猪信息失败")}})}else{if(console.log(this.form),!this.confirmInput())return;console.log("进行新增操作"),this.$http({url:this.$http.adornUrl("/management/yearpigbase/save"),method:"post",data:this.$http.adornData({unitId:this.form.unitId,dayAge:parseInt(this.form.dayAge),eartag:this.form.eartag,healthStatus:this.form.healthStatus,weight:parseInt(this.form.weight),whereDidYouGo:this.form.whereDidYouGo,breed:this.form.breed,birthday:this.form.birthday,sex:this.form.sex,periodId:this.form.periodId,pigstyId:this.form.pigstyId,farmId:parseInt(this.$cookie.get("formFarmId"))})}).then(function(t){if(0===t.data.code){e.totalPage++;var r=Math.ceil(e.totalPage/e.pageSize);e.pageIndex=e.pageIndex