浏览代码

1.解决alias不提示的问题
2.测算表段落模板上传

GouGengquan 8 月之前
父节点
当前提交
7f4722a8fb

+ 9 - 3
jsconfig.json

@@ -1,8 +1,14 @@
 {
   "compilerOptions": {
+    "baseUrl": "./",
     "paths": {
-      "@/*": ["./src/*"]
+      "@/*": [
+        "src/*"
+      ]
     }
   },
-  "exclude": ["node_modules", "dist"]
-}
+  "exclude": [
+    "node_modules",
+    "dist"
+  ]
+}

+ 11 - 0
src/api/tmplAssetCalculate.js

@@ -0,0 +1,11 @@
+import request from '@/utils/request'
+
+// 创建资产测算表模板
+export function createTmplAssetCalculate(params) {
+    return request.post('/tmplAssetCalculate/save',params)
+}
+
+// 获取资产测算表的下拉框数据
+export function getDropDownBoxData() {
+    return request.get('/tmplAssetCalculate/getDropDownBoxData')
+}

+ 6 - 0
src/api/tmplAssetCalculateSection.js

@@ -0,0 +1,6 @@
+import request from '@/utils/request'
+
+// 创建资产测算表段落模板
+export function createTmplAssetCalculateSection(params) {
+    return request.post('/tmplAssetCalculateSection/save',params);
+}

+ 0 - 6
src/api/tmplAssetsCalculate.js

@@ -1,6 +0,0 @@
-import request from '@/utils/request'
-
-// 创建资产测算表模板
-export function createTmplAssetsCalculate(params) {
-    return request.post('/tmplAssetCalculate/save',params)
-}

+ 242 - 69
src/views/assets/template/createCalculate.vue

@@ -1,83 +1,168 @@
 <template>
     <div class="contrl">
-        <el-divider content-position="left"><span style="color:#ff6154;">创建测算表模板</span></el-divider>
-        <div>
-            <el-form ref="createCalculateTmpl" :model="tmplAssetCalculate" :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="calculateName">
-                            <el-input v-model="tmplAssetCalculate.calculateName" clearable />
-                        </el-form-item>
+        <el-tabs v-model="activeName" class="condtion-tabs">
+            <el-tab-pane label="创建主模板" name="main">
+                <div>
+                    <el-form ref="createCalculateTmpl" :model="tmplAssetCalculate" :rules="createRules" label-width="auto"
+                        style="margin-top: 10px;">
                         <el-row :gutter="10">
-                            <el-col :span="24">
-                                <el-form-item label="测算类型:" class="form-item" prop="calculateType">
-                                    <el-select v-model="tmplAssetCalculate.calculateType" placeholder="选择测算类型"
-                                        @change="calculateTypeChange">
-                                        <el-option v-for="item in calculateType" :key="item.value" :label="item.label"
-                                            :value="item.value" />
-                                    </el-select>
+                            <el-col :span="12">
+                                <el-form-item label="测算表名字:" class="form-item" prop="calculateName">
+                                    <el-input v-model="tmplAssetCalculate.calculateName" clearable />
                                 </el-form-item>
+                                <el-row :gutter="10">
+                                    <el-col :span="24">
+                                        <el-form-item label="测算类型:" class="form-item" prop="calculateType">
+                                            <el-select v-model="tmplAssetCalculate.calculateType" placeholder="选择测算类型"
+                                                @change="calculateTypeChange">
+                                                <el-option v-for="item in calculateType" :key="item.value"
+                                                    :label="item.label" :value="item.value" />
+                                            </el-select>
+                                        </el-form-item>
+                                    </el-col>
+                                </el-row>
+                                <el-row :gutter="10" v-if="tmplAssetCalculate.tmplType === 'true'">
+                                    <el-col :span="24">
+                                        <el-form-item label="是否有段落模板:" class="form-item" prop="hasSection">
+                                            <el-radio-group v-model="tmplAssetCalculate.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="tmplAssetCalculate.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="tmplAssetCalculate.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="tmplAssetCalculate.fileUrl" clearable disabled />
+                                        </el-form-item>
+                                    </el-col>
+                                </el-row>
                             </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="tmplAssetCalculate.hasSection">
-                                        <el-radio value="true">有</el-radio>
-                                        <el-radio value="false">无</el-radio>
-                                    </el-radio-group>
-                                </el-form-item>
+                            <el-col :span="12">
+                                <el-upload drag action="#" multiple style="width:50%;margin-left:25%;" accept=".xls,.xlsx"
+                                    :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="24">
-                                <el-form-item label="模板CODE:" class="form-item" prop="tmplCode">
-                                    <el-select v-model="tmplAssetCalculate.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 :span="12">
+                                <el-button type="primary" style="float:right;"
+                                    @click="createCalculateTmpl()">创建模板</el-button>
                             </el-col>
                         </el-row>
