modal.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <a-modal v-model:visible="visible" :title="title" @ok="handleOk" @cancel="handleCancel">
  3. <div class="modal-container">
  4. <div class="vent-flex-row">
  5. <ExclamationCircleFilled style="color: #ffb700; font-size: 30px" />
  6. <div class="warning-text">您是否要进行{{ title }}操作?</div>
  7. </div>
  8. <template
  9. v-if="type == '1' || type == '2' || type.startsWith('sameSetValue') || type.startsWith('middleSetValue') || type.startsWith('rearSetValue')"
  10. >
  11. <div class="vent-flex-row input-box">
  12. <div class="label">{{ title.includes('角度') ? '风窗角度:' : '风窗面积:' }}</div>
  13. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  14. </div>
  15. </template>
  16. <template v-else-if="type == '7'">
  17. <div class="vent-flex-row input-box">
  18. <div class="label">风窗目标风量(m³/min):</div>
  19. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  20. </div>
  21. </template>
  22. <template v-else-if="type == '8'">
  23. <div class="vent-flex-row input-box">
  24. <div class="label">风窗目标风量(m³/min):</div>
  25. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  26. </div>
  27. </template>
  28. <template v-else-if="type == 'ldkzStart'">
  29. <div class="vent-flex-row input-box">
  30. <div class="label">瓦斯超限浓度(%):</div>
  31. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  32. </div>
  33. </template>
  34. <template v-else-if="type.startsWith('frontSetValue')">
  35. <div class="vent-flex-row input-box">
  36. <div class="label">风窗角度:</div>
  37. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  38. </div>
  39. </template>
  40. <template v-else-if="type.startsWith('air')">
  41. <div class="vent-flex-row input-box">
  42. <div class="label">风窗过风量(m³/min):</div>
  43. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  44. </div>
  45. </template>
  46. <template v-else-if="type.startsWith('COTest')">
  47. <div class="vent-flex-row input-box">
  48. <div class="label">一氧化碳(ppm):</div>
  49. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  50. </div>
  51. </template>
  52. <template v-else>
  53. <div class="vent-flex-row input-box">
  54. <div class="label">{{ title }}:</div>
  55. <a-input-number size="small" placeholder="0" :min="0" v-model:value="data" />
  56. </div>
  57. </template>
  58. <div v-if="!globalConfig?.simulatedPassword" class="vent-flex-row input-box">
  59. <div class="label">操作密码:</div>
  60. <a-input size="small" type="password" v-model:value="passWord" />
  61. </div>
  62. </div>
  63. </a-modal>
  64. </template>
  65. <script setup lang="ts">
  66. import { watch, ref, inject } from 'vue';
  67. import { ExclamationCircleFilled } from '@ant-design/icons-vue';
  68. const globalConfig = inject('globalConfig');
  69. const props = defineProps({
  70. modalIsShow: {
  71. type: Boolean,
  72. default: false,
  73. },
  74. modalTitle: {
  75. type: String,
  76. default: '',
  77. },
  78. modalType: {
  79. type: String,
  80. default: '',
  81. },
  82. });
  83. const emit = defineEmits(['handleOk', 'handleCancel']);
  84. const visible = ref<Boolean>(false);
  85. const title = ref<String>('');
  86. const type = ref<String>('');
  87. const passWord = ref('');
  88. const data = ref(0);
  89. watch([() => props.modalIsShow, () => props.modalTitle, () => props.modalType], ([newVal, newModalTitle, newModalType]) => {
  90. visible.value = newVal;
  91. if (newModalTitle) title.value = newModalTitle;
  92. if (newModalType) type.value = newModalType;
  93. passWord.value = '';
  94. data.value = 0;
  95. });
  96. function handleOk() {
  97. if (globalConfig?.simulatedPassword) {
  98. emit('handleOk', '', type.value, data.value);
  99. } else {
  100. if (type.value == '3') {
  101. emit('handleOk', passWord.value, type.value, data.value);
  102. } else if (type.value == '7') {
  103. emit('handleOk', passWord.value, type.value, data.value);
  104. } else if (type.value == '8') {
  105. emit('handleOk', passWord.value, type.value, data.value);
  106. } else {
  107. emit('handleOk', passWord.value, type.value, data.value);
  108. }
  109. }
  110. }
  111. function handleCancel() {
  112. //
  113. emit('handleCancel');
  114. data.value = 0;
  115. }
  116. </script>
  117. <style scoped lang="less">
  118. @ventSpace: zxm;
  119. .label {
  120. min-width: 110px;
  121. }
  122. .@{ventSpace}-input,
  123. .@{ventSpace}-input-number {
  124. width: 150px;
  125. }
  126. </style>