|
|
@@ -2,9 +2,24 @@
|
|
|
<view class="check-task-status-box">
|
|
|
<text class="title" :style="textStyle">任务状态:</text>
|
|
|
<view class="status-input" @click="showMultiPicker">
|
|
|
- <text class="status-text">
|
|
|
- {{ selectedItems.length > 0 ? selectedItems.join('、') : '请选择' }}
|
|
|
- </text>
|
|
|
+ <view class="status-tags">
|
|
|
+ <view v-if="selectedItems.length === 0" class="placeholder-tag">
|
|
|
+ <text class="placeholder-text">请选择</text>
|
|
|
+ </view>
|
|
|
+ <template v-else-if="isOverflow">
|
|
|
+ <view class="status-tag">
|
|
|
+ <text class="tag-text">{{ selectedItems[0] }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="count-tag">
|
|
|
+ <text class="count-text">{{ selectedItems.length - 1 }}</text>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <view v-for="(item, index) in selectedItems" :key="index" class="status-tag">
|
|
|
+ <text class="tag-text">{{ item }}</text>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </view>
|
|
|
<image class="arrow-icon" :src="iconMap.ArrowDown" />
|
|
|
</view>
|
|
|
|
|
|
@@ -36,7 +51,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref } from 'vue'
|
|
|
+import { ref, computed } from 'vue'
|
|
|
import iconMap from '@/utils/imagesMap'
|
|
|
import { PressureCheckerMyTaskStatus } from '@/utils/dictMap'
|
|
|
|
|
|
@@ -73,6 +88,11 @@ if (props.defaultValue && props.defaultValue.length > 0) {
|
|
|
.map((item) => item.label)
|
|
|
}
|
|
|
|
|
|
+// 判断是否超出宽度(选中1个显示tag,2个及以上显示第一个tag+剩余数量)
|
|
|
+const isOverflow = computed(() => {
|
|
|
+ return selectedItems.value.length > 1
|
|
|
+})
|
|
|
+
|
|
|
// 暴露方法
|
|
|
defineExpose({
|
|
|
reset: () => {
|
|
|
@@ -119,32 +139,77 @@ const confirmSelection = () => {
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
align-items: center;
|
|
|
- margin-bottom: 13px;
|
|
|
+ margin-bottom: 10px;
|
|
|
}
|
|
|
|
|
|
.title {
|
|
|
- color: rgb(51, 51, 51);
|
|
|
- font-size: 12px;
|
|
|
width: 90px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: rgb(51, 51, 51);
|
|
|
text-align: right;
|
|
|
}
|
|
|
|
|
|
.status-input {
|
|
|
- flex: 1;
|
|
|
display: flex;
|
|
|
+ flex: 1;
|
|
|
flex-direction: row;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
height: 30px;
|
|
|
+ padding: 0 5px;
|
|
|
border: 1px solid #ccc;
|
|
|
border-radius: 6px;
|
|
|
- padding: 0 5px;
|
|
|
}
|
|
|
|
|
|
-.status-text {
|
|
|
- color: rgba(136, 136, 136, 1);
|
|
|
- font-size: 12px;
|
|
|
+.status-tags {
|
|
|
+ display: flex;
|
|
|
flex: 1;
|
|
|
+ flex-direction: row;
|
|
|
+ gap: 4px;
|
|
|
+ align-items: center;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+
|
|
|
+.count-tag {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ min-width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ padding: 0 6px;
|
|
|
+ background-color: #2f8eff;
|
|
|
+ border-radius: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.count-text {
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: white;
|
|
|
+}
|
|
|
+
|
|
|
+.status-tag {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 2px 8px;
|
|
|
+ background-color: #e6f7ff;
|
|
|
+ border: 1px solid #b3d4ff;
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+
|
|
|
+.tag-text {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #2f8eff;
|
|
|
+ white-space: nowrap;
|
|
|
+}
|
|
|
+
|
|
|
+.placeholder-tag {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.placeholder-text {
|
|
|
+ font-size: 12px;
|
|
|
+ color: rgba(136, 136, 136, 1);
|
|
|
}
|
|
|
|
|
|
.arrow-icon {
|
|
|
@@ -155,22 +220,22 @@ const confirmSelection = () => {
|
|
|
.popup-mask {
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
- left: 0;
|
|
|
right: 0;
|
|
|
bottom: 0;
|
|
|
- background-color: rgba(0, 0, 0, 0.5);
|
|
|
+ left: 0;
|
|
|
+ z-index: 999;
|
|
|
display: flex;
|
|
|
- justify-content: center;
|
|
|
align-items: flex-end;
|
|
|
- z-index: 999;
|
|
|
+ justify-content: center;
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
}
|
|
|
|
|
|
.popup-content {
|
|
|
width: 100%;
|
|
|
max-width: 500px;
|
|
|
+ overflow: hidden;
|
|
|
background-color: #fff;
|
|
|
border-radius: 10px 10px 0 0;
|
|
|
- overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.popup-header {
|
|
|
@@ -181,13 +246,13 @@ const confirmSelection = () => {
|
|
|
|
|
|
.popup-title {
|
|
|
font-size: 18px;
|
|
|
- color: #333;
|
|
|
font-weight: 500;
|
|
|
+ color: #333;
|
|
|
}
|
|
|
|
|
|
.popup-options {
|
|
|
- padding: 15px;
|
|
|
max-height: 300px;
|
|
|
+ padding: 15px;
|
|
|
overflow-y: auto;
|
|
|
}
|
|
|
|
|
|
@@ -204,14 +269,14 @@ const confirmSelection = () => {
|
|
|
}
|
|
|
|
|
|
.checkbox {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
width: 20px;
|
|
|
height: 20px;
|
|
|
- border-radius: 3px;
|
|
|
- border: 1px solid #bbb;
|
|
|
margin-right: 10px;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
+ border: 1px solid #bbb;
|
|
|
+ border-radius: 3px;
|
|
|
}
|
|
|
|
|
|
.checkbox.checked {
|
|
|
@@ -233,25 +298,25 @@ const confirmSelection = () => {
|
|
|
|
|
|
.cancel-btn,
|
|
|
.confirm-btn {
|
|
|
- flex: 1;
|
|
|
- height: 40px;
|
|
|
- border-radius: 4px;
|
|
|
display: flex;
|
|
|
- justify-content: center;
|
|
|
+ flex: 1;
|
|
|
align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ height: 40px;
|
|
|
font-size: 16px;
|
|
|
border: none;
|
|
|
+ border-radius: 4px;
|
|
|
}
|
|
|
|
|
|
.cancel-btn {
|
|
|
- background-color: #fff;
|
|
|
+ margin-right: 10px;
|
|
|
color: #666;
|
|
|
+ background-color: #fff;
|
|
|
border: 1px solid #ddd;
|
|
|
- margin-right: 10px;
|
|
|
}
|
|
|
|
|
|
.confirm-btn {
|
|
|
- background-color: #2f8eff;
|
|
|
color: #fff;
|
|
|
+ background-color: #2f8eff;
|
|
|
}
|
|
|
</style>
|