Forráskód Böngészése

1.优化机器设备批量赋值
2.新增上传债权测算表相关页面

GouGengquan 5 hónapja
szülő
commit
43881ca2ea

+ 5 - 0
src/api/assetsCalculateCRData.js

@@ -0,0 +1,5 @@
+import request from '@/utils/request'
+
+export function uploadCalculate(params) {
+    return request.post('/assetsCalculateCRData/uploadCalculate', params)
+}

+ 5 - 0
src/api/eqptPPI.js

@@ -5,6 +5,11 @@ export function getPPIDownData() {
     return request.get('/eqptPPI/getPPIDownData');
 }
 
+// 根据类型获取ppi
+export function getPPIByType(params) {
+    return request.get(`/eqptPPI/getPPIByType/${params}`);
+}
+
 // 根据ppi名和类型获取ppi
 export function getPPIByNameType(params) {
     return request.get('/eqptPPI/getPPIByNameType', {params: params});

+ 0 - 4
src/api/fileUpload.js

@@ -15,10 +15,6 @@ export function uploadAssetsReportTmpl(params) {
     return request.post('/file/assets/uploadReportTmpl',params)
 }
 
-export function uploadAssetsCRCalculate(params) {
-    return request.post('/file/assets/uploadCRCalculate',params)
-}
-
 export function updateHouseGuarntyTargetTable(params) {
     return request.post('/file/house/guaranty/target',params)
 }

+ 9 - 0
src/router/index.js

@@ -30,6 +30,7 @@ import AssetsEqptReportEqptBaseInfo from '@/views/assets/workbench/eqpt/report/e
 // 资产债权
 import AssetsCRCalculateWorkbench from '@/views/assets/workbench/cr/calculate/index.vue'
 import AssetsCRCalculateBaseInfo from '@/views/assets/workbench/cr/calculate/baseInfo.vue'
+import AssetsCRCalculateUploadCalculate from '@/views/assets/workbench/cr/calculate/uploadCalculate.vue'
 
 const routes = [
   {
@@ -288,6 +289,14 @@ const routes = [
                 meta: {
                   title: '测算表基本信息'
                 },
+              },
+              {
+                path: 'uploadCalculate',
+                component: AssetsCRCalculateUploadCalculate,
+                name: 'assetsCRCalculateUploadCalculate',
+                meta: {
+                  title: '上传测算表'
+                },
               }
             ]
           }

+ 13 - 3
src/views/assets/folder/child.vue

@@ -104,7 +104,7 @@ export default {
       if (this.projectStore.projectInfo.projectTypeName === '机器设备') {
         this.$router.push({ path: '/home/assets/workbench/eqpt/calculate/baseInfo', query: { projectId: this.projectInfo.projectId } })
       } else if (this.projectStore.projectInfo.projectTypeName === '债权') {
-        console.log('跳转债权')
+        this.$router.push('/home/assets/workbench/cr/calculate/baseInfo')
       }
     },
     createNewReport() {
@@ -128,7 +128,12 @@ export default {
               this.$router.push('/home/assets/workbench/eqpt/calculate/eqptBaseInfo')
             }
           } else if (this.projectStore.projectInfo.projectTypeName === '债权') {
-            this.$router.push('/home/assets/workbench/cr/calculate/baseInfo')
+            // 根据不同进度跳转到不同步骤页面
+            if (res.data.progress === 'IMPORT' || res.data.progress === 'GENERATE' || res.data.progress === 'FINISHED') {
+              this.$router.push('/home/assets/workbench/cr/calculate/uploadCalculate')
+            } else if (res.data.progress === 'BASE') {
+              this.$router.push('/home/assets/workbench/cr/calculate/baseInfo')
+            }
           }
           this.projectStore.setCalculateProgress(res.data)
         } else {
@@ -165,7 +170,12 @@ export default {
           this.$router.push('/home/assets/workbench/eqpt/calculate/eqptBaseInfo')
         }
       } else if (this.projectStore.projectInfo.projectTypeName === '债权') {
-        console.log('跳转债权')
+        // 根据不同进度跳转到不同步骤页面
+        if (item.progress === 'IMPORT' || item.progress === 'GENERATE' || item.progress === 'FINISHED') {
+          this.$router.push('/home/assets/workbench/cr/calculate/uploadCalculate')
+        } else if (item.progress === 'BASE') {
+          this.$router.push('/home/assets/workbench/cr/calculate/baseInfo')
+        }
       }
     },
     // 前往报告详情

