Browse Source

1.新增计算报告有效期
2.机器设备作价页面优化

GouGengquan 7 months ago
parent
commit
8f13266aa6

+ 25 - 0
src/utils/date.js

@@ -4,3 +4,28 @@ export function getDaysBetween(dateString1, dateString2) {
     let endDate = Date.parse(dateString2);
     return (endDate - startDate) / (1 * 24 * 60 * 60 * 1000);
 }
+
+// 计算日期字符串往后推算一年的时间并掐头(日减少一天)
+export function processDate(dateStr) {
+    // 将日期字符串转换为 Date 对象
+    const parts = dateStr.match(/(\d+)年(\d+)月(\d+)日/);
+    const year = parseInt(parts[1], 10);
+    const month = parseInt(parts[2], 10) - 1; // JavaScript 中月份是从 0 开始的
+    const day = parseInt(parts[3], 10);
+
+    const date = new Date(year, month, day);
+
+    // 将年份加一
+    date.setFullYear(year + 1);
+    // 减一天
+    date.setDate(day - 1);
+    return date;
+}
+
+// 将 Date 对象转换为 "YYYY年MM月DD日" 格式的字符串
+export function formatDate(date) {
+    const year = date.getFullYear();
+    const month = (date.getMonth() + 1).toString().padStart(2, '0');
+    const day = date.getDate().toString().padStart(2, '0');
+    return `${year}年${month}月${day}日`;
+}

+ 25 - 10
src/views/assets/workbench/calculate/importInfo.vue

@@ -26,9 +26,9 @@
             <el-button type="danger" @click="uploadEqptExcel()">
                 确认上传
             </el-button>
-            <el-button type="danger" @click="generateEquipmentCalculate()">生成测算表</el-button>
         </div>
         <div id="evaluateDiv" class="evaluateDiv">
+            <el-button type="primary" style="float:left" @click="generateEquipmentCalculate()">生成测算表</el-button>
             <el-button v-if="activeName === 'all'" type="primary" style="float:left" @click="saveBatch()">批量保存</el-button>
             <el-button v-if="activeName === 'imported'" type="primary" style="float:left" @click="saveBatchImp()">批量保存</el-button>
             <el-button v-if="activeName === 'nonStandard'" type="primary" style="float:left" @click="saveBatchNonS()">批量保存</el-button>
@@ -56,7 +56,7 @@
                     搜索
                 </el-button>
             </div>
-            <el-table :data="eqptPageData" border stripe v-show="activeName === 'all'">
+            <el-table :data="eqptPageData" border height="585" stripe v-show="activeName === 'all'">
                 <el-table-column fixed prop="sortId" label="序号" width="80" align="center">
                     <template #default="{ row }">
                         <el-form-item prop="sortId">
@@ -201,6 +201,7 @@
                                 <el-input v-model="row.activationDate" placeholder="启用日期" />
                             </el-form>
                         </el-form-item>
+                        <p v-if="new Date(row.activationDate) < new Date(row.purchaseDate)" style="color: red;font-size: 9px;position: absolute;left: 12px;top: 32px;">启用日期在购买之前</p>
                     </template>
                 </el-table-column>
                 <el-table-column prop="storageLocation" label="存放地点" width="250" align="center">
@@ -1308,17 +1309,17 @@
         <el-pagination v-if="activeName === 'all'" background layout="sizes, prev, pager, next"
             :page-sizes="[10, 15, 20, 50]" style="--el-color-primary: #ff6154;margin-top: 20px; float: right;"
             v-model:page-count="eqptDataQuery.pages" v-model:page-size="eqptDataQuery.size"
-            v-model:current-page="eqptDataQuery.current" @current-change="getEqptDataPage" @size-change="getEqptDataPage" />
+            v-model:current-page="eqptDataQuery.current" @current-change="autoSave" @size-change="autoSave"/>
         <el-pagination v-if="activeName === 'imported'" background layout="sizes, prev, pager, next"
             :page-sizes="[10, 15, 20, 100]" style="--el-color-primary: #ff6154;margin-top: 20px; float: right;"
             v-model:page-count="eqptDataQuery.pages" v-model:page-size="eqptDataQuery.size"
