ludc
2024-01-31 df81835dd02eee62527997adf5a4ea2039b51fa4
Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -1,6 +1,6 @@
<template>
  <div>
    <div v-if="this.crudArrayFlag" class="app" style="display: flex;flex-wrap: wrap; display: inline-block">
    <div v-if="this.crudArrayFlag" class="app" style="display: flex;flex-wrap: wrap; display: inline-block;height: 80px">
      <el-button-group>
        <!--新增-->
        <span v-if="permissionList.busineStatus">
@@ -276,8 +276,8 @@
      </el-dialog>
      <!--        全屏编辑-->
      <el-dialog :before-close="escEdit" :visible.sync="attrEditVisible" append-to-body fullscreen="true">
        <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :crudArrayFlag="this.crudArrayFlag"
                  :editOpenFlag="editOpenFlag" :editStyleFlag="editStyleFlag"
        <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :btnAuthList="btnAuthList"
                  :crudArrayFlag="this.crudArrayFlag" :editOpenFlag="editOpenFlag" :editStyleFlag="editStyleFlag"
                  @editCloseChildren="editClose"></attrCrud>
      </el-dialog>
      <!--      组合规则-->
@@ -318,12 +318,27 @@
        :referConfigOption="referConfigOption"
        @setReferConfigValue="setReferConfigValue"
      ></refer-config-dialog>
      <!--近义词查询规则      -->
      <el-dialog :visible.sync="synonymVisible" append-to-body title="近义词查询规则">
          <avue-crud :data="synonymData" :option="synonymOption" v-loading="sysonymLoading" @selection-change="sysChange">
            <template slot="lcStatus" slot-scope="{row}">
              <el-tag v-if="row.lcStatus === 'Released'" type="success">启用</el-tag>
              <el-tag v-else type="danger">停用</el-tag>
            </template>
          </avue-crud>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="sysnonymSubmit">确定</el-button>
          <el-button @click="sysnonymCancel">取消</el-button>
        </div>
      </el-dialog>
    </div>
    <el-table v-if="this.crudArrayFlag"
              ref="referAttrCrud"
              v-loading="loading"
              :data="ProData"
              :header-cell-style="{background:'#FAFAFA',color:'#505050'}"
              :height="this.tableHeight"
              border
              style="width: 100%"
@@ -357,13 +372,15 @@
            @blur="saveRows(row)"
          ></el-input>
          <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'"
                           v-show="!AddCellFlag"
                           v-model="row[item.prop]"
                           :style="{width:(item.width-10)+'px'}"
                           controls-position="right"
                           size="small" @blur="saveRows"></el-input-number>
          <el-select v-if="editingRows === row && editShows== item.prop && item.edit == 'select' " slot="prepend"
                     v-model="row[item.prop]" allow-create default-first-option
                     filterable
          <el-select v-if="editingRows === row && editShows== item.prop && item.edit == 'select' " v-show="!AddCellFlag"
                     slot="prepend"
                     v-model="row[item.prop]" :clearable="true" allow-create
                     default-first-option filterable
                     @blur="selectChangeHandler(item.editConfig,index)">
            <el-option
              v-for="optionItem in item.data"
