risk-criteria-list.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div :class="$style.wrapHeight">
  3. <a-card>
  4. <!-- 高级搜索组件 -->
  5. <audit-advanced-query
  6. :expand="expand"
  7. :search-data="formData"
  8. :ref-name="searchform"
  9. :search-style="{
  10. height: '170px',
  11. }"
  12. :search-fun="handleSearch"
  13. @searchedClick="searchedClick"
  14. @resetForm="resetForm"
  15. >
  16. <template>
  17. <a-col :span="12">
  18. <a-form-model-item label="准则版本编号">
  19. <a-input v-model="formData.criteriaCode"></a-input>
  20. </a-form-model-item>
  21. </a-col>
  22. <a-col :span="12">
  23. <a-form-model-item label="准则适用范围">
  24. <sd-group-picker v-model="formData.criteriaDeptCode" />
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :span="12">
  28. <a-form-model-item :label="'\u2003\u2003是否启用'">
  29. <sd-select v-model="formData.status" :options="statusList" allow-clear />
  30. </a-form-model-item>
  31. </a-col>
  32. </template>
  33. </audit-advanced-query>
  34. <sd-data-table-ex
  35. v-show="flag"
  36. :key="key"
  37. ref="riskCriteriaTable"
  38. form-id="riskCriteria"
  39. page-id="risk/criteria/riskCriteria"
  40. data-url="api/xcoa-mobile/v1/riskcriteria/all-list"
  41. :columns="columns"
  42. :actions="actions"
  43. :show-selection="actions.length > 0"
  44. :show-advance-query="true"
  45. :filter-expressions="expressions"
  46. :search-fields="['criteriaCode']"
  47. @searchbtnClick="searchbtnClick"
  48. >
  49. <template slot="islink" slot-scope="text, record">
  50. <a @click="open(record)">{{ text }}</a>
  51. </template>
  52. </sd-data-table-ex>
  53. </a-card>
  54. </div>
  55. </template>
  56. <script>
  57. import systemManage from '@/system-manage/system-manage'
  58. import TableActionTypes from '@/common/services/table-action-types'
  59. import TableColumnTypes from '@/common/services/table-column-types'
  60. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  61. import auditAdvancedQuery from '@product/iam/components/audit-advanced-query.vue'
  62. import auditAdvancedQueryMixins from '@product/iam/components/audit-advanced-query-mixins'
  63. import riskCriteriaService from './risk-criteria-service'
  64. import components from './_import-components/risk-criteria-list-import'
  65. export default {
  66. name: 'RiskCriteriaList',
  67. metaInfo: {
  68. title: '风险准则',
  69. },
  70. components: {
  71. ...components,
  72. auditAdvancedQuery,
  73. },
  74. mixins: [auditAdvancedQueryMixins],
  75. data() {
  76. return {
  77. statusList: [
  78. {
  79. id: 0,
  80. name: '启用',
  81. },
  82. {
  83. id: 1,
  84. name: '作废',
  85. },
  86. ],
  87. waterMark: systemManage.getFormWaterMark(),
  88. flag: true,
  89. key: 0,
  90. searchform: 'searchform',
  91. formData: {
  92. criteriaCode: '',
  93. criteriaDeptCode: [],
  94. status: [],
  95. },
  96. columns: [
  97. {
  98. title: '序号',
  99. customRender: (text, record, index) => `${index + 1}`,
  100. width: '80px',
  101. },
  102. { dataIndex: 'id', sdHidden: true },
  103. {
  104. title: '准则版本编号',
  105. dataIndex: 'criteriaCode',
  106. scopedSlots: { customRender: 'islink' },
  107. },
  108. {
  109. title: '准则适用范围',
  110. dataIndex: 'criteriaDeptName',
  111. width: '300px',
  112. },
  113. {
  114. title: '状态',
  115. dataIndex: 'state',
  116. },
  117. {
  118. title: '创建人员',
  119. dataIndex: 'creatorName',
  120. },
  121. {
  122. title: '创建日期',
  123. dataIndex: 'creationTime',
  124. sdRender: TableColumnTypes.date,
  125. // sorter: true,
  126. defaultSortOrder: 'descend',
  127. },
  128. ],
  129. actions: [],
  130. expressions: [],
  131. }
  132. },
  133. mounted() {
  134. // 判断用户权限
  135. riskCriteriaService
  136. .checkUserPermission({
  137. formId: 'riskCriteria',
  138. })
  139. .then((res) => {
  140. if (res.data) {
  141. this.actions = [
  142. {
  143. label: '新建',
  144. id: 'new',
  145. type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  146. permission: null,
  147. callback: this.createReport,
  148. index: 4,
  149. },
  150. {
  151. label: '删除',
  152. id: 'delete',
  153. type: TableActionTypes.ex.delete,
  154. permission: null,
  155. index: 3,
  156. },
  157. ]
  158. }
  159. })
  160. },
  161. methods: {
  162. createReport() {
  163. const url = '/risk-criteria-form' // 新页面要打开的路由地址
  164. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  165. if (refreshFlag) {
  166. // 这里写或者调刷新的方法
  167. this.refreshDataTable()
  168. }
  169. })
  170. },
  171. refreshDataTable() {
  172. if (this.$refs.riskCriteriaTable) {
  173. this.$refs.riskCriteriaTable.clearSelection()
  174. this.$refs.riskCriteriaTable.refresh()
  175. }
  176. },
  177. open(record) {
  178. const url = '/risk-criteria-form?record=' + record.id // 新页面要打开的路由地址
  179. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  180. if (refreshFlag) {
  181. this.refreshDataTable()
  182. }
  183. })
  184. },
  185. handleSearch() {
  186. this.expressions = []
  187. // 报告名称
  188. if (this.formData.criteriaCode) {
  189. this.expressions.push({
  190. dataType: 'str',
  191. name: 'criteriaCode',
  192. op: 'like',
  193. stringValue: '%' + this.formData.criteriaCode + '%',
  194. })
  195. }
  196. // 被评价单位
  197. if (this.formData.criteriaDeptCode.length > 0) {
  198. const unitExp = this.formData.criteriaDeptCode.map((item) => item.code)
  199. this.expressions.push({
  200. dataType: 'str',
  201. name: 'criteriaDeptCode',
  202. op: 'in',
  203. stringValue: unitExp.join(','),
  204. })
  205. }
  206. // 是否启用
  207. if (this.formData.status.length > 0) {
  208. this.expressions.push({
  209. dataType: 'str',
  210. name: 'state',
  211. op: 'eq',
  212. stringValue: this.formData.status[0].id + '',
  213. })
  214. }
  215. this.expressions = [...this.expressions]
  216. },
  217. // 重置
  218. resetForm() {
  219. this.formData = {
  220. criteriaCode: '',
  221. criteriaDeptCode: [],
  222. status: [],
  223. }
  224. },
  225. },
  226. }
  227. </script>
  228. <style module lang="scss">
  229. @use '@/common/design' as *;
  230. .wrap-height {
  231. height: 100%;
  232. .row-height {
  233. display: flex;
  234. flex: auto;
  235. height: 100%;
  236. .rightcard {
  237. flex: 1;
  238. width: calc(100% - 20%);
  239. height: 100%;
  240. }
  241. }
  242. }
  243. </style>