lihang
2023-07-05 c2ee2b74bd587fdad8e9e276beb3c792f56f5b6c
业务类型和元数据相关的修正
已修改3个文件
124 ■■■■ 文件已修改
Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/modeling/original.vue 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/modeling/originalAdd.vue 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -320,7 +320,7 @@
                id: [
                    { required: true, message: '请输入业务类型编号', trigger: 'blur' },
                    { pattern: /^[A-Za-z]+$/, message: '业务类型编号只能为英文', trigger: 'blur' },
                    { min: 2, max: 15, message: '长度在2到15个字符', trigger: 'blur' }
                    { min: 2, max: 20, message: '长度在2到20个字符', trigger: 'blur' }
                ],
                domain: [
                    { required: true, message: '请选择所属领域', trigger: 'blur' }
@@ -387,7 +387,11 @@
                    attrDataType : item.typeKey,
                    defaultValue: item.defaultValue,
                    description: item.description,
                    attributeLength: item.maxLength
                    attributeLength: item.maxLength,
                    referBtmTypeId: item.referTypeCode,
                    referBtmTypeName: item.referToName,
                    enumId: item.dictCode,
                    // enumName: item,
                });
                this.attrRef.queryNotIn += (item.id + ",")
            });
Source/UBCS-WEB/src/views/modeling/original.vue
@@ -122,14 +122,14 @@
                <template slot="label">
                  枚举类型
                </template>
                {{ itemForm.itemData.dictCode }}
                {{ itemForm.itemData.dictValue }}
              </el-descriptions-item>
            </el-descriptions>
          </el-tab-pane>
        </el-tabs>
      </basic-container>
    </el-aside>
    <originalAdd ref="originalAdd" @refreshTable="refreshChange"></originalAdd>
    <originalAdd ref="originalAdd" @refreshTable="refreshChange" :attribute="editAttribute"></originalAdd>
  </el-container>
