d3b65f99044ec7afd9d4d64765990e90ed41bc72.svn-base 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <a-card class="j-address-list-right-card-box" :loading="cardLoading" :bordered="false">
  3. <div class="table-page-search-wrapper">
  4. <a-form-model layout="inline" :model="queryParam">
  5. <a-row :gutter="10">
  6. <a-col :md="6" :sm="12">
  7. <a-form-model-item label="姓名" prop="realname" style="margin-left:8px">
  8. <a-input placeholder="请输入姓名查询" v-model="queryParam.realname"></a-input>
  9. </a-form-model-item>
  10. </a-col>
  11. <!-- <a-col :md="6" :sm="12">-->
  12. <!-- <a-form-model-item label="工号" prop="workNo" style="margin-left:8px">-->
  13. <!-- <a-input placeholder="请输入工号查询" v-model="queryParam.workNo"></a-input>-->
  14. <!-- </a-form-model-item>-->
  15. <!-- </a-col>-->
  16. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  17. <a-col :md="6" :sm="24">
  18. <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px">查询</a-button>
  19. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  20. </a-col>
  21. </span>
  22. </a-row>
  23. </a-form-model>
  24. </div>
  25. <a-table
  26. ref="table"
  27. size="middle"
  28. bordered
  29. rowKey="userId"
  30. :pagination="ipagination"
  31. :columns="columns"
  32. :dataSource="dataSource"
  33. :loading="loading"
  34. @change="handleTableChange">
  35. </a-table>
  36. </a-card>
  37. </template>
  38. <script>
  39. import { getAction } from '@/api/manage'
  40. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  41. export default {
  42. name: 'AddressListRight',
  43. mixins: [JeecgListMixin],
  44. components: {},
  45. props: ['value'],
  46. data() {
  47. return {
  48. description: '用户信息',
  49. cardLoading: true,
  50. positionInfo: {},
  51. columns: [
  52. {
  53. title: '#',
  54. key: 'rowIndex',
  55. dataIndex: '',
  56. width: 60,
  57. align: 'center',
  58. customRender: (t, r, i) => parseInt(i) + 1
  59. },
  60. {
  61. title: '姓名',
  62. width: '15%',
  63. align: 'center',
  64. dataIndex: 'realname'
  65. },
  66. // {
  67. // title: '工号',
  68. // width: '15%',
  69. // align: 'center',
  70. // dataIndex: 'workNo'
  71. // },
  72. {
  73. title: '部门',
  74. width: '20%',
  75. align: 'center',
  76. dataIndex: 'departName'
  77. },
  78. {
  79. title: '职务',
  80. width: '15%',
  81. align: 'center',
  82. dataIndex: 'post',
  83. customRender: (text) => (text || '').split(',').map(t => this.positionInfo[t] ? this.positionInfo[t] : t).join(',')
  84. },
  85. {
  86. title: '手机',
  87. width: '15%',
  88. align: 'center',
  89. dataIndex: 'telephone'
  90. },
  91. // {
  92. // title: '手机号',
  93. // width: '12%',
  94. // align: 'center',
  95. // dataIndex: 'phone'
  96. // },
  97. {
  98. title: '公司邮箱',
  99. width: '15%',
  100. align: 'center',
  101. dataIndex: 'email'
  102. }
  103. ],
  104. url: {
  105. list: '/sys/user/queryByOrgCodeForAddressList',
  106. listByPosition: '/sys/position/list'
  107. }
  108. }
  109. },
  110. watch: {
  111. value: {
  112. immediate: true,
  113. handler(orgCode) {
  114. this.dataSource = []
  115. this.loadData(1, orgCode)
  116. }
  117. },
  118. },
  119. created() {
  120. this.queryPositionInfo()
  121. },
  122. methods: {
  123. loadData(pageNum, orgCode) {
  124. this.loading = true
  125. if (pageNum === 1) {
  126. this.ipagination.current = 1
  127. }
  128. // update-begin- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
  129. if (!orgCode) {
  130. getAction(this.url.list, {
  131. ...this.getQueryParams()
  132. }).then((res) => {
  133. if (res.success) {
  134. this.dataSource = res.result.records;
  135. this.ipagination.total = Number(res.result.total);
  136. }
  137. }).finally(() => {
  138. this.loading = false
  139. this.cardLoading = false
  140. })
  141. // update-end- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
  142. }else{
  143. //加载数据 若传入参数1则加载第一页的内容
  144. getAction(this.url.list, {
  145. orgCode,
  146. ...this.getQueryParams()
  147. }).then((res) => {
  148. if (res.success) {
  149. this.dataSource = res.result.records;
  150. this.ipagination.total = Number(res.result.total);
  151. }
  152. }).finally(() => {
  153. this.loading = false
  154. this.cardLoading = false
  155. })
  156. }
  157. },
  158. searchQuery() {
  159. this.loadData(1, this.value)
  160. },
  161. searchReset() {
  162. this.queryParam = {}
  163. this.loadData(1, this.value)
  164. },
  165. handleTableChange(pagination, filters, sorter) {
  166. if (Object.keys(sorter).length > 0) {
  167. this.isorter.column = sorter.field
  168. this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
  169. }
  170. this.ipagination = pagination
  171. this.loadData(null, this.value)
  172. },
  173. // 查询职务信息
  174. queryPositionInfo() {
  175. getAction(this.url.listByPosition, { pageSize: 99999 }).then(res => {
  176. if (res.success) {
  177. let positionInfo = {}
  178. res.result.records.forEach(record => {
  179. positionInfo[record['code']] = record['name']
  180. })
  181. this.positionInfo = positionInfo
  182. }
  183. })
  184. }
  185. }
  186. }
  187. </script>
  188. <style>
  189. .j-address-list-right-card-box .ant-table-placeholder {
  190. min-height: 46px;
  191. }
  192. </style>
  193. <style scoped>
  194. .j-address-list-right-card-box {
  195. height: 100%;
  196. min-height: 300px;
  197. }
  198. </style>