|
@@ -10,8 +10,8 @@
|
|
|
>
|
|
|
<el-checkbox-button
|
|
|
class="j-checkbox-button"
|
|
|
- v-for="state in options.value"
|
|
|
- :key="state"
|
|
|
+ v-for="(state, index) in options.value"
|
|
|
+ :key="index"
|
|
|
:label="setSelectValue(state)"
|
|
|
>
|
|
|
{{ field ? setSelectValue(state) : state }}
|
|
@@ -26,7 +26,7 @@ const props = defineProps({
|
|
|
// 是否单选
|
|
|
sigle: {
|
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
+ default: true
|
|
|
},
|
|
|
// field: 空代表字符串数组
|
|
|
// 其他: options是对象数组,field是对象数组的某个字段
|
|
@@ -44,7 +44,7 @@ const props = defineProps({
|
|
|
}
|
|
|
})
|
|
|
function setSelectValue(state) {
|
|
|
- if (props.dataType === '') {
|
|
|
+ if (props.field === '') {
|
|
|
return state
|
|
|
} else {
|
|
|
return state[props.field]
|
|
@@ -56,9 +56,17 @@ function onIssueStateChange(value) {
|
|
|
if (isAllBtn.length > 0) {
|
|
|
value = ['全部']
|
|
|
} else {
|
|
|
- value = value.filter((item) => item !== '全部')
|
|
|
- if (value.length === 0) {
|
|
|
- value = ['全部']
|
|
|
+ // 如果是单选,则只取最新一个
|
|
|
+ if (props.sigle) {
|
|
|
+ const nonAllValues = value.filter((item) => item !== '全部')
|
|
|
+ value = nonAllValues.length
|
|
|
+ ? [nonAllValues[nonAllValues.length - 1]]
|
|
|
+ : ['全部']
|
|
|
+ } else {
|
|
|
+ value = value.filter((item) => item !== '全部')
|
|
|
+ if (value.length === 0) {
|
|
|
+ value = ['全部']
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
emit('input', value)
|