ludc
2023-04-21 e55cf23dc536ce06b9a8b14edd889215956c1eda
Source/UBCS-WEB/src/views/code/addbasiccode.vue
@@ -1,4 +1,5 @@
<template>
  <div class="total">
    <span class="left">
      <el-form :model="form">
@@ -13,10 +14,10 @@
          <el-form-item label="码段类型" :label-width="leftFormLabelWidth" prop="codefixedsec">
            <el-select v-model="form.sectype" placeholder="请选择" @change="changeSectypeFormItems">
              <el-option
              <el-option
                v-for="item in sectypeList"
                :key="item.dictValue"
                :label="item.dictValue"
                :label="item.dictValue"
                :value="item.dictKey">
              </el-option>
            </el-select>
@@ -34,7 +35,7 @@
          <el-form-item label="是否为空:" :label-width="leftFormLabelWidth">
            <el-switch v-model="form.nullableFlag"></el-switch>
          </el-form-item>
      </el-form>
    </span>
    <el-divider direction="vertical"></el-divider>
@@ -44,10 +45,10 @@
      <el-form v-show="form.sectype==='codefixedsec' ? true:false">
        <el-form-item label="码段长度类型:" :label-width="rightFormLabelWidth">
            <el-select v-model="form.codeSecLengthType" placeholder="请选择">
              <el-option
              <el-option
              v-for="item in codeSecLengthType"
              :key="item.dictValue"
              :label="item.dictValue"
              :label="item.dictValue"
              :value="item.dictKey">
            </el-option>
            </el-select>
@@ -60,16 +61,37 @@
      <!-- 属性码段 -->
      <el-form v-show="form.sectype==='codeattrsec' ? true:false">
        <el-form-item label="属性:" :label-width="rightFormLabelWidth">
          <el-input v-model="form.referAttributeName"></el-input>
          <el-input
            placeholder="请选择"
            suffix-icon="el-icon-search"
            readonly="true"
            v-model="form.referAttributeName"
            @focus="openAttrSelectOrGetValue('attr')">
            <span slot="suffix">
              <i class="el-icon-circle-close" @click="clearAttrDataByIcon('attr')" style="margin-right: 5px;cursor: pointer;"></i>
            </span>
          </el-input>
        </el-form-item>
        <el-form-item label="属性所在分类:" :label-width="rightFormLabelWidth">
          <el-input v-model="form.referCodeClassifyOidName"></el-input>
          <el-input
          v-model="form.referCodeClassifyOidName"
          disabled>
        </el-input>
        </el-form-item>
        <el-form-item label="取值规则:" :label-width="rightFormLabelWidth">
          <el-input v-model="form.getValueClass"></el-input>
          <el-input
            placeholder="请选择"
            suffix-icon="el-icon-search"
            readonly="true"
            v-model="form.getValueClass"
            @focus="openAttrSelectOrGetValue('value')">
            <span slot="suffix">
              <i class="el-icon-circle-close" @click="clearAttrDataByIcon('value')" style="margin-right: 5px;cursor: pointer;"></i>
            </span>
          </el-input>
        </el-form-item>
      </el-form>
      <!-- 流水码段 -->
      <el-form v-show="form.sectype==='codeserialsec' ? true:false">
        <el-form-item label="码段的长度:" :label-width="rightFormLabelWidth">
@@ -93,10 +115,10 @@
        </el-form-item>
        <el-form-item label="补位时的字符:" :label-width="rightFormLabelWidth">
          <el-select v-model="form.codeFillSeparatorSelect" filterable placeholder="请选择">
            <el-option
            <el-option
                v-for="item in codeFillSeparator"
                :key="item.dictValue"
                :label="item.dictValue"
                :label="item.dictValue"
                :value="item.dictKey">
            </el-option>
          </el-select>
@@ -119,10 +141,10 @@
      <el-form v-show="form.sectype==='codelevelsec' ? true:false">
        <el-form-item label="层级类型:" :label-width="rightFormLabelWidth">
          <el-select v-model="form.codeLevelType" placeholder="请选择">
            <el-option
            <el-option
                v-for="item in codeLevelType"
                :key="item.dictValue"
                :label="item.dictValue"
                :label="item.dictValue"
                :value="item.dictKey">
              </el-option>
          </el-select>
