xm-spic-problem-form.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <span>
  3. <audit-form-top-banner
  4. :handel-save-form="saveForm"
  5. :handel-publish="handelPublish"
  6. :form-data="mode"
  7. @handelSaveForm="saveForm"
  8. @handelPublish="handelPublish"
  9. >
  10. <div class="ant-card ant-card-small">
  11. <div :class="$style.antCardBody">
  12. <sd-detail-form
  13. ref="docform"
  14. page-id="audit/spicproblem/spicProblem"
  15. form-id="spicProblem"
  16. :record-id="this.$route.query.id ? parseInt(this.$route.query.id) : null"
  17. :class="[$style.form]"
  18. :read-only="this.mode === 'VIEW'"
  19. @close="close(true)"
  20. @saved="saved"
  21. @sdFormReady="sdFormReady"
  22. >
  23. <template v-slot="{ model, fields }">
  24. <table>
  25. <tr>
  26. <td>
  27. <audit-advanced-group
  28. :expand="basicExpand"
  29. :expand-str="'basicExpand'"
  30. :group-label="'基本信息'"
  31. tablestyle="''"
  32. @changedClick="changedClick"
  33. >
  34. </audit-advanced-group>
  35. </td>
  36. </tr>
  37. </table>
  38. <table v-show="basicExpand" :class="$style.table">
  39. <colgroup>
  40. <col :class="$style.label" />
  41. <col :class="$style.input" />
  42. <col :class="$style.label" />
  43. <col :class="$style.input" />
  44. </colgroup>
  45. <tr>
  46. <sd-form-item-td name="docTitle" :label="'案例名称'" />
  47. <sd-form-item-td name="problemNumber" :label="'案例编号'">
  48. <template v-slot>
  49. <a-input
  50. v-model="model.problemNumber"
  51. placeholder="自动生成"
  52. read-only
  53. ></a-input> </template
  54. ></sd-form-item-td>
  55. </tr>
  56. <tr>
  57. <sd-form-item-td name="problemDesc" :colspan="3" :label="'描述'">
  58. <a-textarea
  59. v-model="model.problemDesc"
  60. placeholder="请输入"
  61. :auto-size="{ minRows: 3, maxRows: 5 }"
  62. />
  63. </sd-form-item-td>
  64. </tr>
  65. <tr>
  66. <!-- 审计处理意见 -->
  67. <sd-form-item-td name="iamBasis" :colspan="3" :label="'审计依据'">
  68. <a-textarea v-model="model.iamBasis" :rows="3" />
  69. </sd-form-item-td>
  70. </tr>
  71. <tr>
  72. <!-- 审计建议 -->
  73. <sd-form-item-td name="suggestion" :colspan="3">
  74. <a-textarea v-model="model.suggestion" :rows="3" />
  75. </sd-form-item-td>
  76. </tr>
  77. <tr>
  78. <!-- 作者 -->
  79. <sd-form-item-td name="creatorName" />
  80. <!-- 所属部门 -->
  81. <sd-form-item-td name="creationTime" />
  82. <sd-form-item-td v-if="initParam('parentId')" :hidden="true" name="parentId" />
  83. </tr>
  84. <tr>
  85. <!-- 附件 -->
  86. <sd-form-item-td name="attach" :colspan="3">
  87. <template v-slot:read-and-edit="{ editable }">
  88. <sd-attachment
  89. v-model="model.attach"
  90. :group-id="JSON.parse(fields.attach.value).value"
  91. :read-only="!editable"
  92. ></sd-attachment>
  93. </template>
  94. </sd-form-item-td>
  95. </tr>
  96. <tr>
  97. <sd-form-item-td name="state" :hidden="true" />
  98. </tr>
  99. </table>
  100. </template>
  101. </sd-detail-form>
  102. </div>
  103. </div>
  104. </audit-form-top-banner>
  105. <audit-matters-select-modal
  106. :visible="visible"
  107. :org-id="orgId"
  108. @listSelected="listSelected"
  109. ></audit-matters-select-modal>
  110. </span>
  111. </template>
  112. <script>
  113. import { Message, Modal } from 'ant-design-vue'
  114. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  115. import auditFormTopBanner from '@product/iam/components/audit-form-top-banner'
  116. import auditAdvancedGroup from '@product/iam/components/audit-advanced-group.vue'
  117. import auditAdvancedGroupMixins from '@product/iam/components/audit-advanced-group-mixins'
  118. import auditMattersSelectModal from '@product/iam/audit/matters/audit-matters-select-modal.vue'
  119. import XmChildTable from '@product/iam/components/xm-child-table.vue'
  120. import problemService from './xm-spic-problem-service.js'
  121. import components from './_import-components/xm-spic-problem-form-import'
  122. export default {
  123. name: 'XmSpicProblemForm',
  124. metaInfo: {
  125. title: '审计案例',
  126. },
  127. components: {
  128. auditFormTopBanner,
  129. ...components,
  130. auditAdvancedGroup,
  131. auditMattersSelectModal,
  132. },
  133. mixins: [auditAdvancedGroupMixins],
  134. data() {
  135. return {
  136. isHidden: true,
  137. publish: 0, // 为1 时是发布
  138. defaultCategory: '',
  139. labelArray: [],
  140. mode: null,
  141. publishFlag: false,
  142. basicExpand: true,
  143. visible: false,
  144. CheckExpand: true,
  145. orgId: null,
  146. checkChildColumns: [
  147. { dataIndex: 'lawsLibraryId', sdHidden: true },
  148. { dataIndex: 'lawsType', sdHidden: true },
  149. { dataIndex: 'lawsTitle', sdHidden: false, width: '40%' },
  150. { dataIndex: 'lawsDocNumber', sdHidden: false, width: '15%' },
  151. { dataIndex: 'lawsChapter', sdHidden: false },
  152. {
  153. title: '序号',
  154. dataIndex: 'sortNum',
  155. width: '80px',
  156. customRender: (text, record, index) => `${index + 1}`,
  157. },
  158. ],
  159. }
  160. },
  161. created() {},
  162. mounted() {},
  163. methods: {
  164. changeNum(data) {
  165. data.forEach((item, index) => {
  166. item.sortNum = index + 1
  167. })
  168. },
  169. handleBeforeAdd(val, callback) {
  170. const fileCode = this.$refs.docform.getFieldValue('problemNumber')
  171. if (fileCode && fileCode !== '') {
  172. callback(false)
  173. } else {
  174. // 生成案例编号
  175. problemService.getFileCode().then((res) => {
  176. this.$refs.docform.setFieldValue('problemNumber', res.data)
  177. callback(false)
  178. })
  179. }
  180. },
  181. // 页面加载完成后
  182. sdFormReady() {
  183. debugger
  184. // this.mode = this.$refs.docform.formData.mode
  185. this.mode = this.$route.query.mode
  186. },
  187. handleChange(model, event) {
  188. model.label = event.join('、')
  189. this.labelArray = [...event]
  190. },
  191. handelPublish() {
  192. this.handleBeforeAdd(null, (res) => {
  193. this.$refs.docform.validateFields().then(() => {
  194. Modal.confirm({
  195. title: '提示',
  196. content: '请确认是否发布当前数据',
  197. onOk: () => {
  198. // 发布,保存
  199. this.$refs.docform.setFieldValue('state', '已发布')
  200. this.publish = 1
  201. this.saveForm()
  202. Message.success('发布成功', 1).then((res) => {
  203. this.close(true)
  204. })
  205. },
  206. onCancel: () => {},
  207. })
  208. })
  209. })
  210. // this.$refs.docform.validateFields().then(() => {
  211. // Modal.confirm({
  212. // title: '提示',
  213. // content: '请确认是否发布当前数据',
  214. // onOk: () => {
  215. // // 发布,保存
  216. // this.$refs.docform.setFieldValue('state', '已发布')
  217. // this.publish = 1
  218. // this.saveForm()
  219. // Message.success('发布成功', 1).then((res) => {
  220. // this.close(true)
  221. // })
  222. // },
  223. // onCancel: () => {},
  224. // })
  225. // })
  226. },
  227. saveForm() {
  228. this.handleBeforeAdd(null, (res) => {
  229. this.$refs.docform.saveBtnClick()
  230. })
  231. return true
  232. },
  233. saved() {
  234. Message.success({ content: '保存成功!' }).then(() => {
  235. this.close(true)
  236. })
  237. },
  238. initParam(val) {
  239. setTimeout(() => {
  240. var flow = this.$refs.docform
  241. if (
  242. flow.getFieldValue('parentId') === null ||
  243. flow.getFieldValue('parentId') === undefined ||
  244. flow.getFieldValue('parentId') === ''
  245. ) {
  246. if (this.$route.query?.typeId) {
  247. this.$refs.docform.setFieldValue('parentId', this.$route.query.typeId)
  248. }
  249. }
  250. }, 0)
  251. return true
  252. },
  253. close(flag) {
  254. crossWindowWatcher.notifyChange(this.$route.path, flag)
  255. window.close()
  256. },
  257. validForm() {
  258. return new Promise((resolve, reject) => {
  259. resolve(true)
  260. })
  261. },
  262. // 选择法律制度
  263. lawsRelSelect() {
  264. // 选择事项分类
  265. this.visible = true
  266. },
  267. listSelected(keys, keyinfos) {
  268. let iamAuditLaws = []
  269. if (this.$refs.docform.getFieldValue('iamAuditLawsRelEntitys')) {
  270. iamAuditLaws = this.$refs.docform.getFieldValue('iamAuditLawsRelEntitys')
  271. }
  272. keyinfos.forEach((element) => {
  273. const mmc = {}
  274. mmc.lawsTitle = element.docTitle
  275. mmc.lawsDocNumber = element.dispatchWord ? element.dispatchWord : ''
  276. mmc.lawsChapter = ''
  277. mmc.lawsArticle = ''
  278. iamAuditLaws.push(mmc)
  279. })
  280. this.$refs.docform.setFieldValue('iamAuditLawsRelEntitys', iamAuditLaws)
  281. },
  282. },
  283. }
  284. </script>
  285. <style module lang="scss">
  286. @import '@/webflow/sd-flow-form.scss';
  287. .ant-card-body {
  288. padding: 12px;
  289. :global(.buttons_sd-detail-form_common) {
  290. :global(.ant-form-item-control-wrapper) {
  291. padding-top: 4%;
  292. padding-left: 24%;
  293. }
  294. }
  295. .tr_border {
  296. box-sizing: border-box;
  297. border-right: 1px solid #e8e8e8;
  298. border-left: 1px solid #e8e8e8;
  299. }
  300. :global(.title_sd-detail-form_common) {
  301. font-size: 1.5em;
  302. text-align: center;
  303. }
  304. }
  305. .btnselect {
  306. position: relative;
  307. top: 4px;
  308. right: 200px;
  309. float: right;
  310. .batchselect {
  311. z-index: 100;
  312. margin-left: 10px;
  313. }
  314. }
  315. </style>