| | |
| | | <el-form ref="form" :model="attribute" show-message="true" inline size="medium" label-suffix=":" |
| | | class="attributeForm" :rules="rules" @resetFields="resetAttributeForm" status-icon="true"> |
| | | <el-form-item label="属性编号" label-width="100px" prop="id"> |
| | | <el-input v-model="attribute.id" maxlength="15" show-word-limit type="text"></el-input> |
| | | <el-input v-model="attribute.id" maxlength="30" show-word-limit @input="handleIdInput"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="属性名称" label-width="100px" prop="name"> |
| | | <el-input v-model="attribute.name"></el-input> |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="标签" label-width="100px"> |
| | | <!-- <el-form-item label="标签" label-width="100px"> |
| | | <el-input v-model="attribute.hashtag"></el-input> |
| | | </el-form-item> |
| | | </el-form-item>--> |
| | | <el-form-item label="默认值" label-width="100px"> |
| | | <el-input v-model="attribute.defaultValue"></el-input> |
| | | </el-form-item> |
| | |
| | | </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"> |
| | | <el-form-item label="参照类型" label-width="100px" class="referTypeForm"> |
| | | <el-select v-model="attribute.referTypeKey" @change="referTypeSelectChange"> |
| | | <el-option v-for="item in btmRefer.referTypeList" :key="item.value" :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="参照名称" label-width="100px"> |
| | | <el-form-item label="参照名称" label-width="100px" class="referNameForm"> |
| | | <el-input v-model="attribute.referToName" @focus="openReferConfig" clearable="true" |
| | | :disabled="referToFlag" @clear="clearReferTo"> |
| | | <i slot="suffix" class="el-input__icon el-icon-search"></i> |
| | |
| | | <!-- 选择枚举时的弹窗 --> |
| | | <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" |
| | | <div> |
| | | <el-form :inline="true" :model="form" class="demo-form-inline" size="small"> |
| | | <el-form-item label="枚举代号"> |
| | | <el-input v-model="form.name" placeholder="枚举代号"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="枚举名称"> |
| | | <el-input v-model="form.label" placeholder="枚举名称"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="onSubmit">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <avue-crud ref="eunmTable" :option="enumRefer.option" @on-load="enumOnLoad" :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"> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | form:{ |
| | | name:'', |
| | | label:'' |
| | | }, |
| | | showSubmitDialog: false, |
| | | // 默认的页签 |
| | | activeName: 'referTab', |
| | |
| | | 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: 30, message: '长度在2到30个字符', trigger: 'blur' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '请输入属性名称', trigger: 'blur' } |
| | |
| | | border: true, |
| | | reserveSelection: true, |
| | | searchMenuSpan: 32, |
| | | searchShowBtn: false, |
| | | // searchShowBtn: false, |
| | | // search:true, |
| | | highlightCurrentRow: true, |
| | | column: [{ |
| | | label: '', |
| | |
| | | prop: 'name', |
| | | align: 'center', |
| | | searchSpan: 8, |
| | | search: true, |
| | | // search: true, |
| | | }, { |
| | | label: '枚举名称', |
| | | prop: 'label', |
| | | align: 'center', |
| | | searchSpan: 8, |
| | | search: true, |
| | | // search: true, |
| | | }] |
| | | }, |
| | | // 枚举参照表格数据 |
| | |
| | | this.initAttributeReferTypeList(); |
| | | }, |
| | | methods: { |
| | | handleIdInput(value){ |
| | | this.attribute.id = value.toLowerCase(); |
| | | }, |
| | | onSubmit() { |
| | | if (this.form.name || this.form.label) { |
| | | const params = {}; |
| | | if (this.form.name) { |
| | | params.name = this.form.name; |
| | | } |
| | | if (this.form.label) { |
| | | params.label = this.form.label; |
| | | } |
| | | getParentList(this.enumRefer.enumPage.currentPage, this.enumRefer.enumPage.pageSize, params) |
| | | .then((res) => { |
| | | this.enumRefer.enumPage.total = res.data.data.total; |
| | | this.enumRefer.data = res.data.data.records; |
| | | }); |
| | | } |
| | | }, |
| | | enumOnLoad(){ |
| | | 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; |
| | | }) |
| | | }, |
| | | closeSubmitDialog() { |
| | | this.resetAttributeForm(); |
| | | this.showSubmitDialog = false; |
| | |
| | | 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'); |
| | | this.$set(this.attribute,'dictCode',''); |
| | | this.$set(this.attribute,'dictKey',''); |
| | | this.$set(this.attribute,'dictValue',''); |
| | | this.$set(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.$set(this.attribute,'referTypeCode',''); |
| | | this.$set(this.attribute,'referTypeKey',''); |
| | | this.$set(this.attribute,'referTypeValue',''); |
| | | this.$set(this.attribute,'referToId',''); |
| | | this.$set(this.attribute,'referToName',''); |
| | | } |
| | | this.$refs.form.validate(function (pass, field) { |
| | | if (pass) { |
| | |
| | | this.btmRefer.btmPage.total = res.data.data.total; |
| | | }) |
| | | } |
| | | if (this.attribute.referTypeKey == 'linkType') { |
| | | |
| | | } |
| | | // if (this.attribute.referTypeKey == 'linkType') { |
| | | // |
| | | // } |
| | | }, |
| | | // 枚举类型输入框获得焦点时的事件 |
| | | openEnumConfig() { |
| | |
| | | |
| | | .attributeForm>.el-form-item>.el-form-item__content>.el-select>.el-input>.el-input__inner { |
| | | width: 200px; |
| | | }</style> |
| | | } |
| | | .attributeForm>.el-form-item>.el-form-item__content{ |
| | | width :190px; |
| | | } |
| | | |
| | | .referTypeForm > .el-form-item__content > .el-select > .el-input>.el-input__inner { |
| | | width: 200px; |
| | | } |
| | | |
| | | .referNameForm > .el-form-item__content > .el-input > .el-input__inner { |
| | | width: 200px; |
| | | } |
| | | </style> |