master-data-operate.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div :class="[$style.wrapHeight, $style.dataclass]">
  3. <div :class="$style.rowHeight">
  4. <div :class="$style.rightcard">
  5. <a-card>
  6. <audit-advanced-query
  7. :expand="expand"
  8. :ref-name="searchform"
  9. :search-data="formData"
  10. :search-style="{ height: '150px', left: '20px', top: '57px' }"
  11. :search-fun="handleSearch"
  12. @searchedClick="searchedClick"
  13. >
  14. <template>
  15. <a-col :span="16">
  16. <a-form-model-item :label="'操作时间'" prop="time">
  17. <a-range-picker v-model="formData.time" />
  18. </a-form-model-item>
  19. </a-col>
  20. </template>
  21. </audit-advanced-query>
  22. <SdDataTableEx
  23. ref="dataTable"
  24. form-id="iamOperationAssociationRecord"
  25. data-url="api/xcoa-mobile/v1/iam-page/businessList"
  26. :columns="columns"
  27. :actions="actions"
  28. :filter-expressions="expressions"
  29. :editnode="editnode"
  30. :projectlist="true"
  31. :show-advance-query="true"
  32. @searchbtnClick="searchbtnClick"
  33. >
  34. <div slot="source" slot-scope="text">
  35. <span v-if="text === 1" >自定义数据</span>
  36. <span v-else>系统数据</span>
  37. </div>
  38. </SdDataTableEx>
  39. </a-card>
  40. </div>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import SdDataTableEx from '@/common/components/sd-data-table-ex.vue'
  46. import SdDataTable from '@/common/components/sd-data-table.vue'
  47. import TableColumnTypes from '@/common/services/table-column-types'
  48. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  49. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  50. import masterDataService from './master-data-service'
  51. import { Modal, Message } from 'ant-design-vue'
  52. export default {
  53. name: 'MasterDataOperate',
  54. metaInfo: {
  55. title: '关联操作记录',
  56. },
  57. components: {
  58. SdDataTableEx,
  59. auditAdvancedQuery,
  60. },
  61. mixins: [auditAdvancedQueryMixins],
  62. data() {
  63. return {
  64. editnode: true,
  65. searchform: 'searchform',
  66. formData: {
  67. startTime: '',
  68. endTime: '',
  69. time: [],
  70. },
  71. actions: [],
  72. columns: [
  73. {
  74. dataIndex: 'id',
  75. sdHidden: true,
  76. },
  77. {
  78. dataIndex: 'groupId',
  79. sdHidden: true,
  80. },
  81. {
  82. title: '系统名称',
  83. dataIndex: 'sysName',
  84. },
  85. {
  86. title: '代码',
  87. dataIndex: 'code',
  88. },
  89. {
  90. title: '名称',
  91. dataIndex: 'name',
  92. },
  93. {
  94. title: '级别',
  95. dataIndex: 'level',
  96. },
  97. {
  98. title: '类型',
  99. dataIndex: 'source',
  100. scopedSlots: { customRender: 'source' },
  101. },
  102. {
  103. title: '操作人',
  104. dataIndex: 'operation',
  105. },
  106. {
  107. title: '操作时间',
  108. dataIndex: 'operationTime',
  109. sdRender: TableColumnTypes.date,
  110. },
  111. {
  112. title: '操作',
  113. dataIndex: 'opt',
  114. aligen: 'center',
  115. width: '150px',
  116. customRender: (text, record, index) => {
  117. return (
  118. <span>
  119. <a
  120. vOn:click={(evt) => {
  121. this.revokeClick(record.id)
  122. }}
  123. >
  124. 撤销
  125. </a>
  126. </span>
  127. )
  128. },
  129. },
  130. ],
  131. expressions: [
  132. // id
  133. {
  134. dataType: 'str',
  135. name: 'groupId',
  136. op: 'eq',
  137. stringValue: this.$route.query.id,
  138. },
  139. ],
  140. }
  141. },
  142. methods: {
  143. handleSearch() {
  144. this.expressions = [
  145. {
  146. dataType: 'str',
  147. name: 'groupId',
  148. op: 'eq',
  149. stringValue: this.$route.query.id,
  150. },
  151. ]
  152. if (this.formData.time.length === 2) {
  153. this.formData.time.forEach((item, index) => {
  154. this.expressions.push({
  155. dataType: 'long',
  156. name: 'operationTime',
  157. op: index === 0 ? 'ge' : 'lt',
  158. longValue: item._d.getTime(),
  159. })
  160. })
  161. }
  162. },
  163. // 撤销关联记录
  164. revokeClick(id) {
  165. const that = this
  166. Modal.confirm({
  167. title: '提示',
  168. content: '确定要删除这条记录吗?',
  169. onOk() {
  170. masterDataService.revokeOrgData(id).then((res) => {
  171. if (res.data) {
  172. Message.success('删除成功', 1).then((flag) => {
  173. if (flag) {
  174. that.$refs.dataTable.refresh()
  175. }
  176. })
  177. }
  178. })
  179. },
  180. onCancel() {},
  181. })
  182. },
  183. },
  184. }
  185. </script>
  186. <style module lang="scss">
  187. @use '@/common/design' as *;
  188. .wrap-height {
  189. height: 100%;
  190. .row-height {
  191. display: flex;
  192. flex: auto;
  193. height: 100%;
  194. .rightcard {
  195. flex: 1;
  196. width: calc(100% - 20%);
  197. height: 100%;
  198. }
  199. }
  200. }
  201. .dataclass {
  202. :global(.projectlist .ant-table-empty .ant-table-body) {
  203. overflow-x: hidden !important;
  204. }
  205. :global(span > .ant-btn:nth-child(2)) {
  206. color: #fff;
  207. background-color: #1890ff;
  208. border-color: #1890ff;
  209. }
  210. // :global(.ant-table-placeholder) {
  211. // width: auto;
  212. // }
  213. }
  214. </style>