SelectProtocolType.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <script setup lang="ts">
  2. import { onMounted } from 'vue';
  3. import { useDictData } from '@/hooks/dict-data';
  4. import { useRequest } from '@/hooks/request';
  5. import { t } from '@/i18n';
  6. import { DictCode } from '@/constants';
  7. import type { SetupProtocolForm, UseGuideStepItemExpose, UseGuideStepItemProps } from '@/types';
  8. const props = defineProps<UseGuideStepItemProps<SetupProtocolForm>>();
  9. const { handleRequest } = useRequest();
  10. const { dictData: protocolTypes, getDictData: getProtocolTypes } = useDictData(DictCode.AllProtocolType);
  11. const currentStep = props.steps[props.stepIndex];
  12. onMounted(() => {
  13. currentStep.title = t('setupProtocol.selectProtocolType');
  14. props.form.protocolType = undefined;
  15. handleRequest(async () => {
  16. await getProtocolTypes();
  17. });
  18. });
  19. const finish = () => {
  20. currentStep.title = t('setupProtocol.protocolDisplayName', { name: props.form.protocolType });
  21. };
  22. defineExpose<UseGuideStepItemExpose>({
  23. finish,
  24. });
  25. </script>
  26. <template>
  27. <div>
  28. <AFormItem :label="$t('setupProtocol.protocolType')" name="protocolType">
  29. <ASelect v-model:value="form.protocolType" class="protocol-select" :placeholder="$t('common.plzSelect')">
  30. <ASelectOption v-for="item in protocolTypes" :key="item.dictValueId" :value="item.dictValue">
  31. {{ item.dictValue }}
  32. </ASelectOption>
  33. </ASelect>
  34. </AFormItem>
  35. <div class="protocol-help">{{ $t('common.needHelp') }}</div>
  36. <AButton>{{ $t('setupProtocol.howToJudgeProtocolType') }}</AButton>
  37. <AButton>{{ $t('setupProtocol.canNotFindProtocolType') }}</AButton>
  38. </div>
  39. </template>
  40. <style lang="scss" scoped>
  41. .protocol-select {
  42. width: 256px;
  43. }
  44. .protocol-help {
  45. margin-top: 128px;
  46. margin-bottom: 16px;
  47. font-size: 16px;
  48. font-weight: 500;
  49. line-height: 24px;
  50. color: var(--antd-color-text);
  51. }
  52. button + button {
  53. margin-left: 12px;
  54. }
  55. </style>