webpackJsonp([21],{BXS2:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=a("mtWM"),o=a.n(r),i={data:function(){return{taskForm:[],taskFormData:{},loading:!1}},created:function(){var t=this;this.$http.get({url:"/rest/form/form-data",data:{taskId:this.$route.query.id}}).then(function(e){t.taskForm=e.formProperties,t.taskFormData={}})},methods:{completeTask:function(){var t=this;this.$refs.taskForm.validate(function(e){e&&(t.loading=!0,o.a.post("rest/form/form-data",{taskId:t.$route.query.id,properties:t.$refs.taskForm.getData()}).then(function(e){t.loading=!1,t.$message.success("成功"),t.$router.go(-1)}).catch(function(e){console.log(e),t.loading=!1,t.$message.error("失败")}))})}},components:{DynamicForm:a("uBmv").a}},n={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("h3"),t._v(" "),a("dynamic-form",{ref:"taskForm",staticStyle:{width:"500px"},attrs:{formProps:t.taskForm}},[a("el-form-item",[a("el-button",{on:{click:function(e){t.$router.go(-1)}}},[t._v("取消")]),t._v(" "),a("el-button",{attrs:{type:"primary",loading:t.loading},on:{click:t.completeTask}},[t._v("完成")])],1)],1)],1)},staticRenderFns:[]};var s=a("VU/8")(i,n,!1,function(t){a("BvC/")},"data-v-75280462",null);e.default=s.exports},"BvC/":function(t,e){},dxsz:function(t,e){},uBmv:function(t,e,a){"use strict";var r=a("Dd8w"),o=a.n(r),i={props:{formProps:{type:Array,required:!0},value:{type:Object},size:{type:String,default:"small"}},created:function(){console.log("created",this.formProps),this.updateForm(this.formProps)},data:function(){return{formData:{},formDef:[]}},computed:{rules:function(){var t={};return this.formDef.forEach(function(e){t[e.id]=[{required:!0,message:"请填写"+e.name,trigger:"blur"}]}),t}},methods:{validate:function(t){this.$refs.form.validate(function(e){t instanceof Function&&t(e)})},clearValidate:function(){this.$refs.form.clearValidate()},getData:function(t){var e=this,a=[];return this.formDef.forEach(function(r){(r.writable||t)&&e.formData[r.id]&&a.push({id:r.id,value:e.formData[r.id]})}),a},updateForm:function(t){var e=this;try{this.$refs.form.clearValidate()}catch(t){}t.forEach(function(t){e.formData[t.id]=t.value||null}),this.formDef=this.formProps},valueChange:function(t,e){var a=o()({},this.formData);a[e]=t,this.formData=a}},watch:{formProps:function(t){this.updateForm(t)},value:function(t){if(t instanceof Object)for(var e in t)this.formData[e]=t[e]},formData:function(t){this.$emit("input",t)}}},n={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-form",{ref:"form",attrs:{model:t.formData,"label-position":"right","label-width":"100px",size:t.size,rules:t.rules}},[t._l(t.formDef,function(e){return e.readable?a("el-form-item",{key:e.id,attrs:{prop:e.id,label:e.name}},["string"===e.type?a("el-input",{staticClass:"form-item",attrs:{disabled:!e.writable},model:{value:t.formData[e.id],callback:function(a){t.$set(t.formData,e.id,a)},expression:"formData[item.id]"}}):"enum"===e.type?a("el-select",{ref:"select",refInFor:!0,staticClass:"form-item",attrs:{value:t.formData[e.id],disabled:!e.writable},on:{input:function(a){t.valueChange(a,e.id)}}},t._l(e.enumValues,function(t,e){return a("el-option",{key:e,attrs:{label:t.name,value:t.id}})})):"date"===e.type?a("el-date-picker",{staticClass:"form-item",attrs:{type:"datetime",value:t.formData[e.id],format:e.datePattern,"value-format":e.datePattern,disabled:!e.writable},on:{input:function(a){t.valueChange(a,e.id)}}}):"boolean"===e.type?a("el-switch",{staticClass:"form-item",attrs:{value:t.formData[e.id],disabled:!e.writable},on:{input:function(a){t.valueChange(a,e.id)}}}):t._e()],1):t._e()}),t._v(" "),t._t("default")],2)},staticRenderFns:[]};var s=a("VU/8")(i,n,!1,function(t){a("dxsz")},"data-v-7c494948",null);e.a=s.exports}});