¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog title="龿¥ç±»å" :visible.sync="showSubmitDialog" append-to-body @close="closeSubmitDialog" width="70%" |
| | | style="height: 115vh;"> |
| | | <el-form ref="form" :model="linkType" show-message="true" inline size="medium" label-suffix=":" |
| | | class="linkTypeForm" :rules="rules" @resetFields="resetForm" status-icon="true"> |
| | | <el-form-item label="è±æåç§°" label-width="100px" required="true" prop="id"> |
| | | <el-input v-model="linkType.id" :prefix-icon="icons.id" maxlength="15" show-word-limit type="text"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="䏿åç§°" label-width="100px"> |
| | | <el-input v-model="linkType.name" :prefix-icon="icons.name"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ°æ®åºè¡¨å" label-width="100px"> |
| | | <el-input v-model="linkType.tableName" :prefix-icon="icons.tableName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æå±é¢å" label-width="100px" prop="domain"> |
| | | <el-select v-model="linkType.domain" :prefix-icon="icons.domain"> |
| | | <el-option v-for="item in domainOption" :label="item.label" :value="item.value" |
| | | :key="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="From端类å" label-width="100px"> |
| | | <!-- from端ä¸å¡ç±»åéæ© --> |
| | | <el-select v-model="fromBtmValues" :value="fromBtmTypes" value-key="oid" placeholder="è¯·éæ©From端类å" filterable multiple collapse-tags @change="fromSelectChange"> |
| | | <el-option-group v-for="domain in domainList" :key="domain.id" :label="domain.name"> |
| | | <el-option v-for="item in domain.childList" :key="item.oid" :label="item.id + item.name" |
| | | :value="item"> |
| | | </el-option> |
| | | </el-option-group> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="To端类å" label-width="100px"> |
| | | <!-- to端ä¸å¡ç±»åéæ© --> |
| | | <el-select v-model="toBtmValues" :value="toBtmTypes" value-key="oid" placeholder="è¯·éæ©To端类å" filterable multiple collapse-tags @change="toSelectChange"> |
| | | <el-option-group v-for="domain in domainList" :key="domain.id" :label="domain.name"> |
| | | <el-option v-for="item in domain.childList" :key="item.oid" :label="item.id + item.name" |
| | | :value="item"> |
| | | </el-option> |
| | | </el-option-group> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æè¿°" label-width="100px" class="description"> |
| | | <el-input v-model="linkType.description" :prefix-icon="icons.desc" class="descClass" id="descId"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <avue-crud :option="option" :data="linkType.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" size="small" @click="rowAdd()">屿§éæ©</el-button> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitlinkType">ç¡®å®</el-button> |
| | | <el-button @click="cancleSubmitlinkType">åæ¶</el-button> |
| | | </div> |
| | | |
| | | <!-- 屿§æ± çéæ© --> |
| | | <el-dialog title="屿§æ± " :visible="attrRef.visible" append-to-body @close="closeAttrDialog" width="80%"> |
| | | <avue-crud class="attrRef" :option="attrRef.option" :data="attrRef.data" :page.sync="attrRef.page" ref="attrRef" |
| | | @on-load="attrRefOnLoad" @search-change="attrRefSearch" @selection-change="selectionChange"> |
| | | <template slot="typeValue" slot-scope="scope"> |
| | | <el-tag>{{ scope.row.typeValue }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="confirmSelectAttr">ç¡®å®</el-button> |
| | | <el-button @click="cancleSelectAttr">åæ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | |
| | | <script> |
| | | |
| | | import { add, update } from '@/api/omd/linkType'; |
| | | import { queryPage } from '@/api/omd/OmdAttribute'; |
| | | import { getPage } from '@/api/omd/revisionRule'; |
| | | import { initTree } from "@/api/omd/btmType" |
| | | export default { |
| | | name: 'LinkTypeAdd', |
| | | props: { |
| | | linkType: { |
| | | type: Object |
| | | }, |
| | | domainOption: { |
| | | type: Array |
| | | }, |
| | | icons: { |
| | | type: Array |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | showSubmitDialog: false, |
| | | option: { |
| | | height: "330px", |
| | | selection: true, |
| | | headerAlign: 'center', |
| | | border: true, |
| | | index: true, |
| | | rowKey: 'id', |
| | | tabs: true, |
| | | menu: false, |
| | | addBtn: false, |
| | | highlightCurrentRow: true, |
| | | column: [ |
| | | { |
| | | label: 'è±æåç§°', |
| | | prop: 'id', |
| | | align: 'center' |
| | | }, { |
| | | label: '䏿åç§°', |
| | | prop: 'name', |
| | | align: 'center', |
| | | cell: true |
| | | }, |
| | | { |
| | | label: 'ç±»å', |
| | | prop: 'attrDataType', |
| | | align: 'center', |
| | | slot: true |
| | | }, |
| | | { |
| | | label: 'é»è®¤å¼', |
| | | prop: 'defaultValue', |
| | | align: 'center', |
| | | cell: true |
| | | }, |
| | | { |
| | | label: '说æ', |
| | | prop: 'description', |
| | | align: 'center', |
| | | cell: true |
| | | } |
| | | ] |
| | | }, |
| | | attrRef: { |
| | | visible: false, |
| | | page: { |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | }, |
| | | key: null, |
| | | option: { |
| | | height: 360, |
| | | addBtn: false, |
| | | refreshBtn: false, |
| | | columnBtn: false, |
| | | selection: true, |
| | | menu: false, |
| | | border: true, |
| | | reserveSelection: true, |
| | | searchMenuSpan: 8, |
| | | highlightCurrentRow: true, |
| | | column: [ |
| | | { |
| | | label: 'è±æåç§°', |
| | | prop: 'id', |
| | | align: 'left', |
| | | search: true, |
| | | width: 230 |
| | | }, { |
| | | label: '䏿åç§°', |
| | | prop: 'name', |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: 'ç±»å', |
| | | prop: 'typeValue', |
| | | align: 'center' |
| | | }, |
| | | { |
| | | label: 'é»è®¤å¼', |
| | | prop: 'defaultValue', |
| | | align: 'center' |
| | | }, |
| | | { |
| | | label: 'å
许为空', |
| | | prop: 'nullable', |
| | | type: 'switch', |
| | | display: false, |
| | | hide: true, |
| | | labelWidth: 132, |
| | | dicData: [{ |
| | | label: 'å¦', |
| | | value: 1 |
| | | }, { |
| | | label: 'æ¯', |
| | | value: 0 |
| | | }] |
| | | }, |
| | | { |
| | | label: '说æ', |
| | | prop: 'description', |
| | | cell: true, |
| | | align: 'center' |
| | | } |
| | | ] |
| | | }, |
| | | data: [], |
| | | queryNotIn: null |
| | | }, |
| | | fromBtmValues: [], |
| | | toBtmValues: [], |
| | | domainList: [], |
| | | rules: { |
| | | id: [ |
| | | { required: true, message: '请è¾å
¥é¾æ¥ç±»åç¼å·', trigger: 'blur' }, |
| | | { pattern: /^[A-Za-z]+$/, message: '龿¥ç±»åç¼å·åªè½ä¸ºè±æ', trigger: 'blur' }, |
| | | { min: 2, max: 15, message: 'é¿åº¦å¨2å°15个å符', trigger: 'blur' } |
| | | ], |
| | | domain: [ |
| | | { required: true, message: 'è¯·éæ©æå±é¢å', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | } |
| | | }, |
| | | created() { |
| | | this.initTreeOnLoad(); |
| | | }, |
| | | methods: { |
| | | // å
³éç»ä»¶å¼¹çª |
| | | closeSubmitDialog() { |
| | | this.showSubmitDialog = false; |
| | | this.linkType.attributes = []; |
| | | this.linkType = {}; |
| | | this.attrRef.selectData = []; |
| | | this.attrRef.queryNotIn = null; |
| | | this.resetForm(); |
| | | }, |
| | | // å
³é屿§æ± æ¥è¯¢å¼¹çª |
| | | closeAttrDialog() { |
| | | this.attrRef.visible = false; |
| | | }, |
| | | initTreeOnLoad() { |
| | | initTree().then(res => { |
| | | this.domainList = res.data.data; |
| | | }); |
| | | }, |
| | | // æ·»å |
| | | rowAdd() { |
| | | this.attrRef.visible = true; |
| | | this.attrRefOnLoad(); |
| | | }, |
| | | // 屿§æ± å è½½ |
| | | attrRefOnLoad() { |
| | | 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() { |
| | | if(!this.linkType.attributes){ |
| | | this.linkType.attributes = []; |
| | | } |
| | | this.attrRef.queryNotIn = ""; |
| | | console.log(this.attrRef.selectData); |
| | | this.attrRef.selectData.forEach(item => { |
| | | this.linkType.attributes.push({ |
| | | id: item.id, |
| | | name: item.name, |
| | | typeValue: item.typeValue, |
| | | typeKey: item.typeValue, |
| | | attrDataType: item.typeKey, |
| | | defaultValue: item.defaultValue, |
| | | description: item.description, |
| | | attributeLength: item.maxLength |
| | | }); |
| | | this.attrRef.queryNotIn += (item.id + ",") |
| | | }); |
| | | this.closeAttrDialog(); |
| | | }, |
| | | // 忶屿§æ± å¾é |
| | | cancleSelectAttr() { |
| | | this.attrRef.selectData = []; |
| | | this.closeAttrDialog(); |
| | | }, |
| | | // æ·»å ä¸å¡ç±»å |
| | | submitlinkType() { |
| | | add(this.linkType, true).then(res => { |
| | | // æ·»å 宿ï¼åè°ç¶ç»ä»¶çå·æ° |
| | | this.$message.success('ä¿åæå'); |
| | | this.cancleSubmitlinkType(); |
| | | this.$emit('refreshTable'); |
| | | }) |
| | | }, |
| | | // åæ¶æ·»å ä¸å¡ç±»å |
| | | cancleSubmitlinkType() { |
| | | this.linkType = {}; |
| | | this.linkType.attributes = []; |
| | | this.showSubmitDialog = false; |
| | | }, |
| | | // å·æ°å±æ§å表 |
| | | refreshAttrTable() { |
| | | this.$nextTick(() => { |
| | | this.$refs.attrTable.refreshTable(); |
| | | }) |
| | | }, |
| | | // |
| | | viewChange() { |
| | | |
| | | }, |
| | | // å表ç¼è¾ |
| | | cellEditClick(cell) { |
| | | cell.$cellEdit = true; |
| | | }, |
| | | // å表ç¼è¾ä¿å |
| | | cellEditSave(row) { |
| | | this.linkType.attributes[row.$index].name = row.name |
| | | this.linkType.attributes[row.$index].defaultValue = row.defaultValue; |
| | | this.linkType.attributes[row.$index].description = row.description; |
| | | row.$cellEdit = false; |
| | | }, |
| | | fromSelectChange(dataList){ |
| | | this.linkType.fromBtmTypes = []; |
| | | var fromBtmName = ""; |
| | | var fromBtmType = ""; |
| | | dataList.forEach(data => { |
| | | //this.linkType.fromBtmTypes.push(data); |
| | | fromBtmName += (data.name + ','); |
| | | fromBtmType += (data.id + ','); |
| | | }) |
| | | this.linkType.fromBtmTypeName = fromBtmName; |
| | | this.linkType.fromBtmType = fromBtmType; |
| | | }, |
| | | toSelectChange(dataList){ |
| | | console.log(dataList); |
| | | this.linkType.toBtmTypes = []; |
| | | var toBtmName = ""; |
| | | var toBtmType = ""; |
| | | dataList.forEach(data => { |
| | | //this.linkType.toBtmTypes.push(data); |
| | | toBtmName += (data.name + ','); |
| | | toBtmType += (data.id + ','); |
| | | }) |
| | | this.linkType.toBtmTypeName = toBtmName; |
| | | this.linkType.toBtmType = toBtmType; |
| | | console.log(this.linkType); |
| | | }, |
| | | resetForm(){ |
| | | this.linkType = {}; |
| | | this.$refs.form.resetFields(); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | /* 屿§æ± åç
§å表 */ |
| | | .attrRef>.el-card:nth-of-type(2)>.el-card__body>.avue-crud__menu { |
| | | display: none !important; |
| | | } |
| | | |
| | | .revisionRef>.el-card:nth-of-type(2)>.el-card__body>.avue-crud__menu { |
| | | display: none !important; |
| | | } |
| | | |
| | | .linkTypeForm>.el-form-item>.el-form-item__content>.el-input>.el-input__inner { |
| | | width: 200px; |
| | | } |
| | | |
| | | .descClass>.el-input__inner { |
| | | width: 57vw |
| | | } |
| | | |
| | | #descId { |
| | | width: 57vw; |
| | | } |
| | | </style> |