xm-composite-database-form.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <sd-webflow ref="flow" :removed-tabs="['sdRelatedDoc']" @actionBtnClick="actionBtnClick">
  3. <template v-slot:form="{ model, fields }">
  4. <table>
  5. <colgroup>
  6. <col style="width:15%;" />
  7. <col />
  8. <col style="width:15%;" />
  9. <col />
  10. </colgroup>
  11. <tr>
  12. <!-- <sd-form-item-td name="title" /> -->
  13. <sd-form-item-td name="title">
  14. <template>
  15. <a-input v-if="!isShow" v-model="model.title"></a-input>
  16. <span v-else read-only>{{ model.title }}</span>
  17. </template>
  18. </sd-form-item-td>
  19. <sd-form-item-td name="reportYear">
  20. <template>
  21. <a-date-picker
  22. v-if="!isShow"
  23. v-model="model.reportYear"
  24. mode="year"
  25. picker="YYYY"
  26. format="YYYY"
  27. :allow-clear="false"
  28. placeholder="选择年度"
  29. :input-read-only="true"
  30. :open="endOpen"
  31. :value="year"
  32. @panelChange="yearChange"
  33. @openChange="handleEndOpenChange"
  34. ></a-date-picker>
  35. <span v-else read-only>{{ model.reportYear }}</span>
  36. </template>
  37. </sd-form-item-td>
  38. </tr>
  39. <tr>
  40. <!-- 上报单位 -->
  41. <sd-form-item-td name="reportUnitCode" />
  42. <!-- 在线反馈截至时间 -->
  43. <!-- <sd-form-item-td name="endTime" /> -->
  44. <sd-form-item-td name="endTime">
  45. <template>
  46. <a-date-picker v-if="!isShow" v-model="model.endTime"></a-date-picker>
  47. <span v-else read-only>{{ model.endTime | sdDateFormat('YYYY-MM-DD') }}</span>
  48. </template>
  49. </sd-form-item-td>
  50. </tr>
  51. <tr>
  52. <!-- 参考附件 -->
  53. <sd-form-item-td name="referenceTemplate" :colspan="3">
  54. <template v-slot:read-and-edit="{ editable }">
  55. <sd-attachment
  56. v-model="model.referenceTemplate"
  57. :group-id="JSON.parse(fields.referenceTemplate.value).value"
  58. :read-only="true"
  59. />
  60. </template>
  61. </sd-form-item-td>
  62. </tr>
  63. <tr>
  64. <!-- 附件 -->
  65. <td class="ant-form-item-label cell_sd-form-item-td-label_common">
  66. <label title="附件" class="ant-form-item-required">附&emsp;&emsp;件</label>
  67. </td>
  68. <td colspan="3" class="ant-form-item-control-wrapper">
  69. <sd-form-item name="attachment" :colspan="3" :label="null">
  70. <template v-slot:read-and-edit="{ editable }">
  71. <XmAttachmentCus
  72. v-model="model.attachment"
  73. :group-id="JSON.parse(fields.attachment.value).value"
  74. :read-only="!editable"
  75. />
  76. </template>
  77. </sd-form-item>
  78. <span style="color: red;"
  79. >小于3G的附件随意传,超过3G的附件,请拆分为多个文件进行上传</span
  80. >
  81. </td>
  82. </tr>
  83. <tr>
  84. <!-- 资料描述 -->
  85. <sd-form-item-td name="infoDesc" :colspan="3">
  86. <a-textarea v-model="model.infoDesc" :rowspan="4" />
  87. </sd-form-item-td>
  88. </tr>
  89. <tr>
  90. <sd-form-item-td name="remark" :colspan="3">
  91. <a-textarea v-model="model.remark" :rowspan="3" />
  92. </sd-form-item-td>
  93. </tr>
  94. <tr>
  95. <!-- 编制人员 -->
  96. <sd-form-item-td name="creatorName" />
  97. <!-- 编制日期 -->
  98. <sd-form-item-td name="creationTime" />
  99. </tr>
  100. </table>
  101. </template>
  102. </sd-webflow>
  103. </template>
  104. <script>
  105. import { Message, Modal } from 'ant-design-vue'
  106. import components from './_import-components/xm-composite-database-form-import'
  107. import moment from 'moment'
  108. import axios from '@/common/services/axios-instance'
  109. import XmAttachmentCus from '@product/iam/core/attachment/xm-attachment-cus'
  110. export default {
  111. name: 'XmCompositeDatabaseForm',
  112. metaInfo: {
  113. title: '综合资料',
  114. },
  115. components: {
  116. ...components,
  117. XmAttachmentCus,
  118. },
  119. data() {
  120. return {
  121. endOpen: false,
  122. year: null,
  123. isShow: false,
  124. }
  125. },
  126. created() {
  127. // if (this.$refs.flow.getFieldValue('reportYear')) {
  128. // this.year = this.$refs.flow.getFieldValue('reportYear')
  129. // }
  130. },
  131. mounted() {
  132. debugger
  133. const autoCreate = this.$refs.flow.getFieldValue('autoCreate')
  134. if (autoCreate === '1') {
  135. this.isShow = true
  136. }
  137. },
  138. methods: {
  139. yearChange(value) {
  140. this.year = value
  141. this.$refs.flow.setFieldValue('reportYear', value.format('YYYY'))
  142. this.$refs.flow.validateField('reportYear').then((res) => {
  143. console.log(res)
  144. })
  145. if (document.getElementsByClassName('ant-calendar-picker-container').length > 0) {
  146. document.getElementsByClassName('ant-calendar-picker-container')[0].style.display = 'none'
  147. }
  148. },
  149. handleEndOpenChange(open) {
  150. this.endOpen = open
  151. },
  152. actionBtnClick(evt, { button, FlowData }) {
  153. if (
  154. button.buttonId === 'G_1_SPIC_COMPOSITE_DATABASE.1' ||
  155. button.buttonId === 'G_1_SPIC_COMPOSITE_DATABASE.3'
  156. ) {
  157. let instId = this.$refs.flow.flowData.instId
  158. if (instId === null) {
  159. instId = 0
  160. }
  161. let beanId = this.$refs.flow.flowData.processFormData.beanId
  162. if (beanId === null) {
  163. beanId = 0
  164. }
  165. const formId = this.$refs.flow.flowData.processFormData.formId
  166. const attachment = this.$refs.flow.FlowData.processFormData.processFormPropertyValues.find(
  167. (item) => item.name === 'attachment'
  168. )?.value
  169. const attachmentId = JSON.parse(attachment).value
  170. console.log('attachment========' + attachmentId)
  171. evt.waitUntil(
  172. new Promise((resolve, reject) => {
  173. evt.defaultPrevented = true
  174. // 校验附件是否上传
  175. axios({
  176. url: `api/xcoa-mobile/v1/attachment-extend/attachments-info-perm/${attachmentId}?formId=${formId}&beanId=${beanId}&instId=${instId}`,
  177. method: 'get',
  178. }).then((res) => {
  179. if (res.data.length === 0) {
  180. axios({
  181. url: `api/framework/v1/large-file/attachments-info-perm/${attachmentId}`,
  182. method: 'get',
  183. }).then((res) => {
  184. if (res.data.largeAttachments.length === 0) {
  185. Modal.warning({
  186. title: '提示',
  187. content: '请上传附件',
  188. })
  189. resolve(false)
  190. } else {
  191. evt.defaultPrevented = false
  192. resolve(true)
  193. }
  194. })
  195. } else {
  196. evt.defaultPrevented = false
  197. resolve(true)
  198. }
  199. })
  200. })
  201. )
  202. }
  203. },
  204. },
  205. }
  206. </script>
  207. <style module lang="scss">
  208. @use '@/common/design' as *;
  209. $carousel-title: 64px;
  210. .syslt > td {
  211. border-top: none !important;
  212. }
  213. .prebtn {
  214. top: 42px;
  215. }
  216. .preivewbox {
  217. width: 100%;
  218. height: 300px;
  219. overflow: hidden;
  220. text-align: center;
  221. :global(.previewimg) {
  222. height: 100%;
  223. }
  224. .slider-title {
  225. // position: relative;
  226. bottom: $carousel-title;
  227. display: inline-block;
  228. width: 100%;
  229. height: $carousel-title;
  230. padding: 0 100px 0 15px;
  231. overflow: hidden;
  232. font-size: $font-size-lg;
  233. line-height: $carousel-title;
  234. color: $white;
  235. text-align: left;
  236. text-overflow: ellipsis;
  237. white-space: nowrap;
  238. background: rgba(0, 0, 0, 0.7);
  239. }
  240. }
  241. :global(.prebtnatt) {
  242. top: 42px;
  243. }
  244. :global(.preivewboxatt) {
  245. width: 100%;
  246. height: 300px;
  247. overflow: hidden;
  248. text-align: center;
  249. :global(.previewimg) {
  250. height: 100%;
  251. }
  252. :global(.slider-titleatt) {
  253. // position: relative;
  254. bottom: $carousel-title;
  255. display: inline-block;
  256. width: 100%;
  257. height: $carousel-title;
  258. padding: 0 100px 0 15px;
  259. overflow: hidden;
  260. font-size: $font-size-lg;
  261. line-height: $carousel-title;
  262. color: $white;
  263. text-align: left;
  264. text-overflow: ellipsis;
  265. white-space: nowrap;
  266. background: rgba(0, 0, 0, 0.7);
  267. }
  268. }
  269. </style>