Source/UBCS-WEB/src/views/code/code.vue
@@ -1186,9 +1186,7 @@
          </el-row>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="selectedListClassifyLinkAttr"
            >确 定</el-button
          >
          <el-button type="primary" @click="selectedListClassifyLinkAttr">确 定</el-button>
          <el-button @click="isShowSelectAttrOption = false">取 消</el-button>
        </div>
      </el-dialog>
@@ -1305,6 +1303,7 @@
import { mapGetters } from "vuex";
import { getByRoleUserList } from "@/api/system/user";
import func from "@/util/func";
import secTypeEnum from '@/enumpack/CodeSecTypeEnum';
export default {
  data() {
@@ -1601,7 +1600,7 @@
        basicMoveupBtn: this.vaildData(this.permission.code_rule.code_basic_moveup, false),
        basicDownBtn: this.vaildData(this.permission.code_rule.code_basic_down, false),
      }
    }
    },
  },
  watch: {},
  mounted() {
@@ -2667,13 +2666,13 @@
        this.basicSecDialogTitle = "修改码段信息";
        this.showbtn = true;
        this.basicSecOnlyRead = false;
        //为form绑定值
      } else {
        this.basicSecDialogTitle = "查看码段信息";
        this.showbtn = false;
        this.basicSecOnlyRead = true;
      }
      //console.log(this.form);
      //为form绑定值
      this.changeSectypeFormItems(condition == "add" ? null : row);
      this.addBasicCodeSettingBox = true;
    },
@@ -2696,16 +2695,16 @@
                type: "success",
                message: "操作成功!",
              });
              // 关闭对话框
              this.addBasicCodeSettingBox = false;
              // 点击新增基础码段,关闭窗口之后触发重新加载
              this.loadBasic(this.selectionList[0]);
            },
            (error) => {
              window.console.log(error);
            }
          );
          // 关闭对话框
          this.addBasicCodeSettingBox = false;
        }
        // 点击新增基础码段,关闭窗口之后触发重新加载
        this.loadBasic(this.selectionList[0]);
      } else {
        // 可能参照引用的业务类型会发生改变所以这儿直接对referConfig的json进行改变
        if (
@@ -2719,21 +2718,38 @@
          // let referValueInfo = JSON.parse(this.form.referValueInfo);
          // referValueInfo.referType = this.form.referBtmId;
        }
        editSave(this.form).then(
        let oldBasicSec = this.selectionBasicList.at(-1);
        let secType = this.form.secType;
        Vue.set(this.form, 'isClearValue', false);
        if((oldBasicSec.secType == "codefixedsec" || oldBasicSec.secType === "codeclassifysec") && oldBasicSec.secType != secType){
          await this.$confirm("码段类型由【"+oldBasicSec.secTypeText+"】,修改为"+"【"+secTypeEnum.getTextByValue(secType)+"】,请问是否需要清空关联的码值?", "提示", {
            distinguishCancelAndClose: true,
            closeOnClickModal: false,
            confirmButtonText: "清空码值",
            cancelButtonText: "保留码值",
          }).then(() => {
            // 清空码值
            this.form.isClearValue = true;
          }).catch(action => {
            this.form.isClearValue = false;
          });
        }
        await editSave(this.form).then(
          () => {
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            this.loadBasic(this.selectionList[0]);
            // 关闭对话框
            this.addBasicCodeSettingBox = false;
          },
          (error) => {
            window.console.log(error);
          }
        );
        this.loadBasic(this.selectionList[0]);
        // 关闭对话框
        this.addBasicCodeSettingBox = false;
      }
      // 取消保存按钮加载效果
      this.isLoadingSecCodeAddBtn = false;
    },
    /** 因为elementui的表单校验设置不上所以采用判断的方式来做表单检验方式*/
@@ -3171,34 +3187,19 @@
      ) {
        this.loadCodeSecType();
      }
      if (row != null) {
        this.form = {
          oid: row.oid,
          id: row.id, //编号,
          name: row.name, //名称
          secType: row.secType, //码段类型
          description: row.description, //描述
          serialDependFlag: row.serialDependFlag == "true" ? true : false, //是否流水依赖
          serialDependOrder: row.serialDependOrder, //流水依赖顺序
          nullableFlag: row.nullableFlag == "true" ? true : false, //是否为空
          displayFlag: row.displayFlag == "true" ? true : false,
          componentCodeFlag: row.componentCodeFlag == "true" ? true : false, //是否参与编码
          pkCodeRule: row.pkCodeRule, //所属编码规则
        };
      } else {
        this.form = {
          id: this.form.id, //编号
          name: this.form.name, //名称
          secType: this.form.secType, //码段类型
          description: this.form.description, //描述
          serialDependFlag: this.form.serialDependFlag, //是否流水依赖
          serialDependOrder: this.form.serialDependOrder, //流水依赖顺序
          nullableFlag: this.form.nullableFlag, //是否为空
          displayFlag: this.form.displayFlag, //
          componentCodeFlag: this.form.componentCodeFlag, //是否参与编码
          pkCodeRule: this.form.pkCodeRule, //所属编码规则
        };
      }
      this.form = {
        oid: row !=null ? row.oid:this.form.oid,
        id: row !=null ? row.id:this.form.id, //编号,
        name: row !=null ? row.name:this.form.name, //名称
        secType: row !=null ?  row.secType:this.form.secType, //码段类型
        description:  row !=null ? row.description:this.form.description, //描述
        serialDependFlag: this.isNullJsonBoolean(row,this.form, 'serialDependFlag'), //是否流水依赖
        serialDependOrder:  row !=null ? row.serialDependOrder:this.form.serialDependOrder, //流水依赖顺序
        nullableFlag: this.isNullJsonBoolean(row, this.form, 'nullableFlag'), //是否为空
        displayFlag: this.isNullJsonBoolean(row, this.form, 'displayFlag'),
        componentCodeFlag: this.isNullJsonBoolean(row, this.form, 'componentCodeFlag'), //是否参与编码
        pkCodeRule:  row !=null ? row.pkCodeRule:this.form.pkCodeRule, //所属编码规则
      };
      if (this.form.secType === "codefixedsec") {
        //固定码段
        this.form = Object.assign({}, this.form, {
@@ -3351,6 +3352,15 @@
        this.loadCodeFillSeparator();
      }
    },
    // 判断Boolean值是否为空,并且对str类型布尔值进行转换
    isNullJsonBoolean(row,form,attr) {
        //console.log(row[attr],form[attr]);
        if(row != null){
          return JSON.parse(row[attr]);
        }else {
          return form[attr];
        }
    },
    /** 第一次请求的枚举数据放缓存*/
    getLocalStorageEnum(enumKey) {
      let enumCach = JSON.parse(localStorage.getItem(enumKey));