risk-identification-form.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. <template>
  2. <div>
  3. <sd-webflow
  4. ref="flow"
  5. :removed-tabs="['sdRelatedDoc']"
  6. :validate-form="validForm"
  7. :class="$style.ristTasksForm"
  8. @saveproject="saveproject"
  9. >
  10. <template v-slot:form="{ model, fields }">
  11. <div v-show="loading" :class="$style.loadingDiv">
  12. <a-spin :spinning="true" tip="加载数据中..." />
  13. </div>
  14. <table>
  15. <tr>
  16. <td style="border: none">
  17. <audit-advanced-group
  18. :expand="planExpand"
  19. :expand-str="'planExpand'"
  20. :group-label="'基本信息'"
  21. tablestyle="''"
  22. @changedClick="changedClick"
  23. ></audit-advanced-group>
  24. </td>
  25. </tr>
  26. </table>
  27. <table v-show="planExpand">
  28. <tr v-show="initData(model)">
  29. <!-- 随机ID -->
  30. <sd-form-item-td name="randomId"> </sd-form-item-td>
  31. <sd-form-item-td name="id"> </sd-form-item-td>
  32. <sd-form-item-td name="taskId"> </sd-form-item-td>
  33. </tr>
  34. <tr>
  35. <!-- 标题 -->
  36. <sd-form-item-td name="title"> </sd-form-item-td>
  37. <!-- 风险识别类型 -->
  38. <sd-form-item-td name="identifyType" component="a-checkbox-group"> </sd-form-item-td>
  39. </tr>
  40. <tr>
  41. <!-- 编制人员 -->
  42. <sd-form-item-td name="creatorName" />
  43. <!-- 编制日期 -->
  44. <sd-form-item-td name="creationTime"> </sd-form-item-td>
  45. </tr>
  46. <tr>
  47. <!-- 说明 -->
  48. <sd-form-item-td name="prove" :colspan="3">
  49. <a-textarea v-model="model.prove" :auto-size="{ maxRows: 3, minRows: 3 }" />
  50. </sd-form-item-td>
  51. </tr>
  52. <tr>
  53. <!-- 附件 -->
  54. <sd-form-item-td name="attachment" :colspan="3">
  55. <template v-slot:read-and-edit="{ editable }">
  56. <sd-attachment
  57. v-model="model.attachment"
  58. :group-id="JSON.parse(fields.attachment.value).value"
  59. :read-only="!editable"
  60. ></sd-attachment>
  61. </template>
  62. </sd-form-item-td>
  63. </tr>
  64. </table>
  65. <!-- 新增风险事件 -->
  66. <table v-show="model.identifyType && model.identifyType.includes('insert')">
  67. <tr
  68. ><td :colspan="4">
  69. <sd-form-item name="riskIdentifyInsertMatterEntitys" :label="null">
  70. <template v-slot:read-and-edit="{ editable }">
  71. <audit-advanced-group
  72. :expand="addExpand"
  73. expand-str="addExpand"
  74. group-label="新增风险事件"
  75. @changedClick="changedClick"
  76. >
  77. <template>
  78. <risk-identification-child-table
  79. ref="insertTable"
  80. v-model="model.riskIdentifyInsertMatterEntitys"
  81. :class="$style.deptPlanChild"
  82. :label="null"
  83. :read-only="!editable"
  84. :add-data="true"
  85. :fields="
  86. [
  87. {
  88. caption: '序号',
  89. name: 'sortNum',
  90. dataType: 'number',
  91. },
  92. ].concat(Array.from(fields.riskIdentifyInsertMatterEntitys.attr.dync))
  93. "
  94. :columns="columns"
  95. :type="'add'"
  96. :deleted-identify="deletedIdentify"
  97. @add="addData"
  98. >
  99. <span slot="eventName" slot-scope="{ text, record }">
  100. <a @click="openDoc(record, 'add', editable)">{{ text }}</a>
  101. </span>
  102. </risk-identification-child-table>
  103. </template>
  104. </audit-advanced-group>
  105. </template>
  106. </sd-form-item>
  107. </td>
  108. </tr>
  109. </table>
  110. <!-- 修改风险事件 -->
  111. <table v-show="model.identifyType && model.identifyType.includes('update')">
  112. <tr
  113. ><td :colspan="4">
  114. <sd-form-item name="riskIdentifyUpdateMatterEntitys" :label="null">
  115. <template v-slot:read-and-edit="{ editable }">
  116. <audit-advanced-group
  117. :expand="selectExpand"
  118. expand-str="selectExpand"
  119. group-label="修改"
  120. @changedClick="changedClick"
  121. >
  122. <template>
  123. <risk-identification-child-table
  124. ref="updateTable"
  125. v-model="model.riskIdentifyUpdateMatterEntitys"
  126. :class="$style.deptPlanChild"
  127. :label="null"
  128. :read-only="!editable"
  129. :select-data="true"
  130. :fields="
  131. [
  132. {
  133. caption: '序号',
  134. name: 'sortNum',
  135. dataType: 'number',
  136. },
  137. ].concat(Array.from(fields.riskIdentifyUpdateMatterEntitys.attr.dync))
  138. "
  139. :columns="columns"
  140. :type="'update'"
  141. :deleted-identify="deletedIdentify"
  142. @select="selectData('update')"
  143. >
  144. <span slot="eventName" slot-scope="{ text, record }">
  145. <a @click="openDoc(record, 'update', editable)">{{ text }}</a>
  146. </span>
  147. </risk-identification-child-table>
  148. </template>
  149. </audit-advanced-group>
  150. </template>
  151. </sd-form-item>
  152. </td>
  153. </tr>
  154. </table>
  155. <!-- 废弃风险事件 -->
  156. <table v-show="model.identifyType && model.identifyType.includes('delete')">
  157. <tr
  158. ><td :colspan="4">
  159. <sd-form-item name="riskIdentifyDeleteMatterEntitys" :label="null">
  160. <template v-slot:read-and-edit="{ editable }">
  161. <audit-advanced-group
  162. :expand="trashExpand"
  163. expand-str="trashExpand"
  164. group-label="废弃"
  165. @changedClick="changedClick"
  166. >
  167. <template>
  168. <risk-identification-child-table
  169. ref="removeTable"
  170. v-model="model.riskIdentifyDeleteMatterEntitys"
  171. :class="$style.deptPlanChild"
  172. :label="null"
  173. :read-only="!editable"
  174. :select-data="true"
  175. :fields="
  176. [
  177. {
  178. caption: '序号',
  179. name: 'sortNum',
  180. dataType: 'number',
  181. },
  182. ].concat(Array.from(fields.riskIdentifyDeleteMatterEntitys.attr.dync))
  183. "
  184. :columns="columns"
  185. :type="'remove'"
  186. :deleted-identify="deletedIdentify"
  187. @select="selectData('remove')"
  188. >
  189. <span slot="eventName" slot-scope="{ text, record }">
  190. <a @click="openDoc(record, 'remove', false)">{{ text }}</a>
  191. </span>
  192. </risk-identification-child-table>
  193. </template>
  194. </audit-advanced-group>
  195. </template>
  196. </sd-form-item>
  197. </td>
  198. </tr>
  199. </table>
  200. </template>
  201. </sd-webflow>
  202. <!-- 风险事项选择器-->
  203. <div v-show="false">
  204. <ic-measure-picker
  205. ref="icRiskeventsel"
  206. v-model="eventSelect"
  207. :is-abandonment="isAbandonment"
  208. :version-id="FxversionId"
  209. types="FK"
  210. :org-id="auditOrgId + ''"
  211. :org-name="auditOrgName + '风险库'"
  212. :single="false"
  213. :read-only="false"
  214. @change="fnSelectRiskInfo"
  215. ></ic-measure-picker>
  216. </div>
  217. </div>
  218. </template>
  219. <script>
  220. import FlowService from '@/webflow/flow-service'
  221. import axios from '@/common/services/axios-instance'
  222. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  223. import { Modal, message } from '@/common/one-ui'
  224. import icMeasurePicker from '@product/iam/components/ic-picker/ic-measure-picker.vue'
  225. import auditAdvancedGroup from '@product/iam/components/audit-advanced-group.vue'
  226. import auditAdvancedGroupMixins from '@product/iam/components/audit-advanced-group-mixins'
  227. import riskTasksService from '@product/iam/risk/task/risk-tasks-service'
  228. import riskService from '@product/iam/risk/risklib/risk-service'
  229. import riskIdentificationService from './risk-identification-service'
  230. import riskIdentificationChildTable from './components/risk-identification-child-table.vue'
  231. import components from './_import-components/risk-identification-form-import'
  232. // 修改主子表的首行title名
  233. export default {
  234. name: 'RiskIdentificationForm',
  235. metaInfo: {
  236. title: '风险识别',
  237. },
  238. components: {
  239. ...components,
  240. auditAdvancedGroup,
  241. riskIdentificationChildTable,
  242. icMeasurePicker,
  243. },
  244. mixins: [auditAdvancedGroupMixins],
  245. data() {
  246. return {
  247. isSubmit: false,
  248. isAbandonment: 'NO',
  249. loading: false,
  250. spinning: false,
  251. eventSelect: [],
  252. childTableKey: 0, // 刷新子表组件
  253. inited: true,
  254. planExpand: true,
  255. addExpand: true,
  256. selectExpand: true,
  257. trashExpand: true,
  258. expand: true,
  259. columns: [
  260. {
  261. title: '序号',
  262. dataIndex: 'sortNum',
  263. width: '50px',
  264. customRender: (text, record, index) => `${index + 1}`,
  265. },
  266. {
  267. dataIndex: 'riskCategoryPath',
  268. title: '风险分类',
  269. },
  270. { dataIndex: 'eventCode', title: '风险事项编号', defaultSortOrder: 'ascend' },
  271. {
  272. dataIndex: 'eventName',
  273. title: '风险事项名称',
  274. },
  275. { dataIndex: 'riskSource', title: '风险源' },
  276. { dataIndex: 'competentDeptName', title: '主管部门' },
  277. {
  278. dataIndex: 'isUpdate',
  279. title: '是否新增、修改、废弃',
  280. sdHidden: true,
  281. },
  282. {
  283. dataIndex: 'id',
  284. title: 'ID',
  285. sdHidden: true,
  286. },
  287. {
  288. dataIndex: 'randomId',
  289. title: 'randomId',
  290. sdHidden: true,
  291. },
  292. {
  293. dataIndex: 'identifyId',
  294. title: '风险事项ID',
  295. sdHidden: true,
  296. },
  297. {
  298. dataIndex: 'versionId',
  299. title: '风险版本库ID',
  300. sdHidden: true,
  301. },
  302. {
  303. dataIndex: 'unitCode',
  304. sdHidden: true,
  305. },
  306. {
  307. dataIndex: 'contactsId',
  308. sdHidden: true,
  309. },
  310. {
  311. dataIndex: 'contactsAccount',
  312. sdHidden: true,
  313. },
  314. {
  315. dataIndex: 'contactsName',
  316. sdHidden: true,
  317. },
  318. {
  319. dataIndex: 'eventId',
  320. sdHidden: true,
  321. },
  322. ],
  323. expressions: [],
  324. riskCriteriaDict: [],
  325. isSave: true, // 是否有保存操作
  326. riskDutieUnitList: [],
  327. sourceId: -1,
  328. unitOpt: [],
  329. riskCriteriaObj: null, // 风险准则
  330. riskid: null, // 风险识别ID
  331. taskInfo: {}, // 风险任务信息
  332. auditOrgId: null, // 审计机构ID,选择风险事项需要用
  333. auditOrgName: null, // 审计机构名称,选择风险事项需要用
  334. FxversionId: null, // 风险库版本
  335. selectType: null, // 选择类型 修改或者废弃
  336. identifyType: null, // 识别类型
  337. isIni: false,
  338. identifyId: null, // 识别ID保存之后才有
  339. }
  340. },
  341. computed: {
  342. // 计算随机key
  343. randomId() {
  344. let randomNum = Math.random()
  345. while (randomNum === 0) {
  346. randomNum = Math.random()
  347. }
  348. const time = new Date().getTime()
  349. return time + Math.ceil(randomNum * 1000000000)
  350. },
  351. },
  352. watch: {
  353. identifyType(val) {
  354. this.$refs.insertTable.$refs.childTable.reset()
  355. this.$refs.updateTable.$refs.childTable.reset()
  356. this.$refs.removeTable.$refs.childTable.reset()
  357. if (!val.includes('insert')) {
  358. this.$refs.flow.setFieldValue('riskIdentifyInsertMatterEntitys', [])
  359. }
  360. if (!val.includes('update')) {
  361. this.$refs.flow.setFieldValue('riskIdentifyUpdateMatterEntitys', [])
  362. }
  363. if (!val.includes('delete')) {
  364. this.$refs.flow.setFieldValue('riskIdentifyDeleteMatterEntitys', [])
  365. }
  366. },
  367. },
  368. created() {
  369. // 监听关闭事件,关闭时如果没有保存操作且没有id,则直接删除所有子表
  370. window.addEventListener('beforeunload', (e) => {
  371. this.beforeunloadHandler(e)
  372. })
  373. },
  374. methods: {
  375. beforeunloadHandler(e) {
  376. if (this.isSubmit) return
  377. const updateData = this.$refs.flow
  378. .getFieldValue('riskIdentifyUpdateMatterEntitys')
  379. .filter((item) => {
  380. return item.isAddItem === true
  381. })
  382. .map((item) => {
  383. return item.id
  384. })
  385. const deleteData = this.$refs.flow
  386. .getFieldValue('riskIdentifyDeleteMatterEntitys')
  387. .filter((item) => {
  388. return item.isAddItem === true
  389. })
  390. .map((item) => {
  391. return item.id
  392. })
  393. this.deletedIdentify(updateData, 'update')
  394. this.deletedIdentify(deleteData, 'remove')
  395. },
  396. deletedIdentify(ids, type) {
  397. if (ids.length === 0) return
  398. const strid = ids.join(',')
  399. axios({
  400. url:
  401. 'api/xcoa-mobile/v1/riskidentify/deletedIdentify?ids=' + strid + '&deletedType=' + type,
  402. method: 'post',
  403. })
  404. },
  405. // 保存之后防止子表被覆盖,重新获取一下
  406. saveproject() {
  407. this.refreshAddDataTable()
  408. this.refreshUpdateDataTable()
  409. this.refreshRemoveDataTable()
  410. },
  411. // 刷新新增子表
  412. refreshAddDataTable() {
  413. riskIdentificationService
  414. .getRiskAddChildInfo({ identifyId: parseFloat(this.riskid) })
  415. .then((res) => {
  416. const newdata = res.data.sort((a, b) => {
  417. return a.eventCode.localeCompare(b.eventCode)
  418. })
  419. this.$refs.flow.setFieldValue('riskIdentifyInsertMatterEntitys', newdata)
  420. })
  421. },
  422. // 刷新修改子表
  423. refreshUpdateDataTable() {
  424. const data = this.$refs.flow.getFieldValue('riskIdentifyUpdateMatterEntitys') || []
  425. riskIdentificationService
  426. .getRiskUpdateChildInfo({ identifyId: parseFloat(this.riskid) })
  427. .then((res) => {
  428. if (data.length === 0) {
  429. const newdata = res.data.sort((a, b) => {
  430. return a.eventCode.localeCompare(b.eventCode)
  431. })
  432. this.$refs.flow.setFieldValue('riskIdentifyUpdateMatterEntitys', newdata)
  433. return
  434. }
  435. const newdata = data.map((dataItem) => {
  436. // 没有ID说名是新增的,增加标识
  437. const item = res.data.find((item) => {
  438. return dataItem.eventId === item.eventId
  439. })
  440. // 有ID直接返回,说明不是新增数据
  441. if (dataItem.id) {
  442. return item
  443. }
  444. item.isAddItem = true
  445. return item
  446. })
  447. newdata.sort((a, b) => {
  448. return a.eventCode.localeCompare(b.eventCode)
  449. })
  450. this.$refs.flow.setFieldValue('riskIdentifyUpdateMatterEntitys', newdata)
  451. })
  452. },
  453. // 刷新废弃表
  454. refreshRemoveDataTable() {
  455. const data = this.$refs.flow.getFieldValue('riskIdentifyDeleteMatterEntitys') || []
  456. riskIdentificationService
  457. .getRiskRemoveChildInfo({ identifyId: parseFloat(this.riskid) })
  458. .then((res) => {
  459. if (data.length === 0) {
  460. const newdata = res.data.sort((a, b) => {
  461. return a.eventCode.localeCompare(b.eventCode)
  462. })
  463. this.$refs.flow.setFieldValue('riskIdentifyDeleteMatterEntitys', newdata)
  464. return
  465. }
  466. const newdata = data.map((dataItem) => {
  467. if (dataItem.id) return dataItem
  468. // 没有ID说名是新增的,增加标识
  469. const item = res.data.find((item) => {
  470. return dataItem.eventId === item.eventId
  471. })
  472. item.isAddItem = true
  473. return item
  474. })
  475. newdata.sort((a, b) => {
  476. return a.eventCode.localeCompare(b.eventCode)
  477. })
  478. this.$refs.flow.setFieldValue('riskIdentifyDeleteMatterEntitys', newdata)
  479. })
  480. },
  481. // 打开子表数据
  482. openDoc(record, type, editable) {
  483. // 新增,直接根据ID打开
  484. let openurl
  485. // 如果是不可编辑,则直接传view
  486. let mode = ''
  487. if (!editable) {
  488. mode = '&mode=view'
  489. }
  490. if (type === 'add') {
  491. openurl = `/risk-identification-event-add-form?record=${record.id}&infoId=${this.riskid}&orgId=${this.auditOrgId}&versionId=${this.FxversionId}&orgName=${this.auditOrgName}${mode}`
  492. } else if (type === 'update') {
  493. // 如果有ID了,则直接赋值ID
  494. let identifyId = ''
  495. if (this.identifyId) {
  496. identifyId = '&identifyId=' + this.identifyId
  497. }
  498. openurl = `/risk-identification-event-update-form?${
  499. record.id ? '&record=' + record.id : ''
  500. }&taskId=${this.$refs.flow?.getFieldValue('taskId')}&infoId=${this.riskid}${
  501. record.eventId ? '&eventId=' + record.eventId : ''
  502. }&orgId=${this.auditOrgId}&versionId=${this.FxversionId}&orgName=${
  503. this.auditOrgName
  504. }${identifyId}${mode}`
  505. } else {
  506. let identifyId = ''
  507. if (this.identifyId) {
  508. identifyId = '&identifyId=' + this.identifyId
  509. }
  510. openurl = `/risk-identification-event-update-form?taskId=${this.$refs.flow?.getFieldValue(
  511. 'taskId'
  512. )}&infoId=${this.riskid}${record.eventId ? '&eventId=' + record.eventId : ''}&orgId=${
  513. this.auditOrgId
  514. }&versionId=${this.FxversionId}&orgName=${this.auditOrgName}${identifyId}${mode}&isDelete=Y`
  515. }
  516. crossWindowWatcher.waitForChanged(openurl).then((info) => {
  517. if (type === 'add') {
  518. // 这里是新增的刷新的方法
  519. this.refreshAddDataTable()
  520. } else {
  521. // 这里是新增的刷新的方法
  522. this.refreshUpdateDataTable()
  523. }
  524. })
  525. },
  526. // 选择风险事项之后
  527. fnSelectRiskInfo(data) {
  528. const ids = []
  529. let iamAuditEvents = []
  530. let childTableName
  531. if (this.selectType === 'update') {
  532. childTableName = 'riskIdentifyUpdateMatterEntitys'
  533. } else {
  534. childTableName = 'riskIdentifyDeleteMatterEntitys'
  535. }
  536. if (this.$refs.flow.getFieldValue(childTableName)) {
  537. iamAuditEvents = this.$refs.flow.getFieldValue(childTableName)
  538. }
  539. let hasRepeat = false
  540. data.forEach((i) => {
  541. let id = i.id.toString()
  542. if (id.indexOf('1000') > -1) {
  543. id = id.substring(4, id.length)
  544. }
  545. if (iamAuditEvents.findIndex((item) => item.eventId.toString() === id.toString()) === -1) {
  546. ids.push(parseInt(id))
  547. } else {
  548. hasRepeat = true
  549. }
  550. })
  551. if (hasRepeat) {
  552. message.info('请勿选择重复数据')
  553. }
  554. // 获取选择的事项内容
  555. riskService
  556. .getFxlist(ids)
  557. .then((data) => {
  558. if (data) {
  559. data.forEach((element) => {
  560. const mmc = element
  561. mmc.eventId = element.id
  562. mmc.randomId = this.riskid
  563. mmc.riskCategoryPath = this.auditOrgName + '风险库/' + mmc.riskCategoryPath
  564. mmc.competentDeptOpt = JSON.stringify(element.competentDeptOpt)
  565. mmc.isAddItem = true
  566. iamAuditEvents.push(mmc)
  567. })
  568. this.visible = false
  569. this.$refs.flow.setFieldValue(childTableName, iamAuditEvents)
  570. }
  571. data.forEach((item) => {
  572. item.competentDeptOpt = []
  573. })
  574. // 保存子表
  575. if (this.selectType === 'update') {
  576. riskIdentificationService
  577. .saveUpdateMatter(data, this.$refs.flow.getFieldValue('id'))
  578. .then(() => {
  579. data.forEach((item) => {
  580. item.id = null
  581. })
  582. this.refreshUpdateDataTable()
  583. })
  584. } else {
  585. riskIdentificationService
  586. .saveRemoveMatter(data, this.$refs.flow.getFieldValue('id'))
  587. .then(() => {
  588. data.forEach((item) => {
  589. item.id = null
  590. })
  591. this.refreshRemoveDataTable()
  592. })
  593. }
  594. })
  595. .catch(() => {
  596. message.error('请选择风险事项')
  597. })
  598. this.eventSelect = []
  599. },
  600. // 获取风险任务信息
  601. getRiskTaskInfo(taskId) {
  602. this.loading = true
  603. riskTasksService.getRiskTaskInfo(taskId).then((res) => {
  604. this.taskInfo = res.data.pageFormData.pageFieldInfos
  605. if (!this.$refs.flow.getFieldValue('title')) {
  606. // 标题赋值
  607. this.$refs.flow?.setFieldValue(
  608. 'title',
  609. this.taskInfo.find((item) => item.name === 'dutieName').value + '的风险识别'
  610. )
  611. }
  612. this.auditOrgName = this.taskInfo.find((item) => item.name === 'inspectUnitName').value
  613. // 获取发起机构对应的审计机构ID
  614. riskIdentificationService
  615. .findIamOrgId(this.taskInfo.find((item) => item.name === 'inspectUnitId').value)
  616. .then((res) => {
  617. this.auditOrgId = res.data
  618. // 获取风控库版本
  619. return riskService.getversion(parseFloat(this.auditOrgId))
  620. })
  621. .then((res) => {
  622. this.loading = false
  623. if (res.data.id) {
  624. this.FxversionId = res.data.id.toString()
  625. } else {
  626. message.info('当前所属机构未设置风险库版本,请联系管理员')
  627. }
  628. })
  629. .catch(() => {
  630. message.info('未获取到当前组织所属风险机构,请联系管理员', 1).then(() => {
  631. window.opener = window
  632. var win = window.open('', '_self')
  633. win.close()
  634. })
  635. })
  636. })
  637. },
  638. initData(model) {
  639. if (!this.$refs.flow) return // 没有加载出来表单组件,先退出
  640. // 保存之后,需要把riskid重新赋值,否则还是随机ID
  641. if (this.$refs.flow.FlowData.processFormData.beanId) {
  642. this.riskid = this.$refs.flow.FlowData.processFormData.beanId
  643. this.identifyId = this.$refs.flow.FlowData.processFormData.beanId
  644. }
  645. if (model.id !== undefined) {
  646. this.riskid = model.id
  647. } else {
  648. // 如果是新建,则直接传随机id
  649. this.riskid = this.randomId
  650. }
  651. // 赋值任务ID,后面都要用
  652. if (this.$route.query.extParams) {
  653. const params = JSON.parse(this.$route.query.extParams)
  654. if (params.taskId) {
  655. this.$refs.flow?.setFieldValue('taskId', params.taskId ? parseFloat(params.taskId) : null)
  656. }
  657. }
  658. // 加载时获取风险任务信息只有起草环节才赋值
  659. if (!this.isIni) {
  660. // 打开的时候获取一下子表数据
  661. this.saveproject()
  662. this.getRiskTaskInfo(this.$refs.flow?.getFieldValue('taskId'))
  663. this.$refs.flow?.setFieldValue('randomId', this.riskid)
  664. this.isIni = true
  665. }
  666. this.identifyType = model.identifyType
  667. return false
  668. },
  669. // 新增风险事项
  670. addData(type) {
  671. // 如果有ID了,则直接赋值ID
  672. let identifyId = ''
  673. if (this.identifyId) {
  674. identifyId = '&identifyId=' + this.identifyId
  675. }
  676. const openurl = `/risk-identification-event-add-form?taskId=${this.$refs.flow?.getFieldValue(
  677. 'taskId'
  678. )}&orgId=${this.auditOrgId}&versionId=${this.FxversionId}&orgName=${
  679. this.auditOrgName
  680. }&type=add&infoId=${this.riskid}${identifyId}`
  681. crossWindowWatcher.waitForChanged(openurl).then((refreshFlag) => {
  682. if (refreshFlag) {
  683. // 这里写或者调刷新的方法
  684. this.refreshAddDataTable()
  685. }
  686. })
  687. },
  688. selectData(type) {
  689. this.selectType = type
  690. if (type === 'update') {
  691. this.isAbandonment = 'NO'
  692. } else {
  693. this.isAbandonment = 'YES'
  694. }
  695. this.$refs.icRiskeventsel.openPicker()
  696. },
  697. validForm() {
  698. this.isSubmit = true
  699. return Promise.resolve(true)
  700. },
  701. },
  702. }
  703. </script>
  704. <style module lang="scss">
  705. @use '@/common/design' as *;
  706. .btnselect {
  707. position: relative;
  708. top: 4px;
  709. float: right;
  710. .batchselect {
  711. z-index: 100;
  712. margin-right: 80px;
  713. }
  714. }
  715. .rist_tasks_form {
  716. :global(.ant-calendar-picker) {
  717. width: 100%;
  718. }
  719. .type_td {
  720. border-right: none !important;
  721. }
  722. }
  723. .loading-div {
  724. position: absolute;
  725. width: 100%;
  726. height: 100%;
  727. display: flex;
  728. justify-content: center;
  729. flex-direction: column;
  730. z-index: 10;
  731. background: rgb(255 255 255 / 70%);
  732. }
  733. </style>