modal.vue 4.0 KB

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