xm-composite-database-form.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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">
  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. <td class="ant-form-item-label cell_sd-form-item-td-label_common">
  63. <label title="资料类别" class="ant-form-item-required">资料类别</label>
  64. </td>
  65. <td class="ant-form-item-control-wrapper">
  66. <span v-if="isShow" read-only>{{
  67. model.fromId > 0
  68. ? '综合资料下发'
  69. : model.fromId === -1
  70. ? '审计机构负责人备案'
  71. : model.fromId === -2
  72. ? '审计机构考核结果备案'
  73. : '其它'
  74. }}</span>
  75. <a-select v-else v-show="!model.fromId || model.fromId < 0" v-model="model.fromId">
  76. <a-select-option :value="-1"> 审计机构负责人备案 </a-select-option>
  77. <a-select-option :value="-2"> 审计机构考核结果备案 </a-select-option>
  78. <a-select-option :value="-3"> 其它 </a-select-option>
  79. </a-select>
  80. </td>
  81. </tr>
  82. <tr>
  83. <!-- 附件 -->
  84. <td class="ant-form-item-label cell_sd-form-item-td-label_common">
  85. <label title="附件" class="ant-form-item-required">附&emsp;&emsp;件</label>
  86. </td>
  87. <td colspan="3" class="ant-form-item-control-wrapper">
  88. <sd-form-item name="attachment" :colspan="3" :label="null">
  89. <template v-slot:read-and-edit="{ editable }">
  90. <XmAttachmentCus
  91. v-model="model.attachment"
  92. :group-id="JSON.parse(fields.attachment.value).value"
  93. :read-only="!editable"
  94. />
  95. </template>
  96. </sd-form-item>
  97. <span style="color: red">小于3G的附件随意传,超过3G的附件,请拆分为多个文件进行上传</span>
  98. </td>
  99. </tr>
  100. <tr>
  101. <!-- 资料描述 -->
  102. <sd-form-item-td name="infoDesc" :colspan="3">
  103. <a-textarea v-model="model.infoDesc" :rowspan="4" />
  104. </sd-form-item-td>
  105. </tr>
  106. <tr>
  107. <sd-form-item-td name="remark" :colspan="3">
  108. <a-textarea v-model="model.remark" :rowspan="3" />
  109. </sd-form-item-td>
  110. </tr>
  111. <tr>
  112. <!-- 编制人员 -->
  113. <sd-form-item-td name="creatorName" />
  114. <!-- 编制日期 -->
  115. <sd-form-item-td name="creationTime" />
  116. </tr>
  117. </table>
  118. </template>
  119. </sd-webflow>
  120. </template>
  121. <script>
  122. import { Message, Modal } from 'ant-design-vue'
  123. import components from './_import-components/xm-composite-database-form-import'
  124. import moment from 'moment'
  125. import axios from '@/common/services/axios-instance'
  126. import XmAttachmentCus from '@product/iam/core/attachment/xm-attachment-cus'
  127. export default {
  128. name: 'XmCompositeDatabaseForm',
  129. metaInfo: {
  130. title: '综合资料',
  131. },
  132. components: {
  133. ...components,
  134. XmAttachmentCus,
  135. },
  136. data() {
  137. return {
  138. endOpen: false,
  139. year: null,
  140. isShow: false,
  141. }
  142. },
  143. created() {
  144. // if (this.$refs.flow.getFieldValue('reportYear')) {
  145. // this.year = this.$refs.flow.getFieldValue('reportYear')
  146. // }
  147. },
  148. mounted() {
  149. debugger
  150. const autoCreate = this.$refs.flow.getFieldValue('autoCreate')
  151. if (autoCreate === '1') {
  152. this.isShow = true
  153. }
  154. },
  155. methods: {
  156. yearChange(value) {
  157. this.year = value
  158. this.$refs.flow.setFieldValue('reportYear', value.format('YYYY'))
  159. this.$refs.flow.validateField('reportYear').then((res) => {
  160. console.log(res)
  161. })
  162. if (document.getElementsByClassName('ant-calendar-picker-container').length > 0) {
  163. document.getElementsByClassName('ant-calendar-picker-container')[0].style.display = 'none'
  164. }
  165. },
  166. handleEndOpenChange(open) {
  167. this.endOpen = open
  168. },
  169. actionBtnClick(evt, { button, FlowData }) {
  170. if (
  171. button.buttonId === 'G_1_SPIC_COMPOSITE_DATABASE.1' ||
  172. button.buttonId === 'G_1_SPIC_COMPOSITE_DATABASE.3'
  173. ) {
  174. let instId = this.$refs.flow.flowData.instId
  175. if (instId === null) {
  176. instId = 0
  177. }
  178. let beanId = this.$refs.flow.flowData.processFormData.beanId
  179. if (beanId === null) {
  180. beanId = 0
  181. }
  182. const formId = this.$refs.flow.flowData.processFormData.formId
  183. const attachment = this.$refs.flow.FlowData.processFormData.processFormPropertyValues.find(
  184. (item) => item.name === 'attachment'
  185. )?.value
  186. const attachmentId = JSON.parse(attachment).value
  187. console.log('attachment========' + attachmentId)
  188. evt.waitUntil(
  189. new Promise((resolve, reject) => {
  190. evt.defaultPrevented = true
  191. // 校验附件是否上传
  192. axios({
  193. url: `api/xcoa-mobile/v1/attachment-extend/attachments-info-perm/${attachmentId}?formId=${formId}&beanId=${beanId}&instId=${instId}`,
  194. method: 'get',
  195. }).then((res) => {
  196. if (res.data.length === 0) {
  197. axios({
  198. url: `api/framework/v1/large-file/attachments-info-perm/${attachmentId}`,
  199. method: 'get',
  200. }).then((res) => {
  201. if (res.data.largeAttachments.length === 0) {
  202. Modal.warning({
  203. title: '提示',
  204. content: '请上传附件',
  205. })
  206. resolve(false)
  207. } else {
  208. evt.defaultPrevented = false
  209. resolve(true)
  210. }
  211. })
  212. } else {
  213. evt.defaultPrevented = false
  214. resolve(true)
  215. }
  216. })
  217. })
  218. )
  219. }
  220. },
  221. },
  222. }
  223. </script>
  224. <style module lang="scss">
  225. @use '@/common/design' as *;
  226. $carousel-title: 64px;
  227. .syslt > td {
  228. border-top: none !important;
  229. }
  230. .prebtn {
  231. top: 42px;
  232. }
  233. .preivewbox {
  234. width: 100%;
  235. height: 300px;
  236. overflow: hidden;
  237. text-align: center;
  238. :global(.previewimg) {
  239. height: 100%;
  240. }
  241. .slider-title {
  242. // position: relative;
  243. bottom: $carousel-title;
  244. display: inline-block;
  245. width: 100%;
  246. height: $carousel-title;
  247. padding: 0 100px 0 15px;
  248. overflow: hidden;
  249. font-size: $font-size-lg;
  250. line-height: $carousel-title;
  251. color: $white;
  252. text-align: left;
  253. text-overflow: ellipsis;
  254. white-space: nowrap;
  255. background: rgba(0, 0, 0, 0.7);
  256. }
  257. }
  258. :global(.prebtnatt) {
  259. top: 42px;
  260. }
  261. :global(.preivewboxatt) {
  262. width: 100%;
  263. height: 300px;
  264. overflow: hidden;
  265. text-align: center;
  266. :global(.previewimg) {
  267. height: 100%;
  268. }
  269. :global(.slider-titleatt) {
  270. // position: relative;
  271. bottom: $carousel-title;
  272. display: inline-block;
  273. width: 100%;
  274. height: $carousel-title;
  275. padding: 0 100px 0 15px;
  276. overflow: hidden;
  277. font-size: $font-size-lg;
  278. line-height: $carousel-title;
  279. color: $white;
  280. text-align: left;
  281. text-overflow: ellipsis;
  282. white-space: nowrap;
  283. background: rgba(0, 0, 0, 0.7);
  284. }
  285. }
  286. </style>