|
@@ -0,0 +1,331 @@
|
|
|
+<template>
|
|
|
+ <div class="create-container">
|
|
|
+ <div class="create-body" v-loading="loading">
|
|
|
+ <div class="title">测评机构认证</div>
|
|
|
+ <el-form :model="authentication" :rules="rules" ref="authentication" label-width="12%" class="demo-report">
|
|
|
+ <el-form-item prop="file" label="机构logo">
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ action=""
|
|
|
+ :show-file-list="false"
|
|
|
+ :http-request="uploadFile"
|
|
|
+ :before-upload="beforeFileUpload">
|
|
|
+ <img v-if="authentication.photoUrl" :src="authentication.photoUrl" class="avatar">
|
|
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ <!--<div v-if="!isModifyMode">-->
|
|
|
+ <!--<span v-if="authentication.photo==null">暂无文件</span>-->
|
|
|
+ <!--<a :href="authentication.photo" v-if="authentication.photo!=null"><i class="fa fa-file-text-o"></i>-->
|
|
|
+ <!--{{authentication.photo}}</a>-->
|
|
|
+ <!--</div>-->
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="机构名称" prop="name">
|
|
|
+ <el-input v-if="isModifyMode" v-model="authentication.name"></el-input>
|
|
|
+ <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
|
|
|
+ </el-form-item>
|
|
|
+ <!--<el-form-item label="机构电话" prop="name">-->
|
|
|
+ <!--<el-input v-if="isModifyMode" v-model="authentication.mobile"></el-input>-->
|
|
|
+ <!--<!–<span v-if="!isModifyMode">{{authentication.name}}</span>–>-->
|
|
|
+ <!--</el-form-item>-->
|
|
|
+ <el-form-item label="对公账户" prop="name">
|
|
|
+ <el-input v-if="isModifyMode" v-model="authentication.bankAccount"></el-input>
|
|
|
+ <!--<span v-if="!isModifyMode">{{authentication.bankAccount}}</span>-->
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="地址" prop="name">
|
|
|
+ <el-input v-if="isModifyMode" v-model="authentication.address"></el-input>
|
|
|
+ <!--<span v-if="!isModifyMode">{{authentication.address}}</span>-->
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="测评机构能力" prop="name">
|
|
|
+ <el-checkbox-group v-if="isModifyMode" v-model="authentication.ability">
|
|
|
+ <span v-for="(item,index) in serviceTypes" :key="index">
|
|
|
+ <el-checkbox :label="item" name="type">{{item}} </el-checkbox>
|
|
|
+ </span>
|
|
|
+ </el-checkbox-group>
|
|
|
+ <!--<span v-if="!isModifyMode">{{authentication.ability}}</span>-->
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="测评机构资源" prop="name">
|
|
|
+ <span v-for="item in authentication.resource" :key="item.id">
|
|
|
+ 资源类型: <el-select v-model="item.type" placeholder="请选择" style="width: 150px;margin-bottom: 10px"
|
|
|
+ :value="item.type">
|
|
|
+ <el-option
|
|
|
+ v-for="item in resourceTypes"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ 资源名称: <el-input v-model="item.name" style="width: 150px"></el-input>
|
|
|
+ 总量: <el-input-number :min="0" v-model="item.totalNum"></el-input-number>
|
|
|
+ 可用数量: <el-input-number :min="0" :max="item.totalNum" v-model="item.availableNum"></el-input-number>
|
|
|
+ <el-button type="danger" icon="el-icon-delete" @click="removeAgencyResource(item.id)"></el-button>
|
|
|
+ <br/>
|
|
|
+ </span>
|
|
|
+ <el-button type="primary" icon="el-icon-circle-plus" plain size="small" @click="addAgencyResource">添加资源
|
|
|
+ </el-button>
|
|
|
+ <!--<span v-if="!isModifyMode">{{authentication.resource}}</span>-->
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!--<el-form-item v-if="!isModifyMode">-->
|
|
|
+ <!--<div class="btn btn-medium btn-info" @click="modifyInfo()">修改</div>-->
|
|
|
+ <!--<div class="btn btn-medium" @click="cancelModify()">返回</div>-->
|
|
|
+ <!--</el-form-item>-->
|
|
|
+ <el-form-item v-if="isModifyMode">
|
|
|
+ <div class="btn btn-primary btn-info" @click="submitInfo()">提交</div>
|
|
|
+ <!--<div class="btn btn-primary" @click="cancelModify()">取消</div>-->
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Http from '@/js/http'
|
|
|
+import Apis from '@/js/api'
|
|
|
+import {notify} from '@/constants/index'
|
|
|
+import {getAllAgencyResourceTypes, getAllServiceTypes, storageGet} from '@/js/index'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'AgencyAuthenticationCreate',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ userId: 0,
|
|
|
+ user: {},
|
|
|
+ loading: false,
|
|
|
+ isModifyMode: true,
|
|
|
+ resourceTypes: [],
|
|
|
+ serviceTypes: [],
|
|
|
+ authentication: {
|
|
|
+ mobile: '',
|
|
|
+ name: '',
|
|
|
+ bankAccount: '',
|
|
|
+ address: '',
|
|
|
+ ability: [],
|
|
|
+ resource: [],
|
|
|
+ photo: [],
|
|
|
+ photoUrl: '',
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ // name: [
|
|
|
+ // {required: true, message: '请输入报告名称', trigger: 'blur'}
|
|
|
+ // // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
|
|
|
+ // ],
|
|
|
+ // abstract: [
|
|
|
+ // {
|
|
|
+ // required: true,
|
|
|
+ // message: '请输入摘要信息',
|
|
|
+ // trigger: 'change'
|
|
|
+ // }
|
|
|
+ // ],
|
|
|
+ // type: [
|
|
|
+ // {required: true, message: '请选择报告类型', trigger: 'change'}
|
|
|
+ // ],
|
|
|
+ // conclusion: [
|
|
|
+ // {required: true, message: '请输入报告结论', trigger: 'blur'}
|
|
|
+ // ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.init()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //初始化数据
|
|
|
+ init () {
|
|
|
+ this.setServiceTypes()
|
|
|
+ this.setResourceTypes()
|
|
|
+ this.setUserInfo()
|
|
|
+ },
|
|
|
+ //加载数据
|
|
|
+ loadData: function () {
|
|
|
+ },
|
|
|
+ //表单进入可编辑状态,可修改表单,不再使用
|
|
|
+ modifyInfo () {
|
|
|
+ this.isModifyMode = true
|
|
|
+ },
|
|
|
+ //提交认证信息
|
|
|
+ submitInfo () {
|
|
|
+ //this.isModifyMode = false
|
|
|
+ this.showLoading()
|
|
|
+ const newAuthentication = {
|
|
|
+ mobile: this.authentication.mobile,
|
|
|
+ evaluationAgencyName: this.authentication.name,
|
|
|
+ bankAccount: this.authentication.bankAccount,
|
|
|
+ address: this.authentication.address,
|
|
|
+ evaluationAgencyAbilityList: this.authentication.ability,
|
|
|
+ evaluationAgencyResourceList: this.authentication.resource,
|
|
|
+ agencyPhoto: this.authentication.photoUrl,
|
|
|
+ }
|
|
|
+ console.log(newAuthentication)
|
|
|
+ Http.post(Apis.USER.SUBMIT_AGENCY_AUTHENTICATION_INFO.replace('{userId}', this.user.userVO.id), newAuthentication).then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ this.hideLoading()
|
|
|
+ notify('success', '认证信息上传成功')
|
|
|
+ }).catch(error => {
|
|
|
+ notify('error', error.data)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //取消修改表单,表单进入不可编辑状态,不再使用
|
|
|
+ cancelModify () {
|
|
|
+ this.isModifyMode = false
|
|
|
+ },
|
|
|
+ //上传文件时移除文件的响应函数
|
|
|
+ handleRemove (file, fileList) {
|
|
|
+ console.log(file, fileList)
|
|
|
+ },
|
|
|
+ //添加文件时的响应函数
|
|
|
+ handleExceed (files, fileList) {
|
|
|
+ this.$message.warning(
|
|
|
+ `当前限制选择 1 个文件,本次选择了 ${
|
|
|
+ files.length
|
|
|
+ } 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
|
|
+ )
|
|
|
+ },
|
|
|
+ //移除文件前的响应函数
|
|
|
+ beforeRemove (file, fileList) {
|
|
|
+ //return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
+ },
|
|
|
+ //文件上传前的响应函数
|
|
|
+ beforeFileUpload () {
|
|
|
+ },
|
|
|
+ //上传文件,此处为上传图片
|
|
|
+ uploadFile (param) {
|
|
|
+ const formData = new FormData()
|
|
|
+ let config = {
|
|
|
+ //添加请求头
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'},
|
|
|
+ }
|
|
|
+ formData.append('file', param.file)
|
|
|
+ Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
|
|
|
+ console.log('上传成功')
|
|
|
+ this.authentication.photoUrl = res.data
|
|
|
+ console.log(res.data)
|
|
|
+ notify('success', '上传成功')
|
|
|
+ }).catch(error => {
|
|
|
+ notify('error', error.data.msg)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //设置服务类型
|
|
|
+ setServiceTypes () {
|
|
|
+ getAllServiceTypes().then((res) => {
|
|
|
+ this.serviceTypes = res
|
|
|
+ }).catch((error) => {
|
|
|
+ notify('error', '机构能力加载失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //设置机构资源类型
|
|
|
+ setResourceTypes () {
|
|
|
+ this.resourceTypes = getAllAgencyResourceTypes()
|
|
|
+ },
|
|
|
+ //添加一项测评机构资源
|
|
|
+ addAgencyResource () {
|
|
|
+ const tmpResource = {
|
|
|
+ id: this.authentication.resource.length,
|
|
|
+ type: this.resourceTypes[0],
|
|
|
+ name: '',
|
|
|
+ totalNum: 0,
|
|
|
+ availableNum: 0,
|
|
|
+ }
|
|
|
+ this.authentication.resource.push(tmpResource)
|
|
|
+ },
|
|
|
+ //删除一项测评机构资源
|
|
|
+ removeAgencyResource (id) {
|
|
|
+ this.authentication.resource.splice(id, 1)
|
|
|
+ for (var i = 0; i < this.authentication.resource.length; i++) {
|
|
|
+ this.authentication.resource[i].id = i
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //检测测评机构资源填写是否有效
|
|
|
+ checkAgencyResourceVaild () {
|
|
|
+ if (this.authentication.resource.length === 0) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ for (var i = 0; i < this.authentication.resource.length; i++) {
|
|
|
+ const item = this.authentication.resource[i]
|
|
|
+ if (item.type === '') {
|
|
|
+ notify('error', '资源类型不能为空')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (item.name === '') {
|
|
|
+ notify('error', '资源名称不能为空')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (item.totalNum < item.availableNum) {
|
|
|
+ notify('error', '资源总数量不能低于可用数量')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ //
|
|
|
+ setUserInfo () {
|
|
|
+ this.user = storageGet('user')
|
|
|
+ },
|
|
|
+ //
|
|
|
+ showLoading () {
|
|
|
+ this.loading = true
|
|
|
+ },
|
|
|
+ hideLoading () {
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+ submitSuccess () {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created: function () {
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .el-radio {
|
|
|
+ margin: 10px 20px 10px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-form-item /deep/ .el-tabs__content {
|
|
|
+ max-height: 120px !important;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-row {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-input {
|
|
|
+ width: 400px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409EFF;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar-uploader-icon {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 176px;
|
|
|
+ height: 178px;
|
|
|
+ line-height: 178px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar-uploader-icon:hover {
|
|
|
+ border-color: #409EFF;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar {
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+</style>
|