|
|
|
@ -2,37 +2,115 @@
|
|
|
|
|
<BasicModal
|
|
|
|
|
v-bind="$attrs"
|
|
|
|
|
:use-wrapper="true"
|
|
|
|
|
:title="getTitle"
|
|
|
|
|
width="60%"
|
|
|
|
|
@register="registerModal"
|
|
|
|
|
@ok="handleSave"
|
|
|
|
|
>
|
|
|
|
|
<BasicForm @register="registerForm" />
|
|
|
|
|
<a-tabs v-model:activeKey="activeKey">
|
|
|
|
|
<a-tab-pane key="0" tab="用户基本信息">
|
|
|
|
|
<BasicForm @register="registerForm">
|
|
|
|
|
<template #sex="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.sex"
|
|
|
|
|
:class="{'woman': model.sex == 2}"
|
|
|
|
|
:checkedValue="1"
|
|
|
|
|
:unCheckedValue="2"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.sex == 1, 'w-active': model.sex == 2 }">{{ model.sex == 1 ? '男' : '女'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #userType="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.userType"
|
|
|
|
|
:class="{'p-normal': model.userType == 2}"
|
|
|
|
|
:checkedValue="1"
|
|
|
|
|
:unCheckedValue="2"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.userType == 1, 'p-active': model.userType == 2 }">{{ model.userType == 1 ? '管理员' : '普通用户'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isOperator="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isOperator"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isOperator }">{{ model.isOperator ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isVouchingClerk="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isVouchingClerk"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isVouchingClerk }">{{ model.isVouchingClerk ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isSale="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isSale"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isSale }">{{ model.isSale ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isCustom="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isCustom"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isCustom }">{{ model.isCustom ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isFinancialStaff="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isFinancialStaff"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isFinancialStaff }">{{ model.isFinancialStaff ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isCustomerService="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isDispatcher"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isCustomerService }">{{ model.isCustomerService ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isDriver="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isDriver"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isDriver }">{{ model.isDriver ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #isDispatcher="{ model }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="model.isDispatcher"
|
|
|
|
|
/>
|
|
|
|
|
<span class="s-txt" :class="{ 's-active': model.isDispatcher }">{{ model.isDispatcher ? '是' : '否'}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicForm>
|
|
|
|
|
</a-tab-pane>
|
|
|
|
|
<a-tab-pane key="1" tab="个人开户信息">
|
|
|
|
|
<BasicTable @register="registerTable" @row-dbClick="EditRow">
|
|
|
|
|
<template #tableTitle>
|
|
|
|
|
<a-button type="link" @click="addboxLine">
|
|
|
|
|
<span class="iconfont icon-new_document"></span>
|
|
|
|
|
添加
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-popconfirm
|
|
|
|
|
title="确定删除当前选中数据?"
|
|
|
|
|
ok-text="是"
|
|
|
|
|
cancel-text="否"
|
|
|
|
|
@confirm="handleDel"
|
|
|
|
|
>
|
|
|
|
|
<a-button type="link">
|
|
|
|
|
<span class="iconfont icon-shanchu21"></span>
|
|
|
|
|
删除
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-popconfirm>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicTable>
|
|
|
|
|
</a-tab-pane>
|
|
|
|
|
</a-tabs>
|
|
|
|
|
<!--右下角按钮-->
|
|
|
|
|
<template #footer>
|
|
|
|
|
<a-button
|
|
|
|
|
pre-icon="ant-design:close-outlined"
|
|
|
|
|
type="warning"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
ghost
|
|
|
|
|
style="margin-right: 0.8rem"
|
|
|
|
|
@click="closeModal"
|
|
|
|
|
>取消</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-button
|
|
|
|
|
type="success"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
pre-icon="ant-design:check-outlined"
|
|
|
|
|
style="margin-right: 0.8rem"
|
|
|
|
|
@click="handleSave(false)"
|
|
|
|
|
>仅保存</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-button
|
|
|
|
|
pre-icon="ant-design:check-circle-outlined"
|
|
|
|
|
type="primary"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
@click="handleSave(true)"
|
|
|
|
|
>保存并关闭</a-button
|
|
|
|
|
>保存</a-button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicModal>
|
|
|
|
@ -42,9 +120,10 @@
|
|
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal'
|
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
|
import { formSchema } from './columns'
|
|
|
|
|
|
|
|
|
|
import { Tablecolumns } from '/@/views/baseinfo/infoclient/columns'
|
|
|
|
|
import { editUser, getUser } from '/@/api/system/user'
|
|
|
|
|
import { useUserStore } from '/@/store/modules/user'
|
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
// 声明Emits
|
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
@ -52,66 +131,71 @@
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const rowId = ref('')
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
const activeKey = ref('0')
|
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema, getFieldsValue }] =
|
|
|
|
|
useForm({
|
|
|
|
|
labelWidth: 100,
|
|
|
|
|
schemas: formSchema,
|
|
|
|
|
showActionButtonGroup: false,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
|
|
|
resetFields()
|
|
|
|
|
setModalProps({ confirmLoading: false, loading: true })
|
|
|
|
|
isUpdate.value = !!data?.isUpdate
|
|
|
|
|
if (unref(isUpdate)) {
|
|
|
|
|
// setModalProps({ confirmLoading: true });
|
|
|
|
|
setModalProps({ confirmLoading: true });
|
|
|
|
|
rowId.value = data.record.id
|
|
|
|
|
const res: API.DataResult = await getUser({ id: unref(rowId) })
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
...res.data,
|
|
|
|
|
})
|
|
|
|
|
// console.log('返回数据Form', getFieldsValue());
|
|
|
|
|
// setFieldsValue({ trainId: unref(res.data.trainId) });
|
|
|
|
|
}
|
|
|
|
|
// setModalProps({ confirmLoading: false });
|
|
|
|
|
setModalProps({ confirmLoading: false });
|
|
|
|
|
} else {
|
|
|
|
|
setFieldsValue({ permissionIdentity: unref(2) })
|
|
|
|
|
}
|
|
|
|
|
setModalProps({ loading: false })
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增用户' : '编辑用户'))
|
|
|
|
|
|
|
|
|
|
async function handleSave(exit) {
|
|
|
|
|
try {
|
|
|
|
|
const values = await validate()
|
|
|
|
|
console.log(values)
|
|
|
|
|
setModalProps({ confirmLoading: true, loading: true })
|
|
|
|
|
// TODO custom api
|
|
|
|
|
// values.roleIds = values.roleIds.join(',')
|
|
|
|
|
// values.orgIds = values.orgIds.join(',')
|
|
|
|
|
const res: API.DataResult = await editUser(values)
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
createMessage.success(res.message)
|
|
|
|
|
emit('success')
|
|
|
|
|
//刷新页面
|
|
|
|
|
if (!exit) {
|
|
|
|
|
if (unref(isUpdate)) {
|
|
|
|
|
await refresh()
|
|
|
|
|
} else {
|
|
|
|
|
rowId.value = res.data
|
|
|
|
|
isUpdate.value = true
|
|
|
|
|
await refresh()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exit && closeModal()
|
|
|
|
|
} finally {
|
|
|
|
|
// loading.value = false;
|
|
|
|
|
setModalProps({ confirmLoading: false, loading: false })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 添加行
|
|
|
|
|
function addboxLine() {
|
|
|
|
|
const data = {
|
|
|
|
|
rowKey: dataSource.value.length
|
|
|
|
|
? dataSource.value[dataSource.value.length - 1].rowKey + 1
|
|
|
|
|
: 1,
|
|
|
|
|
}
|
|
|
|
|
setTableData([...getDataSource(), data])
|
|
|
|
|
}
|
|
|
|
|
const dataSource = ref<any>([])
|
|
|
|
|
// 创建银行信息列表
|
|
|
|
|
const [registerTable, { getDataSource, setTableData }] = useTable({
|
|
|
|
|
pagination: false,
|
|
|
|
|
columns: Tablecolumns,
|
|
|
|
|
dataSource: dataSource.value,
|
|
|
|
|
// showTableSetting: true,
|
|
|
|
|
// tableSetting: { fullScreen: false, redo: false, size: false },
|
|
|
|
|
rowKey: 'rowKey',
|
|
|
|
|
bordered: true,
|
|
|
|
|
autoCreateKey: false,
|
|
|
|
|
showIndexColumn: true,
|
|
|
|
|
})
|
|
|
|
|
async function refresh() {
|
|
|
|
|
const res: API.DataResult = await getUser({ id: unref(rowId) })
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
@ -121,3 +205,39 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.s-txt {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
color: #7A8798;
|
|
|
|
|
position: relative;
|
|
|
|
|
top: 1px;
|
|
|
|
|
}
|
|
|
|
|
.woman {
|
|
|
|
|
background: #BA3849;
|
|
|
|
|
}
|
|
|
|
|
.s-active {
|
|
|
|
|
color: #257AFA;
|
|
|
|
|
}
|
|
|
|
|
.w-active {
|
|
|
|
|
color: #BA3849;
|
|
|
|
|
}
|
|
|
|
|
.p-normal {
|
|
|
|
|
background: #17A6A3;
|
|
|
|
|
}
|
|
|
|
|
.p-active {
|
|
|
|
|
color: #17A6A3;
|
|
|
|
|
}
|
|
|
|
|
/deep/ .ant-divider {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
margin: 16px 0 8px -19px;
|
|
|
|
|
}
|
|
|
|
|
/deep/ .ant-divider-horizontal.ant-divider-with-text-left::before {
|
|
|
|
|
width: 0;
|
|
|
|
|
}
|
|
|
|
|
/deep/ .ant-divider-horizontal.ant-divider-with-text-left::after {
|
|
|
|
|
width: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|