ludc
2023-07-14 7602a824e39e19260ae32bb45e799e6ce43300ac
Source/UBCS-WEB/src/views/code/code.vue
@@ -92,12 +92,19 @@
            @click="handleRange">
            使用范围
          </el-button>
          <el-button
          <el-button
              size="small"
              icon="icon-qingkong"
              plain
              @click="clearAllCodeSec">
              清空码值
          </el-button>
          <el-button
              size="small"
              icon="el-icon-guide"
              plain
              @click="escapeOwner">
              转移所有者
          </el-button>
        </template>
      </avue-crud>
@@ -118,7 +125,7 @@
      width="800px"
      style="height: 116vh; margin-top: -10vh;">
      <avue-crud
        :option="dialogeOption"
        :option="dialogeOption"
        :table-loading="dialogLoading"
        :data="useRangeData"
        @refresh-change="refreshUseRangeChange">
@@ -220,6 +227,27 @@
        <el-button @click="cloneOtherCodeRuleSettingBox = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 编码规则,转移所有者对话框 -->
    <el-dialog
      :visible.sync="escapeOwnerVisible"
      append-to-body
      title="转移所有者"
      width="30%">
      <el-select v-model="ruleOwner" placeholder="请选择" class="selects">
        <el-option
          v-for="item in ruleAdminUserList"
          :key="item.VALUE"
          :label="item.LABLE"
          :value="item.VALUE"
          class="seloption">
        </el-option>
      </el-select>
        <span slot="footer" class="dialog-footer">
          <el-button @click="escapeOwnerVisible = false">取 消</el-button>
          <el-button type="primary" @click="escapeOwnerConfirm">确 定</el-button>
        </span>
    </el-dialog>
    <!-- 基础码段展示区域 -->
    <basic-container class="code-basicsec-container">
@@ -300,6 +328,7 @@
            size="small"
            icon="el-icon-search"
            plain
            :disabled="selectionList.length <= 0"
            @click="openAdvancedQuery('codeBasicSec')">
            高级查询
        </el-button>
@@ -325,8 +354,8 @@
                <basic-container>
                  <div class="abox" style="height:54vh">
                    <avue-tree
                      :data="classifyValueTreeData"
                      :option="classisyValueTreeOption"
                      :data="classifyValueTreeData"
                      :option="classisyValueTreeOption"
                      @node-click="classisyValueTreeOnodeClick"
                      style="overflow-y: auto; height: 54vh"/>
                  </div>
@@ -417,6 +446,8 @@
      append-to-body
      style="height: 115vh; margin-top: -13vh; overflow: hidden"
      destroy-on-close
      lock-scroll
      :close-on-click-modal="false"
      @close="clearBasicAddForm">
      <!--  第一层对话框,添加码段信息对话框中的内容 -->
@@ -430,7 +461,7 @@
            <el-form-item label="码段名称:" :label-width="leftFormLabelWidth" required>
              <el-input ref="name"  v-model="form.name" :readonly="basicSecOnlyRead"></el-input>
            </el-form-item>
            <el-form-item label="码段类型" :label-width="leftFormLabelWidth" required>
              <el-select v-model="form.secType" placeholder="请选择" @change="changeSectypeFormItems(null)" :disabled="basicSecOnlyRead">
                <el-option
@@ -488,7 +519,7 @@
                </el-input>
              </el-form-item>
              <el-form-item label="属性所在分类:" :label-width="rightFormLabelWidth">
                <el-input
                <el-input
                  v-model="form.referCodeClassifyOidName"
                  disabled>
              </el-input>
@@ -526,8 +557,8 @@
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="补位时的字符:" :label-width="rightFormLabelWidth">
                <el-select v-model="form.codeFillSeparatorSelect" @blur="inputSelectBlur" filterable placeholder="请选择" :disabled="basicSecOnlyRead">
              <el-form-item v-if="form.codeFillType!='code_fill_none'" label="补位时的字符:" :label-width="rightFormLabelWidth">
                <el-select v-model="form.codeFillSeparator" @blur="inputSelectBlur" filterable placeholder="请选择" :disabled="basicSecOnlyRead">
                  <el-option
                    v-for="item in enumParam.codeFillSeparator"
                    :key="item.itemValue"
@@ -565,7 +596,7 @@
                <el-input v-model.number="form.codeLevelValue" ref="codeLevelValue"  :readonly="basicSecOnlyRead"></el-input>
              </el-form-item>
              <el-form-item label="字符截取类型:" :label-width="rightFormLabelWidth" required>
                <el-select v-model="form.valueCutType" placeholder="请选择" :disabled="basicSecOnlyRead">
                <el-select v-model="form.valueCutType" placeholder="请选择" :disabled="basicSecOnlyRead" @change="changeCutType($event)">
                  <el-option
                    v-for="item in enumParam.codeCutType"
                    :key="item.itemValue"
@@ -573,6 +604,9 @@
                    :value="item.itemValue">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item id="ShowOrHide" v-if="form.valueCutType!='code_cut_none'" label="值截取长度:" :label-width="rightFormLabelWidth">
                <el-input v-model.number="form.valueCutLength" ref="valueCutLength"  :readonly="basicSecOnlyRead"></el-input>
              </el-form-item>
              <el-form-item label="取值类型:" :label-width="rightFormLabelWidth">
                <el-select v-model="form.codeGetValueType" placeholder="请选择" :disabled="basicSecOnlyRead">
@@ -589,7 +623,7 @@
            <div v-show="form.secType==='coderefersec' ? true:false">
              <el-form-item label="参照引用的业务类型:" label-width="152px" required>
                <el-input
                  ref="referBtmId"
                  ref="referBtmId"
                  placeholder="请选择"
                  prefix-icon="el-icon-search"
                  readonly="true"
@@ -601,7 +635,7 @@
              </el-form-item>
              <el-form-item label="参照配置:" label-width="152px" required>
                <el-input
                  ref="referConfig"
                  ref="referConfig"
                  placeholder="请选择"
                  prefix-icon="el-icon-search"
                  readonly="true"
@@ -663,8 +697,8 @@
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="补位时的字符:" :label-width="rightFormLabelWidth">
                <el-select v-model="form.codeFillSeparatorSelect" filterable @blur="inputSelectBlur" placeholder="请选择" :disabled="basicSecOnlyRead">
              <el-form-item v-if="form.codeFillType!='code_fill_none'" label="补位时的字符:" :label-width="rightFormLabelWidth">
                <el-select v-model="form.codeFillSeparator" filterable @blur="inputSelectBlur" placeholder="请选择" :disabled="basicSecOnlyRead">
                  <el-option
                    v-for="item in enumParam.codeFillSeparator"
                    :key="item.itemValue"
@@ -677,11 +711,11 @@
          </span>
        </el-form>
      </div>
      <!-- 第一层对话框的按钮和,线条 -->
      <!-- 第一层对话框的按钮和分隔线条 -->
      <el-divider class="horizontal-line" direction="horizontal"></el-divider>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="saveOrEditBasicCode" v-show="showbtn">保 存</el-button>
        <el-button @click="addBasicCodeSettingBox = false" v-show="showbtn">取 消</el-button>
        <el-button type="primary" @click="saveOrEditBasicCode" :disabled="!showbtn">保 存</el-button>
        <el-button @click="addBasicCodeSettingBox = false">取 消</el-button>
      </div>
      <!--  第二层对话框,属性码段,属性选择对话框 -->
@@ -730,11 +764,11 @@
      </el-dialog>
      <!-- 第二层对话框,属性码段,公式编辑框对话框组件 -->
      <formula-editor
        ref="formulaEditor"
        @updateFormulaContent="updateFormulaContent"
        :thisSceneTableData="formulaEditorParams.thisSceneTableData"
      <formula-editor
        ref="formulaEditor"
        @updateFormulaContent="updateFormulaContent"
        :visible.sync="formulaEditorParams.formulaEditorSettingBox"
        :thisSceneTableData="formulaEditorParams.thisSceneTableData"
        :systemVariableTableData="formulaEditorParams.systemVariableTableData">
      </formula-editor>
@@ -748,7 +782,7 @@
        <avue-crud
          :page.sync="parentClsfyParams.parentClassifyDataPage"
          :ref="parentClsfyParams.ref"
          :option="parentClsfyParams.parentClassifyParentOption"
          :option="parentClsfyParams.parentClassifyParentOption"
          :table-loading="parentClsfyParams.classifyDialogLoading"
          :data="parentClsfyParams.parentClassifyData"
          @refresh-change="refreshParentClassifyDataChange"