</template>
@@ -141,6 +141,7 @@
  update, getPage, getApplyRange
} from "@/api/omd/OmdAttribute";
import Versionpackage from "./Versionpackage.vue";
import {getDictionary} from "@/api/omd/enum";
export default {
  name: "original",
@@ -157,7 +158,7 @@
      attribute: {
        nullable: true
      },
      editAttibute: {},
      editAttribute: {},
      applyRangeData: [],
      option: {
        height: "550px",
@@ -250,6 +251,8 @@
      itemForm: {
        itemData: {},
        activeName: "referTab",
        enumInitFlag:false,
        referInitFlag: false,
        form: {}
      },
      searchId: '',
@@ -268,10 +271,14 @@
    updateSave(row,index) {
      this.selectRow = index;
      var json = JSON.stringify(row);
      this.editAttibute = JSON.parse(json);
      this.editAttibute.nullable = row.nullable == 'true' ? true : false;
      this.$refs.originalAdd.attribute = this.editAttibute;
      this.editAttribute = JSON.parse(json);
      this.editAttribute.nullable = row.nullable == 'true' ? true : false;
      this.$refs.originalAdd.attribute = this.editAttribute;
      this.$refs.originalAdd.showSubmitDialog = true;
      this.checkUsingReferDict(row);
      this.$refs.originalAdd.activeName = this.itemForm.activeName;
      this.$refs.originalAdd.enumInitFlag = this.itemForm.enumInitFlag;
      this.$refs.originalAdd.referInitFlag = this.itemForm.referInitFlag;
      this.refreshChange()
    },
    deleteSave(row,index) {
@@ -296,6 +303,27 @@
      this.itemForm.itemData = row;
      this.selectRow = row.$index;
      this.attribute = row;
      this.checkUsingReferDict(row);
    },
    checkUsingReferDict(row){
      if (row.referToId !== null && row.referToId !== ""){
        this.itemForm.activeName = 'referTab';
        this.itemForm.referInitFlag = true;
        this.itemForm.enumInitFlag = false;
      }else if (row.usingDict === 'true'){
        this.itemForm.activeName = 'enumTab';
        this.itemForm.referInitFlag = false;
        this.itemForm.enumInitFlag = true;
        getDictionary({code: row.dictCode}).then(res => {
          this.editAttribute.dictValue = res.data.data[0].label;
          this.itemForm.itemData.dictValue = this.editAttribute.dictValue;
          this.$refs.originalAdd.dictEnums = res.data.data;
        })
      }else {
        this.itemForm.activeName = 'referTab';
        this.itemForm.referInitFlag = true;
        this.itemForm.enumInitFlag = false;
      }
    },
    selectBtmType() {
      this.referType.display = true;
Source/UBCS-WEB/src/views/modeling/originalAdd.vue
@@ -37,7 +37,6 @@
                <el-form-item label="描述" label-width="100px">
                    <el-input v-model="attribute.description" type="text"></el-input>
                </el-form-item>
                <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true">
                    <el-tab-pane label="参照" name="referTab">
                        <el-form-item label="参照类型" label-width="100px">
@@ -61,14 +60,16 @@
                            </el-input>
                        </el-form-item>
                        <el-form-item label="枚举项" label-width="100px">
                            <el-tag v-for="eItem in dictEnums" :key="eItem.itemName" type="info">
                              {{eItem.itemName}}
                            </el-tag>
                        </el-form-item>
                    </el-tab-pane>
                </el-tabs>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitAttribute">确定</el-button>
                <el-button @click="cancleSubmit">取消</el-button>
                <el-button @click="cancelSubmit">取消</el-button>
            </div>
            <!-- 选择参照时的弹窗 -->
            <el-dialog title="参照列表" :visible.sync="btmRefer.show" append-to-body @close="closeReferDialog" width="80%"
@@ -104,7 +105,7 @@
                </el-container>
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="confirmBtm" size="small">确定</el-button>
                    <el-button @click="cancleBtm" size="small">取消</el-button>
                    <el-button @click="cancelBtm" size="small">取消</el-button>
                </div>
            </el-dialog>
            <!-- 选择枚举时的弹窗 -->
@@ -119,7 +120,7 @@
                </avue-crud>
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="confirmEnum" size="small">确定</el-button>
                    <el-button @click="cancleEnum" size="small">取消</el-button>
                    <el-button @click="cancelEnum" size="small">取消</el-button>
                </div>
            </el-dialog>
        </el-dialog>
@@ -223,7 +224,7 @@
                    addBtn: false,
                    refreshBtn: false,
                    columnBtn: false,
                    selection: true,
                    // selection: true,
                    menu: false,
                    border: true,
                    reserveSelection: true,
@@ -267,7 +268,12 @@
                        value: 'oid',
                    }
                }
            }
            },
            dictEnums: [],
            enumEditFlag: false,
            enumInitFlag: false,
            referInitFlag: false,
            referEditFlag: false,
        }
    },
    created() {
@@ -286,9 +292,23 @@
            };
            this.referToFlag = true;
            this.$refs.form.resetFields();
            this.dictEnums = [];
        },
        submitAttribute() {
            const that = this;
            if (that.referInitFlag && that.referEditFlag){
                this.$delete(this.attribute,'dictCode');
                this.$delete(this.attribute,'dictKey');
                this.$delete(this.attribute,'dictValue');
                this.$delete(this.attribute,'usingDict');
            }
            if (that.enumInitFlag && that.enumEditFlag){
                this.$delete(this.attribute,'referTypeCode');
                this.$delete(this.attribute,'referTypeKey');
                this.$delete(this.attribute,'referTypeValue');
                this.$delete(this.attribute,'referToId');
                this.$delete(this.attribute,'referToName');
            }
            this.$refs.form.validate(function (pass, field) {
                if (pass) {
                    add(that.attribute).then(res => {
@@ -302,21 +322,23 @@
                }
            })
        },
        cancleSubmit() {
        cancelSubmit() {
            this.closeSubmitDialog();
        },
        closeEnumDialog() {
            this.cancleEnum();
            this.cancelEnum();
        },
        closeReferDialog() {
            this.cancleBtm();
            this.cancelBtm();
        },
        confirmBtm() {
            this.attribute.referToId = this.btmRefer.selectItem.oid;
            this.attribute.referToName = this.btmRefer.selectItem.name;
            this.btmRefer.show = false;
            this.referEditFlag =  true;
            this.enumEditFlag = false;
        },
        cancleBtm() {
        cancelBtm() {
            this.btmRefer.selectItem = {};
            this.btmRefer.show = false;
            this.btmRefer.selectRow = '';
@@ -326,8 +348,13 @@
            this.attribute.dictCode = this.enumRefer.selectItem.name;
            this.attribute.dictValue = this.enumRefer.selectItem.label;
            this.enumRefer.show = false;
            getDictionary({code :this.enumRefer.selectItem.name}).then(res => {
                this.dictEnums = res.data.data;
            });
            this.referEditFlag =  false;
            this.enumEditFlag = true;
        },
        cancleEnum() {
        cancelEnum() {
            this.enumRefer.selectItem = {};
            this.enumRefer.show = false;
            this.enumRefer.selectRow = '';
@@ -345,13 +372,12 @@
                this.domain.data = res.data.data;
            })
            this.btmRefer.show = true;
        },
        // 参照类型树的点击事件
        nodeClick(data) {
            // 区分业务类型的查询和链接类型的查询
            if (this.attribute.referTypeKey == 'btmType') {
                btmPage(this.btmRefer.btmPage.currentPage, this.btmRefer.btmPage.pageSize, { domain: data.id }).then(res => {
                btmPage(this.btmRefer.btmPage.currentPage, this.btmRefer.btmPage.pageSize, { bizDomain: data.id }).then(res => {
                    this.btmRefer.data = res.data.data.records;
                    this.btmRefer.btmPage.total = res.data.data.total;
                })
@@ -431,18 +457,16 @@
            this.btmRefer.selectItem = {};
            this.btmRefer.selectRow = '';
        },
        // handleClick(tab){
        //     // 因为只能参照和枚举二选一。所以在切换的时候把属性给清空。
        //     this.$delete(this.attribute,'referTypeCode');
        //     this.$delete(this.attribute,'referTypeKey');
        //     this.$delete(this.attribute,'referTypeValue');
        //     this.$delete(this.attribute,'referToId');
        //     this.$delete(this.attribute,'referToName');
        //     this.$delete(this.attribute,'dictCode');
        //     this.$delete(this.attribute,'dictKey');
        //     this.$delete(this.attribute,'dictValue');
        //     this.$delete(this.attribute,'usingDict');
        // }
        handleClick(tab){
            // 因为只能参照和枚举二选一。所以在切换的时候把属性给清空。
            if (tab.name === 'enumTab'){
              this.enumInitFlag = true;
              this.referInitFlag = false;
            }else {
              this.enumInitFlag = false;
              this.referInitFlag = true;
            }
        }
    }
}
</script>