xiejun
2023-09-21 52ffefd06e59cbd56c1a919972866592379cfed2
Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -1,65 +1,95 @@
<template>
  <div>
    <div style="display: flex;flex-wrap: wrap;" v-if="this.crudArrayFlag" class="app">
    <div v-if="this.crudArrayFlag" class="app" style="display: flex;flex-wrap: wrap; display: inline-block">
      <el-button-group>
      <!--新增-->
      <el-button v-if="attrEditVisible == false && attrFlagChiledren==false && editOpenFlag &&  (!checkStatus || crudLCStatus=='Editing' )" size="small" type="primary" icon="el-icon-plus" plain @click="busineHandle">添加 {{ msg }}</el-button>
      <!--        全屏编辑-->
      <el-button v-if=" attrEditVisible == false && attrFlagChiledren==false && editOpenFlag&&(!checkStatus || crudLCStatus=='Editing')" size="small" @click="fullscreenHandle" icon="el-icon-full-screen">全屏编辑</el-button>
      <!--        验证规则-->
      <el-button v-if="(!checkStatus || crudLCStatus=='Editing' )&& editOpenFlag" icon="el-icon-info" size="small" @click="ruleAddHandler">验证规则</el-button>
      <!--        属性分组-->
      <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-menu" size="small" @click="attrVisibleHandle">属性分组</el-button>
        <!--新增-->
        <el-button
          v-if="attrEditVisible == false && attrFlagChiledren==false && editOpenFlag &&  (!checkStatus || crudLCStatus=='Editing' )"
          icon="el-icon-plus" plain size="small" type="primary" @click="busineHandle">添加 {{ msg }}
        </el-button>
        <!--        全屏编辑-->
        <el-button
          v-if=" attrEditVisible == false && attrFlagChiledren==false && editOpenFlag&&(!checkStatus || crudLCStatus=='Editing')"
          icon="el-icon-full-screen" size="small" @click="fullscreenHandle">全屏编辑
        </el-button>
        <!--        验证规则-->
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing' )&& editOpenFlag" icon="el-icon-info" size="small"
                   @click="ruleAddHandler">验证规则
        </el-button>
        <!--        属性分组-->
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-menu" size="small"
                   @click="attrVisibleHandle">属性分组
        </el-button>
      </el-button-group>
      <el-button-group>
        <!--    保存-->
        <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" size="small" type="success" plain @click="addsHandler" icon="el-icon-check">保存</el-button>
        <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-check" plain
                   size="small"
                   type="success" @click.prevent="addsHandler">保存
        </el-button>
        <!--    预览排序-->
        <el-button size="small" @click="orderHandle" icon="el-icon-arrow-down">预览排序</el-button>
        <el-button icon="el-icon-arrow-down" size="small" @click="orderHandle">预览排序</el-button>
        <!--    删除-->
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" size="small" @click="CrudRemove" icon="el-icon-delete">删除</el-button>
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-delete" size="small"
                   @click="CrudRemove">删除
        </el-button>
        <!--    重置-->
        <el-button size="small" @click="reset" icon="el-icon-refresh-right">重置</el-button>
        <el-button icon="el-icon-refresh-right" size="small" @click="reset">重置</el-button>
      </el-button-group>
      <el-button-group>
        <!--新增-->
      <!--        分类注入-->
      <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag"  icon="el-icon-magic-stick" size="small" @click="injectBtn">分类注入</el-button>
        <!--        分类注入-->
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-magic-stick"
                   size="small" @click="injectBtn">分类注入
        </el-button>
        <!--    组合规则-->
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-film" size="small" @click="isShowHandler">组合规则</el-button>
      <!--        枚举注入-->
      <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-c-scale-to-original" size="small" @click="enmuVisHandle">枚举注入</el-button>
      <!--    级联属性-->
      <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-coin" size="small" @click="CascadeHandle">级联属性</el-button>
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-film" size="small"
                   @click="isShowHandler">组合规则
        </el-button>
        <!--        枚举注入-->
        <el-button v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-c-scale-to-original"
                   size="small" @click="enmuVisHandle">枚举注入
        </el-button>
        <!--    级联属性-->
        <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-coin" size="small"
                   @click="CascadeHandle">级联属性
        </el-button>
      </el-button-group>
      <el-button-group>
      <!--    同步到其他模板-->
      <el-button size="small"@click="syncHandle" icon="el-icon-share">同步到其他模板</el-button>
        <!--    同步到其他模板-->
        <el-button icon="el-icon-share" size="small" @click="syncHandle">同步到其他模板</el-button>
      </el-button-group>
      <el-button-group>
      <!--    编码申请预览-->
      <el-button size="small" icon="el-icon-view" @click="applicationHandle" style="">编码申请预览</el-button>
        <!--    编码申请预览-->
        <el-button icon="el-icon-view" size="small" style="" @click="applicationHandle">编码申请预览</el-button>
      </el-button-group>
      <!-- 是否开启编辑     -->
    <el-button-group>
      <el-button size="small" plain  icon="el-icon-view"  v-if="(!checkStatus|| crudLCStatus=='Editing') && !editOpenFlag && attrEditVisible == false && attrFlagChiledren==false" @click="editOpen" >开启编辑</el-button>
    </el-button-group>
      <el-select v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag"  size="small" v-model="selectvalue" placeholder="请选择">
        <el-option
          v-for="item in selectoptions"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
      <el-switch v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag"  v-model="switchvalue" @change="batchSetFlag" active-value="true" style="margin:6px 0 0 10px">
      </el-switch>
      <el-button-group>
        <el-button
          v-if="(!checkStatus|| crudLCStatus=='Editing') && !editOpenFlag && attrEditVisible == false && attrFlagChiledren==false"
          icon="el-icon-view" plain
          size="small"
          @click="editOpen">开启编辑
        </el-button>
        <el-select v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" v-model="selectvalue"
                   placeholder="请选择"
                   size="small">
          <el-option
            v-for="item in selectoptions"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
        <el-switch v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" v-model="switchvalue"
                   active-value="true" style="margin:6px 0 0 10px" @change="batchSetFlag">
        </el-switch>
      </el-button-group>
    </div>
