AddressListRight.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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 layout="inline">
  5. <a-row :gutter="10">
  6. <a-col :md="6" :sm="12">
  7. <a-form-item label="姓名" style="margin-left:8px">
  8. <a-input placeholder="请输入姓名查询" v-model="queryParam.realname"></a-input>
  9. </a-form-item>
  10. </a-col>
  11. <a-col :md="6" :sm="12">
  12. <a-form-item label="工号" style="margin-left:8px">
  13. <a-input placeholder="请输入工号查询" v-model="queryParam.workNo"></a-input>
  14. </a-form-item>
  15. </a-col>
  16. <a-col :md="6" :sm="12">
  17. <a-form-item label="部门" style="margin-left:8px">
  18. <j-search-select-tag v-model="queryParam.deptName" placeholder="请选择部门"
  19. dict="sys_depart,depart_name,depart_name,org_type='3' or org_code='TBD' order by org_code"/>
  20. </a-form-item>
  21. </a-col>
  22. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  23. <a-col :md="6" :sm="24">
  24. <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px">查询</a-button>
  25. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  26. </a-col>
  27. </span>
  28. </a-row>
  29. </a-form>
  30. </div>
  31. <div class="table-operator" style="border-top: 5px">
  32. <a-button @click="handleDelete" type="primary" icon="hdd" v-has='"address:delete"'>删除</a-button>
  33. <a-button type="primary" icon="download" @click="handleExportXls('通讯录信息')">导出</a-button>
  34. </div>
  35. <a-table
  36. ref="table"
  37. size="middle"
  38. bordered
  39. rowKey="id"
  40. :pagination="ipagination"
  41. :columns="columns"
  42. :dataSource="dataSource"
  43. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  44. :loading="loading"
  45. @change="handleTableChange">
  46. </a-table>
  47. </a-card>
  48. </template>
  49. <script>
  50. import { getAction,deleteAction } from '@/api/manage'
  51. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  52. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  53. export default {
  54. name: 'AddressListRight',
  55. mixins: [JeecgListMixin],
  56. components: {JSearchSelectTag},
  57. props: ['value'],
  58. data() {
  59. return {
  60. description: '用户信息',
  61. cardLoading: true,
  62. positionInfo: {},
  63. deptnameOptionArr:[],
  64. ipagination:{
  65. pageSizeOptions: ["10", "20", "30", "300"]
  66. },
  67. columns: [
  68. // {
  69. // title: '#',
  70. // key: 'rowIndex',
  71. // dataIndex: '',
  72. // width: 60,
  73. // align: 'center',
  74. // customRender: (t, r, i) => parseInt(i) + 1
  75. // },
  76. {
  77. title: '姓名',
  78. width: '7%',
  79. align: 'center',
  80. dataIndex: 'realname'
  81. },
  82. {
  83. title: '工号',
  84. width: '7%',
  85. align: 'center',
  86. dataIndex: 'workNo'
  87. },
  88. {
  89. title: '部门',
  90. width: '15%',
  91. align: 'center',
  92. dataIndex: 'departIds'
  93. },
  94. {
  95. title: '职务',
  96. width: '10%',
  97. align: 'center',
  98. dataIndex: 'post',
  99. customRender: (text) => (text || '').split(',').map(t => this.positionInfo[t] ? this.positionInfo[t] : t).join(',')
  100. },
  101. {
  102. title: '手机',
  103. width: '10%',
  104. align: 'center',
  105. dataIndex: 'phone'
  106. },
  107. {
  108. title: '虚拟网号',
  109. width: '10%',
  110. align: 'center',
  111. dataIndex: 'nvirtualNo'
  112. },
  113. {
  114. title: '公司电话',
  115. width: '10%',
  116. align: 'center',
  117. dataIndex: 'ncompanyPhone'
  118. },
  119. {
  120. title: '公司内线',
  121. width: '10%',
  122. align: 'center',
  123. dataIndex: 'ncompanyLine'
  124. },
  125. {
  126. title: '家电',
  127. width: '10%',
  128. align: 'center',
  129. dataIndex: 'telephone'
  130. },
  131. {
  132. title: '公司邮箱',
  133. width: '11%',
  134. align: 'center',
  135. dataIndex: 'email'
  136. }
  137. ],
  138. url: {
  139. exportXlsUrl: "/sys/user/exportXls?address=1",
  140. list: '/sys/user/queryByOrgCodeForAddressList',
  141. listByPosition: '/sys/position/list'
  142. }
  143. }
  144. },
  145. watch: {
  146. value: {
  147. immediate: true,
  148. handler(orgCode) {
  149. this.dataSource = []
  150. this.loadData(1, orgCode)
  151. }
  152. },
  153. },
  154. created() {
  155. },
  156. methods: {
  157. loadData(pageNum, orgCode) {
  158. this.loading = true
  159. if (pageNum === 1) {
  160. this.ipagination.current = 1
  161. }
  162. // update-begin- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
  163. if (!orgCode) {
  164. getAction(this.url.list, {
  165. ...this.getQueryParams()
  166. }).then((res) => {
  167. if (res.success) {
  168. this.dataSource = res.result.records
  169. this.ipagination.total = res.result.total
  170. }
  171. }).finally(() => {
  172. this.loading = false
  173. this.cardLoading = false
  174. })
  175. // update-end- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
  176. }else{
  177. //加载数据 若传入参数1则加载第一页的内容
  178. getAction(this.url.list, {
  179. orgCode,
  180. ...this.getQueryParams()
  181. }).then((res) => {
  182. if (res.success) {
  183. this.dataSource = res.result.records
  184. this.ipagination.total = res.result.total
  185. }
  186. }).finally(() => {
  187. this.loading = false
  188. this.cardLoading = false
  189. })
  190. }
  191. },
  192. searchQuery() {
  193. this.loadData(1, this.value)
  194. },
  195. searchReset() {
  196. this.queryParam = {}
  197. this.loadData(1, this.value)
  198. },
  199. handleTableChange(pagination, filters, sorter) {
  200. if (Object.keys(sorter).length > 0) {
  201. this.isorter.column = sorter.field
  202. this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
  203. }
  204. this.ipagination = pagination
  205. this.loadData(null, this.value)
  206. },
  207. //删除
  208. handleDelete(){
  209. if (this.selectedRowKeys.length <= 0) {
  210. this.$message.warning('请选择一条记录!');
  211. return;
  212. } else {
  213. var ids = "";
  214. for (var a = 0; a < this.selectedRowKeys.length; a++) {
  215. ids += this.selectedRowKeys[a] + ",";
  216. }
  217. var that = this;
  218. this.$confirm({
  219. title: "确认取消",
  220. content: "是否删除?",
  221. onOk: function () {
  222. deleteAction("/sys/user/deleteCommunication", {id:ids}).then((res) => {
  223. if (res.success) {
  224. that.$message.success("删除成功!");
  225. that.loadData();
  226. that.onClearSelected();
  227. } else {
  228. that.$message.warning(res.message);
  229. }
  230. });
  231. }
  232. });
  233. }
  234. },
  235. // 查询职务信息
  236. queryPositionInfo() {
  237. getAction(this.url.listByPosition, { pageSize: 99999 }).then(res => {
  238. if (res.success) {
  239. let positionInfo = {}
  240. res.result.records.forEach(record => {
  241. positionInfo[record['code']] = record['name']
  242. })
  243. this.positionInfo = positionInfo
  244. }
  245. })
  246. }
  247. }
  248. }
  249. </script>
  250. <style>
  251. .j-address-list-right-card-box .ant-table-placeholder {
  252. min-height: 46px;
  253. }
  254. </style>
  255. <style scoped>
  256. .j-address-list-right-card-box {
  257. height: 100%;
  258. min-height: 300px;
  259. }
  260. </style>