yusheng пре 10 месеци
родитељ
комит
a3c396e674

+ 72 - 0
src/api/regulationManagement/index.js

@@ -0,0 +1,72 @@
+import request from '@/utils/request';
+
+
+/**
+ * 获取指标列表
+ */
+export async function targetDefinitionPage(data) {
+    const res = await request.post(`/eom/target_definition/page `, data);
+    if (res.data.code == 0) {
+        return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 保存修改指标
+ */
+export async function targetDefinitionSave(data) {
+    const res = await request.post(`/eom/target_definition/` +( data.id ? 'update' : 'save'), data);
+    if (res.data.code == 0) {
+        return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+
+// 删除指标
+export async function targetDefinitionDel(data) {
+    const res = await request.delete(`/eom/target_definition/delete`, {data});
+    if (res.data.code == 0) {
+        return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 获取目标列表
+ */
+ export async function salesTargetPage(data) {
+    const res = await request.post(`/eom/sales_target/page`, data);
+    if (res.data.code == 0) {
+        return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 保存修改目标
+ */
+ export async function salesTargetSave(data) {
+    const res = await request.post(`/eom/sales_target/` +( data.id ? 'update' : 'save'), data);
+    if (res.data.code == 0) {
+        return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+// 删除指标
+export async function settlementAccountRemoveAPI(data) {
+    const res = await request.delete(`/eom/sales_target/delete`, {data});
+    if (res.data.code == 0) {
+        return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+
+// 获取详情
+export async function getById(id) {
+    const res = await request.get(`/eom/sales_target/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  }

+ 400 - 0
src/views/regulationManagement/components/addOrEditDialog.vue

@@ -0,0 +1,400 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :visible.sync="addOrEditDialogFlag"
+    :title="title"
+    :append-to-body="false"
+    :close-on-click-modal="false"
+    width="1000px"
+    :before-close="cancel"
+    :maxable="true"
+    :resizable="true"
+  >
+    <el-form
+      ref="form"
+      :rules="rules"
+      class="el-form-box"
+      :model="form"
+      label-width="90px"
+    >
+      <headerTitle title="基本信息"></headerTitle>
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="编码" prop="code">
+            <el-input v-model="form.code" disabled></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="名称" prop="name">
+            <el-input v-model="form.name"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="考核指标" prop="assessmentIndicators">
+            <el-select
+              @change="salesChange"
+              v-model="form.assessmentIndicators"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in options"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="24">
+          <el-form-item label="描述" prop="describes">
+            <el-input v-model="form.describes" type="textarea"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <headerTitle title="考核指标限制条件"></headerTitle>
+      <el-row>
+        <el-col
+          :span="24"
+          v-for="(item, i) in tableList"
+          :key="i"
+          style="margin-top: 15px"
+        >
+          <div class="itemDiv">
+            <div class="left">
+              <span
+                >且(AND)
+                <i
+                  v-show="i == 0"
+                  style="color: #fff; font-size: 16px; margin-bottom: 5px"
+                  class="el-icon-circle-close"
+                ></i>
+                <i
+                  v-show="i != 0"
+                  style="color: red; font-size: 16px; margin-bottom: 5px"
+                  class="el-icon-circle-close"
+                  @click="del(i)"
+                ></i
+              ></span>
+              <i class="leftLine"></i>
+              <div class="rightLine">
+                <i v-for="(val, index) in item" :key="index"></i>
+                <i></i>
+                <!-- <i></i> -->
+              </div>
+            </div>
+            <div class="right">
+              <div
+                class="rightItem"
+                v-for="(val, index) in item"
+                :key="index"
+                :style="{ marginTop: index == 0 ? '' : '20px' }"
+              >
+                <el-select
+                  v-model="val.value"
+                  placeholder="请选择"
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in valueOptions"
+                    :key="item.value"
+                    :label="item.name"
+                    :value="item.value"
+                    @click.native="valChange(item, val)"
+                  >
+                  </el-option>
+                </el-select>
+                <el-select
+                  v-model="val.operator"
+                  placeholder="请选择"
+                  style="width: 100%; margin-left: 8px"
+                >
+                  <el-option
+                    v-for="item in operatorOptions"
+                    :key="item.value"
+                    :label="item.name"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+
+                <el-select
+                  v-model="val.status"
+                  multiple
+                  placeholder="请选择"
+                  style="width: 100%; margin-left: 8px"
+                >
+                  <el-option
+                    v-for="item in val.statusOptions"
+                    :key="item.value"
+                    :label="item.name"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+                <i
+                  v-show="index == 0"
+                  style="color: #fff; font-size: 16px; margin-left: 5px"
+                  class="el-icon-circle-close"
+                ></i>
+                <i
+                  v-show="index != 0"
+                  style="color: red; font-size: 16px; margin-left: 5px"
+                  class="el-icon-circle-close"
+                  @click="delItem(item, index)"
+                ></i>
+              </div>
+              <div style="margin-top: 20px" class="rightItem">
+                <i
+                  @click="addItem(item)"
+                  class="el-icon-circle-plus-outline"
+                ></i>
+              </div>
+              <!-- <div style="margin-top: 20px" class="rightItem">
+                <el-input v-model="form.branchName"></el-input
+              ></div> -->
+            </div>
+          </div>
+          <el-divider>或</el-divider>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item
+            label-width="50px"
+            prop="branchName"
+            style="margin-top: 15px"
+          >
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="add()"
+            >
+              继续添加筛选器
+            </el-button>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <div slot="footer">
+      <el-button type="primary" @click="handleSave(0)" v-click-once
+        >保存</el-button
+      >
+      <el-button @click="cancel">返回</el-button>
+    </div>
+  </ele-modal>
+</template>
+<script>
+  import { mapGetters } from 'vuex';
+  import { targetDefinitionSave } from '@/api/regulationManagement/index.js';
+  import {
+    salesRegulationOption,
+    assessmentIndicatorsOptions
+  } from './util.js';
+
+  const defForm = {
+    name: '',
+    assessmentIndicators: '',
+    assessmentCriteria: [], //条件
+    status: '',
+    type: '',
+    describes: ''
+  };
+  export default {
+    components: {},
+
+    computed: {
+      ...mapGetters(['user'])
+    },
+    data() {
+      return {
+        addOrEditDialogFlag: false,
+        dialogType: '',
+        title: '',
+        form: {
+          ...defForm
+        },
+        tableList: [],
+        valueOptions: [],
+        operatorOptions: [
+          {
+            name: '属于',
+            value: '1'
+          },
+          {
+            name: '不属于',
+            value: '2'
+          }
+        ],
+        options: assessmentIndicatorsOptions,
+        rules: {
+          name: { required: true, message: '请输入', trigger: 'change' },
+          assessmentIndicators: {
+            required: true,
+            message: '请选择',
+            trigger: 'change'
+          }
+        }
+      };
+    },
+    created() {},
+    methods: {
+      //初始化
+      async open(row = {}, type) {
+        this.addOrEditDialogFlag = true;
+        this.title = type == 'add' ? '新增' : '修改';
+        this.dialogType = type;
+        if (type !== 'add') {
+          this.form = JSON.parse(JSON.stringify(row));
+          this.tableList = this.form.assessmentCriteria;
+          const { valueOption } = salesRegulationOption(
+            this.form.assessmentIndicators
+          );
+          this.valueOptions = valueOption;
+        } else {
+          this.add();
+        }
+      },
+      addItem(item) {
+        item.push({
+          value: '',
+          operator: '1',
+          status: [],
+          statusOptions: []
+        });
+      },
+      delItem(item, i) {
+        item.splice(i, 1);
+      },
+      del(i) {
+        this.tableList.splice(i, 1);
+      },
+
+      add() {
+        this.tableList.push([
+          {
+            value: '',
+            operator: '1',
+            status: [],
+            statusOptions: []
+          }
+        ]);
+      },
+
+      salesChange(val) {
+        const { valueOption, statusOption } = salesRegulationOption(val);
+        this.valueOptions = valueOption;
+        this.statusOptions = statusOption;
+        this.tableList.forEach((item) => {
+          item.forEach((_item) => {
+            _item.status = [];
+            _item.statusOptions = [];
+            _item.value = '';
+          });
+        });
+      },
+      valChange(item, val) {
+        const { statusOption } = salesRegulationOption(
+          this.form.assessmentIndicators,
+          item.value
+        );
+        val.statusOptions = statusOption;
+        val.status = [];
+      },
+      //获取详情
+      async getFeeApplyInfoInfo(id) {
+        this.form = await getSettlementAccountInfoAPI(id);
+      },
+      handleSave(flag) {
+        this.$refs.form.validate(async (valid) => {
+          if (!valid) return this.$message.warning('有必填项未填,请检查');
+          let isTrue = true;
+          this.tableList.forEach((item) => {
+            item.forEach((val) => {
+              if (!val.value || val.status.length == 0) {
+                isTrue = false;
+              }
+            });
+          });
+          if (!isTrue) {
+            return this.$message.warning('请完善考核指标限制条件');
+          }
+          this.form.assessmentCriteria = this.tableList;
+          const id = await targetDefinitionSave(this.form);
+          if (flag) {
+            await this.handleSub(id);
+          }
+          this.$message.success('操作成功');
+          this.done();
+          this.cancel();
+        });
+      },
+
+      //刷新主列表数据
+      done() {
+        this.$emit('reload');
+      },
+      //关闭弹窗
+      cancel() {
+        this.form = {
+          ...defForm
+        };
+        this.tableList = [];
+        this.addOrEditDialogFlag = false;
+      }
+    }
+  };
+</script>
+<style scoped lang="scss">
+  .itemDiv {
+    display: flex;
+    .left {
+      display: flex;
+      align-items: center;
+      span {
+        height: 100%;
+        display: flex;
+        align-items: center;
+      }
+      .leftLine {
+        height: calc(100% - 30px);
+        width: 1px;
+        background: #dddddd;
+        margin-left: 10px;
+      }
+      .rightLine {
+        display: flex;
+        flex-direction: column;
+        justify-content: space-between;
+        height: calc(100% - 30px);
+
+        i {
+          height: 1px;
+          width: 20px;
+          background: #dddddd;
+        }
+      }
+    }
+    .right {
+      display: flex;
+      flex-direction: column;
+      width: calc(100% - 150px);
+    }
+    .rightItem {
+      height: 45px;
+      display: flex;
+      align-items: center;
+      i {
+        font-size: 28px;
+        color: #ddd;
+        cursor: pointer;
+      }
+    }
+  }
+</style>
+@/api/regulationManagement/index.js

+ 70 - 0
src/views/regulationManagement/components/searchTable.vue

@@ -0,0 +1,70 @@
+<!-- 搜索表单 -->
+<template>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
+</template>
+<script>
+  import { reviewStatusSelect, saleOrderProgressStatusEnum } from '@/enum/dict';
+  import { assessmentIndicatorsOptions } from './util.js';
+  export default {
+    data() {
+      return {};
+    },
+    computed: {
+      // 表格列配置
+      seekList() {
+        return [
+          {
+            label: '关键字:',
+            value: 'searchName',
+            type: 'input',
+            placeholder: '编码/名称/创建人'
+          },
+          {
+            label: '编码:',
+            value: 'code',
+            type: 'input',
+            placeholder: '请输入'
+          },
+          {
+            label: '名称:',
+            value: 'name',
+            type: 'input',
+            placeholder: '请输入'
+          },
+          {
+            label: '考核指标:',
+            value: 'assessmentIndicators',
+            width: 380,
+            type: 'select',
+            placeholder: '请选择状态',
+            planList: assessmentIndicatorsOptions
+          },
+          {
+            label: '创建人:',
+            value: 'createUsername',
+            width: 380,
+            type: 'input',
+            placeholder: '请输入'
+          },
+          {
+            label: '创建时间:',
+            value: 'createTime',
+            type: 'date',
+            dateType: 'datetimerange',
+            placeholder: '',
+            width: 380,
+            valueAr: ['createTimeStart', 'createTimeEnd']
+          }
+        ];
+      }
+    },
+    methods: {
+      /* 搜索 */
+      search(e) {
+        this.$emit('search', {
+          ...e
+        });
+      }
+    }
+  };
+</script>

+ 603 - 0
src/views/regulationManagement/components/util.js

@@ -0,0 +1,603 @@
+import { number } from 'echarts';
+
+//指标定义获取option
+export function salesRegulationOption(assessmentIndicators, value) {
+ 
+  let valueOption = [],
+    statusOption = [];
+  if (assessmentIndicators == 1) {
+    valueOption = [
+      {
+        name: '发票管理',
+        value: '1'
+      },
+      {
+        name: '应收管理',
+        value: '2'
+      }
+    ];
+    if (value == 1) {
+      statusOption = [
+        {
+          name: '未开票',
+          value: '0'
+        },
+        {
+          name: '已开票',
+          value: '1'
+        }
+      ];
+    }
+    if (value == 2) {
+      statusOption = [
+        {
+          name: '未收款',
+          value: 0
+        },
+        {
+          name: '部分收款',
+          value: 1
+        },
+        {
+          name: '已收全款',
+          value: 2
+        }
+      ];
+    }
+  }
+  if (assessmentIndicators == 2) {
+    valueOption = [
+      {
+        name: '合同台账',
+        value: '1'
+      }
+    ];
+    if (value == 1) {
+      statusOption = [
+        {
+          name: '未提交',
+          value: 0
+        },
+        {
+          name: '审核中',
+          value: 1
+        },
+        {
+          name: '已审核',
+          value: 2
+        },
+        {
+          name: '审核不通过',
+          value: 3
+        }
+      ];
+    }
+  }
+  if (assessmentIndicators == 3) {
+    valueOption = [
+      {
+        name: '客户管理',
+        value: '1'
+      }
+    ];
+    if (value == 1) {
+      statusOption = [
+        {
+          name: '禁用',
+          value: 2
+        },
+        {
+          name: '启用',
+          value: 1
+        }
+      ];
+    }
+  }
+  if (assessmentIndicators == 4) {
+    valueOption = [
+      {
+        name: '我的客户',
+        value: '1'
+      }
+    ];
+    if (value == 1) {
+      statusOption = [
+        {
+          name: '客户拜访数',
+          value: 0
+        }
+      ];
+    }
+  }
+  if (assessmentIndicators == 5) {
+    valueOption = [
+      {
+        name: '商机管理',
+        value: '1'
+      }
+    ];
+    if (value == 1) {
+      statusOption = [
+        {
+          name: '未提交',
+          value: 0
+        },
+        {
+          name: '审核中',
+          value: 1
+        },
+        {
+          name: '已审核',
+          value: 2
+        },
+        {
+          name: '审核不通过',
+          value: 3
+        }
+      ];
+    }
+  }
+  if (assessmentIndicators == 6) {
+    valueOption = [
+      {
+        name: '市场管理',
+        value: '1'
+      }
+    ];
+    if (value == 1) {
+      statusOption = [
+        {
+          name: '未提交',
+          value: 0
+        },
+        {
+          name: '审核中',
+          value: 1
+        },
+        {
+          name: '已审核',
+          value: 2
+        },
+        {
+          name: '审核不通过',
+          value: 3
+        }
+      ];
+    }
+  }
+  if (assessmentIndicators == 7) {
+    valueOption = [
+      {
+        name: '发货单',
+        value: '1'
+      }
+    ];
+    if (value == 1) {
+      statusOption = [
+        {
+          name: '未提交',
+          value: 0
+        },
+        {
+          name: '审核中',
+          value: 1
+        },
+        {
+          name: '已审核',
+          value: 2
+        },
+        {
+          name: '审核不通过',
+          value: 3
+        },
+        {
+          name: '已回执',
+          value: 4
+        }
+      ];
+    }
+  }
+  return { valueOption, statusOption };
+}
+//考核指标option
+export const assessmentIndicatorsOptions = [
+  {
+    label: '回款额',
+    value: '1'
+  },
+  {
+    label: '合同额',
+    value: '2'
+  },
+  {
+    label: '客户数',
+    value: '3'
+  },
+  {
+    label: '拜访客户数',
+    value: '4'
+  },
+  {
+    label: '商机数',
+    value: '5'
+  },
+  {
+    label: '来司接待次数',
+    value: '6'
+  },
+  {
+    label: '发货额',
+    value: '7'
+  }
+];
+
+//目标tree
+export function getTargetManageTree(data, type) {
+  let tree = {
+    label: data.name,
+    id: data.id,
+    expand: true,
+    children: [
+      {
+        id: data.id + '-' + '1',
+        label: '年度目标',
+        value: '',
+        pid: data.id,
+        type: '1',
+        unit: '',
+        children: [
+          {
+            id: data.id + '-' + '2',
+            pid: data.id + '-' + '1',
+            label: '1季度目标',
+            value: '',
+            unit: '',
+            ratio: '',
+            type: '2',
+            children: [
+              {
+                id: data.id + '-' + '6',
+                pid: data.id + '-' + '2',
+                label: '1月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '7',
+                pid: data.id + '-' + '2',
+                label: '2月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '8',
+                pid: data.id + '-' + '2',
+                label: '3月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              }
+            ]
+          },
+          {
+            id: data.id + '-' + '3',
+            pid: data.id + '-' + '1',
+            label: '2季度目标',
+            unit: '',
+            ratio: '',
+            value: '',
+            type: '2',
+            children: [
+              {
+                id: data.id + '-' + '9',
+                pid: data.id + '-' + '3',
+                label: '4月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '10',
+                pid: data.id + '-' + '3',
+                label: '5月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '11',
+                pid: data.id + '-' + '3',
+                label: '6月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              }
+            ]
+          },
+          {
+            id: data.id + '-' + '4',
+            pid: data.id + '-' + '1',
+            label: '3季度目标',
+            unit: '',
+            ratio: '',
+            value: '',
+            type: '2',
+            children: [
+              {
+                id: data.id + '-' + '12',
+                pid: data.id + '-' + '4',
+                label: '7月目标',
+                ratio: '',
+                unit: '',
+                value: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '13',
+                pid: data.id + '-' + '4',
+                label: '8月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '14',
+                pid: data.id + '-' + '4',
+                label: '9月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              }
+            ]
+          },
+          {
+            id: data.id + '-' + '5',
+            pid: data.id + '-' + '1',
+            label: '4季度目标',
+            unit: '',
+            ratio: '',
+            value: '',
+            type: '2',
+            children: [
+              {
+                id: data.id + '-' + '15',
+                pid: data.id + '-' + '5',
+                label: '10月目标',
+                value: '',
+                unit: '',
+                ratio: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '16',
+                pid: data.id + '-' + '5',
+                label: '11月目标',
+                ratio: '',
+                unit: '',
+                value: '',
+                type: '3'
+              },
+              {
+                id: data.id + '-' + '17',
+                pid: data.id + '-' + '5',
+                label: '12月目标',
+                unit: '',
+                ratio: '',
+                value: '',
+                type: '3'
+              }
+            ]
+          }
+        ]
+      }
+    ]
+  };
+  if (type == 2) {
+    tree.children = tree.children[0].children;
+  }
+  if (type == 3) {
+    let data = [];
+    tree.children[0].children.forEach((item) => {
+      item.children.forEach((val) => {
+        data.push(val);
+      });
+    });
+    tree.children = data;
+  }
+  return tree;
+}
+//单位选择框
+export function renderSelect(h, data, form, children) {
+  let option = [
+    { name: '个' },
+    { name: '次' },
+    // { name: '十' },
+    // { name: '百' },
+    // { name: '千' },
+    // { name: '万' },
+    // { name: '百万' },
+    { name: '元' },
+    { name: '万元' },
+  ];
+  let disabled = false;
+  if (!data.type) {
+    return;
+  }
+  if (form.type == 1 && data.type != 1) {
+    disabled = true;
+  }
+  if (form.type == 2 && data.type != 2) {
+    disabled = true;
+  }
+  return h(
+    'el-select',
+    {
+      attrs: {
+        value: data.unit, // 设置输入框的值
+        disabled,
+        placeholder: '单位'
+      },
+      on: {
+        change: (value) => {
+          data.unit = value;
+          flattenTree(data, 'select', children);
+        }
+      }
+    },
+    [
+      ...option.map((item) => {
+        return h('el-option', {
+          attrs: {
+            key: item.name,
+            label: item.name,
+            value: item.name
+          }
+        });
+      })
+    ]
+  );
+}
+
+//创建输入框
+export function renderInput(h, data, className, placeholder, form, children) {
+  if (!data.type) {
+    return;
+  }
+  if (className == 'ratioInput') {
+    if (form.type == 2 && data.type == 2) {
+      return;
+    }
+    if (form.type == 3 && data.type == 3) {
+      return;
+    }
+  }
+
+  let disabled = false;
+  if (className == 'valueInput') {
+    if (form.type == 1 && data.type != 1) {
+      disabled = true;
+    }
+    if (form.type == 2 && data.type != 2) {
+      disabled = true;
+    }
+  }
+
+  return h(
+    'el-input',
+    {
+      attrs: {
+        type: 'text',
+        value: data[className == 'ratioInput' ? 'ratio' : 'value'], // 设置输入框的值
+        class: className,
+        placeholder,
+        disabled,
+        max: className == 'ratioInput' ? 100 : '',
+        min: 0
+      },
+      on: {
+        input: (value) => {
+          data[className == 'ratioInput' ? 'ratio' : 'value'] = value; // 监听输入事件,更新数据
+          flattenTree(data, className, children, 'input');
+        },
+        focus: () => {
+          flattenTree(data, className, children, 'focus');
+        }
+      }
+    },
+    [className == 'ratioInput' ? h('slot', { slot: 'suffix' }, ['%']) : '']
+  );
+}
+//占比改变
+function setRatio(data, tree, eventFn) {
+  let ratio = 0;
+  tree.forEach((node) => {
+    if (data.pid == node.pid && data.id !== node.id) {
+      ratio += +node.ratio;
+      if (eventFn == 'focus' && ratio) {
+        data.ratio = 100 - ratio >= 0 ? 100 - ratio : 0;
+      }
+      if (eventFn == 'input') {
+        if (ratio + +data.ratio > 100) {
+          data.ratio = 100 - ratio;
+        }
+      }
+    }
+    if (node.children && node.children.length > 0) {
+      setRatio(data, node.children, eventFn);
+    }
+  });
+}
+//占比改变值改变
+function setValue(data, tree) {
+  tree.forEach((node) => {
+    if (node.id == data.pid) {
+      data.value = +(node.value * (data.ratio / 100)).toFixed(2);
+      //季度占比改变计算月度目标值
+    }
+    if (data.type == '2') {
+      data.children.forEach((val) => {
+        val.value = +(data.value * (val.ratio / 100)).toFixed(2);
+      });
+    }
+    if (node.children && node.children.length > 0) {
+      setValue(data, node.children);
+    }
+  });
+}
+
+//设置单位
+function setSelect(data, tree) {
+  tree.forEach((node) => {
+    if (data.id == node.pid) {
+      node.unit = data.unit;
+      node.children.forEach((val) => {
+        val.unit = data.unit;
+      });
+    }
+    if (node.children && node.children.length > 0) {
+      setSelect(data, node.children);
+    }
+  });
+}
+//改变值
+function setValueInput(data, tree) {
+  tree.forEach((node) => {
+    if (node.pid == data.id) {
+      node.value = +(data.value * (node.ratio / 100)).toFixed(2);
+      //年度目标值改变月度目标
+      if (data.type == '1') {
+        node.children.forEach((val) => {
+          val.value = +(node.value * (val.ratio / 100)).toFixed(2);
+        });
+      }
+    }
+    if (node.children && node.children.length > 0) {
+      setValueInput(data, node.children);
+    }
+  });
+}
+
+// 目标值改变递归更新数据
+function flattenTree(data, className, tree, eventFn) {
+  if (className == 'ratioInput') {
+    setRatio(data, tree, eventFn); //设置占比
+    setValue(data, tree); //占比改变值更新
+  }
+  if (className == 'select') {
+    setSelect(data, tree); //设置单位
+  }
+  //目标值改变根据子级占比计算
+  if (className == 'valueInput') {
+    setValueInput(data, tree); //改变值
+  }
+}

+ 315 - 0
src/views/regulationManagement/index.vue

@@ -0,0 +1,315 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <ele-split-layout
+        width="210px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div>
+          <div class="ele-border-lighter sys-organization-list">
+            <AssetTree
+              @handleNodeClick="handleNodeClick"
+              id="1951461877137543169"
+              :isIds="false"
+              :isFirstRefreshTable="false"
+              ref="treeList"
+            />
+          </div>
+        </div>
+        <template v-slot:content>
+          <search-table @search="reload"></search-table>
+          <!-- 数据表格 -->
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            height="calc(100vh - 325px)"
+            full-height="calc(100vh - 116px)"
+            tool-class="ele-toolbar-form"
+            :selection.sync="selection"
+            :page-size="20"
+            @columns-change="handleColumnChange"
+            :cache-key="cacheKeyUrl"
+          >
+            <!-- 表头工具栏 -->
+            <template v-slot:toolbar>
+              <el-button
+                size="small"
+                type="primary"
+                icon="el-icon-plus"
+                class="ele-btn-icon"
+                @click="handleAddOrEdit('', 'add')"
+              >
+                新建
+              </el-button>
+              <el-button
+                size="small"
+                type="danger"
+                el-icon-delete
+                class="ele-btn-icon"
+                @click="allDelBtn"
+                :disabled="selection?.length === 0"
+              >
+                批量删除
+              </el-button>
+            </template>
+            <!-- 操作 -->
+            <template v-slot:action="{ row }">
+              <el-link
+                type="primary"
+                :underline="false"
+                icon="el-icon-edit"
+                @click="handleAddOrEdit(row, 'update')"
+              >
+                修改
+              </el-link>
+              <el-popconfirm
+                class="ele-action"
+                title="确定要删除此信息吗?"
+                @confirm="remove([row.id])"
+              >
+                <template v-slot:reference>
+                  <el-link
+                    type="danger"
+                    :underline="false"
+                    icon="el-icon-delete"
+                  >
+                    删除
+                  </el-link>
+                </template>
+              </el-popconfirm>
+            </template>
+            <template v-slot:applyUserName="{ row }">
+              <el-link
+                type="primary"
+                :underline="false"
+                @click="handleDetail(row, 'view')"
+              >
+                {{ row.applyUserName }}
+              </el-link>
+            </template>
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+
+    <!-- 多选删除弹窗 -->
+    <pop-modal
+      :visible.sync="delVisible"
+      content="是否确定删除?"
+      @done="commitBtn"
+    />
+    <add-or-edit-dialog
+      ref="addOrEditDialogRef"
+      @reload="reload"
+    ></add-or-edit-dialog>
+  </div>
+</template>
+
+<script>
+  import addOrEditDialog from './components/addOrEditDialog.vue';
+  import searchTable from './components/searchTable.vue';
+  import { assessmentIndicatorsOptions } from './components/util.js';
+  import {
+    targetDefinitionPage,
+    targetDefinitionDel
+  } from '@/api/regulationManagement/index.js';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import AssetTree from '@/components/AssetTree';
+  export default {
+    mixins: [tabMixins],
+    components: {
+      addOrEditDialog,
+      searchTable,
+      AssetTree
+    },
+    data() {
+      return {
+        // 加载状态
+        loading: false,
+        delVisible: false,
+        addOrEditDialogFlag: false,
+        selection: [],
+        cacheKeyUrl: 'mian-1ee05028-salesRegulation',
+        columnsVersion: 1
+      };
+    },
+    computed: {
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            width: 60,
+            label: '序号',
+            type: 'index',
+            columnKey: 'index',
+            align: 'center'
+          },
+          {
+            minWidth: 200,
+            prop: 'code',
+            label: '编码',
+            align: 'center',
+            slot: 'code',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 200,
+            prop: 'name',
+            label: '名称',
+            slot: 'name',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            minWidth: 200,
+            prop: 'assessmentIndicators',
+            label: '考核指标',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row, column, val) => {
+              return assessmentIndicatorsOptions.find(
+                (item) => item.value == val
+              )?.label;
+            }
+          },
+
+          // {
+          //   minWidth: 80,
+          //   prop: 'status',
+          //   label: '状态',
+          //   align: 'center',
+          //   slot: 'modelType',
+          //   showOverflowTooltip: true,
+          //   formatter: (row, column) => {
+          //     return row.status ? '启用' : '停用';
+          //   }
+          // },
+          {
+            minWidth: 100,
+            prop: 'createTime',
+            label: '创建人',
+            align: 'center',
+            slot: 'createTime',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 100,
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            slot: 'createTime',
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 120,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ];
+      }
+    },
+    created() {},
+    methods: {
+      //新增、修改
+      handleAddOrEdit(row = {}, type) {
+        this.$refs.addOrEditDialogRef.open(row, type);
+      },
+      //新增、修改
+      handleDetail(row = {}, type) {
+        this.detailDialogFlag = true;
+        this.$nextTick(() => {
+          this.$refs.detailDialogRef.init(row, type);
+        });
+      },
+
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return targetDefinitionPage({
+          pageNum: page,
+          size: limit,
+          ...where
+        });
+      },
+
+      /* 刷新表格 */
+      reload(where = {}) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+
+      //批量删除
+      allDelBtn() {
+        if (this.selection.length === 0) return;
+        let flag = this.selection.some((item) =>
+          [1, 2].includes(item.approvalStatus)
+        );
+        if (flag)
+          return this.$message.warning(
+            '抱歉已审核、审核中的数据不能删除,请检查'
+          );
+        this.delVisible = true;
+      },
+
+      commitBtn() {
+        const dataId = this.selection.map((v) => v.id);
+        settlementAccountRemoveAPI(dataId).then((res) => {
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      },
+      remove(row) {
+        targetDefinitionDel(row).then((res) => {
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      },
+
+      sub(res) {
+        settlementAccountSubmit({
+          businessId: res.id
+        })
+          .then((res) => {
+            this.$message.success('提交成功');
+            this.reload();
+          })
+          .catch((e) => {
+            this.$message.error(e.message);
+          });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  :deep(.el-link--inner) {
+    margin-left: 0px !important;
+  }
+
+  .sys-organization-list {
+    height: calc(100vh - 264px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
+  }
+
+  .sys-organization-list :deep(.el-tree-node__content) {
+    height: 40px;
+
+    & > .el-tree-node__expand-icon {
+      margin-left: 10px;
+    }
+  }
+</style>