瀏覽代碼

1.国产设备作价页面功能完善

GouGengquan 8 月之前
父節點
當前提交
25ad6f34cb

+ 5 - 0
src/api/assetsCalculateEqptData.js

@@ -8,4 +8,9 @@ export function hasImportedEquipment(params) {
 // 分页查询导入的机器设备测算数据
 export function getDataPage(params) {
     return request.get('/assetsCalculateEqptData/getDataPage', { params: params })
+}
+
+// 更新机器设备数据
+export function updateData(params) {
+    return request.put('/assetsCalculateEqptData/update', params)
 }

+ 11 - 0
src/api/eqptPPI.js

@@ -0,0 +1,11 @@
+import request from '@/utils/request'
+
+// 获取所有PPI类型
+export function getPPIDownData() {
+    return request.get('/eqptPPI/getPPIDownData');
+}
+
+// 根据ppi名和类型获取ppi
+export function getPPIByNameType(params) {
+    return request.get('/eqptPPI/getPPIByNameType', {params: params});
+}

+ 1 - 1
src/views/assets/workbench/calculate/baseInfo.vue

@@ -76,7 +76,7 @@ export default {
 <style scoped>
 .contrl {
     font-size: 20px;
-    width: 70.9%;
+    width: 75%;
     border-right: 1.5px #dae1eb solid;
     padding: 20px 20px 20px 0px;
     float: left;

+ 1 - 1
src/views/assets/workbench/calculate/eqptBaseInfo.vue

@@ -131,7 +131,7 @@ export default {
 <style scoped>
 .contrl {
     font-size: 20px;
-    width: 70.9%;
+    width: 75%;
     border-right: 1.5px #dae1eb solid;
     padding: 0px 20px 20px 0px;
     float: left;

+ 132 - 34
src/views/assets/workbench/calculate/importInfo.vue

@@ -5,9 +5,10 @@
             <el-descriptions title="基础信息" :column="1" border>
                 <el-descriptions-item label="评估基准日">{{ calculateBaseInfo.valuationBasisDate }}</el-descriptions-item>
                 <el-descriptions-item label="工期">{{ calculateBaseInfo.constructionPeriod }}</el-descriptions-item>
-                <el-descriptions-item label="利息">{{ calculateBaseInfo.interest }}</el-descriptions-item>
-                <el-descriptions-item label="前期费用率">{{ calculateBaseInfo.preConstructionCostRatio }}</el-descriptions-item>
-                <el-descriptions-item label="建设单位管理费率">{{ calculateBaseInfo.managementExpenseRatio }}</el-descriptions-item>
+                <el-descriptions-item label="利息">{{ calculateBaseInfo.interest }}%</el-descriptions-item>
+                <el-descriptions-item label="前期费用率">{{ calculateBaseInfo.preConstructionCostRatio }}%</el-descriptions-item>
+                <el-descriptions-item label="建设单位管理费率">{{ calculateBaseInfo.managementExpenseRatio
+                }}%</el-descriptions-item>
             </el-descriptions>
             <el-upload ref="importEqptExcel" drag action="#" multiple style="width:100%;margin-top: 20px;"
                 accept=".xls,.xlsx" :limit="1" :file-list="fileList" :on-exceed="handleExceed" :before-remove="beforeRemove"
@@ -128,7 +129,7 @@
                     <template #default="{ row }">
                         <el-form-item prop="originalValue">
                             <el-form :model="row" @submit.native.prevent>
-                                <el-input v-model="row.originalValue" placeholder="请输入账面原值" />
+                                <el-input v-model="row.bookOriginalValue" placeholder="请输入账面原值" />
                             </el-form>
                         </el-form-item>
                     </template>
@@ -137,25 +138,26 @@
                     <template #default="{ row }">
                         <el-form-item prop="netValue">
                             <el-form :model="row" @submit.native.prevent>
-                                <el-input v-model="row.netValue" placeholder="请输入账面净值" />
+                                <el-input v-model="row.bookNetValue" placeholder="请输入账面净值" />
                             </el-form>
                         </el-form-item>
                     </template>
                 </el-table-column>
                 <el-table-column prop="taxedUnitPrice" label="含税单价" width="150">
-                    <template #default="{ row }">
+                    <template #default="{ $index, row }">
                         <el-form-item prop="taxedUnitPrice">
                             <el-form :model="row" @submit.native.prevent>
-                                <el-input v-model="row.taxedUnitPrice" placeholder="请输入含税单价" />
+                                <el-input v-model="row.taxedUnitPrice" placeholder="请输入含税单价"
+                                    @change="countPrice(row, $index)" />
                             </el-form>
                         </el-form-item>
                     </template>
                 </el-table-column>
                 <el-table-column prop="taxRate" label="税率" width="150">
-                    <template #default="{ row }">
+                    <template #default="{ $index, row }">
                         <el-form-item prop="taxRate">
                             <el-form :model="row" @submit.native.prevent>
-                                <el-input v-model="row.taxRate" placeholder="请输入税率" />
+                                <el-input v-model="row.taxRate" placeholder="请输入税率" @change="countPrice(row, $index)" />
                             </el-form>
                         </el-form-item>
                     </template>
@@ -178,17 +180,18 @@
                 <el-table-column label="评估价值" width="300">
                     <el-table-column prop="originalValue" label="原值" width="100">
                         <template #default="{ row }">
-                            <span>{{ row.originalValue }}</span>
+                            <span>{{ row.originalValue = row.excludeTaxPrice }}</span>
                         </template>
                     </el-table-column>
                     <el-table-column prop="depreciationRate" label="成新率%" width="100">
                         <template #default="{ row }">
-                            <span>{{ row.depreciationRate }}</span>
+                            <span>{{ row.depreciationRate = row.comprehensiveDepreciationRate }}</span>
                         </template>
                     </el-table-column>
                     <el-table-column prop="netValue" label="净值" width="100">
                         <template #default="{ row }">
-                            <span>{{ row.netValue }}</span>
+                            <span>{{ row.netValue = (row.originalValue * 1 * row.comprehensiveDepreciationRate / 100)
+                            }}</span>
                         </template>
                     </el-table-column>
                 </el-table-column>
@@ -197,7 +200,8 @@
                         <template #default="{ $index, row }">
                             <el-form-item prop="economicServiceLife">
                                 <el-form :model="row" @submit.native.prevent>
-                                    <el-input v-model="row.economicServiceLife" placeholder="请输入经济使用年数" @change="countDepreciationRate(row.depreciationRateByAge, $index)"/>
+                                    <el-input v-model="row.economicServiceLife" placeholder="请输入经济使用年数"
+                                        @change="countDepreciationRate(row.depreciationRateByAge, $index)" />
                                 </el-form>
                             </el-form-item>
                         </template>
@@ -221,7 +225,7 @@
                 </el-table-column>
                 <el-table-column prop="weight01" label="权重" width="100">
                     <template #default="{ row }">
-                        <span>{{ row.weight01 }}%</span>
+                        <span>{{ row.weight01 * 100 }}%</span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="directObservationDepreciationRate" label="直接观察成新率" width="150">
@@ -235,15 +239,14 @@
                 </el-table-column>
                 <el-table-column prop="weight02" label="权重" width="100">
                     <template #default="{ row }">
-                        <span>{{ row.weight02 }}%</span>
+                        <span>{{ row.weight02 * 100 }}%</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="综合成新率" width="100">
                     <template #default="{ row }">
                         <span>{{ row.comprehensiveDepreciationRate =
                         ((row.depreciationRateByAge * row.weight01 + row.directObservationDepreciationRate *
-                            row.weight02) /
-                            100).toFixed(0) }}</span>
+                            row.weight02)).toFixed(0) }}</span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="equipmentType" label="设备类型" width="150">
@@ -261,11 +264,11 @@
                     </template>
                 </el-table-column>
                 <el-table-column prop="valuationMethod" label="作价方法" width="150">
-                    <template #default="{ row }">
+                    <template #default="{ $index, row }">
                         <el-form-item prop="valuationMethod">
                             <el-form :model="row" @submit.native.prevent>
                                 <el-select v-model="row.valuationMethod" filterable placeholder="请选择作价方法" clearable
-                                    style="width: 130px;">
+                                    style="width: 130px;" @change="setPPItoInquiryBasis(row, $index)">
                                     <el-option label="询价" value="询价"></el-option>
                                     <el-option label="物价指数调整法" value="物价指数调整法"></el-option>
                                     <el-option label="二手价" value="二手价"></el-option>
@@ -274,11 +277,30 @@
                         </el-form-item>
                     </template>
                 </el-table-column>
-                <el-table-column prop="inquiryBasis" label="询价依据" width="150">
-                    <template #default="{ row }">
+                <el-table-column prop="inquiryBasis" label="询价依据" width="300">
+                    <template #default="{ $index, row }">
                         <el-form-item prop="inquiryBasis">
                             <el-form :model="row" @submit.native.prevent>
-                                <el-input v-model="row.inquiryBasis" placeholder="询价依据" />
+                                <el-select v-if="row.valuationMethod === '物价指数调整法'" v-model="row.inquiryBasis"
+                                    placeholder="Select" style="width: 220px" filterable allow-create>
+                                    <el-option-group v-for="group in ppiOptions" :label="group.ppiType">
+                                        <el-option v-for="item in group.eqptPPI"
+                                            :label="'(' + item.id + ')' + item.ppiName + '年:' + item.ppi"
+                                            :value="'(' + item.id + ')' + item.ppiName + '年:' + item.ppi" />
+                                    </el-option-group>
+                                </el-select>
+                                <el-input v-if="row.valuationMethod !== '物价指数调整法'" v-model="row.inquiryBasis"
+                                    placeholder="询价依据" style="width: 220px;" />
+                                <el-upload v-if="row.valuationMethod !== '物价指数调整法'" v-model:file-list="imageList"
+                                    action="/pp/file/upload/image"
+                                    accept=".gif,.jpg,.jpeg,.jpg2,.png,.tif,.tiff,.bmp,.svg,.svgz,.webp" :limit="1"
+                                    :show-file-list="false" :on-success="(response, file, fileList) => {
+                                        return imageSuccess(response, file, fileList, $index);
+                                    }
+                                        " style="width: 50px;display: inline-block;margin-left:5px">
+                                    <el-button type="danger" size="small">图片</el-button>
+                                </el-upload>
+
                             </el-form>
                         </el-form-item>
                     </template>
