webpackJsonp([27],{Mtkr:function(n,e,t){var r=t("n2Wb");"string"==typeof r&&(r=[[n.i,r,""]]),r.locals&&(n.exports=r.locals);t("6imX")("04bb4cfe",r,!0)},daD0:function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t("mFSD"),s=t("vMJZ"),a={name:"financeAdd",data:function(){return{form:{name:"",money:"",balance:"1",memo:""},rules:{money:[{required:!0,message:"请输入金额",trigger:"blur"}]},users:[]}},methods:{querySearch:function(n,e){this.loadUsers();var t=this.users;e(n?t.filter(this.createFilter(n)):t)},createFilter:function(n){return function(e){return 0===e.value.toLowerCase().indexOf(n.toLowerCase())}},handleSelect:function(n){this.form.user_id=n.id},loadUsers:function(){var n=this,e={name:this.form.name};if(!this.form.name)return!1;s.a.userSearch(e).then(function(e){n.users=e.data}).catch(function(e){n.$message.warning(e)})},onSubmit:function(){var n=this;for(var e in this.form.user_id="",this.users)this.users[e].value==this.form.name&&(this.form.user_id=this.users[e].id,delete this.form.name);if(!this.form.user_id)return this.$message.warning("该用户不存在"),!1;this.$refs.form.validate(function(e){if(!e)return!1;r.a.add(n.form).then(function(e){1==e.code?(n.$message.success("提交成功！"),n.form={user_id:"",money:"",balance:"1",memo:""}):n.$message.warning(e.msg)},function(e){n.$message.error("网络请求失败,请稍后重试")})})}}},o={render:function(){var n=this,e=n.$createElement,t=n._self._c||e;return t("div",{staticClass:"container",staticStyle:{width:"600px"}},[t("el-form",{ref:"form",attrs:{"label-position":"top",model:n.form,rules:n.rules}},[t("el-form-item",{attrs:{label:"操作类型"}},[t("el-radio-group",{model:{value:n.form.balance,callback:function(e){n.$set(n.form,"balance",e)},expression:"form.balance"}},[t("el-radio",{attrs:{label:"1"}},[n._v("增加")]),n._v(" "),t("el-radio",{attrs:{label:"0"}},[n._v("减少")])],1)],1),n._v(" "),t("el-form-item",{attrs:{label:"用户名",prop:"name"}},[t("el-autocomplete",{staticClass:"inline-input",staticStyle:{width:"300px"},attrs:{"fetch-suggestions":n.querySearch,placeholder:"请输入用户名","trigger-on-focus":!1},on:{select:n.handleSelect},model:{value:n.form.name,callback:function(e){n.$set(n.form,"name",e)},expression:"form.name"}})],1),n._v(" "),t("el-form-item",{attrs:{label:"金额",prop:"money"}},[t("el-input",{attrs:{type:""},model:{value:n.form.money,callback:function(e){n.$set(n.form,"money",e)},expression:"form.money"}})],1),n._v(" "),t("el-form-item",{attrs:{label:"备注"}},[t("el-input",{attrs:{type:"textarea",rows:"5"},model:{value:n.form.memo,callback:function(e){n.$set(n.form,"memo",e)},expression:"form.memo"}})],1),n._v(" "),t("el-form-item",[t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:n.onSubmit}},[n._v("保存")])],1)],1)],1)},staticRenderFns:[]};var i=t("XAIM")(a,o,!1,function(n){t("Mtkr")},null,null);e.default=i.exports},n2Wb:function(n,e,t){(n.exports=t("bKW+")(!1)).push([n.i,"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",""])}});