sd-user-list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div>
  3. <a-card :class="$style.tabclass">
  4. <a-tabs type="line" class="ant-card sd-has-table">
  5. <a-tab-pane key="1" tab="用户信息">
  6. <template v-if="groupId">
  7. <sd-data-table
  8. ref="userTable"
  9. :data-url="`api/framework/v1/user-manager/${groupId}/members`"
  10. :filter-expressions="expressions"
  11. :columns="columns"
  12. :row-key="'id'"
  13. :search-fields="['addrUser']"
  14. :process-res="processRes"
  15. @rowClick="handleUserClick"
  16. />
  17. </template>
  18. <sd-user-info
  19. ref="signatureDetail"
  20. :record-id="signatureId"
  21. page-id="base/signature/oaUserSignature"
  22. :user="curUserObj"
  23. @saved="saved"
  24. />
  25. </a-tab-pane>
  26. </a-tabs>
  27. </a-card>
  28. </div>
  29. </template>
  30. <script>
  31. import TableColumnTypes from '@/common/services/table-column-types'
  32. import SignaturemanageService from './signaturemanage-service'
  33. import components from './_import-components/sd-user-list-import'
  34. export default {
  35. name: 'SdUserList',
  36. components,
  37. props: {
  38. groupId: {
  39. type: String,
  40. default: '',
  41. },
  42. isContainSubOrg: {
  43. type: Boolean,
  44. default: false,
  45. },
  46. },
  47. data() {
  48. return {
  49. expressions: [
  50. {
  51. name: 'isContainsSub',
  52. stringValue: 'y',
  53. },
  54. ], // 默认搜索
  55. columns: [
  56. {
  57. title: '姓名',
  58. dataIndex: 'name',
  59. sdClickable: true,
  60. },
  61. {
  62. title: '更新时间',
  63. dataIndex: 'props.signDate',
  64. sdRender: TableColumnTypes.dateTime,
  65. },
  66. {
  67. title: '状态',
  68. dataIndex: 'status',
  69. },
  70. ],
  71. signatureId: null,
  72. curUserObj: {},
  73. attachmentNum: -1,
  74. }
  75. },
  76. computed: {},
  77. watch: {
  78. isContainSubOrg(val) {
  79. this.$set(
  80. this.expressions,
  81. 0,
  82. Object.assign(
  83. {},
  84. {
  85. name: 'isContainsSub',
  86. stringValue: val ? 'y' : 'n',
  87. }
  88. )
  89. )
  90. },
  91. },
  92. methods: {
  93. handleUserClick(record, dataIndex, value) {
  94. if (record) {
  95. const params = {
  96. columns: '',
  97. maxResults: 1, // 用户签名列表仅有一条数据
  98. startPosition: 0,
  99. expressions: [
  100. {
  101. dataType: 'str',
  102. name: 'userId',
  103. op: 'eq',
  104. stringValue: record.id,
  105. },
  106. ],
  107. formId: 'oaUserSignature',
  108. }
  109. SignaturemanageService.getUserSignatureList(params).then((res) => {
  110. if (res.data.data.length > 0) {
  111. this.signatureId = res.data.data[0].id
  112. } else {
  113. // 该用户无签名
  114. this.curUserObj = { ...record }
  115. this.signatureId = null
  116. }
  117. this.$nextTick(() => {
  118. this.$refs.signatureDetail.show()
  119. })
  120. })
  121. }
  122. },
  123. processRes(data) {
  124. const dataBase = data.data
  125. dataBase.forEach((e) => {
  126. e.props.signDate = parseInt(e.props.signDate)
  127. if (e.status === '0') {
  128. e.status = '未激活'
  129. } else if (e.status === '1') {
  130. e.status = '正常'
  131. } else if (e.status === '2') {
  132. e.status = '已注销'
  133. } else if (e.status === '4') {
  134. e.status = '账号已过期'
  135. } else if (e.status === '8') {
  136. e.status = '密码已过期'
  137. } else if (e.status === '16') {
  138. e.status = '已被锁定'
  139. } else if (e.status === '32') {
  140. e.status = '用户停用'
  141. } else if (e.status === '64') {
  142. e.status = '用户禁止登录'
  143. } else {
  144. e.status = '未标识的编号'
  145. }
  146. })
  147. return {
  148. datas: dataBase,
  149. total: data.totalSize,
  150. }
  151. },
  152. saved() {
  153. this.$refs.userTable.refresh()
  154. },
  155. },
  156. }
  157. </script>
  158. <style module lang="scss">
  159. @use '@/common/design' as *;
  160. .use-sign {
  161. position: relative;
  162. :global(.ant-form-item-label),
  163. :global(.ant-input) {
  164. visibility: hidden;
  165. }
  166. :global(.has-error) {
  167. position: relative;
  168. top: -96px;
  169. }
  170. }
  171. .tabclass {
  172. :global(.sd-has-table.ant-tabs) {
  173. .wrapper {
  174. margin-top: -64px;
  175. }
  176. }
  177. }
  178. </style>