fuliqi
2024-04-28 a48fa4a7469b87f830251161f812a19dc9729ee9
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");
    }
  }
};