audit-plan-form.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  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: '20px',
  520. customRender: (text, record, index) => `${index + 1}`,
  521. },
  522. {
  523. dataIndex: 'id',
  524. sdHidden: true,
  525. },
  526. {
  527. title: '企业名称',
  528. dataIndex: 'name',
  529. width: '300px',
  530. },
  531. {
  532. title: '类型',
  533. dataIndex: 'category',
  534. width: '150px',
  535. },
  536. {
  537. title: '住所',
  538. dataIndex: 'address',
  539. width: '100px',
  540. },
  541. ],
  542. expressions: [],
  543. externalUnitIds: [],
  544. isSave: false, // 是否有保存操作
  545. orgid: '',
  546. auditTypeOptions: [],
  547. modalviewvisible: false,
  548. viewSjsize: 3,
  549. viewSjjhcolumns3: [
  550. {
  551. title: '单位名称',
  552. dataIndex: 'unitName',
  553. },
  554. ],
  555. viewSjjhcolumns4: [
  556. {
  557. title: '单位名称',
  558. dataIndex: 'unitName',
  559. },
  560. ],
  561. viewSjyears: [],
  562. }
  563. },
  564. computed: {
  565. // 计算随机key
  566. randomId() {
  567. let randomNum = Math.random()
  568. while (randomNum === 0) {
  569. randomNum = Math.random()
  570. }
  571. const time = new Date().getTime()
  572. return time + Math.ceil(randomNum * 1000000000)
  573. },
  574. },
  575. mounted() {
  576. // 监听关闭事件,关闭时如果没有保存操作且没有id,则直接删除所有子表
  577. window.addEventListener('beforeunload', (e) => {
  578. this.beforeunloadHandler(e)
  579. })
  580. // 日期下拉框初始化
  581. this.initDateSelect()
  582. axios({
  583. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=PRODUCT_IAM_AUDIT_TYPE',
  584. method: 'get',
  585. }).then((res) => {
  586. if (res.status === 200) {
  587. this.auditTypeOptions = res.data
  588. }
  589. })
  590. const groupId = this.$refs.flow.getFieldValue('unitId')
  591. // axios({
  592. // url: 'api/xcoa-mobile/v1/iamauditplan/childGroup?unitCode=' + groupId,
  593. // method: 'get',
  594. // }).then((res) => {
  595. // if (res.status === 200) {
  596. // this.unitIdList = res.data
  597. // }
  598. // })
  599. },
  600. methods: {
  601. // 控制请求处理
  602. processReq(req) {
  603. debugger
  604. const groupId = this.$refs.flow.getFieldValue('unitId')
  605. const planYear = this.$refs.flow.getFieldValue('planYear')
  606. var unitIdArray = []
  607. var projectNames = []
  608. const child = this.$refs.flow.getFieldValue('iamAuditProjectList')
  609. if (child) {
  610. child.forEach((c) => {
  611. if (c.whetherAuditCoverage === '1') {
  612. if (c.auditedUnitIds) {
  613. JSON.parse(c.auditedUnitIds).forEach((d) => {
  614. unitIdArray.push(d.code)
  615. })
  616. }
  617. if (c.projectTitle) {
  618. projectNames.push(c.projectTitle)
  619. }
  620. }
  621. })
  622. } else {
  623. unitIdArray = this.unitIdList
  624. }
  625. var projectNameArray = []
  626. if (projectNames !== undefined || projectNames !== null) {
  627. projectNameArray = projectNames.join(',')
  628. }
  629. req.url =
  630. 'api/xcoa-mobile/v1/iamauditplan/findPlanArrangement?groupId=' +
  631. groupId +
  632. '&unitIdList=' +
  633. unitIdArray.join(',') +
  634. '&year=' +
  635. planYear +
  636. '&projectNames=' +
  637. projectNameArray
  638. console.log(req)
  639. return req
  640. },
  641. processRes(res) {
  642. const datas = []
  643. res.data.forEach((d, index) => {
  644. const obj = {
  645. unitName: d['单位名称'],
  646. jl: d['结论'],
  647. gz: d['规则'],
  648. id: index,
  649. }
  650. this.viewSjyears.forEach((y) => {
  651. obj[y] = d[y]
  652. })
  653. datas.push(obj)
  654. })
  655. this.viewSjsize = res.size
  656. return { datas: datas, total: res.data?.length }
  657. },
  658. getFormSelectFieldValue(name, value) {
  659. let result = ''
  660. if (value !== undefined) {
  661. if (name === 'auditType') {
  662. const resultArry = this.auditTypeOptions.filter((e) => {
  663. return e.id === value
  664. })
  665. if (resultArry.length > 0) {
  666. result = resultArry[0].name
  667. }
  668. }
  669. if (name === 'auditMode') {
  670. const resultArry = this.auditModeOptions.filter((e) => {
  671. return e.id === value
  672. })
  673. if (resultArry.length > 0) {
  674. result = resultArry[0].name
  675. }
  676. }
  677. if (name === 'auditBasis') {
  678. const resultArry = this.auditBasisOptions.filter((e) => {
  679. return e.id === value
  680. })
  681. if (resultArry.length > 0) {
  682. result = resultArry[0].name
  683. }
  684. }
  685. if (name === 'projectSource') {
  686. const resultArry = this.projectSourceOptions.filter((e) => {
  687. return e.id === value
  688. })
  689. if (resultArry.length > 0) {
  690. result = resultArry[0].name
  691. }
  692. }
  693. }
  694. return result
  695. },
  696. // 关闭窗口监听
  697. beforeunloadHandler(e) {
  698. if (!this.isSave && !this.$refs.flow.getFieldValue('id')) {
  699. const strid = this.$refs.flow.getFieldValue('iamAuditProjectList').map((item) => {
  700. return item.id
  701. })
  702. if (strid.length > 0) {
  703. // 删除子表内容,防止垃圾数据
  704. axios({
  705. url: `api/xcoa-mobile/v1/iamauditproject/changeProject?planId=${this.planId}&ids=`,
  706. method: 'get',
  707. })
  708. }
  709. }
  710. },
  711. // 保存操作,记录标识位
  712. saveproject() {
  713. this.isSave = true
  714. },
  715. /**
  716. * 提交后事件
  717. */
  718. afterDispatch() {
  719. // 提交也认为是保存
  720. this.isSave = true
  721. },
  722. initData(model) {
  723. // eslint-disable-next-line babel/no-unused-expressions
  724. this.$refs.flow?.setFieldValue('randomId', this.randomId)
  725. if (this.$route.params.id !== '0') {
  726. this.orgid = model.auditOrgId
  727. } else {
  728. const params = {
  729. orgId: model.unitId,
  730. }
  731. AuditService.findIamOrgId(params).then((res) => {
  732. this.orgid = res.data
  733. })
  734. }
  735. return false
  736. },
  737. // 日期下拉框初始化
  738. initDateSelect() {
  739. const nowYear = new Date().getFullYear()
  740. this.yearArry.push(nowYear)
  741. for (let i = 1; i < 6; i++) {
  742. this.yearArry.push(nowYear - i)
  743. }
  744. for (let i = 1; i < 11; i++) {
  745. this.yearArry.push(nowYear + i)
  746. }
  747. this.yearArry.sort()
  748. if (this.$refs.flow.getFieldValue('planYear') === undefined) {
  749. this.$refs.flow.setFieldValue('planYear', nowYear + '')
  750. }
  751. },
  752. actionBtnClick(evt, context) {
  753. const { button, FlowData } = context
  754. if (button.fakeId === 'save' || button.fakeId === 'workflow-push') {
  755. // 保存前先校验计划是否已经存在
  756. evt.waitUntil(
  757. new Promise((resolve, reject) => {
  758. this.handleBeforeAdd(null, (res) => {
  759. if (res) {
  760. evt.preventDefault()
  761. }
  762. resolve()
  763. })
  764. })
  765. )
  766. }
  767. if (button.fakeId === 'workflow-push') {
  768. if (button.buttonId === 'G_1_IAM_AUDITPLAN.3') {
  769. const childTable = this.$refs.flow.getFieldValue('iamAuditProjectList')
  770. evt.waitUntil(
  771. new Promise(function (resolve, reject) {
  772. if (childTable && childTable.length === 0) {
  773. Modal.warning({
  774. title: '提示',
  775. content: '请录入项目信息!',
  776. })
  777. // eslint-disable-next-line prefer-promise-reject-errors
  778. reject()
  779. } else {
  780. resolve()
  781. }
  782. })
  783. )
  784. }
  785. }
  786. },
  787. // 序号赋值
  788. changeNum(data) {
  789. const arr = []
  790. data.forEach((item, index) => {
  791. if (item.id) {
  792. arr.push(`${item.id}`)
  793. }
  794. item.sortNum = index + 1
  795. })
  796. const ids = arr.join(',')
  797. this.planId = parseInt(this.$refs.flow.flowData.processFormData.beanId)
  798. if (!this.planId) {
  799. this.planId = this.randomId
  800. }
  801. axios.get(
  802. 'api/xcoa-mobile/v1/iamauditproject/changeProject?planId=' + this.planId + '&ids=' + ids
  803. )
  804. },
  805. handleBeforeAdd(val, callback) {
  806. this.externalUnitIds = []
  807. const projectList = this.$refs.flow.FlowData.processFormData.processFormPropertyValues.find(
  808. (item) => {
  809. return item.name === 'iamAuditProjectList'
  810. }
  811. )
  812. if (projectList) {
  813. projectList.attr.dync.find((item) => {
  814. return item.name === 'auditedUnitIds'
  815. }).required = false
  816. }
  817. const id = parseInt(this.$refs.flow.flowData.processFormData.beanId)
  818. const planYear = this.$refs.flow.getFieldValue('planYear')
  819. AuditService.existYearPlan(id, planYear, this.orgid).then((res) => {
  820. // 检查指定年份年度计划是否已经存在
  821. if (res.data) {
  822. Modal.warning({
  823. title: '提示',
  824. content: '该年度计划已存在!',
  825. })
  826. }
  827. callback(res.data)
  828. })
  829. },
  830. // 批量导入
  831. batchInport() {
  832. this.importLoading = false
  833. this.handleBeforeAdd(null, (res) => {
  834. if (!res) {
  835. this.planId = parseInt(this.$refs.flow.flowData.processFormData.beanId)
  836. if (!this.planId) {
  837. this.planId = this.randomId
  838. }
  839. this.$refs.import.showImportPanel()
  840. } else {
  841. setTimeout(() => {
  842. this.importLoading = false
  843. }, 1000)
  844. }
  845. })
  846. },
  847. // 查看审计计划安排情况
  848. viewSjjh() {
  849. debugger
  850. const planYear = this.$refs.flow.getFieldValue('planYear')
  851. this.viewSjjhcolumns3 = [
  852. {
  853. title: '单位名称',
  854. dataIndex: 'unitName',
  855. scopedSlots: { customRender: 'unitName' },
  856. },
  857. ]
  858. // this.viewSjjhcolumns4 = [
  859. // {
  860. // title: '单位名称',
  861. // dataIndex: 'unitName',
  862. // scopedSlots: { customRender: 'unitName' },
  863. // },
  864. // ]
  865. const years = []
  866. for (var s = 3; s > -1; s--) {
  867. const planYear1 = parseInt(planYear) - s
  868. this.viewSjjhcolumns3.push({
  869. title: planYear1 + '年',
  870. dataIndex: planYear1.toString(),
  871. scopedSlots: { customRender: 'year' },
  872. })
  873. // if (s !== 3) {
  874. // this.viewSjjhcolumns3.push({
  875. // title: planYear1 + '年',
  876. // dataIndex: planYear1.toString(),
  877. // scopedSlots: { customRender: 'year' },
  878. // })
  879. // }
  880. years.push(planYear1.toString())
  881. }
  882. this.viewSjyears = years
  883. this.viewSjjhcolumns3.push({
  884. title: '结论',
  885. dataIndex: 'jl',
  886. scopedSlots: { customRender: 'jl' },
  887. })
  888. // this.viewSjjhcolumns4.push({
  889. // title: '结论',
  890. // dataIndex: 'jl',
  891. // scopedSlots: { customRender: 'jl' },
  892. // })
  893. this.$nextTick(() => {
  894. this.modalviewvisible = !this.modalviewvisible
  895. })
  896. },
  897. // 自动预排
  898. autoPrequeue() {
  899. const id = this.$refs.flow.flowData.processFormData.beanId
  900. const planYear = this.$refs.flow.getFieldValue('planYear')
  901. var data = null
  902. AuditService.existYearPlan(id, planYear, this.orgid).then((res) => {
  903. // 检查指定年份年度计划是否已经存在
  904. if (res.data) {
  905. Modal.warning({
  906. title: '提示',
  907. content: '该年度计划已存在!',
  908. })
  909. } else {
  910. const unitCode = this.$refs.flow.getFieldValue('unitId')
  911. const child = this.$refs.flow.getFieldValue('iamAuditProjectList')
  912. const unitIdList = []
  913. if (child) {
  914. child.forEach((c) => {
  915. if (c.whetherAuditCoverage === '1') {
  916. if (c.auditedUnitIds) {
  917. JSON.parse(c.auditedUnitIds).forEach((d) => {
  918. unitIdList.push(d.code)
  919. })
  920. }
  921. }
  922. })
  923. }
  924. AuditService.autoPrequeue(id, unitCode, planYear, unitIdList).then((res) => {
  925. debugger
  926. // 自动预排
  927. if (res.data) {
  928. // 更新子表项目信息
  929. const iamAuditProjectList = res.data
  930. iamAuditProjectList.forEach((item) => {
  931. // if (item.projectPrincipalId) {
  932. // item.projectPrincipalId = JSON.stringify(item.projectPrincipalId)
  933. // }
  934. item.id = item.id || 'fakeId_' + Math.random()
  935. if (item.auditedUnitIds) {
  936. item.auditedUnitIds = JSON.stringify(item.auditedUnitIds)
  937. }
  938. })
  939. const tableData = this.$refs.flow.getFieldValue('iamAuditProjectList')
  940. if (tableData) {
  941. this.$refs.flow.setFieldValue(
  942. 'iamAuditProjectList',
  943. tableData.concat(iamAuditProjectList)
  944. )
  945. } else {
  946. this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  947. }
  948. this.childTableKey++
  949. }
  950. })
  951. }
  952. })
  953. },
  954. getDay(model) {
  955. debugger
  956. const planStartTime = model.planStartTime
  957. const planEndTime = model.planEndTime
  958. if (planStartTime !== undefined && planEndTime !== undefined) {
  959. const planDays =
  960. (new Date(moment(planEndTime).format('YYYY/MM/DD')).getTime() -
  961. new Date(moment(planStartTime).format('YYYY/MM/DD')).getTime()) /
  962. 1000 /
  963. 60 /
  964. 60 /
  965. 24
  966. model.planDays = (1 + planDays).toString()
  967. } else {
  968. model.planDays = ''
  969. }
  970. return model
  971. },
  972. importHandleCancel() {
  973. // 导入取消函数
  974. setTimeout(() => {
  975. this.importLoading = false
  976. }, 1000)
  977. },
  978. // 导入前置函数
  979. importfromfileBefore() {
  980. this.inited = false
  981. },
  982. // 导入项目回调函数
  983. importfromfileAfter() {
  984. // 通过计划id获取计划信息
  985. AuditService.getAuditPlanById(this.planId).then((res) => {
  986. this.inited = true
  987. if (res.data != null && res.data !== '') {
  988. this.setProjectList(res.data.iamAuditProjectList)
  989. } else {
  990. axios
  991. .get('api/xcoa-mobile/v1/iamauditproject/getProjectEntity?id=' + this.planId)
  992. .then((res) => {
  993. this.setProjectList(res.data)
  994. setTimeout(() => {
  995. this.importLoading = false
  996. }, 1000)
  997. // // 更新子表项目信息
  998. // const iamAuditProjectList = res.data
  999. // iamAuditProjectList.forEach((item) => {
  1000. // if (item.projectPrincipalId) {
  1001. // item.projectPrincipalId = JSON.stringify(item.projectPrincipalId)
  1002. // }
  1003. // if (item.auditedUnitIds) {
  1004. // item.auditedUnitIds = JSON.stringify(item.auditedUnitIds)
  1005. // }
  1006. // })
  1007. // const ids = []
  1008. // const tableData = this.$refs.flow.getFieldValue('iamAuditProjectList')
  1009. // const clist = tableData?.filter((item) => {
  1010. // if (item.id) ids.push(item.id)
  1011. // return !item.id
  1012. // })
  1013. // if (!clist) {
  1014. // this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  1015. // this.childTableKey++
  1016. // return
  1017. // }
  1018. // this.$refs.flow.setFieldValue(
  1019. // 'iamAuditProjectList',
  1020. // clist.concat(iamAuditProjectList)
  1021. // )
  1022. // this.childTableKey++
  1023. })
  1024. }
  1025. })
  1026. },
  1027. // 项目信息列表赋值
  1028. setProjectList(res) {
  1029. // 更新子表项目信息
  1030. debugger
  1031. const iamAuditProjectList = res
  1032. iamAuditProjectList.forEach((item) => {
  1033. if (item.projectPrincipalId) {
  1034. item.projectPrincipalId = JSON.stringify(item.projectPrincipalId)
  1035. }
  1036. if (item.auditedUnitIds) {
  1037. item.auditedUnitIds = JSON.stringify(item.auditedUnitIds)
  1038. }
  1039. })
  1040. const ids = []
  1041. const tableData = this.$refs.flow.getFieldValue('iamAuditProjectList')
  1042. const clist = tableData?.filter((item) => {
  1043. if (item.id) ids.push(item.id)
  1044. return !item.id
  1045. })
  1046. if (!clist) {
  1047. this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  1048. this.childTableKey++
  1049. return
  1050. }
  1051. iamAuditProjectList.forEach((item) => {
  1052. if (!ids.includes(item.id)) {
  1053. tableData.push(item)
  1054. }
  1055. })
  1056. this.$refs.flow.setFieldValue('iamAuditProjectList', tableData)
  1057. // this.$refs.flow.setFieldValue('iamAuditProjectList', iamAuditProjectList)
  1058. this.childTableKey++
  1059. },
  1060. // 初始化高级字段信息
  1061. initAdvancedField(codeArryData, nameArryData, type) {
  1062. const resultDataArry = []
  1063. let codeArry = []
  1064. let nameArry = []
  1065. if (codeArryData !== null) {
  1066. codeArry = codeArryData.split(',')
  1067. }
  1068. if (nameArryData != null) {
  1069. nameArry = nameArryData.split(',')
  1070. }
  1071. for (let i = 0; i < codeArry.length; i++) {
  1072. resultDataArry.push({
  1073. type: type,
  1074. code: codeArry[i],
  1075. name: nameArry[i],
  1076. })
  1077. }
  1078. return resultDataArry
  1079. },
  1080. // 标题格式化
  1081. formatterTitle(val, length) {
  1082. var resultArry = []
  1083. let title = ''
  1084. let result = ''
  1085. if (val === undefined || val === '' || val === '[]') {
  1086. resultArry.push(title)
  1087. resultArry.push(result)
  1088. return resultArry
  1089. } else {
  1090. try {
  1091. JSON.parse(val).forEach((e) => {
  1092. result += e.name + ','
  1093. })
  1094. } catch (e) {
  1095. result = val
  1096. }
  1097. if (result.lastIndexOf(',') > 0) {
  1098. result = result.substr(0, result.length - 1)
  1099. }
  1100. title = result
  1101. if (result.length > length) {
  1102. result = result.substr(0, length) + '...'
  1103. }
  1104. resultArry.push(title)
  1105. resultArry.push(result)
  1106. return resultArry
  1107. }
  1108. },
  1109. // 展示选择列表
  1110. showselectexternal() {
  1111. this.modalvisible = !this.modalvisible
  1112. },
  1113. // 弹出窗确认
  1114. handleOk() {
  1115. this.showselectexternal()
  1116. // 获取别选择的行信息
  1117. const selectInfo = this.$refs.externalTable.getSelectedRows()
  1118. const list = []
  1119. selectInfo.forEach((item) => {
  1120. const obj = {
  1121. title: item.name,
  1122. id: item.id,
  1123. code: item.id,
  1124. name: item.name,
  1125. text: item.name,
  1126. type: 'Group',
  1127. props: {},
  1128. }
  1129. list.push(obj)
  1130. })
  1131. this.$refs.tabaData.$refs.form.model.externalUnitIds = list
  1132. this.externalUnitIds = list
  1133. },
  1134. // 弹出窗取消
  1135. handleCancel() {
  1136. this.showselectexternal()
  1137. },
  1138. },
  1139. }
  1140. </script>
  1141. <style module lang="scss">
  1142. @use '@/common/design' as *;
  1143. .odrForm {
  1144. /* :global .sd-page-title {
  1145. display: none;
  1146. } */
  1147. :global(.child-table-title) {
  1148. display: none;
  1149. }
  1150. .lastTr {
  1151. :global(.ant-form-item-control-wrapper) {
  1152. border: none !important;
  1153. }
  1154. }
  1155. :global(.header_sd-child-table_common) {
  1156. right: 115px !important;
  1157. }
  1158. .btnexcel {
  1159. position: relative;
  1160. top: -5px;
  1161. float: right;
  1162. .batchexcel {
  1163. z-index: 100;
  1164. margin-left: 10px;
  1165. }
  1166. .autoprequeue {
  1167. right: 180px;
  1168. z-index: 100;
  1169. }
  1170. .viewSjjh {
  1171. right: 180px;
  1172. z-index: 100;
  1173. }
  1174. }
  1175. :global(.ant-form-item-label > label) {
  1176. width: 100% !important;
  1177. white-space: normal;
  1178. }
  1179. }
  1180. .projecttable {
  1181. table {
  1182. border-collapse: collapse;
  1183. }
  1184. }
  1185. .iam-audit-child-table {
  1186. :global(td.ant-form-item-label) {
  1187. width: 15%;
  1188. padding-right: 20px;
  1189. overflow: auto;
  1190. white-space: normal;
  1191. }
  1192. :global(td.ant-form-item-label::after) {
  1193. position: absolute;
  1194. margin: 0 8px 0 8px;
  1195. content: ':';
  1196. }
  1197. :global(td.ant-form-item-label > label::after) {
  1198. margin: 0;
  1199. content: '';
  1200. }
  1201. :global(td.ant-form-item-control-wrapper) {
  1202. width: 32%;
  1203. }
  1204. }
  1205. :global(.auditplanformmodalcksjjh) {
  1206. :global(.ant-pagination) {
  1207. display: none;
  1208. }
  1209. }
  1210. </style>