소스 검색

站点白名单

skyline 2 달 전
부모
커밋
0227653276
2개의 변경된 파일14개의 추가작업 그리고 9개의 파일을 삭제
  1. 6 7
      admin-web/src/components/form/ExtSelect.vue
  2. 8 2
      admin-web/src/views/admin/whitelist/dialog.vue

+ 6 - 7
admin-web/src/components/form/ExtSelect.vue

@@ -31,7 +31,7 @@ const emit = defineEmits(['update:modelValue', 'on-change']);
 
 const props = defineProps({
   modelValue: {
-    type: Number
+    type: [Number, String]
   },
   prefix: {
     type: String
@@ -85,7 +85,7 @@ const props = defineProps({
 
 const state = reactive({
   list: [] as Array<any>,
-  modelVal: null
+  modelVal: null as any
 })
 
 watch(() => props.modelValue, (val) => {
@@ -178,11 +178,10 @@ const loadData = () => {
 }
 
 const handleValueChange = (val: any) => {
-  nextTick(() => {
-    console.log("handleValueChange--->", val)
-    emit("update:modelValue", val);
-    emit("on-change", val);
-  })
+  console.log("handleValueChange--->", val)
+  emit("update:modelValue", val);
+  emit("on-change", val);
+  emit("change", val);
 }
 
 const handleValueClear = () => {

+ 8 - 2
admin-web/src/views/admin/whitelist/dialog.vue

@@ -31,7 +31,8 @@
               label-key="stationName"
               value-key="stationId"
               clearable
-              class="w100">
+              class="w100"
+              @on-change="handleStationChange">
           </ext-select>
         </el-form-item>
 
@@ -86,7 +87,7 @@ const formRef = ref();
 const initState = () => ({
   ruleForm: {
     id: 0,
-    stationId: '',
+    stationId: null as string | null,
     userId: null as number | null,
     remark: ''
   },
@@ -164,6 +165,11 @@ const handleUserSearch = (query: string) => {
   });
 };
 
+const handleStationChange = (val: any) => {
+  state.ruleForm.stationId = val;
+  formRef.value?.clearValidate('stationId');
+};
+
 defineExpose({
   open
 });