116 lines
2.3 KiB
Vue
116 lines
2.3 KiB
Vue
<template>
|
|
<div class="selection-wrapper">
|
|
<div class="box-title-text">
|
|
<a-input class="box-input"
|
|
:value="checkedValue"
|
|
:title="checkedValue"
|
|
disabled
|
|
:max-length="500"
|
|
@change="event => event.target.value = event.target.value.trim()"
|
|
:placeholder="placeholder" />
|
|
<a-button v-if="!disabled" type="primary" class="button-box" @click="handleClick">
|
|
{{ $t('projectLibrary.noncoincidenceItem.projectSelection') }}
|
|
</a-button>
|
|
</div>
|
|
|
|
<vehicle-project-selection-drawer ref="projectSelectModal" @listChange="handleListChange" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import VehicleProjectSelectionDrawer from './VehicleProjectSelectionDrawer'
|
|
|
|
export default {
|
|
name: 'VehicleProjectSelection',
|
|
components: { VehicleProjectSelectionDrawer },
|
|
props: {
|
|
value: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
placeholder: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
// 是否只能选择
|
|
selectOnly: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false
|
|
},
|
|
// 名字字符串
|
|
nameStr: {
|
|
type: String,
|
|
required: false,
|
|
default: ''
|
|
},
|
|
// 回显取哪个字段的值
|
|
echoFieldName: {
|
|
type: String,
|
|
required: false,
|
|
default: 'projectName'
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
checkedValue: null
|
|
}
|
|
},
|
|
watch: {
|
|
nameStr: {
|
|
immediate: true,
|
|
handler (val) {
|
|
this.checkedValue = val
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
// 点击选择标准按钮
|
|
handleClick () {
|
|
this.$refs.projectSelectModal.open()
|
|
},
|
|
handleListChange (list) {
|
|
const ids = list.map(tt => tt.id).join(',')
|
|
this.checkedValue = list.map(tt => tt[this.echoFieldName]).join(',')
|
|
this.$emit('change', ids)
|
|
this.$emit('listChange', list)
|
|
}
|
|
},
|
|
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 {
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.box-input {
|
|
width: 100%;
|
|
}
|
|
|
|
.button-box {
|
|
margin-left: 10px;
|
|
}
|
|
}
|
|
|
|
/deep/ .ant-input[disabled] {
|
|
background-color: white;
|
|
color: rgba(0, 0, 0, 0.65);
|
|
}
|
|
</style> |