110 lines
2.9 KiB
Vue
110 lines
2.9 KiB
Vue
|
|
<template>
|
|||
|
|
<a-select
|
|||
|
|
:value="row[field]"
|
|||
|
|
:options="options"
|
|||
|
|
:disabled="disabled"
|
|||
|
|
:open="dropdownOpen"
|
|||
|
|
allow-clear
|
|||
|
|
show-search
|
|||
|
|
:bordered="false"
|
|||
|
|
size="small"
|
|||
|
|
class="mixing-step-select"
|
|||
|
|
popup-class-name="mixing-step-select-dropdown"
|
|||
|
|
:placeholder="placeholder"
|
|||
|
|
:get-popup-container="getPopupContainer"
|
|||
|
|
@update:value="handleChange"
|
|||
|
|
@dropdown-visible-change="handleDropdownVisibleChange"
|
|||
|
|
@click.stop
|
|||
|
|
/>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script lang="ts" setup>
|
|||
|
|
import { ref } from 'vue';
|
|||
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|||
|
|
|
|||
|
|
const props = defineProps<{
|
|||
|
|
row: Recordable;
|
|||
|
|
field: string;
|
|||
|
|
options: { label: string; value: string }[];
|
|||
|
|
disabled?: boolean;
|
|||
|
|
placeholder?: string;
|
|||
|
|
machineId?: string;
|
|||
|
|
}>();
|
|||
|
|
|
|||
|
|
const { createMessage } = useMessage();
|
|||
|
|
const dropdownOpen = ref(false);
|
|||
|
|
|
|||
|
|
function handleChange(value: string | undefined) {
|
|||
|
|
props.row[props.field] = value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A37】未选机台点击动作/组合提示请先选择机台-----------
|
|||
|
|
function handleDropdownVisibleChange(visible: boolean) {
|
|||
|
|
if (props.disabled) {
|
|||
|
|
dropdownOpen.value = false;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (visible && !props.machineId) {
|
|||
|
|
createMessage.warning('请先选择机台');
|
|||
|
|
dropdownOpen.value = false;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
dropdownOpen.value = visible;
|
|||
|
|
}
|
|||
|
|
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A37】未选机台点击动作/组合提示请先选择机台-----------
|
|||
|
|
|
|||
|
|
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A36】动作/组合下拉挂到body避免被表格裁切-----------
|
|||
|
|
function getPopupContainer() {
|
|||
|
|
return document.body;
|
|||
|
|
}
|
|||
|
|
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A36】动作/组合下拉挂到body避免被表格裁切-----------
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style lang="less" scoped>
|
|||
|
|
.mixing-step-select {
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100%;
|
|||
|
|
display: flex;
|
|||
|
|
align-items: center;
|
|||
|
|
|
|||
|
|
:deep(.ant-select) {
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
:deep(.ant-select-selector) {
|
|||
|
|
border: none !important;
|
|||
|
|
box-shadow: none !important;
|
|||
|
|
background: transparent !important;
|
|||
|
|
padding: 0 18px 0 2px !important;
|
|||
|
|
min-height: 24px !important;
|
|||
|
|
height: 100% !important;
|
|||
|
|
display: flex !important;
|
|||
|
|
align-items: center !important;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
:deep(.ant-select-selection-item),
|
|||
|
|
:deep(.ant-select-selection-placeholder) {
|
|||
|
|
line-height: 1.2 !important;
|
|||
|
|
text-align: center;
|
|||
|
|
padding-inline-end: 0 !important;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
:deep(.ant-select-selection-search-input) {
|
|||
|
|
height: 100% !important;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
:deep(.ant-select-arrow) {
|
|||
|
|
right: 2px;
|
|||
|
|
margin-top: -3px;
|
|||
|
|
color: #666;
|
|||
|
|
font-size: 10px;
|
|||
|
|
pointer-events: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
:deep(.ant-select-clear) {
|
|||
|
|
right: 14px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</style>
|