From 130d63cd0b0e39e26e7826440814e5f8ed1d9e1e Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期三, 24 四月 2024 13:54:33 +0800
Subject: [PATCH] 合同导入模板生成、导入合同及规则、合同规则展示

---
 src/views/system/contract/index.vue |   49 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/src/views/system/contract/index.vue b/src/views/system/contract/index.vue
index a0551cf..f04da84 100644
--- a/src/views/system/contract/index.vue
+++ b/src/views/system/contract/index.vue
@@ -33,21 +33,19 @@
         <el-collapse v-model="activeNames" @change="handleChange">
           <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">
-              {{ item.ruleDesc }} <br/>
-              {{ item.ruleCondition }} {{ item.deductCategory }} {{ item.calcFraction }}{{ item.calcUnit ? "/" + item.calcUnit : item.calcUnit  }}
+              <b>{{ item.ruleDesc }}</b> <br v-if="item.ruleDesc"/>
+              <el-tooltip class="item" effect="dark" :content="item.deductCategory + ' ' + item.calcFraction + (item.calcUnit ? '/' + item.calcUnit : '')" placement="top">
+                <span>{{ item.ruleCondition }}</span>
+                <!-- {{ item.deductCategory }} {{ item.calcFraction }}{{ item.calcUnit ? "/" + item.calcUnit : ''  }} -->
+            </el-tooltip>
             </div>
           </el-collapse-item>
-          <el-form-item label="鍚堝悓闄勪欢" prop="certificates">
-            <el-upload>
-              <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button>
-              <div slot="tip" class="el-upload__tip">璇蜂笂浼犲ぇ灏忎笉瓒呰繃 5MB 鏍煎紡涓� doc/xls/ppt/txt/pdf/png/jpg 鐨勬枃浠�</div>
-            </el-upload>
+          <el-form-item label="鍚堝悓闄勪欢" prop="attachment" class="top">
+            <file-upload v-model="form.attachment"/>
           </el-form-item>
-          <el-dialog :visible.sync="dialogVisible" append-to-body="false">
-            <img width="100%" :src="dialogImageUrl" alt="">
-          </el-dialog>
+            <el-link class="top" v-for="item in contractInfo.attachment != null ? contractInfo.attachment.split(',') : contractInfo.attachment" :underline="false" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1) }}</el-link>
           <div style="text-align: right; margin-top: 10px;">
-            <el-button type="primary" @click="submitForm1(props.row)">鎻愪氦</el-button>
+            <el-button type="primary" @click="submitForm">鎻愪氦</el-button>
           </div>
         </el-collapse>
       </el-form>
@@ -95,7 +93,7 @@
 </template>
 
 <script>
-import { listContract, getContract } from "@/api/platform/contract";
+import { listContract, getContract, updateContract } from "@/api/platform/contract";
 import { getRuleListByContractId } from "../../../api/platform/calculate-rule";
 import { unitSelect } from "../../../api/platform/unit";
 import { deptSelect } from "../../../api/system/dept";
@@ -105,6 +103,7 @@
   name: "Contract",
   data() {
     return {
+      contractInfo: {},
       // 鍚堝悓瀵煎叆鍙傛暟
       upload: {
         // 鏄惁鏄剧ず寮瑰嚭灞傦紙鍚堝悓瀵煎叆锛�
@@ -178,6 +177,15 @@
     this.selectDept();
   },
   methods: {
+    submitForm() {
+      updateContract(this.form).then(response => {
+        if (response.code != 200) {
+          this.$message.error("鎿嶄綔澶辫触");
+        } else {
+          this.$message.success("鎿嶄綔鎴愬姛");
+        }
+      });
+    },
     /** 瀵煎叆鎸夐挳鎿嶄綔 */
     handleImport() {
       this.upload.title = "鍚堝悓瀵煎叆";
@@ -197,7 +205,11 @@
       this.upload.open = false;
       this.upload.isUploading = false;
       this.$refs.upload.clearFiles();
-      this.$message.success("鎿嶄綔鎴愬姛");
+      if (response.code != 200) {
+        this.$message.warning(response.msg);
+      } else {
+        this.$message.success(response.msg);
+      }
       this.getList();
     },
     // 鎻愪氦涓婁紶鏂囦欢
@@ -246,6 +258,8 @@
     getRuleList(item) {
       getRuleListByContractId(item.id).then(response => {
         this.ruleData = response.data;
+        this.form.id = item.id;
+        this.contractInfo = item;
       });
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
@@ -270,6 +284,10 @@
         this.title = "淇敼鍚堝悓";
       });
     },
+    /** 涓嬭浇鎸夐挳鎿嶄綔 */
+    handleDownload (data) {
+      this.$download.resource(data);
+    }
   }
 };
 </script>
@@ -321,4 +339,9 @@
 .clearfix:after {
   clear: both
 }
+
+.top {
+  display: block;
+  margin-top: 10px;
+}
 </style>

--
Gitblit v1.8.0