<!--    弹窗-->
    <!--    弹窗-->
    <div>
      <!--    编码申请预览-->
      <FormTemplateDialog
@@ -86,9 +116,15 @@
        </div>
      </el-dialog>
      <!--        枚举注入-->
      <el-dialog :visible.sync="enumVisible" append-to-body title="枚举注入" :before-close="this.enumBeforeClose">
      <el-dialog :before-close="this.enumBeforeClose" :visible.sync="enumVisible" append-to-body title="枚举注入">
        <!-- 渲染表格及按钮 -->
        <!-- 渲染表格及按钮 -->
        <el-alert
          :closable="false"
          style="margin-bottom: 10px;display: inline-block"
          title="请新增后点击单元格输入枚举数据"
          type="success">
        </el-alert>
        <div>
          <el-button icon="el-icon-plus" type="primary" @click="addRow">新增</el-button>
          <el-table :data="tableData" style="width: 100%" @cell-click="handleCellClick"
@@ -111,7 +147,7 @@
            </el-table-column>
            <el-table-column fixed="right" label="操作" width="120">
              <template slot-scope="scope">
                <el-button size="small" type="text" plain @click="enumDeleteRow">
                <el-button plain size="small" type="text" @click="enumDeleteRow">
                  移除
                </el-button>
              </template>
@@ -146,7 +182,8 @@
                <el-radio-group v-model="injectOption.classifyInvokeLevel">
                  <el-radio label="min">最小层</el-radio>
                  <el-radio label="max">指定层</el-radio>
                  <el-input-number v-if="this.injectOption.classifyInvokeLevel == 'max'" v-model="injectOption.classifyNumber" :max="10" :min="0"
                  <el-input-number v-if="this.injectOption.classifyInvokeLevel == 'max'"
                                   v-model="injectOption.classifyNumber" :max="10" :min="0"
                                   controls-position="right"></el-input-number>
                </el-radio-group>
              </el-form-item>
@@ -166,11 +203,12 @@
        </div>
      </el-dialog>
      <!--        属性分组-->
      <el-dialog :visible.sync="attrVisible" append-to-body style="width: 800px; left:30vw;top: 10vh ;"
      <el-dialog :before-close="attrClose" :visible.sync="attrVisible" append-to-body
                 style="width: 800px; left:30vw;top: 10vh ;"
                 title="输入分组的名称">
        <el-form ref="form" label-width="70px">
          <el-form-item label="属性分组">
            <el-input v-model="attrModel"></el-input>
            <el-input v-model="attrModel" autofocus></el-input>
          </el-form-item>
          <div style="display: flex;justify-content: flex-end">
            <el-button size="small" type="primary" @click="attrHandle">提交</el-button>
@@ -217,19 +255,22 @@
        </el-container>
      </el-dialog>
      <!--        全屏编辑-->
      <el-dialog :visible.sync="attrEditVisible" append-to-body fullscreen="true" :before-close="escEdit" >
        <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :editStyleFlag="editStyleFlag" :editOpenFlag="editOpenFlag" :crudArrayFlag="this.crudArrayFlag"></attrCrud>
      <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"
                  @editCloseChildren="editClose"></attrCrud>
      </el-dialog>
      <!--      组合规则-->
      <formula-editor :systemVariableTableData="systemVariableTableData"
      <formula-editor :componentRuleText="componentRuleText"
                      :systemVariableTableData="systemVariableTableData"
                      :thisSceneTableData="thisSceneTableData"
                      :visible.sync="isShowformulaEdit"
                      @updateFormulaContent="updataFormlaContent"
                      :componentRuleText="componentRuleText"
      ></formula-editor>
      <!--    新增  -->
      <el-dialog :visible.sync="addVisible" append-to-body title="从业务类型中选择属性">
        <avue-crud ref="AddOriginPlace" :data="businessData" :option="businessOption" @selection-change="businessSelect">
        <avue-crud ref="AddOriginPlace" :data="businessData" :option="businessOption"
                   @selection-change="businessSelect">
          <template slot="menuLeft">
            <div style="display: flex;">
              <el-select v-model="SelectValue" placeholder="请选择" style="width: 150px !important;">
@@ -241,7 +282,7 @@
                  style="width: 150px">
                </el-option>
              </el-select>
              <el-input style="width: 400px;margin-left: 20px" v-model="SelectFInd"></el-input>
              <el-input v-model="SelectFInd" style="width: 400px;margin-left: 20px"></el-input>
              <el-button size="small" style="margin-left: 10px" @click="AddFindHandler">查询</el-button>
            </div>
          </template>
