cube-count-list.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div>
  3. <a-card>
  4. <div :class="$style.title">审核结果统计</div>
  5. <div v-show="false">
  6. <table>
  7. <tr class="sumnum">
  8. <td colspan="8" :class="$style.sumtd">总计</td>
  9. <td>{{ allnum }}</td>
  10. <td>{{ tgnum }}</td>
  11. <td>{{ btgnum }}</td>
  12. <td>{{ tgl }}</td>
  13. </tr>
  14. </table>
  15. </div>
  16. <sd-data-table-ex
  17. form-id="iamCubeCount"
  18. page-id="cube/count/iamCubeCount"
  19. :columns="columns"
  20. :actions="actions"
  21. show-selection
  22. :search-fields="[]"
  23. :filter-expressions="expressions"
  24. @tableDataLoaded="tableDataLoaded"
  25. >
  26. <!-- 总数 -->
  27. <div slot="allnum" slot-scope="text, record">
  28. <a :title="text" class="allnum" @click="toCubeClick(record)">{{ text }}</a>
  29. </div>
  30. <div slot="tgnum" slot-scope="text, record">
  31. <a :title="text" class="tgnum" @click="toCubeClick(record)">{{ text }}</a>
  32. </div>
  33. <div slot="btgnum" slot-scope="text, record">
  34. <a :title="text" class="btgnum" @click="toCubeClick(record)">{{ text }}</a>
  35. </div>
  36. <div slot="tgl" slot-scope="text, record">
  37. {{
  38. record.examineNum === '0' || record.examineNum === null
  39. ? '0'
  40. : Math.round((record.adoptNum / record.examineNum) * 100, 2) + '%'
  41. }}
  42. </div>
  43. <!-- <div slot="toCube" slot-scope="text, record">
  44. <a :title="text" @click="toCubeClick(record)">{{ text }}</a>
  45. </div> -->
  46. </sd-data-table-ex>
  47. </a-card>
  48. </div>
  49. </template>
  50. <script>
  51. import loginService from '@/login/login-service'
  52. import axios from '@/common/services/axios-instance'
  53. import TableColumnTypes from '@/common/services/table-column-types'
  54. import { sdLocalStorage } from '@/common/services/storage-service'
  55. import { message, Modal } from '@/common/one-ui'
  56. import cubeServices from '@product/iam/cube/cube-services'
  57. import TableActionTypes from '@/common/services/table-action-types'
  58. import components from './_import-components/cube-count-list-import'
  59. export default {
  60. name: 'CubeCountList',
  61. metaInfo: {
  62. title: '审核结果统计',
  63. },
  64. components,
  65. data() {
  66. return {
  67. allnum: 0,
  68. tgnum: 0,
  69. btgnum: 0,
  70. tgl: 0,
  71. expressions: [
  72. {
  73. dataType: 'long',
  74. name: 'isNewest',
  75. op: 'eq',
  76. longValue: 1,
  77. },
  78. ],
  79. columns: [
  80. {
  81. title: '序号',
  82. dataIndex: 'sortNumber',
  83. width: '80px',
  84. customRender: (text, record, index) => `${index + 1}`,
  85. },
  86. {
  87. title: '签订日期',
  88. dataIndex: 'signDate',
  89. sdRender: TableColumnTypes.date,
  90. },
  91. {
  92. title: '合同名称',
  93. dataIndex: 'contractName',
  94. },
  95. {
  96. title: '合同编号',
  97. dataIndex: 'contractCode',
  98. },
  99. {
  100. title: '合同金额',
  101. dataIndex: 'contractAmount',
  102. },
  103. {
  104. title: '合同类型',
  105. dataIndex: 'contractType',
  106. },
  107. {
  108. title: '合作方名称',
  109. dataIndex: 'partnerName',
  110. },
  111. {
  112. title: '审核结果数',
  113. dataIndex: 'examineNum',
  114. scopedSlots: { customRender: 'allnum' },
  115. },
  116. {
  117. title: '通过数',
  118. dataIndex: 'adoptNum',
  119. scopedSlots: { customRender: 'tgnum' },
  120. },
  121. {
  122. title: '不通过数',
  123. dataIndex: 'notAdoptNum',
  124. scopedSlots: { customRender: 'btgnum' },
  125. },
  126. {
  127. title: '通过率',
  128. dataIndex: 'tgl',
  129. scopedSlots: { customRender: 'tgl' },
  130. },
  131. {
  132. title: '合同ID',
  133. dataIndex: 'contractId',
  134. sdHidden: true,
  135. },
  136. ],
  137. actions: [],
  138. }
  139. },
  140. created() {},
  141. methods: {
  142. // 数据加载完
  143. tableDataLoaded(pageInfo) {
  144. this.allnum = 0
  145. this.tgnum = 0
  146. this.btgnum = 0
  147. this.tgl = 0
  148. // 没有数据直接退出
  149. if (pageInfo.total === 0) return
  150. const getAllNum = setInterval(() => {
  151. if (document.querySelectorAll('.allnum').length > 0) {
  152. clearInterval(getAllNum)
  153. }
  154. document.querySelectorAll('.allnum').forEach((item) => {
  155. this.allnum += parseFloat(item.innerHTML)
  156. })
  157. document.querySelectorAll('.tgnum').forEach((item) => {
  158. this.tgnum += parseFloat(item.innerHTML)
  159. })
  160. document.querySelectorAll('.btgnum').forEach((item) => {
  161. this.btgnum += parseFloat(item.innerHTML)
  162. })
  163. this.tgl = Math.round((this.tgnum / this.allnum) * 100, 2) + '%'
  164. document.querySelector('.ant-table-tbody').appendChild(document.querySelector('.sumnum'))
  165. }, 500)
  166. },
  167. // 跳转方法
  168. toCubeClick(record) {
  169. cubeServices.checkCubeToken('review').then((res) => {
  170. if (!res) {
  171. Modal.warning({
  172. title: '提示',
  173. content: '未开启CUBE集成功能参数或单点认证失败,请联系管理员',
  174. })
  175. return false
  176. }
  177. // 获取本地token
  178. loginService.updateAccessToken().then(() => {
  179. axios({
  180. url: `api/framework/v1/page/wp/cube/contract/iamCubeContract?id=${record.contractId}`,
  181. }).then((res) => {
  182. const item = res.data.pageFormData.pageFieldInfos.find((field) => {
  183. return field.name === 'contractFile'
  184. }).attr.attachments[0]
  185. const cubeJson = JSON.parse(sdLocalStorage.getItem('cube') || '{}')
  186. // 项目修改
  187. axios.get('api/xcoa-mobile/v1/iamcubecontract/getCubeWebUrl').then((res) => {
  188. if (res.data !== '') {
  189. let url =
  190. res.data +
  191. `/projects/8/o/rule_review?file_path=${
  192. location.origin
  193. }/api/framework/v1/task-form-process/download-attachments/${
  194. item.code
  195. }?access_token=${loginService.getTokens().access_token}`
  196. url += `&access_token=${cubeJson.review_token}`
  197. url += `&file_id=${item.code}`
  198. url += `&file_format=${item.suffix}`
  199. // 获取合同分类
  200. axios({
  201. url:
  202. 'api/xcoa-mobile/v1/iamcubecontract/findFileCode?accessToken=' +
  203. cubeJson.review_token,
  204. }).then((list) => {
  205. // 获取合同分类
  206. const docText = res.data.pageFormData.pageFieldInfos.find((field) => {
  207. return field.name === 'contractType'
  208. }).value
  209. const docType = list.data.find((item) => {
  210. return item.text === docText
  211. })
  212. url += `&doc_type=${docType.code}`
  213. window.open(url)
  214. })
  215. }
  216. })
  217. })
  218. })
  219. })
  220. },
  221. },
  222. }
  223. </script>
  224. <style module lang="scss">
  225. @use '@/common/design' as *;
  226. .title {
  227. margin: 10px;
  228. font-size: 22px;
  229. font-weight: bold;
  230. text-align: center;
  231. }
  232. .sumtd {
  233. padding: 0;
  234. font-size: 18px;
  235. font-weight: bold;
  236. text-align: center;
  237. background: #f0f2f5;
  238. }
  239. </style>