| | |
| | | </el-select> |
| | | <div v-if="showType === 'radio'" :disabled="disabled"> |
| | | <el-radio-group :value="dictValue" @input="$emit('input', $event)" > |
| | | <el-radio :label="data.dictValue" @change="changeDictValue(data.dictValue,data.dictLabel)" v-for="data in dicts" :key="data.dictValue">{{data.dictLabel}}</el-radio> |
| | | <el-input class="radio-input" v-if="isName" v-model="inputName"></el-input> |
| | | <el-radio :label="data.dictValue" v-for="data in dicts" :key="data.dictValue">{{data.dictLabel}}</el-radio> |
| | | <el-input class="radio-input" v-if="isOtherOptionSelected" v-model="inputName"></el-input> |
| | | </el-radio-group> |
| | | </div> |
| | | <zt-combo-tree v-model="dictValue" :datas="dictTrees" :disabled-filter="disabledFilter" @input="$emit('input', $event)" v-if="showType === 'tree'" :placeholder="placeholder"/> |
| | |
| | | name: 'ZtDict', |
| | | props: { |
| | | inputName:{}, |
| | | origin:{}, // 字典字段 |
| | | value: [Number, String, Boolean], |
| | | dict: { // 字典类型 |
| | | type: String, |
| | |
| | | return { |
| | | dictValue: typeof this.value === 'undefined' ? '' : (this.value + ''), |
| | | isName:false, |
| | | eventIndex:'', |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.wrapTreeId(datas) |
| | | return datas |
| | | }, |
| | | isOtherOptionSelected() { |
| | | const selectedOption = this.dicts.find(data => data.dictValue === this.dictValue); |
| | | return selectedOption && selectedOption.dictLabel.includes('其他'); |
| | | }, |
| | | dicts: function () { |
| | | let dicts = this.$store.getters.getDict(this.dict) |
| | | if (this.excluded.length > 0) { |
| | |
| | | watch: { |
| | | value(val, oldval) { |
| | | this.dictValue = typeof val === 'undefined' ? '' : (val + '') |
| | | }, |
| | | inputName(){ |
| | | this.$emit('getChangeInputData',this.inputName,this.origin) |
| | | } |
| | | }, |
| | | methods: { |
| | | changeDictValue(value,name){ |
| | | if(name.indexOf("其他")!=-1){ |
| | | console.log(this.inputName,'inputName') |
| | | console.log(name,'字典名字q34567') |
| | | this.eventIndex = value |
| | | this.isName = true |
| | | }else { |
| | | this.isName = false |
| | | } |
| | | }, |
| | | wrapTreeId(dictTypes) { |
| | | dictTypes.forEach(item => { |
| | | if ((item.dictType || '').length > 0) { // 字典类型 |