deviceModal.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <BasicModal
  3. v-bind="$attrs"
  4. @register="registerModal"
  5. :title="title"
  6. width="1000px"
  7. :showCancelBtn="false"
  8. :showOkBtn="false"
  9. :footer="null"
  10. :destroyOnClose="true"
  11. :mask-closable="false"
  12. @cancel="closeModalFn"
  13. >
  14. <a-tabs v-if="props.showTab" v-model:activeKey="activeKey">
  15. <a-tab-pane key="5" tab="配置预警设备" force-render>
  16. <template v-if="activeKey == '5'">
  17. <BackWindDeviceTable :deviceId="selectSysId" />
  18. </template>
  19. </a-tab-pane>
  20. <a-tab-pane key="6" tab="配置控制设备" force-render>
  21. <template v-if="activeKey == '6'">
  22. <ManagerWarningTable :deviceId="selectSysId" />
  23. </template>
  24. </a-tab-pane>
  25. </a-tabs>
  26. </BasicModal>
  27. </template>
  28. <script lang="ts" setup>
  29. import { computed, unref, inject, reactive, ref } from 'vue';
  30. import { BasicModal, useModalInner } from '/@/components/Modal';
  31. import FormModal from '../../../deviceManager/comment/FormModal.vue';
  32. import BackWindDeviceTable from '../../../deviceManager/comment/warningTabel/index3.vue';
  33. import ManagerWarningTable from '../../../deviceManager/comment/warningTabel/index1.vue';
  34. const props = defineProps({
  35. showTab: { type: Boolean, required: true },
  36. deviceType: { type: String, default: '' },
  37. selectSysId: { type: String, default: '' },
  38. selectSysAlarmId: { type: String, default: '' },
  39. });
  40. const emit = defineEmits(['saveOrUpdate', 'register', 'closeModal']);
  41. const isUpdate = inject('isUpdate');
  42. const deviceData = inject('formData') as any;
  43. const deviceType = inject('deviceType') as any;
  44. const record = reactive({});
  45. const activeKey = ref('5');
  46. const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
  47. setModalProps({ confirmLoading: false });
  48. for (const key in deviceData) delete deviceData[key];
  49. Object.assign(deviceData, data.record);
  50. activeKey.value = '5';
  51. });
  52. // 标题
  53. const title = '编辑';
  54. const closeModalFn = () => {
  55. activeKey.value = '5';
  56. closeModal();
  57. emit('closeModal');
  58. };
  59. </script>
  60. <style scoped lang="less">
  61. ::v-deep .suffix {
  62. height: 32px;
  63. line-height: 32px;
  64. margin-left: 5px;
  65. color: #fff;
  66. }
  67. ::v-deep .j-box-bottom-button-float {
  68. background: none !important;
  69. }
  70. </style>