audit-personnel-work-statistics.vue 14 KB

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