Explorar o código

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

yusheng hai 8 meses
pai
achega
41cbe801f3

+ 75 - 0
src/api/indicator/index.js

@@ -0,0 +1,75 @@
+import request from '@/utils/request';
+
+// 获取启用的业务类型列表
+export async function getBusinessTypes(id) {
+  const res = await request.get(`/main/indicatordefinition/getBusinessTypes`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取业务类型分页列表 /main/indicator/page
+export async function getIndicatorPage(body) {
+  const res = await request.post(`/main/indicator/page`, body);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// /main/indicatordefinition/allEnable 查询所有启用的指标定义、条件定义、条件值定义
+export async function getAllEnable() {
+  const res = await request.post(`/main/indicatordefinition/allEnable`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// /main/indicator/save 保存
+export async function saveIndicator(body) {
+  const res = await request.post(`/main/indicator/save`, body);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// /main/indicator/update 修改
+export async function updateIndicator(body) {
+  const res = await request.put(`/main/indicator/update`, body);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// /main/indicator/getById/{id} 根据id查询
+export async function getIndicatorById(id) {
+  const res = await request.get(`/main/indicator/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//  /main/indicator/logicDeleteByIds 逻辑删除
+export async function logicDeleteByIds(body) {
+  const res = await request.delete(`/main/indicator/logicDeleteByIds`, {
+    data: body
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// /main/indicatordefinition/page 指标定义分页列表
+export async function getIndicatorDefinitionPage(body) {
+  const res = await request.post(`/main/indicatordefinition/page`, body);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 94 - 0
src/views/indicator/components/definitionDetials.vue

@@ -0,0 +1,94 @@
+<template>
+  <ele-modal
+    :title="title"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    @close="handleClose"
+    resizable
+    maxable
+    width="60%"
+  >
+    <div>
+      <ele-pro-table
+        ref="table"
+        row-key="id"
+        :columns="columns"
+        :datasource="list"
+      >
+        <template v-slot:expand="{ row }">
+          <el-table
+            :data="row.indicatorAttributeDefinitions"
+            border
+            style="width: 100%"
+          >
+            <el-table-column type="index" width="50" label="序号">
+            </el-table-column>
+            <el-table-column prop="name" label="选项"> </el-table-column>
+          </el-table>
+        </template>
+      </ele-pro-table>
+    </div>
+
+    <template v-slot:footer>
+      <el-button type="primary" @click="handleClose">确 定</el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+
+  export default {
+    mixins: [dictMixins],
+    data() {
+      return {
+        visible: false,
+        title: '详情',
+        list: []
+      };
+    },
+    computed: {
+      columns() {
+        return [
+          {
+            width: 50,
+            type: 'expand',
+            columnKey: 'expand',
+            align: 'center',
+            slot: 'expand'
+          },
+          {
+            width: 50,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            label: '序号'
+          },
+          {
+            prop: 'columnComment',
+            label: '条件名称',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true
+          }
+        ];
+      }
+    },
+    methods: {
+      // 外部调用,打开弹窗
+      open(list) {
+        this.list = list;
+        console.log('this.list', this.list);
+        this.visible = true;
+      },
+      // 关闭时清理表单
+      handleClose() {
+        this.visible = false;
+      },
+      // 提交
+      submit() {}
+    }
+  };
+</script>
+
+<style scoped lang="scss"></style>

+ 150 - 0
src/views/indicator/definition.vue

@@ -0,0 +1,150 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <seek-page :seekList="seekList" @search="search"></seek-page>
+      <ele-pro-table
+        ref="table"
+        row-key="id"
+        :columns="columns"
+        :datasource="datasource"
+        :cache-key="cacheKeyUrl"
+        autoAmendPage
+      >
+        <!-- <template v-slot:toolbar>
+          <el-button type="primary" size="mini">新建</el-button>
+        </template> -->
+        <template v-slot:action="{ row }">
+          <el-button type="text" size="mini" @click="openDetails(row)"
+            >查看条件</el-button
+          >
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <definitionDetials ref="detailsRef"></definitionDetials>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import { getIndicatorDefinitionPage } from '@/api/indicator';
+  import { getAllEnable } from '@/api/indicator/index.js';
+  import definitionDetials from './components/definitionDetials.vue';
+  import list from '@/i18n/lang/zh_CN/list';
+
+  export default {
+    mixins: [dictMixins, tableColumnsMixin],
+    components: { definitionDetials },
+    data() {
+      return {
+        columns: [
+          {
+            width: 50,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            label: '序号'
+          },
+          {
+            prop: 'businessName',
+            label: '业务类型',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return row.businessName + '-' + row.indicatorName;
+            }
+          },
+          {
+            prop: 'enable',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            formatter: (row) => {
+              return row.enable == 1 ? '启用' : '禁用';
+            }
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 220,
+            align: 'center',
+            resizable: false,
+            fixed: 'right',
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+        cacheKeyUrl: 'main-259271505-definition-table',
+        allEnable: []
+      };
+    },
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '工单编码:',
+            value: 'workOrderCode',
+            type: 'input',
+            placeholder: '请输入'
+          }
+        ];
+      }
+    },
+    created() {
+      this.getAllEnable();
+    },
+    methods: {
+      // 刷新表格
+      reload(where = {}) {
+        this.$refs.table.reload({
+          where
+        });
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        // 参数
+        const body = {
+          ...where,
+          ...order,
+          pageNum: page,
+          size: limit
+        };
+        return getIndicatorDefinitionPage(body);
+      },
+      search(where) {
+        this.reload(where);
+      },
+      // 查看详情
+      openDetails(row) {
+        console.log('row', row);
+        const businessTypeItem = this.allEnable.find(
+          (item) => item.businessType == row.businessType
+        );
+        const indicatorDefinitions =
+          businessTypeItem?.indicatorDefinitions.find(
+            (item) => item.indicator == row.indicator
+          );
+        this.$refs.detailsRef?.open(
+          indicatorDefinitions?.indicatorConditionDefinitions || []
+        );
+      },
+      // 获取所有启用的业务类型
+      async getAllEnable() {
+        const data = await getAllEnable();
+        this.allEnable = data;
+        console.log('this.allEnable', this.allEnable);
+      }
+    }
+  };
+</script>
+
+<style></style>

+ 10 - 6
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -428,7 +428,7 @@
                     <el-form-item prop="baseCount" label="基本数量">
                       <el-input
                         placeholder="请输入"
-                        :disabled="isView"
+                        disabled
                         v-model.number="form.baseCount"
                       >
                       </el-input>
@@ -1653,11 +1653,15 @@
         this.resourceBomId = resourceBomId;
         this.attributeData = attributeData;
 
-        if (rowData.baseCount) {
-          this.form.baseCount = rowData.baseCount;
-        } else {
-          this.form.baseCount = 1;
-        }
+        this.form.baseCount = attributeData.baseCount;
+
+        // if (rowData.baseCount) {
+        //   this.form.baseCount = rowData.baseCount;
+        // } else {
+        //   this.form.baseCount = attributeData.baseCount
+        //     ? attributeData.baseCount
+        //     : 1;
+        // }
 
         // if (this.attributeData) {
         //   this.form.baseCount = this.attributeData.baseCount;

+ 279 - 174
src/views/regulationManagement/components/addOrEditDialog.vue

@@ -17,6 +17,7 @@
       class="el-form-box"
       :model="form"
       label-width="90px"
+      v-loading="loading"
     >
       <headerTitle title="基本信息"></headerTitle>
       <el-row>
@@ -26,58 +27,86 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="业务类型" prop="type">
+          <el-form-item label="业务类型" prop="businessType">
             <el-select
-              @change="buissChange"
-              v-model="form.type"
+              v-model="form.businessType"
               placeholder="请选择"
               style="width: 100%"
+              @change="businessTypeChange"
             >
               <el-option
-                v-for="item in businessTypeList"
-                :key="item.value"
-                :label="item.name"
-                :value="item.value"
+                v-for="item in allEnable"
+                :key="item.businessType"
+                :label="item.businessName"
+                :value="item.businessType"
               >
               </el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="考核指标" prop="assessmentIndicators">
+          <el-form-item label="考核指标" prop="indicator">
             <el-select
-              @change="salesChange"
-              v-model="form.assessmentIndicators"
+              v-model="form.indicator"
               placeholder="请选择"
               style="width: 100%"
+              @change="indicatorChange"
             >
               <el-option
-                v-for="item in options"
-                :key="item.value"
-                :label="item.name"
-                :value="item.value"
+                v-for="item in indicatorList"
+                :key="item.indicator"
+                :label="item.indicatorName"
+                :value="item.indicator"
               >
               </el-option>
             </el-select>
           </el-form-item>
         </el-col>
+      </el-row>
+
+      <el-row style="margin-top: 20px">
         <el-col :span="8">
           <el-form-item label="编码" prop="code">
-            <el-input v-model="form.code" disabled></el-input>
+            <el-input
+              v-model="form.code"
+              disabled
+              placeholder="系统自动生成"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="是否启用" prop="status">
+            <el-switch
+              v-model="form.enable"
+              :active-value="1"
+              :inactive-value="0"
+              active-text="启用"
+              inactive-text="停用"
+            ></el-switch>
           </el-form-item>
         </el-col>
-        <el-col :span="16">
-          <el-form-item label="描述" prop="describes">
-            <el-input v-model="form.describes" type="textarea"></el-input>
+        <el-col :span="10">
+          <el-form-item label="描述" prop="remark">
+            <el-input v-model="form.remark" type="textarea"></el-input>
           </el-form-item>
         </el-col>
       </el-row>
 
-      <headerTitle title="考核指标限制条件"></headerTitle>
+      <headerTitle style="margin-top: 20px" title="考核指标限制条件">
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-plus"
+          class="ele-btn-icon"
+          @click="addGroups"
+        >
+          添加筛选器
+        </el-button>
+      </headerTitle>
       <el-row>
         <el-col
           :span="24"
-          v-for="(item, i) in tableList"
+          v-for="(item, i) in form.groups"
           :key="i"
           style="margin-top: 15px"
         >
@@ -99,34 +128,33 @@
               ></span>
               <i class="leftLine"></i>
               <div class="rightLine">
-                <i v-for="(val, index) in item" :key="index"></i>
+                <i v-for="(val, index) in item.conditions" :key="index"></i>
                 <i></i>
-                <!-- <i></i> -->
               </div>
             </div>
             <div class="right">
               <div
                 class="rightItem"
-                v-for="(val, index) in item"
+                v-for="(val, index) in item.conditions"
                 :key="index"
                 :style="{ marginTop: index == 0 ? '' : '20px' }"
               >
                 <el-select
-                  v-model="val.value"
+                  v-model="val.columnComment"
                   placeholder="请选择"
                   style="width: 100%"
+                  @change="itemConditionsChange(val)"
                 >
                   <el-option
-                    v-for="item in valueOptions"
-                    :key="item.value"
-                    :label="item.name"
-                    :value="item.value"
-                    @click.native="valChange(item, val)"
+                    v-for="item in conditionsList"
+                    :key="item.id"
+                    :label="item.columnComment"
+                    :value="item.columnComment"
                   >
                   </el-option>
                 </el-select>
                 <el-select
-                  v-model="val.operator"
+                  v-model="val.compareOperator"
                   placeholder="请选择"
                   style="width: 100%; margin-left: 8px"
                 >
@@ -140,16 +168,18 @@
                 </el-select>
 
                 <el-select
-                  v-model="val.status"
+                  v-model="val.valuesIds"
                   multiple
                   placeholder="请选择"
                   style="width: 100%; margin-left: 8px"
+                  :key="val.value + '_status'"
+                  @change="valuesChange(val)"
                 >
                   <el-option
-                    v-for="item in val.statusOptions"
-                    :key="item.value"
+                    v-for="item in getStatusOptions(val)"
+                    :key="item.id"
                     :label="item.name"
-                    :value="item.value"
+                    :value="item.val"
                   >
                   </el-option>
                 </el-select>
@@ -178,7 +208,7 @@
           </div>
           <el-divider>或</el-divider>
         </el-col>
-        <el-col :span="24">
+        <el-col v-if="form.groups && form.groups.length" :span="24">
           <el-form-item
             label-width="50px"
             prop="branchName"
@@ -189,12 +219,20 @@
               type="primary"
               icon="el-icon-plus"
               class="ele-btn-icon"
-              @click="add()"
+              @click="addGroups"
             >
               继续添加筛选器
             </el-button>
           </el-form-item>
         </el-col>
+        <el-col v-else :span="24">
+          <!-- 提示 请先选择 业务类型 和 考核指标 -->
+          <div>
+            <el-empty
+              description="请先选择 业务类型 和 考核指标 后添加筛选器"
+            ></el-empty>
+          </div>
+        </el-col>
       </el-row>
     </el-form>
     <div slot="footer">
@@ -208,39 +246,34 @@
 <script>
   import { mapGetters } from 'vuex';
   import {
-    targetDefinitionSave,
-    getIndicatorRootNodeList
-  } from '@/api/regulationManagement/index.js';
-  import {
-    salesRegulationOption,
-    // assessmentIndicatorsOptions,
-    businessTypeList
-  } from './util.js';
+    getAllEnable,
+    saveIndicator,
+    getIndicatorById,
+    updateIndicator
+  } from '@/api/indicator/index.js';
 
   const defForm = {
+    id: null,
     name: '',
-    assessmentIndicators: '',
-    assessmentCriteria: [], //条件
+    indicator: '',
+    indicatorName: '',
     status: '',
-    type: '',
-    describes: ''
+    businessType: '',
+    remark: '',
+    // 条件
+    groups: [],
+    createUserName: '',
+    updateUserName: '',
+    enable: 0
   };
   export default {
     components: {},
-
-    computed: {
-      ...mapGetters(['user'])
-    },
     data() {
       return {
         addOrEditDialogFlag: false,
         dialogType: '',
         title: '',
-        form: {
-          ...defForm
-        },
-        tableList: [],
-        valueOptions: [],
+        form: JSON.parse(JSON.stringify(defForm)),
         operatorOptions: [
           {
             name: '属于',
@@ -251,168 +284,240 @@
             value: '2'
           }
         ],
-        businessTypeList: [],
-        // options: assessmentIndicatorsOptions,
-        options: [],
         rules: {
           name: { required: true, message: '请输入', trigger: 'change' },
-          assessmentIndicators: {
+          indicator: {
             required: true,
             message: '请选择',
             trigger: 'change'
           },
-          type: { required: true, message: '请选择', trigger: 'change' }
-        }
+          businessType: { required: true, message: '请选择', trigger: 'change' }
+        },
+        // 业务类型 考核指标 和条件
+        allEnable: [],
+        loading: false
       };
     },
+    computed: {
+      ...mapGetters(['user']),
+      // 获取考核指标列表
+      indicatorList() {
+        const item = this.allEnable.find(
+          (el) => el.businessType == this.form.businessType
+        );
+        return item?.indicatorDefinitions || [];
+      },
+      // 获取考核指标条件值
+      conditionsList() {
+        const item = this.indicatorList.find(
+          (el) => el.indicator == this.form.indicator
+        );
+        return item?.indicatorConditionDefinitions || [];
+      }
+    },
     created() {
-      this.init();
+      this.getAllEnable();
     },
     methods: {
-      async init() {
-        getIndicatorRootNodeList().then((res) => {
-          this.businessTypeList = res;
-        });
-      },
       //初始化
-      async open(row = {}, type, treeType) {
+      async open(row = {}, type) {
+        console.log('row, type', row, type);
         this.addOrEditDialogFlag = true;
         this.title = type == 'add' ? '新增' : '修改';
         this.dialogType = type;
-        if (type !== 'add') {
-          row.assessmentIndicators = Number(row.assessmentIndicators);
-          this.form = JSON.parse(JSON.stringify(row));
-          // 转换value为number类型
-          this.tableList = this.form.assessmentCriteria?.map((i) => {
-            return i.map((j) => {
-              return {
-                ...j,
-                value: Number(j.value)
-              };
-            });
-          });
-          this.buissChange(row.type, 'init');
-          this.salesChange(row.assessmentIndicators, 'init');
+        if (type == 'add') {
+          // 新增
+          this.form.createUserName = this.user.info.name;
         } else {
-          this.add();
-          if (treeType != -1) {
-            this.form.type = treeType;
-            this.buissChange(treeType);
-          }
+          this.getDetails(row.id);
         }
       },
-      addItem(item) {
-        item.push({
-          value: '',
-          operator: '1',
-          status: [],
-          statusOptions: []
+      async getDetails(id) {
+        this.loading = true;
+        const res = await getIndicatorById(id);
+        // 处理 valuesIds 字段
+        res.groups.forEach((group) => {
+          group.conditions.forEach((condition) => {
+            condition.valuesIds = condition.values.map((v) => v.val);
+          });
         });
+        this.$util.assignObject(this.form, res);
+
+        this.loading = false;
+        console.log('this.form', this.form);
       },
       delItem(item, i) {
-        item.splice(i, 1);
+        item.conditions.splice(i, 1);
       },
       del(i) {
-        this.tableList.splice(i, 1);
+        this.form.groups.splice(i, 1);
       },
-
-      add() {
-        this.tableList.push([
-          {
-            value: '',
-            operator: '1',
-            status: [],
-            statusOptions: []
-          }
-        ]);
-      },
-
-      salesChange(val, type) {
-        let data = this.options.find((el) => el.value == val);
-        this.valueOptions = data.nodes;
-        console.log('this.valueOptions', this.valueOptions);
-        this.statusOptions = data.equles;
-        if (type == 'init') {
-          return;
+      addGroups() {
+        if (this.form.businessType === '') {
+          return this.$message.warning('请先选择业务类型');
         }
-        this.form.indicatorName = data.name;
-        this.tableList.forEach((item) => {
-          item.forEach((_item) => {
-            _item.status = [];
-            _item.statusOptions = [];
-            _item.value = '';
-          });
-        });
-      },
-
-      buissChange(val, type) {
-        let data = this.businessTypeList.find((el) => el.value == val);
-        this.options = data.nodes || [];
-        if (type == 'init') {
-          return;
+        if (this.form.indicator === '') {
+          return this.$message.warning('请先选择考核指标');
         }
-        this.form.typeName = data.name;
-        this.form.assessmentIndicators = '';
-        this.valueOptions = [];
-        this.statusOptions = [];
-        this.tableList.forEach((item) => {
-          item.forEach((_item) => {
-            _item.status = [];
-            _item.statusOptions = [];
-            _item.value = '';
-          });
+        this.form.groups.push({
+          conditions: [
+            {
+              className: '',
+              columnComment: '',
+              columnName: '',
+              compareOperator: '',
+              createUserName: '',
+              groupId: 0,
+              indicatorId: null,
+              logicOperator: '',
+              sortNum: 0,
+              tableName: '',
+              fixedCondition: null,
+              updateUserName: '',
+              values: [],
+              valuesIds: []
+            }
+          ],
+          createUserName: this.user.info.name,
+          indicatorId: null,
+          logicOperator: 'or',
+          sortNum: 0,
+          updateUserName: ''
         });
       },
-      valChange(item, val) {
-        // const { statusOption } = salesRegulationOption(
-        //   this.form.assessmentIndicators,
-        //   item.value
-        // );
-        val.statusOptions = item.equals;
-        val.status = [];
-      },
-      //获取详情
-      async getFeeApplyInfoInfo(id) {
-        this.form = await getSettlementAccountInfoAPI(id);
+      // 添加子条件
+      addItem(item) {
+        item.conditions.push({
+          className: '',
+          columnComment: '',
+          columnName: '',
+          compareOperator: '',
+          createUserName: '',
+          groupId: 0,
+          indicatorId: null,
+          logicOperator: '',
+          sortNum: 0,
+          tableName: '',
+          fixedCondition: null,
+          updateUserName: '',
+          values: [],
+          valuesIds: []
+        });
       },
       handleSave(flag) {
+        console.log('this.form', this.form);
         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.value != 0) || val.status.length == 0) {
-                isTrue = false;
+
+          // 判断groups是否有值
+          if (!this.form.groups || this.form.groups.length === 0) {
+            return this.$message.warning('请至少添加一个筛选器');
+          }
+          // 判断每个group的conditions是否有值
+          for (let i = 0; i < this.form.groups.length; i++) {
+            const group = this.form.groups[i];
+            if (!group.conditions || group.conditions.length === 0) {
+              return this.$message.warning('每个筛选器至少添加一个条件');
+            }
+            // 判断每个condition的值是否填写完整
+            for (let j = 0; j < group.conditions.length; j++) {
+              const condition = group.conditions[j];
+              if (
+                !condition.columnComment ||
+                !condition.compareOperator ||
+                !condition.valuesIds ||
+                condition.valuesIds.length === 0
+              ) {
+                return this.$message.warning('请填写完整每个条件的信息');
               }
-            });
-          });
-          if (!isTrue) {
-            return this.$message.warning('请完善考核指标限制条件');
+            }
           }
-          this.form.assessmentCriteria = this.tableList;
-          const id = await targetDefinitionSave(this.form);
-          if (flag) {
-            await this.handleSub(id);
+
+          if (this.dialogType === 'add') {
+            this.form.id = null;
+            this.form.createUserName = this.user.info.name;
+            await saveIndicator(this.form);
+          } else {
+            this.form.updateUserName = this.user.info.name;
+            await updateIndicator(this.form);
           }
-          this.$message.success('操作成功');
-          this.done();
+
+          this.$message.success(
+            this.dialogType === 'add' ? '新增成功' : '修改成功'
+          );
+
+          this.$emit('reload');
+
           this.cancel();
         });
       },
-
-      //刷新主列表数据
-      done() {
-        this.$emit('reload');
-      },
       //关闭弹窗
       cancel() {
         this.form = {
           ...defForm
         };
-        this.options = [];
-        this.tableList = [];
         this.$refs['form'].resetFields();
         this.addOrEditDialogFlag = false;
+      },
+      async getAllEnable() {
+        const data = await getAllEnable();
+        this.allEnable = data;
+      },
+      // 根据 业务类型-》 考核指标-》考核指标条件值 级联获取
+      getStatusOptions(val) {
+        const item = this.conditionsList.find(
+          (el) => el.columnComment == val.columnComment
+        );
+        return item?.indicatorAttributeDefinitions || [];
+      },
+      // 修改条件
+      itemConditionsChange(val) {
+        const item = this.conditionsList.find((el) => el.id == val.indicatorId);
+        if (item) {
+          val.columnName = item.columnName;
+          val.tableName = item.tableName;
+          val.className = item.className;
+          val.fixedCondition = item.fixedCondition;
+        } else {
+          val.columnName = '';
+          val.tableName = '';
+          val.className = '';
+          val.fixedCondition = null;
+        }
+      },
+      // 修改条件值
+      valuesChange(val) {
+        console.log('val', val.values);
+        const list = this.getStatusOptions(val);
+        val.values = list
+          .filter((el) => val.valuesIds.includes(el.val))
+          .map((el) => {
+            return {
+              conditionId: null,
+              createUserName: this.user.info.name,
+              groupId: null,
+              indicatorId: null,
+              sortNum: 0,
+              updateUserName: '',
+              val: el.val
+            };
+          });
+      },
+      //  考核指标修改同步指标名称
+      indicatorChange() {
+        const item = this.indicatorList.find(
+          (el) => el.indicator == this.form.indicator
+        );
+        this.form.indicatorName = item?.indicatorName || '';
+        // 清空条件
+        this.form.groups = [];
+      },
+      // 业务类型修改 同步考核指标名称 和 清空条件
+      businessTypeChange() {
+        this.form.indicator = '';
+        this.form.indicatorName = '';
+        // 清空条件
+        this.form.groups = [];
       }
     }
   };

+ 15 - 32
src/views/regulationManagement/components/leftTree.vue

@@ -17,7 +17,8 @@
 </template>
 
 <script>
-  import { getIndicatorTypeList } from '@/api/regulationManagement';
+  import { getBusinessTypes } from '@/api/indicator';
+
   // let originId = '';
   // let originType = '';
   export default {
@@ -32,8 +33,8 @@
         default: function () {
           return {
             children: 'children',
-            value: 'value',
-            label: 'name'
+            value: 'businessType',
+            label: 'businessName'
           };
         }
       },
@@ -70,8 +71,7 @@
         treeList: [],
         treeLoading: false,
         parentName: '',
-        parentId: '',
-        currentKey: ''
+        parentId: ''
       };
     },
     mounted() {
@@ -87,43 +87,27 @@
       async getTreeData() {
         try {
           this.treeLoading = true;
-          const res = await getIndicatorTypeList();
-          this.treeLoading = false;
+          const res = await getBusinessTypes();
           let data = [
             {
-              name: '全部',
-              value: -1,
+              id: 1,
+              businessName: '全部',
+              businessType: null,
               children: res
             }
           ];
           console.log(data, 'data');
           this.treeList = data;
+
           this.$nextTick(() => {
             // 默认高亮第一级树节点
             if (this.treeList[0]) {
-              this.setCurrentKey(this.treeList[0].value);
-              this.handleNodeClick(this.treeList[0], 'init');
+              this.setCurrentKey(this.treeList[0].id);
             }
           });
-          //   if (res?.code === '0') {
-          //     this.treeList = res.data;
-          //     this.$emit('setRootId', res.data[0].id);
-          //     if (this.treeFormate) {
-          //       this.treeList = this.treeFormate(this.treeList);
-          //     }
-          //     this.$nextTick(() => {
-          //       // 默认高亮第一级树节点
-          //       if (this.treeList[0]) {
-          //         this.setCurrentKey(this.treeList[0].id);
-          //         this.handleNodeClick(
-          //           this.treeList[0],
-          //           this.$refs.tree.getCurrentNode()
-          //         );
-          //       }
-          //     });
-          //     // return this.treeList;
-          //   }
-        } catch (error) {}
+        } catch (error) {
+          this.treeLoading = false;
+        }
         this.treeLoading = false;
       },
 
@@ -132,8 +116,7 @@
       },
       // 设置默认高亮行
       setCurrentKey(id) {
-        this.currentKey = id;
-        this.$refs.tree.setCurrentKey(this.currentKey);
+        this.$refs.tree?.setCurrentKey(id);
       },
 
       // 获取树的选中状态

+ 6 - 6
src/views/regulationManagement/components/searchTable.vue

@@ -13,12 +13,12 @@
       // 表格列配置
       seekList() {
         return [
-          {
-            label: '关键字:',
-            value: 'keyword',
-            type: 'input',
-            placeholder: '编码/名称/考核指标'
-          },
+          // {
+          //   label: '关键字:',
+          //   value: 'keyword',
+          //   type: 'input',
+          //   placeholder: '编码/名称/考核指标'
+          // },
           {
             label: '编码:',
             value: 'code',

+ 47 - 44
src/views/regulationManagement/index.vue

@@ -94,12 +94,6 @@
       </ele-split-layout>
     </el-card>
 
-    <!-- 多选删除弹窗 -->
-    <pop-modal
-      :visible.sync="delVisible"
-      content="是否确定删除?"
-      @done="commitBtn"
-    />
     <add-or-edit-dialog
       ref="addOrEditDialogRef"
       @reload="reload"
@@ -110,16 +104,11 @@
 <script>
   import addOrEditDialog from './components/addOrEditDialog.vue';
   import searchTable from './components/searchTable.vue';
-  import {
-    // assessmentIndicatorsOptions,
-    businessTypeList
-  } from './components/util.js';
-  import {
-    targetDefinitionPage,
-    targetDefinitionDel
-  } from '@/api/regulationManagement/index.js';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import AssetTree from './components/leftTree.vue';
+  import { getIndicatorPage, logicDeleteByIds } from '@/api/indicator';
+  import { getAllEnable } from '@/api/indicator/index.js';
+
   export default {
     mixins: [tabMixins],
     components: {
@@ -131,17 +120,18 @@
       return {
         // 加载状态
         loading: false,
-        delVisible: false,
         addOrEditDialogFlag: false,
         selection: [],
         cacheKeyUrl: 'mian-1ee05028-salesRegulation',
         columnsVersion: 1,
-        treeType: -1
+        treeType: null,
+        // 业务类型 考核指标 和条件
+        allEnable: []
       };
     },
     computed: {
       columns() {
-      let columnsVersion=this.columnsVersion
+        let columnsVersion = this.columnsVersion;
         return [
           {
             width: 45,
@@ -174,14 +164,15 @@
           },
           {
             minWidth: 200,
-            prop: 'typeName',
+            prop: 'businessType',
             label: '业务类型',
             slot: 'type',
             align: 'center',
-            showOverflowTooltip: true
-            // formatter: (row, column, val) => {
-            //   return businessTypeList.find((item) => item.value == val)?.label;
-            // }
+            showOverflowTooltip: true,
+            formatter: (row, column, val) => {
+              return this.allEnable.find((item) => item.businessType == val)
+                ?.businessName;
+            }
           },
           {
             minWidth: 200,
@@ -195,17 +186,17 @@
             // }
           },
 
-          // {
-          //   minWidth: 80,
-          //   prop: 'status',
-          //   label: '状态',
-          //   align: 'center',
-          //   slot: 'modelType',
-          //   showOverflowTooltip: true,
-          //   formatter: (row, column) => {
-          //     return row.status ? '启用' : '停用';
-          //   }
-          // },
+          {
+            minWidth: 80,
+            prop: 'enable',
+            label: '状态',
+            align: 'center',
+            slot: 'modelType',
+            showOverflowTooltip: true,
+            formatter: (row, column) => {
+              return row.enable ? '启用' : '停用';
+            }
+          },
           {
             minWidth: 100,
             prop: 'createUserName',
@@ -234,11 +225,13 @@
         ];
       }
     },
-    created() {},
+    created() {
+      this.getAllEnable();
+    },
     methods: {
       //新增、修改
       handleAddOrEdit(row = {}, type) {
-        this.$refs.addOrEditDialogRef.open(row, type, this.treeType);
+        this.$refs.addOrEditDialogRef.open(row, type);
       },
       //新增、修改
       handleDetail(row = {}, type) {
@@ -250,11 +243,11 @@
 
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
-        return targetDefinitionPage({
+        return getIndicatorPage({
           pageNum: page,
           size: limit,
           ...where,
-          type: this.treeType
+          businessType: this.treeType
         });
       },
 
@@ -273,27 +266,32 @@
           return this.$message.warning(
             '抱歉已审核、审核中的数据不能删除,请检查'
           );
-        this.delVisible = true;
+
+        this.$confirm('是否确定删除?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.commitBtn();
+        });
       },
 
       commitBtn() {
         const dataId = this.selection.map((v) => v.id);
-        settlementAccountRemoveAPI(dataId).then((res) => {
+        logicDeleteByIds(dataId).then((res) => {
           this.$message.success('删除成功!');
           this.reload();
         });
       },
       remove(row) {
-        targetDefinitionDel(row).then((res) => {
+        logicDeleteByIds(row).then((res) => {
           this.$message.success('删除成功!');
           this.reload();
         });
       },
       handleNodeClick(node, type) {
-        this.treeType = node.value;
-        if (type !== 'init') { 
-          this.reload();
-        }
+        this.treeType = node.businessType;
+        this.reload();
         console.log(node, 'node 333');
       },
       sub(res) {
@@ -307,6 +305,11 @@
           .catch((e) => {
             this.$message.error(e.message);
           });
+      },
+      async getAllEnable() {
+        const data = await getAllEnable();
+        this.allEnable = data;
+        console.log('this.allEnable', this.allEnable);
       }
     }
   };

+ 2 - 2
vue.config.js

@@ -40,8 +40,8 @@ module.exports = {
         // target: 'http://192.168.1.251:18186',
 
         // target: 'http://192.168.1.251:18087',
-        target: 'http://192.168.1.251:18086',
-        // target: 'http://192.168.1.116:18086',
+        // target: 'http://192.168.1.251:18086', // 开发
+        target: 'http://192.168.1.116:18086', // 赵沙金
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {