diff --git a/src/views/Invest/BusinessPartner/Index.vue b/src/views/Invest/BusinessPartner/Index.vue index f886bb7..8d891f2 100644 --- a/src/views/Invest/BusinessPartner/Index.vue +++ b/src/views/Invest/BusinessPartner/Index.vue @@ -41,35 +41,37 @@
- + - - + + - - + + - + - + @@ -91,7 +93,7 @@ @@ -99,22 +101,47 @@ - - + - 上传 - - + + 上传 + +
+ 请上传 + + + 的文件 +
+ + + + +
  • + + {{ getFileName(file.name) }} + +
    + 删除 +
    +
  • +
    +
    - + 提交 @@ -133,28 +160,30 @@
    - + - - + + - - + + - + @@ -162,7 +191,7 @@ - + - + - + - - + + - - + + - + - + - + - + - - - + + + @@ -249,7 +278,7 @@ - + @@ -271,7 +300,7 @@ @@ -294,7 +323,7 @@
    - + 提交 @@ -368,34 +397,136 @@ export default { { label: '食品经营许可证', value: '食品经营许可证' }, { label: '其他证书', value: '其他证书' }, ], + form1Rules: { + companyName: [ + { required: true, message: '请输入公司名称(个人)', trigger: 'blur' }, + ], + address: [ + { required: true, message: '请输入地址', trigger: 'blur' }, + ], + phoneNumber: [ + { required: true, message: '请输入联系电话', trigger: 'blur' }, + { + validator: function (rule, value, callback) { + const reg = /^1[3456789]\d{9}$/; + if (!reg.test(value)) { + callback(new Error('请输入手机号')); + } else { + callback(); + } + }, + trigger: 'blur', + }, + ], + email: [ + { required: true, message: '请输入电子邮箱', trigger: 'blur' }, + { + validator: function (rule, value, callback) { + const reg3 = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/; + if (!reg3.test(value)) { + callback(new Error('请输入邮箱')); + } else { + callback(); + } + }, + trigger: 'blur', + }, + ], + }, form1: { + propertiesType: 1, companyName: '', - companyAddress: '', + address: '', + phoneNumber: '', email: '', - phone: '', - excelIn: [], - dominanceConcept: '', - intention: '', + fieldType: [], + advantageConcept: '', + cooperationIntention: '', + }, + formRules: { + companyName: [ + { required: true, message: '请输入公司名称', trigger: 'blur' }, + ], + address: [ + { required: true, message: '请输入地址', trigger: 'blur' }, + ], + identifierCode: [ + { required: true, message: '请输入统一社会信用代码', trigger: 'blur' }, + { + validator: function (rule, value, callback) { + const reg = /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/; + if (!reg.test(value)) { + callback(new Error('请输入统一社会信用代码')); + } else { + callback(); + } + }, + trigger: 'blur', + }, + ], + phoneNumber: [ + { required: true, message: '请输入联系电话', trigger: 'blur' }, + { + validator: function (rule, value, callback) { + const reg = /^1[3456789]\d{9}$/; + if (!reg.test(value)) { + callback(new Error('请输入手机号')); + } else { + callback(); + } + }, + trigger: 'blur', + }, + ], + email: [ + { required: true, message: '请输入电子邮箱', trigger: 'blur' }, + { + validator: function (rule, value, callback) { + const reg3 = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/; + if (!reg3.test(value)) { + callback(new Error('请输入邮箱')); + } else { + callback(); + } + }, + trigger: 'blur', + }, + ] }, form: { + propertiesType: 2, companyName: '', - companyAddress: '', - uniformCode: '', + address: '', + identifierCode: '', email: '', - enterpriseProperty: [], - industryField: '', - mainProduct: '', - phone: '', - website: '', - designCapability: [], - standards: [], - authentication: [], - otherRemark: '', + businessNature: [], + fieldIndustry: '', + mainProducts: '', + phoneNumber: '', + webAddress: '', + developmentCapability: [], + complianceStandards: [], + productCertification: [], + otherNotes: '', qualitySystem: [], - relevantQualification: [], - dominanceConcept: '', - intention: '', + relevantQualifications: [], + advantageConcept: '', + cooperationIntention: '', }, + // 数量限制 + limit: 10, + // 大小限制(MB) + fileSize: 10, + // 文件类型, 例如['png', 'jpg', 'jpeg'] + fileType: ["doc", "docx", "xls","xlsx", "ppt", "txt", "pdf"], + // 是否显示提示 + isShowTip: true, + number: 0, + uploadList: [], + // 上传文件服务器地址 + uploadFileUrl: process.env.VUE_APP_API_TARGET_URL + "/system/oss/upload", + fileList: [], + loadingModal: undefined, }; }, computed: { @@ -428,6 +559,148 @@ export default { this.screen1.Partner = res.rows.sort((a, b) => a.orders - b.orders); } catch (error) {} }, + handleAddPartner() { + try { + this.$refs["Partnerform"].validate(valid => { + if (valid) { + this.form1.fieldType = this.form1.fieldType.toString(); + this.$request.post( + '/official/companymessage/add', + this.form1, + ).then(res => { + if(res.code == 200) { + this.form1= { + propertiesType: 1, + companyName: '', + address: '', + phoneNumber: '', + email: '', + fieldType: [], + advantageConcept: '', + cooperationIntention: '', + } + } + }); + } + }); + } catch (error) {} + }, + handleAddSupper() { + try { + this.$refs["Supperform"].validate(valid => { + if (valid) { + this.form.businessNature = this.form.businessNature.toString(); + this.form.developmentCapability = this.form.developmentCapability.toString(); + this.form.complianceStandards = this.form.complianceStandards.toString(); + this.form.productCertification = this.form.productCertification.toString(); + this.form.qualitySystem = this.form.qualitySystem.toString(); + this.form.relevantQualifications = this.form.relevantQualifications.toString(); + this.$request.post( + '/official/companymessage/add', + this.form, + ).then(res => { + if(res.code == 200) { + this.form= { + propertiesType: 2, + companyName: '', + address: '', + identifierCode: '', + email: '', + businessNature: [], + fieldIndustry: '', + mainProducts: '', + phoneNumber: '', + webAddress: '', + developmentCapability: [], + complianceStandards: [], + productCertification: [], + otherNotes: '', + qualitySystem: [], + relevantQualifications: [], + advantageConcept: '', + cooperationIntention: '', + } + } + }); + } + }); + } catch (error) {} + }, + // 上传前校检格式和大小 + handleBeforeUpload(file) { + // 校检文件类型 + if (this.fileType) { + const fileName = file.name.split('.'); + const fileExt = fileName[fileName.length - 1]; + const isTypeOk = this.fileType.indexOf(fileExt) >= 0; + if (!isTypeOk) { + this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`); + return false; + } + } + // 校检文件大小 + if (this.fileSize) { + const isLt = file.size / 1024 / 1024 < this.fileSize; + if (!isLt) { + this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`); + return false; + } + } + this.loadingModal = this.$loading({ + lock: true, + text: '正在上传文件,请稍候...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); + this.number++; + return true; + }, + // 文件个数超出 + handleExceed() { + this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`); + }, + // 上传失败 + handleUploadError(err) { + this.$message.error(`上传文件失败,请重试`); + this.loadingModal.close(); + }, + // 上传成功回调 + handleUploadSuccess(res, file) { + if (res.code === 200) { + this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId }); + this.uploadedSuccessfully(); + } else { + this.number--; + this.loadingModal.close(); + this.$message.error(res.msg); + this.$refs.fileUpload.handleRemove(file); + this.uploadedSuccessfully(); + } + }, + // 删除文件 + handleDelete(index) { + let ossId = this.fileList[index].ossId; + delOss(ossId); + this.fileList.splice(index, 1); + }, + // 上传结束处理 + uploadedSuccessfully() { + if (this.number > 0 && this.uploadList.length === this.number) { + this.fileList = this.fileList.concat(this.uploadList); + this.uploadList = []; + this.number = 0; + this.loadingModal.close(); + } + }, + // 获取文件名称 + getFileName(name) { + // 如果是url那么取最后的名字 如果不是直接返回 + if (name.lastIndexOf("/") > -1) { + return name.slice(name.lastIndexOf("/") + 1); + } else { + return name; + } + }, }, }; @@ -480,7 +753,6 @@ export default { background: #F5F5F7; } .screen2 .wrapper1680 { - height: 565rem; box-sizing: border-box; background: #FFFFFF; border-radius: 10rem 10rem 10rem 10rem; @@ -490,7 +762,6 @@ export default { background: #F5F5F7; } .screen3 .wrapper1680 { - height: 830rem; background: #FFFFFF; border-radius: 10rem 10rem 10rem 10rem; } @@ -561,8 +832,13 @@ export default { /deep/.el-upload-list__item-status-label { right: 5rem; } +/deep/.el-upload__tip { + font-size: 12rem; + color: #606266; + margin-top: 7rem; +} .formContent { - padding: 20rem 0rem; + padding: 20rem 0rem 0rem; } .formBarContent { padding: 0rem 30rem; @@ -597,4 +873,22 @@ export default { text-transform: none; padding: 12rem 20rem; } +.upload-file-uploader { + margin-bottom: 5rem; +} +.upload-file-list .el-upload-list__item { + border: 1rem solid #e4e7ed; + line-height: 2rem; + margin-bottom: 10rem; + position: relative; +} +.upload-file-list .ele-upload-list__item-content { + display: flex; + justify-content: space-between; + align-items: center; + color: inherit; +} +.ele-upload-list__item-content-action .el-link { + margin-right: 10rem; +}