From d6e03c8b28806fe3e0523f9827bcd593c61454fb Mon Sep 17 00:00:00 2001 From: wente <329538422@qq.com> Date: 星期三, 22 十一月 2023 11:45:42 +0800 Subject: [PATCH] 项目表 --- web/packages/components/zt-dict/src/zt-dict.vue | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/web/packages/components/zt-dict/src/zt-dict.vue b/web/packages/components/zt-dict/src/zt-dict.vue index ec780f7..23c02b1 100644 --- a/web/packages/components/zt-dict/src/zt-dict.vue +++ b/web/packages/components/zt-dict/src/zt-dict.vue @@ -4,9 +4,9 @@ <el-option :label="data.dictLabel" v-for="data in dicts" :key="data.dictValue" :value ="data.dictValue">{{data.dictLabel}}</el-option> </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-group :value="dictValue" @input="$emit('input', $event)"> + <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"/> @@ -19,6 +19,7 @@ name: 'ZtDict', props: { inputName:{}, + origin:{}, // 瀛楀吀瀛楁 value: [Number, String, Boolean], dict: { // 瀛楀吀绫诲瀷 type: String, @@ -48,7 +49,6 @@ return { dictValue: typeof this.value === 'undefined' ? '' : (this.value + ''), isName:false, - eventIndex:'', } }, computed: { @@ -64,6 +64,10 @@ 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) { @@ -78,19 +82,12 @@ 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) { // 瀛楀吀绫诲瀷 -- Gitblit v1.9.1