28.7afb7fcddc1c5f4763ed.js 12 KB

1
  1. webpackJsonp([28],{bz3Z:function(e,t){},yWUp:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=i("SQ4B"),n=i("b9vf"),o=i("qI5z"),s=i("vGYV"),c={name:"AgencyAuthentication",data:function(){var e=this;return{userId:0,user:{},loading:!1,isModifyMode:!1,resourceTypes:[],serviceTypes:[],authentication:{mobile:"",evaluationAgencyName:"",bankAccount:"",address:"",evaluationAgencyAbilityList:[],evaluationAgencyResourceList:[],photo:[],authStatus:{},agencyPhoto:s.c.image,explain:""},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,i,a){e.checkNumber(i)?a():a(new Error("银行卡账户输入有误"))},trigger:"blur"}],address:[{required:!0,message:"请输入地址",trigger:"blur"}],evaluationAgencyAbilityList:[{type:"array",required:!0,message:"请至少选择一种测试类型",trigger:"change"}],evaluationAgencyResourceList:[{validator:function(e,t,i){var a=!1;if(null==t||0==t.length)i(new Error("机构资源不可为空"));else for(var n=0;n<t.length;n++)if(""==t[n].name){a=!0;break}a?i(new Error("资源名称不可为空")):i()},trigger:"blur"}],agencyPhoto:[{validator:function(e,t,i){null==t||""==t?i(new Error("机构logo不可为空")):i()},trigger:"blur"}]}}},mounted:function(){var e=this;this.$nextTick(function(){e.init()})},methods:{init:function(){this.setServiceTypes(),this.setResourceTypes(),this.setUserInfo(),this.getAuthInfo()},getAuthInfo:function(){this.showLoading(),Object(s.s)(this.user.userVO.id,this.getAuthInfoSuccess,this.getAuthInfoFail)},getAuthInfoSuccess:function(e){this.hideLoading(),this.authentication.agencyPhoto=null==e.agencyPhoto?s.c.image:e.agencyPhoto,this.authentication.evaluationAgencyName=null==e.evaluationAgencyName?"暂未填写":e.evaluationAgencyName,this.authentication.evaluationAgencyAbilityList=null==e.evaluationAgencyAbilityList?[]:e.evaluationAgencyAbilityList,this.authentication.evaluationAgencyResourceList=null==e.evaluationAgencyResourceList?[]:e.evaluationAgencyResourceList,this.authentication.bankAccount=null==e.bankAccount?"暂未填写":e.bankAccount,this.authentication.address=null==e.address?"暂未填写":e.address,this.authentication.authStatus=e.authStatus,this.authentication.explain=e.explain,console.log(this.authentication)},getAuthInfoFail:function(e){this.hideLoading(),Object(o.a)("error","加载认证信息失败:"+e.data)},modifyInfo:function(){this.isModifyMode=!0},updateAuthInfo:function(){var e=this;this.$refs.authentication.validate(function(t){if(!t)return Object(o.a)("error","表单填写错误!"),!1;e.showLoading();var i={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};Object(s.P)(e.user.userVO.id,i,e.updateAuthInfoSuccess,e.updateAuthInfoFail)})},updateAuthInfoSuccess:function(e){var t=this;console.log(e),this.hideLoading(),this.cancelModify(),Object(o.a)("success","认证信息修改成功,正在为您刷新用户信息"),Object(s.v)().then(function(e){Object(s.M)("user",e),t.user=e,t.sendBusMessage(),Object(s.M)("rolesPermissions",Object(s.B)(e.roleList)),t.hideLoading(),Object(o.a)("success","用户信息刷新成功")}).catch(function(e){t.hideLoading(),Object(o.a)("error","重新获取用户信息失败:"+e.data)})},updateAuthInfoFail:function(e){this.hideLoading(),Object(o.a)("error",e.data)},cancelModify:function(){this.isModifyMode=!1,this.getAuthInfo()},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,i=t.lastIndexOf(".");if(i<=0)return Object(o.a)("error","只能上传png/jpg格式的文件"),!1;var a=t.substr(i);return".jpg"!==a&&".png"!==a?(Object(o.a)("error","只能上传png/jpg格式的文件"),!1):void 0},uploadFile:function(e){var t=this,i=new FormData;i.append("file",e.file),a.a.upload(n.a.FILE.UPLOAD_IMAGE.replace("{userId}",this.user.userVO.id),i,{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(s.r)().then(function(t){e.serviceTypes=t}).catch(function(e){Object(o.a)("error","机构能力加载失败")})},setResourceTypes:function(){this.resourceTypes=Object(s.k)()},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(s.K)("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(){}},u={render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"create-container"},[i("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"create-body",staticStyle:{width:"100%"}},[i("div",{staticClass:"title"},[e._v("测评机构认证")]),e._v(" "),i("el-form",{ref:"authentication",staticClass:"demo-report",attrs:{model:e.authentication,rules:e.rules,"label-width":"12%"}},[i("el-form-item",{attrs:{prop:"agencyPhoto",label:"机构logo"}},[e.isModifyMode?i("el-upload",{staticClass:"avatar-uploader",attrs:{action:"","show-file-list":!1,"http-request":e.uploadFile,"before-upload":e.beforeFileUpload}},[e.authentication.agencyPhoto?i("img",{staticClass:"avatar",attrs:{src:e.authentication.agencyPhoto}}):i("i",{staticClass:"el-icon-plus avatar-uploader-icon"})]):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[i("el-image",{staticStyle:{width:"100px"},attrs:{src:e.authentication.agencyPhoto,fit:"scale-down"}})],1)],1),e._v(" "),i("el-form-item",{attrs:{label:"机构名称",prop:"evaluationAgencyName"}},[e.isModifyMode?i("el-input",{model:{value:e.authentication.evaluationAgencyName,callback:function(t){e.$set(e.authentication,"evaluationAgencyName",t)},expression:"authentication.evaluationAgencyName"}}):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[e._v(e._s(e.authentication.evaluationAgencyName))])],1),e._v(" "),e.isModifyMode?e._e():i("el-form-item",{attrs:{label:"认证状态",prop:"name"}},[i("el-tag",{attrs:{type:e.authentication.authStatus.style}},[e._v(e._s(e.authentication.authStatus.text))])],1),e._v(" "),e.isModifyMode||"认证失败"!=e.authentication.authStatus.text?e._e():i("el-form-item",{attrs:{label:"失败原因",prop:"name"}},[null!=e.authentication.explain&&""!=e.authentication.explain?i("el-link",{attrs:{type:"danger",disabled:""}},[e._v("\n "+e._s(e.authentication.explain)+"\n ")]):e._e(),e._v(" "),null==e.authentication.explain||""==e.authentication.explain?i("el-link",{attrs:{type:"danger",disabled:""}},[e._v("管理员未填写\n ")]):e._e()],1),e._v(" "),i("el-form-item",{attrs:{label:"地址",prop:"address"}},[e.isModifyMode?i("el-input",{model:{value:e.authentication.address,callback:function(t){e.$set(e.authentication,"address",t)},expression:"authentication.address"}}):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[e._v(e._s(e.authentication.address))])],1),e._v(" "),i("el-form-item",{attrs:{label:"测评机构能力",prop:"evaluationAgencyAbilityList"}},[e.isModifyMode?i("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,a){return i("span",{key:a},[i("el-checkbox",{attrs:{label:t,name:"type"}},[e._v(e._s(t)+"    ")])],1)}),0):e._e(),e._v(" "),e._l(e.authentication.evaluationAgencyAbilityList,function(t,a){return e.isModifyMode?e._e():i("span",{key:a},[i("span",{staticClass:"badge"},[e._v(e._s(t))])])})],2),e._v(" "),i("el-form-item",{attrs:{label:"测评机构资源",prop:"evaluationAgencyResourceList"}},[e._l(e.authentication.evaluationAgencyResourceList,function(t){return e.isModifyMode?i("span",{key:t.id,staticStyle:{width:"2000px"}},[e._v("\n 资源类型: "),i("el-select",{staticStyle:{width:"15%","margin-bottom":"10px"},attrs:{placeholder:"请选择",value:t.type},model:{value:t.type,callback:function(i){e.$set(t,"type",i)},expression:"item.type"}},e._l(e.resourceTypes,function(e){return i("el-option",{key:e,attrs:{label:e,value:e}})}),1),e._v("\n 资源名称: "),i("el-input",{staticStyle:{width:"15%"},model:{value:t.name,callback:function(i){e.$set(t,"name",i)},expression:"item.name"}}),e._v("\n 总量: "),i("el-input-number",{staticStyle:{width:"15%"},attrs:{min:0},model:{value:t.totalNum,callback:function(i){e.$set(t,"totalNum",i)},expression:"item.totalNum"}}),e._v("\n 可用数量: "),i("el-input-number",{staticStyle:{width:"15%"},attrs:{min:0,max:t.totalNum},model:{value:t.availableNum,callback:function(i){e.$set(t,"availableNum",i)},expression:"item.availableNum"}}),e._v(" "),i("el-button",{attrs:{type:"danger",icon:"el-icon-delete"},on:{click:function(i){return e.removeAgencyResource(t.id)}}}),e._v(" "),i("br")],1):e._e()}),e._v(" "),e.isModifyMode?i("el-button",{attrs:{type:"primary",icon:"el-icon-circle-plus",plain:"",size:"small"},on:{click:e.addAgencyResource}},[e._v("添加资源\n ")]):e._e(),e._v(" "),e._l(e.authentication.evaluationAgencyResourceList,function(t){return e.isModifyMode?e._e():i("span",{key:t.id},[e._v("\n 资源类型:"+e._s(t.type)+";  资源名称:"+e._s(t.name)+";  资源总量:"+e._s(t.totalNum)+";  可用资源:"+e._s(t.availableNum)),i("br")])})],2),e._v(" "),e.isModifyMode?e._e():i("el-form-item",[i("div",{staticClass:"btn btn-medium btn-info",on:{click:function(t){return e.modifyInfo()}}},[e._v("修改")])]),e._v(" "),e.isModifyMode?i("el-form-item",[i("div",{staticClass:"btn btn-primary btn-info",on:{click:function(t){return e.updateAuthInfo()}}},[e._v("提交")]),e._v(" "),i("div",{staticClass:"btn btn-primary",on:{click:function(t){return e.cancelModify()}}},[e._v("取消")])]):e._e()],1)],1)])},staticRenderFns:[]};var r=i("VU/8")(c,u,!1,function(e){i("bz3Z")},"data-v-6e733bf9",null);t.default=r.exports}});