risk-criteria-form.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. <template>
  2. <span>
  3. <audit-form-top-banner
  4. :handel-save-form="saveForm"
  5. :form-data="mode"
  6. @handelSaveForm="saveForm"
  7. >
  8. <sd-detail-form
  9. ref="docform"
  10. page-id="risk/criteria/riskCriteria"
  11. :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
  12. :class="$style.form"
  13. :read-only="false"
  14. @close="close(true)"
  15. @saved="saved"
  16. >
  17. <template v-slot="{ model, fields }">
  18. <table>
  19. <tr>
  20. <td style="border: none">
  21. <audit-advanced-group
  22. :expand="expand"
  23. expand-str="expand"
  24. :group-label="'基本信息'"
  25. tablestyle="''"
  26. @changedClick="changedClick"
  27. ></audit-advanced-group>
  28. </td>
  29. </tr>
  30. </table>
  31. <table v-show="expand">
  32. <tr>
  33. <!-- 准则版本编号 -->
  34. <sd-form-item-td v-show="fnIni(model)" name="criteriaCode">
  35. <template v-slot:read-and-edit="{ editable }">
  36. {{ model.criteriaCode }}
  37. </template>
  38. </sd-form-item-td>
  39. <!-- id -->
  40. <sd-form-item-td name="id" :hidden="true"> </sd-form-item-td>
  41. <!-- 准则适用范围 -->
  42. <sd-form-item-td name="criteriaDeptOpt">
  43. <template v-slot:read-and-edit="{ editable }">
  44. <sd-group-picker
  45. v-if="editable"
  46. v-model="model.criteriaDeptOpt"
  47. :root-node="rootNode"
  48. @change="depChange"
  49. ></sd-group-picker>
  50. <div v-else>{{ model.criteriaDeptName }}</div>
  51. </template>
  52. </sd-form-item-td>
  53. <sd-form-item-td name="criteriaDeptId" :hidden="true"> </sd-form-item-td>
  54. <sd-form-item-td name="criteriaDeptCode" :hidden="true"> </sd-form-item-td>
  55. <sd-form-item-td name="criteriaDeptName" :hidden="true"> </sd-form-item-td>
  56. </tr>
  57. <tr>
  58. <!-- 状态 -->
  59. <sd-form-item-td name="state" :colspan="3"> </sd-form-item-td>
  60. </tr>
  61. <tr>
  62. <!-- 说明 -->
  63. <sd-form-item-td name="signify" :colspan="3">
  64. <template v-slot:read-and-edit="{ editable }">
  65. <a-textarea
  66. v-if="editable"
  67. v-model="model.signify"
  68. :auto-size="{ maxRows: 3, minRows: 3 }"
  69. ></a-textarea>
  70. <div v-else>
  71. {{ model.signify }}
  72. </div>
  73. </template>
  74. </sd-form-item-td>
  75. </tr>
  76. <tr>
  77. <!-- 创建人 -->
  78. <sd-form-item-td name="creatorName" label="创建人员" />
  79. <!-- 创建日期 -->
  80. <sd-form-item-td name="creationTime" label="创建日期" />
  81. </tr>
  82. </table>
  83. <table>
  84. <tr
  85. ><td :colspan="4">
  86. <sd-form-item name="riskPossibilityEntitys" :label="null">
  87. <template v-slot:read-and-edit="{ editable }">
  88. <audit-advanced-group
  89. :expand="possExpand"
  90. expand-str="possExpand"
  91. group-label="发生可能性(P)"
  92. @changedClick="changedClick"
  93. >
  94. <template>
  95. <xm-child-table
  96. ref="possTable"
  97. v-model="model.riskPossibilityEntitys"
  98. :class="$style.possChild"
  99. :label="null"
  100. :read-only="true"
  101. :addbuttonvisiable="false"
  102. :fields="
  103. [
  104. {
  105. caption: '序号',
  106. name: 'sortNum',
  107. dataType: 'number',
  108. },
  109. ].concat(Array.from(fields.riskPossibilityEntitys.attr.dync))
  110. "
  111. :columns="possColumns"
  112. >
  113. <!-- 定义 -->
  114. <template v-slot:definition="{ text, record, field, value, index }">
  115. <a-input v-if="editable" v-model="record.definition"></a-input>
  116. <div v-else>
  117. {{ record.definition }}
  118. </div>
  119. </template>
  120. <!-- 评率/可能性 -->
  121. <template v-slot:frequency="{ text, record, field, value, index }">
  122. <a-input v-if="editable" v-model="record.frequency"></a-input>
  123. <div v-else>
  124. {{ record.frequency }}
  125. </div>
  126. </template>
  127. </xm-child-table>
  128. </template>
  129. </audit-advanced-group>
  130. </template>
  131. </sd-form-item>
  132. </td>
  133. </tr>
  134. </table>
  135. <table>
  136. <tr
  137. ><td :colspan="4">
  138. <sd-form-item name="riskDegreeEntitys" :label="null">
  139. <template v-slot:read-and-edit="{ editable }">
  140. <audit-advanced-group
  141. :expand="degreeExpand"
  142. expand-str="degreeExpand"
  143. group-label="风险影响程度(C)"
  144. @changedClick="changedClick"
  145. >
  146. <template>
  147. <risk-criteria-child-table
  148. ref="dgreeTable"
  149. v-model="degreeData"
  150. :select-columns="selectColumnsLength"
  151. :class="$style.dgreeChild"
  152. :label="null"
  153. :read-only="!editable"
  154. :fields="degreeFields"
  155. :columns="degreeColumns"
  156. @addData="addData"
  157. @deleteData="deleteData"
  158. >
  159. <template
  160. v-for="fieldNum in 100"
  161. :slot="'field' + fieldNum"
  162. slot-scope="{ text, record, field, value, index }"
  163. >
  164. <span v-if="index === 0 && field.name === 'field1'" :key="fieldNum">
  165. {{ text }}
  166. </span>
  167. <span v-else :key="fieldNum" :class="$style.titleSpan">
  168. <a-checkbox
  169. v-if="index === 0"
  170. v-model="selectColumns[field.name]"
  171. :class="$style.titleCheckbox"
  172. />
  173. <a-input
  174. v-model="record['field' + fieldNum]"
  175. :class="{
  176. [$style.requireInputXm]:
  177. errorField['field' + fieldNum + '-' + index],
  178. }"
  179. @blur="inputChange($event, 'field' + fieldNum + '-' + index)"
  180. @change="inputChange($event, 'field' + fieldNum + '-' + index)"
  181. ></a-input>
  182. </span>
  183. </template>
  184. </risk-criteria-child-table>
  185. <div
  186. class="ant-form-explain"
  187. :class="{
  188. [$style.requireDivXm]: !canSumibt,
  189. [$style.requireDivNoneXm]: canSumibt,
  190. }"
  191. >风险影响程度内容不能为空</div
  192. >
  193. </template>
  194. </audit-advanced-group>
  195. </template>
  196. </sd-form-item>
  197. </td>
  198. </tr>
  199. </table>
  200. <table>
  201. <tr
  202. ><td :colspan="4">
  203. <sd-form-item name="riskLevelEntitys" :label="null">
  204. <template v-slot:read-and-edit="{ editable }">
  205. <audit-advanced-group
  206. :expand="levelExpand"
  207. expand-str="levelExpand"
  208. group-label="风险等级"
  209. @changedClick="changedClick"
  210. >
  211. <template>
  212. <xm-child-table
  213. ref="levelTable"
  214. v-model="model.riskLevelEntitys"
  215. :class="$style.levelChild"
  216. :label="null"
  217. :read-only="true"
  218. :fields="
  219. [
  220. {
  221. caption: '序号',
  222. name: 'sortNum',
  223. dataType: 'number',
  224. },
  225. ].concat(Array.from(fields.riskLevelEntitys.attr.dync))
  226. "
  227. :columns="levelColumns"
  228. >
  229. <!-- 最小值 -->
  230. <template v-slot:minNum="{ text, record, field, value, index }">
  231. <a-input-number
  232. v-if="editable"
  233. v-model="record.minNum"
  234. :min="0"
  235. :precision="1"
  236. ></a-input-number>
  237. <div v-else>
  238. {{ record.minNum }}
  239. </div>
  240. </template>
  241. <!-- 最大值 -->
  242. <template v-slot:maxNum="{ text, record, field, value, index }">
  243. <a-input-number
  244. v-if="editable"
  245. v-model="record.maxNum"
  246. :min="0"
  247. :precision="1"
  248. ></a-input-number>
  249. <div v-else>
  250. {{ record.maxNum }}
  251. </div>
  252. </template>
  253. </xm-child-table>
  254. </template>
  255. </audit-advanced-group>
  256. </template>
  257. </sd-form-item>
  258. </td>
  259. </tr>
  260. </table>
  261. </template>
  262. </sd-detail-form>
  263. </audit-form-top-banner>
  264. </span>
  265. </template>
  266. <script>
  267. import { getUserInfo } from '@/common/store-mixin'
  268. import { message, Modal } from '@/common/one-ui'
  269. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  270. import auditFormTopBanner from '@product/iam/components/audit-form-top-banner'
  271. import auditAdvancedGroup from '@product/iam/components/audit-advanced-group.vue'
  272. import auditAdvancedGroupMixins from '@product/iam/components/audit-advanced-group-mixins'
  273. import riskCriteriaChildTable from './components/risk-criteria-child-table.vue'
  274. import riskCriteriaService from './risk-criteria-service'
  275. import components from './_import-components/risk-criteria-form-import'
  276. // 修改主子表的首行title名
  277. export default {
  278. name: 'RiskCriteriaForm',
  279. metaInfo: {
  280. title: '风险准则',
  281. },
  282. components: {
  283. ...components,
  284. auditAdvancedGroup,
  285. auditFormTopBanner,
  286. riskCriteriaChildTable,
  287. },
  288. mixins: [auditAdvancedGroupMixins],
  289. data() {
  290. return {
  291. rootNode: {},
  292. errorField: {},
  293. canSumibt: true,
  294. infoDataKey: 0,
  295. selectColumns: {},
  296. mode: null,
  297. childTableKey: 0, // 刷新子表组件
  298. inited: false,
  299. degreeExpand: true,
  300. possExpand: true,
  301. levelExpand: true,
  302. expand: true,
  303. planId: null,
  304. possColumns: [
  305. {
  306. title: '分值',
  307. dataIndex: 'sortNum',
  308. width: '100px',
  309. customRender: (text, record, index) => `${index + 1}`,
  310. },
  311. {
  312. dataIndex: 'definition',
  313. title: '定义',
  314. },
  315. { dataIndex: 'frequency', title: '频率/可能性' },
  316. { dataIndex: 'criteriaId', title: '风险准则ID', sdHidden: true },
  317. ],
  318. possData: [
  319. {
  320. definition: '很低',
  321. frequency: '每年发生一次或者几乎不发生,只特定时期发生',
  322. },
  323. {
  324. definition: '低',
  325. frequency: '每季度发生一次',
  326. },
  327. {
  328. definition: '一般',
  329. frequency: '每月发生一次',
  330. },
  331. {
  332. definition: '高',
  333. frequency: '每周发生一次',
  334. },
  335. {
  336. definition: '很高',
  337. frequency: '每天发生一次',
  338. },
  339. ],
  340. childTableId: {},
  341. degreeIndex: 2,
  342. degreeColumns: [
  343. {
  344. dataIndex: 'sortNum',
  345. title: '分值',
  346. width: '100px',
  347. customRender: (text, record, index) => {
  348. if (index === 0) return '分值'
  349. return index
  350. },
  351. },
  352. { dataIndex: 'field1', title: 'field1' },
  353. ],
  354. degreeFields: [
  355. {
  356. name: 'sortNum',
  357. caption: '序号',
  358. },
  359. {
  360. dataType: 'string',
  361. caption: 'field1',
  362. name: 'field1',
  363. },
  364. ],
  365. degreeData: [
  366. {
  367. field1: '影响',
  368. },
  369. {
  370. field1: '轻微',
  371. },
  372. {
  373. field1: '中等',
  374. },
  375. {
  376. field1: '重要',
  377. },
  378. {
  379. field1: '重大',
  380. },
  381. {
  382. field1: '灾难性',
  383. },
  384. ],
  385. levelColumns: [
  386. {
  387. title: '序号',
  388. dataIndex: 'sortNum',
  389. width: '100px',
  390. customRender: (text, record, index) => `${index + 1}`,
  391. },
  392. {
  393. dataIndex: 'riskLevel',
  394. title: '风险等级',
  395. },
  396. { dataIndex: 'maxNum', title: '最大值(含等于)' },
  397. { dataIndex: 'minNum', title: '最小值(含等于)' },
  398. { dataIndex: 'criteriaId', title: '风险准则ID', sdHidden: true },
  399. ],
  400. levelData: [
  401. {
  402. riskLevel: '高风险',
  403. minNum: null,
  404. maxNum: null,
  405. },
  406. {
  407. riskLevel: '中风险',
  408. minNum: null,
  409. maxNum: null,
  410. },
  411. {
  412. riskLevel: '低风险',
  413. minNum: null,
  414. maxNum: null,
  415. },
  416. ],
  417. expressions: [],
  418. isIni: false,
  419. }
  420. },
  421. computed: {
  422. selectColumnsLength() {
  423. let length = 0
  424. for (const checked in this.selectColumns) {
  425. if (this.selectColumns[checked]) {
  426. length++
  427. }
  428. }
  429. return length
  430. },
  431. },
  432. mounted() {
  433. this.getUserRootNode()
  434. // 重画表格表头
  435. const setHeader = setInterval(() => {
  436. if (document.querySelector('.level-child_risk-criteria-form_product table thead')) {
  437. clearInterval(setHeader)
  438. this.fnSetLevelTableHeader()
  439. }
  440. }, 200)
  441. },
  442. methods: {
  443. // 获取用户默认根节点机构
  444. getUserRootNode() {
  445. const userInfo = getUserInfo()
  446. const deptId = userInfo.deptId
  447. riskCriteriaService.getUserHavePermissionOrg().then((res) => {
  448. riskCriteriaService.findIamOrgId(deptId).then((data) => {
  449. const node = res.data.editNodes.find((item) => {
  450. return item.id === data.data
  451. })
  452. if (node) {
  453. this.rootNode = {
  454. code: node.props.orgId + '',
  455. name: node.text,
  456. }
  457. }
  458. })
  459. })
  460. },
  461. depChange(deptList) {
  462. const ids = []
  463. const codes = []
  464. const names = []
  465. deptList.forEach((item) => {
  466. ids.push(item.id)
  467. codes.push(item.code)
  468. names.push(item.name)
  469. })
  470. this.$refs.docform.setFieldValue('criteriaDeptId', ids.join(','))
  471. this.$refs.docform.setFieldValue('criteriaDeptCode', codes.join(','))
  472. this.$refs.docform.setFieldValue('criteriaDeptName', names.join(','))
  473. },
  474. // 动态增加列
  475. addData() {
  476. this.degreeColumns.push({
  477. dataIndex: 'field' + this.degreeIndex,
  478. title: 'field' + this.degreeIndex,
  479. })
  480. this.degreeFields.push({
  481. dataType: 'string',
  482. caption: 'field' + this.degreeIndex,
  483. name: 'field' + this.degreeIndex,
  484. required: true,
  485. })
  486. this.degreeData.forEach((item) => {
  487. item['field' + this.degreeIndex] = ''
  488. })
  489. this.degreeIndex++
  490. this.$refs.dgreeTable.fnupdate(this.degreeData)
  491. },
  492. // 删除列
  493. deleteData() {
  494. for (const fieldKey in this.selectColumns) {
  495. if (this.selectColumns[fieldKey]) {
  496. let colIndex
  497. this.degreeColumns.forEach((item, index) => {
  498. if (item.dataIndex === fieldKey) colIndex = index
  499. })
  500. this.degreeColumns.splice(colIndex, 1)
  501. let fieldIndex
  502. this.degreeFields.forEach((item, index) => {
  503. if (item.name === fieldKey) fieldIndex = index
  504. })
  505. this.degreeFields.splice(fieldIndex, 1)
  506. this.degreeData.forEach((item) => {
  507. delete item[fieldKey]
  508. })
  509. }
  510. }
  511. this.selectColumns = {}
  512. },
  513. fnIni(model) {
  514. if (this.isIni) return true
  515. this.isIni = true
  516. if (this.$route.query.record) {
  517. // 获取风险影响程度数据
  518. this.fnGetDegreeTableData(model)
  519. } else {
  520. // 发生可能行(P)
  521. model.riskPossibilityEntitys = this.possData
  522. // 风险影响程度
  523. model.riskDegreeEntitys = this.degreeData
  524. // 风险等级
  525. model.riskLevelEntitys = this.levelData
  526. }
  527. return true
  528. },
  529. close(flag) {
  530. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  531. window.close()
  532. },
  533. saved() {
  534. message.success({ content: '保存成功!' }, 1).then(() => {
  535. this.close(true)
  536. })
  537. },
  538. // 保存
  539. saveForm() {
  540. // 保存前先将动态表格拆分为正常数据
  541. this.fnSetDegreeTableData()
  542. this.checkDegreeTableData()
  543. setTimeout(() => {
  544. this.$refs.docform.validateFields().then((valid) => {
  545. // 检查分值不能冲突
  546. if (valid && this.canSumibt && this.checkRiskLevelEntitys()) {
  547. // 如果是作废状态,则不判断是否有启用的文件
  548. // const isStart = this.$refs.docform.getFieldValue('state')
  549. // if (isStart === '1') {
  550. // 先注释掉判断重复启用的代码,以防后边还需要使用,暂时先不判断
  551. this.$refs.docform.saveBtnClick()
  552. // return
  553. // }
  554. // // 启用状态才继续判断是否有其他启用的准则
  555. // const errDep = []
  556. // // 判断组织是否存在启用的准则
  557. // const deptList = this.$refs.docform.getFieldValue('criteriaDeptOpt')
  558. // const promiseAll = []
  559. // const deptName = []
  560. // const id = this.$route.query.record || ''
  561. // deptList.forEach((item) => {
  562. // promiseAll.push(
  563. // riskCriteriaServices.checkDept({
  564. // criteriaDeptCode: item.code,
  565. // id: id,
  566. // })
  567. // )
  568. // deptName.push(item.name)
  569. // })
  570. // // 全部一起请求
  571. // let isErr = false
  572. // Promise.all(promiseAll)
  573. // .then((resAll) => {
  574. // for (let index = 0; index < resAll.length; index++) {
  575. // if (!resAll[index].data) {
  576. // errDep.push(deptName[index])
  577. // }
  578. // }
  579. // })
  580. // .catch((err) => {
  581. // isErr = true
  582. // message.error('判断启用准则接口请求错误,请联系管理员')
  583. // console.log(err)
  584. // })
  585. // .finally(() => {
  586. // // 如果存在已启动的
  587. // if (errDep.length > 0) {
  588. // message.warning(errDep.join(',') + '(单位)的风险准则已启用,请重新选择', 1)
  589. // } else {
  590. // if (!isErr) {
  591. // this.$refs.docform.saveBtnClick()
  592. // }
  593. // }
  594. // })
  595. }
  596. })
  597. }, 0)
  598. },
  599. checkDegreeTableData() {
  600. this.canSumibt = true
  601. this.errorField = []
  602. // 判断是否有未填项目
  603. this.degreeData.forEach((item, index) => {
  604. for (const key in item) {
  605. if (!item[key]) {
  606. this.errorField[key + '-' + index] = true
  607. } else {
  608. this.errorField[key + '-' + index] = false
  609. }
  610. }
  611. })
  612. for (const key in this.errorField) {
  613. if (this.errorField[key]) {
  614. this.canSumibt = false
  615. }
  616. }
  617. },
  618. // 检查分值不能冲突
  619. checkRiskLevelEntitys() {
  620. const levelData = this.$refs.docform.getFieldValue('riskLevelEntitys')
  621. const errorStr = []
  622. const firstMin = parseFloat(levelData[0].minNum)
  623. const firstMax = parseFloat(levelData[0].maxNum)
  624. const secondMin = parseFloat(levelData[1].minNum)
  625. const secondMax = parseFloat(levelData[1].maxNum)
  626. const threeMin = parseFloat(levelData[2].minNum)
  627. const threeMax = parseFloat(levelData[2].maxNum)
  628. if (firstMin > firstMax) {
  629. errorStr.push('高风险最小值不能大于最大值')
  630. }
  631. if (secondMin > secondMax) {
  632. errorStr.push('中风险最小值不能大于最大值')
  633. }
  634. if (threeMin > threeMax) {
  635. errorStr.push('低风险最小值不能大于最大值')
  636. }
  637. if (firstMin <= secondMax) {
  638. errorStr.push('高风险最小值不能小于或等于中风险最大值')
  639. }
  640. if (secondMin <= threeMax) {
  641. errorStr.push('中风险最小值不能小于或等于低风险最大值')
  642. }
  643. if (errorStr.length > 0) {
  644. Modal.warning({
  645. title: '风险等级分值',
  646. content: (h) => {
  647. const info = []
  648. errorStr.forEach((item, index) => {
  649. info.push(index + 1 + '.' + item)
  650. info.push(h('br'))
  651. })
  652. return h('div', null, info)
  653. },
  654. })
  655. return false
  656. }
  657. return true
  658. },
  659. inputChange(e, fieldName) {
  660. // 输入框变化时
  661. if ((e.currentTarget.value === '') | !e.currentTarget.value) {
  662. this.errorField[fieldName] = true
  663. } else {
  664. this.errorField[fieldName] = false
  665. }
  666. // this.checkDegreeTableData()
  667. },
  668. // 获取风险影响程度数据
  669. fnGetDegreeTableData(model) {
  670. const [sequence, score1, score2, score3, score4, score5] = this.degreeData
  671. const tableData = model.riskDegreeEntitys || []
  672. if (tableData.length > 0) {
  673. this.degreeIndex = 1
  674. }
  675. tableData.forEach((item) => {
  676. if (this.degreeIndex !== 1) {
  677. // 增加下标
  678. this.degreeColumns.push({
  679. dataIndex: 'field' + this.degreeIndex,
  680. title: 'field' + this.degreeIndex,
  681. })
  682. this.degreeFields.push({
  683. dataType: 'string',
  684. caption: 'field' + this.degreeIndex,
  685. name: 'field' + this.degreeIndex,
  686. required: true,
  687. })
  688. }
  689. this.childTableId['field' + this.degreeIndex] = item.id
  690. sequence['field' + this.degreeIndex] = item.sequence
  691. score1['field' + this.degreeIndex] = item.score1
  692. score2['field' + this.degreeIndex] = item.score2
  693. score3['field' + this.degreeIndex] = item.score3
  694. score4['field' + this.degreeIndex] = item.score4
  695. score5['field' + this.degreeIndex] = item.score5
  696. this.degreeIndex++
  697. })
  698. },
  699. // 设置风险影响程度数据
  700. fnSetDegreeTableData() {
  701. const [sequence, score1, score2, score3, score4, score5] = this.degreeData
  702. const submitTableData = []
  703. this.degreeColumns.forEach((item, index) => {
  704. if (index < 1) return
  705. submitTableData.push({
  706. sequence: sequence[item.dataIndex] ? sequence[item.dataIndex] : '',
  707. score1: score1[item.dataIndex] ? score1[item.dataIndex] : '',
  708. score2: score2[item.dataIndex] ? score2[item.dataIndex] : '',
  709. score3: score3[item.dataIndex] ? score3[item.dataIndex] : '',
  710. score4: score4[item.dataIndex] ? score4[item.dataIndex] : '',
  711. score5: score5[item.dataIndex] ? score5[item.dataIndex] : '',
  712. id: this.childTableId[item.dataIndex] ? this.childTableId[item.dataIndex] : null,
  713. criteriaId: this.$refs.docform.getFieldValue('id'),
  714. })
  715. })
  716. if (submitTableData.length > 0) {
  717. this.$refs.docform.setFieldValue('riskDegreeEntitys', submitTableData)
  718. } else {
  719. this.$refs.docform.setFieldValue('riskDegreeEntitys', [])
  720. }
  721. },
  722. // 重画表格表头
  723. fnSetLevelTableHeader() {
  724. document.querySelector('.level-child_risk-criteria-form_product table thead').innerHTML = `
  725. <tr>
  726. <th class="header-cell_sd-resizable-th_common ant-table-row-cell-break-word" rowspan="2" style="width:100px" key="score">序号</th>
  727. <th class="header-cell_sd-resizable-th_common ant-table-row-cell-break-word" rowspan="2" key="riskLevel">风险等级</th>
  728. <th class="header-cell_sd-resizable-th_common ant-table-row-cell-break-word" colspan="2">评估区间</th>
  729. </tr>
  730. <tr>
  731. <th class="header-cell_sd-resizable-th_common ant-table-row-cell-break-word"><label class="ant-form-item-required">最小值(含等于)</label></th>
  732. <th class="header-cell_sd-resizable-th_common ant-table-row-cell-break-word"><label class="ant-form-item-required">最大值(含等于)</label></th>
  733. </tr>
  734. `
  735. document.querySelector(
  736. '.level-child_risk-criteria-form_product table colgroup'
  737. ).innerHTML = `<col style="width: 100px; min-width: 100px;"><col style=""><col style=""><col style="">`
  738. },
  739. },
  740. }
  741. </script>
  742. <style module lang="scss">
  743. @use '@/common/design' as *;
  744. @import '@/webflow/sd-flow-form.scss';
  745. .btnselect {
  746. position: relative;
  747. top: 4px;
  748. right: 200px;
  749. float: right;
  750. .batchselect {
  751. z-index: 100;
  752. margin-left: 10px;
  753. }
  754. }
  755. .tablexm tr td {
  756. border: none !important;
  757. }
  758. .poss-child {
  759. :global(.header_xm-child-table_product) {
  760. display: none;
  761. }
  762. :global(.menu_sd-table-header_common) {
  763. display: none;
  764. }
  765. }
  766. .level-child {
  767. :global(.ant-input-number) {
  768. width: 100%;
  769. }
  770. }
  771. .dgree-child {
  772. tr:first-child {
  773. background: #fafafa;
  774. font-weight: bold;
  775. color: #000;
  776. td {
  777. border-top: none !important;
  778. border-right: none !important;
  779. border-left: none !important;
  780. }
  781. }
  782. .title-span {
  783. display: flex;
  784. .title-checkbox {
  785. margin-right: 10px;
  786. }
  787. }
  788. .require_input_xm {
  789. border: 1px solid #e02020;
  790. }
  791. }
  792. .require_div_xm {
  793. color: #e02020;
  794. }
  795. .require_div_none_xm {
  796. display: none;
  797. }
  798. </style>