12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { mapGetters } from 'vuex'
- import { debounce } from '@/utils'
- export default {
- data() {
- return {
- loadingMore: false,
- finished: true,
- isRequest: true,
- listQuery: {
- authUserId: '',
- doctorType: 1,
- doctorName: '',
- pageNum: 1,
- pageSize: 12,
- },
- list: [],
- total: 0,
- }
- },
- computed: {
- ...mapGetters(['supplierInfo', 'authUserId', 'routePrefix']),
- },
- mounted() {
- this.fetchList()
- },
- methods: {
- fetchList: debounce(async function () {
- try {
- this.loadingMore = true
- this.listQuery.authUserId = this.authUserId
- const res = await this.$http.api.fetchDoctorList(this.listQuery)
- this.list = [...this.list, ...res.data.list]
- this.finished = !res.data.hasNextPage
- this.listQuery.pageNum += 1
- this.total = res.data.total
- } catch (error) {
- console.log(error)
- } finally {
- this.isRequest = false
- this.loadingMore = false
- }
- }, 400),
- // 搜索
- onSearch() {
- this.list = []
- this.listQuery.pageNum = 1
- this.fetchList()
- },
- // 医师详情
- toDetail(item) {
- const url = `${this.routePrefix}/approve/personnel/operate/detail?id=${item.doctorId}`
- this.$router.push(url)
- },
- // 加载更多
- onLoadMore() {
- this.fetchList()
- },
- },
- }
|