龚焕茏
2024-04-24 4fa44f71fbb58abf9256f8bd872b8e0890f49f9c
合同规则分三层、合同积分新增
3个文件已修改
132 ■■■■■ 已修改文件
src/api/platform/calculate-rule.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/contract/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/score/default/index.vue 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/platform/calculate-rule.js
@@ -17,6 +17,14 @@
  })
}
// 根据运维单位查询违约规则列表
export function getRuleListByUnitId(data) {
  return request({
    url: '/calculate/rule/getRuleListByUnitId?unitId=' + data,
    method: 'get'
  })
}
// 查询违约规则详细
export function getRule(id) {
  return request({
src/views/system/contract/index.vue
@@ -34,8 +34,8 @@
          <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" effect="dark" :content="item.deductCategory + ' ' + item.calcFraction + (item.calcUnit ? '/' + item.calcUnit : '')" placement="top">
                <span>{{ item.ruleCondition }}</span>
              <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">
                <span>{{ item.ruleCondition }}<br/></span>
                <!-- {{ item.deductCategory }} {{ item.calcFraction }}{{ item.calcUnit ? "/" + item.calcUnit : ''  }} -->
            </el-tooltip>
            </div>
@@ -179,6 +179,7 @@
  methods: {
    submitForm() {
      updateContract(this.form).then(response => {
        this.detail = false;
        if (response.code != 200) {
          this.$message.error("操作失败");
        } else {
src/views/system/score/default/index.vue
@@ -164,59 +164,54 @@
    </el-dialog>
    <!-- 新增或修改 -->
    <el-dialog title="运维积分审核" :visible.sync="open" width="700px"append-to-body>
    <el-dialog title="运维积分审核" :visible.sync="open" width="700px" append-to-body>
      <el-form ref="auditingForm" :model="auditingForm" :rules="auditingRules" label-width="120px">
        <el-form-item label="运维考核单位" prop="unitName">
          <el-select v-model="form.unitNameList" placeholder="运维考核单位">
        <el-form-item label="运维考核单位" prop="unitId">
          <el-select v-model="form.unitId" placeholder="运维考核单位" @change="handleChangeUnit">
            <el-option
              v-for="item in unitNameList"
              :key="item.id"
              :label="item.value"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="考核名" prop="examineId">
          <el-select v-model="form.examineId" placeholder="考核名" >
            <el-option
              v-for="item in examineList"
              :key="item.id"
              :label="item.value"
              :value="item.id">
            </el-option>
            v-for="item in unitList"
            :key="item.id"
            :label="item.value"
            :value="item.id">
          </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="运维考核规则" prop="tempRuleFormList">
          <div class="row-warp">
            <div class="row" v-for="(form) in tempRuleFormList">
            <div class="row">
              <div class="row-left">
                <div>规则</div>
                <div class="block">
                  <span class="demonstration"></span>
                  <el-cascader
                    ref="cascader"
                    v-model="value"
                    :options="options"
                    :props = "props"
                    @change="handleChange"></el-cascader>
                    @change="handleChange">
                    <template slot-scope="{ data }">
                      <el-tooltip
                        class="item"
                        :disabled="data.label.length < 16 && !data.deductCategory"
                        effect="dark"
                        :content="data.label.length < 16 ? data.deductCategory ? data.deductCategory + ' ' + data.calcFraction + (data.calcUnit ? '/' + data.calcUnit : '') : '' : (data.deductCategory ? data.label + ' ' + data.deductCategory + ' ' + data.calcFraction + (data.calcUnit ? '/' + data.calcUnit : '') : data.label)"
                        placement="left"
                      >
                        <span>{{ data.label }}</span>
                      </el-tooltip>
                    </template>
                  </el-cascader>
                </div>
              </div>
              <div class="row-right">
              <div class="row-right" v-if="needNum">
                <div>指标</div>
                <div class="margin-5">
                  <el-input type="number" v-model="form.weight"/>
                  <el-input type="number" placeholder="请输入" v-model="form.num" @change="handleChangeNum"/>
                </div>
              </div>
              <div class="item-op">
                <el-button @click="removeRule(form)" type="danger" icon="el-icon-delete" circle></el-button>
              </div>
            </div>
            <div style="margin-top: 25px">
              <el-button type="success" @click="nextAdd" size="mini" plain>添加</el-button>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="运维考核扣分"  style="width: 20%">
          <el-input v-model="auditingForm.score"></el-input>
        <el-form-item label="运维考核扣分"  style="width: 51%">
          <el-input type="number" v-model="form.score"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
@@ -230,33 +225,17 @@
<script>
import { listAuditing, getAuditing, delAuditing, addAuditing, updateAuditing,auditing } from "@/api/platform/contract-score";
import { unitSelect } from "@/api/platform/unit";
import { getRuleListByUnitId } from "@/api/platform/calculate-rule";
export default {
  name: "Auditing",
  data() {
    return {
      options: [{
        value: 'city',
        label: '前端感知源治理工作',
        children: [{
          value: 'fushun',
          label: '时钟同步',
        }, {
          value: 'rong',
          label: 'OSD标识未修复',
        }, {
          value: 'rong',
          label: '一机一档不合格',
        }
        ]
      },
      ],
      needNum: false,
      options: [],
      auditingOpen: false,
      auditingForm: {},
      unitList: [],
      unitNameList: [
        {id:2 , value:"成都x运维"}
        ],
      // 考核模板
      examineList: [
        {id:1 , value:"车辆考核"},
@@ -314,8 +293,36 @@
    this.getUnitSelect();
  },
  methods: {
    handleChange(value) {
      console.log(value);
    handleChange() {
      let item = this.$refs['cascader'].getCheckedNodes()[0].data;
      console.log("item", item);
      if (item.deductCategory == "扣指定分数") {
        this.needNum = false;
        this.form.score = item.calcFraction;
      } else {
        this.needNum = true;
        this.form.score = null;
      }
    },
    handleChangeNum() {
      // 算分
    },
    handleChangeUnit(value) {
      getRuleListByUnitId(value).then((res) => {
        this.options = this.getTreeData(res.data);
      })
    },
    getTreeData(data){
      for(var i=0;i<data.length;i++){
        if(data[i].children.length<1){
          // children若为空数组,则将children设为undefined
          data[i].children=undefined;
        }else {
          // children若不为空数组,则继续 递归调用 本方法
          this.getTreeData(data[i].children);
        }
      }
      return data;
    },
    // 提交审核
    submitAuditing() {
@@ -489,4 +496,8 @@
  flex-direction: row;
}
</style>
<style>
.el-cascader-node {
  max-width: 300px;
}
</style>