+ 12 - 73
src/views/assets/workbench/cr/calculate/baseInfo.vue

@@ -18,38 +18,7 @@
           </el-form-item>
         </el-col>
       </el-row>
-      <el-row :gutter="10">
-        <el-col :span="12">
-          <el-form-item label="上传测算表:" class="form-item" prop="calculateFile">
-            <el-upload
-              ref="uploadCRCalculateExcel"
-              drag
-              action="#"
-              multiple
-              style="width:100%;"
-              accept=".xls, .xlsx"
-              :limit="1"
-              :file-list="fileList"
-              :on-exceed="handleExceed"
-              :before-remove="beforeRemove"
-              :auto-upload="true"
-              :http-request="uploadCRCalculateExcel"
-            >
-              <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-form-item>
-        </el-col>
-      </el-row>
-      <el-button plain type="danger" style="float: right;" @click="createCalculate()">完成</el-button>
+      <el-button plain type="danger" style="float: right;" @click="createCalculate()">下一步</el-button>
     </el-form>
   </div>
 </template>
@@ -58,21 +27,14 @@
 import { mapStores } from 'pinia'
 import { assetsProjectInfo } from '@/stores/assetsProjectStore'
 import { createAssetsCalculate, getUnFinishedCalculateProgress } from '@/api/assetsCalculate'
-import { uploadAssetsCRCalculate } from '@/api/fileUpload'
 import documentProduction from '@/api/documentProduction'
 export default {
   data() {
-    var calculateFile = (rule, value, callback) => {
-      if (this.fileList < 1) {
-        return callback(new Error('请上传债权测算表'))
-      }
-    }
     return {
       baseInfo: {},
       baseInfoRules: {
         calculateName: [{ required: true, message: '请输入测算表名', trigger: 'blur' }],
         valuationBasisDate: [{ required: true, message: '请选择评估基准日', trigger: 'blur' }],
-        calculateFile: [{ required: true, validator: calculateFile, trigger: 'change' }],
       },
       fileList: [],
     }
@@ -97,43 +59,11 @@ export default {
         }
       })
     },
-    // 文件上传数量限制
-    handleExceed() {
-      ElMessage({
-        showClose: true,
-        message: '最多选择一个文件!',
-        type: 'error',
-      })
-    },
-    // 移除文件
-    beforeRemove(file, fileList) {
-      fileList = fileList.filter((o) => {
-        return o.name !== file.name
-      })
-      this.fileList = []
-      this.tmplAssetCalculate.fileName = null
-      this.tmplAssetCalculate.fileUrl = null
-    },
-    // 上传债权测算表
-    uploadCRCalculateExcel(item) {
-      let crCalculateExcel = new FormData()
-      crCalculateExcel.append('multipartFile', item.file)
-      uploadAssetsCRCalculate(crCalculateExcel).then((res) => {
-        if (res.code == 200) {
-          ElMessage({
-            showClose: true,
-            message: res.message,
-            type: 'success',
-          })
-        }
-      })
-    },
     // 创建测算表,填写测算表基础信息
     createCalculate() {
       this.$refs.baseInfo.validate((valid) => {
         if (valid) {
-          // 债权目前没有在线测算的需求,直接完成进度
-          this.baseInfo.progress = 'FINISHED'
+          this.baseInfo.progress = 'BASE'
           this.baseInfo.projectId = this.projectStore.projectInfo.id
           createAssetsCalculate(this.baseInfo).then((res) => {
             if (res.code == 200) {
@@ -142,12 +72,21 @@ export default {
                 message: res.message,
                 type: 'success',
               })
-              this.$router.push('/home/assets/workbench/calculate/eqptBaseInfo')
+              this.getCalculateProgress()
+              this.$router.push('/home/assets/workbench/cr/calculate/uploadCalculate')
             }
           })
         }
       })
     },
+    // 获取未完成测算表的进度信息并保存到缓存
+    getCalculateProgress() {
+      getUnFinishedCalculateProgress(this.projectStore.projectInfo.id).then((res) => {
+        if (res.data) {
+          this.projectStore.setCalculateProgress(res.data)
+        }
+      })
+    },
   },
 }
 </script>

+ 3 - 24
src/views/assets/workbench/cr/calculate/components/timeline.vue

