This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
147 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<template> | ||
<div> | ||
<BasicTable @register="registerTable"> | ||
<template #toolbar> | ||
<a-button type="primary" @click="handleCreate"> 新增</a-button> | ||
<a-button type="primary" @click="handleBatchDelete"> 批量删除</a-button> | ||
<a-button type="primary" @click="handleOnStatus(0)"> 批量启用</a-button> | ||
<a-button type="primary" @click="handleOnStatus(1)"> 批量禁用</a-button> | ||
</template> | ||
<template #bodyCell="{ column, record }"> | ||
<template v-if="column.key === 'action'"> | ||
<TableAction | ||
:actions="[ | ||
{ | ||
icon: 'clarity:note-edit-line', | ||
onClick: handleEdit.bind(null, record), | ||
}, | ||
{ | ||
icon: 'ant-design:delete-outlined', | ||
color: 'error', | ||
popConfirm: { | ||
title: '是否确认删除', | ||
placement: 'left', | ||
confirm: handleDelete.bind(null, record), | ||
}, | ||
}, | ||
]" | ||
/> | ||
</template> | ||
</template> | ||
</BasicTable> | ||
<OperatorModal @register="registerModal" @success="handleSuccess" /> | ||
</div> | ||
</template> | ||
<div> | ||
</div> | ||
|
||
<script lang="ts"> | ||
import {defineComponent} from "vue"; | ||
import {BasicTable, TableAction, useTable} from "@/components/Table"; | ||
import {useModal} from "@/components/Modal"; | ||
import {useMessage} from "@/hooks/web/useMessage"; | ||
import {columns, searchFormSchema} from "@/views/basic/operator/operator.data"; | ||
import {getOperatorList, deleteBatchOperator, updateOperatorStatus} from "@/api/basic/operator"; | ||
import OperatorModal from "@/views/basic/operator/components/OperatorModal.vue"; | ||
export default defineComponent({ | ||
name: 'financialAccount', | ||
components: {TableAction, BasicTable, OperatorModal }, | ||
setup() { | ||
const [registerModal, {openModal}] = useModal(); | ||
const { createMessage } = useMessage(); | ||
const [registerTable, { reload, getSelectRows }] = useTable({ | ||
title: '操作员/经办人列表', | ||
api: getOperatorList, | ||
rowKey: 'id', | ||
columns: columns, | ||
rowSelection: { | ||
type: 'checkbox', | ||
}, | ||
formConfig: { | ||
labelWidth: 110, | ||
schemas: searchFormSchema, | ||
autoSubmitOnEnter: true, | ||
}, | ||
useSearchForm: true, | ||
clickToRowSelect: false, | ||
bordered: true, | ||
showTableSetting: true, | ||
striped: true, | ||
showIndexColumn: true, | ||
actionColumn: { | ||
width: 80, | ||
title: '操作', | ||
dataIndex: 'action', | ||
fixed: undefined, | ||
}, | ||
}); | ||
async function handleCreate() { | ||
openModal(true, { | ||
isUpdate: false, | ||
}); | ||
} | ||
async function handleBatchDelete(record: Recordable) { | ||
const data = getSelectRows(); | ||
if (data.length === 0) { | ||
createMessage.warn('请选择一条数据'); | ||
return; | ||
} | ||
const ids = data.map((item) => item.id); | ||
const result = await deleteBatchOperator(ids) | ||
if (result.code === 'O0003') { | ||
await reload(); | ||
} | ||
} | ||
async function handleEdit(record: Recordable) { | ||
openModal(true, { | ||
record, | ||
isUpdate: true, | ||
}); | ||
} | ||
async function handleDelete(record: Recordable) { | ||
const result = await deleteBatchOperator([record.id]) | ||
if (result.code === 'O0003') { | ||
await reload(); | ||
} | ||
} | ||
async function handleSuccess() { | ||
reload(); | ||
} | ||
async function handleOnStatus(newStatus: number) { | ||
const data = getSelectRows(); | ||
if (data.length === 0) { | ||
createMessage.warn('请选择一条数据'); | ||
return; | ||
} | ||
const ids = data.map((item) => item.id); | ||
const result = await updateOperatorStatus(ids,newStatus ) | ||
if (result.code === 'O0004') { | ||
await reload(); | ||
} | ||
} | ||
async function handleCancel() { | ||
reload(); | ||
} | ||
return { | ||
registerTable, | ||
registerModal, | ||
handleCreate, | ||
handleDelete, | ||
handleBatchDelete, | ||
handleEdit, | ||
handleSuccess, | ||
handleOnStatus, | ||
handleCancel, | ||
} | ||
} | ||
}) | ||
</script> |
This file was deleted.
Oops, something went wrong.