|
@@ -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>
|