From 55bf797dcc730b37bc691ebab2b51ff9db8ed245 Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周二, 06 5月 2025 17:37:23 +0800
Subject: [PATCH] 修改代码样式

---
 HIAWms/web/src/components/Search/Search.tsx |   64 ++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/HIAWms/web/src/components/Search/Search.tsx b/HIAWms/web/src/components/Search/Search.tsx
new file mode 100644
index 0000000..8c7414b
--- /dev/null
+++ b/HIAWms/web/src/components/Search/Search.tsx
@@ -0,0 +1,64 @@
+import { defineComponent, ref } from 'vue'
+import styles from './Search.module.scss'
+import Icon from '../Icon/Icon'
+import { useVModel } from '@vueuse/core'
+import { debounce } from 'lodash'
+export default defineComponent({
+  name: '鎼滅储杈撳叆',
+  props: {
+    placeholder: {
+      type: String,
+      default: '璇疯緭鍏ユ悳绱�',
+    },
+    modelValue: {
+      type: String,
+      default: '',
+    },
+    tableRef: {
+      type: Object,
+      default: null,
+    },
+    field: {
+      type: String,
+      default: '',
+    },
+  },
+  emits: ['confirm', 'update:modelValue'],
+  setup(props, { attrs, slots, emit }) {
+    const innerValue = useVModel(props)
+    return () => {
+      const confirm = (event: KeyboardEvent | string) => {
+        if (
+          typeof event === 'string' ||
+          event.key === 'Enter' ||
+          event.keyCode === 13
+        ) {
+          emit('confirm', innerValue.value)
+          const rf = props.tableRef?.value || props.tableRef
+          if (rf) {
+            rf.getList({
+              [props.field || 'Name']: innerValue.value,
+            })
+          }
+        }
+      }
+
+      const fn = debounce(confirm, 100)
+
+      return (
+        <div class={styles.inputContent}>
+          <el-input
+            v-model={innerValue.value}
+            class={styles.searchInner}
+            // size="small"
+            prefix-icon={<Icon icon="s_input" width={12} height={12} />}
+            placeholder={props.placeholder}
+            {...attrs}
+            onKeydown={fn}
+            onChange={fn}
+          />
+        </div>
+      )
+    }
+  },
+})

--
Gitblit v1.9.3