Blame view

ant-design-vue-jeecg/src/views/system/modules/AddressListRight.vue 5.55 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<template>
  <a-card class="j-address-list-right-card-box" :loading="cardLoading" :bordered="false">
    <div class="table-page-search-wrapper">
      <a-form-model layout="inline" :model="queryParam">
        <a-row :gutter="10">

          <a-col :md="6" :sm="12">
            <a-form-model-item label="姓名" prop="realname" style="margin-left:8px">
              <a-input placeholder="请输入姓名查询" v-model="queryParam.realname"></a-input>
            </a-form-model-item>
          </a-col>


          <a-col :md="6" :sm="12">
            <a-form-model-item label="工号" prop="workNo" style="margin-left:8px">
              <a-input placeholder="请输入工号查询" v-model="queryParam.workNo"></a-input>
            </a-form-model-item>
          </a-col>

          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="6" :sm="24">
             <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </a-col>
          </span>
        </a-row>
      </a-form-model>
    </div>

    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="userId"
      :pagination="ipagination"
      :columns="columns"
      :dataSource="dataSource"
      :loading="loading"
      @change="handleTableChange">
    </a-table>

  </a-card>
</template>

<script>
肖超群 authored
46
47
import {getAction} from '@/api/manage'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
肖超群 authored
48
肖超群 authored
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
export default {
  name: 'AddressListRight',
  mixins: [JeecgListMixin],
  components: {},
  props: ['value'],
  data() {
    return {
      description: '用户信息',
      cardLoading: true,
      positionInfo: {},
      columns: [
        {
          title: '#',
          key: 'rowIndex',
          dataIndex: '',
          width: 60,
          align: 'center',
          customRender: (t, r, i) => parseInt(i) + 1
        },
        {
          title: '姓名',
          width: '15%',
          align: 'center',
          dataIndex: 'realname'
        },
        {
          title: '工号',
          width: '15%',
          align: 'center',
          dataIndex: 'workNo'
        },
        {
          title: '部门',
          width: '20%',
          align: 'center',
          dataIndex: 'departName'
        },
        {
          title: '职务',
          width: '15%',
          align: 'center',
          dataIndex: 'post',
          customRender: (text) => (text || '').split(',').map(t => this.positionInfo[t] ? this.positionInfo[t] : t).join(',')
        },
        {
          title: '手机',
          width: '15%',
          align: 'center',
          dataIndex: 'phone'
        },
        // {
        //   title: '手机号',
        //   width: '12%',
        //   align: 'center',
        //   dataIndex: 'phone'
        // },
        {
          title: '公司邮箱',
          width: '15%',
          align: 'center',
          dataIndex: 'email'
肖超群 authored
110
        }
肖超群 authored
111
112
113
114
115
116
117
118
119
120
121
122
123
      ],
      url: {
        list: '/sys/user/queryByOrgCodeForAddressList',
        listByPosition: '/sys/position/list'
      }
    }
  },
  watch: {
    value: {
      immediate: true,
      handler(orgCode) {
        this.dataSource = []
        this.loadData(1, orgCode)
肖超群 authored
124
125
      }
    },
肖超群 authored
126
127
128
129
130
  },
  created() {
    this.queryPositionInfo()
  },
  methods: {
肖超群 authored
131
肖超群 authored
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
    loadData(pageNum, orgCode) {
      this.loading = true
      if (pageNum === 1) {
        this.ipagination.current = 1
      }
      // update-begin- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
      if (!orgCode) {
        getAction(this.url.list, {
          ...this.getQueryParams()
        }).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records
            this.ipagination.total = res.result.total
          }
        }).finally(() => {
          this.loading = false
          this.cardLoading = false
        })
        // update-end- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
      } else {
肖超群 authored
152
153
154
155
156
157
158
159
160
161
162
163
164
        //加载数据 若传入参数1则加载第一页的内容
        getAction(this.url.list, {
          orgCode,
          ...this.getQueryParams()
        }).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records
            this.ipagination.total = res.result.total
          }
        }).finally(() => {
          this.loading = false
          this.cardLoading = false
        })
肖超群 authored
165
166
      }
    },
肖超群 authored
167
肖超群 authored
168
169
170
171
172
173
174
    searchQuery() {
      this.loadData(1, this.value)
    },
    searchReset() {
      this.queryParam = {}
      this.loadData(1, this.value)
    },
肖超群 authored
175
肖超群 authored
176
177
178
179
    handleTableChange(pagination, filters, sorter) {
      if (Object.keys(sorter).length > 0) {
        this.isorter.column = sorter.field
        this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
肖超群 authored
180
      }
肖超群 authored
181
182
183
      this.ipagination = pagination
      this.loadData(null, this.value)
    },
肖超群 authored
184
肖超群 authored
185
186
187
188
189
190
191
192
193
194
195
    // 查询职务信息
    queryPositionInfo() {
      getAction(this.url.listByPosition, {pageSize: 99999}).then(res => {
        if (res.success) {
          let positionInfo = {}
          res.result.records.forEach(record => {
            positionInfo[record['code']] = record['name']
          })
          this.positionInfo = positionInfo
        }
      })
肖超群 authored
196
    }
肖超群 authored
197
肖超群 authored
198
  }
肖超群 authored
199
}
肖超群 authored
200
201
</script>
<style>
肖超群 authored
202
203
204
.j-address-list-right-card-box .ant-table-placeholder {
  min-height: 46px;
}
肖超群 authored
205
206
</style>
<style scoped>
肖超群 authored
207
208
209
210
.j-address-list-right-card-box {
  height: 100%;
  min-height: 300px;
}
肖超群 authored
211
</style>