@@ -135,7 +157,7 @@
            <el-option
              v-for="item in codeCutType"
              :key="item.dictValue"
              :label="item.dictValue"
              :label="item.dictValue"
              :value="item.dictKey">
            </el-option>
          </el-select>
@@ -145,7 +167,7 @@
            <el-option
              v-for="item in codeGetValueType"
              :key="item.dictValue"
              :label="item.dictValue"
              :label="item.dictValue"
              :value="item.dictKey">
            </el-option>
          </el-select>
@@ -161,7 +183,7 @@
          <el-input v-model="form.referConfig"></el-input>
        </el-form-item>
      </el-form>
      <!-- 日期码段 -->
      <el-form v-show="form.sectype==='codedatesec' ? true:false">
        <el-form-item label="日期格式:" :label-width="rightFormLabelWidth">
@@ -173,10 +195,10 @@
      <el-form v-show="form.sectype==='codeclassifysec' ? true:false">
        <el-form-item label="码段长度类型:" :label-width="rightFormLabelWidth">
          <el-select v-model="form.codeSecLengthType" placeholder="请选择">
            <el-option
            <el-option
                v-for="item in codeSecLengthType"
                :key="item.dictValue"
                :label="item.dictValue"
                :label="item.dictValue"
                :value="item.dictKey">
            </el-option>
          </el-select>
@@ -199,20 +221,20 @@
        </el-form-item>
        <el-form-item label="编码补位方式:" :label-width="rightFormLabelWidth">
          <el-select v-model="form.codeFillType" placeholder="请选择">
            <el-option
            <el-option
                v-for="item in codeFillType"
                :key="item.dictValue"
                :label="item.dictValue"
                :label="item.dictValue"
                :value="item.dictKey">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="补位时的字符:" :label-width="rightFormLabelWidth">
          <el-select v-model="form.codeFillSeparatorSelect" placeholder="请选择">
            <el-option
            <el-option
                v-for="item in codeFillSeparator"
                :key="item.dictValue"
                :label="item.dictValue"
                :label="item.dictValue"
                :value="item.dictKey">
            </el-option>
          </el-select>
@@ -220,12 +242,14 @@
      </el-form>
    </span>
  </div>
