695593266@qq.com 10 hónapja
szülő
commit
62ca3006ba

+ 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));
+}

+ 43 - 11
src/components/addDoc/file-edit.vue

@@ -12,6 +12,15 @@
     :maxable="true"
     :resizable="true"
   >
+    <el-tabs
+      v-model="activeName"
+      type="card"
+      @tab-click="handleClick"
+      style="margin-bottom: 10px"
+    >
+      <el-tab-pane label="文档工作区" name="1"></el-tab-pane>
+      <el-tab-pane label="个人文档" name="2"></el-tab-pane>
+    </el-tabs>
     <el-form ref="form" :model="form" :rules="rules" label-width="82px">
       <el-row :gutter="15">
         <el-col :span="24">
@@ -139,6 +148,7 @@
         fileType: 0
       };
       return {
+        activeName: '1',
         rules: {
           businessCodeId: [
             { required: true, message: '请选择', trigger: 'blur' }
@@ -149,6 +159,8 @@
         },
         templateVisible: false,
         folderList: [],
+        allFolderList: [],
+        myFolderList: [],
         list: [],
         options: [],
         defaultForm,
@@ -172,19 +184,34 @@
       ...mapGetters(['user'])
     },
     async created() {
-      let query = {
+      this.allFolderList = await getDocTreeListAPI({
         type: 0,
         currentUserId: this.user.info.userId
-      };
-      this.folderList = await getDocTreeListAPI(query);
+      });
+      this.myFolderList = await getDocTreeListAPI({
+        type: 1,
+        currentUserId: this.user.info.userId
+      });
+      this.folderList = this.allFolderList;
       setFolderList(this.folderList); //权限过滤
     },
     methods: {
+      handleClick() {
+        this.form.directoryId = '';
+        this.form.businessCodeId = '';
+        this.form.codeType = '';
+        if (this.activeName == 2) {
+          this.folderList = this.myFolderList;
+        } else {
+          this.folderList = this.allFolderList;
+        }
+      },
       async getTreeCode() {
         let nodeData = {};
         await this.$nextTick(() => {
           // console.log(this.$refs,'this.$refs')
-          nodeData = this.$refs.cascaderRef&&this.$refs.cascaderRef.getCheckedNodes();
+          nodeData =
+            this.$refs.cascaderRef && this.$refs.cascaderRef.getCheckedNodes();
         });
         this.nodeData = {
           id: nodeData[0]?.data?.id,
@@ -222,13 +249,16 @@
         });
       },
       async typeChange(val) {
-        let data = await listParentId({
+        let obj = {
           pageNum: 1,
           size: 100,
-          parentId: val,
-          objId: this.nodeData?.id,
-          objParentId: this.nodeData?.parentId
-        });
+          parentId: val
+        };
+        if (this.activeName == 1) {
+          obj['objId'] = this.nodeData?.id;
+          obj['objParentId'] = this.nodeData?.parentId;
+        }
+        let data = await listParentId(obj);
         this.options = data.list.filter((item) => item.type == 2);
         this.form.businessCodeId = '';
       },
@@ -244,10 +274,12 @@
             return false;
           }
 
