详情路由设置

szh-new
lijingjia 7 months ago
parent 1e44b8669c
commit d7d1bf7be9

@ -140,6 +140,11 @@
function renderMenu() { function renderMenu() {
const { menus, ...menuProps } = unref(getCommonProps) const { menus, ...menuProps } = unref(getCommonProps)
menus.forEach(res => {
res?.children?.forEach(item => {
item.children = null
})
})
// console.log(menus); // console.log(menus);
if (!menus || !menus.length) return null if (!menus || !menus.length) return null
return !props.isHorizontal ? ( return !props.isHorizontal ? (

@ -1,3 +1,8 @@
/*
* @Description:
* @Author: lijj
* @Date: 2024-04-15 17:08:08
*/
import type { RouteRecordRaw } from 'vue-router' import type { RouteRecordRaw } from 'vue-router'
import type { App } from 'vue' import type { App } from 'vue'

@ -54,6 +54,7 @@ const staticMenus: Menu[] = []
async function getAsyncMenus() { async function getAsyncMenus() {
const permissionStore = usePermissionStore() const permissionStore = usePermissionStore()
if (isBackMode()) { if (isBackMode()) {
// 设置后台路由到路由表
return permissionStore.getBackMenuList.filter((item) => !item.meta?.hideMenu && !item.hideMenu) return permissionStore.getBackMenuList.filter((item) => !item.meta?.hideMenu && !item.hideMenu)
} }
if (isRouteMappingMode()) { if (isRouteMappingMode()) {

@ -0,0 +1,11 @@
export const detailRouters = [
{
path: '/BookingDetail',
name: '海运出口详情',
meta: {
title: '海运出口详情',
},
parent: '操作管理',
component: () => import('/@/views/operation/seaexport/detail/index.vue')
}
]

@ -231,39 +231,8 @@ export const usePermissionStore = defineStore({
await this.changePermissionCode() await this.changePermissionCode()
// routeList = (await getMenuList()) as AppRouteRecordRaw[] // routeList = (await getMenuList()) as AppRouteRecordRaw[]
const res = await getMenuList() const res = await getMenuList()
console.log('后台返回路由', res, res.data[0].children)
// -------------------ZTH------------------------
res.data[0].children.push(
// {
// "id": "1288018625843826606",
// "parentId": "1288018625843826601",
// "path": "/BookingLedger",
// "name": "嗨嗨",
// "component": "operation/seaexport/list/index",
// "meta": {
// "title": "嗨嗨",
// "icon": "ant-design:ant-design-outlined"
// },
// "sortCode": 0
// },
{
id: '12880186258438266061',
parentId: '12880186258438266011',
path: '/BookingDetail',
name: '嗨嗨嗨',
component: 'operation/seaexport/detail/index',
meta: {
title: '嗨嗨嗨',
icon: 'ant-design:ant-design-outlined',
},
sortCode: 0,
},
)
// ----------------------------------------------
routeList = res.data as AppRouteRecordRaw[] routeList = res.data as AppRouteRecordRaw[]
this.setWrouteList(routeList) this.setWrouteList(routeList)
// console.log('后台返回路由1', routeList)
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }

@ -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/FeeCustTemplateDetail/GetFeeCustTemplateDetailList',
edit = '/feeApi/FeeCurrency/EditFeeCurrency',
info = '/feeApi/FeeCurrency/GetFeeCurrencyInfo'
}
// 列表 (Auth)
export function getFeeCustTemplateDetailList(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,126 @@
/*
* @Description: tsx
* @Author: lijj
* @Date: 2024-04-25 15:48:33
*/
import { BasicColumn, FormSchema } from '/@/components/Table'
export const columns: BasicColumn[] = [
{
title: '费用名称',
dataIndex: 'feeName',
width: 150
},
{
title: '往来单位',
dataIndex: 'customerName',
width: 200
},
{
title: '标准',
dataIndex: 'unit',
width: 150
},
{
title: '币别',
dataIndex: 'currency',
width: 150
},
{
title: '单价',
dataIndex: 'unitPrice',
width: 120
},
{
title: '汇率',
dataIndex: 'exchangeRate',
width: 150
},
{
title: '税率',
dataIndex: 'taxRate',
width: 150
},
{
title: '发票税率',
dataIndex: 'accTaxRate',
width: 150
},
{
title: 'FRT',
dataIndex: 'feeFrt',
width: 150
},
{
title: '垫付',
dataIndex: 'isAdvancedPay',
width: 150
},
{
title: '不开发票',
dataIndex: 'isInvoice',
width: 150
},
{
title: '备注',
dataIndex: 'remark',
width: 150
}
]
export const searchFormSchema: FormSchema[] = [
{
field: 'feeName',
label: '费用名称',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'customerName',
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,121 @@
<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 { defineComponent, onMounted, ref } from 'vue'
import { BasicTable, useTable, TableAction } from '/@/components/Table'
import { getFeeCustTemplateDetailList } from './api'
import { useModal } from '/@/components/Modal'
import Modal from './components/Modal.vue'
import { columns, searchFormSchema } from './columns'
const dictOptions = ref<any[]>([])
const [registerModal, { openModal }] = useModal()
const [registerPermissionModal, { openModal: openPermissionModal }] = useModal()
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '币别设置',
// api: getSysDictTypeList,
api: async (p) => {
const res: API.DataResult = await getFeeCustTemplateDetailList(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,
})
}
function handleDelete(record: Recordable) {
console.log(record)
}
onMounted(() => {
//
})
function handleSuccess() {
reload()
}
</script>
Loading…
Cancel
Save