自动费用模板 调整

feature-JimuReport-1106-yjl
张同海 3 weeks ago
parent 27aa6631f4
commit a6b03038d7

@ -10,7 +10,7 @@
<!-- 费用模版表单 -->
<BasicForm @register="registerForm" />
<!-- 费用字段表格 -->
<FeeField ref="feeField" v-show="!isBulk"></FeeField>
<FeeField ref="feeField" @success="handleSuccess" v-show="!isBulk"></FeeField>
<!--右下角按钮-->
<template #footer>
<a-button
@ -144,6 +144,26 @@
setModalProps({ loading: false })
},
)
async function handleSuccess() {
emit('success')
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
const UnitList = await feeUnitDict()
res.data.details.forEach((item) => {
UnitList.forEach((e: any) => {
if (e.value == item.unit) {
item.unitText = e.name
}
})
})
feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition
detailId.value = res.data.id
}
}
const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑'))
//
const feeField = ref()

@ -5,6 +5,8 @@ enum Api {
list = '/feeApi/FeeCustTemplate/GetList',
edit = '/feeApi/FeeCustTemplate/Edit',
bulkEdit = '/feeApi/FeeCustTemplate/BulkEdit',
bulkEditDetails = '/feeApi/FeeCustTemplate/BulkEditDetails',
info = '/feeApi/FeeCustTemplate/Edit',
delete = '/feeApi/FeeCustTemplate/Delete',
GetColumns = '/mainApi/Common/GetColumnsByClient',
@ -42,6 +44,14 @@ export function ApiBulkEdit(data: PageRequest) {
data,
})
}
// 批量编辑模板明细 (Auth)
export function ApiBulkEditDetails(data: PageRequest) {
return request<DataResult>({
url: Api.bulkEditDetails,
method: 'post',
data,
})
}
// 详情 (Auth)
export function ApiInfo(query) {
return request<DataResult>({

@ -13,10 +13,8 @@ import {
GetClientSourceSelectList,
GetClientSourceDetailSelectList,
} from '/@/views/operation/seaexport/api/BookingLedger'
// 往来单位下拉框数据
const companyDict = ref([])
import { useOptionsStore } from '/@/store/modules/options'
const optionsStore = useOptionsStore()
import { GetFeeCodeSelectList, GetFeeCurrencySelectList } from '/@/api/common'
import { feeUnitDict } from '/@/hooks/dict/index'
let businessType: any = [
{ value: 1, label: '海运出口' },
{ value: 2, label: '海运进口' },
@ -423,7 +421,7 @@ export const searchFormSchema: FormSchema[] = [
required: false,
dynamicDisabled: false,
colProps: { span: 4 },
componentProps: ({ formModel, formActionType }) => {
componentProps: () => {
return {
api: GetClientFrtSelectList,
allowClear: true,
@ -910,3 +908,269 @@ export const formSchema: FormSchema[] = [
},
},
]
export const detailsFormSchema: FormSchema[] = [
{
label: '费用名称Code',
field: 'feeCode',
component: 'Input',
defaultValue: '',
show: false,
},
{
label: '费用名称ID',
field: 'feeId',
component: 'Input',
defaultValue: '',
show: false,
},
{
field: 'feeName',
label: '费用名称',
component: 'ApiSelect',
required: false,
dynamicDisabled: false,
defaultValue: null,
colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
api: GetFeeCodeSelectList,
allowClear: true,
showSearch: true,
labelField: 'name',
valueField: 'name',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
console.log(e, obj)
if (e && obj) {
formModel.feeName = obj.label
formModel.feeCode = obj.code
formModel.feeId = obj.id
formModel.unit = obj.defaultUnit
formModel.unitText = obj.defaultUnitName
formModel.currency = obj.defaultCurrency
if (formModel.currency == 'RMB') {
formModel.exchangeRate = 1
} else {
formModel.exchangeRate = ''
}
formModel.taxRate = obj.taxRate
formModel.isInvoice = obj.isInvoice
formModel.isAdvancedPay = obj.isAdvancedPay
}
if (!e && !obj) {
formModel.feeName = ''
formModel.feeCode = ''
formModel.feeId = ''
formModel.unit = ''
formModel.unitText = ''
formModel.currency = ''
formModel.exchangeRate = ''
formModel.taxRate = ''
formModel.isInvoice = ''
formModel.isAdvancedPay = ''
}
},
}
},
},
{
label: '客户类别',
field: 'customerType',
component: 'Input',
defaultValue: '',
show: false,
},
{
field: 'customerTypeText',
label: '客户类别',
component: 'ApiSelect',
required: false,
dynamicDisabled: false,
defaultValue: null,
colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
api: () => {
return new Promise((resolve) => {
getDictOption('djy_cust_prop').then((res) => {
resolve(res)
})
})
},
allowClear: true,
showSearch: true,
labelField: 'label',
valueField: 'value',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
console.log(e, obj)
if (e && obj) {
formModel.customerTypeText = obj.label
formModel.customerType = obj.value
}
if (!e && !obj) {
formModel.customerTypeText = ''
formModel.customerType = ''
}
},
}
},
},
{
label: '单位标准',
field: 'unit',
component: 'Input',
defaultValue: '',
show: false,
},
{
field: 'unitText',
label: '单位标准',
component: 'ApiSelect',
required: false,
dynamicDisabled: false,
defaultValue: null,
colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
api: feeUnitDict,
allowClear: true,
showSearch: true,
labelField: 'label',
valueField: 'value',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
console.log(e, obj)
if (e && obj) {
formModel.unitText = obj.label
formModel.unit = obj.value
}
if (!e && !obj) {
formModel.unitText = ''
formModel.unit = ''
}
},
}
},
},
{
field: 'isCtn',
label: '是否箱型',
component: 'Switch',
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
defaultValue: false,
colProps: {
span: 6,
},
},
{
field: 'currency',
label: '币别',
component: 'ApiSelect',
required: false,
dynamicDisabled: false,
defaultValue: null,
colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
api: GetFeeCurrencySelectList,
allowClear: true,
showSearch: true,
labelField: 'codeName',
valueField: 'codeName',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e) => {
if (e == 'RMB') {
formModel.exchangeRate = 1
} else {
formModel.exchangeRate = ''
}
},
}
},
},
{
field: 'unitPrice',
label: '单价',
component: 'InputNumber',
colProps: { span: 4 },
},
{
field: 'exchangeRate',
label: '汇率',
component: 'InputNumber',
colProps: { span: 4 },
},
{
field: 'taxRate',
label: '税率',
component: 'InputNumber',
colProps: { span: 4 },
},
{
field: 'accTaxRate',
label: '财务税率',
component: 'InputNumber',
colProps: { span: 4 },
},
{
field: 'tax',
label: '税额',
component: 'InputNumber',
colProps: { span: 4 },
},
{
field: 'taxUnitPrice',
label: '含税单价',
component: 'InputNumber',
colProps: { span: 4 },
},
{
field: 'isInvoice',
label: '是否开票',
component: 'Switch',
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
defaultValue: false,
colProps: {
span: 6,
},
},
{
field: 'isAdvancedPay',
label: '是否垫付',
component: 'Switch',
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
defaultValue: false,
colProps: {
span: 6,
},
},
]