-          const data = {
+          let data = {
             ...this.form
           };
-
+          if (this.activeName == 2) {
+            data.fileType = 1;
+          }
           this.loading = true;
           fileSaveAPI(data)
             .then((msg) => {

+ 1 - 1
src/components/addDoc/getCode.vue

@@ -119,7 +119,7 @@
         this.form.type1 = '';
       },
       async type1Change(val) {
-        this.form.code = await getCode(val);
+        // this.form.code = await getCode(val);
       },
       /* 保存编辑 */
       save() {

+ 1 - 1
src/components/addDoc/main.vue

@@ -186,7 +186,7 @@
       },
       async init() {
         if (this.fileId.length > 0) {
-          if (typeof(this.fileId[0])=='object' ) {
+          if (typeof this.fileId[0] == 'object') {
             this.tableList = [];
           } else {
             this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });

+ 2 - 2
src/components/select/SelectProduct/index.vue

@@ -63,7 +63,7 @@
             type: 'selection',
             width: 45,
             align: 'center',
-            selectable: (row, index) => {
+            selectable: (row) => {
               return !this.processData?.some((it) => it.id == row.id);
             },
             reserveSelection: true,
@@ -201,7 +201,7 @@
       },
       selected() {
         if (!this.selection.length) {
-          this.$message.error('请少选择一条数据');
+          this.$message.error('请少选择一条数据');
           return;
         }
         console.log(this.current);

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

@@ -0,0 +1,90 @@
+<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.values" 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>

+ 383 - 176
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,77 @@
           </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="考核指标限制条件">
+      </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 +119,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,19 +159,42 @@
                 </el-select>
 
                 <el-select
-                  v-model="val.status"
+                  v-if="val.conditionType != 3"
+                  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>
+
+                <!-- 选择产品 -->
+                <div
+                  v-else
+                  class="select-product"
+                  @click="openSelectProduct(val)"
+                >
+                  <el-input
+                    placeholder="请选择产品"
+                    :value="
+                      val.values[0]
+                        ? val.values[0].valJson.map((i) => i.name).join(', ')
+                        : ''
+                    "
+                    readonly
+                    disabled
+                    suffix-icon="el-icon-arrow-right"
+                  />
+                </div>
+
                 <i
                   v-show="index == 0"
                   style="color: #fff; font-size: 16px; margin-left: 5px"
@@ -178,7 +220,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,13 +231,26 @@
               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>
+
+      <SelectProduct
+        ref="SelectProductRef"
+        @chooseProcess="chooseProcess"
+      ></SelectProduct>
     </el-form>
     <div slot="footer">
       <el-button type="primary" @click="handleSave(0)" v-click-once
@@ -205,214 +260,341 @@
     </div>
   </ele-modal>
 </template>
+
 <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';
+  import SelectProduct from '@/components/select/SelectProduct';
 
   const defForm = {
+    id: null,
     name: '',
-    assessmentIndicators: '',
-    assessmentCriteria: [], //条件
-    status: '',
-    type: '',
-    describes: ''
+    indicator: '',
+    indicatorName: '',
+    businessType: '',
+    businessName: '',
+    remark: '',
+    // 条件
+    groups: [],
+    createUserName: '',
+    updateUserName: '',
+    enable: 1,
+    code: ''
   };
-  export default {
-    components: {},
 
-    computed: {
-      ...mapGetters(['user'])
+  const conditionsItem = {
+    className: '',
+    columnComment: '',
+    columnName: '',
+    conditionType: null,
+    compareOperator: '',
+    createUserName: '',
+    groupId: 0,
+    indicatorId: null,
+    logicOperator: 'and',
+    sortNum: 0,
+    tableName: '',
+    fixedCondition: null,
+    updateUserName: '',
+    isSelectAll: 0,
+    values: [],
+    valuesIds: []
+  };
+
+  export default {
+    components: {
+      SelectProduct
     },
     data() {
       return {
         addOrEditDialogFlag: false,
         dialogType: '',
         title: '',
-        form: {
-          ...defForm
-        },
-        tableList: [],
-        valueOptions: [],
+        form: JSON.parse(JSON.stringify(defForm)),
         operatorOptions: [
           {
             name: '属于',
-            value: '1'
+            value: 1
           },
           {
             name: '不属于',
-            value: '2'
+            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,
+        // 当前操作的条件
+        currentItem: null
       };
     },
+    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);
       },
+      addGroups() {
+        if (this.form.businessType === '' || this.form.indicator === '') {
+          return this.$message.warning('请先选择业务类型和考核指标');
+        }
 
-      add() {
-        this.tableList.push([
-          {
-            value: '',
-            operator: '1',
-            status: [],
-            statusOptions: []
-          }
-        ]);
-      },
+        const maxSortNum = this.form.groups.reduce((max, group) => {
+          return group.sortNum > max ? group.sortNum : max;
+        }, 0);
 
-      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;
-        }
-        this.form.indicatorName = data.name;
-        this.tableList.forEach((item) => {
-          item.forEach((_item) => {
-            _item.status = [];
-            _item.statusOptions = [];
-            _item.value = '';
-          });
+        this.form.groups.push({
+          conditions: [{ ...this.newConditionsItem() }],
+          createUserName: this.user.info.name,
+          indicatorId: null,
+          logicOperator: 'or',
+          sortNum: maxSortNum + 1,
+          updateUserName: ''
         });
       },
+      // 添加子条件
+      addItem(item) {
+        const conditionsItem = this.newConditionsItem();
+        conditionsItem.createUserName = this.user.info.name;
 
-      buissChange(val, type) {
-        let data = this.businessTypeList.find((el) => el.value == val);
-        this.options = data.nodes || [];
-        if (type == 'init') {
-          return;
-        }
-        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 = '';
-          });
+        const maxSortNum = item.conditions.reduce((max, condition) => {
+          return condition.sortNum > max ? condition.sortNum : max;
+        }, 0);
+
+        conditionsItem.sortNum = maxSortNum + 1;
+
+        item.conditions.push({
+          ...conditionsItem
         });
       },
-      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);
+      newConditionsItem() {
+        return JSON.parse(JSON.stringify(conditionsItem));
       },
       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.values ||
+                condition.values.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
+          ...JSON.parse(JSON.stringify(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?.values || [];
+      },
+      // 修改条件
+      itemConditionsChange(val) {
+        const item = this.conditionsList.find(
+          (el) => el.columnComment == val.columnComment
+        );
+        console.log('item', item);
+        if (item) {
+          val.columnName = item.columnName;
+          val.tableName = item.tableName;
+          val.className = item.className;
+          val.fixedCondition = item.fixedCondition;
+          val.conditionType = item.conditionType;
+        } else {
+          val.columnName = '';
+          val.tableName = '';
+          val.className = '';
+          val.fixedCondition = null;
+          val.conditionType = null;
+        }
+
+        val.valuesIds = [];
+        val.values = [];
+        val.isSelectAll = 0;
+      },
+      // 修改条件值
+      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
+            };
+          });
+
+        if (val.values.length === list.length) {
+          val.isSelectAll = 1;
+        } else {
+          val.isSelectAll = 0;
+        }
+      },
+      //  考核指标修改同步指标名称
+      indicatorChange() {
+        const item = this.indicatorList.find(
+          (el) => el.indicator == this.form.indicator
+        );
+        this.form.indicatorName = item?.indicatorName || '';
+        // 清空条件
+        this.form.groups = [];
+
+        // 添加一条默认条件
+        this.addGroups();
+      },
+      // 业务类型修改 同步考核指标名称 和 清空条件
+      businessTypeChange() {
+        const item = this.allEnable.find(
+          (el) => el.businessType == this.form.businessType
+        );
+        this.form.businessName = item?.businessName || '';
+        this.form.indicator = '';
+        this.form.indicatorName = '';
+        // 清空条件
+        this.form.groups = [];
+      },
+      // 去选择产品
+      openSelectProduct(item) {
+        this.currentItem = item;
+        this.$refs.SelectProductRef.open([], '选择产品', '9');
+      },
+      // 选择产品完成
+      chooseProcess(productList, current) {
+        console.log('productList', productList);
+        this.currentItem.values = [
+          {
+            conditionId: null,
+            createUserName: this.user.info.name,
+            groupId: null,
+            indicatorId: null,
+            sortNum: 0,
+            updateUserName: this.user.info.name,
+            valJson: productList.map((i) => {
+              return {
+                code: i.code,
+                name: i.name,
+                id: i.id
+              };
+            })
+          }
+        ];
       }
     }
   };
@@ -463,5 +645,30 @@
       }
     }
   }
