From 84562e1978146f396c6976c75dc931c12b188982 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 26 四月 2024 15:54:17 +0800
Subject: [PATCH] 核算报告功能完善

---
 src/views/system/calculate/report/index.vue |  105 +++++++++++++++++-----------------------------------
 1 files changed, 34 insertions(+), 71 deletions(-)

diff --git a/src/views/system/calculate/report/index.vue b/src/views/system/calculate/report/index.vue
index c0af4db..df97728 100644
--- a/src/views/system/calculate/report/index.vue
+++ b/src/views/system/calculate/report/index.vue
@@ -1,54 +1,7 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
-      <el-form-item label="鏍哥畻瀵硅薄" prop="checkUnitId">
-        <el-input
-          v-model="queryParams.checkUnitName"
-          placeholder="璇疯緭鍏ユ牳绠楀璞�"
-          clearable
-          @clear="handleQuery"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
 
-      <el-form-item label="鏍哥畻鏃堕棿">
-        <el-date-picker
-          v-model="daterangeCheckTime"
-          style="width: 240px"
-          value-format="yyyy-MM-dd HH:mm:ss"
-          type="daterange"
-          range-separator="-"
-          start-placeholder="寮�濮嬫棩鏈�"
-          end-placeholder="缁撴潫鏃ユ湡"
-        ></el-date-picker>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
-      </el-form-item>
-    </el-form>
-
-    <el-row :gutter="10" class="mb8">
-<!--      <el-col :span="1.5">-->
-<!--        <el-button-->
-<!--          type="primary"-->
-<!--          plain-->
-<!--          icon="el-icon-plus"-->
-<!--          size="mini"-->
-<!--          @click="handleAdd"-->
-<!--          v-hasPermi="['system:checkResult:add']"-->
-<!--        >鏂板</el-button>-->
-<!--      </el-col>-->
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-        >鍒犻櫎</el-button>
-      </el-col>
+    <el-row style="margin-left: 10px" :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -56,7 +9,7 @@
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-        >瀵煎嚭</el-button>
+        >瀵煎嚭鎵�鏈夋暟鎹�</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -67,12 +20,14 @@
         <el-button style="float: right; padding: 3px 0" type="text" @click="handleDetail(item)">鏍哥畻</el-button>
       </div>
       <div class="text item">鍚堝悓<span class="time">{{ item.contractName }}</span></div>
-      <div class="text item">鎵e噺閲戦<span class="time">{{ item.deductMoney }}</span></div>
-      <div class="text item">鏈�鏂版牳绠楁椂闂�
-        <span class="time">{{ item.whichYear }}骞磠{ item.whichMonth }}鏈�</span>
+      <div class="text item">鏈�杩戞墸鍑忛噾棰�<span class="time">{{ item.latestDeductMoney }}</span></div>
+      <div class="text item">绱鎵e噺閲戦<span class="time">{{ item.deductMoney }}</span></div>
+      <div class="text item">鏈�杩戞牳绠楁湀浠�
+        <span v-if="item.latestTime" class="time">{{ new Date(item.latestTime).getFullYear() }}骞磠{ new Date(item.latestTime).getMonth() }}鏈�</span>
+        <span v-else class="time">鏆傛棤</span>
       </div>
-      <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-show="item.publish != 1"  v-hasPermi="['result:contract:publish']">纭鍙戝竷</el-button>
-      <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-show="item.publish == 1"  v-hasPermi="['result:contract:publish']">宸插彂甯�</el-button>
+      <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-if="item.status === 'not_publish'" :disabled="!item.canPublish" v-hasPermi="['system:calculate:report:status']">纭鍙戝竷</el-button>
+      <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-if="item.status === 'published'" v-hasPermi="['system:calculate:report:status']">鍙栨秷鍙戝竷</el-button>
     </el-card>
 
     <pagination
@@ -135,7 +90,9 @@
             prop="deductMoney"
             width="180">
             <template slot-scope="scope">
-              <el-input type="number"
+              <el-input
+                :disabled="!scope.row.latest"
+                type="number"
                 :precision="2" :step="0.1"
                 :min="0" :max="1000000"
                 v-model="scope.row.deductMoney"
@@ -163,7 +120,7 @@
 </template>
 
 <script>
-import { getCalculateReports, getCalculateReportById, backfill } from "@/api/platform/calculate-report";
+import { getCalculateReports, getCalculateReportById, backfill, updatePublishStatus } from "@/api/platform/calculate-report";
 
 export default {
   name: "CheckResult",
@@ -288,13 +245,14 @@
       })
     },
     handlePublish(row) {
-      let text = row.publish == 1 ? '鍙栨秷鍙戝竷' : '鍙戝竷';
-      const ids = row.id || this.ids;
-      this.$modal.confirm('鏄惁纭' + text + '鑰冩牳缁撴灉缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
+      let text = row.status === 'published' ? '鍙栨秷鍙戝竷' : '鍙戝竷';
+      this.$modal.confirm('纭瑕併��' + text + "銆戙��" + row.contractName + "銆戙��" + new Date(row.latestTime).getMonth() + "鏈堛��" + '鐨勬牳绠楁姤鍛婂悧锛�').then(function() {
         // return publishCheckResult(ids);
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess(text + "鎴愬姛");
+        updatePublishStatus(row.id).then(res => {
+          this.getList();
+          this.$modal.msgSuccess(text + "鎴愬姛");
+        })
       }).catch(() => {});
 
     },
@@ -313,15 +271,20 @@
     submitForm() {
       let data = {
         id: this.detail.id,
-        recordList: this.detail.recordList
+        recordList: this.detail.recordList.filter(item => item.latest)
       }
-      backfill(data).then(res => {
-        if (res.code === 200) {
-          this.$message.success("鎿嶄綔鎴愬姛");
-          this.detailOpen = false;
-          this.getList();
-        }
-      })
+      if (data.recordList.length > 0) {
+        backfill(data).then(res => {
+          if (res.code === 200) {
+            this.$message.success("鎿嶄綔鎴愬姛");
+            this.detailOpen = false;
+            this.getList();
+          }
+        })
+      } else {
+        this.detailOpen = false;
+      }
+
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
@@ -338,7 +301,7 @@
           sums[index] = '鍚堣';
           return;
         }
-        
+
         const values = data.map(item => Number(item[column.property]));
         if (!values.every(value => isNaN(value))) {
           sums[index] = values.reduce((prev, curr) => {
@@ -353,7 +316,7 @@
             sums[index] = '-';
           }
           if (column.property === 'deductMoney') {
-            sums[index] += '鍏�';
+            sums[index] += ' 鍏�';
           }
         } else {
           sums[index] = '-';

--
Gitblit v1.8.0