fujunling
2023-07-13 4d46d3d70d2f38eebd2b861a97a9bf5ba9604ada
Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -7,7 +7,8 @@
    width="70%"
    style="height: 115vh;"
    >
        <el-form ref="form" :model="btmType" show-message="true" inline size="medium" label-suffix=":" class="btmTypeForm" :rules="rules" @resetFields="resetForm" status-icon="true">
    <el-form ref="form" :model="btmType" show-message="true" inline size="medium" label-suffix=":" class="btmTypeForm"
             :rules="rules" @resetFields="resetForm" status-icon="true">
            <el-form-item label="英文名称" label-width="100px" required="true" prop="id">
                <el-input v-model="btmType.id" :prefix-icon="icons.key"></el-input>
            </el-form-item>
@@ -17,10 +18,11 @@
            <el-form-item label="数据库表名" label-width="100px">
                <el-input v-model="btmType.tableName" :prefix-icon="icons.tableName"></el-input>
            </el-form-item>
            <el-form-item label="所属领域" label-width="100px" prop="domain">
                <el-select v-model="btmType.domain" :prefix-icon="icons.domain">
      <el-form-item label="所属领域" label-width="100px" prop="domain" class="domainSelect">
        <el-select v-model="btmType.bizDomain" :prefix-icon="icons.domain">
                    <el-option v-for="item in domainOption"
                    :label="item.label" :value="item.value" :key="item.value"></el-option>
                     :label="item.label" :value="item.value" :key="item.value">
          </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="版本规则" label-width="100px">
@@ -38,7 +40,7 @@
            <el-form-item label="开启视图" label-width="100px" class="viewFlag">
                <el-switch v-model="btmType.viewFlag" active-color="#13ce66" @change="viewChange"></el-switch>
            </el-form-item>
            <el-form-item label="视图语句" label-width="100px">
        <el-form-item label="视图语句" label-width="100px" class="viewInput">
                <el-input v-model="btmType.view" :prefix-icon="icons.view" :disabled="!btmType.viewFlag"></el-input>
            </el-form-item>
        </div>
@@ -58,12 +60,21 @@
                <el-button type="danger"
                icon="el-icon-plus"
                size="small"
                @click="rowAdd()">属性选择</el-button>
                   @click="rowAdd()">属性选择
        </el-button>
      </template>
      <template slot="attrDataTypeText" slot-scope="{row}">
        <el-tag>{{ row.attrDataTypeText }}</el-tag>
            </template>
          <template slot="menu" slot-scope="{row,index}">
            <el-button icon="el-icon-edit" size="small" type="text" v-if="!row.$cellEdit" @click="cellEditClick(row)">编辑</el-button>
            <el-button icon="el-icon-delete" size="small" type="text" v-if="!row.$cellEdit" @click="removeFormAttrTable(row,index)">移除</el-button>
            <el-button icon="el-icon-check" size="small" type="text" v-if="row.$cellEdit" @click="cellEditSave(row,index)">保存</el-button>
        <el-button icon="el-icon-edit" size="small" type="text" v-if="!row.$cellEdit" @click="cellEditClick(row)">编辑
        </el-button>
        <el-button icon="el-icon-delete" size="small" type="text" v-if="!row.$cellEdit"
                   @click="removeFormAttrTable(row,index)">移除
        </el-button>
        <el-button icon="el-icon-check" size="small" type="text" v-if="row.$cellEdit" @click="cellEditSave(row,index)">
          保存
        </el-button>
          </template>
        </avue-crud>
        <div slot="footer" class="dialog-footer">
@@ -129,6 +140,7 @@
import { add,update } from '@/api/omd/btmType';
import { queryPage } from '@/api/omd/OmdAttribute';
import { getPage } from '@/api/omd/revisionRule';
export default {
    name: 'BusinessAdd',
    props: {
@@ -166,6 +178,7 @@
                menu: true,
                editBtn: false,
                delBtn: false,
        columnBtn: false,
                menuWidth: 150,
                addBtn:false,
                highlightCurrentRow: true,
@@ -179,10 +192,9 @@
                        prop: 'name',
                        align: 'center',
                        cell: true
                    },
                    {
          },{
                        label: "类型",
                        prop: "attrDataType",
            prop: "attrDataTypeText",
                        align: 'center',
                        slot: true
                    },
@@ -338,6 +350,9 @@
                    { pattern: /^[A-Za-z]+$/, message: '业务类型编号只能为英文', trigger: 'blur' },
                    { min: 2, max: 20, message: '长度在2到20个字符', trigger: 'blur' }
                ],
        name: [
          {required: true, message: '请输入业务类型中文名称', trigger: 'blur'}
        ],
                domain: [
                    { required: true, message: '请选择所属领域', trigger: 'blur' }
                ]
@@ -368,7 +383,7 @@
        },
        // 属性池加载
        attrRefOnLoad(){
            if (this.attrRef.queryNotIn != ''){
      if (this.attrRef.queryNotIn != '' && this.btmType.attributes !== undefined && this.btmType.attributes.length > 0) {
              this.attrRef.queryNotIn = '';
               this.btmType.attributes.forEach(item => {
                  this.attrRef.queryNotIn += (item.id + ",")
@@ -411,20 +426,19 @@
            if(!this.btmType.attributes) {
              this.btmType.attributes = [];
            }
      console.log(this.attrRef.selectData);
            this.attrRef.selectData.forEach(item => {
                this.btmType.attributes.push({
                    id: item.id,
                    name: item.name,
                    typeValue: item.typeValue,
                    typeKey: item.typeValue,
                    attrDataType : item.typeKey,
          attrDataTypeText: item.typeValue,
                    defaultValue: item.defaultValue,
                    description: item.description,
                    attributeLength: item.maxLength,
                    referBtmTypeId: item.referTypeCode,
                    referBtmTypeName: item.referToName,
                    enumId: item.dictCode,
                    // enumName: item,
                });
                this.attrRef.queryNotIn += (item.id + ",")
            });
@@ -439,6 +453,23 @@
        // 添加业务类型
        submitBtmType(){
            console.log(this.btmType);
      if (!this.btmType.attributes){
         this.$message.warning("还没有为业务类型选择属性");
         return;
      }else{
        let nullFlag = false;
         this.btmType.attributes.forEach(item => {
            if (!item.name){
               this.$message.warning("第" + (item.$index+1) + "行的中文名称不能为空");
               nullFlag = true;
               return;
            }
         })
        if (nullFlag){
          return;
        }
      }
            add(this.btmType,true).then(res => {
                // 添加完成,回调父组件的刷新
                this.$message.success('保存成功');
@@ -490,7 +521,8 @@
       },
       // 版本规则选中事件
       revisionChange(){},
    revisionChange() {
    },
       // 确认选中版本规则
       confirmRevision(){
            this.btmType.revisionFlag = true;
@@ -541,10 +573,18 @@
    width: 200px;
}
.domainSelect > .el-form-item__content > .el-select > .el-input > .el-input__inner {
  width: 200px;
}
.viewFlag {
    width: 305px;
}
.viewInput > .el-form-item__content > .el-input > .el-input__inner {
  width: 200px;
}
.descClass > .el-input__inner {
    width: 57vw
}