3 changed files with 129 additions and 83 deletions
Unified View
Diff Options
-
79src/views/components/MemberModal.vue
-
49src/views/invite/index/index.vue
-
84src/views/invite/list/index.vue
@ -0,0 +1,79 @@ |
|||||
|
<template> |
||||
|
<BasicModal v-bind="$attrs" title="奖品选择" @ok="handleOk" @register="registerModal"> |
||||
|
<BasicTable row-key="userId" @register="registerTable" /> |
||||
|
</BasicModal> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue' |
||||
|
import { useMessage } from '/@/hooks/web/useMessage' |
||||
|
import { BasicTable, useTable, BasicColumn, FormSchema } from '/@/components/Table' |
||||
|
import { BasicModal, useModalInner } from '/@/components/Modal' |
||||
|
import { pageOrganizationMember } from '/@/api/staff/staff' |
||||
|
|
||||
|
const tableColumns: BasicColumn[] = [ |
||||
|
{ width: 120, title: '姓名', dataIndex: 'realName' }, |
||||
|
{ width: 160,title: '手机号', dataIndex: 'phone' }, |
||||
|
{ title: '部门', dataIndex: 'departmentName' }, |
||||
|
{ title: '添加时间', dataIndex: 'joinedTime' }, |
||||
|
] |
||||
|
|
||||
|
const tableFormSchema: FormSchema[] = [ |
||||
|
{ field: 'name', label: '姓名', component: 'Input', colProps: { span: 9 } }, |
||||
|
{ field: 'phone', label: '手机号', component: 'Input', colProps: { span: 9 } }, |
||||
|
] |
||||
|
|
||||
|
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({ |
||||
|
bordered: true, |
||||
|
immediate: false, |
||||
|
canResize: false, |
||||
|
useSearchForm: true, |
||||
|
showIndexColumn: true, |
||||
|
showTableSetting: false, |
||||
|
pagination: true, |
||||
|
api: pageOrganizationMember, |
||||
|
columns: tableColumns, |
||||
|
rowSelection: { |
||||
|
type: 'radio', |
||||
|
}, |
||||
|
formConfig: { |
||||
|
labelWidth: 80, |
||||
|
schemas: tableFormSchema, |
||||
|
}, |
||||
|
}) |
||||
|
|
||||
|
const id = ref<string>('') |
||||
|
const [registerModal, { setModalProps }] = useModalInner(async (data: any) => { |
||||
|
const { record } = data |
||||
|
var title = '分配' |
||||
|
if(record){ |
||||
|
id.value = record?.id |
||||
|
title = record.allocationStatus == 1 ? '分配' : '重新分配' |
||||
|
} |
||||
|
setModalProps({ |
||||
|
minHeight: 50, |
||||
|
title, |
||||
|
confirmLoading: false, |
||||
|
width: '800px', |
||||
|
}) |
||||
|
await reload() |
||||
|
await clearSelectedRowKeys() |
||||
|
}) |
||||
|
|
||||
|
const { createMessage } = useMessage() |
||||
|
const emits = defineEmits(['success']) |
||||
|
async function handleOk() { |
||||
|
const rows = getSelectRows() |
||||
|
if (!rows?.length) { |
||||
|
createMessage.error('请选择分配人') |
||||
|
return |
||||
|
} |
||||
|
emits('success', {id: id.value, rows}) |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="less"> |
||||
|
:deep(.ant-form) { |
||||
|
margin-bottom: 0; |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save