+                    </el-form>
+                </div>
+            </el-tab-pane>
+            <el-tab-pane label="创建段落模板" name="section">
+                <div>
+                    <el-form ref="createCalculateSectionTmpl" :model="tmplAssetCalculateSection" :rules="createSectionRules" label-width="auto"
+                        style="margin-top: 10px;">
                         <el-row :gutter="10">
-                            <el-col :span="24">
-                                <el-form-item label="模板文件名字:" class="form-item" prop="fileName">
-                                    <el-input v-model="tmplAssetCalculate.fileName" clearable disabled />
+                            <el-col :span="12">
+                                <el-form-item label="段落模板名称:" class="form-item" prop="sectionName">
+                                    <el-input v-model="tmplAssetCalculateSection.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="tmplAssetCalculateSection.templateReportId" placeholder="选择主模板">
+                                                <el-option v-for="item in calculateDropDownBoxData" :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="calculateType">
+                                            <el-select v-model="tmplAssetCalculateSection.calculateType" placeholder="选择测算类型"
+                                                @change="calculateTypeChange">
+                                                <el-option v-for="item in calculateType" :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="模板CODE:" class="form-item" prop="tmplCode">
+                                            <el-select v-model="tmplAssetCalculateSection.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="tmplAssetCalculateSection.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="tmplAssetCalculateSection.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=".xls,.xlsx"
+                                    :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="24">
-                                <el-form-item label="模板文件存储位置:" class="form-item" prop="fileUrl">
-                                    <el-input v-model="tmplAssetCalculate.fileUrl" clearable disabled />
-                                </el-form-item>
+                            <el-col :span="12">
+                                <el-button type="primary" style="float:right;"
+                                    @click="createCalculateSectionTmpl()">创建模板</el-button>
                             </el-col>
                         </el-row>
-                    </el-col>
-                    <el-col :span="12">
-                        <el-upload drag action="#" multiple style="width:50%;margin-left:25%;" accept=".xls,.xlsx"
-                            :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="createCalculateTmpl()">创建模板</el-button>
-                    </el-col>
-                </el-row>
-            </el-form>
-        </div>
+                    </el-form>
+                </div>
+            </el-tab-pane>
+        </el-tabs>
+
 
     </div>
 </template>
@@ -85,7 +170,8 @@
 <script>
 
 import { uploadAssetsCalculateTmpl } from '@/api/fileUpload'