@ -11,6 +11,10 @@
<span class="iconfont icon-new_document"></span>
添加
</a-button>
<a-button type="link" @click="BulkEdit">
<span class="iconfont icon-dengjizongshu"></span>
批量编辑
</a-button>
<a-popconfirm
title="确定删除当前选中数据?"
ok-text="是"
@ -40,6 +44,16 @@
:IsApi="false"
:IsApiData="Rcondition"
/>
<a-modal
class="ds-fee-to-tem-modal"
v-model:visible="visible"
v-if="visible"
title="批量编辑费用明细"
width="80%"
@ok="handleOk"
>
<BasicForm @register="registerForm" />
</a-modal>
</div>
</template>
<script lang="ts" setup>
@ -56,16 +70,18 @@
} from 'vue'
//
import { GetFeeCodeSelectList, GetFeeCurrencySelectList } from '/@/api/common'
import { getColumns, DeleteDetails } from './api'
import { getColumns, DeleteDetails, ApiBulkEditDetails } from './api'
// import { GetFeeTemplateDetailList, BatchDelFeeTemplateDetail } from '../api'
//
import { feeUnitDict } from '/@/hooks/dict/index'
//
import { getDictOption } from '/@/utils/dictUtil'
import AdvancedSearch from '/@/components/Form/src/components/AdvancedSearch.vue'
import { BasicForm, useForm } from '/@/components/Form/index'
import { useMessage } from '/@/hooks/web/useMessage'
import { HotTable, HotColumn } from '@handsontable/vue3'
import { registerAllModules } from 'handsontable/registry'
import { detailsFormSchema } from './columns'
import 'handsontable/dist/handsontable.full.min.css'
defineComponent({
HotTable,
@ -234,7 +250,48 @@
hot.selectCell(list.value.length - 1, 1)
})
}
const visible = ref(false)
function BulkEdit() {
const ids = []
list.value.forEach((item: any, index) => {
if (item.selected) {
ids.push(item.id)
}
})
if (ids.length) {
visible.value = true
} else {
notification.warning({ message: '请至少选择一条数据', duration: 3 })
}
}
const emit = defineEmits(['success'])
//
const handleOk = async () => {
let ApiData: any = []
const formData = await modalValidate()
list.value.forEach((item: any) => {
if (item.selected) {
ApiData.push({ ...formData, id: item.id, templateId: item.templateId })
}
})
const res = await ApiBulkEditDetails(ApiData)
if (res.succeeded) {
createMessage.success(res.message)
visible.value = false
emit('success')
} else {
createMessage.error(res.message)
}
}
//
const [
registerForm,
{ validate: modalValidate, resetFields, setFieldsValue, getFieldsValue, updateSchema },
] = useForm({
labelWidth: 100,
schemas: detailsFormSchema,
showActionButtonGroup: false,
})
//
const columns = [
{

@ -3,6 +3,8 @@ import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/feeApi/FeeCustTemplate/GetList',
listView = '/feeApi/FeeCustTemplate/GetListView',
edit = '/feeApi/FeeCustTemplate/Edit',
bulkEdit = '/feeApi/FeeCustTemplate/BulkEdit',
bulkEditDetails = '/feeApi/FeeCustTemplate/BulkEditDetails',
@ -20,6 +22,14 @@ export function getColumns(query: { id: string }) {
params: query,
})
}
// 视图列表 (Auth)
export function ApiListView(data: PageRequest) {
return request<DataResult>({
url: Api.listView,
method: 'post',
data,
})
}
// 列表 (Auth)
export function ApiList(data: PageRequest) {
return request<DataResult>({

@ -214,7 +214,141 @@ export const columns: BasicColumn[] = [
width: 200,
},
]
export const viewColumns: BasicColumn[] = [
{
title: '模板名称',
dataIndex: 'templateName',
width: 200,
},
{
title: '费用名称',
dataIndex: 'feeName',
width: 100,
},
{
title: '20GP',
dataIndex: 'unit20GP',
width: 100,
},
{
title: '40GP',
dataIndex: 'unit40GP',
width: 100,
},
{
title: '40HC',
dataIndex: 'unit40HC',
width: 100,
},
{
title: '单票',
dataIndex: 'unitP',
width: 100,
},
{
title: '业务类型',
dataIndex: 'businessTypeText',
width: 120,
},
{
title: '客户名称',
dataIndex: 'customerName',
width: 200,
},
{
title: '费用类型',
dataIndex: 'feeTypeText',
width: 120,
},
{
title: '费用类别',
dataIndex: 'feeCategoryName',
width: 200,
},
{
title: '起运港',
dataIndex: 'polCode',
width: 200,
},
{
title: '卸货港',
dataIndex: 'podCode',
width: 200,
},
{
dataIndex: 'laneName',
title: '航线',
sorter: true,
width: 200,
},
{
dataIndex: 'sourceName',
title: '业务来源',
sorter: true,
width: 200,
},
{
dataIndex: 'carrierName',
title: '船公司',
sorter: true,
width: 200,
},
{
dataIndex: 'forwarderName',
title: '订舱口',
sorter: true,
width: 200,
},
{
dataIndex: 'mblFrtCode',
title: '付费方式',
sorter: true,
width: 200,
customRender: ({ record }) => {
let name = ''
mblFrtCodeList.value.some((item: any) => {
if (record.mblFrtCode == item.ediCode) {
name = item.frtName
return true
}
})
return name
},
},
{
title: '是否停用',
dataIndex: 'isDisabled',
width: 120,
customRender: ({ text }) => {
if (text === false) {
return <Tag color="success"></Tag>
} else if (text == true) {
return <Tag color="error"></Tag>
}
return text
},
},
{
title: '开始时间',
dataIndex: 'startTime',
width: 200,
},
{
title: '结束时间',
dataIndex: 'endTime',
width: 200,
},
{
title: '优先等级',
dataIndex: 'priority',
width: 120,
},
{
title: '录入日期',
dataIndex: 'createTime',
width: 200,
},
]
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
@ -453,26 +587,6 @@ export const searchFormSchema: FormSchema[] = [
span: 4,
},
},
// {
// field: 'startTime',
// label: '开始时间',
// component: 'DatePicker',
// colProps: { span: 4 },
// defaultValue: '',
// componentProps: {
// showTime: false,
// },
// },
// {
// field: 'endTime',
// label: '结束时间',
// component: 'DatePicker',
// colProps: { span: 4 },
// defaultValue: '',
// componentProps: {
// showTime: false,
// },
// },
{
field: 'isDisabled',
label: '是否停用',
@ -964,7 +1078,7 @@ export const detailsFormSchema: FormSchema[] = [
if (formModel.currency == 'RMB') {
formModel.exchangeRate = 1
} else {
formModel.exchangeRate = '【根据设置汇率生成】'
formModel.exchangeRate = ' '
}
formModel.taxRate = obj.taxRate
formModel.isInvoice = obj.isInvoice
@ -1110,7 +1224,7 @@ export const detailsFormSchema: FormSchema[] = [
if (e == 'RMB') {
formModel.exchangeRate = 1
} else {
formModel.exchangeRate = '【根据设置汇率生成】'
formModel.exchangeRate = ' '
}
},
}

@ -2,6 +2,10 @@
<div>
<BasicTable class="ds-table" @register="registerTable" @row-dbClick="handleAudit">
<template #tableTitle>
<div class="ShowView">
<a-switch @change="ChangeView" v-model:checked="ShowView" />
<span class="ShowViewText">按费用显示</span>
</div>
<a-button type="link" @click="handleCreate">
<span class="iconfont icon-new_document"></span>
添加
@ -54,10 +58,10 @@
<script lang="ts" setup>
import { defineComponent, onMounted, ref } from 'vue'
import { BasicTable, useTable, TableAction, SorterResult } from '/@/components/Table'
import { ApiList, ApiDel } from './api'
import { ApiList, ApiListView, ApiDel } from './api'
import { useModal } from '/@/components/Modal'
import TenantAuditStepModal from './TenantAuditStepModal.vue'
import { columns, searchFormSchema } from './columns'
import { columns, viewColumns, searchFormSchema } from './columns'
import { formatParams } from '/@/hooks/web/common'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
@ -66,10 +70,16 @@
customerName: { type: String },
})
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload, getSelectRows, getForm, getPaginationRef }] = useTable({
const ShowView = ref(false)
const [registerTable, { reload, getSelectRows, setProps, getForm, getPaginationRef }] = useTable({
title: '',
api: async (p) => {
const res: API.DataResult = await ApiList(p)
let res: any = null
if (ShowView.value) {
res = await ApiListView(p)
} else {
res = await ApiList(p)
}
return new Promise((resolve) => {
resolve({ data: [...res.data], total: res.count })
})
@ -79,7 +89,7 @@
p['customerId'] = props.clientId
return formatParams(p, ['isShared', 'isDisabled'])
},
columns,
columns: columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
@ -104,6 +114,14 @@
fixed: 'right',
},
})
function ChangeView(e) {
if (e) {
setProps({ columns: viewColumns })
} else {
setProps({ columns: columns })
}
reload()
}
function handleCreate() {
openModal(true, {
customerId: props.clientId,
@ -157,7 +175,6 @@
}
ApiDel(ApiData).then((res) => {
console.log(res)
notification.success({ message: res.message, duration: 3 })
reload()
})
@ -167,6 +184,14 @@
}
</script>
<style lang="less" scoped>
.ShowView {
margin-left: 15px;
.ShowViewText {
font-size: 12px;
margin-left: 5px;
}
}
.ds-table-detail {
margin-top: -16px;
.title {

Loading…
Cancel
Save