[update] 标准选择改成回显用value

This commit is contained in:
lideqin
2023-09-25 17:59:32 +08:00
parent bf9004585c
commit c54b8e8c7b
8 changed files with 76 additions and 356 deletions
+25 -31
View File
@@ -1,14 +1,14 @@
<template>
<div>
<div class="selection-wrapper">
<div class="box-title-text">
<a-input class="box-input" :value="value" :title="value" @input="indexClick($event)"
:disabled="isDisabled" readonly
:placeholder="!isDisabled?$t('pleaseEnterOrSelect')+query.dbFieldTxt:query.dbFieldTxt"/>
:placeholder="placeholder"/>
<a-button v-if="!isDisabled" type="primary" class="button-box" @click="standardClick">
{{this.$t('standardSelect.standardSelection')}}
</a-button>
</div>
<standard-selection-modal ref="standardSelectionModal" v-bind="$attrs" :query="query" @input="modalInput" @change="modalChange"></standard-selection-modal>
<standard-selection-modal ref="standardSelectionModal" v-bind="$attrs" :value="value" @change="modalInput" @nameChange="modalNameChange"></standard-selection-modal>
</div>
</template>
@@ -19,27 +19,17 @@ export default {
name: 'StandardSelection',
components: { StandardSelectionModal },
props: {
query: {
type: Object,
default: () => {
return {}
}
},
value: {
type: String,
default: ''
}
},
computed: {
isDisabled () {
if (this.query.dbFieldName === 'replaced_standard') {
return true
}
return false
}
},
data () {
return {
},
placeholder: {
type: String,
default: ''
},
isDisabled: {
type: Boolean,
default: false
}
},
methods: {
@@ -49,33 +39,37 @@ export default {
},
// 输入框输入监听
indexClick (event) {
console.log(event.target.value)
this.$emit('input', event.target.value)
this.$emit('change', event.target.value)
},
modalInput (value) {
this.$emit('input', value)
this.$emit('change', value)
},
modalChange (fieldName, value) {
this.$emit('change', fieldName, value)
modalNameChange (value) {
this.$emit('nameChange', value)
}
},
model: {
prop: 'value',
event: 'change'
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.selection-wrapper {
height: 40px;
line-height: 40px;
}
.box-title-text {
line-height: 1.4;
height: 100%;
display: flex;
align-items: center;
.box-input {
display: inline-block;
//height: 38px;
width: 100%;
}
.button-box {
margin-left: 10px;
//height: 38px;
//line-height: 38px;
}
}
</style>