iam-ic-rectify-require-form.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <div>
  3. <sd-webflow
  4. ref="flow"
  5. :removed-tabs="['sdRelatedDoc']"
  6. :validate-form="validForm"
  7. :class="$style.mainForm"
  8. >
  9. <template v-slot:form="{ model, fields }">
  10. <table>
  11. <tr>
  12. <td style="border: none">
  13. <audit-advanced-group
  14. :expand="planExpand"
  15. :expand-str="'planExpand'"
  16. :group-label="'基本信息'"
  17. tablestyle="''"
  18. @changedClick="changedClick"
  19. ></audit-advanced-group>
  20. </td>
  21. </tr>
  22. </table>
  23. <table v-show="planExpand">
  24. <tr>
  25. <!-- 整改名称 -->
  26. <sd-form-item-td name="rectName" />
  27. <!-- 整改要求编号 -->
  28. <sd-form-item-td name="rectCode">
  29. <template v-slot:read-and-edit>
  30. {{ model.rectCode }}
  31. </template>
  32. </sd-form-item-td>
  33. </tr>
  34. <tr>
  35. <!-- 整改计划反馈截止日期 -->
  36. <td class="ant-form-item-label ant-form-item-label">
  37. <label
  38. title="整改计划反馈截止日期"
  39. :class="fields.feedbackDate.required ? 'ant-form-item-required' : ''"
  40. >
  41. 整改计划反馈<br />{{ '截\u2002止\u2003日\u2002期' }}
  42. </label>
  43. </td>
  44. <sd-form-item-td
  45. name="feedbackDate"
  46. :colspan="3"
  47. :label="'整改计划反馈截止日期'"
  48. :label-td-attrs="{ hidden: true }"
  49. >
  50. </sd-form-item-td>
  51. </tr>
  52. <tr>
  53. <!-- 附件 -->
  54. <sd-form-item-td name="attachment" :colspan="3" />
  55. </tr>
  56. <tr>
  57. <!-- 报告内容 -->
  58. <sd-form-item-td name="rectRequire" :colspan="3">
  59. <a-textarea v-model="model.rectRequire" :auto-size="{ maxRows: 3, minRows: 3 }" />
  60. </sd-form-item-td>
  61. </tr>
  62. <tr>
  63. <!-- 创建人 -->
  64. <sd-form-item-td name="creatorName" />
  65. <!-- 创建日期 -->
  66. <sd-form-item-td name="creationTime" />
  67. </tr>
  68. </table>
  69. <table>
  70. <tr
  71. ><td :colspan="4">
  72. <sd-form-item name="icRequireDefectEntity" :label="null">
  73. <template v-slot:read-and-edit="{ editable }">
  74. <audit-advanced-group
  75. :expand="listExpand"
  76. :expand-str="'listExpand'"
  77. group-label="缺陷列表"
  78. @changedClick="changedClick"
  79. >
  80. <template>
  81. <template>
  82. <div :class="$style.wrapper">
  83. <div v-show="listExpand && editable" :class="$style.btnselect">
  84. <a-button
  85. type="link"
  86. :class="$style.batchselectFirst"
  87. @click="rectSelect"
  88. >
  89. <a-icon type="check-circle" :theme="'filled'" />
  90. 选择缺陷
  91. </a-button>
  92. <a-button
  93. :disabled="btnDisabled"
  94. type="link"
  95. :class="$style.batchselectThree"
  96. @click="selectUser('lxr')"
  97. >
  98. <a-icon type="check-circle" :theme="'filled'" />
  99. 设置整改联系人
  100. </a-button>
  101. <a-button
  102. :disabled="btnDisabled"
  103. type="link"
  104. :class="$style.batchselectSecond"
  105. @click="selectUser('gzr')"
  106. >
  107. <a-icon type="check-circle" :theme="'filled'" />
  108. 设置整改跟踪人
  109. </a-button>
  110. </div>
  111. </div>
  112. </template>
  113. <xm-child-table
  114. :key="infoKey"
  115. ref="infoData"
  116. v-model="model.icRequireDefectEntity"
  117. :class="$style.deptPlanChild"
  118. :label="null"
  119. :read-only="!editable"
  120. :addbuttonvisiable="false"
  121. :fields="
  122. [
  123. {
  124. caption: '序号',
  125. name: 'sortNum',
  126. dataType: 'number',
  127. },
  128. ].concat(Array.from(fields.icRequireDefectEntity.attr.dync))
  129. "
  130. :columns="defectColumns"
  131. :flagpage="true"
  132. @onSelectChange="onSelectChange"
  133. @deleted="deletedInfoData"
  134. >
  135. <!-- 流程名称 -->
  136. <template v-slot:prcName_xm="{ text, record, field, value }">
  137. {{ text }}
  138. </template>
  139. <!-- 控制点名称 -->
  140. <template v-slot:measureName_xm="{ text, record, field, value }">
  141. {{ text }}
  142. </template>
  143. <!-- 控制点编号 -->
  144. <template v-slot:measureCode_xm="{ text, record, field, value }">
  145. {{ text }}
  146. </template>
  147. <!-- 测试结果 -->
  148. <template v-slot:testResult_xm="{ text, record, field, value }">
  149. {{ text }}
  150. </template>
  151. <!-- 缺陷类型 -->
  152. <template v-slot:defectType_xm="{ text, record, field, value }">
  153. {{ text }}
  154. </template>
  155. <!-- 缺陷等级 -->
  156. <template v-slot:defectLevel_xm="{ text, record, field, value }">
  157. {{ text }}
  158. </template>
  159. <!-- 整改测试人 -->
  160. <template v-slot:rectContactName_xm="{ text, record, field, value }">
  161. {{ text }}
  162. </template>
  163. <!-- 整改跟踪人 -->
  164. <template v-slot:rectTrackerName_xm="{ text, record, field, value }">
  165. {{ text }}
  166. </template>
  167. </xm-child-table>
  168. </template>
  169. </audit-advanced-group>
  170. </template>
  171. </sd-form-item>
  172. </td>
  173. </tr>
  174. </table>
  175. </template>
  176. </sd-webflow>
  177. <!-- 选择人员组件 -->
  178. <div v-show="false">
  179. <sd-user-picker ref="userSelect" :single="true" :read-only="false" @change="userChange" />
  180. </div>
  181. <a-modal
  182. :destroy-on-close="true"
  183. title="请选择"
  184. width="1500px"
  185. :visible="rectVisible"
  186. dialog-class="rectListModal"
  187. @ok="handleOk"
  188. @cancel="handleCancel"
  189. >
  190. <iam-ic-defect-statement-list ref="rectList"></iam-ic-defect-statement-list>
  191. </a-modal>
  192. <!-- 重复提示 -->
  193. <a-modal
  194. width="30%"
  195. :visible="modalVisible"
  196. title="存在重复数据"
  197. @ok="modalHandleOk"
  198. @cancel="modalHandleOk"
  199. >
  200. <template v-slot:footer>
  201. <a-button key="submit" type="primary" @click="modalHandleOk">确定</a-button>
  202. </template>
  203. <p v-html="modalInfoHtml"></p>
  204. </a-modal>
  205. </div>
  206. </template>
  207. <script>
  208. import { message } from '@/common/one-ui'
  209. import auditAdvancedGroup from '@product/iam/components/audit-advanced-group.vue'
  210. import auditAdvancedGroupMixins from '@product/iam/components/audit-advanced-group-mixins'
  211. import iamIcDefectStatementList from './iam-ic-defect-statement-list.vue'
  212. import IamIcRectifyRequireServices from './iam-ic-rectify-require-service'
  213. import components from './_import-components/iam-ic-rectify-require-form-import'
  214. export default {
  215. name: 'IamIcRectifyRequireForm',
  216. metaInfo: {
  217. title: '整改要求',
  218. },
  219. components: {
  220. ...components,
  221. auditAdvancedGroup,
  222. iamIcDefectStatementList,
  223. },
  224. mixins: [auditAdvancedGroupMixins],
  225. data() {
  226. return {
  227. selectKeys: [],
  228. btnDisabled: true,
  229. modalVisible: false,
  230. modalInfoHtml: '',
  231. selectDataId: [], // 已选择缺陷ID
  232. userType: null,
  233. infoKey: 0,
  234. rectVisible: false, // 缺陷清单列表显示
  235. planExpand: true,
  236. listExpand: true,
  237. defectColumns: [
  238. {
  239. title: '序号',
  240. dataIndex: 'sortNum',
  241. width: '80px',
  242. customRender: (text, record, index) => `${index + 1}`,
  243. },
  244. {
  245. dataIndex: 'prcName',
  246. title: '流程名称',
  247. width: '120px',
  248. },
  249. { dataIndex: 'measureName', title: '控制点名称' },
  250. { dataIndex: 'measureCode', title: '控制点编号' },
  251. { dataIndex: 'testResult', title: '测试结果' },
  252. { dataIndex: 'defectType', title: '缺陷类型' },
  253. { dataIndex: 'defectLevel', title: '缺陷等级' },
  254. { dataIndex: 'rectContactName', title: '整改联系人' },
  255. { dataIndex: 'rectTrackerName', title: '整改跟踪人' },
  256. { dataIndex: 'rectContactId', sdHidden: true },
  257. { dataIndex: 'rectContactAccount', sdHidden: true },
  258. { dataIndex: 'rectTrackerId', sdHidden: true },
  259. { dataIndex: 'rectTrackerAccount', sdHidden: true },
  260. { dataIndex: 'defectListId', sdHidden: true },
  261. { dataIndex: 'evaluationName', sdHidden: true },
  262. { dataIndex: 'liabilityOrgId', sdHidden: true },
  263. { dataIndex: 'liabilityOrgCode', sdHidden: true },
  264. { dataIndex: 'liabilityOrgName', sdHidden: true },
  265. { dataIndex: 'rectTrackerOpt', sdHidden: true },
  266. { dataIndex: 'rectContactOpt', sdHidden: true },
  267. { dataIndex: 'entryMethod', sdHidden: true },
  268. ],
  269. }
  270. },
  271. watch: {
  272. selectKeys(val) {
  273. if (val.length !== 0) {
  274. this.btnDisabled = false
  275. } else {
  276. this.btnDisabled = true
  277. }
  278. },
  279. },
  280. mounted() {},
  281. methods: {
  282. // 缺陷列表选择项
  283. onSelectChange(keys) {
  284. this.selectKeys = keys
  285. },
  286. // 选择缺陷
  287. rectSelect() {
  288. // 选择缺陷
  289. this.rectVisible = true
  290. },
  291. // 删除数据, 重新获取id
  292. deletedInfoData() {
  293. this.selectDataId = []
  294. let dataList = this.$refs.flow.getFieldValue('icRequireDefectEntity')
  295. if (!dataList) dataList = []
  296. dataList.forEach((item) => {
  297. this.selectDataId.push(item.defectListId)
  298. })
  299. },
  300. // 选择确认方法
  301. handleOk() {
  302. let dataList = this.$refs.flow.getFieldValue('icRequireDefectEntity')
  303. if (!dataList) dataList = []
  304. const titleList = []
  305. const selectRows = this.$refs.rectList.$refs.icDefectStatementList.getSelectedRows()
  306. selectRows.forEach((item) => {
  307. const info = {}
  308. info.prcName = item.prcName
  309. info.evaluationName = item.evaluationName
  310. info.defectListId = item.id
  311. info.measureName = item.measureName
  312. info.measureCode = item.measureCode
  313. info.defectType = item.defectType
  314. info.defectLevel = item.defectLevel
  315. info.testResult = item.testResult
  316. info.liabilityOrgId = item.liabilityOrgId
  317. info.liabilityOrgCode = item.liabilityOrgCode
  318. info.liabilityOrgName = item.liabilityOrgName
  319. info.controOrgId = item.controOrgId
  320. info.controOrgCode = item.controOrgCode
  321. info.controOrgName = item.controOrgName
  322. info.entryMethod = item.entryMethod
  323. // 重复数据不进行添加
  324. if (this.selectDataId.indexOf(item.id) === -1) {
  325. this.selectDataId.push(item.id)
  326. dataList.push(info)
  327. } else {
  328. titleList.push('流程名称:' + item.prcName + ',控制点名称:' + item.measureName + '<br>')
  329. }
  330. })
  331. if (titleList.length > 0) {
  332. this.modalInfoHtml = titleList.join('') + '已存在,请勿添加重复数据'
  333. this.modalVisible = true
  334. }
  335. this.$refs.flow.setFieldValue('icRequireDefectEntity', dataList)
  336. this.$refs.infoData.fnupdate(dataList)
  337. // 最后隐藏列表
  338. this.rectVisible = false
  339. },
  340. // 选择取消方法
  341. handleCancel() {
  342. this.rectVisible = false
  343. },
  344. modalHandleOk() {
  345. this.modalVisible = false
  346. },
  347. // 选择整改联系人和跟踪人
  348. selectUser(type) {
  349. const ids = this.$refs.infoData.selectedRowKeys
  350. if (ids.length === 0) {
  351. message.info('请选择缺陷列表数据', 1)
  352. return false
  353. }
  354. this.userType = type
  355. this.$refs.userSelect.openPicker()
  356. },
  357. // 人员选择变化时
  358. userChange(values) {
  359. const ids = this.$refs.infoData.selectedRowKeys
  360. const listVal = this.$refs.infoData.value
  361. const userObj = values[0]
  362. for (const index in ids) {
  363. if (this.userType === 'lxr') {
  364. listVal[ids[index]].rectContactName = userObj.name
  365. listVal[ids[index]].rectContactAccount = userObj.code
  366. listVal[ids[index]].rectContactOpt = JSON.stringify(values)
  367. }
  368. if (this.userType === 'gzr') {
  369. listVal[ids[index]].rectTrackerName = userObj.name
  370. listVal[ids[index]].rectTrackerAccount = userObj.code
  371. listVal[ids[index]].rectTrackerOpt = JSON.stringify(values)
  372. }
  373. }
  374. this.$refs.flow.setFieldValue('icRequireDefectEntity', listVal)
  375. this.$refs.infoData.fnupdate(listVal)
  376. },
  377. // 获取用户姓名
  378. getUserName(jsonStr) {
  379. if (!jsonStr) return ''
  380. return jsonStr[0].name
  381. },
  382. selectclick() {
  383. return false
  384. },
  385. initData() {
  386. // 如果不是起草,则直接退出,不需要获取计划信息了
  387. if (!this.planId | this.isIni) return false
  388. this.isIni = true
  389. // 生成标题
  390. IamIcRectifyRequireServices.getPlanInfo(this.planId).then((res) => {
  391. if (res.status === 200) {
  392. const planTitle = res.data.pageFormData.pageFieldInfos.find((item) => {
  393. return item.name === 'evaluationName'
  394. }).value
  395. this.$refs.flow.setFieldValue('reportName', planTitle + '的内控评价报告')
  396. }
  397. })
  398. // 获取所有被评价单位
  399. IamIcRectifyRequireServices.getDvaluationDept(parseFloat(this.planId)).then((res) => {
  400. if (res.status === 200) {
  401. this.$refs.flow.setFieldValue('evaluatedUnitOpt', res.data)
  402. }
  403. })
  404. return false
  405. },
  406. actionBtnClick(evt, { button, FlowData }) {
  407. if (button.fakeId === 'save' || button.fakeId === 'workflow-push') {
  408. }
  409. },
  410. // 自定义校验
  411. validForm() {
  412. // 待办标题赋值
  413. this.$refs.flow.setFieldValue('title', this.$refs.flow.getFieldValue('rectName'))
  414. // 获取环节号
  415. const flowNum = this.$refs.flow.flowData.attrs.stepN
  416. // 起草环节才校验 校验是否选择了缺陷
  417. if (flowNum === 0) {
  418. let dataList = this.$refs.flow.getFieldValue('icRequireDefectEntity')
  419. if (!dataList) dataList = []
  420. if (dataList.length === 0) {
  421. message.info('请添加缺陷列表数据', 1)
  422. return Promise.resolve(false)
  423. } else {
  424. let submit = true
  425. dataList.forEach((item) => {
  426. if (!item.rectTrackerName | !item.rectContactName) {
  427. submit = false
  428. }
  429. })
  430. // 判断是否可以提交
  431. if (submit) {
  432. return Promise.resolve(true)
  433. } else {
  434. message.info('请设置缺陷列表内整改联系人以及整改跟踪人', 1)
  435. return Promise.resolve(false)
  436. }
  437. }
  438. } else {
  439. return Promise.resolve(true)
  440. }
  441. },
  442. },
  443. }
  444. </script>
  445. <style module lang="scss">
  446. @use '@/common/design' as *;
  447. :global(.modal-info-rectify-require) {
  448. :global(div.ant-modal) {
  449. width: 50% !important;
  450. }
  451. }
  452. .main-form {
  453. :global(.header_xm-child-table_product) {
  454. right: 340px;
  455. z-index: 101;
  456. }
  457. :global(.ant-calendar-picker) {
  458. width: 100%;
  459. }
  460. .btnselect {
  461. position: relative;
  462. top: 4px;
  463. float: right;
  464. z-index: 100;
  465. .batchselect-first {
  466. margin-right: 100px !important;
  467. }
  468. .batchselect-second {
  469. z-index: 100;
  470. }
  471. .batchselect-three {
  472. z-index: 100;
  473. }
  474. }
  475. }
  476. :global(.rectListModal) {
  477. :global(.ant-modal-body) {
  478. overflow-x: hidden;
  479. }
  480. }
  481. </style>