-import { createTmplAssetsCalculate } from '@/api/tmplAssetsCalculate'
+import { getDropDownBoxData,createTmplAssetCalculate } from '@/api/tmplAssetCalculate'
+import { createTmplAssetCalculateSection } from '@/api/tmplAssetCalculateSection'
 
 export default {
     name: 'assetsCreateCalculateTmpl',
@@ -94,6 +180,8 @@ export default {
     },
     data() {
         return {
+            activeName: 'main',
+            calculateDropDownBoxData: null,
             equipmentTmplCode: [
                 {
                     value: 'MAIN',
@@ -162,10 +250,42 @@ export default {
                 fileUrl: [
                     { required: true, message: '请上传模板文件', trigger: 'blur' }
                 ]
-            }
+            },
+            tmplAssetCalculateSection: {
+                
+            },
+            createSectionRules: {
+                sectionName: [
+                    { required: true, message: '请输入段落模板名称', trigger: 'blur' }
+                ],
+                templateReportId: [
+                    { required: true, message: '请选择主模板', trigger: 'change' }
+                ],
+                calculateType: [
+                    { 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.getDropDownBoxData();
+    },
     methods: {
+        getDropDownBoxData(){
+            getDropDownBoxData().then(res => {
+                this.calculateDropDownBoxData = res.data
+            })
+        },
         // 上传文件
         handleUpload(item) {
             let fileData = new FormData();
@@ -196,10 +316,10 @@ export default {
             this.tmplAssetCalculate.fileUrl = null;
         },
         calculateTypeChange() {
-            if (this.tmplAssetCalculate.calculateType == "机器设备") {
+            if (this.tmplAssetCalculate.calculateType == "机器设备" || this.tmplAssetCalculateSection.calculateType == "机器设备") {
                 this.tmplCodes = this.equipmentTmplCode;
             }
-            if (this.tmplAssetCalculate.calculateType == "债权") {
+            if (this.tmplAssetCalculate.calculateType == "债权" || this.tmplAssetCalculateSection.calculateType == "债权") {
                 this.tmplCodes = null;
             }
         },
@@ -207,14 +327,16 @@ export default {
         createCalculateTmpl() {
             this.$refs.createCalculateTmpl.validate((valid) => {
                 if (valid) {
-                    createTmplAssetsCalculate(this.tmplAssetCalculate).then(res => {
+                    createTmplAssetCalculate(this.tmplAssetCalculate).then(res => {
                         if (res.code == 200) {
                             this.$refs.createCalculateTmpl.resetFields();
+                            this.fileList = [];
                             ElMessage({
                                 showClose: true,
                                 message: res.message,
                                 type: 'success',
-                                onClose: ()=>{
+                                onClose: () => {
+                                    // 跳转到模板列表页面
                                     this.$router.push('/home/assets/template/mange')
                                 }
                             })
@@ -223,6 +345,57 @@ export default {
                 }
             });
         },
+        // 上传文件
+        handleSectionUpload(item) {
+            let fileData = new FormData();
+            fileData.append("multipartFile", item.file)
+            uploadAssetsCalculateTmpl(fileData).then(res => {
+                if (res.code == 200) {
+                    this.tmplAssetCalculateSection.sectionFileName = res.data.fileName;
+                    this.tmplAssetCalculateSection.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.tmplAssetCalculate.fileName = null;
+            this.tmplAssetCalculate.fileUrl = null;
+        },
+        // 创建测算表段落模板
+        createCalculateSectionTmpl() {
+            this.$refs.createCalculateSectionTmpl.validate((valid) => {
+                if (valid) {
+                    createTmplAssetCalculateSection(this.tmplAssetCalculateSection).then(res => {
+                        if (res.code == 200) {
+                            this.$refs.createCalculateSectionTmpl.resetFields();
+                            this.fileList = [];
+                            ElMessage({
+                                showClose: true,
+                                message: res.message,
+                                type: 'success',
+                                onClose: () => {
+                                    // 跳转到模板列表页面
+                                    this.$router.push('/home/assets/template/mange')
+                                }
+                            })
+                        }
+                    })
+                }
+            });
+        }
     }
 }
 </script>

+ 64 - 7
src/views/assets/template/mange.vue

@@ -2,7 +2,7 @@
   <div class="contrl">
     <div style="width: 95%;">
       <div class="title-div">
-        <p>{{ folderName }}</p>
+        <p>模板管理</p>
       </div>
       <div class="createNew-div">
         <img src="../../../assets/icons/word.png" style="width: 32px; height: 32px; float: left;margin-top: 22px;" />
@@ -15,9 +15,53 @@
         <img src="../../../assets/icons/plus.png" style="width: 32px; height: 32px;float: right;margin-top: 22px;" />
       </div>
     </div>
-    <div class="example-list report-div">
-      
-    </div>
+    <el-tabs v-model="activeName" class="condtion-tabs">
+      <el-tab-pane label="测算表模板" name="calculate">
+        <div class="example-list report-div">
+          <el-card class="report-item no-border" shadow="never">
+            <div class="report-icon">
+              <img src="../../../assets/icons/excel.png" style="width: 52px; height: 52px;" />
+            </div>
+            <div class="report-text">
+              <span class="report-text-type">测试创建模板202411080937 </span><br />
+              <span> 文件名: </span>
+              <span class="report-text-name">c4f51695-4a88-4ba5-b307-0955b1cf2d95_TEST03.xlsx
+              </span><br />
+              <span> 存储位置: </span>
+              <span class="report-text-name">assets\templates\calculate\
+              </span><br />
+              <div style="margin-top: 5px;">
+                <span>
+                  <el-tag style="margin-left: 5px;">
+                    机器设备
+                  </el-tag>
+                </span>
+                <span style="float: right; color:darkgrey">
+                  2024-10-16 12:10:09
+                </span>
+              </div>
+            </div>
+            <div class="report-button" style="margin-left: 20px;">
+              <el-icon>
+                <Delete />
+              </el-icon>
+            </div>
+            <div class="report-button">
+              <el-icon>
+                <View />
+              </el-icon>
+            </div>
+          </el-card>
+        </div>
+        <el-pagination background layout="prev, pager, next" style="--el-color-primary: #ff6154" :page-count="100"
+          :page-sizes="[10, 20, 30, 40, 50, 100]" />
+      </el-tab-pane>
+      <el-tab-pane label="报告模板" name="report">
+        <div class="example-list report-div">
+
+        </div>
+      </el-tab-pane>
+    </el-tabs>
   </div>
 </template>
 
@@ -27,12 +71,13 @@ export default {
   data() {
     return {
       msg: 0,
-      folderName: null
+      folderName: null,
+      activeName: 'calculate'
     }
   },
 
   created() {
-    
+
   },
   methods: {
     goCreateCalculateTmpl() {
@@ -67,8 +112,20 @@ export default {
 
 }
 
+.condtion-tabs {
+  margin-top: 80px;
+}
+
+.title-div {
+  height: 80px;
+  line-height: 80px;
+  width: 200px;
+  float: left;
+  font-size: 20px;
+  font-weight: 900;
+}
+
 .report-div {
-  margin-top: 100px;
   min-height: 600px;
 }