xiejun
2023-06-15 8e6c58eec222c4bbea613e02703d9af22da72bee
Source/UBCS-WEB/src/views/modeling/originalAdd.vue
@@ -27,10 +27,12 @@
                    <el-switch v-model="attribute.nullable" active-text="允许" inactive-text="不允许"></el-switch>
                </el-form-item>
                <el-form-item label="长度" label-width="100px" prop="maxLength">
                    <el-input-number v-model="attribute.maxLength" :min="1" :max="4000" :step="1" controls-position="right"></el-input-number>
                    <el-input-number v-model="attribute.maxLength" :min="1" :max="4000" :step="1"
                        controls-position="right"></el-input-number>
                </el-form-item>
                <el-form-item label="精度" label-width="100px" v-if="attribute.typeValue == 'VTDouble'">
                    <el-input-number v-model="attribute.precision" :min="1" :max="20" :step="1" controls-position="right" @change="changeNumber"></el-input-number>
                <el-form-item label="精度" label-width="100px" v-if="attribute.typeKey == 'VTDouble'">
                    <el-input-number v-model="attribute.precision" :min="1" :max="20" :step="1" controls-position="right"
                        @change="changeNumber"></el-input-number>
                </el-form-item>
                <el-form-item label="描述" label-width="100px">
                    <el-input v-model="attribute.description" type="text"></el-input>
@@ -59,7 +61,7 @@
                            </el-input>
                        </el-form-item>
                        <el-form-item label="枚举项" label-width="100px">
                        </el-form-item>
                    </el-tab-pane>
                </el-tabs>
@@ -74,7 +76,7 @@
                <el-container>
                    <el-aside>
                        <basic-container>
                           <span class="el-dialog__title"> {{ domain.treeOption.title }} </span>
                            <span class="el-dialog__title"> {{ domain.treeOption.title }} </span>
                            <div style="height:20px;"></div>
                            <avue-tree id="domain" :data="domain.data" :option="domain.treeOption" @node-click="nodeClick"
                                class="businessTree" style="height: 418px">
@@ -89,7 +91,8 @@
                    </el-aside>
                    <el-main>
                        <basic-container>
                            <avue-crud ref="btmTable" :option="btmRefer.option" :data="btmRefer.data" class="btmTable" @row-click="btmReferClick">
                            <avue-crud ref="btmTable" :option="btmRefer.option" :data="btmRefer.data" class="btmTable"
                                @row-click="btmReferClick">
                                <template slot="radio" slot-scope="{row}">
                                    <el-radio v-model="btmRefer.selectRow" :label="row.$index">&nbsp;
                                    </el-radio>
@@ -105,9 +108,10 @@
                </div>
            </el-dialog>
            <!-- 选择枚举时的弹窗 -->
            <el-dialog title="枚举列表" :visible.sync="enumRefer.show" append-to-body @close="closeEnumDialog" width="70%"
            <el-dialog title="枚举列表" :visible.sync="enumRefer.show" append-to-body @close="closeEnumDialog" width="70%"
                style="height: 115vh;">
                <avue-crud ref="eunmTable" :option="enumRefer.option" :data="enumRefer.data" class="enumTable" @row-click="enumReferClick" :page.sync="enumRefer.enumPage">
                <avue-crud ref="eunmTable" :option="enumRefer.option" :data="enumRefer.data" class="enumTable"
                    @row-click="enumReferClick" :page.sync="enumRefer.enumPage">
                    <template slot="radio" slot-scope="{row}">
                        <el-radio v-model="enumRefer.selectRow" :label="row.$index">&nbsp;
                        </el-radio>
@@ -124,9 +128,9 @@
</template>
<script>
import { getDictionary,getParentList } from '@/api/omd/enum'
import { initTree,btmPage } from '@/api/omd/btmType'
import { add} from '@/api/omd/OmdAttribute'
import { getDictionary, getParentList } from '@/api/omd/enum'
import { initTree, btmPage } from '@/api/omd/btmType'
import { add } from '@/api/omd/OmdAttribute'
export default {
    name: 'originalAdd',
    props: {
@@ -181,24 +185,24 @@
                    highlightCurrentRow: true,
                    column: [
                        {
                        label: '',
                        prop: 'radio',
                        width: 60,
                        hide: false
                    },
                    {
                        label: '英文名称',
                        prop: 'id',
                        align: 'center',
                        searchSpan:8,
                        search: true,
                    }, {
                        label: '中文名称',
                        prop: 'name',
                        align: 'center',
                        searchSpan:8,
                        search: true,
                    }]
                            label: '',
                            prop: 'radio',
                            width: 60,
                            hide: false
                        },
                        {
                            label: '英文名称',
                            prop: 'id',
                            align: 'center',
                            searchSpan: 8,
                            search: true,
                        }, {
                            label: '中文名称',
                            prop: 'name',
                            align: 'center',
                            searchSpan: 8,
                            search: true,
                        }]
                },
                // 参照页面表格数据
                data: [],
@@ -231,17 +235,17 @@
                        prop: 'radio',
                        width: 60,
                        hide: false
                    },{
                    }, {
                        label: '枚举代号',
                        prop: 'name',
                        align: 'center',
                        searchSpan:8,
                        searchSpan: 8,
                        search: true,
                    }, {
                        label: '枚举名称',
                        prop: 'label',
                        align: 'center',
                        searchSpan:8,
                        searchSpan: 8,
                        search: true,
                    }]
                },
