You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

67 lines
2.0 KiB

<template>
2 years ago
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" v-auth="['mp:user:sync']" :preIcon="IconEnum.RESET" @click="handleSync">
2 years ago
{{ t('action.sync') }}
2 years ago
</a-button>
</template>
<template #bodyCell="{ column }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'mp:user:update', onClick: handleEdit.bind(null) }]"
/>
</template>
</template>
</BasicTable>
<MpUserModal @register="registerModal" @success="reload()" />
</div>
</template>
2 years ago
<script lang="ts" setup name="MpUser">
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { useModal } from '@/components/Modal'
import MpUserModal from './MpUserModal.vue'
import { IconEnum } from '@/enums/appEnum'
import { BasicTable, useTable, TableAction } from '@/components/Table'
import { getUserPage, syncUser } from '@/api/mp/mpuser'
import { columns, searchFormSchema } from './mpuser.data'
const { t } = useI18n()
const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { getForm, reload }] = useTable({
title: '公众号账号列表',
api: getUserPage,
columns,
formConfig: { labelWidth: 120, schemas: searchFormSchema },
useSearchForm: true,
showTableSetting: true,
actionColumn: {
width: 140,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right'
}
})
/** 同步按钮操作 */
async function handleSync() {
createConfirm({
2 years ago
title: t('action.sync'),
2 years ago
iconType: 'warning',
content: '是否确认同步粉丝?',
async onOk() {
await syncUser(getForm().getFieldsValue().accountId)
createMessage.success('开始从微信公众号同步粉丝信息,同步需要一段时间,建议稍后再查询')
}
})
}
/** 修改按钮操作 */
function handleEdit(record: Recordable) {
openModal(true, { record })
}
</script>