From b046b693b02a0ae00dec69e94063120460590f3d Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期五, 26 四月 2024 18:24:19 +0800
Subject: [PATCH] 考核结果应用规则(算钱)新增、展示
---
src/views/system/contract/index.vue | 50 ++++++++++++++++++++++++++++++++++++++------------
src/api/platform/calculate-money-rule.js | 8 ++++++++
2 files changed, 46 insertions(+), 12 deletions(-)
diff --git a/src/api/platform/calculate-money-rule.js b/src/api/platform/calculate-money-rule.js
index 025aebd..12285d2 100644
--- a/src/api/platform/calculate-money-rule.js
+++ b/src/api/platform/calculate-money-rule.js
@@ -9,6 +9,14 @@
})
}
+// 鏍规嵁鍚堝悓id鏌ヨ杩濈害瑙勫垯鍒楄〃
+export function getMoneyRulesByContractId(data) {
+ return request({
+ url: '/system/contract/selectMoneyRules?contractId=' + data,
+ method: 'get'
+ })
+}
+
// 鏌ヨ鏍哥畻瑙勫垯璇︾粏
export function getRule(id) {
return request({
diff --git a/src/views/system/contract/index.vue b/src/views/system/contract/index.vue
index d495071..ec6f212 100644
--- a/src/views/system/contract/index.vue
+++ b/src/views/system/contract/index.vue
@@ -1,7 +1,7 @@
<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;"
@@ -38,6 +38,18 @@
<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 +91,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,8 +140,9 @@
</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";
@@ -138,6 +151,7 @@
name: "Contract",
data() {
return {
+ loading: false,
contractInfo: {},
// 鍚堝悓瀵煎叆鍙傛暟
upload: {
@@ -152,7 +166,6 @@
// 涓婁紶鐨勫湴鍧�
url: process.env.VUE_APP_BASE_API + "/system/contract/importData",
ruleList: [],
- fileList: [],
unitId: '',
startTime: '',
endTime: ''
@@ -191,6 +204,7 @@
// 鏄惁鏄剧ず璇︽儏
detail: false,
ruleData: [],
+ moneyRules: [],
// 琛ㄥ崟鍙傛暟
form: {
},
@@ -267,14 +281,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 +331,9 @@
this.form.id = item.id;
this.contractInfo = item;
});
+ getMoneyRulesByContractId(item.id).then(response => {
+ this.moneyRules = response.data;
+ });
},
/** 鏂板鎸夐挳鎿嶄綔 */
handleAdd() {
@@ -344,6 +360,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