lihang
2023-05-17 b826e9a0c17ddcc2c2984b71469bc9d1f4b20ac7
Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -4,44 +4,56 @@
    :visible.sync="showSubmitDialog"
    append-to-body
    @close="closeSubmitDialog"
    width="74%"
    width="70%"
    >
        <el-form ref="form" :model="btmType" show-message="true" inline>
            <el-form-item label="英文名称:" label-width="100px">
        <el-form ref="form" :model="btmType" show-message="true" inline size="medium" label-suffix=":" class="btmTypeForm">
            <el-form-item label="英文名称" label-width="100px" required="true">
                <el-input v-model="btmType.id" :prefix-icon="icons.key"></el-input>
            </el-form-item>
            <el-form-item label="中文名称:" label-width="100px">
            <el-form-item label="中文名称" label-width="100px">
                <el-input v-model="btmType.name" :prefix-icon="icons.name"></el-input>
            </el-form-item>
            <el-form-item label="数据库表名:" label-width="100px">
            <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">
            <el-form-item label="所属领域" label-width="100px">
                <el-select v-model="btmType.domain" :prefix-icon="icons.domain">
                    <el-option v-for="item in domainOption"
                    :label="item"></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">
                <el-input v-model="btmType.revisionRuleId" :prefix-icon="icons.revisionRule">
            <el-form-item label="版本规则" label-width="100px">
                <el-input v-model="btmType.revisionRuleId" :prefix-icon="icons.revisionRule" class="revisionRule">
                    <i slot="suffix" class="el-input__icon el-icon-search"></i>
                </el-input>
            </el-form-item>
            <el-form-item label="生命周期:" label-width="100px">
            <el-form-item label="生命周期" label-width="100px">
                <el-input v-model="btmType.lifeCycleId" :prefix-icon="icons.lifeCycle">
                    <i slot="suffix" class="el-input__icon el-icon-search"></i>
                </el-input>
            </el-form-item>
            <el-form-item label="视图:" label-width="100px">
                <el-input v-model="btmType.view" :prefix-icon="icons.view"></el-input>
            <div>
            <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">
                <el-input v-model="btmType.view" :prefix-icon="icons.view" :disabled="!btmType.viewFlag"></el-input>
            </el-form-item>
        </div>
            <el-form-item label="描述" label-width="100px" class="description">
                <el-input v-model="btmType.description" 
                :prefix-icon="icons.desc" 
                class="descClass"
                ></el-input>
            </el-form-item>
        </el-form>
        <avue-crud :option="option" :data="btmType.attributes" :page.sync="page" ref="attrTable">
        <avue-crud :option="option"
        :data="btmType.attributes"
        :page.sync="page"
        ref="attrTable"
        @cell-mouse-enter="cellEditClick"
        @cell-mouse-leave="cellEditSave">
            <template slot-scope="scope" slot="menuLeft">
                <el-button type="danger"
                icon="el-icon-plus"
@@ -50,8 +62,10 @@
            </template>
            
        </avue-crud>
        <el-button @click="submitBtmType">确定</el-button>
        <div slot="footer" class="dialog-footer">
            <el-button @click="submitBtmType">确定</el-button>
            <el-button @click="cancleSubmitBtmType">取消</el-button>
        </div>
        <el-dialog title="属性池"
@@ -66,13 +80,16 @@
            :page.sync="attrRef.page"
            ref="attrRef"
            @on-load="attrRefOnLoad"
            @search-change="attrRefSearch"
            @selection-change="selectionChange">
                <template slot="name" slot-scope="scope" >
                    <el-tag>{{scope}}</el-tag>
                </template>
            </avue-crud>
            <el-button @click="confirmSelectAttr">确定</el-button>
            <el-button @click="cancleSelectAttr">取消</el-button>
            <div slot="footer" class="dialog-footer">
                <el-button @click="confirmSelectAttr">确定</el-button>
                <el-button @click="cancleSelectAttr">取消</el-button>
            </div>
        </el-dialog>
    </el-dialog>
