Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
update name wallah -> operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Jzow committed Oct 16, 2023
1 parent dda4ce4 commit 42c2181
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 7 deletions.
147 changes: 147 additions & 0 deletions src/views/basic/operator/index.vue
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>
7 changes: 0 additions & 7 deletions src/views/basic/wallah/index.vue

This file was deleted.

0 comments on commit 42c2181

Please sign in to comment.