xiangpei
2024-09-03 16eb67ab6b103663d30cad9ba74360f982e131cb
src/views/system/contract/contract/index.vue
@@ -1,5 +1,29 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <el-form-item label="合同名称">
        <el-input
          v-model="queryParams.name"
          placeholder="合同名称搜索"
          clearable
          @clear="getList"
          @keyup.enter.native="getList"
        />
      </el-form-item>
      <el-form-item label="合同状态">
        <el-select v-model="queryParams.status" @change="getList">
          <el-option label="全部" value=""></el-option>
          <el-option label="有效" value="ACTIVE"></el-option>
          <el-option label="未生效" value="NOT_START"></el-option>
          <el-option label="已失效" value="FINISHED"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="small" @click="getList">搜索</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8" style="margin-top: 10px">
      <el-col :span="1.5">
        <el-button
@@ -13,12 +37,12 @@
        >
      </el-col>
    </el-row>
    <el-row v-loading="loading">
    <el-row v-loading="loading" :gutter="20">
      <el-col
        :span="8"
        v-for="(item, index) in contractList"
        :key="index"
        style="margin: 10px; width: 30%"
        style="margin-bottom: 10px"
      >
        <el-card :body-style="{ padding: '0px' }">
          <ImagePreview
@@ -55,33 +79,22 @@
      <el-form label-position="left" inline class="table-expand">
        <el-collapse v-model="activeNames">
          <el-collapse-item
            v-for="(item, index) in ruleData"
            v-for="name, index in ruleName"
            :key="index"
            :title="item.ruleName"
            :name="index"
            :title="name"
          >
            <div
              class="inline-input-container"
              v-for="(item, index) in item.children"
              v-for="item, index in ruleData"
              :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.deductCategory == '除以数量后乘以分数'
                    ? '扣' + item.calcFraction + '分/' + item.calcUnit + '小时'
                    : '扣' + item.calcFraction + '分'
                "
                placement="top"
              >
                <span>{{ item.ruleCondition }}<br /></span>
                <!-- {{ item.deductCategory }} {{ item.calcFraction }}{{ item.calcUnit ? "/" + item.calcUnit : ''  }} -->
              <el-tooltip :content="
                item.deductCategory == '分数乘以数量'
                ? '扣' + item.calcFraction + '分*数量 '
                : item.deductCategory == '除以数量后乘以分数'
                ? '扣' + item.calcFraction + '分/' + item.calcUnit + '小时'
                : '扣' + item.calcFraction + '分'">
                <b v-if="item.ruleName === name">{{ item.ruleCondition }}<br /></b>
              </el-tooltip>
            </div>
          </el-collapse-item>
@@ -102,6 +115,7 @@
                  </el-tooltip>
                </div>
              </span>
              <el-empty v-if="moneyRules.length == 0" :image-size="100" />
            </div>
          </el-collapse-item>
          <el-form-item label="合同附件" prop="attachment" class="top">
@@ -250,8 +264,8 @@
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
@@ -275,6 +289,10 @@
  comments: { ImagePreview },
  data() {
    return {
      queryParams: {
        name: '',
        status: ''
      },
      loading: false,
      contractInfo: {},
      // 合同导入参数
@@ -303,8 +321,6 @@
      unitList: [],
      deptList: [],
      activeNames: ["1"],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
@@ -326,6 +342,7 @@
      // 是否显示详情
      detail: false,
      ruleData: [],
      ruleName: [],
      moneyRules: [],
      // 表单参数
      form: {},
@@ -449,7 +466,7 @@
    getList() {
      this.loading = true;
      listContract(this.queryParams).then((response) => {
        this.contractList = response;
        this.contractList = response.data;
        this.total = response.total;
        this.loading = false;
      });
@@ -458,6 +475,13 @@
    getRuleList(item) {
      getRuleListByContractId(item.id).then((response) => {
        this.ruleData = response.data;
        if (this.ruleData) {
          this.ruleName = this.ruleData.map((item) => {
            return item.ruleName;
          });
          this.ruleName = [...new Set(this.ruleName)];
          console.log('this.ruleName', this.ruleName);
        }
        this.form.id = item.id;
        this.contractInfo = item;
      });