1 |
- webpackJsonp([17,90],{CoTw:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=a("Xxa5"),n=a.n(i),r=a("exGp"),l=a.n(r),o={data:function(){return{visible:!1,dataForm:{id:"",eartag:"",pigstyId:"",unitId:"",pigIds:[]},dataRule:{eartag:[{required:!0,message:"耳标不能为空",trigger:"blur"}],pigstyId:[{required:!0,message:"栋舍不能为空",trigger:"blur"}],unitId:[{required:!0,message:"单元不能为空",trigger:"blur"}]},gender:[{value:"公",label:"公"},{value:"母",label:"母"}],pigstyList:[],unitList:[],unitSelectedList:[],periodList:[],periodSelectedList:[],healthStatus:[{value:!0,label:"健康"},{value:!1,label:"不健康"}],originPlaceList:[],outFenceStatus:[{value:0,label:"育肥"},{value:1,label:"出栏"}]}},methods:{init:function(t){var e,a=this;this.visible=!0,this.dataForm.id="",this.$nextTick(function(){a.$refs.dataForm.resetFields(),console.log(t);var e=[],i=[];a.dataForm.pigIds=[],t.forEach(function(t){e.push(t.id),a.dataForm.pigIds.push(t.id),i.push(t.eartag)}),a.dataForm.id=e.join(),a.dataForm.eartag=i.join()}),this.$http({url:this.$http.adornUrl("/management/pigsty/findAll"),method:"get",params:this.$http.adornParams({})}).then((e=l()(n.a.mark(function t(e){var i,r,l,o=e.data;return n.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a.pigstyList=[],i=[],o.all&&(i=o.all),i.forEach(function(t){var e={value:t.id,label:t.number};a.pigstyList.push(e)}),a.unitList=[],r=[],t.next=8,a.$http({url:a.$http.adornUrl("/management/unit/findAll"),method:"get",params:a.$http.adornParams({})});case 8:(l=t.sent).data.all&&(r=l.data.all),r.forEach(function(t){var e={value:t.id,label:t.number,pigstyId:t.pigstyId,farmId:t.farmId};a.unitList.push(e)}),a.unitSelectedList=a.unitList;case 12:case"end":return t.stop()}},t,a)})),function(t){return e.apply(this,arguments)}))},pigstyChange:function(t){this.unitSelectedList=this.unitList.filter(function(e){return e.pigstyId===t}),console.log(this.unitList),console.log(this.unitSelectedList)},ifPigsty:function(){this.dataForm.pigstyId||(this.$message.error("请先选择猪舍"),this.dataForm.unitId="")},dataFormSubmit:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&t.$http({url:t.$http.adornUrl("/management/yearpigbase/transferPeriod"),method:"post",data:t.$http.adornData({pigIds:t.dataForm.pigIds,unitId:t.dataForm.unitId},!1)}).then(function(e){var a=e.data;a&&0===a.code?(t.visible=!1,t.$emit("refreshDataList"),t.$message({message:"操作成功",type:"success",duration:1500}),t.visible=!1):t.$message.error(a.msg)})})},changeBirth:function(t){var e=this,a=new Date(t);(new Date).getTime()-a.getTime()<0&&this.$confirm("出生日期有误","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){e.dataForm.birthday="",console.log("还没出生呢...")}).catch(function(){})}},watch:{"dataForm.pigstyId":{handler:function(t,e){e&&(this.dataForm.unitId="",this.dataForm.periodId="",this.unitSelectedList=this.unitList.filter(function(e){return e.pigstyId===t}),this.periodSelectedList=this.periodList.filter(function(e){return e.pigstyId===t}))}}}},s={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{title:t.dataForm.id?"修改":"新增","close-on-click-modal":!1,visible:t.visible,width:"600px"},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{ref:"dataForm",staticStyle:{"margin-left":"20px",width:"500px"},attrs:{model:t.dataForm,rules:t.dataRule,"label-width":"80px",size:"mini"},nativeOn:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.dataFormSubmit()}}},[a("el-form-item",{attrs:{label:"耳标",prop:"eartag"}},[a("el-input",{attrs:{type:"textarea",rows:2,placeholder:"每个耳标之间用英文逗号隔开,最多可以添加50头猪",disabled:!!t.dataForm.id},model:{value:t.dataForm.eartag,callback:function(e){t.$set(t.dataForm,"eartag",e)},expression:"dataForm.eartag"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"猪舍",prop:"pigstyId"}},[a("el-select",{staticStyle:{width:"100%"},on:{change:t.pigstyChange},model:{value:t.dataForm.pigstyId,callback:function(e){t.$set(t.dataForm,"pigstyId",e)},expression:"dataForm.pigstyId"}},t._l(t.pigstyList,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",{attrs:{label:"单元",prop:"unitId"}},[a("el-select",{staticStyle:{width:"100%"},on:{change:function(e){t.ifPigsty("unitId")}},model:{value:t.dataForm.unitId,callback:function(e){t.$set(t.dataForm,"unitId",e)},expression:"dataForm.unitId"}},t._l(t.unitSelectedList,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1)],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"mini"},on:{click:function(e){t.visible=!1}}},[t._v("关闭")]),t._v(" "),a("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.dataFormSubmit()}}},[t._v("确定")])],1)],1)},staticRenderFns:[]},d=a("VU/8")(o,s,!1,null,null,null);e.default=d.exports},aNpG:function(t,e,a){var i=a("pZbN");"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);a("rjj0")("297b6196",i,!0)},dBfx:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=a("Xxa5"),n=a.n(i),r=a("exGp"),l=a.n(r),o={data:function(){return{form:{eartag:"",sex:"",breed:"",healthStatus:"",outFenceStatus:"",periodId:"",pigstyId:"",unitId:""},dataList:[],pageIndex:1,pageSize:10,totalPage:0,dataListLoading:!1,dataListSelections:[],addOrUpdateVisible:!1,farmId:void 0,gender:[{value:"公",label:"公"},{value:"母",label:"母"}],breedList:[],healthStatus:[{value:1,label:"健康"},{value:0,label:"不健康"}],outFenceStatus:[{value:0,label:"育肥"},{value:1,label:"出栏"}],periodList:[],periodSelectedList:[],pigstyList:[],unitList:[],unitSelectedList:[],labelPosition:"right"}},components:{Update:a("CoTw").default},activated:function(){this.getDataList()},methods:{getDataList:function(){var t,e=this;this.dataListLoading=!0,this.$http({url:this.$http.adornUrl("/management/yearpigbase/list"),method:"get",params:this.$http.adornParams({page:this.pageIndex,limit:this.pageSize,eartag:this.form.eartag||void 0,sex:this.form.sex||void 0,breed:this.form.breed||void 0,healthStatus:this.form.healthStatus||void 0,outFenceStatus:this.form.outFenceStatus||void 0,periodId:this.form.periodId||void 0,pigstyId:this.form.pigstyId||void 0,unitId:this.form.unitId||void 0})}).then((t=l()(n.a.mark(function t(a){var i,r,l,o,s,d,c,u,p=a.data;return n.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.pigstyList=[],i=[],t.next=4,e.$http({url:e.$http.adornUrl("/management/pigsty/findAll"),method:"get",params:e.$http.adornParams({})});case 4:return(r=t.sent).data.all&&(i=r.data.all),i.forEach(function(t){var a={value:t.id,label:t.number};e.pigstyList.push(a)}),e.unitList=[],l=[],t.next=11,e.$http({url:e.$http.adornUrl("/management/unit/findAll"),method:"get",params:e.$http.adornParams({})});case 11:return(o=t.sent).data.all&&(l=o.data.all),l.forEach(function(t){var a={value:t.id,label:t.number,pigstyId:t.pigstyId};e.unitList.push(a)}),e.unitSelectedList=e.unitList,e.periodList=[],s=[],t.next=19,e.$http({url:e.$http.adornUrl("/management/period/findAll"),method:"get",params:e.$http.adornParams({})});case 19:return(d=t.sent).data.all&&(s=d.data.all),s.forEach(function(t){var a={value:t.id,label:t.number,pigstyId:t.pigstyId};e.periodList.push(a)}),e.periodSelectedList=e.periodList,e.breedList=[],c=[],t.next=27,e.$http({url:e.$http.adornUrl("/management/basebloodline/findAll"),method:"get",params:e.$http.adornParams({})});case 27:(u=t.sent).data.all&&(c=u.data.all),c.forEach(function(t){var a={value:t.name,label:t.name};e.breedList.push(a)}),e.periodSelectedList=e.form.pigstyId?e.periodList.filter(function(t){return t.pigstyId===e.form.pigstyId}):e.periodList,e.unitSelectedList=e.form.pigstyId?e.unitList.filter(function(t){return t.pigstyId===e.form.pigstyId}):e.unitList,p&&0===p.code?(e.dataList=p.page.list,e.totalPage=p.page.totalCount):(e.dataList=[],e.totalPage=0,e.$message.error(p.msg)),e.dataListLoading=!1;case 34:case"end":return t.stop()}},t,e)})),function(e){return t.apply(this,arguments)}))},selectFocus:function(t){var e=this;this.form.pigstyId||(this.$message.error("请先选择猪舍"),this.form[t+"Id"]="",setTimeout(function(){e.$refs[t].blur()},10))},clearAll:function(){for(var t in this.form)this.form[t]="";this.unitSelectedList=this.unitList,this.periodSelectedList=this.periodList},sizeChangeHandle:function(t){this.pageSize=t,this.pageIndex=1,this.getDataList()},currentChangeHandle:function(t){this.pageIndex=t,this.getDataList()},selectionChangeHandle:function(t){this.dataListSelections=t},addOrUpdateHandle:function(t){var e=this;this.addOrUpdateVisible=!0;var a=t?[t]:this.dataListSelections.map(function(t){return{id:t.id,eartag:t.eartag}});this.$nextTick(function(){e.$refs.addOrUpdate.init(a)})}},watch:{"form.pigstyId":{handler:function(t,e){e&&(this.form.unitId="",this.form.periodId=""),this.unitSelectedList=this.unitList.filter(function(e){return e.pigstyId===t}),this.periodSelectedList=this.periodList.filter(function(e){return e.pigstyId===t})}}}},s={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"mod-role"},[a("el-container",[a("el-header",[a("div",{staticClass:"rect rect-form"},[a("el-form",{ref:"form",attrs:{inline:!0,model:t.form,size:"mini"},nativeOn:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.getDataList()}}},[a("el-form-item",[a("el-input",{attrs:{placeholder:"耳标",clearable:""},model:{value:t.form.eartag,callback:function(e){t.$set(t.form,"eartag",e)},expression:"form.eartag"}})],1),t._v(" "),a("el-form-item",{staticStyle:{width:"140px"}},[a("el-select",{attrs:{placeholder:"性别"},model:{value:t.form.sex,callback:function(e){t.$set(t.form,"sex",e)},expression:"form.sex"}},t._l(t.gender,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",{staticStyle:{width:"140px"}},[a("el-select",{attrs:{placeholder:"品种"},model:{value:t.form.breed,callback:function(e){t.$set(t.form,"breed",e)},expression:"form.breed"}},t._l(t.breedList,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",{staticStyle:{width:"140px"}},[a("el-select",{attrs:{placeholder:"健康状态"},model:{value:t.form.healthStatus,callback:function(e){t.$set(t.form,"healthStatus",e)},expression:"form.healthStatus"}},t._l(t.healthStatus,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",{staticStyle:{width:"140px"}},[a("el-select",{attrs:{placeholder:"养殖状态"},model:{value:t.form.outFenceStatus,callback:function(e){t.$set(t.form,"outFenceStatus",e)},expression:"form.outFenceStatus"}},t._l(t.outFenceStatus,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",{staticStyle:{width:"140px"}},[a("el-select",{attrs:{placeholder:"猪舍"},model:{value:t.form.pigstyId,callback:function(e){t.$set(t.form,"pigstyId",e)},expression:"form.pigstyId"}},t._l(t.pigstyList,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",{staticStyle:{width:"140px"}},[a("el-select",{ref:"unit",attrs:{placeholder:"单元"},on:{focus:function(e){t.selectFocus("unit")}},model:{value:t.form.unitId,callback:function(e){t.$set(t.form,"unitId",e)},expression:"form.unitId"}},t._l(t.unitSelectedList,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",{staticStyle:{width:"140px"}},[a("el-select",{ref:"period",attrs:{placeholder:"栏期"},on:{focus:function(e){t.selectFocus("period")}},model:{value:t.form.periodId,callback:function(e){t.$set(t.form,"periodId",e)},expression:"form.periodId"}},t._l(t.periodSelectedList,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),a("el-form-item",[a("el-button",{attrs:{icon:"el-icon-search"},on:{click:function(e){t.getDataList()}}},[t._v("查 询")])],1),t._v(" "),a("el-form-item",[a("el-button",{attrs:{icon:"el-icon-circle-close"},on:{click:t.clearAll}},[t._v("清 空")])],1)],1)],1)]),t._v(" "),a("el-main",[a("div",{staticClass:"rect rect-table"},[a("el-form",{attrs:{inline:"",size:"mini"}},[a("el-form-item",[a("el-button",{attrs:{icon:"el-icon-refresh",type:"danger",disabled:t.dataListSelections.length<=0},on:{click:function(e){t.addOrUpdateHandle()}}},[t._v("\n 转 栏\n ")])],1)],1),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.dataListLoading,expression:"dataListLoading"}],staticStyle:{width:"100%"},attrs:{data:t.dataList,border:"",stripe:"",size:"mini",height:"540","header-cell-style":{background:"rgb(245,245,245)",color:"#000",height:"45px",fontSize:"13px",fontWeight:"normal",borderBottom:"1px solid #ccc"},"cell-style":{color:"#888",fontSize:"13px"}},on:{"selection-change":t.selectionChangeHandle}},[a("el-table-column",{attrs:{type:"selection","header-align":"center",align:"center",width:"50"}}),t._v(" "),a("el-table-column",{attrs:{prop:"id","header-align":"center",align:"center",label:"id",width:"80"}}),t._v(" "),a("el-table-column",{attrs:{prop:"eartag","header-align":"center",align:"center",label:"耳标"}}),t._v(" "),a("el-table-column",{attrs:{prop:"sex","header-align":"center",align:"center",label:"性别",width:"80"}}),t._v(" "),a("el-table-column",{attrs:{prop:"birthday","header-align":"center",align:"center",label:"出生日期"}}),t._v(" "),a("el-table-column",{attrs:{"header-align":"center",align:"center",label:"健康状态",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.healthStatus?"健康":"不健康"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{"header-align":"center",align:"center",label:"养殖状态",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.outFenceStatus?"出栏":"育肥"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"breed","header-align":"center",align:"center",label:"品种",width:"100"}}),t._v(" "),a("el-table-column",{attrs:{prop:"pigstyName","header-align":"center",align:"center",label:"猪舍"}}),t._v(" "),a("el-table-column",{attrs:{prop:"unitName","header-align":"center",align:"center",label:"单元"}}),t._v(" "),a("el-table-column",{attrs:{prop:"periodName","header-align":"center",align:"center",label:"栏期"}})],1),t._v(" "),a("el-pagination",{attrs:{"current-page":t.pageIndex,"page-sizes":[10,20,50,100],"page-size":t.pageSize,total:t.totalPage,layout:"total, sizes, prev, pager, next, jumper"},on:{"size-change":t.sizeChangeHandle,"current-change":t.currentChangeHandle}}),t._v(" "),t.addOrUpdateVisible?a("update",{ref:"addOrUpdate",on:{refreshDataList:t.getDataList}}):t._e()],1)])],1)],1)},staticRenderFns:[]};var d=a("VU/8")(o,s,!1,function(t){a("aNpG")},"data-v-11d0ebb2",null);e.default=d.exports},pZbN:function(t,e,a){(t.exports=a("FZ+f")(!1)).push([t.i,"\n.rect[data-v-11d0ebb2] {\r\n background-color: #fff;\r\n padding: 30px 15px;\r\n border-radius: 5px;\r\n border: 1px solid #e8e8e8;\n}\n.rect-form[data-v-11d0ebb2] {\r\n padding-bottom: 10px;\n}\n.rect-table[data-v-11d0ebb2] {\r\n margin-top: 20px;\n}\n.demo-table-expand[data-v-11d0ebb2] {\r\n font-size: 0;\r\n margin-left: 40px;\n}\n.demo-table-expand label[data-v-11d0ebb2] {\r\n width: 90px;\r\n color: #99a9bf;\n}\n.demo-table-expand .el-form-item[data-v-11d0ebb2] {\r\n margin-right: 0;\r\n margin-bottom: 0;\r\n width: 80%;\n}\n.el-table .height[data-v-11d0ebb2] {\r\n background: rgba(254, 254, 254, 0.5);\n}\n[data-v-11d0ebb2].el-table--mini td, .el-table--mini th[data-v-11d0ebb2] {\r\n padding: 3px 0 !important;\r\n height: 20px !important;\n}\n[data-v-11d0ebb2].el-checkbox__input.is-checked+.el-checkbox__label {\r\n color: rgb(24,144,255);\r\n background-color: rgb(24,144,255);\r\n border-color: rgb(24,144,255);\n}\n[data-v-11d0ebb2].el-table .el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner[data-v-11d0ebb2] {\r\n background-color: rgb(24,144,255);\r\n border-color: rgb(24,144,255);\n}\n[data-v-11d0ebb2].el-table .el-checkbox__inner:hover {\r\n border-color: rgb(24,144,255);\n}\n[data-v-11d0ebb2].el-table .el-checkbox__input.is-focus .el-checkbox__inner {\r\n border-color: rgb(24,144,255);\n}\n[data-v-11d0ebb2].el-table #select .cell .el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner[data-v-11d0ebb2] {\r\n background-color: rgb(24,144,255);\r\n border-color: rgb(24,144,255);\n}\r\n",""])}});
|