audit-plan-form.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  1. <template>
  2. <div :class="$style.odrForm">
  3. <sd-webflow
  4. ref="flow"
  5. :removed-tabs="['sdRelatedDoc']"
  6. @actionBtnClick="actionBtnClick"
  7. @saveproject="saveproject"
  8. @afterDispatch="afterDispatch"
  9. >
  10. <template v-slot:form="{ model, fields }">
  11. <table>
  12. <tr>
  13. <td style="border: none">
  14. <audit-advanced-group
  15. :expand="planExpand"
  16. :expand-str="'planExpand'"
  17. :group-label="'计划信息'"
  18. tablestyle="''"
  19. @changedClick="changedClick"
  20. ></audit-advanced-group>
  21. </td>
  22. </tr>
  23. </table>
  24. <table v-show="planExpand">
  25. <tr v-show="initData(model)">
  26. <!-- ID -->
  27. <sd-form-item-td name="id" />
  28. <!-- 随机ID -->
  29. <sd-form-item-td name="randomId" />
  30. <!-- 标题 -->
  31. <sd-form-item-td name="title" />
  32. <sd-form-item-td name="unitId" />
  33. <sd-form-item-td name="unitCode" />
  34. </tr>
  35. <tr>
  36. <!-- 计划年度 -->
  37. <sd-form-item-td name="planYear">
  38. <a-select
  39. v-if="
  40. model.iamAuditProjectList === null ||
  41. model.iamAuditProjectList === undefined ||
  42. model.iamAuditProjectList?.length === 0 ||
  43. model.iamAuditProjectList === ''
  44. "
  45. v-model="model.planYear"
  46. >
  47. <a-select-option v-for="year in yearArry" :key="year + ''">
  48. {{ year }}
  49. </a-select-option>
  50. </a-select>
  51. <span v-else>{{ model.planYear }}</span>
  52. </sd-form-item-td>
  53. <!-- 审计机构 -->
  54. <sd-form-item-td name="unitName" />
  55. </tr>
  56. <tr>
  57. <!-- 计划描述 -->
  58. <sd-form-item-td name="description" :colspan="3">
  59. <a-textarea v-model="model.description" :rows="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. <tr>
  69. <!-- 附件 -->
  70. <sd-form-item-td name="attachment" :colspan="3">
  71. <template v-slot:read-and-edit="{ editable }">
  72. <sd-attachment
  73. v-model="model.attachment"
  74. :group-id="JSON.parse(fields.attachment.value).value"
  75. :read-only="!editable"
  76. ></sd-attachment>
  77. </template>
  78. </sd-form-item-td>
  79. </tr>
  80. </table>
  81. <a-spin :spinning="!inited" tip="正在导入...">
  82. <table style="width: 90%; margin: auto; table-layout: fixed">
  83. <tr :class="$style.lastTr">
  84. <td :colspan="4">
  85. <sd-form-item name="iamAuditProjectList" :label="null">
  86. <template v-slot:read-and-edit="{ editable }">
  87. <audit-advanced-group
  88. :expand="expand"
  89. :expand-str="'expand'"
  90. :group-label="'项目信息'"
  91. @changedClick="changedClick"
  92. >
  93. <template>
  94. <template>
  95. <div v-show="expand && editable" :class="$style.btnexcel">
  96. <a-button type="link" :class="$style.viewSjjh" @click="viewSjjh">
  97. <a-icon type="plus-circle" theme="filled" />
  98. 查看审计计划安排情况
  99. </a-button>
  100. <a-button
  101. type="link"
  102. :class="$style.autoprequeue"
  103. @click="autoPrequeue"
  104. >
  105. <a-icon type="plus-circle" theme="filled" />
  106. 自动预排
  107. </a-button>
  108. <a-button
  109. :loading="importLoading"
  110. type="link"
  111. :class="$style.batchexcel"
  112. @click="batchInport"
  113. >
  114. <a-icon
  115. v-show="!importLoading"
  116. type="sd-audit-import"
  117. theme="filled"
  118. />
  119. 批量导入
  120. </a-button>
  121. </div>
  122. </template>
  123. <sd-child-table
  124. :key="childTableKey"
  125. ref="tabaData"
  126. v-model="model.iamAuditProjectList"
  127. :class="$style.projecttable"
  128. label="项目信息"
  129. :read-only="!editable"
  130. :fields="
  131. [
  132. {
  133. caption: '序号',
  134. name: 'sortNum',
  135. dataType: 'number',
  136. attr: {},
  137. },
  138. ].concat(Array.from(fields.iamAuditProjectList.attr.dync))
  139. "
  140. :columns="childColumns"
  141. :handle-before-add="handleBeforeAdd"
  142. @change="changeNum"
  143. >
  144. <!-- input-form 表示这部分是子表组件的form插槽 -->
  145. <template v-slot:form="{ model, fields }">
  146. <table :class="$style.iamAuditChildTable">
  147. <tr>
  148. <sd-form-item-td name="projectTitle"></sd-form-item-td>
  149. <sd-form-item-td
  150. v-if="
  151. model.projectCode === '' ||
  152. model.projectCode === null ||
  153. model.projectCode === undefined
  154. "
  155. name="auditType"
  156. ></sd-form-item-td>
  157. <sd-form-item-td v-else name="auditType">{{
  158. getFormSelectFieldValue('auditType', model.auditType)
  159. }}</sd-form-item-td>
  160. </tr>
  161. <tr>
  162. <sd-form-item-td
  163. label="项目负责人"
  164. name="projectPrincipalId"
  165. ></sd-form-item-td>
  166. <sd-form-item-td name="projectCode">
  167. <a-input
  168. v-model="model.projectCode"
  169. :disabled="true"
  170. placeholder="系统自动生成"
  171. ></a-input>
  172. </sd-form-item-td>
  173. </tr>
  174. <tr>
  175. <sd-form-item-td
  176. name="auditedUnitIds"
  177. :colspan="3"
  178. ></sd-form-item-td>
  179. <!-- <sd-form-item-td name="auditBasis"></sd-form-item-td> -->
  180. </tr>
  181. <tr>
  182. <sd-form-item-td name="auditMode"></sd-form-item-td>
  183. <sd-form-item-td
  184. v-if="model.auditType === '03' || model.auditType === '04'"
  185. name="auditedUser"
  186. ></sd-form-item-td>
  187. </tr>
  188. <tr>
  189. <!-- <sd-form-item-td name="secondAuditDeptPerson"></sd-form-item-td> -->
  190. <sd-form-item-td
  191. v-if="model.auditMode === '02'"
  192. name="externalUnitIds"
  193. :colspan="3"
  194. >
  195. <template v-slot:read-and-edit="{ editable }">
  196. <AuditGroupPicker
  197. v-if="editable"
  198. v-model="model.externalUnitIds"
  199. :read-only="false"
  200. :selectclick="showselectexternal"
  201. />
  202. <span v-else>{{ model.externalUnitNames }}</span>
  203. </template>
  204. </sd-form-item-td>
  205. </tr>
  206. <!-- <tr>
  207. <sd-form-item-td name="whetherFinance" />
  208. <sd-form-item-td name="whetherOverseas" />
  209. </tr> -->
  210. <!-- <tr>
  211. <sd-form-item-td name="auditObjective" :colspan="3">
  212. <a-textarea v-model="model.auditObjective" :rows="3" />
  213. </sd-form-item-td>
  214. </tr> -->
  215. <tr>
  216. <sd-form-item-td name="projectContent" :colspan="3">
  217. <a-textarea v-model="model.projectContent" :rows="3" />
  218. </sd-form-item-td>
  219. </tr>
  220. <!-- <tr>
  221. <sd-form-item-td v-show="false" name="whetherFinance" />
  222. <sd-form-item-td v-show="false" name="whetherOverseas" />
  223. </tr> -->
  224. <tr class="bklabeloverflow">
  225. <sd-form-item-td name="whetherAuditCoverage" />
  226. </tr>
  227. <tr>
  228. <sd-form-item-td
  229. name="planStartTime"
  230. @change="getDay(model)"
  231. ></sd-form-item-td>
  232. <sd-form-item-td
  233. name="planEndTime"
  234. range-after="planStartTime"
  235. @change="getDay(model)"
  236. ></sd-form-item-td>
  237. </tr>
  238. <tr>
  239. <sd-form-item-td name="planDays">
  240. <a-input :v-model="model.planDay"></a-input>
  241. </sd-form-item-td>
  242. </tr>
  243. <tr>
  244. <sd-form-item-td
  245. name="groupLeaderId"
  246. :colspan="3"
  247. ></sd-form-item-td>
  248. <!-- <sd-form-item-td
  249. name="projectSource"
  250. component="a-select"
  251. ></sd-form-item-td> -->
  252. </tr>
  253. <!-- <tr>
  254. <sd-form-item-td name="exPersonnelNum" :input-props="{ min: 0 }">
  255. <a-input-number
  256. v-model="model.exPersonnelNum"
  257. style="width: 100%"
  258. ></a-input-number>
  259. </sd-form-item-td>
  260. <sd-form-item-td name="predictedCost" :input-props="{ min: 0 }">
  261. <template v-slot:read-and-edit="{ editable }">
  262. <a-input-number
  263. v-if="editable"
  264. v-model="model.predictedCost"
  265. :min="0"
  266. :precision="2"
  267. style="width: 100%"
  268. ></a-input-number>
  269. <span v-else>{{
  270. model.predictedCost === undefined
  271. ? model.predictedCost
  272. : parseFloat(model.predictedCost).toFixed(2)
  273. }}</span>
  274. </template>
  275. </sd-form-item-td>
  276. </tr> -->
  277. <!-- <tr>
  278. <sd-form-item-td name="secondAuditDeptPerson" :colspan="3" />
  279. </tr> -->
  280. <tr>
  281. <sd-form-item-td name="attachment" :colspan="3">
  282. <template v-slot:read-and-edit="{ editable }">
  283. <sd-attachment
  284. v-model="model.attachment"
  285. :read-only="editable ? false : true"
  286. :group-id="JSON.parse(fields.attachment.value).value"
  287. />
  288. </template>
  289. </sd-form-item-td>
  290. </tr>
  291. <tr>
  292. <sd-form-item-td name="projectRemarks" :colspan="3">
  293. <a-textarea v-model="model.projectRemarks" :rows="3" />
  294. </sd-form-item-td>
  295. </tr>
  296. </table>
  297. </template>
  298. </sd-child-table>
  299. </template>
  300. </audit-advanced-group>
  301. </template>
  302. </sd-form-item>
  303. </td>
  304. </tr>
  305. </table>
  306. <div :class="[$style.btns]">
  307. <audit-advanced-import
  308. ref="import"
  309. :config-id="'101'"
  310. :table-id="'list'"
  311. :relevant-column="planId"
  312. :class-style="[$style.buttonSpacing]"
  313. :v-if="false"
  314. @importfromfileAfter="importfromfileAfter"
  315. @importfromfileBefore="importfromfileBefore"
  316. @importHandleCancel="importHandleCancel"
  317. >
  318. </audit-advanced-import>
  319. </div>
  320. </a-spin>
  321. <a-modal
  322. :visible="modalvisible"
  323. title="请选择"
  324. width="1200px"
  325. :body-style="{
  326. minHeight: '700px',
  327. }"
  328. :destroy-on-close="true"
  329. @ok="handleOk"
  330. @cancel="handleCancel"
  331. >
  332. <sd-data-table-ex
  333. ref="externalTable"
  334. check-type="checkbox"
  335. :filter-expressions="expressions"
  336. :columns="modalcolumns"
  337. form-id="iamExternalBase"
  338. page-id="audit/auditsource/extrnal/iamExternalBase"
  339. :search-fields="['name', 'code', 'address']"
  340. show-selection
  341. >
  342. </sd-data-table-ex>
  343. </a-modal>
  344. <a-modal
  345. :visible="modalviewvisible"
  346. title="查看审计计划安排情况"
  347. width="1200px"
  348. :body-style="{
  349. minHeight: '700px',
  350. }"
  351. :footer="null"
  352. @cancel="modalviewvisible = false"
  353. >
  354. <sd-data-table
  355. ref="viewsjjh"
  356. class="auditplanformmodalcksjjh"
  357. :data-url="'api/xcoa-mobile/v1/iamauditplan/findPlanArrangement'"
  358. :process-req="processReq"
  359. row-key="id"
  360. :process-res="processRes"
  361. :columns="viewSjjhcolumns3"
  362. :filter-expressions="[]"
  363. :pagination="false"
  364. :defultpagination-pagesize="Number.MAX_VALUE"
  365. >
  366. <div slot="jl" slot-scope="text, record">
  367. <span
  368. v-if="text === '未覆盖'"
  369. style="
  370. display: flex;
  371. width: 80px;
  372. padding-left: 16px;
  373. color: #fff;
  374. text-align: center;
  375. background-color: rgb(238, 67, 76);
  376. border-radius: 4px;
  377. "
  378. :title="text"
  379. >{{ text }}</span
  380. >
  381. <span
  382. v-if="text === '已安排'"
  383. style="
  384. display: flex;
  385. width: 80px;
  386. padding-left: 16px;
  387. color: #fff;
  388. text-align: center;
  389. background-color: #178fff;
  390. border-radius: 4px;
  391. "
  392. :title="text"
  393. >{{ text }}</span
  394. >
  395. <span
  396. v-if="text === '已覆盖'"
  397. style="
  398. display: flex;
  399. width: 80px;
  400. padding-left: 16px;
  401. color: #fff;
  402. text-align: center;
  403. background-color: #26c686;
  404. border-radius: 4px;
  405. "
  406. :title="text"
  407. >{{ text }}</span
  408. >
  409. </div>
  410. <div slot="unitName" slot-scope="text, record">
  411. <span style="font-size: 18px" :title="text + '(' + record.gz + ')'">{{ text }}</span
  412. ><br /><span
  413. style="font-size: 12px; color: rgb(238, 67, 76)"
  414. :title="text + '(' + record.gz + ')'"
  415. >{{ record.gz }}
  416. </span></div
  417. >
  418. <div slot="year" slot-scope="text, record">
  419. <span v-if="text && text !== ''" :title="text">{{ text }}</span>
  420. </div>
  421. </sd-data-table>
  422. </a-modal>
  423. </template>
  424. </sd-webflow>
  425. </div>
  426. </template>
  427. <script>
  428. import moment from 'moment'
  429. import { Modal, Message } from 'ant-design-vue'
  430. import AuditGroupPicker from '../../components/picker/audit-group-picker.vue'
  431. import auditAdvancedGroup from '../../components/audit-advanced-group.vue'
  432. import auditAdvancedImport from '../../components/audit-advanced-import.vue'
  433. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  434. import AuditService from './audit-service'
  435. import components from './_import-components/audit-plan-form-import'
  436. import TableColumnTypes from '@/common/services/table-column-types'
  437. import axios from '@/common/services/axios-instance'
  438. // 修改主子表的首行title名
  439. export default {
  440. name: 'IamPlanForm',
  441. metaInfo: {
  442. title: '审计计划信息',
  443. },
  444. components: {
  445. ...components,
  446. auditAdvancedGroup,
  447. AuditGroupPicker,
  448. auditAdvancedImport,
  449. },
  450. mixins: [auditAdvancedGroupMixins],
  451. data() {
  452. return {
  453. importLoading: false,
  454. childTableKey: 0, // 刷新子表组件
  455. unitIdList: [],
  456. inited: true,
  457. planExpand: true,
  458. expand: true,
  459. planId: null,
  460. childColumns: [
  461. {
  462. title: '序号',
  463. dataIndex: 'sortNum',
  464. width: '50px',
  465. customRender: (text, record, index) => `${index + 1}`,
  466. },
  467. {
  468. dataIndex: 'auditedUnitIds',
  469. width: '120px',
  470. customRender: (text, record, index) => {
  471. if (record.auditedUnitIds) {
  472. const array = this.formatterTitle(record.auditedUnitIds, 15)
  473. return <label title={array[0]}>{array[1]}</label>
  474. } else {
  475. return ''
  476. }
  477. },
  478. },
  479. { dataIndex: 'projectTitle', sorter: true, width: '25%' },
  480. { dataIndex: 'projectCode', sorter: true, defaultSortOrder: 'ascend', width: '15%' },
  481. { dataIndex: 'auditType', sorter: true, width: '15%' },
  482. {
  483. title: '项目负责人',
  484. dataIndex: 'projectPrincipalId',
  485. sorter: true,
  486. width: '120px',
  487. sdHidden: true,
  488. },
  489. { dataIndex: 'auditMode', sorter: true, width: '120px' },
  490. { dataIndex: 'externalUnitIds', sdHidden: true },
  491. { dataIndex: 'auditedUnitNames', sdHidden: true },
  492. { dataIndex: 'externalUnitCodes', sdHidden: true },
  493. { dataIndex: 'externalUnitNames', sdHidden: true },
  494. { dataIndex: 'auditBasis', sdHidden: true },
  495. { dataIndex: 'auditedUser', sdHidden: true },
  496. { dataIndex: 'auditObjective', sdHidden: true },
  497. { dataIndex: 'planStartTime', sdHidden: true },
  498. { dataIndex: 'planEndTime', sdHidden: true },
  499. { dataIndex: 'groupLeaderId', sdHidden: true },
  500. { dataIndex: 'projectSource', sdHidden: true },
  501. { dataIndex: 'exPersonnelNum', sdHidden: true },
  502. { dataIndex: 'predictedCost', sdHidden: true },
  503. { dataIndex: 'attachment', sdHidden: true },
  504. { dataIndex: 'projectRemarks', sdHidden: true },
  505. { dataIndex: 'secondAuditDeptPerson', sdHidden: true },
  506. { dataIndex: 'whetherFinance', sdHidden: true },
  507. { dataIndex: 'whetherOverseas', sdHidden: true },
  508. { dataIndex: 'whetherAuditCoverage', sdHidden: true },
  509. { dataIndex: 'projectContent', sdHidden: true },
  510. { dataIndex: 'planDays', sdHidden: true },
  511. { dataIndex: 'id', sdHidden: true },
  512. ],
  513. yearArry: [],
  514. modalvisible: false,
  515. modalcolumns: [
  516. {
  517. title: '序号',
  518. dataIndex: 'sortNumber',
  519. width: '70px',
  520. customRender: (text, record, index) => `${index + 1}`,
  521. },
  522. {
  523. dataIndex: 'id',
  524. sdHidden: true,
  525. },
  526. {
  527. title: '企业名称',
  528. dataIndex: 'name',
  529. // sdClickable: true, // 列内容是否可点击
  530. scopedSlots: { customRender: 'islink' },
  531. },
  532. {
  533. title: '类型',
  534. dataIndex: 'category',
  535. width: '160px',
  536. },
  537. {
  538. title: '统一社会信用代码',
  539. dataIndex: 'code',
  540. width: '180px',
  541. },
  542. {
  543. title: '住所',
  544. dataIndex: 'address',
  545. width: '70px',
  546. },
  547. {
  548. title: '企业状态',
  549. sorter: true,
  550. dataIndex: 'status',
  551. },
  552. {
  553. title: '当前所参与项目',
  554. dataIndex: 'joinProject',
  555. width: '180px',
  556. scopedSlots: { customRender: 'isProject' },
  557. },
  558. {
  559. title: '编制人员',
  560. dataIndex: 'authName',
  561. width: '120px',
  562. },
  563. {
  564. title: '编制日期',
  565. dataIndex: 'authTime',
  566. sorter: true,
  567. defaultSortOrder: 'descend',
  568. sdRender: TableColumnTypes.date,
  569. },
  570. ],
  571. expressions: [],
  572. externalUnitIds: [],
  573. isSave: false, // 是否有保存操作
  574. orgid: '',
  575. auditTypeOptions: [],
  576. modalviewvisible: false,
  577. viewSjsize: 3,
  578. viewSjjhcolumns3: [
  579. {
  580. title: '单位名称',
  581. dataIndex: 'unitName',
  582. },
  583. ],
  584. viewSjjhcolumns4: [
  585. {
  586. title: '单位名称',
  587. dataIndex: 'unitName',
  588. },
  589. ],
  590. viewSjyears: [],
  591. }
  592. },
  593. computed: {
  594. // 计算随机key
  595. randomId() {
  596. let randomNum = Math.random()
  597. while (randomNum === 0) {
  598. randomNum = Math.random()
  599. }
  600. const time = new Date().getTime()
  601. return time + Math.ceil(randomNum * 1000000000)
  602. },
  603. },
  604. mounted() {
  605. // 监听关闭事件,关闭时如果没有保存操作且没有id,则直接删除所有子表
  606. window.addEventListener('beforeunload', (e) => {
  607. this.beforeunloadHandler(e)
  608. })
  609. // 日期下拉框初始化
  610. this.initDateSelect()
  611. axios({
  612. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=PRODUCT_IAM_AUDIT_TYPE',
  613. method: 'get',
  614. }).then((res) => {
  615. if (res.status === 200) {
  616. this.auditTypeOptions = res.data
  617. }
  618. })
  619. const groupId = this.$refs.flow.getFieldValue('unitId')
  620. // axios({
  621. // url: 'api/xcoa-mobile/v1/iamauditplan/childGroup?unitCode=' + groupId,
  622. // method: 'get',
  623. // }).then((res) => {
  624. // if (res.status === 200) {
  625. // this.unitIdList = res.data
  626. // }
  627. // })
  628. },
  629. methods: {
  630. // 控制请求处理
  631. processReq(req) {
  632. debugger
  633. const groupId = this.$refs.flow.getFieldValue('unitId')
  634. const planYear = this.$refs.flow.getFieldValue('planYear')
  635. var unitIdArray = []
  636. var projectNames = []
  637. const child = this.$refs.flow.getFieldValue('iamAuditProjectList')
  638. if (child) {
  639. child.forEach((c) => {
  640. if (c.whetherAuditCoverage === '1') {
  641. if (c.auditedUnitIds) {
  642. JSON.parse(c.auditedUnitIds).forEach((d) => {
  643. unitIdArray.push(d.code)
  644. })
  645. }
  646. if (c.projectTitle) {
  647. projectNames.push(c.projectTitle)
  648. }
  649. }
  650. })
  651. } else {
  652. unitIdArray = this.unitIdList
  653. }
  654. var projectNameArray = []
  655. if (projectNames !== undefined || projectNames !== null) {
  656. projectNameArray = projectNames.join(',')
  657. }
  658. req.url =
  659. 'api/xcoa-mobile/v1/iamauditplan/findPlanArrangement?groupId=' +
  660. groupId +
  661. '&unitIdList=' +
  662. unitIdArray.join(',') +
  663. '&year=' +
  664. planYear +
  665. '&projectNames=' +
  666. projectNameArray
  667. console.log(req)
  668. return req
  669. },
  670. processRes(res) {
  671. const datas = []
  672. res.data.forEach((d, index) => {
  673. const obj = {
  674. unitName: d['单位名称'],
  675. jl: d['结论'],
  676. gz: d['规则'],
  677. id: index,
  678. }
  679. this.viewSjyears.forEach((y) => {
  680. obj[y] = d[y]
  681. })
  682. datas.push(obj)
  683. })
  684. this.viewSjsize = res.size
  685. return { datas: datas, total: res.data?.length }
  686. },
  687. getFormSelectFieldValue(name, value) {
  688. let result = ''
  689. if (value !== undefined) {
  690. if (name === 'auditType') {
  691. const resultArry = this.auditTypeOptions.filter((e) => {
  692. return e.id === value
  693. })
  694. if (resultArry.length > 0) {
  695. result = resultArry[0].name
  696. }
  697. }
  698. if (name === 'auditMode') {
  699. const resultArry = this.auditModeOptions.filter((e) => {
  700. return e.id === value
  701. })
  702. if (resultArry.length > 0) {
  703. result = resultArry[0].name
  704. }
  705. }
  706. if (name === 'auditBasis') {
  707. const resultArry = this.auditBasisOptions.filter((e) => {
  708. return e.id === value
  709. })
  710. if (resultArry.length > 0) {
  711. result = resultArry[0].name
  712. }
  713. }
  714. if (name === 'projectSource') {
  715. const resultArry = this.projectSourceOptions.filter((e) => {
  716. return e.id === value
  717. })
  718. if (resultArry.length > 0) {
  719. result = resultArry[0].name
  720. }
  721. }
  722. }
  723. return result
  724. },
  725. // 关闭窗口监听
  726. beforeunloadHandler(e) {
  727. if (!this.isSave && !this.$refs.flow.getFieldValue('id')) {
  728. const strid = this.$refs.flow.getFieldValue('iamAuditProjectList').map((item) => {
  729. return item.id
  730. })
  731. if (strid.length > 0) {
  732. // 删除子表内容,防止垃圾数据
  733. axios({
  734. url: `api/xcoa-mobile/v1/iamauditproject/changeProject?planId=${this.planId}&ids=`,
  735. method: 'get',
  736. })
  737. }
  738. }
  739. },
  740. // 保存操作,记录标识位
  741. saveproject() {
  742. this.isSave = true
  743. },
  744. /**
  745. * 提交后事件
  746. */
  747. afterDispatch() {
  748. // 提交也认为是保存
  749. this.isSave = true
  750. },
  751. initData(model) {
  752. // eslint-disable-next-line babel/no-unused-expressions
  753. this.$refs.flow?.setFieldValue('randomId', this.randomId)
  754. if (this.$route.params.id !== '0') {
  755. this.orgid = model.auditOrgId
  756. } else {
  757. const params = {
  758. orgId: model.unitId,
  759. }
  760. AuditService.findIamOrgId(params).then((res) => {
  761. this.orgid = res.data
  762. })
  763. }
  764. return false
  765. },
  766. // 日期下拉框初始化
  767. initDateSelect() {
  768. const nowYear = new Date().getFullYear()
  769. this.yearArry.push(nowYear)
  770. for (let i = 1; i < 6; i++) {
  771. this.yearArry.push(nowYear - i)
  772. }
  773. for (let i = 1; i < 11; i++) {
  774. this.yearArry.push(nowYear + i)
  775. }
  776. this.yearArry.sort()
  777. if (this.$refs.flow.getFieldValue('planYear') === undefined) {
  778. this.$refs.flow.setFieldValue('planYear', nowYear + '')
  779. }
  780. },
  781. actionBtnClick(evt, context) {
  782. const { button, FlowData } = context
  783. if (button.fakeId === 'save' || button.fakeId === 'workflow-push') {
  784. // 保存前先校验计划是否已经存在
  785. evt.waitUntil(
  786. new Promise((resolve, reject) => {
  787. this.handleBeforeAdd(null, (res) => {
  788. if (res) {
  789. evt.preventDefault()
  790. }
  791. resolve()
  792. })
  793. })
  794. )
  795. }
  796. if (button.fakeId === 'workflow-push') {
  797. if (button.buttonId === 'G_1_IAM_AUDITPLAN.3') {
  798. const childTable = this.$refs.flow.getFieldValue('iamAuditProjectList')
  799. evt.waitUntil(
  800. new Promise(function (resolve, reject) {
  801. if (childTable && childTable.length === 0) {
  802. Modal.warning({
  803. title: '提示',
  804. content: '请录入项目信息!',
  805. })
  806. // eslint-disable-next-line prefer-promise-reject-errors
  807. reject()
  808. } else {
  809. resolve()
  810. }
  811. })
  812. )
  813. }
  814. }
  815. },
  816. // 序号赋值
  817. changeNum(data) {
  818. const arr = []
  819. data.forEach((item, index) => {
  820. if (item.id) {
  821. arr.push(`${item.id}`)
  822. }
  823. item.sortNum = index + 1
  824. })
  825. const ids = arr.join(',')
  826. this.planId = parseInt(this.$refs.flow.flowData.processFormData.beanId)
  827. if (!this.planId) {
  828. this.planId = this.randomId
  829. }
  830. axios.get(
  831. 'api/xcoa-mobile/v1/iamauditproject/changeProject?planId=' + this.planId + '&ids=' + ids
  832. )
  833. },
  834. handleBeforeAdd(val, callback) {
  835. this.externalUnitIds = []
  836. const projectList = this.$refs.flow.FlowData.processFormData.processFormPropertyValues.find(
  837. (item) => {
  838. return item.name === 'iamAuditProjectList'
  839. }
  840. )
  841. if (projectList) {
  842. projectList.attr.dync.find((item) => {
  843. return item.name === 'auditedUnitIds'
  844. }).required = false
  845. }
  846. const id = parseInt(this.$refs.flow.flowData.processFormData.beanId)
  847. const planYear = this.$refs.flow.getFieldValue('planYear')
  848. AuditService.existYearPlan(id, planYear, this.orgid).then((res) => {
  849. // 检查指定年份年度计划是否已经存在
  850. if (res.data) {
  851. Modal.warning({
  852. title: '提示',
  853. content: '该年度计划已存在!',
  854. })
  855. }
  856. callback(res.data)
  857. })
  858. },
  859. // 批量导入
  860. batchInport() {
  861. this.importLoading = false
  862. this.handleBeforeAdd(null, (res) => {
  863. if (!res) {
  864. this.planId = parseInt(this.$refs.flow.flowData.processFormData.beanId)
  865. if (!this.planId) {
  866. this.planId = this.randomId
  867. }
  868. this.$refs.import.showImportPanel()
  869. } else {
  870. setTimeout(() => {
  871. this.importLoading = false
  872. }, 1000)
  873. }
  874. })
  875. },
  876. // 查看审计计划安排情况
  877. viewSjjh() {
  878. debugger
  879. const planYear = this.$refs.flow.getFieldValue('planYear')
  880. this.viewSjjhcolumns3 = [
  881. {
  882. title: '单位名称',
  883. dataIndex: 'unitName',
  884. scopedSlots: { customRender: 'unitName' },
  885. },
  886. ]
  887. // this.viewSjjhcolumns4 = [
  888. // {
  889. // title: '单位名称',
  890. // dataIndex: 'unitName',
  891. // scopedSlots: { customRender: 'unitName' },
  892. // },
  893. // ]
  894. const years = []
  895. for (var s = 3; s > -1; s--) {
  896. const planYear1 = parseInt(planYear) - s
  897. this.viewSjjhcolumns3.push({
  898. title: planYear1 + '年',
  899. dataIndex: planYear1.toString(),
  900. scopedSlots: { customRender: 'year' },
  901. })
  902. // if (s !== 3) {
  903. // this.viewSjjhcolumns3.push({
  904. // title: planYear1 + '年',
  905. // dataIndex: planYear1.toString(),
  906. // scopedSlots: { customRender: 'year' },
  907. // })
  908. // }
  909. years.push(planYear1.toString())
  910. }
  911. this.viewSjyears = years
  912. this.viewSjjhcolumns3.push({
  913. title: '结论',
  914. dataIndex: 'jl',
  915. scopedSlots: { customRender: 'jl' },
  916. })
  917. // this.viewSjjhcolumns4.push({
  918. // title: '结论',
  919. // dataIndex: 'jl',
  920. // scopedSlots: { customRender: 'jl' },
  921. // })
  922. this.$nextTick(() => {
  923. this.modalviewvisible = !this.modalviewvisible
  924. })
  925. },
  926. // 自动预排
  927. autoPrequeue() {
  928. const id = this.$refs.flow.flowData.processFormData.beanId
  929. const planYear = this.$refs.flow.getFieldValue('planYear')
  930. var data = null
  931. AuditService.existYearPlan(id, planYear, this.orgid).then((res) => {
  932. // 检查指定年份年度计划是否已经存在
  933. if (res.data) {
  934. Modal.warning({
  935. title: '提示',
  936. content: '该年度计划已存在!',
  937. })
  938. } else {
  939. const unitCode = this.$refs.flow.getFieldValue('unitId')
  940. const child = this.$refs.flow.getFieldValue('iamAuditProjectList')
  941. const unitIdList = []
  942. if (child) {
  943. child.forEach((c) => {
  944. if (c.whetherAuditCoverage === '1') {
  945. if (c.auditedUnitIds) {
  946. JSON.parse(c.auditedUnitIds).forEach((d) => {
  947. unitIdList.push(d.code)
  948. })
  949. }
  950. }
  951. })
  952. }
  953. AuditService.autoPrequeue(id, unitCode, planYear, unitIdList).then((res) => {
  954. debugger
  955. // 自动预排
  956. if (res.data) {
  957. // 更新子表项目信息
  958. const iamAuditProjectList = res.data
  959. iamAuditProjectList.forEach((item) => {
  960. // if (item.projectPrincipalId) {
  961. // item.projectPrincipalId = JSON.stringify(item.projectPrincipalId)
  962. // }
  963. item.id = item.id || 'fakeId_' + Math.random()
  964. if (item.auditedUnitIds) {
  965. item.auditedUnitIds = JSON.stringify(item.auditedUnitIds)
  966. }
  967. })
  968. const tableData = this.$refs.flow.getFieldValue('iamAuditProjectList')
  969. if (tableData) {
  970. this.$refs.flow.setFieldValue(
  971. 'iamAuditProjectList',
  972. tableData.concat(iamAuditProjectList)
  973. )
  974. } else {
  975. this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  976. }
  977. this.childTableKey++
  978. }
  979. })
  980. }
  981. })
  982. },
  983. getDay(model) {
  984. debugger
  985. const planStartTime = model.planStartTime
  986. const planEndTime = model.planEndTime
  987. if (planStartTime !== undefined && planEndTime !== undefined) {
  988. const planDays =
  989. (new Date(moment(planEndTime).format('YYYY/MM/DD')).getTime() -
  990. new Date(moment(planStartTime).format('YYYY/MM/DD')).getTime()) /
  991. 1000 /
  992. 60 /
  993. 60 /
  994. 24
  995. model.planDays = (1 + planDays).toString()
  996. } else {
  997. model.planDays = ''
  998. }
  999. return model
  1000. },
  1001. importHandleCancel() {
  1002. // 导入取消函数
  1003. setTimeout(() => {
  1004. this.importLoading = false
  1005. }, 1000)
  1006. },
  1007. // 导入前置函数
  1008. importfromfileBefore() {
  1009. this.inited = false
  1010. },
  1011. // 导入项目回调函数
  1012. importfromfileAfter() {
  1013. // 通过计划id获取计划信息
  1014. AuditService.getAuditPlanById(this.planId).then((res) => {
  1015. this.inited = true
  1016. if (res.data != null && res.data !== '') {
  1017. this.setProjectList(res.data.iamAuditProjectList)
  1018. } else {
  1019. axios
  1020. .get('api/xcoa-mobile/v1/iamauditproject/getProjectEntity?id=' + this.planId)
  1021. .then((res) => {
  1022. this.setProjectList(res.data)
  1023. setTimeout(() => {
  1024. this.importLoading = false
  1025. }, 1000)
  1026. // // 更新子表项目信息
  1027. // const iamAuditProjectList = res.data
  1028. // iamAuditProjectList.forEach((item) => {
  1029. // if (item.projectPrincipalId) {
  1030. // item.projectPrincipalId = JSON.stringify(item.projectPrincipalId)
  1031. // }
  1032. // if (item.auditedUnitIds) {
  1033. // item.auditedUnitIds = JSON.stringify(item.auditedUnitIds)
  1034. // }
  1035. // })
  1036. // const ids = []
  1037. // const tableData = this.$refs.flow.getFieldValue('iamAuditProjectList')
  1038. // const clist = tableData?.filter((item) => {
  1039. // if (item.id) ids.push(item.id)
  1040. // return !item.id
  1041. // })
  1042. // if (!clist) {
  1043. // this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  1044. // this.childTableKey++
  1045. // return
  1046. // }
  1047. // this.$refs.flow.setFieldValue(
  1048. // 'iamAuditProjectList',
  1049. // clist.concat(iamAuditProjectList)
  1050. // )
  1051. // this.childTableKey++
  1052. })
  1053. }
  1054. })
  1055. },
  1056. // 项目信息列表赋值
  1057. setProjectList(res) {
  1058. // 更新子表项目信息
  1059. debugger
  1060. const iamAuditProjectList = res
  1061. iamAuditProjectList.forEach((item) => {
  1062. if (item.projectPrincipalId) {
  1063. item.projectPrincipalId = JSON.stringify(item.projectPrincipalId)
  1064. }
  1065. if (item.auditedUnitIds) {
  1066. item.auditedUnitIds = JSON.stringify(item.auditedUnitIds)
  1067. }
  1068. })
  1069. const ids = []
  1070. const tableData = this.$refs.flow.getFieldValue('iamAuditProjectList')
  1071. const clist = tableData?.filter((item) => {
  1072. if (item.id) ids.push(item.id)
  1073. return !item.id
  1074. })
  1075. if (!clist) {
  1076. this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  1077. this.childTableKey++
  1078. return
  1079. }
  1080. iamAuditProjectList.forEach((item) => {
  1081. if (!ids.includes(item.id)) {
  1082. tableData.push(item)
  1083. }
  1084. })
  1085. this.$refs.flow.setFieldValue('iamAuditProjectList', tableData)
  1086. // this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  1087. this.childTableKey++
  1088. },
  1089. // 初始化高级字段信息
  1090. initAdvancedField(codeArryData, nameArryData, type) {
  1091. const resultDataArry = []
  1092. let codeArry = []
  1093. let nameArry = []
  1094. if (codeArryData !== null) {
  1095. codeArry = codeArryData.split(',')
  1096. }
  1097. if (nameArryData != null) {
  1098. nameArry = nameArryData.split(',')
  1099. }
  1100. for (let i = 0; i < codeArry.length; i++) {
  1101. resultDataArry.push({
  1102. type: type,
  1103. code: codeArry[i],
  1104. name: nameArry[i],
  1105. })
  1106. }
  1107. return resultDataArry
  1108. },
  1109. // 标题格式化
  1110. formatterTitle(val, length) {
  1111. var resultArry = []
  1112. let title = ''
  1113. let result = ''
  1114. if (val === undefined || val === '' || val === '[]') {
  1115. resultArry.push(title)
  1116. resultArry.push(result)
  1117. return resultArry
  1118. } else {
  1119. try {
  1120. JSON.parse(val).forEach((e) => {
  1121. result += e.name + ','
  1122. })
  1123. } catch (e) {
  1124. result = val
  1125. }
  1126. if (result.lastIndexOf(',') > 0) {
  1127. result = result.substr(0, result.length - 1)
  1128. }
  1129. title = result
  1130. if (result.length > length) {
  1131. result = result.substr(0, length) + '...'
  1132. }
  1133. resultArry.push(title)
  1134. resultArry.push(result)
  1135. return resultArry
  1136. }
  1137. },
  1138. // 展示选择列表
  1139. showselectexternal() {
  1140. this.modalvisible = !this.modalvisible
  1141. },
  1142. // 弹出窗确认
  1143. handleOk() {
  1144. this.showselectexternal()
  1145. // 获取别选择的行信息
  1146. const selectInfo = this.$refs.externalTable.getSelectedRows()
  1147. const list = []
  1148. selectInfo.forEach((item) => {
  1149. const obj = {
  1150. title: item.name,
  1151. id: item.id,
  1152. code: item.id,
  1153. name: item.name,
  1154. text: item.name,
  1155. type: 'Group',
  1156. props: {},
  1157. }
  1158. list.push(obj)
  1159. })
  1160. this.$refs.tabaData.$refs.form.model.externalUnitIds = list
  1161. this.externalUnitIds = list
  1162. },
  1163. // 弹出窗取消
  1164. handleCancel() {
  1165. this.showselectexternal()
  1166. },
  1167. },
  1168. }
  1169. </script>
  1170. <style module lang="scss">
  1171. @use '@/common/design' as *;
  1172. .odrForm {
  1173. /* :global .sd-page-title {
  1174. display: none;
  1175. } */
  1176. :global(.child-table-title) {
  1177. display: none;
  1178. }
  1179. .lastTr {
  1180. :global(.ant-form-item-control-wrapper) {
  1181. border: none !important;
  1182. }
  1183. }
  1184. :global(.header_sd-child-table_common) {
  1185. right: 115px !important;
  1186. }
  1187. .btnexcel {
  1188. position: relative;
  1189. top: -5px;
  1190. float: right;
  1191. .batchexcel {
  1192. z-index: 100;
  1193. margin-left: 10px;
  1194. }
  1195. .autoprequeue {
  1196. right: 180px;
  1197. z-index: 100;
  1198. }
  1199. .viewSjjh {
  1200. right: 180px;
  1201. z-index: 100;
  1202. }
  1203. }
  1204. :global(.ant-form-item-label > label) {
  1205. width: 100% !important;
  1206. white-space: normal;
  1207. }
  1208. }
  1209. .projecttable {
  1210. table {
  1211. border-collapse: collapse;
  1212. }
  1213. }
  1214. .iam-audit-child-table {
  1215. :global(td.ant-form-item-label) {
  1216. width: 15%;
  1217. padding-right: 20px;
  1218. overflow: auto;
  1219. white-space: normal;
  1220. }
  1221. :global(td.ant-form-item-label::after) {
  1222. position: absolute;
  1223. margin: 0 8px 0 8px;
  1224. content: ':';
  1225. }
  1226. :global(td.ant-form-item-label > label::after) {
  1227. margin: 0;
  1228. content: '';
  1229. }
  1230. :global(td.ant-form-item-control-wrapper) {
  1231. width: 32%;
  1232. }
  1233. }
  1234. :global(.auditplanformmodalcksjjh) {
  1235. :global(.ant-pagination) {
  1236. display: none;
  1237. }
  1238. }
  1239. </style>