-            v-model:current-page="eqptDataQuery.current" @current-change="getImpEqptDataPage"
-            @size-change="getImpEqptDataPage" />
+            v-model:current-page="eqptDataQuery.current" @current-change="autoSaveImp"
+            @size-change="autoSaveImp"/>
         <el-pagination v-if="activeName === 'nonStandard'" background layout="sizes, prev, pager, next"
             :page-sizes="[10, 15, 50, 100]" style="--el-color-primary: #ff6154;margin-top: 20px; float: right;"
             v-model:page-count="eqptDataQuery.pages" v-model:page-size="eqptDataQuery.size"
-            v-model:current-page="eqptDataQuery.current" @current-change="getNonSEqptDataPage"
-            @size-change="getNonSEqptDataPage" />
+            v-model:current-page="eqptDataQuery.current" @current-change="autoSaveNonS"
+            @size-change="autoSaveNonS"/>
         <el-tabs v-model="activeName" tab-position="bottom" @tab-change="tabChange()"
             style="display:inline-block;margin-left: 308px">
             <el-tab-pane label="所有设备测算" name="all">
@@ -1584,7 +1585,6 @@ export default {
         // 进口设备税率截图上传成功回调
         tariffRatePictureSuccess(res, file, fileList, $index) {
             this.imageList = [];
-            console.log(this.eqptImpPageData[$index])
             this.eqptImpPageData[$index].tariffRatePicture = res.data;
             ElMessage({
                 showClose: true,
@@ -1738,7 +1738,7 @@ export default {
                 const parts = row.inquiryBasis.split(':');
                 if (parts.length > 1) {
                     let ppi = parts[1].trim();
-                    this.eqptPageData[index].price = row.unTaxedUnitPrice * ppi;
+                    this.eqptPageData[index].price = (row.unTaxedUnitPrice * ppi).toFixed(2);
                 }
             }
         },
@@ -1766,6 +1766,11 @@ export default {
                 }
             })
         },
