feat: 拆包明细备注下拉选项支持删除并持久化
This commit is contained in:
parent
8e808db6ce
commit
5eecfda9fa
@ -289,7 +289,16 @@
|
||||
class="remark-select"
|
||||
@change="handleRemarkChange(row, $event)"
|
||||
>
|
||||
<el-option v-for="opt in remarkOptions" :key="opt" :label="opt" :value="opt" />
|
||||
<el-option v-for="opt in remarkOptions" :key="opt" :label="opt" :value="opt">
|
||||
<span class="remark-option-content">
|
||||
<span class="remark-option-label">{{ opt }}</span>
|
||||
<span
|
||||
class="remark-option-delete"
|
||||
title="删除该备注选项"
|
||||
@click.stop.prevent="removeRemarkOption(opt)"
|
||||
>×</span>
|
||||
</span>
|
||||
</el-option>
|
||||
<el-option :value="REMARK_ADD_OPTION_VALUE" label="+ 添加备注选项" class="remark-add-option" />
|
||||
</el-select>
|
||||
</template>
|
||||
@ -1925,6 +1934,15 @@ function addRemarkOption(text: string): string {
|
||||
return value
|
||||
}
|
||||
|
||||
/** 删除备注选项(仅从选项列表移除,不影响已录入明细的备注值) */
|
||||
function removeRemarkOption(text: string) {
|
||||
const value = String(text ?? '').trim()
|
||||
const idx = remarkOptions.value.findIndex((o) => o === value)
|
||||
if (idx < 0) return
|
||||
remarkOptions.value.splice(idx, 1)
|
||||
persistRemarkOptions()
|
||||
}
|
||||
|
||||
/** 备注下拉变更:拦截「添加备注选项」,其余值自动入库 localStorage 并保存明细 */
|
||||
function handleRemarkChange(row: any, value: string) {
|
||||
if (value === REMARK_ADD_OPTION_VALUE) {
|
||||
@ -2552,6 +2570,34 @@ async function confirmRemoveDetail() {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.remark-option-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.remark-option-label {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.remark-option-delete {
|
||||
flex-shrink: 0;
|
||||
margin-left: 8px;
|
||||
color: #c0c4cc;
|
||||
font-size: 15px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
transition: color 0.15s;
|
||||
|
||||
&:hover {
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-pagination {
|
||||
margin-top: 8px;
|
||||
justify-content: flex-end;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user