EditExamNumberDialog.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <a-modal
  3. v-model:open="visible"
  4. :width="380"
  5. style="bottom: 0"
  6. :footer="false"
  7. :mask="false"
  8. :maskClosable="false"
  9. :keyboard="false"
  10. centered
  11. wrapClassName="edit-exam-number-dialog"
  12. title="输入准考证号"
  13. >
  14. <a-form ref="formRef" :label-col="{ style: { width: '80px' } }">
  15. <a-form-item label="准考证号">
  16. <div class="exam-number" style="margin-bottom: 10px">
  17. <a-input
  18. v-model:value="examNumber"
  19. placeholder="请输入"
  20. allow-clear
  21. ></a-input>
  22. </div>
  23. <a-button style="margin-right: 10px" @click="close">取消</a-button>
  24. <a-button type="primary" @click="confirm">保存</a-button>
  25. </a-form-item>
  26. </a-form>
  27. </a-modal>
  28. </template>
  29. <script setup lang="ts">
  30. import { onMounted, ref, watch } from "vue";
  31. import { message } from "ant-design-vue";
  32. import { getTextAreaRows } from "@/utils";
  33. import useModal from "@/hooks/useModal";
  34. defineOptions({
  35. name: "EditExamNumberDialog",
  36. });
  37. /* modal */
  38. const { visible, open, close } = useModal();
  39. defineExpose({ open, close });
  40. const props = defineProps<{
  41. data: string;
  42. }>();
  43. const emit = defineEmits(["confirm"]);
  44. const examNumber = ref("");
  45. async function confirm() {
  46. if (!examNumber.value) {
  47. message.warning("请输入考号");
  48. return;
  49. }
  50. emit("confirm", examNumber.value);
  51. close();
  52. }
  53. watch(
  54. () => visible.value,
  55. (val) => {
  56. if (val) {
  57. examNumber.value = props.data || "";
  58. }
  59. },
  60. {
  61. immediate: true,
  62. }
  63. );
  64. </script>
  65. <style lang="less" scoped>
  66. .exam-number {
  67. position: relative;
  68. .ant-input {
  69. padding-bottom: 30px;
  70. width: 100%;
  71. }
  72. .number-suffix {
  73. position: absolute;
  74. color: @text-color3;
  75. height: 22px;
  76. line-height: 22px;
  77. bottom: 5px;
  78. right: 5px;
  79. z-index: 8;
  80. }
  81. }
  82. </style>