+        // 翻页时自动保存
+        autoSave() {
+            this.saveBatch();
+            this.getEqptDataPage();
+        },
         // 通过设备名称判断参考数据中是否有符合的参考信息并设置
         mostSimilar() {
             for (let index = 0; index < this.eqptPageData.length; index++) {
@@ -1802,7 +1807,7 @@ export default {
         // 设置默认物价指数给询价依据
         setPPItoInquiryBasis(row, $index) {
             if (row.valuationMethod === '物价指数调整法') {
-                const date = new Date(this.calculateBaseInfo.valuationBasisDate);
+                const date = new Date(row.purchaseDate);
                 let year = date.getFullYear().toString();
                 const params = { ppiName: null, ppiType: null };
                 params.ppiName = year;
@@ -1882,6 +1887,11 @@ export default {
                 }
             })
         },
+        // 进口设备翻页自动保存
+        autoSaveImp() {
+            this.saveBatchImp();
+            this.getImpEqptDataPage();
+        },
         // 更新非标设备测算
         saveNonS(row) {
             updateNonSData(row).then(res => {
@@ -1908,6 +1918,11 @@ export default {
                 }
             })
         },
+        // 进口设备翻页自动保存
+        autoSaveNonS() {
+            this.saveBatchNonS();
+            this.getNonSEqptDataPage();
+        },
         // 获取表格过滤条件
         getEqptTableFilter(queryType, eqptType) {
             let params = {

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

@@ -44,7 +44,7 @@ export default {
         }
       }else {
         var obj = document.getElementById('contrl');
-        obj.style.width = '99%';
+        obj.style.width = '98.9%';
         var evaluateDiv = document.getElementById('evaluateDiv');
         if(evaluateDiv) {
           evaluateDiv.style.width = '85%';

+ 31 - 17
src/views/assets/workbench/report/eqptBaseInfo.vue

@@ -14,14 +14,14 @@
                             </el-form-item>
                         </el-col>
                     </el-row>
-                    <el-row :gutter="10">
+                    <!-- <el-row :gutter="10">
                         <el-col :span="24">
                             <el-form-item label="评估范围:" label-width="180" class="form-item" prop="scope">
                                 <el-input v-model="eqptBaseInfo.scope" :rows="3" type="textarea" clearable
                                     style="width: 100%;" />
                             </el-form-item>
                         </el-col>
-                    </el-row>
+                    </el-row> -->
                     <el-row :gutter="10">
                         <el-col :span="24">
                             <el-form-item label="价值类型:" label-width="180" class="form-item" prop="valueType">
@@ -63,7 +63,12 @@
                     <el-row :gutter="10">
                         <el-col :span="24">
                             <el-form-item label="评估方法:" label-width="180" class="form-item" prop="method">
-                                <el-input v-model="eqptBaseInfo.method" clearable style="width: 100%;" />
+                                <el-select v-model="eqptBaseInfo.method" clearable filterable allow-create style="width: 100%;">
+                                    <el-option label="成本法" value="成本法" />
+                                    <el-option label="市场法" value="市场法" />
+                                    <el-option label="收益法" value="收益法" />
+                                    <el-option label="成本法/市场法" value="成本法/市场法" />
+                                </el-select>
                             </el-form-item>
                         </el-col>
                     </el-row>
@@ -413,6 +418,7 @@ import { mapStores } from 'pinia'
 import { assetsProjectInfo } from '@/stores/assetsProjectStore';
 import { updateReportBaseInfo, getReportBaseInfo, generateEquipmentReport } from '@/api/assetsReport';
 import { getReferencesInfoById } from '@/api/assetsCalculate';
+import { processDate, formatDate } from '@/utils/date'
 
 export default {
     data() {
@@ -619,8 +625,10 @@ export default {
             getReportBaseInfo(this.projectStore.reportProgress.id).then(res => {
                 if (res.data) {
                     this.eqptBaseInfo = JSON.parse(res.data);
-                    const parts = this.eqptBaseInfo.reportValidity.split('起至');
-                    this.eqptBaseInfo.reportValidity = parts.map(part => part.trim());
+                    if (this.eqptBaseInfo.reportValidity) {
+                        const parts = this.eqptBaseInfo.reportValidity.split('起至');
+                        this.eqptBaseInfo.reportValidity = parts.map(part => part.trim());
+                    }
                     // 返回不为空说明该步骤以前已经完成了,不需要更新本地缓存
                     this.needUpdateStore = false;
                 }
@@ -632,18 +640,24 @@ export default {
                 if (res.data) {
                     if (!this.eqptBaseInfo.assetsInfo.purchasePeriod) {
                         this.eqptBaseInfo.assetsInfo.purchasePeriod = res.data.purchasePeriod;
-                        if (!this.eqptBaseInfo.assetsInfo.majorEquipmentAssets) {
-                            this.eqptBaseInfo.assetsInfo.majorEquipmentAssets = res.data.majorEquipmentAssets;
-                        }
-                        if (!this.eqptBaseInfo.assetsInfo.assetCount) {
-                            this.eqptBaseInfo.assetsInfo.assetCount = res.data.assetCount;
-                        }
-                        if (!this.eqptBaseInfo.assetsInfo.assetCount) {
-                            this.eqptBaseInfo.assetsInfo.assetCount = res.data.assetCount;
-                        }
-                        if (!this.eqptBaseInfo.valuationBasisDate) {
-                            this.eqptBaseInfo.valuationBasisDate = res.data.valuationBasisDate;
-                        }
+                    }
+                    if (!this.eqptBaseInfo.assetsInfo.majorEquipmentAssets) {
+                        this.eqptBaseInfo.assetsInfo.majorEquipmentAssets = res.data.majorEquipmentAssets;
+                    }
+                    if (!this.eqptBaseInfo.assetsInfo.assetCount) {
+                        this.eqptBaseInfo.assetsInfo.assetCount = res.data.assetCount;
+                    }
+                    if (!this.eqptBaseInfo.assetsInfo.assetCount) {
+                        this.eqptBaseInfo.assetsInfo.assetCount = res.data.assetCount;
+                    }
+                    if (!this.eqptBaseInfo.valuationBasisDate) {
+                        const date = new Date(res.data.valuationBasisDate);
+                        this.eqptBaseInfo.valuationBasisDate = formatDate(date);
+                    }
+                    if (!this.eqptBaseInfo.reportValidity) {
+                        this.eqptBaseInfo.reportValidity = [];
+                        this.eqptBaseInfo.reportValidity.push(this.eqptBaseInfo.valuationBasisDate)
+                        this.eqptBaseInfo.reportValidity.push(formatDate(processDate(this.eqptBaseInfo.valuationBasisDate)));
                     }
                 }
             })