audit-matters-form.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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="audit/matters/iamAuditMatters"
  11. :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
  12. :class="$style.form"
  13. @close="close(true)"
  14. @saved="saved"
  15. @sdFormReady="sdFormReady"
  16. >
  17. <template v-slot="{ model, fields }">
  18. <table>
  19. <tr>
  20. <!-- 审计事项编号 -->
  21. <sd-form-item-td name="auditMattersCode">
  22. <a-form-model-item
  23. :rules="[
  24. {
  25. validator: validator,
  26. trigger: ['change', 'blur'],
  27. },
  28. ]"
  29. prop="auditMattersCode"
  30. name="auditMattersCode"
  31. >
  32. <a-input v-model.trim="model.auditMattersCode" />
  33. </a-form-model-item>
  34. </sd-form-item-td>
  35. <!-- 审计事项名称 -->
  36. <sd-form-item-td name="auditMattersName" />
  37. </tr>
  38. <tr>
  39. <!-- 风险点名称 -->
  40. <sd-form-item-td name="riskPointName" :colspan="3" />
  41. </tr>
  42. <sd-form-item-td v-if="initParam(model)" :hidden="true" name="catalogId" />
  43. <sd-form-item-td :hidden="true" name="catalogName" />
  44. <sd-form-item-td :hidden="true" name="auditMattersPath" />
  45. <sd-form-item-td :hidden="true" name="orgId" />
  46. <!-- 风险点描述 -->
  47. <tr>
  48. <sd-form-item-td name="riskPointDesc" :colspan="3">
  49. <a-textarea v-model="model.riskPointDesc" :rows="3" />
  50. </sd-form-item-td>
  51. </tr>
  52. <tr>
  53. <!-- 检查资料 -->
  54. <sd-form-item-td name="checkMaterial" :colspan="3">
  55. <a-textarea v-model="model.checkMaterial" :rows="3" />
  56. </sd-form-item-td>
  57. </tr>
  58. <tr>
  59. <sd-form-item-td name="creatorName" />
  60. <sd-form-item-td name="creationTime" />
  61. </tr>
  62. <tr
  63. ><td :colspan="4">
  64. <sd-form-item name="iamAuditProcedureEntitys" :label="null">
  65. <template v-slot:read-and-edit="{ editable }">
  66. <audit-advanced-group
  67. :expand="expandC"
  68. :expand-str="'expandC'"
  69. :group-label="'审计程序'"
  70. @changedClick="changedClick"
  71. ><template>
  72. <xm-child-table
  73. ref="docformProcedure"
  74. v-model="model.iamAuditProcedureEntitys"
  75. :read-only="!editable"
  76. label=""
  77. :fields="
  78. [
  79. {
  80. caption: '序号',
  81. name: 'sortNum',
  82. dataType: 'number',
  83. attr: {},
  84. },
  85. ].concat(Array.from(fields.iamAuditProcedureEntitys.attr.dync))
  86. "
  87. :columns="childColumns"
  88. :width="1200"
  89. >
  90. </xm-child-table>
  91. </template>
  92. </audit-advanced-group>
  93. </template> </sd-form-item
  94. ></td>
  95. </tr>
  96. <tr
  97. ><td :colspan="4">
  98. <sd-form-item name="iamAuditLawsRelEntitys" :label="null">
  99. <template v-slot:read-and-edit="{ editable }">
  100. <audit-advanced-group
  101. :expand="expandY"
  102. :expand-str="'expandY'"
  103. :group-label="'法律制度依据'"
  104. @changedClick="changedClick"
  105. ><template>
  106. <template>
  107. <div :class="$style.wrapper">
  108. <div v-show="expandY && editable" :class="$style.btnselect">
  109. <a-button
  110. type="link"
  111. :class="$style.batchselect"
  112. @click="lawsRelSelect"
  113. >
  114. <a-icon type="check-circle" :theme="'filled'" />
  115. 选择
  116. </a-button>
  117. </div>
  118. </div>
  119. </template>
  120. <xm-child-table
  121. ref="docformLawsRel"
  122. v-model="model.iamAuditLawsRelEntitys"
  123. :read-only="!editable"
  124. label=""
  125. :fields="
  126. [
  127. {
  128. caption: '序号',
  129. name: 'sortNum',
  130. dataType: 'number',
  131. attr: {},
  132. },
  133. ].concat(Array.from(fields.iamAuditLawsRelEntitys.attr.dync))
  134. "
  135. :columns="childLawsColumns"
  136. :width="1200"
  137. >
  138. </xm-child-table
  139. ></template>
  140. </audit-advanced-group>
  141. </template> </sd-form-item
  142. ></td>
  143. </tr>
  144. </table>
  145. </template>
  146. </sd-detail-form>
  147. </audit-form-top-banner>
  148. <audit-matters-select-modal
  149. :visible="visible"
  150. :org-id="null"
  151. @listSelected="listSelected"
  152. ></audit-matters-select-modal>
  153. </span>
  154. </template>
  155. <script>
  156. import { Message } from 'ant-design-vue'
  157. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  158. import debounce from 'lodash.debounce'
  159. import axios from '@/common/services/axios-instance'
  160. import auditFormTopBanner from '../../components/audit-form-top-banner'
  161. import auditAdvancedGroup from '../../components/audit-advanced-group.vue'
  162. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  163. import auditMattersSelectModal from './audit-matters-select-modal.vue'
  164. import components from './_import-components/audit-matters-form-import'
  165. export default {
  166. name: 'AuditMattersForm',
  167. metaInfo: {
  168. title: '审计事项',
  169. },
  170. components: {
  171. ...components,
  172. auditFormTopBanner,
  173. auditAdvancedGroup,
  174. auditMattersSelectModal,
  175. },
  176. mixins: [auditAdvancedGroupMixins],
  177. data() {
  178. return {
  179. expandC: true,
  180. mode: null,
  181. expandY: true,
  182. visible: false,
  183. orgId: this.$route.query.orgId,
  184. childColumns: [
  185. {
  186. title: '序号',
  187. dataIndex: 'sortNum',
  188. width: '80px',
  189. customRender: (text, record, index) => `${index + 1}`,
  190. },
  191. { dataIndex: 'id', sdHidden: true },
  192. { dataIndex: 'stepName', width: '60%' },
  193. { dataIndex: 'importance', width: '100px' },
  194. { dataIndex: 'attachment' },
  195. ],
  196. childLawsColumns: [
  197. {
  198. title: '序号',
  199. dataIndex: 'sortNum',
  200. width: '80px',
  201. customRender: (text, record, index) => `${index + 1}`,
  202. },
  203. { dataIndex: 'id', sdHidden: true },
  204. { dataIndex: 'lawsLibraryId', sdHidden: true },
  205. { dataIndex: 'lawsType', sdHidden: true },
  206. {
  207. dataIndex: 'lawsTitle',
  208. width: '40%',
  209. },
  210. { dataIndex: 'lawsDocNumber', width: '15%' },
  211. { dataIndex: 'lawsArticle' },
  212. ],
  213. }
  214. },
  215. created() {},
  216. methods: {
  217. // 页面加载完成后
  218. sdFormReady() {
  219. this.mode = this.$refs.docform.formData.mode
  220. },
  221. validator(rule, value, callback) {
  222. let id = -1
  223. if (this.$route.query.record) {
  224. id = this.$route.query.record
  225. }
  226. value = encodeURIComponent(value)
  227. this.orgId = this.$refs.docform.getFieldValue('orgId')
  228. const url =
  229. `api/xcoa-mobile/v1/iam-audit-matters/check-category-code?catalogCode=${value}&orgId=${this.orgId}&id=` +
  230. id
  231. debounce(() => {
  232. axios.get(url).then((res) => {
  233. if (res.data) {
  234. callback()
  235. } else {
  236. callback('已存在事项编码,不可以重复')
  237. }
  238. })
  239. }, 500)()
  240. },
  241. close(flag) {
  242. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  243. window.close()
  244. },
  245. saved() {
  246. Message.success({ content: '保存成功!' }, 1).then(() => {
  247. this.close(true)
  248. })
  249. },
  250. // 保存
  251. saveForm() {
  252. this.$refs.docform.validateFields().then((res) => {
  253. // 校验动态子表
  254. })
  255. this.$refs.docformProcedure.valid().then((res) => {
  256. // 校验动态子表
  257. if (res) {
  258. this.$refs.docformLawsRel.valid().then((res) => {
  259. // 校验动态子表
  260. if (res) {
  261. this.$refs.docform.saveBtnClick()
  262. } else {
  263. return false
  264. }
  265. })
  266. } else {
  267. this.$refs.docformLawsRel.valid().then((res) => {
  268. // 校验动态子表
  269. })
  270. return false
  271. }
  272. })
  273. },
  274. initParam(model) {
  275. // 设置父id
  276. const catalogId = this.$route.query.catalogId
  277. const catalogName = this.$route.query.catalogName
  278. const auditMattersPath = this.$route.query.auditMattersPath
  279. const orgId = this.$route.query.orgId
  280. if (catalogId) {
  281. model.catalogId = Number(catalogId)
  282. }
  283. if (catalogName) {
  284. model.catalogName = catalogName
  285. }
  286. if (auditMattersPath) {
  287. model.auditMattersPath = auditMattersPath
  288. }
  289. if (orgId) {
  290. model.orgId = orgId
  291. }
  292. },
  293. // 序号赋值
  294. changeNum(data) {
  295. data.forEach((item, index) => {
  296. item.sortNum = index + 1
  297. })
  298. },
  299. // 选择法律制度
  300. lawsRelSelect() {
  301. // 选择事项分类
  302. this.visible = true
  303. },
  304. listSelected(keys, keyinfos) {
  305. let iamAuditLaws = []
  306. if (this.$refs.docform.getFieldValue('iamAuditLawsRelEntitys')) {
  307. iamAuditLaws = this.$refs.docform.getFieldValue('iamAuditLawsRelEntitys')
  308. }
  309. keyinfos.forEach((element) => {
  310. const mmc = {}
  311. mmc.lawsTitle = element.docTitle
  312. mmc.lawsDocNumber = element.dispatchWord ? element.dispatchWord : ''
  313. mmc.lawsArticle = ''
  314. iamAuditLaws.push(mmc)
  315. })
  316. this.$refs.docform.setFieldValue('iamAuditLawsRelEntitys', iamAuditLaws)
  317. },
  318. },
  319. }
  320. </script>
  321. <style module lang="scss">
  322. @use '@/common/design' as *;
  323. @import '@/webflow/sd-flow-form.scss';
  324. .btnselect {
  325. position: relative;
  326. top: 2px;
  327. right: 200px;
  328. float: right;
  329. .batchselect {
  330. z-index: 100;
  331. margin-left: 10px;
  332. }
  333. }
  334. </style>