1 |
- webpackJsonp([83],{ZuYJ:function(t,a,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r=e("Xxa5"),o=e.n(r),i=e("exGp"),l=e.n(i),d={data:function(){return{visible:!1,dataForm:{id:"",eartagNo:"",type:"",birthDate:"",blood:"",batchNp:"",pigletTotal:"",psy:"",remark:""},dataRule:{eartagNo:[{required:!0,message:"耳标不能为空",trigger:"blur"}],type:[{required:!0,message:"类型不能为空",trigger:"blur"}],birthDate:[{required:!0,message:"出生日期不能为空",trigger:"blur"}],blood:[{required:!0,message:"种类不能为空",trigger:"blur"}],origin:[{required:!0,message:"源产地不能为空",trigger:"blur"}],psy:[{type:"string",message:"只允许输入小数",pattern:/^[0-9]{1,2}\.[0-9]{1,}$/}]},bloodList:[],type:[{value:1,label:"种公猪"},{value:2,label:"母猪"},{value:3,label:"后备母猪"}]}},methods:{init:function(t){var a,e=this;this.visible=!0,this.dataForm.id=t||0,this.$nextTick(function(){e.$refs.dataForm.resetFields()}),this.dataForm.id&&this.$http({url:this.$http.adornUrl("/management/breedparents/info/"+this.dataForm.id),method:"get",params:this.$http.adornParams({},!1)}).then((a=l()(o.a.mark(function t(a){var r=a.data;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r&&0===r.code&&(e.dataForm.id=r.breedParents.id,e.dataForm.eartagNo=r.breedParents.eartagNo,e.dataForm.type=r.breedParents.type,e.dataForm.birthDate=r.breedParents.birthDate,e.dataForm.blood=r.breedParents.blood,e.dataForm.origin=r.breedParents.origin,e.dataForm.remark=r.breedParents.remark,e.dataForm.batchNp=r.breedParents.batchNp,e.dataForm.pigletTotal=r.breedParents.pigletTotal,e.dataForm.psy=r.breedParents.psy);case 1:case"end":return t.stop()}},t,e)})),function(t){return a.apply(this,arguments)})),this.$http({url:this.$http.adornUrl("/management/basebloodline/findAll"),method:"get",params:this.$http.adornParams({},!1)}).then(function(t){var a=t.data;e.bloodList=[];a&&0===a.code&&a.all.forEach(function(t){var a={value:t.name,label:t.name,origin:t.origin};e.bloodList.push(a)})})},dataFormSubmit:function(){var t=this;this.$refs.dataForm.validate(function(a){a&&t.$http({url:t.$http.adornUrl("/management/breedparents/"+(t.dataForm.id?"update":"save")),method:"post",data:t.$http.adornData({id:t.dataForm.id||void 0,eartagNo:t.dataForm.eartagNo,farmId:parseInt(t.$cookie.get("formFarmId")),type:t.dataForm.type,gender:t.dataForm.type<2?1:2,birthDate:t.dataForm.birthDate,blood:t.dataForm.blood,origin:t.bloodList.filter(function(a){return a.label===t.dataForm.blood})[0].origin,batchNp:t.dataForm.batchNp||void 0,pigletTotal:t.dataForm.pigletTotal||void 0,psy:t.dataForm.psy||void 0,remark:t.dataForm.remark||void 0},!1)}).then(function(a){var e=a.data;e&&0===e.code?(t.visible=!1,t.$emit("refreshDataList"),t.$message({message:"操作成功",type:"success",duration:1500}),t.visible=!1):t.$message.error(e.msg)})})},changeBirth:function(t){var a=this,e=new Date(t);(new Date).getTime()-e.getTime()<0&&(this.dataForm.birthDate="",this.$confirm("出生日期有误","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){a.dataForm.birthday="",console.log("还没出生呢...")}).catch(function(){}))}},watch:{"dataForm.pigstyId":{handler:function(t,a){a&&(this.dataForm.unitId="",this.dataForm.periodId="")}}}},n={render:function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("el-dialog",{attrs:{title:t.dataForm.id?"修改":"新增","close-on-click-modal":!1,visible:t.visible,width:"600px"},on:{"update:visible":function(a){t.visible=a}}},[e("el-form",{ref:"dataForm",staticStyle:{"margin-left":"20px",width:"500px"},attrs:{model:t.dataForm,rules:t.dataRule,"label-width":"100px",size:"mini"},nativeOn:{keyup:function(a){if(!("button"in a)&&t._k(a.keyCode,"enter",13,a.key,"Enter"))return null;t.dataFormSubmit()}}},[e("el-form-item",{attrs:{label:"耳标",prop:"eartagNo"}},[e("el-input",{attrs:{disabled:!!t.dataForm.id},model:{value:t.dataForm.eartagNo,callback:function(a){t.$set(t.dataForm,"eartagNo",a)},expression:"dataForm.eartagNo"}})],1),t._v(" "),e("el-form-item",{attrs:{label:"类型",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.dataForm.type,callback:function(a){t.$set(t.dataForm,"type",a)},expression:"dataForm.type"}},t._l(t.type,function(t){return e("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),e("el-form-item",{attrs:{label:"出生日期",prop:"birthDate"}},[e("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"date","value-format":"yyyy-MM-dd"},on:{change:t.changeBirth},model:{value:t.dataForm.birthDate,callback:function(a){t.$set(t.dataForm,"birthDate",a)},expression:"dataForm.birthDate"}})],1),t._v(" "),e("el-form-item",{attrs:{label:"品种",prop:"blood"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.dataForm.blood,callback:function(a){t.$set(t.dataForm,"blood",a)},expression:"dataForm.blood"}},t._l(t.bloodList,function(t){return e("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1),t._v(" "),1!==t.dataForm.type?e("el-form-item",{attrs:{label:"产仔窝数",prop:"batchNp"}},[e("el-input",{attrs:{placeholder:"请输入数字"},model:{value:t.dataForm.batchNp,callback:function(a){t.$set(t.dataForm,"batchNp",t._n(a))},expression:"dataForm.batchNp"}})],1):t._e(),t._v(" "),1!==t.dataForm.type?e("el-form-item",{attrs:{label:"产仔总数量",prop:"pigletTotal"}},[e("el-input",{attrs:{placeholder:"请输入数字"},model:{value:t.dataForm.pigletTotal,callback:function(a){t.$set(t.dataForm,"pigletTotal",t._n(a))},expression:"dataForm.pigletTotal"}})],1):t._e(),t._v(" "),1!==t.dataForm.type?e("el-form-item",{attrs:{label:"PSY",prop:"psy"}},[e("el-input",{attrs:{placeholder:"请输入小数"},model:{value:t.dataForm.psy,callback:function(a){t.$set(t.dataForm,"psy",a)},expression:"dataForm.psy"}})],1):t._e(),t._v(" "),e("el-form-item",{attrs:{label:"备注",prop:"remark"}},[e("el-input",{model:{value:t.dataForm.remark,callback:function(a){t.$set(t.dataForm,"remark",a)},expression:"dataForm.remark"}})],1)],1),t._v(" "),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{attrs:{size:"mini"},on:{click:function(a){t.visible=!1}}},[t._v("关闭")]),t._v(" "),e("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(a){t.dataFormSubmit()}}},[t._v("确定")])],1)],1)},staticRenderFns:[]},s=e("VU/8")(d,n,!1,null,null,null);a.default=s.exports}});
|