@@ -397,7 +414,7 @@
</template>
<script>
import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto, listByFlag} from '@/api/template/templateAttr'
import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto, listByFlag,codeSynonym} from '@/api/template/templateAttr'
import {getList} from "@/api/refer/table";
import func from "@/util/func";
import {getCurrentInstance} from "vue";
@@ -448,6 +465,9 @@
      type: Boolean,
      default: false
    },
    btnAuthList: {
      type: Array
    }
  },
  watch: {
    crudOid: {
@@ -512,6 +532,48 @@
  },
  data() {
    return {
      sysSelectData:[],
      sysonymLoading:false,
      synonymOption:{
        addBtn:false,
        editBtn:false,
        delBtn:false,
        refreshBtn:false,
        columnBtn:false,
        menu:false,
        selection:true,
        column:[
          {
            label:'编码',
            prop:'id',
            align:'center'
          },
          {
            label:'名称',
            prop:'name',
            align:'center'
          },
          {
            label:'源值',
            prop:'sourceValue',
            align:'center'
          },
          {
            label:'同义词',
            prop:'synonymValue',
            align:'center'
          },
          {
            label:'启停状态',
            prop:'lcStatus',
            align:'center',
            slot: true
          },
        ]
      },
      synonymData:[],
      //近义词查询规则
      synonymVisible:false,
      //表格高度
      dynamicHeight: '',
      // 保存单元格状态
@@ -1104,6 +1166,10 @@
        indexClassName: "序号",
        indexLabelClassName: '序号',
        index: true,
        indexFixed: false,
        selectionFixed: false,
        columnBtn: false,
        refreshBtn: false,
        border: true,
        addBtn: false,
        menu: false,
@@ -1113,7 +1179,7 @@
          {
            label: "属性英文名称",
            prop: "id",
            width: 100,
            width: 130,
          },
          {
            label: "属性中文名称",
@@ -1277,6 +1343,12 @@
            width: 110,
            cell: false,
            edit: "switch"
          },
          {
            label:'近义词查询规则',
            prop:'sysonymRuleOids',
            cell: false,
            edit: 'refer'
          },
          {
            label: "相似查重属性",
@@ -1553,20 +1625,20 @@
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        busineStatus: this.vaildData(this.permission.classifyTree.attr_add, false),
        fullscreenStatus: this.vaildData(this.permission.classifyTree.attr_view_edit, false),
        ruleStatus: this.vaildData(this.permission.classifyTree.attr_rule, false),
        attrStatus: this.vaildData(this.permission.classifyTree.attr_group, false),
        saveStatus: this.vaildData(this.permission.classifyTree.attr_save, false),
        resetStatus: this.vaildData(this.permission.classifyTree.attr_reset, false),
        injectStatus: this.vaildData(this.permission.classifyTree.attr_inject, false),
        isShowStatus: this.vaildData(this.permission.classifyTree.attr_formrule, false),
        enumStatus: this.vaildData(this.permission.classifyTree.attr_enum, false),
        cascadStatus: this.vaildData(this.permission.classifyTree.attr_parentcode, false),
        syncStatus: this.vaildData(this.permission.classifyTree.attr_sync, false),
        applicationStatus: this.vaildData(this.permission.classifyTree.attr_application, false),
        orderStatus: this.vaildData(this.permission.classifyTree.attr_sort, false),
        removeStatus: this.vaildData(this.permission.classifyTree.attr_delete, false),
        busineStatus: this.vaildData(this.btnAuthList.attr_add, false),
        fullscreenStatus: this.vaildData(this.btnAuthList.attr_view_edit, false),
        ruleStatus: this.vaildData(this.btnAuthList.attr_rule, false),
        attrStatus: this.vaildData(this.btnAuthList.attr_group, false),
        saveStatus: this.vaildData(this.btnAuthList.attr_save, false),
        resetStatus: this.vaildData(this.btnAuthList.attr_reset, false),
        injectStatus: this.vaildData(this.btnAuthList.attr_inject, false),
        isShowStatus: this.vaildData(this.btnAuthList.attr_formrule, false),
        enumStatus: this.vaildData(this.btnAuthList.attr_enum, false),
        cascadStatus: this.vaildData(this.btnAuthList.attr_parentcode, false),
        syncStatus: this.vaildData(this.btnAuthList.attr_sync, false),
        applicationStatus: this.vaildData(this.btnAuthList.attr_application, false),
        orderStatus: this.vaildData(this.btnAuthList.attr_sort, false),
        removeStatus: this.vaildData(this.btnAuthList.attr_delete, false),
      }
    },
    attrOids() {
@@ -1587,7 +1659,7 @@
      if (this.editStyleFlag) {
        return '800px'
      } else {
        return 'calc(100vh - 595px)'
        return 'calc(100vh - 602px)'
      }
    }
  },
@@ -1601,6 +1673,25 @@
    })
  },
  methods: {
    //近义词查询规则取消
    sysnonymCancel(){
      this.synonymVisible = false;
    },
    //近义词查询规则确定
    sysnonymSubmit(){
      if(this.sysSelectData.length <= 0){
        this.$message.warning('请至少选择一条数据!')
      }else {
        const newArray = this.sysSelectData.map(obj => obj.oid);
        const newString = newArray.join(',');
        this.$set(this.CurrentCell, 'sysonymRuleOids', newString)
        this.AddCellFlag = true;
        this.synonymVisible = false;
      }
    },
    sysChange(row){
      this.sysSelectData = row;
    },
    //新增搜索
    AddFindHandler() {
      if (this.SelectValue == 'id') {
@@ -1713,7 +1804,10 @@
            attrTableWidth: 120,
            ts: ""
          })
          this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
          // 将英文编号转换为小写
          let {id, ...res} = this.busineAddList;
          this.busineAddList = {id: id.toLowerCase(), ...res};
          this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)));
        }
      })
      this.addVisible = false;
