<template>
  <a-button
    @click="openNew(`/oa/task/add?appid=${data.appId}&appName=${data.appName}`)"
    >提交工单</a-button
  >
</template>

<script lang="ts" setup>
  import { TaskParam } from '@/api/oa/task/model';
  import useSearch from '@/utils/use-search';
  import { openNew } from '@/utils/common';
  import { App } from '@/api/oa/app/model';

  defineProps<{
    data: App;
  }>();

  const emit = defineEmits<{
    (e: 'search', where: TaskParam): void;
    (e: 'remove'): void;
  }>();

  // 表单数据
  const { where } = useSearch<TaskParam>({
    keywords: '',
    status: undefined,
    commander: undefined
  });

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