</template>
@@ -80,8 +97,8 @@
<script>
import {  } from '@/api/omd/btmType';
import { getPage } from '@/api/omd/OmdAttribute';
import { add,update } from '@/api/omd/btmType';
import { queryPage } from '@/api/omd/OmdAttribute';
export default {
    name: 'BusinessAdd',
    props: {
@@ -99,35 +116,30 @@
        return {
            form: {},
            showSubmitDialog : false,
            page: {
                currentPage: 1,
                pageSize:10
            },
            option: {
                height: "330px",
                selection: true,
                headerAlign: 'center',
                border: true,
                index: true,
                rowKey: 'oid',
                addBtn: false,
                refreshBtn: false,
                columnBtn:false,
                rowKey: 'id',
                tabs: true,
                menu: false,
                highlightCurrentRow: true,
                column: [
                    {
                        label: '属性英文名称',
                        label: '英文名称',
                        prop: 'id',
                        align: 'left'
                    }, {
                        label: '属性中文名称',
                        prop: 'name',
                        align: 'center'
                    }, {
                        label: '中文名称',
                        prop: 'name',
                        align: 'center',
                        cell: true
                    },
                    {
                        label: "属性类型",
                        prop: "typeValue",
                        label: "类型",
                        prop: "attrDataType",
                        align: 'center',
                        slot: true
                    },
@@ -135,13 +147,15 @@
                        label: "默认值",
                        prop: "defaultValue",
                        cell: 'true',
                        align: 'center'
                        align: 'center',
                        cell: true
                    },
                    {
                        label: "说明",
                        prop: "description",
                        cell: 'true',
                        align: 'center'
                        align: 'center',
                        cell:true
                    }
                ]
            },
@@ -150,8 +164,8 @@
                page: {
                    currentPage:1,
                    pageSize:10,
                    key:''
                },
                key: null,
                option:{
                    height: 360,
                    addBtn: false,
@@ -160,19 +174,22 @@
                    selection: true,
                    menu: false,
                    border: true,
                    reserveSelection: true,
                    searchMenuSpan:8,
                    column: [
                        {
                        label: '属性英文名称',
                        label: '英文名称',
                        prop: 'key',
                        align: 'left',
                        search: true,
                        width: 230
                    }, {
                        label: '属性中文名称',
                        label: '中文名称',
                        prop: 'label',
                        align: 'center'
                        align: 'center',
                    },
                    {
                        label: "属性类型",
                        label: "类型",
                        prop: "typeValue",
                        align: 'center'
                    },
@@ -199,12 +216,13 @@
                    {
                        label: "说明",
                        prop: "description",
                        cell:true,
                        align: 'center'
                    }
                    ]
                },
                data: [],
                queryNotIn: []
                queryNotIn: null
            }
        }
    },
@@ -214,42 +232,52 @@
    methods: {
        closeSubmitDialog(){
            this.showSubmitDialog = false;
            this.btmType.attributes = [];
            this.btmType = {};
            this.attrRef.selectData = [];
            this.attrRef.queryNotIn = null;
        },
        closeAttrDialog(){
            this.attrRef.visible = false;
        },
        rowAdd(){
            this.attrRef.visible = true;
            this.$refs.attrRef.refreshTable();
            this.attrRefOnLoad();
        },
        attrRefOnLoad(){
            var str = '';
            this.attrRef.queryNotIn.forEach(item => {
                str = str + item + ','
            });
            getPage(this.attrRef.page.currentPage, this.attrRef.page.pageSize,{'condition["key_like"]':this.attrRef.page.key}).then(res => {
            queryPage(this.attrRef.key,this.attrRef.queryNotIn,this.attrRef.page.currentPage, this.attrRef.page.pageSize).then(res => {
                const data = res.data.data;
                this.attrRef.page.total = data.total;
                this.attrRef.data = data.records;
            })
            });
            this.$nextTick(() => {
                this.$refs.attrRef.refreshTable();
            });
        },
        attrRefSearch(form,done){
            this.attrRef.key = form.key;
            this.attrRefOnLoad();
            done();
            this.attrRef.key = null;
        },
        selectionChange(list){
            this.attrRef.selectData = list;
        },
        confirmSelectAttr(){
            this.btmType.attributes = [];
            this.attrRef.queryNotIn = "";
            this.attrRef.selectData.forEach(item => {
                this.btmType.attributes.push({
                    id: item.key,
                    name: item.label,
                    typeValue: item.typeValue,
                    typeKey: item.typeValue,
                    attrDataType : item.typeValue,
                    defaultValue: item.defaultValue,
                    description: item.description
                    description: item.description,
                    attributeLength: item.maxLength
                });
                this.attrRef.queryNotIn.push(item.key);
                this.attrRef.queryNotIn += (item.key + ",")
            });
            this.closeAttrDialog();
        },
@@ -258,17 +286,35 @@
            this.closeAttrDialog();
        },
        submitBtmType(){
            // 添加完成,回调父组件的刷新
            console.log(this.btmType);
            this.$emit('refreshTable');
            add(this.btmType,true).then(res => {
                // 添加完成,回调父组件的刷新
                this.$message.success('保存成功');
                this.cancleSubmitBtmType();
                this.$emit('refreshTable');
            })
        },
        cancleSubmitBtmType(){
            this.btmType = {};
            this.btmType.attributes = [];
            console.log(this.btmType);
            this.showSubmitDialog = false;
        },
        refreshAttrTable(){
            this.$refs.attrTable.refreshTable();
            this.$nextTick( () => {
                this.$refs.attrTable.refreshTable();
            })
        },
        viewChange(){
        },
        cellEditClick(cell){
            cell.$cellEdit = true;
        },
        cellEditSave(row){
            this.btmType.attributes[row.$index].name = row.name
            this.btmType.attributes[row.$index].defaultValue = row.defaultValue;
            this.btmType.attributes[row.$index].description = row.description;
            row.$cellEdit = false;
        }
    }
}
@@ -277,6 +323,18 @@
<style>
/* 属性池参照列表 */
.attrRef > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu{
        display: none !important;
    display: none !important;
}
</style>
.btmTypeForm > .el-form-item > .el-form-item__content > .el-input > .el-input__inner {
    width: 200px;
}
.viewFlag {
    width: 305px;
}
.descClass > .el-input__inner {
    width: 57vw
}
</style>