+
+  .select-product {
+    margin-left: 8px;
+    width: 100%;
+    box-sizing: border-box;
+    position: relative;
+
+    &::after {
+      content: '';
+      width: 100%;
+      height: 100%;
+      position: absolute;
+      top: 0;
+      left: 0;
+      z-index: 1;
+      opacity: 0;
+    }
+
+    :deep(.is-disabled) {
+      .el-input__inner {
+        background-color: #fff;
+        cursor: pointer;
+        color: var(--color-text-regular);
+      }
+    }
+  }
 </style>
-@/api/regulationManagement/index.js

+ 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);
       }
     }
   };

+ 13 - 3
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -298,10 +298,20 @@
       </ele-pro-table>
     </el-form>
     <template v-slot:footer>
-      <el-button :loading="btnLoading" type="primary" @click="saveAndPublish">
+      <el-button
+        v-if="type != 'detail'"
+        :loading="btnLoading"
+        type="primary"
+        @click="saveAndPublish"
+      >
         保存并发布
       </el-button>
-      <el-button :loading="btnLoading" type="primary" @click="confirm">
+      <el-button
+        v-if="type != 'detail'"
+        :loading="btnLoading"
+        type="primary"
+        @click="confirm"
+      >
         保存
       </el-button>
       <el-button :loading="btnLoading" @click="handleClose">取消</el-button>
@@ -523,7 +533,7 @@
         this.type = type;
         console.log('type', type, row);
 