@@ -5,39 +5,18 @@
         :timestamp="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'BASE' || projectStore.calculateProgress.progress === 'IMPORT' || projectStore.calculateProgress.progress === 'GENERATE' || projectStore.calculateProgress.progress === 'FINISHED') ? '已完成' : '未完成'"
         placement="top"
         :color="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'BASE' || projectStore.calculateProgress.progress === 'IMPORT' || projectStore.calculateProgress.progress === 'GENERATE' || projectStore.calculateProgress.progress === 'FINISHED') ? '#ff6154' : '#dae1eb'"
-        @click="goBench('/home/assets/workbench/eqpt/calculate/baseInfo', ['BASE', 'IMPORT', 'GENERATE', 'FINISHED'])">
+        @click="goBench('/home/assets/workbench/cr/calculate/baseInfo', ['BASE', 'IMPORT', 'GENERATE', 'FINISHED'])">
         <el-card shadow="never" class="timeline-card report-item">
           <h4>创建测算表</h4>
-          <!-- <p>更新时间: 2018/4/12 20:46</p> -->
         </el-card>
       </el-timeline-item>
       <el-timeline-item
         :timestamp="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'IMPORT' || projectStore.calculateProgress.progress === 'GENERATE' || projectStore.calculateProgress.progress === 'FINISHED') ? '已完成' : '未完成'"
         placement="top"
         :color="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'IMPORT' || projectStore.calculateProgress.progress === 'GENERATE' || projectStore.calculateProgress.progress === 'FINISHED') ? '#ff6154' : '#dae1eb'"
-        @click="goBench('/home/assets/workbench/eqpt/calculate/eqptBaseInfo', ['BASE', 'IMPORT', 'GENERATE', 'FINISHED'])">
+        @click="goBench('/home/assets/workbench/cr/calculate/uploadCalculate', ['BASE', 'IMPORT', 'GENERATE', 'FINISHED'])">
         <el-card shadow="never" class="timeline-card report-item">
-          <h4>填写基本信息</h4>
-          <!-- <p>更新时间: 2018/4/12 20:46</p> -->
-        </el-card>
-      </el-timeline-item>
-      <el-timeline-item
-        :timestamp="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'GENERATE' || projectStore.calculateProgress.progress === 'FINISHED') ? '已完成' : '未完成'"
-        placement="top"
-        :color="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'GENERATE' || projectStore.calculateProgress.progress === 'FINISHED') ? '#ff6154' : '#dae1eb'"
-        @click="goBench('/home/assets/workbench/eqpt/calculate/importInfo', ['IMPORT', 'GENERATE', 'FINISHED'])">
-        <el-card shadow="never" class="timeline-card report-item">
-          <h4>测算</h4>
-          <!-- <p>更新时间: 2018/4/12 20:46</p> -->
-        </el-card>
-      </el-timeline-item>
-      <el-timeline-item
-        :timestamp="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'FINISHED') ? '已完成' : '未完成'"
-        placement="top"
-        :color="projectStore.calculateProgress && (projectStore.calculateProgress.progress === 'FINISHED') ? '#ff6154' : '#dae1eb'">
-        <el-card shadow="never" class="timeline-card report-item">
-          <h4>生成测算表</h4>
-          <!-- <p>更新时间: 2018/4/12 20:46</p> -->
+          <h4>上传测算表</h4>
         </el-card>
       </el-timeline-item>
     </el-timeline>

+ 1 - 1
src/views/assets/workbench/cr/calculate/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <Bench></Bench>
-    <!-- <Timeline :baseInfo="true"></Timeline> -->
+    <Timeline :baseInfo="true"></Timeline>
   </div>
 </template>
   

+ 105 - 0
src/views/assets/workbench/cr/calculate/uploadCalculate.vue