@@ -773,17 +807,12 @@
        @echoReferBtmType="echoReferBtmType">
      </refer-btm-type-crud-dialog>
      <!-- 第二层对话框,自定义参照配置Form组件 -->
      <refer-config-form-dialog
        ref="referConfigFormDialog"
        @echoReferConfig="echoReferConfig">
      </refer-config-form-dialog>
      <!-- 第二层对话框,直接选择参照配置crud组件 -->
      <refer-config-crud-dialog
        ref="referConfigCrudDialog"
        @openReconfigInterFace="openReconfigInterFace"
        @echoReferConfig="echoReferConfig">
      </refer-config-crud-dialog>
      <!-- 第二层对话框,参照配置组件 -->
      <refer-config-dialog
        :display="referConfigVisble"
        @setReferConfigValue="setReferConfigValue"
        :referConfigOption="referConfigOption">
      </refer-config-dialog>
    </el-dialog>
@@ -792,12 +821,12 @@
<script>
  import { gridCodeRule, getDetail, add, update, remove, listUseRange, updateStatus,clone,clearAllCode } from "@/api/code/mdmrule";
  import {
    gridCodeBasicSec,
    downOrderNum,
    upOrderNum,
    deleteData,
    editSave,
  import {
    gridCodeBasicSec,
    downOrderNum,
    upOrderNum,
    deleteData,
    editSave,
    cloneCodeBasic,
    addSave,
    refDataGridClassifySec,
@@ -817,8 +846,7 @@
  import parentClassifyParentOption from "@/const/code/parentClassifyParentOptionDialog";
  import fixedValueOption from "@/const/code/fixedValueMgrDialog";
  import {mapGetters} from "vuex";
  import func from "@/util/func";
  import {MasterTable} from "@/api/GetItem";
  import {getByRoleUserList} from "@/api/system/user";
  export default {
      data() {
@@ -852,6 +880,10 @@
          cloneBasicOption: cloneBasicOption,
          cloneCodeRuleOption: cloneCodeRuleOption,
          selectionOtherCloneCodeBasicList: [], // 当前选中的基础码段
          /** 转移所有者对话框 */
          escapeOwnerVisible: false,
          ruleAdminUserList: [], //规则管理员列表
          ruleOwner: '', // 当前要转移给哪个规则管理员的ID
          /*使用范围对话框显示控制*/
          codeRangeSettingBox: false,
@@ -908,7 +940,7 @@
            codeFixedSecOid: "",
            description: "",
            id: "",
          },
          },
          isShowFixedForm: true, //true显示固定码段码值管理界面,false显示分类码段码值管理界面
          fixedValueData: [], //固定码段码值表格数据
          fixedValueOption: fixedValueOption, //表格配置
@@ -924,7 +956,6 @@
          },
          classisyValueTreeOption: classisyValueTreeOption, //分类码段树相关配置项
          classifyValueTreeData: [],
          //currentSelectClsValueTreeData: '', //当前选中的分类码值树节点
          /* 为属性选取值窗口显示打开控制变量 */
          isShowSelectAttrOption: false,
@@ -933,7 +964,7 @@
          treeOption: treeOption,
          currentSelectTreeData: '', //当前选中的树节点
          /* 为属性选值右侧表格相关数据 */
          selectAttrParams: {
            ref: "selectionAttrCrud",
            attrOption: attrOption,
@@ -1011,7 +1042,7 @@
            ],
            formulaEditorSettingBox: false,
          },
          /* 父分类码段对话框 */
          parentClsfyParams: {
            ref: 'crudParentClassify',
@@ -1028,7 +1059,7 @@
            parentClassifyQuery: {}, //查询条件
            parentClassifySelectionList: [], //当前选中行
          },
          /** 参照引用的业务类型对话框相关数据 */
          referBtmDialogParams: {
            ref: 'crudReferBtm',
@@ -1048,7 +1079,7 @@
            componentCodeFlag: false, //是否参与编码
            pkCodeRule: '', //所属编码规则
          },
          //枚举和可输可选查询
          enumParam: {
            secTypeList:[],    //码段类型
@@ -1069,8 +1100,13 @@
            ref: 'advancedQuery',
            advancedQuerySettingBox: false,
            options: [],
            currentOpen: '', //当前打开高级查询的窗口是
            //conditionMapParams: {},
          },
          //引用码段中参照配置组件相关参数
          referConfigOption: {},
          referConfigVisble: false,
        };
      },
