audit-summarry-from.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <template>
  2. <span>
  3. <sd-webflow
  4. ref="docform"
  5. :key="key"
  6. :validate-form="validForm"
  7. :removed-tabs="['sdRelatedDoc']"
  8. @actionBtnClick="actionBtnClick"
  9. >
  10. <template v-slot:form="{ model, fields, FlowData }">
  11. <table v-if="initData(model)">
  12. <colgroup>
  13. <col style="width: 15%;" />
  14. <col style="width: 35%;" />
  15. <col style="width: 15%;" />
  16. <col style="width: 35%;" />
  17. </colgroup>
  18. <tr v-show="false">
  19. <!-- 标题 -->
  20. <sd-form-item-td name="title" :colspan="3" />
  21. </tr>
  22. <tr>
  23. <td colspan="4" style="border:none">
  24. <audit-advanced-group
  25. :expand="expandJ"
  26. :expand-str="'expandJ'"
  27. :group-label="'风险审计信息'"
  28. @changedClick="changedClick"
  29. />
  30. </td>
  31. </tr>
  32. <tr v-show="expandJ">
  33. <!-- 业务编码 -->
  34. <sd-form-item-td name="businessCode" :input-props="{ disabled: true }" />
  35. <!-- 事件标签 -->
  36. <sd-form-item-td
  37. name="eventTagName"
  38. label="事件标签分类"
  39. :input-props="{ disabled: true }"
  40. />
  41. </tr>
  42. <!-- 模型编码 -->
  43. <!-- 模型名称 -->
  44. <tr v-show="expandJ">
  45. <sd-form-item-td name="batchName" :input-props="{ disabled: true }" />
  46. <sd-form-item-td name="batchCode" :input-props="{ disabled: true }" />
  47. </tr>
  48. <tr v-show="expandJ">
  49. <!-- 模型类型 -->
  50. <sd-form-item-td name="modelTypeName" :input-props="{ disabled: true }" />
  51. <!-- 整改人 -->
  52. <sd-form-item-td name="viewAccount" :input-props="{ disabled: true }" />
  53. </tr>
  54. <!-- 非问题 -->
  55. <tr v-show="expandJ">
  56. <sd-form-item-td
  57. label="非问题标签"
  58. name="nonQuestionTag"
  59. :colspan="3"
  60. :input-props="{ disabled: true }"
  61. />
  62. </tr>
  63. <tr v-show="expandJ">
  64. <sd-form-item-td
  65. label="非问题说明"
  66. name="nonQuestionDesc"
  67. :colspan="3"
  68. :input-props="{ disabled: true }"
  69. />
  70. </tr>
  71. <tr v-show="expandJ">
  72. <!-- 关注风险 -->
  73. <sd-form-item-td
  74. label="关注风险"
  75. name="risk"
  76. :colspan="3"
  77. :input-props="{ disabled: true }"
  78. />
  79. </tr>
  80. <tr v-if="isViewType">
  81. <td
  82. v-if="getClassdata(model, fields)"
  83. :colspan="4"
  84. style="line-height:40px;border:none1;"
  85. :class="$style.maintaintable"
  86. >
  87. <audit-advanced-group
  88. :expand="expandY"
  89. :expand-str="'expandY'"
  90. :group-label="'审计明细信息'"
  91. @changedClick="changedClick"
  92. >
  93. <template>
  94. <sd-table
  95. v-show="expandY"
  96. ref="classtable"
  97. :row-key="(record, index) => index"
  98. :loading="false"
  99. class="maintaintable"
  100. :columns="childMXColumns"
  101. :data-source="classdata"
  102. :pagination="false"
  103. >
  104. <div slot="attachment" slot-scope="text, record">
  105. <span :class="$style.exportClickBtn" @click="exportClick(record)">{{
  106. record.fileName
  107. }}</span>
  108. </div>
  109. <div slot="questionNature" slot-scope="text, record">
  110. <a-select
  111. v-model="record.questionNature"
  112. placeholder="请选择问题性质"
  113. allow-clear
  114. @change="saveForm"
  115. >
  116. <a-select-option value="有业务无制度">有业务无制度</a-select-option>
  117. <a-select-option value="有制度难执行">有制度难执行</a-select-option>
  118. <a-select-option value="制度太宽泛缺乏操作细则"
  119. >制度太宽泛缺乏操作细则</a-select-option
  120. >
  121. <a-select-option value="制度过时不具备可操作性"
  122. >制度过时不具备可操作性</a-select-option
  123. >
  124. <a-select-option value="制度脱离实际难落地实施"
  125. >制度脱离实际难落地实施</a-select-option
  126. >
  127. <a-select-option value="有制度未遵循">有制度未遵循</a-select-option>
  128. <a-select-option value="特殊事项已经线下审批"
  129. >特殊事项已经线下审批</a-select-option
  130. >
  131. <a-select-option value="事项紧急重目标轻合规"
  132. >事项紧急重目标轻合规</a-select-option
  133. >
  134. <a-select-option value="制度理解存在人为偏差"
  135. >制度理解存在人为偏差</a-select-option
  136. >
  137. <a-select-option value="工作疏忽未按制度行事"
  138. >工作疏忽未按制度行事</a-select-option
  139. >
  140. <a-select-option value="人为规避制度管控要求"
  141. >人为规避制度管控要求</a-select-option
  142. >
  143. </a-select>
  144. </div>
  145. <!-- <div slot="personResponsible" slot-scope="text, record">
  146. <span :class="$style.exportClickBtn" @click="selectUserClick">{{
  147. record.personResponsible || '请选择'
  148. }}</span>
  149. </div> -->
  150. </sd-table>
  151. </template>
  152. </audit-advanced-group>
  153. <div v-show="false">
  154. <sd-dep-picker
  155. ref="pRelSelect"
  156. v-model="mainSendPersonal"
  157. :single="true"
  158. :read-only="false"
  159. @change="changep"
  160. />
  161. </div>
  162. </td>
  163. </tr>
  164. </table>
  165. <template v-if="!isViewType">
  166. <tr>
  167. <td colspan="4" style="border:none">
  168. <audit-advanced-group
  169. :expand="expandDesc"
  170. :expand-str="'expandDesc'"
  171. :group-label="'说明'"
  172. @changedClick="changedClick"
  173. />
  174. </td>
  175. </tr>
  176. <table v-if="expandDesc">
  177. <sd-form-item-td name="reformDesc" :colspan="4" label="说明">
  178. <a-textarea v-model="model.reformDesc" placeholder="请填写说明" :rows="3" />
  179. </sd-form-item-td>
  180. </table>
  181. <!-- 整改说明 -->
  182. <tr>
  183. <td colspan="4" style="border:none">
  184. <audit-advanced-group
  185. :expand="expandFiles"
  186. :expand-str="'expandFiles'"
  187. :group-label="'附件'"
  188. @changedClick="changedClick"
  189. />
  190. </td>
  191. </tr>
  192. <table v-if="expandFiles">
  193. <a-form-model-item label="">
  194. <div :class="$style.upload">
  195. <a-upload-dragger
  196. :class="$style.uploadData"
  197. name="RectificationFile"
  198. :file-list="fileListTemp"
  199. :accept="actualAccept"
  200. :multiple="true"
  201. :custom-request="(file) => customRequest(file, 0)"
  202. @change="handleChange"
  203. >
  204. <p class="ant-upload-drag-icon"><a-icon type="inbox"/></p>
  205. <p class="ant-upload-text">请上传整改附件</p>
  206. </a-upload-dragger>
  207. <div :class="$style.uploadList">
  208. <li v-for="(item, i) in fileList" :key="i">
  209. <span>{{ item.name }}</span>
  210. <!-- 删除 -->
  211. <a-icon type="delete" style="cursor: pointer;" @click="deleteFile(i)" />
  212. </li>
  213. </div>
  214. </div>
  215. </a-form-model-item>
  216. </table>
  217. </template>
  218. <!-- 整改说明 -->
  219. </template>
  220. </sd-webflow>
  221. </span>
  222. </template>
  223. <script>
  224. import { Modal, Message } from 'ant-design-vue'
  225. import auditAdvancedGroup from '../../components/audit-advanced-group.vue'
  226. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  227. import components from './_import-components/audit-summarry-from-import'
  228. import download from '@/common/services/download'
  229. import { getUserInfo } from '@/common/store-mixin'
  230. import moment from 'moment/moment'
  231. import AuditRiskbraryService from './riskLibrary'
  232. import { sdLocalStorage } from '@/common/services/storage-service'
  233. import axios from '@/common/services/axios-instance'
  234. // import
  235. export default {
  236. name: 'AuditSummarryFrom',
  237. metaInfo: {
  238. title: '风险问题审计',
  239. },
  240. components: {
  241. ...components,
  242. auditAdvancedGroup,
  243. },
  244. mixins: [auditAdvancedGroupMixins],
  245. data() {
  246. return {
  247. key: 0,
  248. // 控制是否展开
  249. expandY: true,
  250. expandJ: true,
  251. expandDesc: true,
  252. expandFiles: true,
  253. mainSendPersonal: [],
  254. fileList: [],
  255. fileListTemp: [],
  256. userInfo: getUserInfo(),
  257. childMXColumns: [
  258. {
  259. title: '序号',
  260. dataIndex: 'sortNum',
  261. customRender: (text, record, index) => `${index + 1}`,
  262. width: '80px',
  263. },
  264. // {
  265. // title: '批次号',
  266. // dataIndex: 'batchCode',
  267. // },
  268. // {
  269. // title: '批次名称',
  270. // dataIndex: 'batchName',
  271. // },
  272. {
  273. // 模型名称
  274. title: '模型名称',
  275. dataIndex: 'batchName',
  276. },
  277. {
  278. // 模型编号
  279. title: '模型编号',
  280. dataIndex: 'batchCode',
  281. },
  282. {
  283. title: '整改说明',
  284. dataIndex: 'reformDesc',
  285. },
  286. {
  287. title: '附件',
  288. dataIndex: 'attachment',
  289. scopedSlots: { customRender: 'attachment' },
  290. },
  291. // {
  292. // title: '问题性质',
  293. // dataIndex: 'questionNature',
  294. // width: '250px',
  295. // scopedSlots: { customRender: 'questionNature' },
  296. // },
  297. // {
  298. // title: '问题责任人',
  299. // dataIndex: 'personResponsible',
  300. // scopedSlots: { customRender: 'personResponsible' },
  301. // },
  302. ],
  303. classIndexData: [],
  304. maintaindata: [],
  305. flag: true,
  306. modelFlag: true,
  307. classtable: false,
  308. // 分类列表
  309. classdata: [],
  310. // 基础数据
  311. baseData: {},
  312. isViewType: true,
  313. infoProperties: {},
  314. attachments: [],
  315. lockId: '',
  316. flagIs: true,
  317. initType: false,
  318. }
  319. },
  320. computed: {
  321. actualAccept() {
  322. // 优先使用前端配置的类型限制,如未配置,则使用后端支持的类型
  323. return (
  324. this.accept || JSON.parse(sdLocalStorage.getItem('commonConfig') || '{}').attachType || ''
  325. )
  326. },
  327. },
  328. watch: {
  329. classdata() {
  330. this.saveForm()
  331. },
  332. },
  333. created() {
  334. const lock = sdLocalStorage.getItem(`Lock${this.webflow?.FlowData?.instId}`)
  335. this.lockId = (lock && JSON.parse(lock).sessionId) || ''
  336. },
  337. mounted() {
  338. this.initModelData()
  339. },
  340. methods: {
  341. initModelData() {
  342. if (!this.$route.query.extParams) return
  343. this.isViewType = false
  344. this.flagIs = false
  345. this.baseData = JSON.parse(this.$route.query.extParams)
  346. Object.keys(this.baseData).forEach((key) => {
  347. // 如果值是字符 null 则转换为null
  348. if (this.baseData[key] === 'null') {
  349. this.baseData[key] = null
  350. }
  351. this.$refs.docform.setFieldValue(key, this.baseData[key])
  352. })
  353. // todo 问题整改人
  354. },
  355. // 附件自定义上传
  356. customRequest(data, catnum = 0, item) {
  357. if (data.file.size === 0) {
  358. Message.warn(`不能上传大小为0的文件`)
  359. return
  360. }
  361. const file = {
  362. FileName: data.file.name,
  363. Completed: 0,
  364. CatNum: catnum,
  365. }
  366. this.attachments = [...this.attachments]
  367. const strTime = moment().format('YYYY-MM-DD HH:mm:ss')
  368. const formData = new FormData()
  369. formData.append('file', data.file)
  370. formData.append('FileName', data.file.name)
  371. formData.append('lockId', this.lockId)
  372. formData.append('groupId', this.groupId)
  373. Object.keys(this.infoProperties).forEach((key) => {
  374. formData.append(key, this.infoProperties[key])
  375. })
  376. formData.append(
  377. 'querystring',
  378. `<file_unid></file_unid><file_name>${data.file.name}</file_name><file_size>${data.file.size}</file_size><completed>1</completed><file_create>${strTime}</file_create><file_update>${strTime}</file_update><file_editmodel>0</file_editmodel><file_lockuser>0</file_lockuser><CreateInfo>${this.userInfo.account} ${strTime}</CreateInfo><filetype></filetype><user_name>${this.userInfo.account}</user_name><UpdateInfo>${this.userInfo.account}于${strTime}创建.</UpdateInfo><TaodaInfo></TaodaInfo><CatNum>${catnum}</CatNum><Ext></Ext>`
  379. )
  380. const url = 'api/xcoa-mobile/v1/iam-attachment-extend/attachments-upload/indi'
  381. axios
  382. .post(url, formData, {
  383. headers: {
  384. 'Content-Type': 'multipart/form-data',
  385. },
  386. })
  387. .then((_) => {
  388. if (_.data.startsWith('false')) {
  389. Message.error(`${data.file.name} 上传失败`)
  390. } else {
  391. this.fileList.push({
  392. name: data.file.name,
  393. url: _.data,
  394. })
  395. const attachment = this.fileList.map((item) => item.url).join(',')
  396. const nameList = this.fileList.map((item) => item.name).join(',')
  397. this.$refs.docform.setFieldValue('attachment', attachment)
  398. this.$refs.docform.setFieldValue('fileName', nameList)
  399. data.onSuccess(_, data.file)
  400. }
  401. })
  402. .catch((e) => {
  403. Message.error(`${data.file.name} 上传失败`)
  404. throw e
  405. })
  406. },
  407. // 附件上传
  408. handleChange(info) {
  409. const status = info.file.status
  410. if (status === 'done') {
  411. Message.success(`${info.file.name} 上传成功.`)
  412. } else if (status === 'error') {
  413. Message.error(`${info.file.name} 上传失败.`)
  414. }
  415. },
  416. // <!-- 删除已上传附件 -->
  417. deleteFile(index) {
  418. this.fileList.splice(index, 1)
  419. const attachment = this.fileList.map((item) => item.url).join(',')
  420. const nameList = this.fileList.map((item) => item.name).join(',')
  421. this.$refs.docform.setFieldValue('attachment', attachment)
  422. this.$refs.docform.setFieldValue('fileName', nameList)
  423. },
  424. saveForm() {
  425. return new Promise((resolve) => {
  426. if (this.isViewType) {
  427. this.$refs.docform.setFieldValue('questionNature', this.classdata[0].questionNature)
  428. const account = getUserInfo().name
  429. const strTime = moment().format('YYYY-MM-DD')
  430. // 第一次
  431. if (!this.initType) {
  432. // 没有初审人,设置初审人
  433. if (!this.classdata[0].checker) {
  434. this.$refs.docform.setFieldValue('checker', account)
  435. this.$refs.docform.setFieldValue('checkDate', strTime)
  436. }
  437. // 有初审人并且没有终审人
  438. if (this.classdata[0].checker && !this.classdata[0].reviewer) {
  439. this.$refs.docform.setFieldValue('reviewer', account)
  440. this.$refs.docform.setFieldValue('reviewDate', strTime)
  441. }
  442. }
  443. }
  444. if (!this.isViewType) {
  445. const strTime = moment().format('YYYY-MM-DD')
  446. this.$refs.docform.setFieldValue('reformDate', strTime)
  447. this.$refs.docform.setFieldValue('title', getUserInfo().name + '风险审核')
  448. }
  449. resolve(true)
  450. })
  451. },
  452. validForm(e) {
  453. return Promise.resolve(true)
  454. },
  455. actionBtnClick(evt, { button, FlowData }) {
  456. if (button.buttonId === 'G_1_FXWTSJ.4') {
  457. if (
  458. !this.classdata[0]?.questionNature &&
  459. this.isViewType &&
  460. !this.classdata[0]?.nonQuestionDesc
  461. ) {
  462. evt.preventDefault()
  463. return Modal.warning({
  464. title: '提示',
  465. content: '请选择需要问题性质!',
  466. })
  467. }
  468. }
  469. if (button.fakeId === 'save' || button.fakeId === 'workflow-push') {
  470. // 保存前先校验计划是否已经存在
  471. evt.waitUntil(
  472. new Promise((resolve, reject) => {
  473. this.saveForm(button.buttonId).then((res) => {
  474. if (!res) {
  475. evt.preventDefault()
  476. }
  477. resolve()
  478. })
  479. })
  480. )
  481. }
  482. },
  483. initData(model) {
  484. // 如果整改人是自己则可以上传
  485. if (model.viewAccount === getUserInfo().name) {
  486. this.isViewType = false
  487. if (model.attachment && this.flagIs) {
  488. const attachmentList = model.attachment.split(',')
  489. const fileNameList = model.fileName.split(',')
  490. this.fileList = []
  491. for (let i = 0; i < attachmentList.length; i++) {
  492. this.fileList.push({
  493. name: fileNameList[i],
  494. url: attachmentList[i],
  495. })
  496. }
  497. this.flagIs = false
  498. }
  499. }
  500. return true
  501. },
  502. getClassdata(model, fields) {
  503. if (this.flag) {
  504. this.classdata = [
  505. {
  506. batchCode: fields.batchCode.value,
  507. batchName: fields.batchName.value,
  508. reformDesc: fields.reformDesc.value,
  509. attachment: fields.attachment.value,
  510. fileName: fields.fileName.value,
  511. questionNature: fields.questionNature.value || undefined,
  512. // personResponsible: fields.personResponsible.value,
  513. checker: fields.checker.value,
  514. checkDate: fields.checkDate.value,
  515. reviewer: fields.reviewer.value,
  516. reviewDate: fields.reviewDate.value,
  517. viewAccount: fields.viewAccount.value,
  518. nonQuestionDesc: fields.nonQuestionDesc.value,
  519. },
  520. ]
  521. // 如果 非问题标签内有值则不显示
  522. if (
  523. !this.classdata[0].nonQuestionDesc &&
  524. !this.childMXColumns.find((item) => item.title === '问题性质')
  525. ) {
  526. this.childMXColumns.push({
  527. title: '问题性质',
  528. dataIndex: 'questionNature',
  529. width: '250px',
  530. scopedSlots: { customRender: 'questionNature' },
  531. })
  532. }
  533. if (!this.classdata[0].viewAccount) {
  534. this.initType = true
  535. this.$nextTick(() => {
  536. this.$refs.docform.setFieldValue('viewAccount', getUserInfo().name)
  537. })
  538. }
  539. this.flag = false
  540. }
  541. return true
  542. },
  543. // 下载
  544. exportClick(row) {
  545. const attachmentList = row.attachment.split(',')
  546. const fileNameList = row.fileName.split(',')
  547. for (let i = 0; i < attachmentList.length; i++) {
  548. const spliceIndex = attachmentList[i].lastIndexOf('|')
  549. const destStep = attachmentList[i].substring(spliceIndex + 1, attachmentList[i].length)
  550. download(
  551. 'api/framework/v1/task-form-process/download-attachments/' + destStep,
  552. fileNameList[i]
  553. )
  554. }
  555. },
  556. selectUserClick() {
  557. setTimeout(() => {
  558. this.$refs.pRelSelect.openPicker()
  559. }, 0)
  560. },
  561. changep(values) {
  562. this.saveForm()
  563. },
  564. },
  565. }
  566. </script>
  567. <style module lang="scss">
  568. @use '@/common/design' as *;
  569. @import '@/webflow/sd-flow-form.scss';
  570. .btnselect {
  571. position: relative;
  572. top: 2px;
  573. right: 80px;
  574. float: right;
  575. .batchselect {
  576. z-index: 100;
  577. margin-left: 10px;
  578. }
  579. }
  580. .btnselectmaintain {
  581. position: relative;
  582. float: right;
  583. .batchselect {
  584. z-index: 100;
  585. margin-right: -10px;
  586. margin-left: 10px;
  587. }
  588. }
  589. .maintaintable {
  590. :global(.ant-table-thead > tr > th) {
  591. border-right: none;
  592. }
  593. :global(.ant-table-bordered.ant-table-empty .ant-table-placeholder) {
  594. border: none;
  595. }
  596. :global(.ant-table-body table) {
  597. // border-left:none;
  598. border: none;
  599. }
  600. }
  601. .exportClickBtn {
  602. color: #1890ff;
  603. cursor: pointer;
  604. }
  605. .upload {
  606. display: flex;
  607. .upload-list {
  608. width: calc(30% - 10px);
  609. margin-left: 10px;
  610. li {
  611. display: flex;
  612. align-items: center;
  613. justify-content: space-between;
  614. width: 100%;
  615. height: 30px;
  616. padding: 0 10px;
  617. margin-bottom: 10px;
  618. line-height: 30px;
  619. border-radius: 4px;
  620. span {
  621. display: inline-block;
  622. width: 80%;
  623. overflow: hidden;
  624. text-overflow: ellipsis;
  625. white-space: nowrap;
  626. }
  627. }
  628. }
  629. .upload-data {
  630. width: 70%;
  631. }
  632. }
  633. </style>