instrument_appointment.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="cert-dialog-container">
  3. <van-cell-group>
  4. <van-cell title="仪器名称" title-class="cell-title" :value="state.form.instName" />
  5. <van-cell title="所属平台" title-class="cell-title" :value="state.form.platformName" />
  6. <van-cell title="仪器类型" title-class="cell-title" :value="state.form.instClassDesc" />
  7. <van-cell title="计费方式" title-class="cell-title" :value="state.form.costType" />
  8. <van-cell title="预约人" title-class="cell-title" :value="state.form.userName" />
  9. <van-cell title="预约时间段" title-class="cell-title">
  10. <template #value>
  11. <div class="time-range">
  12. <div class="time-item">{{ state.form.startTime }}</div>
  13. <div class="time-connector">至</div>
  14. <div class="time-item">{{ state.form.endTime }}</div>
  15. </div>
  16. </template>
  17. </van-cell>
  18. <van-cell title="辅助上机" title-class="cell-title" :value="state.form.assistEnable ? '是' : '否'" />
  19. <van-cell title="备注" title-class="cell-title" :value="state.form.remark" />
  20. </van-cell-group>
  21. </div>
  22. </template>
  23. <script setup lang="ts" name="systemProDialog">
  24. import to from 'await-to-js'
  25. import { reactive, ref, onMounted } from 'vue'
  26. import { useUseAppointApi } from '/@/api/instr/inst/useAppoint'
  27. // 定义子组件向父组件传值/事件
  28. const emit = defineEmits(['refresh'])
  29. const props = defineProps({
  30. code: {
  31. type: String,
  32. default: '',
  33. },
  34. })
  35. const useAppointApi = useUseAppointApi()
  36. // 定义变量内容
  37. const certDialogFormRef = ref()
  38. const state = reactive({
  39. form: {
  40. instName: '',
  41. platformName: '',
  42. instClassDesc: '',
  43. costType: '',
  44. appointeeInstrumentName: '',
  45. userName: '',
  46. startTime: '',
  47. endTime: '',
  48. assistEnable: false,
  49. remark: '',
  50. },
  51. })
  52. const getDetail = async () => {
  53. const costTypeMap: Record<number, string> = {
  54. 10: '按预约时间计费',
  55. 20: '按使用时间计费',
  56. 30: '按使用次数计费',
  57. 40: '按阶梯计费',
  58. 50: '按管数计费',
  59. }
  60. const [err, res]: ToResponse = await to(useAppointApi.getZunYiAppointEntityById({ id: Number(props.code) }))
  61. if (err) return
  62. state.form = {
  63. ...res?.data,
  64. costType: costTypeMap[res?.data?.costType],
  65. }
  66. }
  67. onMounted(() => {
  68. getDetail()
  69. })
  70. </script>
  71. <style scoped lang="scss">
  72. .add-record-title {
  73. display: flex;
  74. justify-content: space-between;
  75. }
  76. .time-range {
  77. display: flex;
  78. align-items: center;
  79. justify-content: center;
  80. height: 100%;
  81. gap: 8px;
  82. }
  83. .time-item {
  84. flex: 1;
  85. text-align: center;
  86. min-width: 0;
  87. }
  88. .time-connector {
  89. color: #969799;
  90. font-size: 12px;
  91. position: relative;
  92. padding: 0 4px;
  93. }
  94. .time-connector::before {
  95. content: '';
  96. position: absolute;
  97. top: 50%;
  98. left: 0;
  99. right: 0;
  100. height: 1px;
  101. background-color: #ebedf0;
  102. transform: translateY(-50%);
  103. }
  104. .time-connector::after {
  105. content: '';
  106. position: absolute;
  107. top: 50%;
  108. left: 0;
  109. right: 0;
  110. height: 1px;
  111. background-color: #ebedf0;
  112. transform: translateY(-50%);
  113. }
  114. </style>