@@ -1088,36 +1124,83 @@
      watch:{
      },
      mounted(){
        this.loadTotalEnum();
      },
      // 解决表格错行问题
      activated () {
        this.$nextTick(() => {
          this.$refs.crud.doLayout();
          this.$refs.crudBasic.doLayout();
        })
      },
      methods: {
        /** 转移规则所有者对话框 */
        escapeOwner(){
          if (this.selectionList.length === 0) {
            this.$message.warning("请选择一条编码规则!");
            return;
          }
          this.escapeOwnerVisible = true;
          getByRoleUserList("规则管理员").then(res=>{
            this.ruleAdminUserList = res.data.data;
          });
        },
        /** 确认转移所有者 */
        escapeOwnerConfirm(){
          if(!this.ruleOwner){
            this.$message.warning("请选择您要转移的规则管理员!");
            return;
          }
          this.selectionList[0].owner = this.ruleOwner;
          let data = this.selectionList[0];
          update(data).then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "规则转移成功!"
            });
            this.escapeOwnerVisible = false;
          }, error => {
            console.log(error);
          });
        },
        /** 高级查询对话框组件,组件返回的值是condtionMap[field]形式的查询条件,保留了和之前一样的方式 */
        echoSeniorContionMap(conditionMaps){
          // console.log(conditionMaps);
          this.query = conditionMaps;
          this.onLoad(this.page);
          //console.log(conditionMaps);
          if(JSON.stringify(conditionMaps)!='{}'){
            if(this.advancedQueryParam.currentOpen =='codeRule'){
              this.query = conditionMaps;
              this.onLoad(this.page);
            }else{
              this.sendGridCodeBasicSec(conditionMaps,true);
            }
            //console.log(conditionMaps);
          }
        },
        /* 公式编辑框内容改变,子组件编辑完公式之后内容回显时调用 */
        updateFormulaContent(content){
          this.form.getValueClass = content;
        },
        /* 引用码段参照配置,子组件填完参照配置之后内容回显时调用 */
        echoReferConfig(content){
        setReferConfigValue(content){
          // console.log(content.referTypeName);
          this.form.referBtmId = content.referType;
          this.form.referBtmName = content.referTypeName;
          this.form.referBtmId = content.referType || '';
          this.form.referBtmName = content.referTypeName || content.referType;
          //转换成JSON字符串进行父组件回显
          let submitFormJson = JSON.stringify(content);
          this.form.referConfig = submitFormJson;
          this.form.referConfig = submitFormJson || '';
        },
        /** 引用码段为【参照引用的业务类型】选取值之后的内容回显时调用 */
        echoReferBtmType(content){
            // 实现回显
            this.form.referBtmId = content.id;
            this.form.referBtmName = content.name;
          // 实现回显
          this.form.referBtmId = content.id || '';
          this.form.referBtmName = content.name || content.id;
        },
        /** 父分类选择对话框,第二层嵌套对话框,及其相关方法 */
        /** 父分类选择对话框,第二层嵌套对话框,及其相关方法 */
        // 保存当前父分类码段的选中行,并进行回显
        saveSelectedParentClassify(){
          //console.log(this.parentClsfyParams.parentClassifySelectionList.length);
@@ -1169,8 +1252,13 @@
          let parentClsParam = this.parentClsfyParams;
          parentClsParam.classifyDialogLoading = true;
          let oid = this.selectionList.length==0 ? this.form.pkCodeRule:this.selectionList[0].oid;
          Object.assign(params,{pkCodeRule:oid})
          refDataGridClassifySec(page.currentPage, page.pageSize, Object.assign(params, parentClsParam.parentClassifyQuery)).then(res => {
          let conditionMaps = {};
          conditionMaps['conditionMap[pkCodeRule]'] = oid;
          refDataGridClassifySec(
            page.currentPage,
            page.pageSize,
            conditionMaps
          ).then(res => {
            //console.log(res.data);
            const data = res.data.data;
            parentClsParam.parentClassifyDataPage.total = data.total;
@@ -1179,9 +1267,9 @@
            this.parentClassifySelectionClear();
          });
        },
        /** 打开属性选取值,第二层嵌套对话框,及其相关方法 */
        /** 打开属性选取值,第二层嵌套对话框,及其相关方法 */
        // 获取当前被选中树节点的oid
        nodeClick(data) {
          this.currentSelectTreeData = data;
@@ -1191,23 +1279,25 @@
        loadlistClassifyLinkAttr() {
          let attrParam = this.selectAttrParams;
          //console.log(this.currentSelectTreeData);
          attrParam.selectAttrOptionLoading = true;
          let param = {};
          // 多个conditionMap这样传参
          this.selectAttrParams.selectAttrOptionLoading = true;
          let conditionMaps = {};
          if(attrParam.selectAttrQeury){
              Object.keys(attrParam.selectAttrQeury).forEach(key=>{
                  param['conditionMap['+key+']'] = attrParam.selectAttrQeury[key];
              });
          }
          param['conditionMap[codeClassifyOid]'] = this.currentSelectTreeData.oid;
          param['conditionMap[btmTypeOid]'] = this.currentSelectTreeData.btmTypeOid;
          listClassifyLinkAttr(param).then(res=>{
            //console.log(res.data.data);
            attrParam.selectAttrData = res.data.data;
            attrParam.selectAttrOptionLoading = false;
            this.$nextTick(() => {
                this.$refs[attrParam.ref].doLayout()
            Object.keys(attrParam.selectAttrQeury).forEach(key=>{
              conditionMaps['conditionMap['+key+']'] = attrParam.selectAttrQeury[key].trim();
            });
          }
          conditionMaps['conditionMap[codeClassifyOid]'] = this.currentSelectTreeData.oid;
          conditionMaps['conditionMap[btmTypeOid]'] = this.currentSelectTreeData.btmTypeOid;
          listClassifyLinkAttr(conditionMaps).then(res=>{
            const data = res.data;
            this.$nextTick(() => {
              this.$refs[attrParam.ref].doLayout()
            });
            //console.log(data.data);
            this.selectAttrParams.selectAttrData = data.data;
            this.selectAttrParams.selectAttrOptionLoading = false;
            // 将搜索框内容置空
            this.selectAttrParams.selectAttrQeury = {};
          })
        },
        // 点击搜索后触发该事件
@@ -1249,7 +1339,7 @@
          })
          this.isShowSelectAttrOption = false;
        },
        /** 基础码段表中的码值管理的相关方法 */
        // 码值管理弹窗控制
@@ -1369,6 +1459,11 @@
            });
          }else {
            this.codeClassifyForm.oid = this.selectedFixedOrCodeclassifyValue.attributes.oid;
            // 分类码段,子分类和父分类之间不能相互更改
            if(this.checkClassUpdate(this.codefixedsecOrCodeclassifysecOid,this.codeClassifyForm.codeClassifySecOid)){
              return;
            }
            this.$delete(this.codeClassifyForm,"parentClassifyValueOid");
            editCodeClassifyValue(this.codeClassifyForm).then(() => {
                this.loadClassifyValueData({"oid":this.codefixedsecOrCodeclassifysecOid})
                this.$message({
@@ -1379,10 +1474,10 @@
                window.console.log(error);
            });
          }
        },
        //删除码值
        delCodeSecValue(condition){
        delCodeSecValue(condition){
          //固定码段码值删除
          if(condition == 'codefixedsec'){
            //console.log(this.selectedFixedOrCodeclassifyValue.oid);
@@ -1405,6 +1500,9 @@
              });
            });
          }else{
            if(this.checkClassUpdate(this.codefixedsecOrCodeclassifysecOid,this.codeClassifyForm.codeClassifySecOid)){
              return;
            }
            //分类码段码值删除
            this.$confirm("是否删除这条数据?如果被引用将不能被删除!", {
              confirmButtonText: "确定",
@@ -1424,8 +1522,7 @@
                message: "操作成功!"
              });
            });
          }
          }
        },
        //对固定码值表进行:上移、下移、移除操作
        codeFixedValueOpetion(condition,row){
@@ -1465,10 +1562,13 @@
        },
        //对分类码值表进行:上移、下移、移除操作
        codeClassifyValueOpetion(condition){
          if(this.checkClassUpdate(this.codefixedsecOrCodeclassifysecOid,this.codeClassifyForm.codeClassifySecOid)){
            return;
          }
          //此处涉及到深浅拷贝问题,但是执行上下移保存操作之后会重新加载treedata,所以影响不大
          let currentTreeList = this.getCodeClassifyValueTreeData();
          let saveData = [];
          console.log(currentTreeList.treeList);
          // console.log(currentTreeList.treeList);
          if(condition == 'up'){
            if(currentTreeList.index-1>=0){
              // 调整顺序
@@ -1486,10 +1586,8 @@
              saveData[0].orderNum = parseInt(saveData[0].orderNum)+1;
              saveData[1].orderNum = parseInt(saveData[1].orderNum)-1;
              this.saveCodeFixedOrClassifyValueOption('classifyValue',saveData);
            }
            }
          }
          console.log(saveData);
          console.log(this.classifyValueTreeData);
        },
        //选中被调整顺序的两个树的节点
        getCodeClassifyValueTreeData(){
@@ -1499,10 +1597,10 @@
          */
          //说明是根节点,直接找再判断是否是边界值
          if(currentNodeTreeData.parentId.trim() == ''){
            return this.findTreeIndex(this.classifyValueTreeData,currentNodeTreeData.oid,true);
            return this.findTreeIndex(this.classifyValueTreeData,currentNodeTreeData.oid,true);
          }else{
            //说明不是根节点,先找到父节点再找到子节点,判断是否是边界值
            return this.findTreeIndex(this.classifyValueTreeData,currentNodeTreeData.parentId,false);
            return this.findTreeIndex(this.classifyValueTreeData,currentNodeTreeData.parentId,false);
          }
        },
        /**
@@ -1528,7 +1626,7 @@
          }
        },
        //上移下移等操作的保存
        saveCodeFixedOrClassifyValueOption(condition,editOrderNumdata){
        async saveCodeFixedOrClassifyValueOption(condition,editOrderNumdata){
          //保存对固定码段码值的上移下移移出等操作
          if(condition == "fixedValue"){
            let data = {
@@ -1547,7 +1645,7 @@
            });
          }else {
            //保存对分类码值码段码值的上移下移移出等操作
            saveCodeClassifyValueOrder({
            await saveCodeClassifyValueOrder({
              "codeClassifySecOid": this.codefixedsecOrCodeclassifysecOid,
              "dtoList": JSON.stringify(editOrderNumdata),
            }).then(() => {
@@ -1560,7 +1658,7 @@
            });
            this.loadClassifyValueData({"oid":this.codefixedsecOrCodeclassifysecOid});
          }
        },
        //分类码值树data加载
        loadClassifyValueData(row){
@@ -1586,417 +1684,26 @@
          this.codeClassifyForm.id = node.attributes.id;
          this.codeClassifyForm.name = node.attributes.name;
          this.codeClassifyForm.parentClassifyValueOid = node.attributes.oid;
          //console.log(this.codeClassifyForm);
          // console.log(this.codeClassifyForm);
        },
        /** 基础码段相关方法 */
        //防止打开过编辑窗口之后表单中存在值,所以需要清空,并初始化form表单属性
        clearBasicAddForm(){
          this.form = this.$options.data().form;
          // this.changeSectypeFormItems(null);
        },
        // 打开新增窗口
        openAddBasicCodeSec(){
          if(!this.tipsMessage(this.selectionList)){
            return;
          }
          if(this.selectionList[0].lcStatus != 'Editing'){
            this.$message.warning('编码规则状态不是"编辑中",不允许编辑码段!');
            return;
          }
          this.openBasicDialog('add',null);
          this.loadCodeSecType();
        },
        // 打开新增或编辑基础码段对话框
        openBasicDialog(condition,row){
          //console.log(row);
          if(condition == 'add') {
            this.basicSecDialogTitle = '添加码段信息';
            this.showbtn = true;
            this.basicSecOnlyRead = false;
          }else if(condition == 'edit'){
            if(this.selectionList.length!=1){
              this.$message.warning('请选择一条编码规则数据!');
              return;
            }
            this.basicSecDialogTitle = '修改码段信息';
            this.showbtn = true;
            this.basicSecOnlyRead = false;
            //为form绑定值
          }else{
            this.basicSecDialogTitle = '查看码段信息';
            this.showbtn = false;
            this.basicSecOnlyRead = true;
          }
          //console.log(this.form);
          this.changeSectypeFormItems(condition == 'add' ? null:row);
          this.addBasicCodeSettingBox = true;
        },
        // 新增基础码段
        saveOrEditBasicCode(){
          if(this.selectionList[0].oid == null ||  this.selectionList[0].oid == ''){
            this.$message.warning('缺失必要参数,请重新选择编码规则后再试!');
            return;
          }
          this.form.pkCodeRule = this.selectionList[0].oid;
          if(this.form.oid == '' || this.form.oid == null){
            if(this.checkForm()){
              addSave(this.form).then(() => {
                this.$message({
                  type: "success",
                  message: "操作成功!"
                });
              }, error => {
                window.console.log(error);
              });
              // 关闭对话框
              this.addBasicCodeSettingBox = false
            }
          }else{
            editSave(this.form).then(() => {
               // 关闭对话框
              this.addBasicCodeSettingBox = false
              this.$message({
                type: "success",
                message: "操作成功!"
              });
              }, error => {
                window.console.log(error);
            });
          }
          // 点击新增基础码段,关闭窗口之后触发重新加载
          this.loadBasic(this.selectionList[0]);
        },
        // 因为elementui的表单校验设置不上所以采用判断的方式来做表单检验方式
        checkForm(){
          let form = this.form;
          //console.log(form);
          const regNumber = /^[0-9]+\.{0,1}[0-9]*$/; //数字或小数正则校验
          const tipsMsg = "必填项不能为空";
          if(form.id == ''){
            this.$message.warning("(码段编号)"+tipsMsg);
            this.$refs.id.$el.querySelector('input').focus();
            return false;
          }
          if(form.name == ''){
            this.$message.warning("(码段名称)"+tipsMsg);
            this.$refs.name.$el.querySelector('input').focus();
            return false;
          }
          if(form.secType == ''){
            this.$message.warning("(码段类型)"+tipsMsg);
            this.$refs.secType.$el.querySelector('select').focus();
            return false;
          }
          if(form.secType==='codefixedsec'){
            //固定码段
            if(form.codeSecLengthType == ''){
              this.$message.warning("(码段长度类型)"+tipsMsg);
              this.$refs.codeSecLengthType.$el.querySelector('select').focus();
              return false;
            }
            if(form.codeSecLength == ''){
              this.$message.warning("(码段长度)"+tipsMsg);
              this.$refs.codeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning("码段的长度必须为数字值");
              this.$refs.codeSecLength.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codeattrsec'){
            //属性码段
            if(form.referAttributeId == ''){
              this.$message.warning('(属性)'+tipsMsg);
              this.$refs.referAttributeId.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codeserialsec'){
            console.log(form.codeFillType);
            //流水码段
            if(form.codeSecLength == ''){
              this.$message.warning('(码段的长度)'+tipsMsg);
              this.$refs.seriaCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning('码段的长度必须为数字值');
              this.$refs.seriaCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.serialStart)){
              this.$message.warning('流水号的起始值必须为数字值');
              this.$refs.serialStart.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.serialStep)){
              this.$message.warning('流水的步长必须为数字值');
              this.$refs.serialStep.$el.querySelector('input').focus();
              return false;
            }
            if(form.codeFillType == ''){
              this.$message.warning('(编码补位方式)'+tipsMsg);
              return false;
            }
            if(form.codeFillType != '不补位' && form.codeFillSeparatorSelect == ''){
              this.$message.warning('当补位方式为左补位或者右补位的时候,补位字符不能为空');
              return false;
            }
            if(form.codeFillLength == ''){
              this.$message.warning('填充长度不能为空');
              this.$refs.codeFillLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeFillLength)){
              this.$message.warning('填充长度必须为数字值');
              this.$refs.codeFillLength.$el.querySelector('input').focus();
              return false;
            }
            if(form.codeFillLimit == ''){
              this.$message.warning('(流水上限)'+tipsMsg);
              this.$refs.codeFillLimit.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeFillLimit)){
              this.$message.warning('流水上限必须为数字值');
              this.$refs.codeFillLimit.$el.querySelector('input').focus();
              return false;
            }
            if(form.codeFillFlag == ''){
              this.$message.warning('(流水是否补码)'+tipsMsg);
              this.$refs.switch.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codelevelsec'){
            //层级码段
            if(form.codeLevelType == ''){
              this.$message.warning('(层级类型)'+tipsMsg);
              return false;
            }
            if(!regNumber.test(form.codeLevelValue)){
              this.$message.warning('层级的值)只能填写数字');
              this.$refs.codeLevelValue.$el.querySelector('input').focus();
              return false;
            }
            if(form.valueCutType == ''){
              this.$message.warning('(字符截取类型)'+tipsMsg);
              this.$refs.valueCutType.$el.querySelector('select').focus();
              return false;
            }
          }else if(this.form.secType==='coderefersec'){
            //引用码段
            if(form.referBtmId == ''){
              this.$message.warning('(参照引用的业务类型)'+tipsMsg);
              this.$refs.referBtmId.$el.querySelector('input').focus();
              return false;
            }
            if(form.referConfig == ''){
              this.$message.warning('(参照配置)'+tipsMsg);
              this.$refs.referConfig.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codedatesec'){
            //日期码段
            if(form.codeDateFormatStr == ''){
              this.$message.warning('(日期格式)'+tipsMsg);
              this.$refs.codeDateFormatStr.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codeclassifysec'){
            //分类码段
            if(form.codeSecLengthType == ''){
              this.$message.warning('(码段长度类型)'+tipsMsg);
              return false;
            }
            if(form.codeSecLength == ''){
              this.$message.warning('(码段长度)'+tipsMsg);
              this.$refs.classCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning('码段的长度必须为数字值');
              this.$refs.classCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codevariablesec'){
            //可变码段
            if(form.codeSecLength == ''){
              this.$message.warning('(码段长度)'+tipsMsg);
              this.$refs.varCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning('码段的长度必须为数字值');
              this.$refs.classCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(form.codeFillType == ''){
              this.$message.warning('(编码补位方式)'+tipsMsg);
              return false;
            }
            if(form.codeFillType != '不补位' && form.codeFillSeparatorSelect == ''){
              this.$message.warning('当补位方式为左补位或者右补位的时候,补位字符不能为空');
              return false;
            }
          }
          return true;
        },
        // 判断数据是否选择以及只能选择单条数据
        tipsMessage(list){
          if(list.length != 1){
            this.$message.warning("请选择一条编码规则数据!");
            return false;
          }
          return true;
        },
        // 基础码段删除
        deleteBasicCode(){
          if(!this.tipsMessage(this.selectionBasicList)){
            return;
          }
          let oid = this.selectionBasicList[0].oid;
          this.$confirm("是否删除这条数据?如果被引用将不能被删除!", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            let ts = new Date(this.selectionBasicList[0].ts).getTime();
            return deleteData({"oid": oid,"ts": ts});
          })
          .then(() => {
            this.loadBasic({"oid":this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' ? this.selectionList[0].oid:this.currentCodeRuleOid});
        /**
         * 分类码段码值,修改、删除、上下移之前,检查是否为子分类和父分类之间相互更改
         * @currentRowClassOid 当前选中行oid
         * @updateClassOid 要修改的分类码值oid
         */
         checkClassUpdate(currentRowClassOid,updateClassOid){
          if(currentRowClassOid!=updateClassOid){
            this.$message({
              type: "success",
              message: "操作成功!"
              type: "error",
              message: "操作失败【子分类与父分类之间不能相互修改码值】!"
            });
            this.$refs.crudBasic.toggleSelection();
          });
        },
        // 点击触发加载基础码段信息
        loadBasic(row){
          if(this.cloneSettingBox){
            this.cloneTableLoading = true;
          }else{
            this.loadingBasic = true;
          }
          // console.log(row.oid);
          //存储当前关联的编码规则相关信息
          this.currentCodeRuleOid = row.oid;
          this.currentRuleLcStatus = row.lcStatus;
          this.sendGridCodeBasicSec({"pkCodeRule":row.oid});
          return currentRowClassOid!=updateClassOid;
        },
        // 发送加载基础码段的请求
        sendGridCodeBasicSec(condition){
          // 如果当前基础码段表中的搜索按钮被隐藏,就需要在此开启
          if(this.selectionList.length>=0 && !this.$refs.crudBasic.option.column[0].search){
            this.hideBasicTable(true);
          }
          gridCodeBasicSec(1, -1, condition).then(res => {
            const data = res.data.data;
            if(this.cloneSettingBox){
              this.cloneData = data.records;
              // console.log(tihs.cloneData);
              this.cloneTableLoading = false;
            }else {
              this.basicData = data.records;
              // console.log(this.basicData);
              this.loadingBasic = false;
            }
          });
        },
        // 基础码段选中时触发
        selectionBasicChange(list) {
          this.selectionBasicList = list;
          this.$refs.crudBasic.setCurrentRow(this.selectionBasicList[list.length-1]);
          //console.log(this.selectionBasicList);
        },
        // 基础码段被单击表格行时触发
        codeBasicSecRowClick(row){
          this.$refs.crudBasic.toggleSelection();
          this.selectionBasicList = row;
          this.$refs.crudBasic.setCurrentRow(row);
          this.$refs.crudBasic.toggleRowSelection(row); //选中当前行
        },
        basicSearchChange(params, done){
          //console.log(this.$refs.crudBasic);
          this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule":this.selectionList[this.selectionList.length-1].oid}));
          done();
        },
        basicSearchReset(){
          this.sendGridCodeBasicSec({"pkCodeRule":this.selectionList[this.selectionList.length-1].oid});
        },
        // 上移下移基础码段
        upOrderNum(row){
          //console.log(row.oid);
          if(!this.tipsMessage(this.selectionList)){
            return;
          }
          let codeRuleOid = this.selectionList[0].oid;
          if (this.selectionList[0].lcStatus != 'Editing') {
            this.$message.warning("只有编码规则的状态是 [编辑中] 的时候,才能调整码段顺序!");
            return;
          }
          if(row.oid==null || row.oid==''){
            this.$message.warning("未获取到必填参数!");
            return;
          }
          upOrderNum(row.oid).then(() => {
            this.loadBasic({"oid":codeRuleOid});
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          })
        },
        downOrderNum(row){
          //console.log(row.oid);
          if(!this.tipsMessage(this.selectionList)){
            return;
          }
          let codeRuleOid = this.selectionList[0].oid;
          //console.log(this.selectionList);
          if (this.selectionList[0].lcStatus != 'Editing') {
            this.$message.warning("只有编码规则的状态是 [编辑中] 的时候,才能调整码段顺序!");
            return;
          }
          if(row.oid==null || row.oid==''){
            this.$message.warning("未获取到必填参数!");
            return;
          }
          downOrderNum(row.oid).then(() => {
            this.loadBasic({"oid":codeRuleOid});
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          })
        },
        // 基础码段刷新时查询
        refreshChangeBasicSec(){
          this.loadBasic({"oid":this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' ? this.selectionList[0].oid:this.currentCodeRuleOid});
        },
        // 操作基础码段中搜索清空等按钮的显示/隐藏
        hideBasicTable(hideBoolean){
          this.$refs.crudBasic.option.refreshBtn = hideBoolean;
          this.$refs.crudBasic.option.columnBtn = hideBoolean;
          this.$refs.crudBasic.option.column[0].search = hideBoolean;
          this.$refs.crudBasic.option.column[1].search = hideBoolean;
        },
        /** 编码规则相关方法 */
        // 打开高级查询窗口
        openAdvancedQuery(condition){
          // MasterTable({
          //   codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
          //   functionId: 5,
          // }).then(res=>{
          //   console.log(res.data.tableDefineVO.seniorQueryColumns);
          // })
          if(condition=='codeRule'){
            this.advancedQueryParam.options = [
              {
@@ -2032,8 +1739,8 @@
                title: '状态',
                fieldType: 'combox',
                queryField: 'lcStatus',
                comboxKey: 'Eummaterialtype',
              }
                comboxKey: 'codeSearchLCStatus',
              },
            ]
          }else {
            this.advancedQueryParam.options = [
@@ -2061,6 +1768,7 @@
              }
            ]
          }
          this.advancedQueryParam.currentOpen = condition;
          this.advancedQueryParam.advancedQuerySettingBox = true;
        },
        // 查询使用范围
@@ -2072,7 +1780,7 @@
          this.getRangeCodeList()
        },
        // 加载使用范围列表
        getRangeCodeList(){
        getRangeCodeList(){
          this.dialogLoading = true;
          if(this.selectionList[0].oid==null){
            this.$message.error("未获取到参数!");
@@ -2087,17 +1795,6 @@
        // 刷新使用范围列表
        refreshUseRangeChange(){
          this.getRangeCodeList();
        },
        // 单击编码规则实现行选择
        codeRuleRowClick (row) {
          // 这儿应该可以不要,因为toggleRowSelection也会触发行选择时间
          this.selectionList = row;
          this.$refs.crud.toggleSelection();
          this.$refs.crud.setCurrentRow(row);
          this.$refs.crud.toggleRowSelection(row); //选中当前行
          if(row!=''){
            this.loadBasic(row);
          }
        },
        // 启用与停用
        enableOrDeactivatse(oId,update){
@@ -2151,7 +1848,7 @@
          }, error => {
            window.console.log(error);
          });
          //console.log(data);
          //console.log(data);
        },
        // 打开从其他编码规则中克隆码段对话框
        openOtherCodeRuleDialog(){
@@ -2160,7 +1857,7 @@
          }
          if(this.selectionList[0].lcStatus != 'Editing'){
            this.$message.warning("编码规则已被引用,不允许编辑或删除!");
            return;
            return;
          }
          this.cloneOtherCodeRuleSettingBox = true;
        },
@@ -2195,7 +1892,7 @@
          this.selectionOtherCloneCodeBasicList = list;
          this.$refs.crudCloneCodeBasicOther.setCurrentRow(this.selectionOtherCloneCodeBasicList[list.length-1]);
        },
         // 从其他编码规则中克隆码段信息
        // 从其他编码规则中克隆码段信息
        saveOtherCodeBasic(){
          let oid = this.selectionList[0].oid;
          let fromDialogPkCodebasic = this.selectionOtherCloneCodeBasicList;
@@ -2213,7 +1910,7 @@
          //console.log(res);
          let oidArr = [];
          fromDialogPkCodebasic.forEach(ele => {
            oidArr.push(ele.id);
            oidArr.push(ele.oid);
          });
          let data = {
            "pkCodeRule": oid,
@@ -2261,6 +1958,7 @@
        },
        // 添加
        rowSave(row, done, loading) {
          console.log(row);
          add(row).then(() => {
            this.onLoad(this.page);
            this.$message({
@@ -2332,29 +2030,36 @@
        searchChange(params, done) {
          this.page.currentPage = 1;
          // 多个conditionMap这样传参,快速查询默认采用模糊查询
          let requestData = {};
          if(params){
              Object.keys(params).forEach(key=>{
                this.query['conditionMap['+key+'_like]'] = params[key];
              });
            Object.keys(params).forEach(key=>{
              requestData["conditionMap"+'['+key+'_like]'] = params[key].trim();
            });
          }
          console.log(this.query);
          this.query = requestData;
          this.onLoad(this.page);
          done();
        },
        },
        // 编码规则当前选中行变化的时候触发
        selectionChange(list) {
          this.selectionList = list;
          this.$refs.crud.setCurrentRow(this.selectionList[list.length-1]);
          //当前选中行为空的时候就将码段管理表格数据置空,并禁用相关功能
          if(list == ''){
            this.basicData = [];
          if(this.selectionList.length <= 0){
            this.hideBasicTable(false);
          }
          if(this.selectionList.length > 0){
          if (this.selectionList.length > 0) {
            this.$refs.crud.setCurrentRow(this.selectionList[list.length-1]);
            this.currentCodeRuleOid = this.selectionList[list.length-1].oid;
            this.currentRuleLcStatus = this.selectionList[list.length-1].lcStatus;
            this.loadBasic(this.selectionList[list.length-1]);
          }
        },
        // 单击编码规则实现行选择
        codeRuleRowClick (row) {
          // console.log(this.currentRuleLcStatus);
          this.$refs.crud.toggleSelection();
          this.$refs.crud.toggleRowSelection(row); //选中当前行
        },
        selectionClear() {
          this.selectionList = [];
@@ -2372,8 +2077,8 @@
        onLoad(page,params={}) {
          this.loading = true;
          gridCodeRule(
            page.currentPage,
            page.pageSize,
            page.currentPage,
            page.pageSize,
            this.query
          ).then(res => {
            //console.log(res.data);
@@ -2384,8 +2089,6 @@
            // 查询的值为空时,要将码段管理相关的内容禁用
            if(data.records.length <= 0) {
              this.hideBasicTable(false);
              this.selectionList = [];
              this.basicData = [];
              return;
            }
            this.loadBasic(this.data[0])
@@ -2396,6 +2099,441 @@
            this.selectionList = data.records[0];
            //this.selectionClear();
          });
        },
        /** 基础码段相关方法 */
        //防止打开过编辑窗口之后表单中存在值,所以需要清空,并初始化form表单属性
        clearBasicAddForm(){
          this.form = this.$options.data().form;
          // this.changeSectypeFormItems(null);
        },
        // 打开新增窗口
        openAddBasicCodeSec(){
          if(!this.tipsMessage(this.selectionList)){
            return;
          }
          if(this.selectionList[0].lcStatus != 'Editing'){
            this.$message.warning('编码规则状态不是"编辑中",不允许编辑码段!');
            return;
          }
          this.openBasicDialog('add',null);
          this.loadCodeSecType();
        },
        // 打开新增或编辑基础码段对话框
        openBasicDialog(condition,row){
          //console.log(row);
          if(condition == 'add') {
            this.basicSecDialogTitle = '添加码段信息';
            this.showbtn = true;
            this.basicSecOnlyRead = false;
          }else if(condition == 'edit'){
            if(this.selectionList.length!=1){
              this.$message.warning('请选择一条编码规则数据!');
              return;
            }
            this.basicSecDialogTitle = '修改码段信息';
            this.showbtn = true;
            this.basicSecOnlyRead = false;
            //为form绑定值
          }else{
            this.basicSecDialogTitle = '查看码段信息';
            this.showbtn = false;
            this.basicSecOnlyRead = true;
          }
          //console.log(this.form);
          this.changeSectypeFormItems(condition == 'add' ? null:row);
          this.addBasicCodeSettingBox = true;
        },
        // 新增基础码段
        async saveOrEditBasicCode(){
          if(this.selectionList[0].oid == null ||  this.selectionList[0].oid == ''){
            this.$message.warning('缺失必要参数,请重新选择编码规则后再试!');
            return;
          }
          this.form.pkCodeRule = this.selectionList[0].oid;
          if(this.form.oid == '' || this.form.oid == null){
            if(this.checkForm()){
              await addSave(this.form).then(() => {
                this.$message({
                  type: "success",
                  message: "操作成功!"
                });
              }, error => {
                window.console.log(error);
              });
              // 关闭对话框
              this.addBasicCodeSettingBox = false
            }
            // 点击新增基础码段,关闭窗口之后触发重新加载
            this.loadBasic(this.selectionList[0]);
          }else{
            // 可能参照引用的业务类型会发生改变所以这儿直接对referConfig的json进行改变
            if(this.form.referConfig === "coderefersec" || this.form.referConfig != undefined){
              let referConfig = JSON.parse(this.form.referConfig);
              referConfig.referType = this.form.referBtmId;
              referConfig.referTypeName = this.form.referBtmName;
              this.form.referConfig = JSON.stringify(referConfig);
              // let referValueInfo = JSON.parse(this.form.referValueInfo);
              // referValueInfo.referType = this.form.referBtmId;
            }
            editSave(this.form).then(() => {
              this.$message({
                type: "success",
                message: "操作成功!"
              });
              }, error => {
                window.console.log(error);
            });
            this.loadBasic(this.selectionList[0]);
            // 关闭对话框
            this.addBasicCodeSettingBox = false
          }
        },
        // 因为elementui的表单校验设置不上所以采用判断的方式来做表单检验方式
        checkForm(){
          let form = this.form;
          //console.log(form);
          const regNumber = /^[0-9]+\.{0,1}[0-9]*$/; //数字或小数正则校验
          const regPos =  /^[0-9]*[1-9][0-9]*$/; //非负整数正则校验
          const tipsMsg = "必填项不能为空";
          if(form.id == ''){
            this.$message.warning("(码段编号)"+tipsMsg);
            this.$refs.id.$el.querySelector('input').focus();
            return false;
          }
          if(form.name == ''){
            this.$message.warning("(码段名称)"+tipsMsg);
            this.$refs.name.$el.querySelector('input').focus();
            return false;
          }
          if(form.secType == ''){
            this.$message.warning("(码段类型)"+tipsMsg);
            this.$refs.secType.$el.querySelector('select').focus();
            return false;
          }
          if(form.secType==='codefixedsec'){
            //固定码段
            if(form.codeSecLengthType == ''){
              this.$message.warning("(码段长度类型)"+tipsMsg);
              // this.$refs.codeSecLengthType.$el.querySelector('select').focus();
              return false;
            }
            if(form.codeSecLength == ''){
              this.$message.warning("(码段长度)"+tipsMsg);
              this.$refs.codeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning("码段的长度必须为数字值");
              this.$refs.codeSecLength.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codeattrsec'){
            //属性码段
            if(form.referAttributeId == ''){
              this.$message.warning('(属性)'+tipsMsg);
              this.$refs.referAttributeId.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codeserialsec'){
            //console.log(form.codeFillType);
            //流水码段
            if(form.codeSecLength == ''){
              this.$message.warning('(码段的长度)'+tipsMsg);
              this.$refs.seriaCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning('码段的长度必须为数字值');
              this.$refs.seriaCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.serialStart)){
              this.$message.warning('流水号的起始值必须为数字值');
              this.$refs.serialStart.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.serialStep)){
              this.$message.warning('流水的步长必须为数字值');
              this.$refs.serialStep.$el.querySelector('input').focus();
              return false;
            }
            if(form.codeFillType == ''){
              this.$message.warning('(编码补位方式)'+tipsMsg);
              return false;
            }
            if(form.codeFillType != '不补位' && form.codeFillSeparator == ''){
              this.$message.warning('当补位方式为左补位或者右补位的时候,补位字符不能为空');
              return false;
            }
            if(form.codeFillLength == ''){
              this.$message.warning('填充长度不能为空');
              this.$refs.codeFillLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeFillLength)){
              this.$message.warning('填充长度必须为数字值');
              this.$refs.codeFillLength.$el.querySelector('input').focus();
              return false;
            }
            if(form.codeFillLimit == ''){
              this.$message.warning('(流水上限)'+tipsMsg);
              this.$refs.codeFillLimit.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeFillLimit)){
              this.$message.warning('流水上限必须为数字值');
              this.$refs.codeFillLimit.$el.querySelector('input').focus();
              return false;
            }
            // if(form.codeFillFlag == '' || ){
            //   this.$message.warning('(流水是否补码)'+tipsMsg);
            //   return false;
            // }
          }else if(this.form.secType==='codelevelsec'){
            //层级码段
            if(form.codeLevelType == ''){
              this.$message.warning('(层级类型)'+tipsMsg);
              return false;
            }
            if(form.codeLevelType != 'code_level_min'&& !regNumber.test(form.codeLevelValue)){
              this.$message.warning('(层级的值)只能填写数字');
              this.$refs.codeLevelValue.$el.querySelector('input').focus();
              return false;
            }
            if(form.valueCutType == ''){
              this.$message.warning('(字符截取类型)'+tipsMsg);
              // this.$refs.valueCutType.$el.querySelector('select').focus();
              return false;
            }
            if(form.valueCutType != 'code_cut_none' && !regPos.test(form.valueCutLength)){
              this.$message.warning('(值截取长度)只能填写正整数');
              this.$refs.valueCutLength.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='coderefersec'){
            //引用码段
            if(form.referBtmId == ''){
              this.$message.warning('(参照引用的业务类型)'+tipsMsg);
              this.$refs.referBtmId.$el.querySelector('input').focus();
              return false;
            }
            if(form.referConfig == ''){
              this.$message.warning('(参照配置)'+tipsMsg);
              this.$refs.referConfig.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codedatesec'){
            //日期码段
            if(form.codeDateFormatStr == ''){
              this.$message.warning('(日期格式)'+tipsMsg);
              this.$refs.codeDateFormatStr.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codeclassifysec'){
            //分类码段
            if(form.codeSecLengthType == ''){
              this.$message.warning('(码段长度类型)'+tipsMsg);
              return false;
            }
            if(form.codeSecLength == ''){
              this.$message.warning('(码段长度)'+tipsMsg);
              this.$refs.classCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning('码段的长度必须为数字值');
              this.$refs.classCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
          }else if(this.form.secType==='codevariablesec'){
            //可变码段
            if(form.codeSecLength == ''){
              this.$message.warning('(码段长度)'+tipsMsg);
              this.$refs.varCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(!regNumber.test(form.codeSecLength)){
              this.$message.warning('码段的长度必须为数字值');
              this.$refs.classCodeSecLength.$el.querySelector('input').focus();
              return false;
            }
            if(form.codeFillType == ''){
              this.$message.warning('(编码补位方式)'+tipsMsg);
              return false;
            }
            // console.log(form);
            if(form.codeFillType != 'code_fill_none' && form.codeFillSeparator == ''){
              this.$message.warning('当补位方式为左补位或者右补位的时候,补位字符不能为空');
              return false;
            }
          }
          return true;
        },
        // 判断数据是否选择以及只能选择单条数据
        tipsMessage(list){
          if(list.length != 1){
            this.$message.warning("请选择一条编码规则数据!");
            return false;
          }
          return true;
        },
        // 基础码段删除
        deleteBasicCode(){
          if(!this.tipsMessage(this.selectionBasicList)){
            return;
          }
          let oid = this.selectionBasicList[0].oid;
          this.$confirm("是否删除这条数据?如果被引用将不能被删除!", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            let ts = new Date(this.selectionBasicList[0].ts).getTime();
            return deleteData({"oid": oid,"ts": ts});
          })
          .then(() => {
            this.loadBasic({"oid":this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' ? this.selectionList[0].oid:this.currentCodeRuleOid});
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crudBasic.toggleSelection();
          });
        },
        // 点击触发加载基础码段信息
        loadBasic(row){
          if(this.cloneSettingBox){
            this.cloneTableLoading = true;
          }else{
            this.loadingBasic = true;
          }
          // console.log(row.oid);
          //存储当前关联的编码规则相关信息
          if(row!='' || row!=null){
            this.currentCodeRuleOid = row.oid;
            this.currentRuleLcStatus = row.lcStatus;
            this.sendGridCodeBasicSec({"pkCodeRule":row.oid},false);
          }
        },
        // 发送加载基础码段的请求
        sendGridCodeBasicSec(condition,isAdancedQuery/** 是否高级查询 */){
          // 如果当前基础码段表中的搜索按钮被隐藏,就需要在此开启
          if(this.selectionList.length>=0 && !this.$refs.crudBasic.option.column[0].search){
            this.hideBasicTable(true);
          }
          let conditionMaps = {};
          if(condition && !isAdancedQuery){
            Object.keys(condition).forEach(key=>{
              conditionMaps['conditionMap['+key+']'] = condition[key].trim();
            });
          }
          if(isAdancedQuery){
            condition['conditionMap[pkCodeRule]'] = this.currentCodeRuleOid == null || this.currentCodeRuleOid == ''
            ? this.selectionList[0].oid:this.currentCodeRuleOid;
          }
          gridCodeBasicSec(1, -1,isAdancedQuery ? condition:conditionMaps).then(res => {
            const data = res.data.data;
            if(this.cloneSettingBox){
              this.cloneData = data.records;
              // console.log(tihs.cloneData);
              this.cloneTableLoading = false;
            }else {
              this.basicData = data.records;
              // console.log(this.basicData);
              this.loadingBasic = false;
            }
          });
        },
        // 基础码段选中时触发
        selectionBasicChange(list) {
          this.selectionBasicList = list;
          this.$refs.crudBasic.setCurrentRow(this.selectionBasicList[list.length-1]);
          //console.log(this.selectionBasicList);
        },
        // 基础码段被单击表格行时触发
        codeBasicSecRowClick(row){
          this.$refs.crudBasic.toggleSelection();
          this.selectionBasicList = row;
          this.$refs.crudBasic.setCurrentRow(row);
          this.$refs.crudBasic.toggleRowSelection(row); //选中当前行
        },
        basicSearchChange(params, done){
          //console.log(this.$refs.crudBasic);
          this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule":this.selectionList[this.selectionList.length-1].oid}),false);
          done();
        },
        basicSearchReset(){
          this.sendGridCodeBasicSec({"pkCodeRule":this.selectionList[this.selectionList.length-1].oid},false);
        },
        // 上移下移基础码段
        async upOrderNum(row){
          if(!this.tipsMessage(this.selectionList)){
            return;
          }
          if (this.selectionList[0].lcStatus != 'Editing') {
            this.$message.warning("只有编码规则的状态是 [编辑中] 的时候,才能调整码段顺序!");
            return;
          }
          if(row.oid==null || row.oid==''){
            this.$message.warning("未获取到必填参数!");
            return;
          }
          await upOrderNum(row.oid).then(() => {
            this.loadBasic(this.selectionList[0]);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          })
        },
        downOrderNum(row){
          //console.log(row.oid);
          if(!this.tipsMessage(this.selectionList)){
            return;
          }
          let codeRuleOid = this.selectionList[0].oid;
          //console.log(this.selectionList);
          if (this.selectionList[0].lcStatus != 'Editing') {
            this.$message.warning("只有编码规则的状态是 [编辑中] 的时候,才能调整码段顺序!");
            return;
          }
          if(row.oid==null || row.oid==''){
            this.$message.warning("未获取到必填参数!");
            return;
          }
          downOrderNum(row.oid).then(() => {
            this.loadBasic({"oid":codeRuleOid});
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          })
        },
        // 基础码段刷新时查询
        refreshChangeBasicSec(){
          this.loadBasic(this.selectionList.at(-1));
        },
        // 操作基础码段中搜索清空等按钮的显示/隐藏
        hideBasicTable(hideBoolean){
          this.$refs.crudBasic.option.refreshBtn = hideBoolean;
          this.$refs.crudBasic.option.column[0].search = hideBoolean;
          this.$refs.crudBasic.option.column[1].search = hideBoolean;
          if(!hideBoolean){
            this.selectionList = [];
            this.basicData = [];
          }
        },
        changeCutType(value){
          if (value != 'code_cut_none'){
            if(this.form.valueCutLength == ''){
              this.form.valueCutLength = 1;
            }
          }else{
            this.form.valueCutLength = '';
          }
        },
        /** 第一层对话框相关方法 */
@@ -2414,49 +2552,14 @@
            // 调用子组件刷新表格数据
            this.$refs[this.referBtmDialogParams.ref].referBtmOnLoad();
          }else if(condition === 'referConfig'){
            if(func.notEmpty(this.form.referConfig) || func.notEmpty(this.form.referBtmName)){
              this.openReconfigInterFace(this.form);
            }else{
              this.openTipsChooseOrCust();
            this.referConfigVisble = true;
            this.referConfigOption = {
              referBtmName: this.form.referBtmName,
              referBtmId: this.form.referBtmId,
              referConfig: this.form.referConfig || '',
            }
            this.$refs.referConfig.$el.querySelector('input').blur();
          }
        },
        // 当前已存在编辑过的参照配置,所以直接打开参照配置界面
        openReconfigInterFace(preReferConfigForm){
          // console.log(preReferConfigForm);
          this.$refs.referConfigFormDialog.isShowReferConfigForm = true;
              let value = {
                referTypeName: preReferConfigForm.referBtmName,
                referType: preReferConfigForm.referBtmId,
                referConfig: preReferConfigForm.referConfig,
              }
              this.$refs.referConfigFormDialog.initPageData(value);
        },
        // 打开自定义参照配置或直接选择参照配置的提示框
        openTipsChooseOrCust(){
          this.$confirm('请选择参照配置的定义方式?','参照配置的方式', {
            distinguishCancelAndClose: true,
            closeOnClickModal: false,
            confirmButtonText: '自定义参照配置',
            cancelButtonText: '直接选择参照配置'
          })
          .then(() => {
            // 打开自定参照配置对话框
            this.$refs.referConfigFormDialog.isShowReferConfigForm = true;
            // 表格错行的问题
            this.$refs.referConfigFormDialog.onloadAttrData();
          })
          .catch(action => {
            if (action === "cancel") {
              // 打开直接选择参照配置对话框
              this.$refs.referConfigCrudDialog.isShowReferConfigCrud = true;
              this.$refs.referConfigCrudDialog.referConfigOnload();
            }
            //console.log(action);
          });
          // 让参照配置输入框失去焦点,否则该提示框无法被关闭
          this.$refs.referConfig.$el.querySelector('input').blur();
        },
        // 点击输入框的×号,清空输入框中的内容
@@ -2480,13 +2583,13 @@
        },
        // 补位时的字符,实现可输可选
        inputSelectBlur(e){
          if (e.target.value) {
            this.form.codeFillSeparatorSelect = e.target.value;
          if (e.target.value) {
            this.form.codeFillSeparator = e.target.value;
          }
        },
        // 码段类型改变时,增加对应的form表单中的属性
        changeSectypeFormItems(row){
          //console.log(row);
        changeSectypeFormItems(row){
          //console.log(row);
          if(this.enumParam.secTypeList.length==0){
            this.loadCodeSecType();
          }
@@ -2542,8 +2645,8 @@
              serialStart: row!=null&&row.serialStart != '' ? row.serialStart:1,  //流水号起始值
              serialStep: row!=null&&row.serialStep != '' ? row.serialStep:1,   //流水的步长
              codeFillType: row!=null&&row.codeFillType != '' ? row.codeFillType:'code_fill_left', //编码补位方式
              codeFillSeparatorSelect: row!=null&&row.codeFillSeparator != '' ? row.codeFillSeparatorSelect:0,    //补位时的字符,选中的下拉框的下标
              codeFillSeparator: row!=null&&row.codeFillSeparator != '' ? row.codeFillSeparator:0,          //补位时的字符
              // codeFillSeparatorSelect: row!=null&&row.codeFillSeparatorSelect != '' ? row.codeFillSeparatorSelect:0,    //补位时的字符,选中的下拉框的下标
              codeFillSeparator: row!=null&&row.codeFillSeparator != '' ? row.codeFillSeparator:'0',          //补位时的字符
              codeFillLength: row!=null&&row.codeFillLength != '' ? row.codeFillLength:'',              //填充长度
              codeFillLimit: row!=null&&row.codeFillLimit != '' ? row.codeFillLimit:'',               //流水上限
              codeFillFlag: row!=null&&row.codeFillFlag != '' ? row.codeFillFlag=='true' ?  true:false :false,      //流水是否补码
@@ -2569,6 +2672,7 @@
              referBtmId: row!=null&&row.referBtmId != '' ? row.referBtmId:'',   //参照引用的业务类型,的id
              referBtmName: row!=null&&row.referBtmName != '' ? row.referBtmName:'', //参照引用的业务类型
              referConfig: row!=null&&row.referConfig != '' ? row.referConfig:'',  //参照配置
              referValueInfo: row!=null&&row.referValueInfo != '' ? row.referValueInfo:'',  //参照配置
            });
          }else if(this.form.secType==='codedatesec'){
            //日期码段
@@ -2590,51 +2694,64 @@
            //可变码段
            this.form = Object.assign({}, this.form,{
              codeSecLength: row!=null&&row.codeSecLength != '' ? row.codeSecLength:'',             //码段的长度
              codeFillType: row!=null&&row.codeFillType != '' ? row.codeFillType:'code_fill_right', //编码部位方式,枚举查询
              codeFillSeparatorSelect: row!=null&&row.codeFillSeparatorSelect != '' ? row.codeFillSeparatorSelect:0,  //选中的补位时的字符的下标
              codeFillSeparator: row!=null&&row.codeFillSeparator != '' ? row.codeFillSeparator:'', //补位时的字符,可输可选查询
              codeFillType: row!=null&&row.codeFillType != '' ? row.codeFillType:'code_fill_left', //编码部位方式,枚举查询
              // codeFillSeparatorSelect: row!=null&&row.codeFillSeparatorSelect != '' ? row.codeFillSeparatorSelect:0,  //选中的补位时的字符的下标
              codeFillSeparator: row!=null&&row.codeFillSeparator != '' ? row.codeFillSeparator:'0', //补位时的字符,可输可选查询
            });
            this.loadCodeFillType();
            this.loadCodeFillSeparator();
          }
          // console.log(this.form);
        },
        // 第一次请求的枚举数据放缓存
        getLocalStorageEnum(enumKey){
          let enumCach = JSON.parse(localStorage.getItem(enumKey));
          if(enumCach == null) {
            getDictionary({code: enumKey}).then(res=>{
              enumCach = res.data.data;
              localStorage.setItem(enumKey,JSON.stringify(res.data.data));
            })
          }
          return enumCach;
        },
        // 统一加载所有枚举查询,主要是为避免切换码段类型时还未加载完成的情况
        loadTotalEnum(){
          this.loadCodeSecType();
          this.loadCodeSecLength();
          this.loadCodeFillType();
          this.loadCodeFillSeparator();
          this.loadCodeLevelType();
          this.loadCodeCutType();
          this.loadCodeGetValueType();
        },
        //枚举和可输可选内容查询
        loadCodeSecType(){
          getDictionary({code: "codeSecType"}).then(res=>{
            this.enumParam.secTypeList = res.data.data;
          })
          this.enumParam.secTypeList = this.getLocalStorageEnum("codeSecType");
          this.loadCodeSecLength();
        },
        loadCodeSecLength(){
          getDictionary({code: "codeSecLength"}).then(res=>{
            this.enumParam.codeSecLengthType = res.data.data;
          })
          this.enumParam.codeSecLengthType = this.getLocalStorageEnum("codeSecLength");
        },
        loadCodeFillType(){
          getDictionary({code: "codeFillType"}).then(res=>{
            this.enumParam.codeFillType = res.data.data;
          })
          this.enumParam.codeFillType = this.getLocalStorageEnum("codeFillType");
        },
        loadCodeFillSeparator(){
          getDictionary({code: "codeFillSeparator"}).then(res=>{
            this.enumParam.codeFillSeparator = res.data.data;
          })
          let enumCach = JSON.parse(localStorage.getItem("codeFillSeparator"));
          if(enumCach == null) {
            getDictionary("codeFillSeparator").then(res=>{
              this.enumParam.codeFillSeparator = res.data.data;
              localStorage.setItem(key,JSON.stringify(res.data.data));
            })
          }
        },
        loadCodeLevelType(){
          getDictionary({code: "codeLevelType"}).then(res=>{
            this.enumParam.codeLevelType = res.data.data;
          })
          this.enumParam.codeLevelType = this.getLocalStorageEnum("codeLevelType");
        },
        loadCodeCutType(){
          getDictionary({code: "codeCutType"}).then(res=>{
            this.enumParam.codeCutType = res.data.data;
          })
          this.enumParam.codeCutType = this.getLocalStorageEnum("codeCutType");
        },
        loadCodeGetValueType(){
          getDictionary({code: "codeGetValueType"}).then(res=>{
            this.enumParam.codeGetValueType = res.data.data;
          })
          this.enumParam.codeGetValueType =  this.getLocalStorageEnum("codeGetValueType");
        },
        
      }
@@ -2651,7 +2768,7 @@
  .code-rule-crud > .avue-crud__pagination {
    padding: 14px 0 2px 20px;
  }
  .clone-input-textarea > .el-form-item__content {
    width: 495px;
  }
@@ -2671,7 +2788,7 @@
  .other-clone-coderule-crud > .el-card> .el-card__body > .avue-crud__menu {
    display: none!important;
  }
  .el-table--small .el-table__cell {
    padding: 3px 0;
  }
@@ -2713,8 +2830,8 @@
  .left > .el-form-item > .el-form-item__content > .el-input-number > .el-input > .el-input__inner {
    width:120px;
  }
  }
  .el-col>.el-card > .el-card__header {
    background: rgb(213 231 239);
    border-radius: inherit;
@@ -2769,4 +2886,8 @@
    padding: 5px 10px 10px;
 }
</style>
 .seloption{
  margin-left: 10px;
}
</style>