iam-audit-external-project-form.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <audit-form-top-banner
  3. :handel-save-form="saveForm"
  4. :handel-publish="publishflag ? handelPublish : null"
  5. :form-data="mode"
  6. @handelSaveForm="saveForm"
  7. @handelPublish="handelPublish"
  8. >
  9. <sd-detail-form
  10. ref="docform"
  11. page-id="audit/externalProject/iamExternalProject"
  12. :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
  13. :class="$style.form"
  14. @close="close(true)"
  15. @saved="saved"
  16. @sdFormReady="sdFormReady"
  17. >
  18. <template v-slot="{ model, fields }">
  19. <table
  20. ><tr
  21. ><td style="border:none">
  22. <audit-advanced-group
  23. :expand="basicExpand"
  24. :expand-str="'basicExpand'"
  25. :group-label="'基本信息'"
  26. tablestyle="''"
  27. @changedClick="changedClick"
  28. ></audit-advanced-group> </td></tr
  29. ></table>
  30. <table v-show="basicExpand">
  31. <tr v-show="false">
  32. <!-- id -->
  33. <sd-form-item-td name="id" />
  34. <sd-form-item-td name="randomId" :input-props="{ defaultValue: randomId }" />
  35. </tr>
  36. <tr>
  37. <!-- 项目名称 -->
  38. <sd-form-item-td name="projectTitle" />
  39. <!-- 项目编号 -->
  40. <sd-form-item-td name="projectCode">
  41. <!-- <a-input v-model="model.projectCode" :read-only="true"></a-input> -->
  42. </sd-form-item-td>
  43. </tr>
  44. <tr>
  45. <!-- 外部检查机构 -->
  46. <sd-form-item-td name="inspectionOrg" />
  47. <!-- 被检查机构 -->
  48. <sd-form-item-td name="auditedUnitNames" />
  49. </tr>
  50. <tr v-show="false">
  51. <sd-form-item-td :hidden="true" name="auditedUnitIds" />
  52. </tr>
  53. <tr>
  54. <!-- 外部项目联系人 -->
  55. <sd-form-item-td name="linkMan" />
  56. <!-- 被检查类型 -->
  57. <sd-form-item-td name="inspectionType" />
  58. </tr>
  59. <tr>
  60. <!-- 外部检查联系方式 -->
  61. <sd-form-item-td name="linkManNum" />
  62. </tr>
  63. <tr>
  64. <!-- 项目说明 -->
  65. <sd-form-item-td name="description" :colspan="3">
  66. <a-textarea v-model="model.description" :rows="3" />
  67. </sd-form-item-td>
  68. </tr>
  69. <tr>
  70. <!-- 检查开始日期 -->
  71. <sd-form-item-td name="inspectionStartTime" />
  72. <!-- 检查结束日期 -->
  73. <sd-form-item-td name="inspectionEndTime" />
  74. </tr>
  75. <tr>
  76. <!-- 检查区间开始日期 -->
  77. <sd-form-item-td name="sectionStartTime" />
  78. <!-- 检查区间结束日期 -->
  79. <sd-form-item-td name="sectionEndTime" />
  80. </tr>
  81. <tr>
  82. <!-- 创建人姓名 -->
  83. <sd-form-item-td name="creatorName" />
  84. <!-- 创建时间 -->
  85. <sd-form-item-td name="creationTime" />
  86. </tr>
  87. <tr>
  88. <!-- 附件 -->
  89. <sd-form-item-td name="attachment" :colspan="3" />
  90. </tr>
  91. <tr v-show="false">
  92. <sd-form-item-td v-if="initParam(model)" :hidden="true" name="releaseType" />
  93. </tr> </table
  94. ><table>
  95. <tr
  96. ><td :colspan="4">
  97. <sd-form-item name="iamExternalFindEntitys" :label="null">
  98. <template v-slot:read-and-edit="{ editable }">
  99. <audit-advanced-group
  100. :expand="findExpand"
  101. :expand-str="'findExpand'"
  102. :group-label="'审计发现'"
  103. tablestyle="''"
  104. @changedClick="changedClick"
  105. ><template>
  106. <template>
  107. <div :class="$style.wrapper">
  108. <div v-show="findExpand && editable" :class="$style.btnselect">
  109. <a-button type="link" :class="$style.batchselect" @click="findImport">
  110. <a-icon type="check-circle" :theme="'filled'" />批量导入
  111. </a-button>
  112. </div>
  113. </div>
  114. </template>
  115. <div :class="[$style.btns]">
  116. <audit-advanced-import
  117. ref="sjzlImport"
  118. :config-id="'151'"
  119. :table-id="'findData'"
  120. :relevant-column="relevant"
  121. :v-if="false"
  122. @importfromfileAfter="importfromfileAfter"
  123. >
  124. </audit-advanced-import>
  125. </div>
  126. <xm-paper-child-table
  127. v-show="findExpand"
  128. :key="findDataKey"
  129. ref="findData"
  130. v-model="iamExternalFindEntitys"
  131. :mode="mode"
  132. :class="$style.deptPlanChild"
  133. :label="null"
  134. :colspan="8"
  135. :columns="findcolumns"
  136. name="iamExternalFindEntitys"
  137. :project-id="record"
  138. :fields="
  139. [
  140. {
  141. caption: '序号',
  142. name: 'sortNum',
  143. dataType: 'number',
  144. attr: {},
  145. },
  146. ].concat(Array.from(fields.iamExternalFindEntitys.attr.dync).slice(0, 6))
  147. "
  148. :creatnewfind="creatnewfind"
  149. :deletefind="deletefind"
  150. :findtable="true"
  151. :captionvisiable="true"
  152. :read-only="!editable"
  153. @change="changetable"
  154. >
  155. </xm-paper-child-table>
  156. </template>
  157. </audit-advanced-group>
  158. </template> </sd-form-item
  159. ></td>
  160. </tr> </table
  161. ><table>
  162. <tr
  163. ><td :colspan="4">
  164. <sd-form-item name="iamExternalFileEntitys" :label="null">
  165. <!-- input-form 表示这部分是子表组件的form插槽 -->
  166. <template v-slot:read-and-edit="{ editable }">
  167. <audit-advanced-group
  168. :expand="expandY"
  169. :expand-str="'expandY'"
  170. :group-label="'项目相关文件'"
  171. @changedClick="changedClick"
  172. ><template>
  173. <xm-child-table
  174. v-model="model.iamExternalFileEntitys"
  175. :read-only="!editable"
  176. label=""
  177. :fields="
  178. [
  179. {
  180. caption: '序号',
  181. name: 'sortNum',
  182. dataType: 'number',
  183. attr: {},
  184. },
  185. ].concat(Array.from(fields.iamExternalFileEntitys.attr.dync))
  186. "
  187. :columns="childLawsColumns"
  188. :width="1000"
  189. >
  190. </xm-child-table
  191. ></template>
  192. </audit-advanced-group>
  193. </template> </sd-form-item
  194. ></td>
  195. </tr>
  196. </table>
  197. </template>
  198. </sd-detail-form>
  199. </audit-form-top-banner>
  200. </template>
  201. <script>
  202. import { Modal, Message } from 'ant-design-vue'
  203. import axios from '@/common/services/axios-instance'
  204. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  205. import auditFormTopBanner from '../../components/audit-form-top-banner'
  206. import auditAdvancedImport from '../../components/audit-advanced-import.vue'
  207. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  208. import auditAdvancedGroup from '../../components/audit-advanced-group.vue'
  209. import components from './_import-components/iam-audit-external-project-form-import'
  210. import xmPaperChildTable from './table/xm-paper-child-table.vue'
  211. import AuditExternalProjectService from './iam-audit-external-project-service.js'
  212. export default {
  213. name: 'IamAuditExternalProjectForm',
  214. metaInfo: {
  215. title: '外部项目',
  216. },
  217. components: {
  218. ...components,
  219. auditFormTopBanner,
  220. auditAdvancedGroup,
  221. xmPaperChildTable,
  222. auditAdvancedImport,
  223. },
  224. mixins: [auditAdvancedGroupMixins],
  225. data() {
  226. return {
  227. findDataKey: 0,
  228. isSave: false, // 是否为保存操作
  229. relevant: this.$route.query.record * 1,
  230. publishflag: false,
  231. record: '',
  232. basicExpand: true,
  233. message: '保存成功',
  234. expandY: true,
  235. mode: null,
  236. findExpand: true,
  237. labelArray: [],
  238. fileFileds: [],
  239. findcolumns: [
  240. {
  241. title: '序号',
  242. dataIndex: 'sortNum',
  243. width: '5.8%',
  244. customRender: (text, record, index) => `${index + 1}`,
  245. },
  246. {
  247. title: '问题名称(定性描述)',
  248. dataIndex: 'findTitle',
  249. scopedSlots: { customRender: 'islink' },
  250. },
  251. { title: '审计问题编号', dataIndex: 'findCode' },
  252. {
  253. title: '问题类别',
  254. dataIndex: 'problemType',
  255. scopedSlots: { customRender: 'problemType' },
  256. sdHidden: true,
  257. },
  258. {
  259. title: '问题分类',
  260. dataIndex: 'problemCategoryFunction',
  261. customRender: (text, record, index) => JSON.parse(text).text,
  262. },
  263. // { title: '被检查机构', dataIndex: 'auditedUnitNames' },
  264. { title: '被审计单位', dataIndex: 'auditedUnitNames' },
  265. { title: '发送整改状态', dataIndex: 'sendStatus' },
  266. ],
  267. childLawsColumns: [
  268. {
  269. title: '序号',
  270. dataIndex: 'sortNum',
  271. width: '5%',
  272. customRender: (text, record, index) => `${index + 1}`,
  273. },
  274. {
  275. dataIndex: 'fileType',
  276. title: '文件类型',
  277. width: '15%',
  278. },
  279. {
  280. dataIndex: 'fileTitle',
  281. width: '15%',
  282. title: '文件名称',
  283. },
  284. {
  285. dataIndex: 'fileDesc',
  286. width: '15%',
  287. title: '文件说明',
  288. },
  289. ],
  290. iamExternalFindEntitys: [],
  291. }
  292. },
  293. computed: {
  294. // 计算随机key
  295. randomId() {
  296. let randomNum = Math.random()
  297. while (randomNum === 0) {
  298. randomNum = Math.random()
  299. }
  300. const time = new Date().getTime()
  301. return time + Math.ceil(randomNum * 1000000000)
  302. },
  303. },
  304. mounted() {
  305. window.addEventListener('beforeunload', (e) => {
  306. this.beforeunloadHandler(e)
  307. })
  308. this.record = this.$route.query.record
  309. if (this.record) {
  310. this.getExternalrFind(this.record)
  311. }
  312. },
  313. methods: {
  314. beforeunloadHandler(e) {
  315. if (!this.isSave && !this.$refs.docform.getFieldValue('id')) {
  316. const strid = this.iamExternalFindEntitys.map((item) => {
  317. return item.id
  318. })
  319. if (strid.length > 0) {
  320. axios({
  321. url: 'api/xcoa-mobile/v1/iamexternalfind/deletedFind?ids=' + strid.join(','),
  322. method: 'post',
  323. })
  324. }
  325. }
  326. },
  327. findImport() {
  328. if (!this.relevant) {
  329. this.relevant = this.randomId
  330. }
  331. this.$refs.sjzlImport.showImportPanel()
  332. },
  333. importfromfileAfter() {
  334. let record
  335. if (this.record === undefined || this.record === '') {
  336. record = this.randomId
  337. } else {
  338. record = this.record
  339. }
  340. const params = { projectId: record }
  341. AuditExternalProjectService.getAuditFindData(params).then((res) => {
  342. this.$refs.docform.setFieldValue('iamExternalFindEntitys', res.data)
  343. this.iamExternalFindEntitys = res.data
  344. })
  345. },
  346. sdFormReady() {
  347. this.mode = this.$refs.docform.formData.mode
  348. // this.$refs.docform.setFieldValue('randomId', this.randomId)
  349. },
  350. initParam(model) {
  351. if (model.releaseType !== 1) {
  352. this.publishflag = true
  353. }
  354. return true
  355. },
  356. handelPublish() {
  357. this.$refs.docform.setFieldValue('releaseType', 1)
  358. this.message = '发布成功!'
  359. this.saveForm()
  360. },
  361. close(flag) {
  362. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  363. window.close()
  364. },
  365. // 保存
  366. saveForm() {
  367. this.isSave = true
  368. const auditedUnitNames = this.$refs.docform.getFieldValue('auditedUnitNames')
  369. // 处理部门
  370. if (auditedUnitNames) {
  371. this.$refs.docform.setFieldValue(
  372. 'auditedUnitIds',
  373. auditedUnitNames
  374. .map((item) => {
  375. return item.code
  376. })
  377. .toString()
  378. )
  379. }
  380. this.$refs.docform.saveBtnClick()
  381. },
  382. saved(data) {
  383. // 拼接record
  384. if (!this.$route.fullPath.includes('record')) {
  385. this.$router.replace(`/audit-externalProject-form?record=${data.pageFormData.beanId}`)
  386. // 刷新审计发现子表
  387. this.getExternalrFind(data.pageFormData.beanId)
  388. this.record = data.pageFormData.beanId
  389. }
  390. Message.success({ content: this.message }).then(() => {
  391. crossWindowWatcher.notifyChange(this.$route.fullPath, true)
  392. // 发布就关闭
  393. if (this.message === '发布成功!') {
  394. this.close(true)
  395. }
  396. })
  397. },
  398. getExternalrFind(projectId) {
  399. // 获取发现列表
  400. const params = { projectId: projectId }
  401. AuditExternalProjectService.getAuditFindData(params).then((res) => {
  402. res.data.forEach((item, index) => {
  403. item.sortNum = index + 1
  404. })
  405. this.iamExternalFindEntitys = res.data
  406. })
  407. },
  408. changeNum(data) {
  409. data.forEach((item, index) => {
  410. item.sortNum = index + 1
  411. })
  412. },
  413. creatnewfind() {
  414. let record
  415. if (this.record === undefined || this.record === '') {
  416. record = this.randomId
  417. } else {
  418. record = this.record
  419. }
  420. const url = '/audit-externalProject-find-form?projectId=' + record // 新页面要打开的路由地址
  421. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  422. if (refreshFlag) {
  423. setTimeout(this.getExternalrFind(record), 3000)
  424. }
  425. })
  426. },
  427. deletefind(ids) {
  428. const strid = ids.join(',')
  429. axios({
  430. url: 'api/xcoa-mobile/v1/iamexternalfind/deletedFind?ids=' + strid,
  431. method: 'post',
  432. })
  433. },
  434. changetable(data) {
  435. data.forEach((item, index) => {
  436. item.sortNum = index + 1
  437. })
  438. },
  439. },
  440. }
  441. </script>
  442. <style module lang="scss">
  443. @import '@/webflow/sd-flow-form.scss';
  444. .ant-card-body {
  445. padding: 12px;
  446. }
  447. .btnselect {
  448. position: relative;
  449. float: right;
  450. .batchselect {
  451. top: 4px;
  452. z-index: 100;
  453. margin-right: 190px;
  454. }
  455. }
  456. </style>