cube-contract-search.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div :class="$style.searchdiv">
  3. <a-spin :spinning="loading" tip="文本审核中,请耐心等待...">
  4. <a-card :class="$style.searchWrap">
  5. <a-form-model
  6. ref="advancedSearchForm"
  7. class="ant-advanced-search-form"
  8. :model="form"
  9. v-bind="formItemLayout"
  10. >
  11. <a-row :gutter="24" :class="$style.antformitem">
  12. <a-col :span="11">
  13. <a-form-model-item label="签订日期" prop="searchDate">
  14. <a-range-picker v-model="form.searchDate" />
  15. </a-form-model-item>
  16. </a-col>
  17. <a-col :span="11">
  18. <a-form-model-item label="合同名称" prop="contractName">
  19. <a-input v-model="form.contractName"> </a-input>
  20. </a-form-model-item>
  21. </a-col>
  22. <a-col :span="11">
  23. <a-form-model-item label="合同类型" prop="contractType">
  24. <a-select v-model="form.contractType" :options="contractType" allow-clear>
  25. </a-select>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :span="11">
  29. <a-form-model-item label="合作方名称" prop="counterpartName">
  30. <a-input v-model="form.counterpartName"> </a-input>
  31. </a-form-model-item>
  32. </a-col>
  33. </a-row>
  34. <a-row>
  35. <a-col :span="16"> </a-col>
  36. <a-col :class="$style.searchbutton" :span="8">
  37. <div class="reportbuttonContent" style="margin-right:15%">
  38. <a-button type="primary" html-type="submit" @click="submitForm">查询</a-button>
  39. <a-button type="primary" @click="allAudit">批量审核</a-button>
  40. <a-button @click="handleReset">重置</a-button>
  41. </div>
  42. </a-col>
  43. </a-row>
  44. </a-form-model>
  45. </a-card>
  46. <a-card class="reporttablecardxm">
  47. <div :class="$style.title"
  48. ><span :class="['toptitle', $style.toptitle]">合同信息</span></div
  49. >
  50. <div v-show="!isSubmit" style="height:500px"></div>
  51. <sd-data-table-ex
  52. v-show="isSubmit"
  53. :key="tableKey"
  54. ref="dataTable"
  55. show-selection
  56. :filter-expressions="filterExpressions"
  57. form-id="iamCubeContract"
  58. :columns="columns"
  59. :row-key="(record, index) => index"
  60. :defultpagination-pagesize="10"
  61. @dataLoaded="dataLoaded"
  62. >
  63. <div slot="islink" slot-scope="text, record">
  64. <a :title="text" @click="rowClick(record)">{{ text }}</a>
  65. </div>
  66. </sd-data-table-ex>
  67. </a-card>
  68. </a-spin>
  69. </div>
  70. </template>
  71. <script>
  72. import loginService from '@/login/login-service'
  73. import axios from '@/common/services/axios-instance'
  74. import TableColumnTypes from '@/common/services/table-column-types'
  75. import { sdLocalStorage } from '@/common/services/storage-service'
  76. import { message, Modal } from '@/common/one-ui'
  77. import cubeServices from '@product/iam/cube/cube-services'
  78. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  79. import moment from 'moment'
  80. import components from './_import-components/cube-contract-search-import'
  81. export default {
  82. name: 'CubeContractSearch',
  83. metaInfo: {
  84. title: '文本智能审核',
  85. },
  86. components: {
  87. ...components,
  88. },
  89. data() {
  90. return {
  91. pagination: {
  92. pageSize: 10,
  93. total: 100,
  94. },
  95. loading: false, // 列表加载中
  96. tableData: [], // 列表数据
  97. isSubmit: false, // 是否点了查询
  98. showTable: false, // 是否显示查询结果
  99. tableKey: 0,
  100. contractType: [], // 合同类型
  101. data: [],
  102. filterExpressions: [], // 过滤条件
  103. columns: [
  104. {
  105. title: '序号',
  106. dataIndex: 'sortNum',
  107. width: '80px',
  108. customRender: (text, record, index) => `${index + 1}`,
  109. },
  110. {
  111. title: '签订日期',
  112. dataIndex: 'signDate',
  113. sdRender: TableColumnTypes.date,
  114. },
  115. {
  116. title: '合同名称',
  117. dataIndex: 'contractName',
  118. scopedSlots: { customRender: 'islink' },
  119. },
  120. {
  121. title: '合同编号',
  122. dataIndex: 'contractCode',
  123. },
  124. {
  125. title: '合同金额',
  126. dataIndex: 'contractAmount',
  127. },
  128. {
  129. title: '合同类型',
  130. dataIndex: 'contractType',
  131. },
  132. {
  133. title: '合作方名称',
  134. dataIndex: 'partnerName',
  135. },
  136. ],
  137. formItemLayout: {
  138. labelCol: { span: 6 },
  139. wrapperCol: { span: 12 },
  140. },
  141. dateFormat: 'YYYY',
  142. form: {
  143. contractName: '',
  144. searchDate: [],
  145. contractType: '',
  146. counterpartName: '',
  147. },
  148. params: {},
  149. }
  150. },
  151. mounted() {
  152. // 初始化数据字典信息
  153. this.initDictionaryInfo()
  154. },
  155. methods: {
  156. // 详情打开新页面
  157. rowClick(record) {
  158. const url = '/cube-contract-form?record=' + record.id // 新页面要打开的路由地址
  159. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  160. if (refreshFlag) {
  161. this.flush()
  162. }
  163. })
  164. },
  165. fnonloadsum() {
  166. if (!this.flag) {
  167. if (document.getElementsByClassName('ant-pagination')) {
  168. document.getElementsByClassName('ant-pagination')[0].style.display = 'none'
  169. }
  170. this.flag = true
  171. } else {
  172. if (document.getElementsByClassName('ant-pagination')) {
  173. document.getElementsByClassName('ant-pagination')[0].style.display = ''
  174. }
  175. }
  176. },
  177. initDictionaryInfo() {
  178. // 获取合同类型
  179. cubeServices.checkCubeToken('review').then((res) => {
  180. if (!res) {
  181. Modal.warning({
  182. title: '提示',
  183. content: '未开启CUBE集成功能参数或单点认证失败,请联系管理员',
  184. })
  185. return false
  186. }
  187. const cubeJson = JSON.parse(sdLocalStorage.getItem('cube') || '{}')
  188. axios({
  189. url:
  190. 'api/xcoa-mobile/v1/iamcubecontract/findFileCode?accessToken=' + cubeJson.review_token,
  191. }).then((res) => {
  192. this.contractType = res.data.map((item) => {
  193. return {
  194. value: item.code,
  195. label: item.text,
  196. }
  197. })
  198. })
  199. })
  200. },
  201. dataLoaded(eventData) {
  202. this.showTable = true
  203. return eventData
  204. },
  205. submitForm() {
  206. this.$refs.advancedSearchForm.validate((valid, values) => {
  207. if (valid) {
  208. this.isSubmit = true
  209. this.params.startPosition = 0
  210. this.params.maxResults = 10
  211. this.filterExpressions = []
  212. // 合同签订时间
  213. if (this.form.searchDate.length > 0) {
  214. this.filterExpressions.push({
  215. dataType: 'long',
  216. name: 'signDate',
  217. op: 'between',
  218. longValues: [
  219. moment(moment(this.form.searchDate[0]).startOf('day')).valueOf(),
  220. moment(moment(this.form.searchDate[1]).endOf('day')).valueOf(),
  221. ],
  222. })
  223. }
  224. // 合同名称
  225. if (this.form.contractName !== '') {
  226. this.filterExpressions.push({
  227. dataType: 'str',
  228. name: 'contractName',
  229. op: 'like',
  230. stringValue: `%${this.form.contractName}%`,
  231. })
  232. }
  233. // 合同类型
  234. if (this.form.contractType && this.form.contractType !== '') {
  235. this.filterExpressions.push({
  236. dataType: 'str',
  237. name: 'contractTypeCode',
  238. op: 'eq',
  239. stringValue: this.form.contractType,
  240. })
  241. }
  242. // 合同合作方
  243. if (this.form.counterpartName !== '') {
  244. this.filterExpressions.push({
  245. dataType: 'str',
  246. name: 'partnerName',
  247. op: 'like',
  248. stringValue: `%${this.form.counterpartName}%`,
  249. })
  250. }
  251. this.tableKey++
  252. }
  253. })
  254. },
  255. handleReset() {
  256. // this.isSubmit = false
  257. this.$refs.advancedSearchForm.resetFields()
  258. // 特殊处理,清空字段值
  259. // this.handlesearch()
  260. },
  261. // 批量审核
  262. allAudit() {
  263. const ids = this.$refs.dataTable.getSelectedRowKeys()
  264. if (ids.length === 0) {
  265. Modal.warning({
  266. title: '提示',
  267. content: '请选择需要智能审核的合同信息',
  268. })
  269. return
  270. }
  271. this.loading = true
  272. cubeServices.checkCubeToken('review').then((res) => {
  273. if (!res) {
  274. Modal.warning({
  275. title: '提示',
  276. content: '未开启CUBE集成功能参数或单点认证失败,请联系管理员',
  277. })
  278. return false
  279. }
  280. const cubeJson = JSON.parse(sdLocalStorage.getItem('cube') || '{}')
  281. // 获取本地token
  282. loginService.updateAccessToken().then(() => {
  283. axios({
  284. url: 'api/xcoa-mobile/v1/iamcubeexamine/fineContractReview',
  285. params: {
  286. accessToken: 'Bearer ' + cubeJson.review_token,
  287. ids: this.$refs.dataTable.getSelectedRowKeys().join(','),
  288. localToken: loginService.getTokens().access_token,
  289. },
  290. })
  291. .then((res) => {
  292. this.loading = false
  293. Modal.success({
  294. title: '提示',
  295. content: '文本审核完成,点击确认跳转审核结果页面',
  296. okText: '确认',
  297. okType: 'primary',
  298. onOk: () => {
  299. const url = '/cube-count-list' // 新页面要打开的路由地址
  300. crossWindowWatcher.waitForChanged(url)
  301. },
  302. })
  303. })
  304. .catch((err) => {
  305. this.loading = false
  306. message.error('文本智能审核接口调用失败,请联系管理员')
  307. console.log(err)
  308. })
  309. })
  310. })
  311. },
  312. },
  313. }
  314. </script>
  315. <style module lang="scss">
  316. @use '@/common/design' as *;
  317. .title {
  318. text-align: center;
  319. .toptitle {
  320. color: #404040;
  321. font-weight: bold;
  322. font-size: 22px;
  323. }
  324. }
  325. .search-wrap {
  326. margin-bottom: $padding-lg;
  327. :global(.ant-advanced-search-form) {
  328. padding: 0;
  329. background: transparent;
  330. border: none;
  331. }
  332. :global .ant-divider-horizontal {
  333. margin: 10px 0;
  334. }
  335. }
  336. .searchdiv {
  337. height: 100%;
  338. background-color: #f0f2f5;
  339. :global(.sd-has-table.ant-card) {
  340. min-height: 50%;
  341. }
  342. :global(.reporttablecardxm) {
  343. :global(.ant-table-body) {
  344. height: auto !important;
  345. overflow: auto;
  346. min-height: auto !important;
  347. }
  348. }
  349. :global(.ant-table-placeholder) {
  350. height: auto !important;
  351. }
  352. }
  353. :global(.statistics) {
  354. :global(.ant-table-wrapper) {
  355. margin-top: 40px;
  356. }
  357. }
  358. </style>