|
@@ -0,0 +1,412 @@
|
|
|
+<template>
|
|
|
+ <div class="contrl">
|
|
|
+ <el-tabs v-model="activeName" class="condtion-tabs" @tab-change="tabChange()">
|
|
|
+ <el-tab-pane label="创建主模板" name="main">
|
|
|
+ <div>
|
|
|
+ <el-form ref="createReportTmpl" :model="tmplAssetReport" :rules="createRules" label-width="auto"
|
|
|
+ style="margin-top: 10px;">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="报告名字:" class="form-item" prop="reportName">
|
|
|
+ <el-input v-model="tmplAssetReport.reportName" clearable />
|
|
|
+ </el-form-item>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="报告类型:" class="form-item" prop="reportType">
|
|
|
+ <el-select v-model="tmplAssetReport.reportType" placeholder="选择报告类型"
|
|
|
+ @change="reportTypeChange">
|
|
|
+ <el-option v-for="item in reportType" :key="item.id"
|
|
|
+ :label="item.name" :value="item.name" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="是否有段落模板:" class="form-item" prop="hasSection">
|
|
|
+ <el-radio-group v-model="tmplAssetReport.hasSection">
|
|
|
+ <el-radio value="true">有</el-radio>
|
|
|
+ <el-radio value="false">无</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="模板CODE:" class="form-item" prop="tmplCode">
|
|
|
+ <el-select v-model="tmplAssetReport.tmplCode" placeholder="选择模板CODE">
|
|
|
+ <el-option v-for="item in tmplCodes" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="模板文件名字:" class="form-item" prop="fileName">
|
|
|
+ <el-input v-model="tmplAssetReport.fileName" clearable disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="模板文件存储位置:" class="form-item" prop="fileUrl">
|
|
|
+ <el-input v-model="tmplAssetReport.fileUrl" clearable disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-upload drag action="#" multiple style="width:50%;margin-left:25%;" accept=".doc,.docx"
|
|
|
+ :limit="1" :http-request="handleUpload" :file-list="fileList" :on-exceed="handleExceed"
|
|
|
+ :before-remove="beforeRemove">
|
|
|
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 拖拽文件 <em>或点击上传</em>
|
|
|
+ </div>
|
|
|
+ <template #tip>
|
|
|
+ <div class="el-upload__tip">
|
|
|
+ 文件大小限制在100MB及以下
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-button type="primary" style="float:right;"
|
|
|
+ @click="createReportTmpl()">创建模板</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="创建段落模板" name="section">
|
|
|
+ <div>
|
|
|
+ <el-form ref="createReportSectionTmpl" :model="tmplAssetReportSection" :rules="createSectionRules"
|
|
|
+ label-width="auto" style="margin-top: 10px;">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="段落模板名称:" class="form-item" prop="sectionName">
|
|
|
+ <el-input v-model="tmplAssetReportSection.sectionName" clearable />
|
|
|
+ </el-form-item>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="主模板id:" class="form-item" prop="tmplCode">
|
|
|
+ <el-select v-model="tmplAssetReportSection.templateReportId"
|
|
|
+ placeholder="选择主模板">
|
|
|
+ <el-option v-for="item in reportDropDownBoxData" :key="item.id"
|
|
|
+ :label="item.name" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="报告类型:" class="form-item" prop="reportType">
|
|
|
+ <el-select v-model="tmplAssetReportSection.reportType"
|
|
|
+ placeholder="选择报告类型" @change="reportTypeChange">
|
|
|
+ <el-option v-for="item in reportType" :key="item.id"
|
|
|
+ :label="item.name" :value="item.name" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="模板CODE:" class="form-item" prop="tmplCode">
|
|
|
+ <el-select v-model="tmplAssetReportSection.tmplCode" placeholder="选择模板CODE">
|
|
|
+ <el-option v-for="item in tmplCodes" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="模板文件名字:" class="form-item" prop="sectionFileName">
|
|
|
+ <el-input v-model="tmplAssetReportSection.sectionFileName" clearable
|
|
|
+ disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="模板文件存储位置:" class="form-item" prop="sectionFileUrl">
|
|
|
+ <el-input v-model="tmplAssetReportSection.sectionFileUrl" clearable
|
|
|
+ disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-upload drag action="#" multiple style="width:50%;margin-left:25%;" accept=".doc,.docx"
|
|
|
+ :limit="1" :http-request="handleSectionUpload" :file-list="sectionFileList"
|
|
|
+ :on-exceed="handleExceed" :before-remove="beforeRemove">
|
|
|
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 拖拽文件 <em>或点击上传</em>
|
|
|
+ </div>
|
|
|
+ <template #tip>
|
|
|
+ <div class="el-upload__tip">
|
|
|
+ 文件大小限制在100MB及以下
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-button type="primary" style="float:right;"
|
|
|
+ @click="createReportSectionTmpl()">创建模板</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+import { uploadAssetsReportTmpl } from '@/api/fileUpload'
|
|
|
+import { createTmplAssetReport, getDropDownBoxData } from '@/api/tmplAssetReport'
|
|
|
+import { getDropDownBoxDataByCode } from '@/api/dictData'
|
|
|
+import { createTmplAssetReportSection } from '@/api/tmplAssetReportSection'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'assetsCreateReportTmpl',
|
|
|
+ components: {
|
|
|
+
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeName: 'main',
|
|
|
+ reportDropDownBoxData: null,
|
|
|
+ equipmentTmplCode: [
|
|
|
+ {
|
|
|
+ value: 'MAIN',
|
|
|
+ label: '设备融资项目报告-框架-主模板',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'COVER',
|
|
|
+ label: '设备融资项目报告-封面-段落模板',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'CATALOGUE',
|
|
|
+ label: '设备融资项目报告-目录-段落模板',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'DETAIL',
|
|
|
+ label: '设备融资项目报告-正文-段落模板',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'CONSIGNOR',
|
|
|
+ label: '设备融资项目报告-委托人概况-段落模板',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'PROPERTY_OWNER',
|
|
|
+ label: '设备融资项目报告-产权持有人概况-段落模板',
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ tmplCodes: null,
|
|
|
+ reportType: [],
|
|
|
+ tmplAssetReport: {
|
|
|
+
|
|
|
+ },
|
|
|
+ fileList: [],
|
|
|
+ createRules: {
|
|
|
+ reportName: [
|
|
|
+ { required: true, message: '请输入报告名字', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ reportType: [
|
|
|
+ { required: true, message: '请选择报告类型', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ hasSection: [
|
|
|
+ { required: true, message: '是否有段落模板', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ tmplCode: [
|
|
|
+ { required: true, message: '请选择模板CODE', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ fileName: [
|
|
|
+ { required: true, message: '请上传模板文件', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ fileUrl: [
|
|
|
+ { required: true, message: '请上传模板文件', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tmplAssetReportSection: {
|
|
|
+
|
|
|
+ },
|
|
|
+ createSectionRules: {
|
|
|
+ sectionName: [
|
|
|
+ { required: true, message: '请输入段落模板名称', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ templateReportId: [
|
|
|
+ { required: true, message: '请选择主模板', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ reportType: [
|
|
|
+ { required: true, message: '请选择报告类型', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ tmplCode: [
|
|
|
+ { required: true, message: '请选择模板CODE', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ sectionFileName: [
|
|
|
+ { required: true, message: '请上传模板文件', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ sectionFileUrl: [
|
|
|
+ { required: true, message: '请上传模板文件', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ sectionFileList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getDictDropDownBoxDataByCode();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ tabChange() {
|
|
|
+ if (this.activeName === "section") {
|
|
|
+ this.getDropDownBoxData();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 根据code获取字典数据
|
|
|
+ getDictDropDownBoxDataByCode(){
|
|
|
+ getDropDownBoxDataByCode('ASSET_REPORT_TMPL_TYPE').then(res => {
|
|
|
+ this.reportType = res.data;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDropDownBoxData() {
|
|
|
+ getDropDownBoxData().then(res => {
|
|
|
+ this.reportDropDownBoxData = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 上传文件
|
|
|
+ handleUpload(item) {
|
|
|
+ let fileData = new FormData();
|
|
|
+ fileData.append("multipartFile", item.file)
|
|
|
+ uploadAssetsReportTmpl(fileData).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.tmplAssetReport.fileName = res.data.fileName;
|
|
|
+ this.tmplAssetReport.fileUrl = res.data.filePath;
|
|
|
+ } else {
|
|
|
+ this.fileList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 文件上传数量限制
|
|
|
+ handleExceed() {
|
|
|
+ ElMessage({
|
|
|
+ showClose: true,
|
|
|
+ message: "最多选择一个文件!",
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 移除文件
|
|
|
+ beforeRemove(file, fileList) {
|
|
|
+ fileList = fileList.filter((o) => {
|
|
|
+ return o.name !== file.name
|
|
|
+ });
|
|
|
+ this.tmplAssetReport.fileName = null;
|
|
|
+ this.tmplAssetReport.fileUrl = null;
|
|
|
+ },
|
|
|
+ reportTypeChange() {
|
|
|
+ if (this.tmplAssetReport.reportType == "机器设备" || this.tmplAssetReportSection.reportType == "机器设备") {
|
|
|
+ this.tmplCodes = this.equipmentTmplCode;
|
|
|
+ }
|
|
|
+ if (this.tmplAssetReport.reportType == "债权" || this.tmplAssetReportSection.reportType == "债权") {
|
|
|
+ this.tmplCodes = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 创建报告模板
|
|
|
+ createReportTmpl() {
|
|
|
+ this.$refs.createReportTmpl.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ createTmplAssetReport(this.tmplAssetReport).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$refs.createReportTmpl.resetFields();
|
|
|
+ this.tmplCodes = null;
|
|
|
+ this.fileList = [];
|
|
|
+ ElMessage({
|
|
|
+ showClose: true,
|
|
|
+ message: res.message,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 上传文件
|
|
|
+ handleSectionUpload(item) {
|
|
|
+ let fileData = new FormData();
|
|
|
+ fileData.append("multipartFile", item.file)
|
|
|
+ uploadAssetsReportTmpl(fileData).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.tmplAssetReportSection.sectionFileName = res.data.fileName;
|
|
|
+ this.tmplAssetReportSection.sectionFileUrl = res.data.filePath;
|
|
|
+ } else {
|
|
|
+ this.sectionFileList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 文件上传数量限制
|
|
|
+ handleSectionExceed() {
|
|
|
+ ElMessage({
|
|
|
+ showClose: true,
|
|
|
+ message: "最多选择一个文件!",
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 移除文件
|
|
|
+ beforeSectionRemove(file, fileList) {
|
|
|
+ fileList = fileList.filter((o) => {
|
|
|
+ return o.name !== file.name
|
|
|
+ });
|
|
|
+ this.tmplAssetReport.fileName = null;
|
|
|
+ this.tmplAssetReport.fileUrl = null;
|
|
|
+ },
|
|
|
+ // 创建报告段落模板
|
|
|
+ createReportSectionTmpl() {
|
|
|
+ this.$refs.createReportSectionTmpl.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ createTmplAssetReportSection(this.tmplAssetReportSection).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$refs.createReportSectionTmpl.resetFields();
|
|
|
+ this.tmplCodes = null;
|
|
|
+ this.sectionFileList = [];
|
|
|
+ ElMessage({
|
|
|
+ showClose: true,
|
|
|
+ message: res.message,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.contrl {
|
|
|
+ font-size: 20px;
|
|
|
+ width: 70.9%;
|
|
|
+ border-right: 1.5px #dae1eb solid;
|
|
|
+ padding: 20px 20px 20px 0px;
|
|
|
+ float: left;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(*) {
|
|
|
+ color-scheme: light;
|
|
|
+ --el-color-primary: #ff6154;
|
|
|
+ --el-color-primary-light-3: #ff7154;
|
|
|
+ --el-color-primary-light-5: #ff8154;
|
|
|
+ --el-color-primary-light-7: #ff9154;
|
|
|
+ --el-color-primary-light-8: #ffa999;
|
|
|
+ --el-color-primary-light-9: #ffa854;
|
|
|
+ --el-color-primary-dark-2: #ff8154;
|
|
|
+}
|
|
|
+</style>
|