From 7116e6e5a387f769ac610d3396a7d61771eb90dd Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期日, 28 四月 2024 14:41:26 +0800
Subject: [PATCH] Merge branch 'master' into dev-threejs

---
 src/views/system/contract/index.vue |   59 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/src/views/system/contract/index.vue b/src/views/system/contract/index.vue
index d495071..61ac223 100644
--- a/src/views/system/contract/index.vue
+++ b/src/views/system/contract/index.vue
@@ -1,12 +1,11 @@
 <template>
   <div class="app-container">
 
-    <el-row>
+    <el-row v-loading="loading">
       <el-col :span="8" v-for="(item, index) in contractList" :key="index" style="margin: 10px;width: 30%;">
         <el-card :body-style="{ padding: '0px' }">
-          <el-image style="width: 420px;height: 187px;"
-            :preview-src-list="['https://img2.baidu.com/it/u=68398439,1553004927&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=357']"
-            fit="cover" src="https://img2.baidu.com/it/u=68398439,1553004927&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=357"
+          <ImagePreview style="width: 100%;height: 187px;"
+            fit="cover" :src="item.attachment"
             class="image" />
           <div style="padding: 14px;">
             <span>{{ item.name }}</span>
@@ -34,10 +33,22 @@
           <el-collapse-item  v-for="(item, index) in ruleData" :key="index" :title="item.ruleName" :name="index">
             <div class="inline-input-container" v-for="(item, index) in item.children" :key="index">
               <b>{{ item.ruleDesc }}</b> <br v-if="item.ruleDesc"/>
-              <el-tooltip class="item" v-for="(item, index) in item.children" :key="index" effect="dark" :content="item.deductCategory + ' ' + item.calcFraction + (item.calcUnit ? '/' + item.calcUnit : '')" placement="top">
+              <el-tooltip class="item" v-for="(item, index) in item.children" :key="index" effect="dark" :content="item.deductCategory == '鍒嗘暟涔樹互鏁伴噺' ? '鎵�' + item.calcFraction  + '涔樹互鏁伴噺 ' : item.deductCategory == '闄や互鏁伴噺鍚庝箻浠ュ垎鏁�' ? '鎵�' + item.calcFraction + '鍒�/' +  item.calcUnit + '灏忔椂' : item.deductCategory + ' ' + item.calcFraction" placement="top">
                 <span>{{ item.ruleCondition }}<br/></span>
                 <!-- {{ item.deductCategory }} {{ item.calcFraction }}{{ item.calcUnit ? "/" + item.calcUnit : ''  }} -->
             </el-tooltip>
+            </div>
+          </el-collapse-item>
+          <el-collapse-item title="鑰冩牳缁撴灉搴旂敤瑙勫垯" :name="ruleData.length">
+            <div class="inline-input-container">
+                <span v-for="(item, index) in moneyRules" :key="index">
+                    <div>
+                      <span>{{ item.scoreCondition }}</span>
+                      <el-tooltip class="item" effect="dark" :content="item.description" placement="top">
+                        <span style="margin-left: 20px;">{{ item.description }}</span>
+                      </el-tooltip>
+                    </div>
+                </span>
             </div>
           </el-collapse-item>
           <el-form-item label="鍚堝悓闄勪欢" prop="attachment" class="top">
@@ -79,9 +90,9 @@
             <div class="row-right" style="margin-left: 80px;">
               <div class="margin-5">
                 <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
-                  :action="upload.url + '?unitId=' + upload.unitId + '&startTime=' + upload.startTime + '&endTime=' + upload.endTime + '&name=' + upload.name"
+                  :action="upload.url"
                   :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
-                  :file-list="upload.fileList"
+                  :data="upload"
                   :auto-upload="false" drag style="text-align: center;">
                   <i class="el-icon-upload"></i>
                   <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
@@ -128,16 +139,20 @@
 </template>
 
 <script>
-import { listContract, getContract, updateContract, addContract } from "@/api/platform/contract";
+import { listContract, getContract, updateContract } from "@/api/platform/contract";
 import { getRuleListByContractId } from "../../../api/platform/calculate-rule";
+import { getMoneyRulesByContractId } from "../../../api/platform/calculate-money-rule";
 import { unitSelect } from "../../../api/platform/unit";
 import { deptSelect } from "../../../api/system/dept";
 import { getToken } from "@/utils/auth";
+import { ImagePreview } from "@/components/ImagePreview";
 
 export default {
   name: "Contract",
+  comments: { ImagePreview },
   data() {
     return {
+      loading: false,
       contractInfo: {},
       // 鍚堝悓瀵煎叆鍙傛暟
       upload: {
@@ -152,7 +167,6 @@
         // 涓婁紶鐨勫湴鍧�
         url: process.env.VUE_APP_BASE_API + "/system/contract/importData",
         ruleList: [],
-        fileList: [],
         unitId: '',
         startTime: '',
         endTime: ''
@@ -191,6 +205,7 @@
       // 鏄惁鏄剧ず璇︽儏
       detail: false,
       ruleData: [],
+      moneyRules: [],
       // 琛ㄥ崟鍙傛暟
       form: {
       },
@@ -267,14 +282,13 @@
       let that = this;
       this.$refs["form"].validate(valid => {
         if (valid) {
-          addContract(this.upload).then (response => {
-            if (response.code != 200) {
-              this.$message.error("鎿嶄綔澶辫触");
-            } else {
-              this.$message.success("鎿嶄綔鎴愬姛");
-            }
+          that.upload.ruleList = JSON.stringify(this.upload.ruleList);
+          that.loading = true;
+          that.upload.open = false;
+          that.$refs.upload.submit().then(() => {
+            that.loading = false;
+            that.reset();
           });
-          // that.$refs.upload.submit();
         }
       })
     },
@@ -318,6 +332,9 @@
         this.form.id = item.id;
         this.contractInfo = item;
       });
+      getMoneyRulesByContractId(item.id).then(response => {
+        this.moneyRules = response.data;
+      });
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
@@ -344,6 +361,16 @@
     /** 涓嬭浇鎸夐挳鎿嶄綔 */
     handleDownload (data) {
       this.$download.resource(data);
+    },
+    reset () {
+      this.upload = {
+        open: false,
+        name: undefined,
+        unitId: undefined,
+        timezone: undefined,
+        ruleList: []
+      };
+      this.resetForm("form");
     }
   }
 };

--
Gitblit v1.8.0