@@ -253,46 +294,57 @@
      </el-dialog>
      <!--      参照配置-->
        <refer-config-dialog
          :display="referConfigVisble"
          @setReferConfigValue="setReferConfigValue"
          :referConfigOption="referConfigOption"
        ></refer-config-dialog>
      <refer-config-dialog
        :display="referConfigVisble"
        :referConfigOption="referConfigOption"
        @setReferConfigValue="setReferConfigValue"
      ></refer-config-dialog>
    </div>
    <el-table :data="ProData"
              style="width: 100%"
              :height="this.editStyleFlag? 800 : 343"
              @cell-click="handleCellClicks"
              @select="selectHandle"
              @selection-change="selectionChange"
              @row-click="rowClick"
              v-if="this.crudArrayFlag"
    <el-table v-if="this.crudArrayFlag"
              ref="referAttrCrud"
              v-loading="loading"
              :data="ProData"
              :height="this.editStyleFlag? 800 : 343"
              style="width: 100%"
              @select="selectHandle"
              @cell-click="handleCellClicks"
              @selection-change="selectionChange"
              @row-click="rowClick"
    >
      <el-table-column
        type="selection"
        width="55" fixed>
        fixed
        type="selection" width="55">
      </el-table-column>
      <!--<el-table-column fixed label="序号" type="index" width="55"></el-table-column>-->
      <el-table-column v-for="(item,index) in this.option.column" :key="item.id"
      <el-table-column v-for="(item,index) in this.option.column" v-if="item.edit !='referName'"
                       :key="item.id"
                       :fixed="item.fixed"
                       :formatter="formAttr"
                       :label="item.label"
                       :prop="item.prop"
                       :formatter="formAttr"
                       :width="item.width||(item.label.length >=4 ?'160':item.label.length==3 ?'130':'100')"
                       :show-overflow-tooltip="true"
                       :sortable="item.sortable"
                       :fixed="item.fixed"
                       :width="item.width||(item.label.length >=4 ?'160':item.label.length==3 ?'130':'100')"
                       align="center"
                       v-if="item.edit !='referName'"
      >
        <template slot-scope="{ row }">
          <el-input ref="inputRef" v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text'  ||item.edit == 'refer' )" v-model="row[item.prop]"
                    @blur="saveRows" autofocus ></el-input>
          <el-input-number size="small" controls-position="right" v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]"
                           @blur="saveRows" :style="{width:(item.width-10)+'px'}"></el-input-number>
          <el-select v-model="row[item.prop]" filterable  allow-create  default-first-option slot="prepend" v-if="editingRows === row && editShows== item.prop && item.edit == 'select' " @blur="selectChangeHandler(item.editConfig,index)">
          <el-input
            v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text'  ||item.edit == 'refer' )"
            v-show="!AddCellFlag"
            :ref="'input' + row.oid"
            v-model="row[item.prop]"
            @blur="saveRows(row)"
          ></el-input>
          <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'"
                           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
                     @blur="selectChangeHandler(item.editConfig,index)">
            <el-option
              v-for="optionItem in item.data"
              :key="optionItem.dictValue"
@@ -301,7 +353,7 @@
            </el-option>
          </el-select>
          <el-switch
            v-if="item.edit === 'switch'" v-model="row[item.prop]" active-value="true" :disabled="!editOpenFlag"
            v-if="item.edit === 'switch'" v-model="row[item.prop]" :disabled="!editOpenFlag" active-value="true"
            inactive-value="false">
          </el-switch>
          <span v-else>{{ row[item.prop] }}</span>