@@ -346,7 +368,7 @@
                 </el-table-column>
                 <el-table-column prop="installationFee" label="安装费" width="100">
                     <template #default="{ row }">
-                        <span>{{ row.installationFee = (row.quotation * row.installationRate / 100).toFixed(0) }}</span>
+                        <span>{{ row.installationFee = (row.quotation * row.installationRate / 100).toFixed(2) }}</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="设备工程费" width="100">
@@ -387,21 +409,25 @@
         <el-pagination background layout="prev, pager, next"
             style="--el-color-primary: #ff6154;margin-top: 20px; float: right;" v-model:page-count="eqptDataQuery.pages"
             v-model:current-page="eqptDataQuery.current" @current-change="getEqptDataPage" />
+        <el-button @click="generateEquipmentCalculate()">生成测算表</el-button>
     </div>
 </template>
 
 <script>
 import { mapStores } from 'pinia';
 import { assetsProjectInfo } from '@/stores/assetsProjectStore';
-import { importEqptExcelData, getCalculateBaseInfo, getValuationBasisDate } from '@/api/assetsCalculate';
-import { getDataPage } from '@/api/assetsCalculateEqptData';
+import { importEqptExcelData, getCalculateBaseInfo, getValuationBasisDate, generateEquipmentCalculate } from '@/api/assetsCalculate';
+import { getDataPage, updateData } from '@/api/assetsCalculateEqptData';
 import { getDaysBetween } from '@/utils/date';
 import { eqptLifeIfrRefsList } from '@/api/eqptLifeIfrRefs';
