audit-project-rectification.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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="false"
  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="projectSource">
  30. <a-select v-model="form.projectSource" allow-clear>
  31. <a-select-option
  32. v-for="(item, index) in projectSourceList"
  33. :key="index"
  34. :value="item.id"
  35. >{{ item.name }}
  36. </a-select-option>
  37. </a-select>
  38. </a-form-model-item>
  39. </a-col>
  40. </a-row>
  41. </a-form-model>
  42. <div :class="$style.buttonContent">
  43. <a-button @click="handleReset">重置</a-button>
  44. <a-button type="primary" @click="handleAction('serach')">查询</a-button>
  45. <a-button :loading="exportLoading" type="primary" @click="handleAction('export')"
  46. >导出</a-button
  47. >
  48. </div>
  49. </a-card>
  50. <p :class="$style.tableTitle"> 整改情况统计(按审计项目查询) </p>
  51. <a-card>
  52. <sd-data-table
  53. ref="dataTable"
  54. :key="dataKey"
  55. :columns="columns"
  56. :process-req="processReq"
  57. :data-source.sync="data"
  58. :defultpagination-pagesize="50"
  59. data-url="api/xcoa-mobile/v1/iam-statistics/getRectifyStatusList"
  60. @dataLoaded="dataLoaded"
  61. @rowClick="rowClick"
  62. >
  63. <template slot="number" slot-scope="text, record">
  64. {{ text ? text : '0' }}
  65. </template>
  66. </sd-data-table>
  67. </a-card>
  68. </div>
  69. </template>
  70. <script>
  71. import AuditRangePicker from '../../components/picker/audit-range-picker.vue'
  72. import AuditGroupPicker from '../../components/picker/audit-group-picker.vue'
  73. import components from './_import-components/audit-project-rectification-import'
  74. import StatisticsService from './statistics-service'
  75. import { message } from '@/common/one-ui'
  76. import download from '@/common/services/download'
  77. import axios from '@/common/services/axios-instance'
  78. import { getUserInfo } from '@/common/store-mixin'
  79. export default {
  80. name: 'AuditProjectRectification',
  81. metaInfo: {
  82. title: '整改情况统计',
  83. },
  84. components: {
  85. ...components,
  86. AuditRangePicker,
  87. AuditGroupPicker,
  88. },
  89. data() {
  90. return {
  91. exportLoading: false,
  92. dataKey: 0,
  93. projectSourceList: [],
  94. form: {
  95. projectSource: '',
  96. unitNames: [],
  97. timeRange: [],
  98. },
  99. rules: {
  100. timeRange: [{ required: true, message: '请选择统计时间', trigger: 'change' }],
  101. unitNames: [{ required: true, message: '请选择审计机构', trigger: 'change' }],
  102. },
  103. reqData: {
  104. dateStart: '3000',
  105. dateEnd: '',
  106. unitNames: '',
  107. projectSource: '',
  108. },
  109. data: [],
  110. columns: [
  111. {
  112. title: '序号',
  113. dataIndex: 'id',
  114. width: '66px',
  115. },
  116. {
  117. title: '审计机构',
  118. dataIndex: 'UNIT_NAME',
  119. width: '100px',
  120. },
  121. {
  122. title: '项目名称',
  123. dataIndex: 'PROJECT_TITLE',
  124. width: '100px',
  125. },
  126. {
  127. title: '审计类型',
  128. dataIndex: 'AUDIT_TYPE',
  129. width: '100px',
  130. },
  131. {
  132. title: '项目来源',
  133. dataIndex: 'PROJECT_SOURCE',
  134. width: '100px',
  135. },
  136. {
  137. title: '需要整改问题数',
  138. dataIndex: 'NUM',
  139. width: '144px',
  140. scopedSlots: { customRender: 'number' },
  141. sdClickable: true,
  142. },
  143. {
  144. title: '已整改',
  145. dataIndex: 'DONE',
  146. width: '80px',
  147. scopedSlots: { customRender: 'number' },
  148. sdClickable: true,
  149. },
  150. {
  151. title: '整改中',
  152. dataIndex: 'DOING',
  153. width: '80px',
  154. scopedSlots: { customRender: 'number' },
  155. sdClickable: true,
  156. },
  157. {
  158. title: '未整改',
  159. dataIndex: 'TODO',
  160. width: '80px',
  161. scopedSlots: { customRender: 'number' },
  162. sdClickable: true,
  163. },
  164. {
  165. title: '超期未整改',
  166. dataIndex: 'EXPIRE',
  167. width: '115px',
  168. scopedSlots: { customRender: 'number' },
  169. sdClickable: true,
  170. },
  171. {
  172. title: '风险接受',
  173. dataIndex: 'RISK',
  174. width: '100px',
  175. scopedSlots: { customRender: 'number' },
  176. sdClickable: true,
  177. },
  178. {
  179. title: '整改完成率',
  180. dataIndex: 'PERCENT',
  181. width: '115px',
  182. },
  183. {
  184. title: '实际完成率',
  185. dataIndex: 'REAL_PERCENT',
  186. width: '115px',
  187. },
  188. ],
  189. formItemLayout: {
  190. labelCol: { span: 6 },
  191. wrapperCol: { span: 14 },
  192. },
  193. rootNode: {},
  194. }
  195. },
  196. created() {
  197. let userInfo = getUserInfo()
  198. const params = {
  199. orgId: userInfo.deptId,
  200. }
  201. axios({
  202. url: 'api/xcoa-mobile/v1/iamorg/getCurrentUserGroup',
  203. method: 'get',
  204. }).then((res) => {
  205. userInfo = res.data
  206. params.orgId = res.data.id
  207. axios({
  208. url: 'api/xcoa-mobile/v1/iamorg/findIamOrgId',
  209. method: 'post',
  210. params,
  211. }).then((res) => {
  212. this.id = res.data
  213. const deptCode = userInfo.id.toString()
  214. const deptName = userInfo.name
  215. this.rootNode = { code: deptCode, name: deptName, id: this.id }
  216. })
  217. })
  218. },
  219. mounted() {
  220. axios({
  221. url: 'api/xcoa-mobile/v1/dict-manager/dictvalues?keyId=PRODUCT_IAM_AUDIT_PROJECT_SOURCE',
  222. method: 'get',
  223. }).then((res) => {
  224. if (res.status === 200) {
  225. this.projectSourceList = res.data
  226. }
  227. })
  228. this.tableResize()
  229. },
  230. methods: {
  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. processReq(req, pagination) {
  240. req.data = {
  241. maxResults: req.data.maxResults,
  242. startPosition: req.data.startPosition,
  243. dateStart: this.reqData.dateStart,
  244. dateEnd: this.reqData.dateEnd,
  245. unitIds: this.reqData.unitNames,
  246. projectSource: this.reqData.projectSource,
  247. }
  248. return req
  249. },
  250. dataLoaded(res) {
  251. if (res.data.length) {
  252. res.data.forEach((item, index) => {
  253. item.id = index + 1
  254. })
  255. } else {
  256. this.tableResize()
  257. }
  258. return res
  259. },
  260. handleReset() {
  261. this.$refs.advancedSearchForm.resetFields()
  262. },
  263. handleAction(type) {
  264. this.$refs.advancedSearchForm.validate((valid, values) => {
  265. if (valid) {
  266. // 处理项目来源
  267. this.reqData.projectSource = this.form.projectSource
  268. // 处理时间
  269. this.reqData.dateStart = this.form.timeRange[0].year() + ''
  270. this.reqData.dateEnd = this.form.timeRange[1].year() + ''
  271. // 处理部门
  272. const arr = []
  273. this.form.unitNames.forEach((item) => {
  274. arr.push(`'${item.id}'`)
  275. })
  276. this.reqData.unitNames = arr.join(',')
  277. // 调用方法
  278. switch (type) {
  279. case 'serach':
  280. this.handleSearch()
  281. break
  282. case 'export':
  283. this.handleExport()
  284. break
  285. }
  286. }
  287. })
  288. },
  289. handleSearch() {
  290. this.reqData.startPosition = 0
  291. this.dataKey++
  292. },
  293. handleExport() {
  294. if (this.$refs.dataTable.data.length === 0) {
  295. message.warning('未查询出可导出数据', 1)
  296. return
  297. }
  298. this.exportLoading = true
  299. StatisticsService.exportRectifyList(this.reqData).then((data) => {
  300. const url = URL.createObjectURL(data)
  301. download(url, '整改情况统计表.xls')
  302. this.exportLoading = false
  303. })
  304. },
  305. rowClick(record, { rowIndex, column }) {
  306. const param = {
  307. dateStart: this.reqData.dateStart,
  308. dateEnd: this.reqData.dateEnd,
  309. unitIds: this.reqData.unitNames,
  310. projectSource: this.reqData.projectSource,
  311. projectTitle: record.PROJECT_TITLE,
  312. }
  313. if (column.dataIndex === 'DONE') {
  314. // 已整改
  315. param.rectStatus = '03'
  316. } else if (column.dataIndex === 'DOING') {
  317. // 整改中
  318. param.rectStatus = '02'
  319. } else if (column.dataIndex === 'TODO') {
  320. // 未整改
  321. param.rectStatus = '01'
  322. } else if (column.dataIndex === 'EXPIRE') {
  323. // 超期未整改
  324. param.isTrue = 1
  325. } else if (column.dataIndex === 'RISK') {
  326. // 风险接受
  327. param.rectStatus = '04'
  328. }
  329. const url = '#/audit-statistics-find-list?params=' + encodeURIComponent(JSON.stringify(param))
  330. window.open(url)
  331. },
  332. },
  333. }
  334. </script>
  335. <style module lang="scss">
  336. @use '@/common/design' as *;
  337. .auditProRectify {
  338. :global(.ant-table-body) {
  339. overflow-x: scroll !important;
  340. }
  341. :global(.ant-table-empty) {
  342. :global(.ant-table-body) {
  343. overflow-x: scroll !important;
  344. }
  345. }
  346. .conditions {
  347. margin-bottom: 20px;
  348. }
  349. .buttonContent {
  350. text-align: right;
  351. button {
  352. margin: 0 4px;
  353. }
  354. }
  355. :global(.anticon-setting) {
  356. display: none;
  357. }
  358. .tableTitle {
  359. padding-top: 16px;
  360. margin: 0;
  361. font-size: 22px;
  362. font-weight: bold;
  363. color: #404040;
  364. text-align: center;
  365. background: white;
  366. }
  367. :global(.reporttablecardxm) {
  368. :global(.ant-table-body) {
  369. height: auto !important;
  370. min-height: auto !important;
  371. overflow: auto;
  372. }
  373. }
  374. :global(.ant-table-placeholder) {
  375. height: auto !important;
  376. }
  377. }
  378. </style>