@@ -325,8 +377,10 @@
</template>
<script>
import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto,listByFlag} from '@/api/template/templateAttr'
import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto, listByFlag} from '@/api/template/templateAttr'
import {getList} from "@/api/refer/table";
import func from "@/util/func";
import {getCurrentInstance} from "vue";
export default {
  name: "attrCrud .vue",
@@ -338,16 +392,16 @@
      type: String,
      default: ''
    },
    checkStatus:{
    checkStatus: {
      type: Boolean,
      default: false
    },
    //控制是否开启编辑
    editOpenFlag:{
    editOpenFlag: {
      type: Boolean,
      default: false
    },
    editStyleFlag:{
    editStyleFlag: {
      type: Boolean,
      default: false
    },
@@ -369,84 +423,91 @@
      type: Boolean,
      default: false
    },
    crudArrayFlag:{
    crudArrayFlag: {
      type: Boolean,
      default: false
    },
  },
  watch:{
    crudOid:{
      handler(newval,oldval){
        if(newval){
          this.editOpenFlag=false
  watch: {
    crudOid: {
      handler(newval, oldval) {
        if (newval) {
          this.editOpenFlag = false
        }
      }
    },
    crudArray:{
      handler(newval,oldval){
        if(newval != undefined){
          if(newval.length>=1){
            this.crudArrayFlag=true
          }else{
            this.crudArrayFlag=false
    crudArrayFlag: {
      handler(newval, oldval) {
        // console.log('crudArrayFlag', newval)
      }
    },
    crudArray: {
      handler(newval, oldval) {
        if (newval != undefined) {
          if (newval.length >= 1) {
            this.crudArrayFlag = true
          } else {
            this.crudArrayFlag = false
          }
        }
      },
      deep:true,
      immediate:true
      deep: true,
      immediate: true
    },
    Formlist:{
      handler(newval,oldval){
        if(newval.length === 0){
          this.crudArrayFlag=false
    Formlist: {
      handler(newval, oldval) {
        if (newval.length === 0) {
          this.crudArrayFlag = false
          return
        }
      }
    },
    ProData:{
      handler(newval,oldval){
        if(newval){
          this.loading=true;
    ProData: {
      handler(newval, oldval) {
        if (newval) {
          this.loading = true;
          setTimeout(() => {
            this.loading=false
            this.loading = false
          }, 1000);
        }
      }
    },
    'injectOption.classifyInvokeAttr': function(newVal) {
    'injectOption.classifyInvokeAttr': function (newVal) {
      if (newVal === "name") {
        this.injectOption.classifyInvokeAttrName='分类名称'
        this.injectOption.classifyInvokeAttrName = '分类名称'
      } else if (newVal === "id") {
        this.injectOption.classifyInvokeAttrName='分类代号'
        this.injectOption.classifyInvokeAttrName = '分类代号'
      }
      return '';
    },
    editOpenFlag:{
      handler(newval,oldval){
        console.log('editOpenFlag',newval)
    editOpenFlag: {
      handler(newval, oldval) {
        // console.log('editOpenFlag', newval)
      },
      deep:true,
      immediate:true
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      // 保存单元格状态
      AddCellFlag: false,
      //全屏编辑高度状态
      editStyleFlag:false,
      loading:false,
      referConfigText:"",
      referConfigVisble:false,
      referConfigOption:{
        referConfig:'',
      editStyleFlag: false,
      loading: false,
      referConfigText: "",
      referConfigVisble: false,
      referConfigOption: {
        referConfig: '',
      },
      screenWidth: document.documentElement.clientWidth, // 屏幕宽度
      //当前单元格
      CurrentCell:'',
      CurrentCell: '',
      // 新增
      SelectValue:"",
      SelectFInd:"",
      SelectOption:[
      SelectValue: "",
      SelectFInd: "",
      SelectOption: [
        {
          value: 'name',
          label: '属性中文名称'
@@ -457,12 +518,12 @@
        }
      ],
      //参照
      referVisible:false,
      crudArrayFlag:false,
      referVisible: false,
      crudArrayFlag: false,
      editingRows: null,
      editShows:"",
      editShows: "",
      attrFlag: false,
      referObject:{},
      referObject: {},
      //编码申请预览option
      applicationoption: {
        column: []
@@ -569,7 +630,7 @@
      // 级联单选
      selectRow: '',
      //级联单选数组
      selectRowArr:[],
      selectRowArr: [],
      // 级联data
      CascadeData: [],
      // 级联option
@@ -864,18 +925,18 @@
      addvisible: false,
      //分类注入option
      injectOption: {
        classifyInvokeAttrName:'分类名称',
        classifyInvokeAttrName: '分类名称',
        classifyInvokeAttr: "name",
        classifyInvokeEditFlag: "true",
        classifyInvokeLevel:'min',
        classifyInvokeLevel: 'min',
        //分类注入计数器
        classifyNumber:0,
        classifyNumber: 0,
      },
      // 属性验证输入框
      RulesForm: {
        expressionText: "",
        TestContent: "",
        ruleRowBds:""
        ruleRowBds: ""
      },
      //属性验证规则配置
      rulesOption: {
@@ -1026,11 +1087,13 @@
        column: [
          {
            label: "属性英文名称",
            prop: "id"
            prop: "id",
            width: 100,
          },
          {
            label: "属性中文名称",
            prop: "name"
            prop: "name",
            width: 100,
          },
          {
            label: "长度",
@@ -1039,7 +1102,7 @@
          {
            label: "数据类型",
            prop: "attrDataType",
            formatter:function(row,column){
            formatter: function (row, column) {
              let vciFieldTypeMap = {
                VTBoolean: "布尔型",
                VTClob: "长文本",
@@ -1058,7 +1121,9 @@
          {
            label: "可空",
            prop: "nullableFlag",
            formatter:function(row,column){return row.nullableFlag=='true' || row.nullableFlag=='1'?'是':'否'}
            formatter: function (row, column) {
              return row.nullableFlag == 'true' || row.nullableFlag == '1' ? '是' : '否'
            }
          },
          {
            label: "默认值",
@@ -1069,7 +1134,7 @@
            prop: "precisionLength"
          },
          {
            label: "小精刻度",
            label: "小数刻度",
            prop: "scaleLength"
          },
          {
@@ -1129,14 +1194,14 @@
          width: 90,
          fixed: true
        }, {
            label: "属性英文编号",
            prop: "id",
            fixed: true,
            cell: false,
            labelWidth: 110,
            width: 125,
            sortable: false,
          },
          label: "属性英文编号",
          prop: "id",
          fixed: true,
          cell: false,
          labelWidth: 110,
          width: 125,
          sortable: false,
        },
          {
            label: "属性中文名称",
            prop: "name",
@@ -1396,7 +1461,7 @@
        ],
        List: []
      },
      vciFieldTypeMap : {
      vciFieldTypeMap: {
        VTBoolean: "布尔型",
        VTClob: "长文本",
        VTDate: "日期",
@@ -1409,9 +1474,9 @@
        VTString: "字符串"
      },
      //时间格式下拉框
      codeDataFlag:false,
    //  组合规单元格编辑回填
      componentRuleText:"",
      codeDataFlag: false,
      //  组合规单元格编辑回填
      componentRuleText: "",
      //模板属性下拉设置switch
      selectoptions: [{
        value: 'keyAttrFlag',
@@ -1455,10 +1520,10 @@
      }],
      //模板属性下拉选中值
      selectvalue: 'keyAttrFlag',
      switchvalue:'false'
      switchvalue: 'false'
    }
  },
  computed:{
  computed: {
    attrOids() {
      let oids = [];
      this.attrSelectList.forEach(ele => {
@@ -1477,80 +1542,80 @@
  mounted() {
  },
  created() {
    this.option.column.forEach((item,index) => {
    this.option.column.forEach((item, index) => {
      if (item.edit == 'select') {
        this.selectChangeHandler(item.editConfig,index)
        this.selectChangeHandler(item.editConfig, index)
      }
    })
  },
  methods: {
    //新增搜索
    AddFindHandler(){
      if(this.SelectValue == 'id'){
        const masterParameter={
          'conditionMap[id]':this.SelectFInd
    AddFindHandler() {
      if (this.SelectValue == 'id') {
        const masterParameter = {
          'conditionMap[id]': this.SelectFInd
        }
        this.BuineAttrByBtm(masterParameter);
        this.SelectValue=""
        this.SelectFInd=""
      }else if(this.SelectValue == 'name'){
        const masterParameter={
          'conditionMap[name]':this.SelectFInd
        this.SelectValue = ""
        this.SelectFInd = ""
      } else if (this.SelectValue == 'name') {
        const masterParameter = {
          'conditionMap[name]': this.SelectFInd
        }
        this.BuineAttrByBtm(masterParameter)
        this.SelectValue=""
        this.SelectFInd=""
        this.SelectValue = ""
        this.SelectFInd = ""
      }
    },
    //参照配置子组件
    echoReferConfig(val){
      this.referObject=val
      this.$set(this.CurrentCell,'referConfig',JSON.stringify(val))
    echoReferConfig(val) {
      this.referObject = val
      this.$set(this.CurrentCell, 'referConfig', JSON.stringify(val))
    },
    //可输可选下拉
    selectChangeHandler(editConfig,index){
      let that=this;
      /*if(that.option.column[index].data && that.option.column[index].data.length>=0){
        return;
      }*/
      listByFlag(editConfig.extraParams).then(res=>{
        that.option.column[index].data=res.data.data;
    selectChangeHandler(editConfig, index) {
      let that = this;
      listByFlag(editConfig.extraParams).then(res => {
        that.option.column[index].data = res.data.data;
      })
    },
    //属性分组按钮
    attrVisibleHandle() {
     if (this.attrSelectList < 1) {
      if (this.attrSelectList < 1) {
        this.$message.warning('请选择模板属性')
      } else  {
      } else {
        this.attrVisible = true;
      }
    },
    //属性分组提交
    attrHandle() {
      this.attrSelectList.forEach(item=>{
        item.attributeGroup=this.attrModel
      this.attrSelectList.forEach(item => {
        item.attributeGroup = this.attrModel
      })
      if(this.CurrentCell){
        this.$set(this.CurrentCell, 'attributeGroup', this.attrModel)
      }else {
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'attributeGroup', this.attrModel);
      } else {
        this.$set(this.attrSelectList[0], 'attributeGroup', this.attrModel)
      }
      this.attrModel = "";
      this.attrVisible = false;
      this.attrClose()
    },
    //属性分组清空
    attrRemove() {
      this.attrModel = ""
    },
    attrClose() {
      this.attrModel = "";
      this.attrVisible = false
    },
    //表格数据
    CrudRend() {
      if (this.crudOid != '') {
        gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.crudOid,limit:-1}).then(res => {
          this.loading=true
        gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.crudOid, limit: -1}).then(res => {
          this.loading = true
          setTimeout(() => {
            this.ProData = res.data.data;
            this.loading=false
            this.loading = false
          }, 1000);
        }).catch(res => {
@@ -1575,7 +1640,7 @@
        })
        if (!isCopy) {
          citem.oid = ''
          this.busineAddList=Object.assign(citem, {
          this.busineAddList = Object.assign(citem, {
            orderNum: ++ordernum,
            attributeDataType: citem.attrDataType,
            attributeDataTypeText: this.vciFieldTypeMap[citem.attrDataType],
@@ -1594,7 +1659,7 @@
            queryAttrFlag: 'true',
            seniorQueryAttrFlag: 'true',
            attrTableWidth: 120,
            ts:""
            ts: ""
          })
          this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
        }
@@ -1610,11 +1675,14 @@
      this.addVisible = true;
      this.busineSelectList = []
      this.busineAddList = [];
      this.BuineAttrByBtm()
      this.BuineAttrByBtm();
      this.$nextTick(() => {
        this.$refs.AddOriginPlace.doLayout();
      })
    },
    //业务类型数据
    BuineAttrByBtm(masterParameter){
      AttrByBtm({'conditionMap[oid]': this.crudOid,...masterParameter}).then(res => {
    BuineAttrByBtm(masterParameter) {
      AttrByBtm({'conditionMap[oid]': this.crudOid, ...masterParameter}).then(res => {
        this.businessData = res.data.data;
      })
    },
@@ -1638,24 +1706,27 @@
    CascadeAddHandle() {
      let CascadeString = "";
      CascadeString = this.selectRowArr.id + (this.selectRowArr.name);
      if(this.CurrentCell){
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'parentCode', CascadeString)
      }else {
      } else {
        this.$set(this.attrSelectList[0], 'parentCode', CascadeString)
      }
      this.CascadeVisible = false;
    },
    //级联属性清除
    casRemove() {
      this.selectRow = ""
      this.selectRow = "";
      this.$set(this.CurrentCell, 'parentCode', this.selectRow);
      this.CascadeVisible = false;
    },
    // 级联属性行单选
    CascaderowClick(row) {
      this.selectRow = row.$index;
      this.selectRowArr=row
      this.selectRowArr = row
    },
    // 排序预览按钮
    orderHandle(){
    orderHandle() {
      this.$refs.referAttrCrud.sort("orderNum");
    },
    //表格单选
@@ -1667,7 +1738,7 @@
    selectionChange(list) {
      this.attrSelectList = list;
    },
    rowClick(row){
    rowClick(row) {
      this.$refs.referAttrCrud.clearSelection();
      this.attrSelectList = [row];
      this.$refs.referAttrCrud.setCurrentRow(row);
@@ -1677,75 +1748,148 @@
      this.attrRow = row;
    },
    //保存
    addsHandler() {
      batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
        this.$message.success('保存成功')
        this.editOpenFlag=false
      }).catch(()=>{
        this.$message.warning('保存失败,请查看控制台输出!')
    addsHandler(event) {
      this.$refs.referAttrCrud.sort("orderNum");
      var ischeck = true;
      this.ProData.forEach((item, index) => {
        if ((item.requireFlag && item.requireFlag.toString() == 'true') && (item.readOnlyFlag && item.readOnlyFlag.toString() == 'true')) {
          this.$message.warning(item.name + "(" + item.id + ")必输的属性不能是只读");
          ischeck = false;
          return;
        }
        var num = 0;
        if (item.componentRule) {
          //组合规则
          num++
        }
        if (item.enumString || item.enumId) {
          //枚举
          num++
        }
        if (item.referConfig || item.referBtmId) {
          //参照
          num++
        }
        if (item.codeDateFormat) {
          //时间格式
          num++
        }
        //如果空后台返回none
        if (item.classifyInvokeLevel && item.classifyInvokeLevel != 'none') {
          //分类注入
          num++
        }
        if (num > 1 && ischeck) {
          this.$message({
            showClose: true,
            message: item.name + "(" + item.id + ") 属性只能是组合规则,枚举,参照,时间格式,分类注入中的一种",
            type: 'warning'
          });
          ischeck = false;
          return;
        }
      })
      if (!ischeck) {
        return;
      }
      // 新函数用于执行batchAddSave方法
      const executeBatchAddSave = () => {
        batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
          this.$message.success('保存成功')
          this.editOpenFlag = false;
          // 调用父组件修改按钮状态
          this.$emit('editCloseChildren')
          this.AddCellFlag = true;
        }).catch(() => {
          this.$message.warning('保存失败,请查看控制台输出!')
        });
      }
      // 所有if条件和逻辑通过后调用executeBatchAddSave函数
      executeBatchAddSave();
    },
    //表格行编辑
    handleCellClicks(row, column) {
       if(this.editOpenFlag){
         this.editingRows = row;
         this.editShows = column.property;
         this.rowOid = row.oid;
         this.CurrentCell=row;
         if(column.property == 'referConfig' ){
           this.referConfigVisble= true;
           this.referConfigOption = {
             referConfig: this.CurrentCell.referConfig || '',
           }
           if(this.CurrentCell.referConfig == ''){
             this.referConfigOption = {
               referConfig:'',
             }
           }
           // this.$refs.referConfigFormDialog.onloadAttrData();
         }else if(column.property == 'classifyInvokeText'){
           if (this.CurrentCell.classifyInvokeAttr != '') {
             this.injectOption = {
               classifyInvokeAttr: this.CurrentCell.classifyInvokeAttr,
               classifyInvokeAttrName: this.CurrentCell.classifyInvokeAttrName,
               classifyInvokeEditFlag: this.CurrentCell.classifyInvokeEditFlag,
               classifyInvokeLevel: this.CurrentCell.classifyInvokeLevel == 'min' ? 'min' : 'max',
               classifyNumber: this.CurrentCell.classifyInvokeLevel == 'min' ? '' : this.CurrentCell.classifyInvokeLevel
             };
           } else {
             this.injectHandleReset();
           }
         }else if(column.property == 'componentRule'){
           if(this.CurrentCell){
             this.CurrentCell.componentRule=this.componentRuleText;
           }
           this.isShowformulaEdit = true;
         }else if(column.property == 'enumString'){
           this.enumVisible=true;
           if(this.attrSelectList[0].enumString != ""){
             this.tableData=JSON.parse(this.attrSelectList[0].enumString)
             return
           }
         }else if(column.property == 'parentCode'){
           gridCodeClassifyTemplateAttr({
             'conditionMap[classifyTemplateOid]': this.Formlist[0].oid,
             'conditionMap[oid_notequal]': this.CurrentCell.oid,
             limit:-1
           }).then(res => {
             this.CascadeData = res.data.data;
           })
           this.CascadeVisible=true;
         }else if(column.property == 'verifyRule'){
           this.RulesForm.expressionTextt=this.CurrentCell.verifyRule;
           this.rulesVisible=true;
         }else if(column.property == 'attributeGroup'){
           this.attrVisible = true;
         }
       }
      if (this.editOpenFlag) {
        this.editingRows = row;
        this.editShows = column.property;
        this.rowOid = row.oid;
        this.CurrentCell = row;
        this.$nextTick(() => {
          const inputs = this.$refs['input' + row.oid];
          const input = inputs && inputs.length > 0 ? inputs[0].$el : null;
          if (input) {
            input.focus();
          }
        });
        const columnActions = {
          referConfig: () => {
            this.referConfigVisble = true;
            this.referConfigOption = {
              referConfig: this.CurrentCell.referConfig || '',
            }
            if (this.CurrentCell.referConfig == '') {
              this.referConfigOption = {
                referConfig: '',
              }
            }
          },
          classifyInvokeText: () => {
            this.injectVisible = true;
            if (this.CurrentCell.classifyInvokeAttr != '') {
              this.injectOption = {
                classifyInvokeAttr: this.CurrentCell.classifyInvokeAttr,
                classifyInvokeAttrName: this.CurrentCell.classifyInvokeAttrName,
                classifyInvokeEditFlag: this.CurrentCell.classifyInvokeEditFlag,
                classifyInvokeLevel: this.CurrentCell.classifyInvokeLevel == 'min' ? 'min' : 'max',
                classifyNumber: this.CurrentCell.classifyInvokeLevel == 'min' ? '' : this.CurrentCell.classifyInvokeLevel
              };
            }
          },
          componentRule: () => {
            this.isShowformulaEdit = true;
          },
          enumString: () => {
            this.enumVisible = true;
            this.tableData = [];
            if (this.CurrentCell.enumString != "") {
              this.tableData = JSON.parse(this.CurrentCell.enumString)
              return;
            }
          },
          parentCode: () => {
            gridCodeClassifyTemplateAttr({
              'conditionMap[classifyTemplateOid]': this.Formlist[0].oid,
              'conditionMap[oid_notequal]': this.CurrentCell.oid,
              limit: -1
            }).then(res => {
              this.CascadeData = res.data.data;
            })
            this.CascadeVisible = true;
          },
          verifyRule: () => {
            this.RulesForm.expressionTextt = this.CurrentCell.verifyRule;
            this.rulesVisible = true;
          },
          attributeGroup: () => {
            this.attrVisible = true;
            if (this.CurrentCell.attributeGroup !== '') {
              this.attrModel = this.CurrentCell.attributeGroup
            }
          }
        };
        if (column.property in columnActions) {
          columnActions[column.property]();
        }
      }
    },
    saveRows() {
      this.editingRows = null;
      this.editShows = null;
      // const inputElement = document.querySelector(`#inputRef${this.CurrentCell.oid}`);
      // if (inputElement) {
      //   inputElement.blur();
      // }
    },
    // 枚举注入添加一行空数据
    addRow() {
@@ -1771,20 +1915,20 @@
        this.$message.warning('请选择一条模板属性')
      } else if (this.attrSelectList.length === 1) {
        this.enumVisible = true;
        if(this.attrSelectList[0].enumString != ""){
          this.tableData=JSON.parse(this.attrSelectList[0].enumString)
        if (this.attrSelectList[0].enumString != "") {
          this.tableData = JSON.parse(this.attrSelectList[0].enumString)
          return
        }
      }
    },
    enumBeforeClose(done){
      this.tableData=[]
    enumBeforeClose(done) {
      this.tableData = []
      done()
    },
    enumCancell(){
      this.tableData=[]
      this.enumVisible=false;
    enumCancell() {
      this.tableData = []
      this.enumVisible = false;
    },
    //枚举注入多选框
    handleSelectionChange(row) {
@@ -1792,28 +1936,32 @@
    },
    //枚举注入保存
    enumAddHandle() {
      let hasError = false; // 添加一个变量
      this.tableData.forEach((item, index) => {
        if (item.key === '') {
          this.$message.warning(`第${index + 1}行的选项值不能为空`);
          hasError = true;
          return;
        } else if (item.value === '') {
          this.$message.warning(`第${index + 1}行的选项中文标签不能为空`);
          hasError = true;
          return;
        }
      });
      if (this.tableData.length >= 1) {
        let hasError = false; // 添加一个变量
        this.tableData.forEach((item, index) => {
          if (item.key === '') {
            this.$message.warning(`第${index + 1}行的选项值不能为空`);
            hasError = true;
            return;
          } else if (item.value === '') {
            this.$message.warning(`第${index + 1}行的选项中文标签不能为空`);
            hasError = true;
            return;
          }
        });
        // 保存执行逻辑
      if (!hasError) {
        if (this.CurrentCell) {
          this.$set(this.CurrentCell, 'enumString', JSON.stringify(this.tableData));
          this.enumVisible = false;
        } else {
          this.$set(this.attrSelectList[0], 'enumString', JSON.stringify(this.tableData));
          this.tableData=[];
          this.enumVisible = false;
        if (!hasError) {
          if (this.CurrentCell) {
            this.$set(this.CurrentCell, 'enumString', JSON.stringify(this.tableData));
            this.enumVisible = false;
          } else {
            this.$set(this.attrSelectList[0], 'enumString', JSON.stringify(this.tableData));
            this.tableData = [];
            this.enumVisible = false;
          }
        }
      } else {
        this.$message.warning('请添加枚举注入数据!')
      }
    },
    // 将正在编辑的行的状态变为 null,即退出编辑状态
@@ -1821,40 +1969,43 @@
      this.editingRow = null;
    },
    //验证规则按钮
    ruleAddHandler(){
    ruleAddHandler() {
      if (this.attrSelectList < 1) {
        this.$message.warning('请选择模板属性')
      } else{
        this.rulesVisible=true
      } else {
        this.rulesVisible = true
      }
    },
    //规则校验,双击表单事件
    handleRulesRowDBLClick(row) {
      this.ruleRowBds=row.bds
      this.ruleRowBds = row.bds
      this.RulesForm.expressionText = row.bds
    },
    // 验证规则清除内容
    rulesremove() {
      this.RulesForm.expressionText = ""
      this.RulesForm.TestContent = ""
      this.$set(this.CurrentCell, 'verifyRule', '')
      this.rulesVisible = false
    },
    // 验证规则确定
    rulesHandle() {
     if(this.CurrentCell){
       this.$set(this.CurrentCell,'verifyRule',this.RulesForm.expressionText)
     }else {
       this.attrSelectList.forEach((item)=>{
         this.$set(item,'verifyRule',this.RulesForm.expressionText)
       })
       this.rulesremove()
     }
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'verifyRule', this.RulesForm.expressionText)
        this.AddCellFlag = !this.AddCellFlag;
      } else {
        this.attrSelectList.forEach((item) => {
          this.$set(item, 'verifyRule', this.RulesForm.expressionText)
        })
        this.rulesremove()
      }
      this.rulesVisible = false
    },
    //验证规则检查
    rulesExamine() {
      const regex = new RegExp(this.rulesData.ruleRowBds);
      if(regex.test(this.RulesForm.TestContent)){
      if (regex.test(this.RulesForm.TestContent)) {
        this.$message.success('校验成功')
      }
    },
@@ -1870,40 +2021,44 @@
    },
    //分类注入保存
    injectAddHandle() {
      // 定义展示类型
      let data = {
        "注入类型": this.injectOption.classifyInvokeAttr,
        "注入类型名称": this.injectOption.classifyInvokeAttrName,
        "层级设置": this.injectOption.classifyInvokeLevel=='max'?this.injectOption.classifyNumber :'min',
        "是否可修改": this.injectOption.classifyInvokeEditFlag
      }
        //勾选操作
        for (const key in this.injectOption) {
          this.attrSelectList[0][key] = this.injectOption[key];
          //如果是指定层赋值为数字
          if(this.injectOption.classifyInvokeLevel !== 'min'){
            this.attrSelectList[0].classifyInvokeLevel=this.injectOption.classifyNumber
          }else {
            this.attrSelectList[0].classifyInvokeLevel='min'
          }
          this.$set(this.attrSelectList[0],'classifyInvokeText',data)
      const {
        classifyInvokeAttr,
        classifyInvokeAttrName,
        classifyInvokeLevel,
        classifyInvokeEditFlag,
        classifyNumber
      } = this.injectOption;
      const data = {
        "注入类型": classifyInvokeAttr,
        "注入类型名称": classifyInvokeAttrName,
        "层级设置": classifyInvokeLevel === 'max' ? classifyNumber : 'min',
        "是否可修改": classifyInvokeEditFlag
      };
      for (const key in this.injectOption) {
        this.attrSelectList[0][key] = this.injectOption[key];
        if (classifyInvokeLevel !== 'min') {
          this.attrSelectList[0].classifyInvokeLevel = classifyNumber;
        } else {
          this.attrSelectList[0].classifyInvokeLevel = 'min';
        }
        this.injectHandleReset()
      if(this.injectOption.classifyInvokeLevel !== 'min'){
        this.injectOption.classifyInvokeLevel=this.injectOption.classifyNumber;
      }else  {
        this.injectOption.classifyNumber=0;
        this.$set(this.attrSelectList[0], 'classifyInvokeText', data);
      }
      if (classifyInvokeLevel !== 'min') {
        this.injectOption.classifyInvokeLevel = classifyNumber;
      } else {
        this.injectOption.classifyNumber = 0;
      }
      this.injectVisible = false;
    },
    //分类注入清空
    injectHandleReset() {
      this.injectOption.classifyInvokeAttrName = "分类名称";
      this.injectOption.classifyInvokeAttr = "name";
      this.injectOption.classifyInvokeLevel = "min";
      this.injectOption.classifyInvokeEditFlag = "true";
      this.injectOption.classifyNumber = "0";
      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.injectVisible = false;
    },
    // 分类注入取消
    injectRemove() {
@@ -1917,7 +2072,7 @@
    },
    //表格删除
    CrudRemove() {
      this.attrSelectList.forEach((item)=>{
      this.attrSelectList.forEach((item) => {
        const index = this.ProData.indexOf(item);
        this.ProData.splice(index, 1)
      })
@@ -1949,7 +2104,7 @@
      } else if (this.attrSelectList.length < 1) {
        this.$message.warning('请选择一条模板属性数据')
      } else if (this.attrSelectList.length === 1) {
        this.isShowformulaEdit=true
        this.isShowformulaEdit = true
      }
    },
    //全屏编辑
@@ -1957,9 +2112,10 @@
      if (this.crudArray.length < 1) {
        this.$message.warning('请选择一个模板')
      } else {
        this.editStyleFlag=true;
        this.editStyleFlag = true;
        this.attrEditVisible = true;
        this.attrFlag = true;
        this.AddCellFlag = true;
      }
    },
@@ -1967,50 +2123,57 @@
    escEdit() {
      this.attrFlagChiledren = false;
      this.attrEditVisible = false;
      this.editStyleFlag=false;
      this.editStyleFlag = false;
    },
    //组合规则确定
    updataFormlaContent(val) {
      if(this.CurrentCell){
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'componentRule', val.replace(/"/g, ''))
      }else {
        this.componentRuleText = this.CurrentCell.componentRule
      } else {
        this.$set(this.attrRow, 'componentRule', val.replace(/"/g, ''))
      }
    },
    setReferConfigValue(content){
    setReferConfigValue(content) {
      let submitFormJson = JSON.stringify(content);
      this.referConfigText=submitFormJson
      if(this.CurrentCell){
      this.referConfigText = submitFormJson
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'referConfig', JSON.stringify(content))
      }else {
      } else {
        this.$set(this.attrRow, 'referConfig', JSON.stringify(content))
      }
    },
    // 排序
    // 排序 this.AddCellFlag=false;
    sortChange(val) {
      console.log(val)
      // console.log(val)
    },
    //开启编辑
    editOpen(){
      this.editOpenFlag=true;
    editOpen() {
      this.editOpenFlag = true;
      this.AddCellFlag = false;
    },
    //定义一个关闭编辑的方法供子组件使用
    editClose() {
      this.editOpenFlag = false;
    },
    //批量设置switch
    batchSetFlag(value){
      this.attrSelectList.forEach(item=>{
        item[this.selectvalue]=value;
    batchSetFlag(value) {
      this.attrSelectList.forEach(item => {
        item[this.selectvalue] = value;
      })
    }
  }
}
</script>
<style scoped lang="scss" >
<style lang="scss" scoped>
.app {
   /deep/ .el-button {
   //margin: 0 10px 10px 0;
   }
  /deep/ .el-button {
    //margin: 0 10px 10px 0;
  }
}
.el-button-group {
  margin-right: 10px;
  margin-bottom: 10px;