@@ -0,0 +1,105 @@
+<template>
+  <div id="contrl" class="contrl">
+    <el-upload
+      ref="uploadCalculate"
+      drag
+      action="#"
+      multiple
+      style="width:50%;"
+      accept=".xls, .xlsx"
+      :limit="1"
+      :file-list="fileList"
+      :on-exceed="handleExceed"
+      :before-remove="beforeRemove"
+      :auto-upload="true"
+      :http-request="uploadCalculate"
+    >
+      <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>
+  </div>
+</template>
+
+<script>
+import { mapStores } from 'pinia'
+import { assetsProjectInfo } from '@/stores/assetsProjectStore'
+import { createAssetsCalculate, getUnFinishedCalculateProgress } from '@/api/assetsCalculate'
+import { uploadCalculate } from '@/api/assetsCalculateCRData'
+export default {
+  data() {
+    return {
+      fileList: [],
+    }
+  },
+  computed: {
+    ...mapStores(assetsProjectInfo),
+  },
+  created() {
+    
+  },
+  methods: {
+    // 获取未完成测算表的进度信息并保存到缓存
+    getCalculateProgress() {
+      getUnFinishedCalculateProgress(this.projectStore.projectInfo.id).then((res) => {
+        if (res.data) {
+          this.projectStore.setCalculateProgress(res.data)
+        }
+      })
+    },
+    // 文件上传数量限制
+    handleExceed() {
+      ElMessage({
+        showClose: true,
+        message: '最多选择一个文件!',
+        type: 'error',
+      })
+    },
+    // 移除文件
+    beforeRemove(file, fileList) {
+      fileList = fileList.filter((o) => {
+        return o.name !== file.name
+      })
+      this.fileList = []
+      this.tmplAssetCalculate.fileName = null
+      this.tmplAssetCalculate.fileUrl = null
+    },
+    // 上传债权测算表
+    uploadCalculate(item) {
+      let crCalculateExcel = new FormData()
+      crCalculateExcel.append('calculateId', this.projectStore.calculateProgress.id)
+      crCalculateExcel.append('multipartFile', item.file)
+      uploadCalculate(crCalculateExcel).then((res) => {
+        if (res.code == 200) {
+          ElMessage({
+            showClose: true,
+            message: res.message,
+            type: 'success',
+          })
+          this.projectStore.calculateProgress.progress = 'FINISHED'
+        }
+      })
+    }
+  },
+}
+</script>
+
+<style scoped>
+: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>

+ 21 - 14
src/views/assets/workbench/eqpt/calculate/importInfo.vue

@@ -1049,7 +1049,7 @@ import {
 } from '@/api/assetsCalculateEqptData'
 import { getDaysBetween } from '@/utils/date'
 import { eqptLifeIfrRefsList } from '@/api/eqptLifeIfrRefs'
-import { getPPIDownData, getPPIByNameType } from '@/api/eqptPPI'
+import { getPPIDownData, getPPIByNameType, getPPIByType } from '@/api/eqptPPI'
 import { eqptGnEvpList } from '@/api/eqptGnEvp'
 import { imagePasteHandler } from '@/utils/handlerPaste'
 import { uploadImage } from '@/api/fileUpload'
@@ -2046,19 +2046,26 @@ export default {
           // 批量赋值给作价方法的特殊处理
           case 'valuationMethod':
             if (value === '物价指数调整法') {
-              this.eqptPageData.forEach((item) => {
-                // 动态赋值,属性名由变量 propName 指定
-                const date = new Date(item.purchaseDate)
-                let year = date.getFullYear().toString()
-                const params = { ppiName: null, ppiType: null }
-                params.ppiName = year
-                params.ppiType = '通用设备制造业'
-                getPPIByNameType(params).then((res) => {
-                  if (res.data && res.data.ppi) {
-                    item.inquiryBasis = '(' + res.data.id + ')' + res.data.ppiName + '年:' + res.data.ppi
-                    this.countPrice(item)
+              // 获取符合条件的所有ppi指数
+              let ppis = []
+              getPPIByType('通用设备制造业').then((res) => {
+                if (res.data) {
+                  ppis = res.data
+                  // 赋值指数
+                  for (let index = 0; index < this.eqptPageData.length; index++) {
+                    const date = new Date(this.eqptPageData[index].purchaseDate)
+                    let year = date.getFullYear().toString()
+                    const ppi = ppis.find((i) => i.ppiName === year && i.id)
+                    if (ppi) {
+                      // 设置询价依据
+                      this.eqptPageData[index].inquiryBasis = '(' + ppi.id + ')' + ppi.ppiName + '年:' + ppi.ppi
+                      // 计算不含税单价(虚拟加载,不提前计算可能会undefined,理论上只有批量赋值需要提前计算)
+                      this.eqptPageData[index].unTaxedUnitPrice = (this.eqptPageData[index].taxedUnitPrice / (1 + this.eqptPageData[index].taxRate / 100)).toFixed(2)
+                      // 计算询价单价
+                      this.eqptPageData[index].price = (this.eqptPageData[index].unTaxedUnitPrice * ppi.ppi * 1.13).toFixed(2)
+                    }
                   }
-                })
+                }
               })
             }
             break
@@ -2066,7 +2073,7 @@ export default {
           case 'economicServiceLife':
           case 'remainingUsefulLife':
             this.eqptPageData.forEach((item) => {
-              this.countDepreciationRate(item);
+              this.countDepreciationRate(item)
             })
             break
         }