MapSourceModal.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <BasicModal width="1200px" v-bind="$attrs" @register="registerModal" @cancel="handleCancel" :title="getTitle"
  3. @ok="handleSubmit">
  4. <div style="height: 60vh" class="res-form-container">
  5. <a-tabs v-model:activeKey="activeKey" class="res-a-tabs">
  6. <a-tab-pane key="1" tab="组件信息">
  7. <!-- <BasicForm @register="registerForm"></BasicForm> -->
  8. <source-detail ref="refSourceDetail" @RtnMain="RtnMain" :formData="formData" :isUpdate="isUpdate"
  9. :isView="isView"></source-detail>
  10. </a-tab-pane>
  11. <a-tab-pane key="2" tab="流程信息" force-render>
  12. <FlowStep :flowTitle="'组件资源上传'" :flowCode="flowCode" :formData="formData"></FlowStep>
  13. </a-tab-pane>
  14. </a-tabs>
  15. </div>
  16. </BasicModal>
  17. </template>
  18. <script lang="ts">
  19. import { defineComponent, ref, computed, unref, reactive, onMounted } from 'vue';
  20. import { BasicModal, useModalInner } from '/@/components/Modal';
  21. import { BasicForm } from '/@/components/Form/index';
  22. import { BasicTree } from '/@/components/Tree';
  23. import { PlusOutlined } from '@ant-design/icons-vue';
  24. import SourceDetail from './SourceDetail.vue';
  25. import FlowStep from './flowStep/index.vue';
  26. import { queryFlowInfoPage } from '/@/api/resource/examine';
  27. export default defineComponent({
  28. name: 'AccountModal',
  29. components: {
  30. BasicModal,
  31. BasicForm,
  32. BasicTree,
  33. PlusOutlined,
  34. FlowStep,
  35. SourceDetail,
  36. VNodes: (_, { attrs }) => {
  37. return attrs.vnodes;
  38. },
  39. },
  40. emits: ['success', 'register'],
  41. setup(_, { emit }) {
  42. const activeKey = ref('1')
  43. const flowCode = ref('20220523001');
  44. const refSourceDetail = ref(null);
  45. let formData = ref(null)
  46. const isUpdate = ref(true);
  47. const isView = ref(false);
  48. const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
  49. setModalProps({ confirmLoading: false });
  50. isUpdate.value = !!data?.isUpdate;
  51. isView.value = !!data?.see;
  52. if (isUpdate.value) formData.value = data.record
  53. });
  54. const getTitle = computed(() => {
  55. if (isUpdate.value && !isView.value) {
  56. return '编辑组件资源'
  57. } else if (isView.value) {
  58. return '查看组件资源'
  59. } else {
  60. return '新增组件资源'
  61. }
  62. });
  63. async function handleSubmit() {
  64. refSourceDetail.value.submitForm();
  65. }
  66. const RtnMain = (status) => {
  67. emit('success')
  68. }
  69. function getFlow() {
  70. queryFlowInfoPage({
  71. page: 1,
  72. rows: 1000000
  73. }).then(flowRes => {
  74. if (flowRes && flowRes.length) {
  75. var flow = flowRes.filter(i => i.FLOWNAME === '组件资源上传');
  76. if (flow && flow.length) flowCode.value = flow[0].id;
  77. }
  78. })
  79. }
  80. onMounted(() => getFlow());
  81. function handleCancel() {
  82. formData.value = null;
  83. closeModal();
  84. }
  85. return {
  86. handleCancel,
  87. isView,
  88. flowCode,
  89. activeKey,
  90. registerModal,
  91. handleSubmit,
  92. getTitle,
  93. refSourceDetail,
  94. isUpdate,
  95. formData,
  96. RtnMain,
  97. };
  98. },
  99. });
  100. </script>
  101. <style scoped lang="less">
  102. :deep(.vben-basic-tree) {
  103. width: 100% !important;
  104. }
  105. :deep(.is-unflod) {
  106. display: none !important;
  107. }
  108. :deep(.is-flod) {
  109. display: none !important;
  110. }
  111. :deep(.res-form-container) {
  112. .res-a-tabs {
  113. margin-top: 61px !important;
  114. }
  115. }
  116. </style>