cpm-improve-remind-config.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <span :class="$style.remindconfig">
  3. <audit-form-top-banner :handel-save-form="saveForm" @handelSaveForm="saveForm">
  4. <sd-detail-form
  5. v-if="initialled"
  6. ref="docform"
  7. :page-id="'onl:66b2a4cdc379410f8364320c0ecac5c9'"
  8. :record-id="this.id ? this.id : null"
  9. :read-only="false"
  10. :class="[$style.form]"
  11. @close="close(true)"
  12. @saved="saved"
  13. >
  14. <template v-slot="{ formData, model, fields }">
  15. <table :class="$style.remindTable">
  16. <p :class="$style.title">提醒设置</p>
  17. <tr>
  18. <td colspan="4" :class="$style.subTable">
  19. <sd-form-by-builder
  20. v-if="initialled"
  21. :form-data="initDaF(formData.pageFormData)"
  22. ></sd-form-by-builder>
  23. </td>
  24. </tr>
  25. </table>
  26. </template>
  27. </sd-detail-form> </audit-form-top-banner
  28. ></span>
  29. </template>
  30. <script>
  31. import { message } from '@/common/one-ui'
  32. import auditFormTopBanner from '@product/iam/components/audit-form-top-banner'
  33. import cpmService from '../../cpm-service.js'
  34. import components from './_import-components/cpm-improve-remind-config-import'
  35. export default {
  36. name: 'CpmImproveRemindConfig',
  37. metaInfo: {
  38. title: '整改提醒',
  39. },
  40. components: {
  41. ...components,
  42. auditFormTopBanner,
  43. },
  44. data() {
  45. return {
  46. initialled: false,
  47. id: this.$route.query.id ? this.$route.query.id : '',
  48. flag: true,
  49. orgId: '',
  50. }
  51. },
  52. created() {
  53. const ini = setInterval(() => {
  54. try {
  55. cpmService.getRemindConfigId().then((res) => {
  56. clearInterval(ini)
  57. if (!res.data.id) {
  58. this.id = null
  59. } else {
  60. this.id = res.data.id
  61. }
  62. setTimeout(() => {
  63. this.initialled = true
  64. if (this.id === null) {
  65. // 设置orgId
  66. cpmService.getCurrentUserGroup().then((res) => {
  67. this.orgId = res.data
  68. })
  69. }
  70. }, 100)
  71. })
  72. } catch {}
  73. }, 100)
  74. },
  75. methods: {
  76. saved(t) {
  77. const idobj = t.pageFormData.pageFieldInfos.find((i) => i.name === 'id').value
  78. this.id = idobj
  79. const id = this.$route.params.id ? this.$route.params.id : this.$route.query.id
  80. if (id === null || id === undefined || id === '') {
  81. let path = this.$route.fullPath
  82. path = path.replace('?id=&pageId', '?id=' + this.id + '&pageId')
  83. debugger
  84. window.location.href = '#' + path
  85. }
  86. message.success({ content: '保存成功!' }, 1).then(() => {})
  87. },
  88. // 保存
  89. saveForm() {
  90. this.$refs.docform.saveBtnClick()
  91. },
  92. close(flag) {
  93. window.close()
  94. },
  95. initDaF(array) {
  96. if (array) {
  97. array.attrFD.keepHiddenCell = false
  98. }
  99. if (this.flag) {
  100. setTimeout(() => {
  101. this.$refs.docform.setFieldValue('ZGJH_TXGZSD', 'true')
  102. this.$refs.docform.setFieldValue('ZGFK_TXGZSD', 'true')
  103. this.$refs.docform.setFieldValue('ZGCQ_TXGZSD', 'true')
  104. if (this.id === null) {
  105. this.$refs.docform.setFieldValue('ORG_ID', this.orgId.id)
  106. this.$refs.docform.setFieldValue('ORG_NAME', this.orgId.name)
  107. }
  108. }, 1000)
  109. this.flag = false
  110. }
  111. return array
  112. },
  113. },
  114. }
  115. </script>
  116. <style module lang="scss">
  117. @use '@/common/design' as *;
  118. @import '@/webflow/sd-flow-form.scss';
  119. .remind-table {
  120. table-layout: auto !important;
  121. :global(.ant-form-item-label) {
  122. width: 15% !important;
  123. }
  124. }
  125. .title {
  126. font-size: $btn-font-size-sm;
  127. font-weight: bold;
  128. text-align: center;
  129. }
  130. .remindconfig {
  131. :global(.ant-layout) {
  132. background: #fff;
  133. }
  134. :global(.ant-layout-header) {
  135. background: #fff;
  136. }
  137. :global(.close-btn_audit-form-top-banner_product) {
  138. display: none;
  139. }
  140. }
  141. .subTable {
  142. border: none !important;
  143. }
  144. </style>