@@ -1847,8 +1941,8 @@
      // 新函数用于执行batchAddSave方法
      const executeBatchAddSave = () => {
        batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
          this.$message.success('保存成功')
          this.editOpenFlag = false;
          this.$message.success('保存成功')
          // 调用父组件修改按钮状态
          this.$emit('editCloseChildren')
          this.AddCellFlag = true;
@@ -1927,6 +2021,16 @@
            if (this.CurrentCell.attributeGroup !== '') {
              this.attrModel = this.CurrentCell.attributeGroup
            }
          },
          sysonymRuleOids: () =>{
            this.sysonymLoading = true
            codeSynonym('1','-1','Released').then(res=>{
              this.synonymData = res.data.data.records;
              this.sysonymLoading = false;
            }).catch(()=>{
              this.$message.error('请检查控制台错误信息!')
            })
            this.synonymVisible = true;
          }
        };
@@ -2059,16 +2163,24 @@
      const regex = new RegExp(this.rulesData.ruleRowBds);
      if (regex.test(this.RulesForm.TestContent)) {
        this.$message.success('校验成功')
      } else {
        this.$message.error('校验失败')
      }
    },
    //点击分类注入按钮
    injectBtn() {
      if (this.attrSelectList.length > 1) {
        this.$message.warning('只能选择一条模板数据')
      } else if (this.attrSelectList.length < 1) {
        return;
      }
      if (this.attrSelectList.length < 1) {
        this.$message.warning('请选择一条模板数据')
      } else if (this.attrSelectList.length === 1) {
        return;
        ;
      }
      if (this.attrSelectList.length === 1) {
        this.injectVisible = true;
        return;
      }
    },
    //分类注入保存
@@ -2101,15 +2213,17 @@
      } else {
        this.injectOption.classifyNumber = 0;
      }
      // console.log(this.ProData)
      this.injectVisible = false;
    },
    //分类注入清空
    injectHandleReset() {
      this.$set(this.CurrentCell, 'classifyInvokeText', '')
      this.$set(this.CurrentCell, 'classifyInvokeAttr:', '')
      this.$set(this.CurrentCell, 'classitwInvokeAttrName', '')
      this.$set(this.CurrentCell, 'classifyInvokeEditFlag', 'false')
      this.$set(this.CurrentCell, 'classifyInvokeLevel', 'none')
      this.CurrentCell.classifyInvokeText = null;
      this.CurrentCell.classifyInvokeAttr = '';
      this.CurrentCell.classifyInvokeAttrName = '';
      this.CurrentCell.classifyInvokeEditFlag = '';
      this.CurrentCell.classifyInvokeLevel = null;
      // console.log(this.ProData)
      this.injectVisible = false;
    },
    // 分类注入取消
@@ -2222,7 +2336,7 @@
<style lang="scss" scoped>
//固定列高度
/deep/ .el-table__fixed {
  height: calc(100vh - 612px) !important;
  height: calc(100vh - 618px) !important;
}
///deep/ .el-table__fixed[v-if='editStyleFlag'] {