</template>
<script>
import { addSave } from "@/api/code/codebasic";
import { getDictionary } from "@/api/omd/dictbiz";
import { getDictionary } from "@/api/omd/dict";
export default {
  name: "addBasicCode",
  data() {
@@ -241,7 +265,6 @@
        displayFlag: false, //
        componentCodeFlag: false, //是否参与编码
        pkCodeRule: '', //所属编码规则
        //valueCutType: "code_cut_none", //字符截取类型
      },
      sectypeList:[],    //码段类型
      codeSecLengthType:[],  //码段长度类型
@@ -262,6 +285,48 @@
  },
  methods: {
    //公式内容回调到子组件进行回显
    saveFormulaContent(data){
      console.log(data);
      this.form.getValueClass = data;
    },
    // 为属性选取值之后的回显
    selectedListClassifyLinkAttr(data){
      //console.log(data);
      this.form = Object.assign({}, this.form, {
        referAttributeId:data.referAttributeId,
        referAttributeName:data.referAttributeName,
        referCodeClassifyOid: data.referCodeClassifyOid,
        referCodeClassifyOidName: data.referCodeClassifyOidName,
      })
    },
    // 打开为属性选取值或者取值规则窗口
    openAttrSelectOrGetValue(condition){
      if(condition === 'attr'){
        //console.log('attr');
        //调用父组件的方法
        this.$emit('openAttrSelectOrGetValue')
      }else if(condition === 'value'){
        //console.log('value');
        this.$emit('openformulaEdit')
      }
    },
    // 点击输入框的×号,清空输入框中的内容
    clearAttrDataByIcon(condition){
      if(condition === 'attr'){
        this.form.referAttributeName = '';
        this.form.referAttributeId = '';
        this.form.referCodeClassifyOid = '';
        this.form.referCodeClassifyOidName = '';
      }else if(condition === 'value'){
        this.form.getValueClass = '';
      }
    },
    addSave(pkCodeRule) {
      this.form.pkCodeRule = pkCodeRule;
      console.log(this.form);
@@ -274,7 +339,7 @@
          window.console.log(error);
      });
    },
    loadCodeSecType(){
      getDictionary({code: "codeBasicSecType"}).then(res=>{
        this.sectypeList = res.data.data;
@@ -319,19 +384,19 @@
        console.log(this.codeGetValueType);
      })
    },
    // 码段类型改变时,增加对应的form表单中的属性
    changeSectypeFormItems(){
      if(this.form.sectype==='codefixedsec'){
        //固定码段
        this.form = Object.assign({}, this.form,{
          codeSecLength: '',
        this.form = Object.assign({}, this.form,{
          codeSecLength: '',
          codeSecLengthType: 'code_sec_length_variable'
        });
        this.loadCodeSecLength();
      }else if(this.form.sectype==='codeattrsec'){
        //属性码段
        this.form = Object.assign({}, this.form, {
        this.form = Object.assign({}, this.form, {
          referCodeClassifyOid: '',     //属性id
          referCodeClassifyOidName: '', //属性所在分类
          referAttributeId: '',    //属性编号
@@ -340,7 +405,7 @@
      });
      }else if(this.form.sectype==='codeserialsec'){
        //流水码段
        this.form = Object.assign({}, this.form,{
        this.form = Object.assign({}, this.form,{
          codeSecLength: '', //码段的长度
          serialStart: '1',  //流水号起始值
          serialStep: '1',   //流水的步长
@@ -356,9 +421,9 @@
        this.loadCodeFillSeparator();
      }else if(this.form.sectype==='codelevelsec'){
        //层级码段
        this.form = Object.assign({}, this.form,{
        this.form = Object.assign({}, this.form,{
          codeLevelType: 'code_level_min',     //层级类型  枚举查询
          codeLevelValue: '',    //层级的值
          codeLevelValue: '',    //层级的值
          valueCutType: 'code_cut_none',      //字符截取类型 枚举查询
          valueCutLength: '',    //
          codeGetValueType: 'code_get_value_all_up',  //取值类型 枚举查询
@@ -368,19 +433,19 @@
        this.loadCodeGetValueType();
      }else if(this.form.sectype==='coderefersec'){
        //引用码段
        this.form = Object.assign({}, this.form,{
        this.form = Object.assign({}, this.form,{
          referBtmId: '',   //参照引用的业务类型,的id
          referBtmName: '', //参照引用的业务类型
          referConfig: ''   //参照配置
        });
      }else if(this.form.sectype==='codedatesec'){
        //日期码段
        this.form = Object.assign({}, this.form,{
        this.form = Object.assign({}, this.form,{
          codeDateFormatStr: '',   //日期格式
        });
      }else if(this.form.sectype==='codeclassifysec'){
        //分类码段
        this.form = Object.assign({}, this.form,{
        this.form = Object.assign({}, this.form,{
          codeSecLengthType: 'code_sec_length_variable',    //码段长度类型
          codeSecLength: '',  //码段的长度
          matchClassifyValueFlag: 'false',  //是否自动匹配值
@@ -390,7 +455,7 @@
        this.loadCodeSecLength();
      }else if(this.form.sectype==='codevariablesec'){
        //可变码段
        this.form = Object.assign({}, this.form,{
        this.form = Object.assign({}, this.form,{
          codeSecLength: '',            //码段的长度
          codeFillType: 'code_fill_right',             //编码部位方式,枚举查询
          codeFillSeparatorSelect: '0',  //选中的补位时的字符的下标
@@ -402,10 +467,6 @@
      //console.log(this.form);
    }
  }
};
</script>
@@ -414,10 +475,10 @@
  .total{
    height: 420px;
    width: 100%;
  }
  .total .el-input__inner,.el-textarea__inner {
  .total .el-input__inner,.total .el-textarea__inner {
    width: 220px;
  }
@@ -426,14 +487,14 @@
      height: 31.5em;
      margin: 0 5px;
  }
 .left {
    float: left;
    width: 49%;
    /* border-right: 2px rgb(0, 0, 0); */
 }
 .right {
    float: right;
    float: right;
    width: 49%;
    /* border-left: 2px rgb(0, 0, 0); */
 }