@@ -283,30 +287,36 @@
            this.referToFlag = true;
            this.$refs.form.resetFields();
        },
        submitAttribute() {
            add(this.attribute).then(res => {
                this.$message.success("保存成功");
                this.showSubmitDialog = false;
                this.attribute = {};
                this.$emit('refreshTable');
            });
        submitAttribute() {
            const that = this;
            this.$refs.form.validate(function (pass, field) {
                if (pass) {
                    add(that.attribute).then(res => {
                        that.$message.success("保存成功");
                        that.showSubmitDialog = false;
                        that.attribute = {};
                        that.$emit('refreshTable');
                    });
                } else {
                    that.$message.error('必填');
                }
            })
        },
        cancleSubmit() {
            this.closeSubmitDialog();
        },
        closeEnumDialog() {
            this.cancleEnum();
         },
        closeReferDialog() {
        },
        closeReferDialog() {
            this.cancleBtm();
        },
        confirmBtm() {
        confirmBtm() {
            this.attribute.referToId = this.btmRefer.selectItem.oid;
            this.attribute.referToName = this.btmRefer.selectItem.name;
            this.btmRefer.show = false;
        },
        cancleBtm() {
        cancleBtm() {
            this.btmRefer.selectItem = {};
            this.btmRefer.show = false;
            this.btmRefer.selectRow = '';
@@ -316,8 +326,8 @@
            this.attribute.dictCode = this.enumRefer.selectItem.name;
            this.attribute.dictValue = this.enumRefer.selectItem.label;
            this.enumRefer.show = false;
         },
        cancleEnum() {
        },
        cancleEnum() {
            this.enumRefer.selectItem = {};
            this.enumRefer.show = false;
            this.enumRefer.selectRow = '';
@@ -340,19 +350,19 @@
        // 参照类型树的点击事件
        nodeClick(data) {
            // 区分业务类型的查询和链接类型的查询
            if(this.attribute.referTypeKey == 'btmType'){
                btmPage(this.btmRefer.btmPage.currentPage,this.btmRefer.btmPage.pageSize,{domain:data.id}).then(res => {
            if (this.attribute.referTypeKey == 'btmType') {
                btmPage(this.btmRefer.btmPage.currentPage, this.btmRefer.btmPage.pageSize, { domain: data.id }).then(res => {
                    this.btmRefer.data = res.data.data.records;
                    this.btmRefer.btmPage.total = res.data.data.total;
                })
            }
            if(this.attribute.referTypeKey == 'linkType'){
            if (this.attribute.referTypeKey == 'linkType') {
            }
        },
        // 枚举类型输入框获得焦点时的事件
        openEnumConfig() {
            getParentList(this.enumRefer.enumPage.currentPage,this.enumRefer.enumPage.pageSize).then(res => {
            getParentList(this.enumRefer.enumPage.currentPage, this.enumRefer.enumPage.pageSize).then(res => {
                this.enumRefer.enumPage.total = res.data.data.total;
                this.enumRefer.data = res.data.data.records;
            })
@@ -361,20 +371,20 @@
        // 属性类型下拉框选择事件
        typeSelectChange(value) {
            if (value == 'VTString') {
                this.$set(this.attribute,"maxLength",150)
                this.$set(this.attribute, "maxLength", 150)
            } else if (value == 'VTInteger') {
                this.$set(this.attribute,"maxLength",50)
                this.$set(this.attribute, "maxLength", 50)
            } else if (value == 'VTBoolean') {
                this.$set(this.attribute,"maxLength",5)
                this.$set(this.attribute, "maxLength", 5)
            } else if (value == 'VTDouble') {
                this.$set(this.attribute,"maxLength",26)
                this.$set(this.attribute,"precision",8)
                this.$set(this.attribute, "maxLength", 26)
                this.$set(this.attribute, "precision", 8)
            } else if (value == 'VTLong') {
                this.$set(this.attribute,"maxLength",150)
                this.$set(this.attribute, "maxLength", 150)
            } else if (value == 'VTDate' || value == 'VTTime' || value == 'VTDateTime') {
                this.$set(this.attribute,"maxLength",6)
                this.$set(this.attribute, "maxLength", 6)
            } else {
                this.$set(this.attribute,"maxLength",50)
                this.$set(this.attribute, "maxLength", 50)
            }
            this.attribute.typeCode = 'attributeType';
            this.attribute.typeKey = value;
@@ -395,7 +405,7 @@
                this.$message.error('属性类型没找到或者未定义')
            })
        },
        initAttributeReferTypeList(){
        initAttributeReferTypeList() {
            getDictionary({ code: 'attributeReferType' }).then(res => {
                res.data.data.forEach(element => {
                    this.btmRefer.referTypeList.push(
@@ -406,33 +416,33 @@
                this.$message.error('参照类型没找到或者未定义')
            })
        },
        btmReferClick(row){
        btmReferClick(row) {
            this.btmRefer.selectItem = row;
            this.btmRefer.selectRow = row.$index;
        },
        enumReferClick(row){
        enumReferClick(row) {
            this.enumRefer.selectItem = row;
            this.enumRefer.selectRow = row.$index;
        },
        // 参照名称点击清除数据
        clearReferTo(){
            this.$delete(this.attribute,'referToId');
            this.$delete(this.attribute,'referToName');
        clearReferTo() {
            this.$delete(this.attribute, 'referToId');
            this.$delete(this.attribute, 'referToName');
            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){
        //     // 因为只能参照和枚举二选一。所以在切换的时候把属性给清空。
        //     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');
        // }
    }
}
</script>
@@ -450,7 +460,6 @@
    width: 200px;
}
.attributeForm>.el-form-item>.el-form-item__content> .el-select>.el-input>.el-input__inner {
.attributeForm>.el-form-item>.el-form-item__content>.el-select>.el-input>.el-input__inner {
    width: 200px;
}
</style>
}</style>