audit-project-rectification-unit.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <div :class="$style.auditProRectify">
  3. <a-card :class="$style.conditions">
  4. <a-form-model
  5. ref="advancedSearchForm"
  6. class="ant-advanced-search-form"
  7. :model="form"
  8. :rules="rules"
  9. v-bind="formItemLayout"
  10. >
  11. <a-row :gutter="24" :class="$style.antformitem">
  12. <a-col :span="8">
  13. <a-form-model-item label="年度" prop="timeRange">
  14. <AuditRangePicker :time-range.sync="form.timeRange" />
  15. </a-form-model-item>
  16. </a-col>
  17. <a-col :span="8">
  18. <a-form-model-item label="审计机构" prop="unitNames">
  19. <AuditGroupPicker
  20. ref="unitNames"
  21. v-model="form.unitNames"
  22. :single="true"
  23. :read-only="false"
  24. :root-node="rootNode"
  25. />
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :span="8">
  29. <a-form-model-item label="整改单位" prop="rectifyUnits">
  30. <sd-group-picker
  31. ref="rectifyUnits"
  32. v-model="form.rectifyUnits"
  33. :single="false"
  34. :read-only="false"
  35. /> </a-form-model-item
  36. ></a-col>
  37. </a-row>
  38. </a-form-model>
  39. <div :class="$style.buttonContent">
  40. <a-button @click="handleReset">重置</a-button>
  41. <a-button type="primary" @click="handleAction('serach')">查询</a-button>
  42. <a-button :loading="exportLoading" type="primary" @click="handleAction('export')"
  43. >导出</a-button
  44. >
  45. </div>
  46. </a-card>
  47. <p :class="$style.tableTitle"> 整改情况统计(按整改单位查询) </p>
  48. <a-card class="reporttablecardxm">
  49. <div id="hj" style="display: none">
  50. <sd-data-table-hj
  51. ref="dataTablesum"
  52. :key="dataKeysum"
  53. :process-req="processReqsum"
  54. :columns="columnssum"
  55. :projectlist="true"
  56. :defultpagination-pagesize="50"
  57. data-url="api/xcoa-mobile/v1/iam-statistics/getUnitRectifyStatusList"
  58. @dataLoaded1="dataLoadedsum"
  59. @rowClick="rowClick"
  60. >
  61. <template slot="number" slot-scope="text, record">
  62. {{ text ? text : '0' }}
  63. </template>
  64. </sd-data-table-hj>
  65. </div>
  66. <sd-data-table
  67. ref="dataTable"
  68. :key="dataKey"
  69. :process-req="processReq"
  70. :columns="columns"
  71. :projectlist="true"
  72. :defultpagination-pagesize="50"
  73. data-url="api/xcoa-mobile/v1/iam-statistics/getUnitRectifyStatusList"
  74. @fnonloadsum="fnonloadsum"
  75. @dataLoaded="dataLoaded"
  76. @rowClick="rowClick"
  77. >
  78. <template slot="number" slot-scope="text, record">
  79. {{ text ? text : '0' }}
  80. </template>
  81. </sd-data-table>
  82. </a-card>
  83. </div>
  84. </template>
  85. <script>
  86. import AuditRangePicker from '../../components/picker/audit-range-picker.vue'
  87. import AuditGroupPicker from '../../components/picker/audit-group-picker.vue'
  88. import StatisticsService from './statistics-service'
  89. import components from './_import-components/audit-project-rectification-unit-import'
  90. import { message } from '@/common/one-ui'
  91. import axios from '@/common/services/axios-instance'
  92. import { getUserInfo } from '@/common/store-mixin'
  93. import download from '@/common/services/download'
  94. export default {
  95. name: 'AuditProjectRectificationUnit',
  96. metaInfo: {
  97. title: '整改情况统计',
  98. },
  99. components: {
  100. ...components,
  101. AuditRangePicker,
  102. AuditGroupPicker,
  103. },
  104. data() {
  105. return {
  106. exportLoading: false,
  107. dataKey: 0,
  108. dataKeysum: 0,
  109. form: {
  110. rectifyUnits: [],
  111. unitNames: [],
  112. timeRange: [],
  113. },
  114. rules: {
  115. timeRange: [{ required: true, message: '请选择统计时间', trigger: 'change' }],
  116. unitNames: [{ required: true, message: '请选择审计机构', trigger: 'change' }],
  117. },
  118. columns: [
  119. {
  120. title: '序号',
  121. dataIndex: 'id',
  122. width: '66px',
  123. },
  124. {
  125. title: '整改单位',
  126. dataIndex: 'RESP_UNIT_NAME',
  127. width: '100px',
  128. },
  129. {
  130. title: '需要整改问题(条)',
  131. dataIndex: 'NUM',
  132. width: '160px',
  133. scopedSlots: { customRender: 'number' },
  134. sdClickable: true,
  135. },
  136. {
  137. title: '已整改',
  138. dataIndex: 'DONE',
  139. width: '80px',
  140. scopedSlots: { customRender: 'number' },
  141. sdClickable: true,
  142. },
  143. {
  144. title: '整改中',
  145. dataIndex: 'DOING',
  146. width: '80px',
  147. scopedSlots: { customRender: 'number' },
  148. sdClickable: true,
  149. },
  150. {
  151. title: '未整改',
  152. dataIndex: 'TODO',
  153. width: '80px',
  154. scopedSlots: { customRender: 'number' },
  155. sdClickable: true,
  156. },
  157. {
  158. title: '超期未整改',
  159. dataIndex: 'EXPIRE',
  160. width: '115px',
  161. scopedSlots: { customRender: 'number' },
  162. sdClickable: true,
  163. },
  164. {
  165. title: '风险接受',
  166. dataIndex: 'RISK',
  167. width: '100px',
  168. scopedSlots: { customRender: 'number' },
  169. sdClickable: true,
  170. },
  171. {
  172. title: '整改完成率',
  173. dataIndex: 'PERCENT',
  174. width: '115px',
  175. },
  176. {
  177. title: '实际整改完成率',
  178. dataIndex: 'REAL_PERCENT',
  179. width: '115px',
  180. },
  181. ],
  182. columnssum: [
  183. {
  184. title: '整改单位',
  185. dataIndex: 'RESP_UNIT_NAME',
  186. width: '100px',
  187. colspan: 2,
  188. },
  189. {
  190. title: '需要整改问题(条)',
  191. dataIndex: 'NUM',
  192. width: '160px',
  193. scopedSlots: { customRender: 'number' },
  194. sdClickable: true,
  195. },
  196. {
  197. title: '已整改',
  198. dataIndex: 'DONE',
  199. width: '80px',
  200. scopedSlots: { customRender: 'number' },
  201. sdClickable: true,
  202. },
  203. {
  204. title: '整改中',
  205. dataIndex: 'DOING',
  206. width: '80px',
  207. scopedSlots: { customRender: 'number' },
  208. sdClickable: true,
  209. },
  210. {
  211. title: '未整改',
  212. dataIndex: 'TODO',
  213. width: '80px',
  214. scopedSlots: { customRender: 'number' },
  215. sdClickable: true,
  216. },
  217. {
  218. title: '超期未整改',
  219. dataIndex: 'EXPIRE',
  220. width: '115px',
  221. scopedSlots: { customRender: 'number' },
  222. sdClickable: true,
  223. },
  224. {
  225. title: '风险接受',
  226. dataIndex: 'RISK',
  227. width: '100px',
  228. scopedSlots: { customRender: 'number' },
  229. sdClickable: true,
  230. },
  231. {
  232. title: '整改完成率',
  233. dataIndex: 'PERCENT',
  234. width: '115px',
  235. },
  236. {
  237. title: '实际整改完成率',
  238. dataIndex: 'REAL_PERCENT',
  239. width: '115px',
  240. },
  241. ],
  242. reqData: {
  243. dateStart: '3000',
  244. dateEnd: '',
  245. unitNames: '',
  246. rectifyUnits: '',
  247. },
  248. data: [],
  249. formItemLayout: {
  250. labelCol: { span: 6 },
  251. wrapperCol: { span: 14 },
  252. },
  253. hj: {},
  254. hjarr: [],
  255. rootNode: {},
  256. }
  257. },
  258. created() {
  259. let userInfo = getUserInfo()
  260. const params = {
  261. orgId: userInfo.deptId,
  262. }
  263. axios({
  264. url: 'api/xcoa-mobile/v1/iamorg/getCurrentUserGroup',
  265. method: 'get',
  266. }).then((res) => {
  267. userInfo = res.data
  268. params.orgId = res.data.id
  269. axios({
  270. url: 'api/xcoa-mobile/v1/iamorg/findIamOrgId',
  271. method: 'post',
  272. params,
  273. }).then((res) => {
  274. this.id = res.data
  275. const deptCode = userInfo.id.toString()
  276. const deptName = userInfo.name
  277. this.rootNode = { code: deptCode, name: deptName, id: this.id }
  278. })
  279. })
  280. },
  281. mounted() {
  282. const ym =
  283. 'questionTotal;doneTotal;doingTotal;todoTotal;expireTotal;riskTotal;percentTotal;realPercentTotal'
  284. const arrym = ym.split(';')
  285. const data = ['', 'DONE', 'DOING', 'TODO', 'EXPIRE', 'RISK', '', '']
  286. arrym.forEach((a, index) => {
  287. this.hjarr.push({
  288. title: a,
  289. dataIndex: data[index],
  290. })
  291. })
  292. },
  293. methods: {
  294. processReq(req, pagination) {
  295. req.data = {
  296. maxResults: req.data.maxResults,
  297. startPosition: req.data.startPosition,
  298. dateStart: this.reqData.dateStart,
  299. dateEnd: this.reqData.dateEnd,
  300. unitIds: this.reqData.unitNames,
  301. rectifyUnits: this.reqData.rectifyUnits,
  302. }
  303. return req
  304. },
  305. dataLoaded(res) {
  306. if (res.data.length) {
  307. res.data.forEach((item, index) => {
  308. item.id = index + 1
  309. })
  310. this.hjarr.forEach((item) => {
  311. this.hj[item.title] = res.respData[item.title]
  312. })
  313. return res
  314. }
  315. },
  316. processReqsum(req, pagination) {
  317. req.data = {
  318. maxResults: req.data.maxResults,
  319. startPosition: req.data.startPosition,
  320. dateStart: this.reqData.dateStart,
  321. dateEnd: this.reqData.dateEnd,
  322. unitIds: this.reqData.unitNames,
  323. rectifyUnits: this.reqData.rectifyUnits,
  324. }
  325. return req
  326. },
  327. dataLoadedsum(res) {
  328. if (res.data.length) {
  329. res.data.splice(0, res.data.length)
  330. const obj = {}
  331. this.columns.forEach((item, index) => {
  332. if (index > 1) {
  333. obj[item.dataIndex] = res.respData[this.hjarr[index - 2].title]
  334. }
  335. })
  336. obj.id = 1
  337. obj.RESP_UNIT_NAME = '总计'
  338. res.data.push(obj)
  339. return res
  340. }
  341. },
  342. fnonloadsum() {
  343. setTimeout(() => {
  344. if (
  345. document
  346. .getElementById('hj')
  347. .getElementsByClassName('ant-table-tbody')[0]
  348. .getElementsByTagName('tr').length > 0
  349. ) {
  350. const obj = document
  351. .getElementById('hj')
  352. .getElementsByClassName('ant-table-tbody')[0].firstChild
  353. obj.firstChild.colSpan = 2
  354. obj.classList.add('childsum')
  355. document.getElementsByClassName('ant-table-tbody')[1].appendChild(obj)
  356. }
  357. }, 500)
  358. },
  359. handleReset() {
  360. this.$refs.advancedSearchForm.resetFields()
  361. },
  362. handleAction(type) {
  363. this.$refs.advancedSearchForm.validate((valid, values) => {
  364. if (valid) {
  365. // 处理时间
  366. this.reqData.dateStart = this.form.timeRange[0].year() + ''
  367. this.reqData.dateEnd = this.form.timeRange[1].year() + ''
  368. // 处理部门
  369. const arr = []
  370. this.form.unitNames.forEach((item) => {
  371. arr.push(`'${item.id}'`)
  372. })
  373. this.reqData.unitNames = arr.join(',')
  374. // 处理整改部门
  375. const arr2 = []
  376. this.form.rectifyUnits.forEach((item) => {
  377. arr2.push(`'${item.name}'`)
  378. })
  379. this.reqData.rectifyUnits = arr2.join(',')
  380. // 调用方法
  381. switch (type) {
  382. case 'serach':
  383. this.handleSearch()
  384. break
  385. case 'export':
  386. this.reqData.unitIds = arr.join(',')
  387. this.handleExport()
  388. break
  389. }
  390. }
  391. })
  392. },
  393. handleSearch() {
  394. this.reqData.startPosition = 0
  395. this.dataKey++
  396. this.dataKeysum++
  397. },
  398. handleExport() {
  399. if (this.$refs.dataTable.data.length === 0) {
  400. message.warning('未查询出可导出数据', 1)
  401. return
  402. }
  403. this.exportLoading = true
  404. StatisticsService.exportUnitRectifyList(this.reqData).then((data) => {
  405. const url = URL.createObjectURL(data)
  406. download(url, '整改情况统计表.xls')
  407. this.exportLoading = false
  408. })
  409. },
  410. rowClick(record, { rowIndex, column }) {
  411. const param = {
  412. dateStart: this.reqData.dateStart,
  413. dateEnd: this.reqData.dateEnd,
  414. unitIds: this.reqData.unitNames,
  415. }
  416. if (record) {
  417. if (record.RESP_UNIT_NAME !== '总计') {
  418. param.rectifyUnits = "'" + record.RESP_UNIT_NAME + "'"
  419. }
  420. }
  421. console.log(column)
  422. if (column.dataIndex === 'DONE') {
  423. // 已整改
  424. param.rectStatus = '03'
  425. } else if (column.dataIndex === 'DOING') {
  426. // 整改中
  427. param.rectStatus = '02'
  428. } else if (column.dataIndex === 'TODO') {
  429. // 未整改
  430. param.rectStatus = '01'
  431. } else if (column.dataIndex === 'EXPIRE') {
  432. // 超期未整改
  433. param.isTrue = 1
  434. } else if (column.dataIndex === 'RISK') {
  435. // 风险接受
  436. param.rectStatus = '04'
  437. }
  438. param.rectUnitFlag = 'true'
  439. const url = '#/audit-statistics-find-list?params=' + encodeURIComponent(JSON.stringify(param))
  440. window.open(url)
  441. },
  442. },
  443. }
  444. </script>
  445. <style module lang="scss">
  446. @use '@/common/design' as *;
  447. .auditProRectify {
  448. :global(.ant-table-body) {
  449. overflow-x: scroll !important;
  450. }
  451. :global(.ant-table-empty) {
  452. :global(.ant-table-body) {
  453. overflow-x: scroll !important;
  454. }
  455. }
  456. .conditions {
  457. margin-bottom: 20px;
  458. }
  459. .buttonContent {
  460. text-align: right;
  461. button {
  462. margin: 0 4px;
  463. }
  464. }
  465. :global(.anticon-setting) {
  466. display: none;
  467. }
  468. .tableTitle {
  469. padding-top: 16px;
  470. margin: 0;
  471. font-size: 22px;
  472. font-weight: bold;
  473. color: #404040;
  474. text-align: center;
  475. background: white;
  476. }
  477. :global(.reporttablecardxm) {
  478. :global(.ant-table-body) {
  479. height: auto !important;
  480. min-height: auto !important;
  481. overflow: auto;
  482. }
  483. }
  484. :global(.ant-table-placeholder) {
  485. height: auto !important;
  486. }
  487. }
  488. </style>