+import { getPPIDownData, getPPIByNameType } from '@/api/eqptPPI'
 
 export default {
     data() {
         return {
+            baseURL: import.meta.env.VITE_BASE_URL,
             fileList: [],
+            imageList: [],
             eqptDataQuery: {
                 current: 1,
                 size: 10,
@@ -413,7 +439,8 @@ export default {
             },
             eqptPageData: [],
             calculateBaseInfo: {},
-            eqptLifeIfrRefs: []
+            eqptLifeIfrRefs: [],
+            ppiOptions: []
         }
     },
     computed: {
@@ -422,6 +449,7 @@ export default {
     created() {
         this.getBaseInfo();
         this.getEqptDataPage();
+        this.getPPI();
     },
     methods: {
         getDaysBetween,
@@ -475,6 +503,16 @@ export default {
             this.tmplAssetCalculate.fileName = null;
             this.tmplAssetCalculate.fileUrl = null;
         },
+        // 图片上传成功回调
+        imageSuccess(res, file, fileList, $index) {
+            this.imageList = [];
+            this.eqptPageData[$index].inquiryBasis = res.data;
+            ElMessage({
+                showClose: true,
+                message: res.message,
+                type: 'success'
+            })
+        },
         // 分页查询导入的机器设备测算数据
         getEqptDataPage() {
             this.eqptDataQuery.calculateId = this.projectStore.calculateProgress.id;
@@ -567,7 +605,7 @@ export default {
             // 前期费用率,除一百是因为数据库存的整数
             const AS4 = this.calculateBaseInfo.preConstructionCostRatio / 100;
             // 建设单位管理费率,除一百是因为数据库存的整数
-            const AS5 = this.calculateBaseInfo.preConstructionCostRatio / 100;
+            const AS5 = this.calculateBaseInfo.managementExpenseRatio / 100;
 
             // 计算 报价 部分
             const partAE5 = AE5 / (1 + 0.13) * 0.13;
@@ -582,26 +620,46 @@ export default {
             // 将三部分相加并四舍五入到最接近的整数
             const result = Math.round(partAE5 + partAG5AI5AK5 + partAL5);
 
+            console.log(AE5,AG5,AI5,AK5,AL5,AS4,AS5)
             return result;
         },
+        // 计算单价
+        countPrice(row, index) {
+            if (row.valuationMethod === '物价指数调整法' && row.inquiryBasis) {
+                const parts = row.inquiryBasis.split(':');
+                if (parts.length > 1) {
+                    let ppi = parts[1].trim();
+                    this.eqptPageData[index].price = row.unTaxedUnitPrice * ppi;
+                }
+            }
+        },
         save(row) {
-            console.log(row);
+            updateData(row).then(res => {
+                if (res.code == 200) {
+                    ElMessage({
+                        showClose: true,
+                        message: res.message,
+                        type: 'success'
+                    })
+                }
+            })
         },
-        // 通过设备名称判断参考数据中是否有符合的参考信息
+        // 通过设备名称判断参考数据中是否有符合的参考信息并设置
         mostSimilar() {
             for (let index = 0; index < this.eqptPageData.length; index++) {
                 for (const item of this.eqptLifeIfrRefs) {
                     if (this.eqptPageData[index].equipmentName.includes(item.type)) {
                         this.eqptPageData[index].economicServiceLife = item.lifeRecommendedValue;
+                        this.eqptPageData[index].installationRate = item.ifrRecommendedValue;
                         // 计算年限成新率
                         this.eqptPageData[index].depreciationRateByAge = ((this.eqptPageData[index].economicServiceLife - this.eqptPageData[index].yearsInUse) / this.eqptPageData[index].economicServiceLife < 0.15) ? 15 :
-                                ((this.eqptPageData[index].economicServiceLife - this.eqptPageData[index].yearsInUse) / this.eqptPageData[index].economicServiceLife).toFixed(2) * 100
+                            ((this.eqptPageData[index].economicServiceLife - this.eqptPageData[index].yearsInUse) / this.eqptPageData[index].economicServiceLife).toFixed(2) * 100
                         this.countDepreciationRate(this.eqptPageData[index].depreciationRateByAge, index)
                         break;
                     }
                 }
             }
-                
+
         },
         // 获取设备参考年限、安装费率
         getEqptLifeIfrRefs() {
@@ -611,6 +669,46 @@ export default {
                     this.mostSimilar();
                 }
             })
+        },
+        // 获取物价指数下拉数据
+        getPPI() {
+            getPPIDownData().then(res => {
+                if (res.data) {
+                    this.ppiOptions = res.data;
+                }
+            })
+        },
+        // 设置默认物价指数给询价依据
+        setPPItoInquiryBasis(row, $index) {
+            if (row.valuationMethod === '物价指数调整法') {
+                const date = new Date(this.calculateBaseInfo.valuationBasisDate);
+                let year = date.getFullYear().toString();
+                const params = { ppiName: null, ppiType: null };
+                params.ppiName = year;
+                params.ppiType = '通用设备制造业';
+                getPPIByNameType(params).then(res => {
+                    if (res.data) {
+                        row.inquiryBasis = '(' + res.data.id + ')' + res.data.ppiName + '年:' + res.data.ppi;
+                        // setTimeout(() => {
+                        this.countPrice(row, $index);
+                        // }, 3000);
+                    }
+                })
+            } else {
+                row.inquiryBasis = null;
+            }
+        },
+        // 生成测算表
+        generateEquipmentCalculate() {
+            generateEquipmentCalculate(this.projectStore.calculateProgress.id).then(res => {
+                if (res.code == 200) {
+                    ElMessage({
+                        showClose: true,
+                        message: res.message,
+                        type: 'success'
+                    })
+                }
+            })
         }
     },
 
@@ -620,7 +718,7 @@ export default {
 <style scoped>
 .contrl {
     font-size: 20px;
-    width: 70.9%;
+    width: 75%;
     border-right: 1.5px #dae1eb solid;
     padding: 0px 20px 20px 0px;
     float: left;
@@ -661,14 +759,14 @@ export default {
 }
 
 .uploadDiv {
-    width: 16%;
+    width: 14.5%;
     display: inline-block;
     vertical-align: top;
 }
 
 .evaluateDiv {
     margin-left: 1%;
-    width: 83%;
+    width: 84.5%;
     display: inline-block;
     vertical-align: top;
     min-height: 650px;