audit-enterprise-reports.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <div :class="$style.personalStatistics">
  3. <a-card :class="$style.conditions">
  4. <a-form-model
  5. ref="projectSearchForm"
  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="unitNames">
  14. <AuditGroupPicker
  15. ref="unitNames"
  16. v-model="form.unitNames"
  17. :single="false"
  18. :read-only="false"
  19. :root-node="rootNode"
  20. />
  21. </a-form-model-item>
  22. </a-col>
  23. <a-col :span="8">
  24. <a-form-model-item label="年度" prop="planYear">
  25. <a-date-picker
  26. v-model="form.planYear"
  27. mode="year"
  28. picker="YYYY"
  29. format="YYYY"
  30. :allow-clear="false"
  31. placeholder="选择年度"
  32. :input-read-only="true"
  33. :value="year"
  34. :open="endOpen"
  35. @panelChange="yearChange"
  36. @openChange="handleEndOpenChange"
  37. ></a-date-picker>
  38. </a-form-model-item>
  39. </a-col>
  40. </a-row>
  41. </a-form-model>
  42. </a-card>
  43. <a-card :class="$style.conditions2">
  44. <div>
  45. <p :class="$style.tableTitle"> 审计署 </p>
  46. <a-row :gutter="24" :class="$style.antformitem">
  47. <a-col :span="8">
  48. <div :class="$style.buttonContent">
  49. <a-button :loading="exportLoading" type="primary" @click="exportAuditGroup"
  50. >生成《单位及内部审计机构基本情况表》</a-button
  51. >
  52. </div>
  53. </a-col>
  54. </a-row>
  55. <a-row :gutter="24" :class="$style.antformitem">
  56. <a-col :span="8">
  57. <div :class="$style.buttonContent">
  58. <a-button :loading="exportLoading" type="primary" @click="exportAuditWork"
  59. >生成《单位内部审计业务情况表》</a-button
  60. >
  61. </div>
  62. </a-col>
  63. </a-row>
  64. </div>
  65. </a-card>
  66. <a-card :class="$style.conditions3">
  67. <p :class="$style.tableTitle"> 国资委 </p>
  68. <a-row :gutter="24" :class="$style.antformitem">
  69. <a-col :span="8">
  70. <div :class="$style.buttonContent">
  71. <a-button
  72. :loading="exportLoading"
  73. type="primary"
  74. @change="processReq"
  75. @click="handelExport"
  76. >生成《国资委报表》</a-button
  77. >
  78. </div>
  79. </a-col>
  80. </a-row>
  81. </a-card>
  82. </div>
  83. </template>
  84. <script>
  85. import moment from 'moment'
  86. import components from './_import-components/audit-enterprise-reports-import'
  87. import AuditGroupPicker from '@product/iam/components/picker/audit-group-picker.vue'
  88. import { message } from '@/common/one-ui'
  89. import download from '@/common/services/download'
  90. import axios from '@/common/services/axios-instance'
  91. import { getUserInfo } from '@/common/store-mixin'
  92. export default {
  93. name: 'AuditEnterpriseReports',
  94. metaInfo: {
  95. title: '企业上报报表',
  96. },
  97. components: {
  98. ...components,
  99. AuditGroupPicker,
  100. },
  101. data() {
  102. return {
  103. endOpen: false,
  104. year: null,
  105. exportLoading: false,
  106. reqData: {
  107. unitNames: '',
  108. planYear: '',
  109. },
  110. data: [],
  111. form: {
  112. unitNames: [],
  113. planYear: '',
  114. },
  115. rules: {
  116. unitNames: [{ required: true, message: '请选择审计机构', trigger: 'change' }],
  117. planYear: [{ required: true, message: '请选择统计时间', trigger: 'change' }],
  118. },
  119. formItemLayout: {
  120. labelCol: { span: 6 },
  121. wrapperCol: { span: 14 },
  122. },
  123. rootNode: {},
  124. }
  125. },
  126. created() {
  127. let userInfo = getUserInfo()
  128. const params = {
  129. orgId: userInfo.deptId,
  130. }
  131. axios({
  132. url: 'api/xcoa-mobile/v1/iamorg/getCurrentUserGroup',
  133. method: 'get',
  134. }).then((res) => {
  135. userInfo = res.data
  136. params.orgId = res.data.id
  137. axios({
  138. url: 'api/xcoa-mobile/v1/iamorg/findIamOrg',
  139. method: 'post',
  140. params,
  141. }).then((res) => {
  142. this.id = res.data.id
  143. const deptCode = res.data.orgId + ''
  144. const deptName = res.data.orgName
  145. this.rootNode = { code: deptCode, name: deptName, id: this.id }
  146. })
  147. })
  148. // this.initGroupPicker()
  149. // this.tableResize()
  150. },
  151. mounted() {
  152. // this.tableResize()
  153. this.initGroupPicker()
  154. this.initDatePicker()
  155. // 初始化审计类型数据字典信息
  156. // this.initDictionaryInfo()
  157. },
  158. methods: {
  159. yearChange(value) {
  160. debugger
  161. this.year = value
  162. this.form.planYear = value.format('YYYY')
  163. if (document.getElementsByClassName('ant-calendar-picker-container').length > 0) {
  164. document.getElementsByClassName('ant-calendar-picker-container')[0].style.display = 'none'
  165. }
  166. },
  167. handleEndOpenChange(open) {
  168. this.endOpen = open
  169. },
  170. // initGroupPicker() {
  171. // debugger
  172. // const userInfo = getUserInfo()
  173. // const userDeptValue = []
  174. // const userDept = {
  175. // code: userInfo.deptId + '',
  176. // name: JSON.parse(userInfo.attrs.deptLevMap).COMPANY,
  177. // text: JSON.parse(userInfo.attrs.deptLevMap).COMPANY,
  178. // id: userInfo.deptId,
  179. // type: 'Group',
  180. // }
  181. // userDeptValue.push(userDept)
  182. // this.form.unitNames = userDeptValue
  183. // },
  184. initGroupPicker() {
  185. let userInfo = getUserInfo()
  186. const params = {
  187. orgId: userInfo.deptId,
  188. }
  189. axios({
  190. url: 'api/xcoa-mobile/v1/iamorg/getCurrentUserGroup',
  191. method: 'get',
  192. }).then((res) => {
  193. userInfo = res.data
  194. params.orgId = res.data.id
  195. axios({
  196. url: 'api/xcoa-mobile/v1/iamorg/findIamOrg',
  197. method: 'post',
  198. params,
  199. }).then((res) => {
  200. const userDeptValue = []
  201. const userDept = {
  202. code: res.data.orgId + '',
  203. name: res.data.orgName,
  204. text: res.data.orgName,
  205. id: res.data.orgId,
  206. type: 'Group',
  207. }
  208. userDeptValue.push(userDept)
  209. this.form.unitNames = userDeptValue
  210. this.$refs.projectSearchForm.validate()
  211. })
  212. })
  213. },
  214. initDatePicker() {
  215. debugger
  216. // const datePick = []
  217. const time = moment(new Date())
  218. // datePick.push(time)
  219. this.form.planYear = time.format('YYYY')
  220. },
  221. initDictionaryInfo() {
  222. axios({
  223. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=PRODUCT_IAM_AUDIT_TYPE',
  224. method: 'get',
  225. }).then((res) => {
  226. if (res.status === 200) {
  227. this.auditTypeOptions = res.data
  228. }
  229. })
  230. },
  231. // tableResize() {
  232. // document
  233. // .getElementsByClassName('ant-table-empty')[0]
  234. // .getElementsByClassName('ant-table-tbody')[0]
  235. // .appendChild(document.getElementsByClassName('ant-table-placeholder')[0])
  236. // var width = document.getElementsByClassName('ant-table-tbody')[0].offsetWidth
  237. // document.getElementsByClassName('ant-table-placeholder')[0].style.width = `${width}%`
  238. // },
  239. // dataLoaded(res) {
  240. // if (res.data.length) {
  241. // res.data.forEach((item, index) => {
  242. // item.id = index + 1
  243. // })
  244. // } else {
  245. // this.tableResize()
  246. // }
  247. // return res
  248. // },
  249. processReq(req) {
  250. req.data = {
  251. maxResults: req.data.maxResults,
  252. startPosition: req.data.startPosition,
  253. unitIds: this.reqData.unitNames,
  254. planYear: this.reqData.planYear,
  255. }
  256. return req
  257. },
  258. handelExport() {
  259. debugger
  260. if (this.form.unitNames.length === 0 && this.form.planYear.length === 0) {
  261. this.exportGZW()
  262. } else {
  263. // 处理部门
  264. const arr = []
  265. this.form.unitNames.forEach((item) => {
  266. arr.push(`'${item.id}'`)
  267. })
  268. this.reqData.unitNames = arr.join(',')
  269. this.reqData.unitIds = arr.join(',')
  270. // 处理时间
  271. this.reqData.planYear = this.form.planYear + ''
  272. // this.reqData.dateEnd = this.form.timeRange[1].year() + ''
  273. this.exportGZW()
  274. }
  275. },
  276. exportAuditGroup() {
  277. if (this.form.unitNames.length === 0 && this.form.planYear.length === 0) {
  278. this.exportIamOrgExcel()
  279. } else {
  280. // 处理时间
  281. // this.reqData.dateStart = this.form.timeRange[0].year() + ''
  282. // this.reqData.dateEnd = this.form.timeRange[1].year() + ''
  283. // 处理部门
  284. const arr = []
  285. this.form.unitNames.forEach((item) => {
  286. arr.push(`'${item.id}'`)
  287. })
  288. this.reqData.unitNames = arr.join(',')
  289. this.reqData.unitIds = arr.join(',')
  290. // 处理时间
  291. this.reqData.planYear = this.form.planYear + ''
  292. this.exportIamOrgExcel()
  293. }
  294. },
  295. exportAuditWork() {
  296. if (this.form.unitNames.length === 0 && this.form.planYear.length === 0) {
  297. this.exportIamDwywExcel()
  298. } else {
  299. // 处理时间
  300. // this.reqData.dateStart = this.form.timeRange[0].year() + ''
  301. // this.reqData.dateEnd = this.form.timeRange[1].year() + ''
  302. // 处理部门
  303. const arr = []
  304. this.form.unitNames.forEach((item) => {
  305. arr.push(`'${item.id}'`)
  306. })
  307. this.reqData.unitNames = arr.join(',')
  308. this.reqData.unitIds = arr.join(',')
  309. // 处理时间
  310. this.reqData.planYear = this.form.planYear + ''
  311. this.exportIamDwywExcel()
  312. }
  313. },
  314. exportGZW() {
  315. axios({
  316. method: 'post',
  317. url: 'api/xcoa-mobile/v1/iam-auditWork-statistics/exportGZWExcel',
  318. responseType: 'blob',
  319. data: {
  320. unitIds: this.reqData.unitIds,
  321. planYear: this.reqData.planYear,
  322. },
  323. }).then((res) => {
  324. const url = URL.createObjectURL(res.data)
  325. download(url, '国资委报表.xls')
  326. })
  327. },
  328. exportIamOrgExcel() {
  329. axios({
  330. method: 'post',
  331. url: 'api/xcoa-mobile/v1/iam-audits-statistics/exportIamOrgExcel',
  332. responseType: 'blob',
  333. data: {
  334. unitIds: this.reqData.unitIds,
  335. planYear: this.reqData.planYear,
  336. },
  337. }).then((res) => {
  338. const url = URL.createObjectURL(res.data)
  339. download(url, '单位及内部审计机构基本情况表-审计署.xls')
  340. })
  341. },
  342. exportIamDwywExcel() {
  343. axios({
  344. method: 'post',
  345. url: 'api/xcoa-mobile/v1/iam-audits-statistics/exportIamDwywExcel',
  346. responseType: 'blob',
  347. data: {
  348. unitIds: this.reqData.unitIds,
  349. planYear: this.reqData.planYear,
  350. },
  351. }).then((res) => {
  352. const url = URL.createObjectURL(res.data)
  353. download(url, '单位内部审计业务情况表-审计署.xls')
  354. })
  355. },
  356. },
  357. }
  358. </script>
  359. <style module lang="scss">
  360. @use '@/common/design' as *;
  361. .personalStatistics {
  362. :global(.ant-table-body) {
  363. overflow-x: scroll !important;
  364. }
  365. :global(.ant-form-item) {
  366. margin: 0;
  367. }
  368. :global(.ant-table-empty) {
  369. :global(.ant-table-body) {
  370. overflow-x: scroll !important;
  371. }
  372. }
  373. .conditions {
  374. height: 100px;
  375. margin-bottom: 20px;
  376. }
  377. .conditions2 {
  378. height: 300px;
  379. margin-bottom: 20px;
  380. }
  381. .conditions3 {
  382. height: 200px;
  383. margin-bottom: 20px;
  384. }
  385. .buttonContent {
  386. margin-right: 500px;
  387. padding-top: 50px;
  388. text-align: right;
  389. button {
  390. margin: 0 4px;
  391. }
  392. }
  393. :global(.anticon-setting) {
  394. display: none;
  395. }
  396. .tableTitle {
  397. padding-top: 16px;
  398. margin: 0;
  399. font-size: 22px;
  400. font-weight: bold;
  401. color: #404040;
  402. background: white;
  403. }
  404. :global(.reporttablecardxm) {
  405. :global(.ant-table-body) {
  406. height: auto !important;
  407. min-height: auto !important;
  408. overflow: auto;
  409. }
  410. }
  411. :global(.ant-table-placeholder) {
  412. height: auto !important;
  413. }
  414. }
  415. </style>