-        if (type == 'edit') {
+        if (type == 'edit' || type == 'detail') {
           this.$util.assignObject(this.formData, row);
 
           this.formData.startDate = new Date(row.startDate);

+ 11 - 1
src/views/rulesManagement/releaseRules/index.vue

@@ -83,6 +83,15 @@
             </template>
           </el-popconfirm>
         </template>
+
+        <template v-slot:code="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="addPermit(row, 'detail', '记录规则详情')"
+            >{{ row.code }}</el-link
+          >
+        </template>
       </ele-pro-table>
     </el-card>
     <permitAdd ref="permitAddRef" @reload="reload" />
@@ -122,7 +131,8 @@
             label: '记录规则编码',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 110,
+            slot: 'code'
           },
           {
             prop: 'name',

+ 33 - 44
src/views/technology/production/components/user-setting-matter-add.vue

@@ -59,7 +59,7 @@
 
       <el-form-item v-if="formData.itemType == '3'" label="关联任务">
         <!-- 下拉选择 -->
-        <el-select
+        <!-- <el-select
           placeholder="请选择关联任务"
           filterable
           clearable
@@ -72,7 +72,12 @@
             :label="task.name"
             :value="task.id"
           />
-        </el-select>
+        </el-select> -->
+        <el-input
+          v-model="formData.itemTaskName"
+          placeholder="请输入任务名称"
+          size="small"
+        ></el-input>
       </el-form-item>
 
       <el-form-item
@@ -160,30 +165,34 @@
       selectReleaseRules
     },
     data() {
+      const formBaseData = {
+        id: null,
+        // 设备id
+        deviceId: null,
+        //设备名称
+        deviceName: '',
+        // 记录规则执行方式,参考字典项:record_rules_execute_method
+        executeMethod: '1',
+        // 记录规则事项类型,参考字典项:record_rules_item_type
+        itemType: '1',
+        // 工序ID
+        produceTaskId: null,
+        // 记录规则报工类型,参考字典项:record_rules_report_work_type
+        reportWorkType: null,
+        // 规则id,包括事项规则id,记录规则id,根据事项类型区分
+        rulesId: null,
+        // 	规则名称
+        rulesName: '',
+        // 任务id
+        taskId: null,
+        itemTaskName: ''
+      };
+
       return {
         visible: false,
         type: 'add', // add新增 edit编辑
-        formData: {
-          id: null,
-          // 设备id
-          deviceId: null,
-          //设备名称
-          deviceName: '',
-          // 记录规则执行方式,参考字典项:record_rules_execute_method
-          executeMethod: '1',
-          // 记录规则事项类型,参考字典项:record_rules_item_type
-          itemType: '1',
-          // 工序ID
-          produceTaskId: null,
-          // 记录规则报工类型,参考字典项:record_rules_report_work_type
-          reportWorkType: null,
-          // 规则id,包括事项规则id,记录规则id,根据事项类型区分
-          rulesId: null,
-          // 	规则名称
-          rulesName: '',
-          // 任务id
-          taskId: null
-        },
+        formBaseData,
+        formData: JSON.parse(JSON.stringify(formBaseData)),
         // 表单验证规则
         rules: {
           // 验证类型、执行方式、设备、关联事项规则
@@ -279,27 +288,7 @@
       // 关闭清空formData
       handleClose() {
         this.visible = false;
-        this.formData = {
-          id: null,
-          // 设备id
-          deviceId: null,
-          //设备名称
-          deviceName: '',
-          // 记录规则执行方式,参考字典项:record_rules_execute_method
-          executeMethod: '1',
-          // 记录规则事项类型,参考字典项:record_rules_item_type
-          itemType: '1',
-          // 工序ID
-          produceTaskId: null,
-          // 记录规则报工类型,参考字典项:record_rules_report_work_type
-          reportWorkType: null,
-          // 规则id,包括事项规则id,记录规则id,根据事项类型区分
-          rulesId: null,
-          // 	规则名称
-          rulesName: '',
-          // 任务id
-          taskId: null
-        };
+        this.formData = JSON.parse(JSON.stringify(this.formBaseData));
         this.$nextTick(() => {
           this.$refs.formRef.clearValidate();
         });

+ 6 - 0
src/views/technology/production/index.vue

@@ -452,6 +452,12 @@
 
       /* 删除 */
       remove(row) {
+        // 规则正在执行中,无法删除
+        // if () {
+        //   this.$message.error('规则正在执行中,无法删除');
+        //   return;
+        // }
+
         const loading = this.$loading({ lock: true });
 
         producetask

+ 0 - 3
vue.config.js

@@ -35,12 +35,9 @@ module.exports = {
         // target: 'http://192.168.1.105:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.1.176:18086',
-
         target: 'http://192.168.1.125:18086',
         // 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',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域