1 |
- webpackJsonp([40],{F14N:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a("SQ4B"),i=a("b9vf"),o=a("qI5z"),r=a("vGYV"),s={name:"AgencyAuthenticationCreate",data:function(){var e=this;return{userId:0,user:{},loading:!1,isModifyMode:!0,resourceTypes:[],serviceTypes:[],authentication:{mobile:"",evaluationAgencyName:"",bankAccount:"",address:"",evaluationAgencyAbilityList:[],evaluationAgencyResourceList:[],photo:[],agencyPhoto:""},rules:{evaluationAgencyName:[{required:!0,message:"请输入机构名称",trigger:"blur"},{min:3,max:50,message:"机构名称长度在 3 到 50 个字符",trigger:"blur"}],bankAccount:[{required:!0,message:"请输入银行卡账户",trigger:"blur"},{min:16,max:19,message:"银行卡账户输入有误",trigger:"blur"},{validator:function(t,a,n){e.checkNumber(a)?n():n(new Error("银行卡账户输入有误"))},trigger:"blur"}],address:[{required:!0,message:"请输入地址",trigger:"blur"}],evaluationAgencyAbilityList:[{type:"array",required:!0,message:"请至少选择一种测试类型",trigger:"change"}],evaluationAgencyResourceList:[{validator:function(e,t,a){var n=!1;if(null==t||0==t.length)a(new Error("机构资源不可为空"));else for(var i=0;i<t.length;i++)if(""==t[i].name){n=!0;break}n?a(new Error("资源名称不可为空")):a()},trigger:"blur"}],agencyPhoto:[{validator:function(e,t,a){null==t||""==t?a(new Error("机构logo不可为空")):a()},trigger:"blur"}]}}},mounted:function(){var e=this;this.$nextTick(function(){e.init()})},methods:{init:function(){this.setServiceTypes(),this.setResourceTypes(),this.setUserInfo()},loadData:function(){},modifyInfo:function(){this.isModifyMode=!0},submitInfo:function(){var e=this;this.$refs.authentication.validate(function(t){if(!t)return Object(o.a)("error","表单填写错误!"),!1;e.showLoading();var a={userId:e.user.userVO.id,evaluationAgencyName:e.authentication.evaluationAgencyName,bankAccount:e.authentication.bankAccount,address:e.authentication.address,evaluationAgencyAbilityList:e.authentication.evaluationAgencyAbilityList,evaluationAgencyResourceList:e.authentication.evaluationAgencyResourceList,agencyPhoto:e.authentication.agencyPhoto};console.log(a),Object(r.V)(e.user.userVO.id,a,e.submitInfoSuccess,e.submitInfoFail)})},submitInfoSuccess:function(e){var t=this;console.log(e),Object(r.w)().then(function(e){Object(r.O)("user",e),t.user=e,t.sendBusMessage(),Object(r.O)("rolesPermissions",Object(r.C)(e.roleList)),t.hideLoading(),t.$alert("认证信息提交成功,将于3个工作日内审核完成","提交成功",{confirmButtonText:"确定",callback:function(e){t.$router.push({name:"AgencyAuthentication",params:{userId:t.user.userVO.id}})}})}).catch(function(e){t.hideLoading(),Object(o.a)("error","重新获取用户信息失败:"+e.data)})},submitInfoFail:function(e){this.hideLoading(),Object(o.a)("error",e.data)},cancelModify:function(){this.isModifyMode=!1},handleRemove:function(e,t){console.log(e,t)},handleExceed:function(e,t){this.$message.warning("当前限制选择 1 个文件,本次选择了 "+e.length+" 个文件,共选择了 "+(e.length+t.length)+" 个文件")},beforeRemove:function(e,t){},beforeFileUpload:function(e){if(e.size>1e7)return Object(o.a)("error","单个文件大小不能超过10M"),!1;var t=e.name,a=t.lastIndexOf(".");if(a<=0)return Object(o.a)("error","只能上传png/jpg格式的文件"),!1;var n=t.substr(a);return".jpg"!==n&&".png"!==n?(Object(o.a)("error","只能上传png/jpg格式的文件"),!1):void 0},uploadFile:function(e){var t=this;this.showLoading();var a=new FormData;a.append("file",e.file),n.a.upload(i.a.FILE.UPLOAD_IMAGE.replace("{userId}",this.user.userVO.id),a,{headers:{"Content-Type":"multipart/form-data"}}).then(function(e){t.hideLoading(),t.authentication.agencyPhoto=e.data,console.log(e.data),Object(o.a)("success","上传成功"),t.$refs.authentication.validateField("agencyPhoto")}).catch(function(e){t.hideLoading();try{413===e.response.status?Object(o.a)("error","文件过大,请选择小于20M的图片"):500===e.response.status&&Object(o.a)("error","上传文件发生错误,请稍后重试")}catch(t){Object(o.a)("error",e.data)}})},setServiceTypes:function(){var e=this;Object(r.s)().then(function(t){e.serviceTypes=t}).catch(function(e){Object(o.a)("error","机构能力加载失败")})},setResourceTypes:function(){this.resourceTypes=Object(r.l)()},addAgencyResource:function(){var e={id:this.authentication.evaluationAgencyResourceList.length,type:this.resourceTypes[0],name:"",totalNum:0,availableNum:0};this.authentication.evaluationAgencyResourceList.push(e)},removeAgencyResource:function(e){this.authentication.evaluationAgencyResourceList.splice(e,1);for(var t=0;t<this.authentication.evaluationAgencyResourceList.length;t++)this.authentication.evaluationAgencyResourceList[t].id=t},checkAgencyResourceVaild:function(){if(0===this.authentication.evaluationAgencyResourceList.length)return!0;for(var e=0;e<this.authentication.evaluationAgencyResourceList.length;e++){var t=this.authentication.evaluationAgencyResourceList[e];if(""===t.type)return Object(o.a)("error","资源类型不能为空"),!1;if(""===t.name)return Object(o.a)("error","资源名称不能为空"),!1;if(t.totalNum<t.availableNum)return Object(o.a)("error","资源总数量不能低于可用数量"),!1}return!0},setUserInfo:function(){this.user=Object(r.M)("user")},showLoading:function(){this.loading=!0},hideLoading:function(){this.loading=!1},submitSuccess:function(){},sendBusMessage:function(){this.$root.$emit("user",this.user)},checkNumber:function(e){return/^\d+$/.test(e)}},created:function(){}},c=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"create-container"},[a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"create-body"},[a("div",{staticClass:"title"},[e._v("测评机构认证")]),e._v(" "),a("el-form",{ref:"authentication",staticClass:"demo-report",attrs:{model:e.authentication,rules:e.rules,"label-width":"12%"}},[a("el-form-item",{attrs:{prop:"agencyPhoto",label:"机构logo"}},[a("el-upload",{staticClass:"avatar-uploader",attrs:{action:"","show-file-list":!1,"http-request":e.uploadFile,"before-upload":e.beforeFileUpload}},[e.authentication.agencyPhoto?a("img",{staticClass:"avatar",attrs:{src:e.authentication.agencyPhoto}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),a("el-form-item",{attrs:{label:"机构名称",prop:"evaluationAgencyName"}},[e.isModifyMode?a("el-input",{attrs:{size:"small"},model:{value:e.authentication.evaluationAgencyName,callback:function(t){e.$set(e.authentication,"evaluationAgencyName",t)},expression:"authentication.evaluationAgencyName"}}):e._e()],1),e._v(" "),a("el-form-item",{attrs:{label:"地址",prop:"address"}},[e.isModifyMode?a("el-input",{attrs:{size:"small"},model:{value:e.authentication.address,callback:function(t){e.$set(e.authentication,"address",t)},expression:"authentication.address"}}):e._e()],1),e._v(" "),a("el-form-item",{attrs:{label:"测评机构能力",prop:"evaluationAgencyAbilityList"}},[e.isModifyMode?a("el-checkbox-group",{model:{value:e.authentication.evaluationAgencyAbilityList,callback:function(t){e.$set(e.authentication,"evaluationAgencyAbilityList",t)},expression:"authentication.evaluationAgencyAbilityList"}},e._l(e.serviceTypes,function(t,n){return a("span",{key:n},[a("el-checkbox",{attrs:{label:t,name:"type"}},[e._v(e._s(t)+" ")])],1)}),0):e._e()],1),e._v(" "),a("el-form-item",{attrs:{label:"测评机构资源",prop:"evaluationAgencyResourceList"}},[e._l(e.authentication.evaluationAgencyResourceList,function(t){return a("span",{key:t.id},[e._v("\n 资源类型: "),a("el-select",{staticStyle:{width:"150px","margin-bottom":"10px"},attrs:{size:"small",placeholder:"请选择",value:t.type},model:{value:t.type,callback:function(a){e.$set(t,"type",a)},expression:"item.type"}},e._l(e.resourceTypes,function(e){return a("el-option",{key:e,attrs:{label:e,value:e}})}),1),e._v("\n 资源名称: "),a("el-input",{staticStyle:{width:"150px"},attrs:{size:"small"},model:{value:t.name,callback:function(a){e.$set(t,"name",a)},expression:"item.name"}}),e._v("\n 总量: "),a("el-input-number",{attrs:{size:"small",min:0},model:{value:t.totalNum,callback:function(a){e.$set(t,"totalNum",a)},expression:"item.totalNum"}}),e._v("\n 可用数量: "),a("el-input-number",{attrs:{size:"small",min:0,max:t.totalNum},model:{value:t.availableNum,callback:function(a){e.$set(t,"availableNum",a)},expression:"item.availableNum"}}),e._v(" "),a("el-button",{attrs:{size:"small",type:"danger",icon:"el-icon-delete"},on:{click:function(a){return e.removeAgencyResource(t.id)}}}),e._v(" "),a("br")],1)}),e._v(" "),a("el-button",{attrs:{type:"primary",icon:"el-icon-circle-plus",plain:"",size:"small"},on:{click:e.addAgencyResource}},[e._v("添加资源\n ")])],2),e._v(" "),e.isModifyMode?a("el-form-item",[a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(t){return e.submitInfo()}}},[e._v("提交")])],1):e._e()],1)],1)])};c._withStripped=!0;var l={render:c,staticRenderFns:[]},u=l;var d=!1;var A=a("VU/8")(s,u,!1,function(e){d||a("qH3o")},"data-v-1fd6bb12",null);A.options.__file="src/components/authen/AgencyAuthenticationCreate.vue";t.default=A.exports},WXCP:function(e,t,a){(t=a("yGwj")(!0)).push([e.i,"\n.el-radio[data-v-1fd6bb12] {\n margin: 10px 20px 10px 0;\n}\n.el-form-item[data-v-1fd6bb12] .el-tabs__content {\n /*max-height: 120px !important;*/\n overflow: auto;\n}\n.el-row[data-v-1fd6bb12] {\n margin-bottom: 10px;\n}\n.el-input[data-v-1fd6bb12] {\n width: 400px;\n}\n.avatar-uploader .el-upload[data-v-1fd6bb12] {\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n}\n.avatar-uploader .el-upload[data-v-1fd6bb12]:hover {\n border-color: #409EFF;\n}\n.avatar-uploader-icon[data-v-1fd6bb12] {\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n font-size: 28px;\n color: #8c939d;\n width: 176px;\n height: 178px;\n line-height: 178px;\n text-align: center;\n}\n.avatar-uploader-icon[data-v-1fd6bb12]:hover {\n border-color: #409EFF;\n}\n.avatar[data-v-1fd6bb12] {\n width: 178px;\n height: 178px;\n display: block;\n}\n","",{version:3,sources:["AgencyAuthenticationCreate.vue"],names:[],mappings:";AACA;EACE,wBAAwB;AAC1B;AACA;EACE,gCAAgC;EAChC,cAAc;AAChB;AACA;EACE,mBAAmB;AACrB;AACA;EACE,YAAY;AACd;AACA;EACE,0BAA0B;EAC1B,kBAAkB;EAClB,eAAe;EACf,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,qBAAqB;AACvB;AACA;EACE,0BAA0B;EAC1B,kBAAkB;EAClB,eAAe;EACf,cAAc;EACd,YAAY;EACZ,aAAa;EACb,kBAAkB;EAClB,kBAAkB;AACpB;AACA;EACE,qBAAqB;AACvB;AACA;EACE,YAAY;EACZ,aAAa;EACb,cAAc;AAChB",file:"AgencyAuthenticationCreate.vue",sourcesContent:["\n.el-radio[data-v-1fd6bb12] {\n margin: 10px 20px 10px 0;\n}\n.el-form-item[data-v-1fd6bb12] .el-tabs__content {\n /*max-height: 120px !important;*/\n overflow: auto;\n}\n.el-row[data-v-1fd6bb12] {\n margin-bottom: 10px;\n}\n.el-input[data-v-1fd6bb12] {\n width: 400px;\n}\n.avatar-uploader .el-upload[data-v-1fd6bb12] {\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n}\n.avatar-uploader .el-upload[data-v-1fd6bb12]:hover {\n border-color: #409EFF;\n}\n.avatar-uploader-icon[data-v-1fd6bb12] {\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n font-size: 28px;\n color: #8c939d;\n width: 176px;\n height: 178px;\n line-height: 178px;\n text-align: center;\n}\n.avatar-uploader-icon[data-v-1fd6bb12]:hover {\n border-color: #409EFF;\n}\n.avatar[data-v-1fd6bb12] {\n width: 178px;\n height: 178px;\n display: block;\n}\n"]}]),e.exports=t},qH3o:function(e,t,a){var n=a("WXCP");"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);a("rjj0")("611385bc",n,!1,{})}});
|