|
@@ -42,7 +42,7 @@
|
|
|
import { debounce } from "@/utils/debounce";
|
|
|
import { stringNotBlank } from "@/utils/blank-utils";
|
|
|
import { onMounted, watch, useId } from "vue";
|
|
|
-import useCompRef from "@/utils/useCompRef";
|
|
|
+import { useCompShallowRef } from "@/utils/useCompRef";
|
|
|
import { ElSelect } from "element-plus";
|
|
|
import XEUtils from "xe-utils";
|
|
|
|
|
@@ -82,8 +82,7 @@ const props = defineProps({
|
|
|
const emit = defineEmits(["method", "change", "focus"]);
|
|
|
|
|
|
const uuid = useId();
|
|
|
-const modelObj = ref(null);
|
|
|
-const selectRef = useCompRef(ElSelect);
|
|
|
+const selectRef = useCompShallowRef(ElSelect);
|
|
|
const optionList = ref([]);
|
|
|
const colorList = {
|
|
|
primary: "#409eff",
|
|
@@ -98,6 +97,8 @@ const changeStaff = value => {
|
|
|
if (find) {
|
|
|
props.modelValue[props.name[0]] = find[props.keys[0]];
|
|
|
props.modelValue[props.name[1]] = find[props.keys[1]];
|
|
|
+ } else {
|
|
|
+ props.modelValue[props.name[1]] = null;
|
|
|
}
|
|
|
emit("change", find);
|
|
|
};
|
|
@@ -127,17 +128,8 @@ const getFocus = () => {
|
|
|
watch(
|
|
|
() => props.modelValue[props.name[0]],
|
|
|
() => {
|
|
|
- modelObj.value = props.modelValue[props.name[0]];
|
|
|
- let len = props.data.length;
|
|
|
- if (len === 0) {
|
|
|
- method(modelObj.value);
|
|
|
- }
|
|
|
- for (let i = 0; i < len; i++) {
|
|
|
- if (modelObj.value === props.data[i].code) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- method(modelObj.value);
|
|
|
+ changeStaff(props.modelValue[props.name[0]]);
|
|
|
+ method(props.modelValue[props.name[0]]);
|
|
|
}
|
|
|
);
|
|
|
|
|
@@ -156,9 +148,6 @@ const blur = () => {
|
|
|
defineExpose({ focus, blur });
|
|
|
|
|
|
onMounted(() => {
|
|
|
- // nextTick(() => {
|
|
|
- // modelObj.value = props.modelValue[props.name[0]];
|
|
|
- // });
|
|
|
// 判断组件是否使用了 slot
|
|
|
if (!!useSlots().default) {
|
|
|
// 判断 slot 有没有想要的值
|