<template>
  <a-space>
    <a-button type="primary" @click="add">添加</a-button>
    <a-input-search
      allow-clear
      placeholder="请输入标题关键词"
      v-model:value="where.keywords"
      @pressEnter="search"
      @search="search"
    />
    <QuestionIcon message="适用于记录日常运维服务，或存储的开发资料，如FTP、数据库、登录账号密码等" />
  </a-space>
</template>

<script lang="ts" setup>
import useSearch from "@/utils/use-search";
import QuestionIcon from '@/components/QuestionIcon/index.vue';
import {ProjectFieldParam} from "@/api/project/projectField/model";

const emit = defineEmits<{
  (e: 'add'): void;
  (e: 'search', where?: ProjectFieldParam): void;
}>();

// 表单数据
const {where} = useSearch<ProjectFieldParam>({
  appId: undefined,
  name: undefined,
  keywords: ''
});

const add = () => {
  emit('add');
};

/* 搜索 */
const search = () => {
  emit('search', where);
};
</script>
