cube-contract-list.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div>
  3. <a-card>
  4. <!-- 高级搜索组件 -->
  5. <audit-advanced-query
  6. :expand="expand"
  7. :search-data="formData"
  8. :ref-name="searchform"
  9. :search-style="{ height: '170px', left: '20px', top: '57px' }"
  10. :search-fun="handleSearch"
  11. @searchedClick="searchedClick"
  12. @resetForm="resetForm"
  13. >
  14. <template>
  15. <a-col :span="12">
  16. <a-form-model-item :label="'合同名称'" prop="contractName">
  17. <a-input v-model="formData.contractName" allow-clear />
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :span="12">
  21. <a-form-model-item :label="'合同类型'" prop="contractType">
  22. <a-select
  23. v-model="formData.contractType"
  24. :allow-clear="true"
  25. :options="contractType"
  26. />
  27. </a-form-model-item>
  28. </a-col>
  29. </template>
  30. </audit-advanced-query>
  31. <sd-data-table-ex
  32. ref="CubeDataTable"
  33. :filter-expressions="expressions"
  34. :columns="columns"
  35. :actions="actions"
  36. form-id="iamCubeContract"
  37. page-id="cube/contract/iamCubeContract"
  38. :search-fields="['contractName', 'contractType']"
  39. show-selection
  40. :show-advance-query="true"
  41. @searchbtnClick="searchbtnClick"
  42. >
  43. <div slot="islink" slot-scope="text, record">
  44. <a :title="text" @click="rowClick(record)">{{ text }}</a>
  45. </div>
  46. </sd-data-table-ex>
  47. </a-card>
  48. </div>
  49. </template>
  50. <script>
  51. import { sdLocalStorage } from '@/common/services/storage-service'
  52. import { Modal } from '@/common/one-ui'
  53. import cubeServices from '@product/iam/cube/cube-services'
  54. import axios from '@/common/services/axios-instance'
  55. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  56. import TableColumnTypes from '@/common/services/table-column-types'
  57. import TableActionTypes from '@/common/services/table-action-types'
  58. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  59. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  60. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  61. import components from './_import-components/cube-contract-list-import'
  62. export default {
  63. name: 'CubeContractList',
  64. metaInfo: {
  65. title: '合同信息录入',
  66. },
  67. components: {
  68. ...components,
  69. auditAdvancedQuery,
  70. },
  71. mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  72. data() {
  73. return {
  74. searchform: 'searchform',
  75. expressions: [],
  76. formData: {
  77. contractName: '',
  78. contractType: null,
  79. },
  80. contractType: [],
  81. // 高级搜索用
  82. expand: false,
  83. formId: 'iamCubeContract',
  84. columns: [
  85. {
  86. title: '序号',
  87. dataIndex: 'sortNumber',
  88. width: '80px',
  89. customRender: (text, record, index) => `${index + 1}`,
  90. },
  91. {
  92. title: '签订日期',
  93. dataIndex: 'signDate',
  94. sdRender: TableColumnTypes.date,
  95. defaultSortOrder: 'desc',
  96. },
  97. {
  98. title: '合同名称',
  99. dataIndex: 'contractName',
  100. scopedSlots: { customRender: 'islink' },
  101. },
  102. {
  103. title: '合同编号',
  104. dataIndex: 'contractCode',
  105. },
  106. {
  107. title: '合同金额',
  108. dataIndex: 'contractAmount',
  109. },
  110. {
  111. title: '合同类型',
  112. dataIndex: 'contractType',
  113. },
  114. {
  115. title: '合作方名称',
  116. dataIndex: 'partnerName',
  117. },
  118. ],
  119. actions: [
  120. {
  121. label: '新建',
  122. id: 'new',
  123. permission: 'create',
  124. type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  125. callback: () => {
  126. const url = '/cube-contract-form' // 新页面要打开的路由地址
  127. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  128. if (refreshFlag) {
  129. // 这里写或者调刷新的方法
  130. this.refresh()
  131. }
  132. })
  133. },
  134. },
  135. {
  136. label: '删除',
  137. id: 'delete',
  138. type: TableActionTypes.oa.delete, // 删除按钮,不需要回调,会自动处理
  139. },
  140. ],
  141. }
  142. },
  143. computed: {},
  144. created() {},
  145. mounted() {
  146. this.seniorSearch()
  147. },
  148. methods: {
  149. refresh() {
  150. return this.$refs.CubeDataTable.refresh(true)
  151. },
  152. rowClick(record) {
  153. const url = '/cube-contract-form?record=' + record.id // 新页面要打开的路由地址
  154. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  155. if (refreshFlag) {
  156. this.refresh()
  157. }
  158. })
  159. },
  160. // 高级搜索
  161. seniorSearch() {
  162. // 如果是展示的,那么可能去获取字典值去
  163. if (!this.strOrArr(this.formData.contractType)) {
  164. // 获取合同类型的字典值 'contractType'
  165. if (!this.strOrArr(this.contractType)) {
  166. // axios({
  167. // url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=IAM_CONTRACT_TYPE',
  168. // method: 'get',
  169. // }).then((res) => {
  170. // if (res.status === 200) {
  171. // this.contractType = res.data
  172. // }
  173. // })
  174. cubeServices.checkCubeToken('review').then((res) => {
  175. if (!res) {
  176. Modal.warning({
  177. title: '提示',
  178. content: '未开启CUBE集成功能参数或单点认证失败,请联系管理员',
  179. })
  180. return false
  181. }
  182. const cubeJson = JSON.parse(sdLocalStorage.getItem('cube') || '{}')
  183. axios({
  184. url:
  185. 'api/xcoa-mobile/v1/iamcubecontract/findFileCode?accessToken=' +
  186. cubeJson.review_token,
  187. }).then((res) => {
  188. this.contractType = res.data.map((item) => {
  189. return {
  190. value: item.code,
  191. label: item.text,
  192. }
  193. })
  194. })
  195. })
  196. }
  197. }
  198. },
  199. // 判断数组或字符串为null或长度为0
  200. strOrArr(strOrArr) {
  201. return strOrArr !== null && strOrArr.length > 0
  202. },
  203. // 查询
  204. handleSearch() {
  205. this.expressions = []
  206. // 合同名称
  207. if (this.formData.contractName) {
  208. this.expressions.push({
  209. dataType: 'str',
  210. name: 'contractName',
  211. op: 'like',
  212. stringValue: `%${this.formData.contractName}%`,
  213. })
  214. }
  215. // 合同类型
  216. if (this.formData.contractType) {
  217. this.expressions.push({
  218. dataType: 'str',
  219. name: 'contractTypeCode',
  220. op: 'eq',
  221. stringValue: this.formData.contractType[0].id,
  222. })
  223. }
  224. },
  225. resetForm() {
  226. this.formData.contractType = null
  227. },
  228. },
  229. }
  230. </script>
  231. <style module lang="scss">
  232. @use '@/common/design' as *;
  233. </style>