费用页面
parent
f30635dc23
commit
323c446ff1
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* @Description: 费用管理 -> 币别设置接口
|
||||
* @Author: lijj
|
||||
* @Date: 2024-04-25 15:48:33
|
||||
*/
|
||||
|
||||
import { request } from '/@/utils/request'
|
||||
import { DataResult, PageRequest } from '/@/api/model/baseModel'
|
||||
enum Api {
|
||||
list = '/feeApi/FeeCurrency/GetFeeCurrencyList',
|
||||
edit = '/feeApi/FeeCurrency/EditFeeCurrency',
|
||||
info = '/feeApi/FeeCurrency/GetFeeCurrencyInfo'
|
||||
}
|
||||
// 列表 (Auth)
|
||||
export function getFeeCurrencyList(data: PageRequest) {
|
||||
return request<DataResult>({
|
||||
url: Api.list,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 编辑 (Auth)
|
||||
export function editFeeCurrency(data: PageRequest) {
|
||||
return request<DataResult>({
|
||||
url: Api.edit,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 详情 (Auth)
|
||||
export function getFeeCurrencyInfo(query) {
|
||||
return request<DataResult>({
|
||||
url: Api.info,
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* @Description: 币别设置tsx
|
||||
* @Author: lijj
|
||||
* @Date: 2024-04-25 15:48:33
|
||||
*/
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table'
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '币别代码',
|
||||
dataIndex: 'codeName',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '英文名称',
|
||||
dataIndex: 'name',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '中文描述名称',
|
||||
dataIndex: 'description',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '对人民币汇率',
|
||||
dataIndex: 'defaultRate',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '财务软件代码',
|
||||
dataIndex: 'financeSoftCode',
|
||||
width: 200
|
||||
}
|
||||
]
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'codeName',
|
||||
label: '币别代码',
|
||||
component: 'Input',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
]
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
defaultValue: '',
|
||||
show: false
|
||||
},
|
||||
{
|
||||
field: 'codeName',
|
||||
label: '币别代码',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 }
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
label: '英文名称',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 }
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
label: '中文描述名称',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
field: 'defaultRate',
|
||||
label: '对人民币汇率',
|
||||
component: 'Input',
|
||||
colProps: { span: 12 }
|
||||
},
|
||||
{
|
||||
field: 'financeSoftCode',
|
||||
label: '财务软件代码',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
colProps: { span: 12 }
|
||||
}
|
||||
]
|
@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:use-wrapper="true"
|
||||
:title="getTitle"
|
||||
:form-schema="formSchema"
|
||||
width="50%"
|
||||
@register="registerModal"
|
||||
@ok="handleSave"
|
||||
>
|
||||
<!-- 币别表单 -->
|
||||
<BasicForm @register="registerForm" />
|
||||
<!--右下角按钮-->
|
||||
<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>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref } from 'vue'
|
||||
// 弹窗组件
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
// 币别字段数据
|
||||
import { formSchema } from '../columns'
|
||||
// 币别相关接口
|
||||
import { editFeeCurrency, getFeeCurrencyInfo } from '../api'
|
||||
// 提升消息混入
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
// 按钮loading
|
||||
const loading = ref(false)
|
||||
const rowId = ref('')
|
||||
const { createMessage } = useMessage()
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] =
|
||||
useForm({
|
||||
labelWidth: 100,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false, loading: true })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
setModalProps({ confirmLoading: true });
|
||||
updateFormField(updateSchema)
|
||||
rowId.value = data.record.id
|
||||
const res: API.DataResult = await getFeeCurrencyInfo({ id: unref(rowId) })
|
||||
if (res.succeeded) {
|
||||
setFieldsValue({
|
||||
...res.data,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
setFieldsValue({ permissionIdentity: unref(2) })
|
||||
}
|
||||
setModalProps({ loading: false })
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增币别' : '编辑币别'))
|
||||
|
||||
async function handleSave(exit) {
|
||||
try {
|
||||
const values = await validate()
|
||||
loading.value = true
|
||||
setModalProps({ confirmLoading: true, loading: true })
|
||||
const res: API.DataResult = await editFeeCurrency(values)
|
||||
loading.value = false
|
||||
if (res.succeeded) {
|
||||
createMessage.success(res.message)
|
||||
emit('success')
|
||||
} else {
|
||||
createMessage.error(res.message)
|
||||
}
|
||||
exit && closeModal()
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false, loading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" @click="handleCreate"> 新建币别 </a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'userName'">
|
||||
<span style="color: #0d84ff" @click="handleEdit(record)">{{ record.userName }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
icon: 'clarity:note-edit-line',
|
||||
tooltip: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<Modal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
||||
import { getFeeCurrencyList } from './api'
|
||||
import { useModal } from '/@/components/Modal'
|
||||
import Modal from './components/Modal.vue'
|
||||
import { columns, searchFormSchema } from './columns'
|
||||
const [registerModal, { openModal }] = useModal()
|
||||
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
|
||||
title: '币别设置',
|
||||
// api: getSysDictTypeList,
|
||||
api: async (p) => {
|
||||
const res: API.DataResult = await getFeeCurrencyList(p)
|
||||
// console.log(items);
|
||||
return new Promise((resolve) => {
|
||||
resolve({ data: [...res.data], total: res.count })
|
||||
})
|
||||
},
|
||||
beforeFetch: () => {
|
||||
var currentPageInfo: any = getPaginationRef()
|
||||
var data = getForm().getFieldsValue()
|
||||
const postParam: API.PageRequest = {
|
||||
queryCondition: '',
|
||||
pageCondition: {
|
||||
pageIndex: currentPageInfo.current,
|
||||
pageSize: currentPageInfo.pageSize,
|
||||
sortConditions: [],
|
||||
},
|
||||
}
|
||||
let condition: API.ConditionItem[] = []
|
||||
if (!!data.UserName) {
|
||||
condition.push({
|
||||
FieldName: 'UserName',
|
||||
FieldValue: data.UserName,
|
||||
ConditionalType: 1,
|
||||
})
|
||||
}
|
||||
if (!!data.UserCode) {
|
||||
condition.push({
|
||||
FieldName: 'UserCode',
|
||||
FieldValue: data.UserCode,
|
||||
ConditionalType: 1,
|
||||
})
|
||||
}
|
||||
postParam.queryCondition = JSON.stringify(condition)
|
||||
// console.log(postParam);
|
||||
return postParam
|
||||
},
|
||||
columns,
|
||||
formConfig: {
|
||||
labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
},
|
||||
isTreeTable: false,
|
||||
pagination: true,
|
||||
striped: true,
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
bordered: true,
|
||||
showIndexColumn: true,
|
||||
canResize: false,
|
||||
actionColumn: {
|
||||
width: 80,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
},
|
||||
})
|
||||
|
||||
function handleCreate() {
|
||||
openModal(true, {
|
||||
isParent: false,
|
||||
isUpdate: false,
|
||||
})
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
//初始化字典选项
|
||||
})
|
||||
function handleSuccess() {
|
||||
reload()
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue