cpm-confirm-form.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <sd-webflow ref="webflow" :class="$style.webflow" :validate-form="validForm">
  3. <template v-slot:form="{ model, FlowData }">
  4. <sd-form-by-builder
  5. ref="builderform"
  6. :form-data="initDaF(FlowData.processFormData)"
  7. :keep-hidden-cell="false"
  8. />
  9. </template>
  10. </sd-webflow>
  11. </template>
  12. <script>
  13. import CpmService from '../../cpm-service'
  14. import components from './_import-components/cpm-confirm-form-import'
  15. export default {
  16. name: 'CpmConfirmForm',
  17. metaInfo: {
  18. title: 'CpmConfirmForm',
  19. },
  20. components,
  21. data() {
  22. return {
  23. projectId: '',
  24. flag: true,
  25. }
  26. },
  27. mounted() {
  28. if (this.$route.query.extParams) {
  29. const ep = JSON.parse(this.$route.query.extParams)
  30. if (ep.SUB_PROJECT_ID !== '1') {
  31. this.initData(ep.SUB_PROJECT_ID, true, false)
  32. } else {
  33. this.initData(ep.PROJECT_ID, true, true)
  34. }
  35. } else {
  36. setTimeout(() => {
  37. const projectId = this.$refs.webflow.getFieldValue('PROJECT_ID')
  38. const subprojectId = this.$refs.webflow.getFieldValue('SUB_PROJECT_ID')
  39. if (subprojectId !== null && subprojectId !== '1') {
  40. this.initData(subprojectId, false, false)
  41. } else {
  42. this.initData(projectId, false, true)
  43. }
  44. }, 2000)
  45. }
  46. this.showSelect()
  47. },
  48. methods: {
  49. validForm() {
  50. this.$refs.webflow.setFieldValue('datagroup1', 'true')
  51. this.$refs.webflow.setFieldValue('datagroup2', 'true')
  52. return new Promise((resolve, reject) => {
  53. resolve(true)
  54. })
  55. },
  56. initDaF(array) {
  57. if (array) {
  58. array.attrFD.keepHiddenCell = false
  59. }
  60. return array
  61. },
  62. showSelect() {
  63. const stepProps = this.$refs.webflow.FlowData.attrs.stepProps
  64. if (stepProps) {
  65. const showSel = this.$refs.webflow.FlowData.attrs.stepProps.showSel
  66. // 被检查单位环节隐藏选择、删除按钮
  67. if (showSel === 'false') {
  68. document.getElementsByClassName('anticon-plus-circle')[0].parentNode.style.display =
  69. 'none'
  70. document.getElementsByClassName('anticon-minus-circle')[0].parentNode.style.display =
  71. 'none'
  72. }
  73. } else {
  74. // 仅在被检查单位环节显示确认、取消按钮
  75. document.getElementsByClassName('ant-btn-link')[0].parentNode.style.display = 'none'
  76. document.getElementsByClassName('ant-btn-link')[1].parentNode.style.display = 'none'
  77. }
  78. },
  79. // 初始化项目信息
  80. initData(projectId, flag, flagz) {
  81. const org = []
  82. if (projectId) {
  83. // 获取项目信息
  84. CpmService.getProjectData(projectId, flagz).then((res) => {
  85. const title = res.data[0].title
  86. const startDeptName = res.data[0].startDeptName
  87. if (flag) this.$refs.webflow.setFieldValue('title', title + '问题确认单')
  88. if (flag) this.$refs.webflow.setFieldValue('START_DEPT_NAME', startDeptName)
  89. if (flag) {
  90. this.$refs.webflow.FlowData.processFormData.processFormPropertyValues.find((item) => {
  91. return item.name === 'START_DEPT_NAME'
  92. }).readonly = true
  93. }
  94. const checkdeptnames = res.data[0].checkedDeptNames
  95. let checkdeptcodes = []
  96. if (res.data[0].checkedDeptCodes) {
  97. checkdeptcodes = res.data[0].checkedDeptCodes
  98. } else {
  99. checkdeptcodes = res.data[0].checkedDeptIds
  100. }
  101. const code = res.data[0].currentNumber
  102. const names = checkdeptnames.split(',')
  103. const codes = checkdeptcodes.split(',')
  104. const orgfw = []
  105. names.forEach((n, index) => {
  106. orgfw.push({
  107. type: 'Group',
  108. name: n,
  109. code: codes[index],
  110. })
  111. })
  112. this.$refs.webflow.setFieldValue('CHECKED_DEPT_FW', orgfw)
  113. if (flag) {
  114. if (names.length > 1) {
  115. this.$refs.webflow.setFieldValue('CHECKED_DEPT', org)
  116. } else {
  117. names.forEach((n, index) => {
  118. org.push({
  119. type: 'Group',
  120. name: n,
  121. code: codes[index],
  122. })
  123. })
  124. this.$refs.webflow.setFieldValue('CHECKED_DEPT', org)
  125. }
  126. }
  127. })
  128. }
  129. },
  130. },
  131. }
  132. </script>
  133. <style module lang="scss">
  134. @use '@/common/design' as *;
  135. .webflow {
  136. :global(.ant-space-horizontal) {
  137. :global(.ant-space-item):nth-child(4) {
  138. display: none;
  139. }
  140. }
  141. }
  142. </style>