自动费用模板

szh-new
张同海 2 months ago
parent 187c29d233
commit 4f82231b2d

@ -55,6 +55,8 @@
import { ApiEdit, ApiInfo } from './api'
//
import { useMessage } from '/@/hooks/web/useMessage'
import { useUserStore } from '/@/store/modules/user'
const userStore = useUserStore()
const props = defineProps({
customerName: { type: String },
customerId: { type: String },
@ -62,6 +64,7 @@
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const isCopy = ref(false)
const detailId = ref()
// loading
const loading = ref(false)
@ -78,6 +81,7 @@
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
isCopy.value = !!data?.isCopy
if (unref(isUpdate)) {
setModalProps({ confirmLoading: true })
rowId.value = data.record.id
@ -91,13 +95,31 @@
detailId.value = res.data.id
}
} else {
detailId.value = ''
setFieldsValue({
customerName: props.customerName,
customerId: props.customerId,
})
feeField.value.SetData([])
feeField.value.condition = ''
if (isCopy.value) {
setModalProps({ confirmLoading: true })
const res: API.DataResult = await ApiInfo({ id: unref(data.record.id) })
if (res.succeeded) {
setFieldsValue({
...res.data,
id: '',
})
res.data.details.forEach((item) => {
delete item.id
})
feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition
// detailId.value = res.data.id
}
} else {
detailId.value = ''
setFieldsValue({
customerName: props.customerName,
customerId: props.customerId,
saleOrgId: userStore.getUserInfo.userOrgs[0].orgId,
})
feeField.value.SetData([])
feeField.value.condition = ''
}
}
setModalProps({ loading: false })
},

@ -3,8 +3,8 @@ import { BasicColumn, FormSchema } from '/@/components/Table'
import { Tag } from 'ant-design-vue'
// 引入字典数据
import { getDictOption } from '/@/utils/dictUtil'
// 下拉框数据接口
import { GetClientListByCode } from '/@/api/common'
import { getOrgList } from '/@/api/common'
// 往来单位下拉框数据
const companyDict = ref([])
let businessType: any = [
@ -32,10 +32,10 @@ export const columns: BasicColumn[] = [
dataIndex: 'feeCategory',
width: 120,
customRender: ({ text }) => {
if (text == 1) {
return '收'
} else if (text == 2) {
return '付'
if (text == '1') {
return '收'
} else if (text == '2') {
return '付'
}
return text
},
@ -99,8 +99,8 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 },
componentProps: {
options: [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
{ label: '收', value: '1' },
{ label: '付', value: '2' },
],
},
},
@ -245,8 +245,8 @@ export const formSchema: FormSchema[] = [
colProps: { span: 6 },
componentProps: {
options: [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
{ label: '收', value: '1' },
{ label: '付', value: '2' },
],
},
},
@ -293,6 +293,34 @@ export const formSchema: FormSchema[] = [
component: 'InputNumber',
colProps: { span: 6 },
},
{
field: 'saleOrgId',
label: '分公司',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
api: getOrgList,
labelField: 'label',
valueField: 'id',
resultField: 'data',
allowClear: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
if (e && obj) {
formModel.saleOrgName = obj.label
formModel.saleOrgId = obj.id
}
if (!e && !obj) {
formModel.saleOrgName = ''
formModel.saleOrgId = ''
}
},
}
},
},
{
field: 'description',
label: '模板说明',

@ -209,6 +209,10 @@
//
const addRow = () => {
list.value.push({})
const hot = hotTb.value.hotInstance
nextTick(() => {
hot.selectCell(list.value.length - 1, 1)
})
}
//
@ -265,49 +269,41 @@
data: 'unit',
type: 'dropdown',
source: async (query, process) => {
// if (unitDict.value && unitDict.value.length) {
// const dict = unitDict.value.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// } else {
// const results = await feeUnitDict()
// unitDict.value = results
// const dict = results.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// }
const results = [
{ label: '20GP', name: '20GP', value: '22G0' },
{ label: '40GP', name: '40GP', value: '42G0' },
]
const dict = results.map((res) => {
return res.label
})
process(dict)
},
},
{
title: '费用类型',
width: 80,
data: 'feeTypeName',
type: 'dropdown',
source: async (query, process) => {
if (currencyDict.value.length) {
process(currencyDict.value)
if (unitDict.value && unitDict.value.length) {
const dict = unitDict.value.map((item) => {
return item.name
})
process(dict)
} else {
const results = [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
]
const dict = results.map((res) => {
return res.label
const results = await feeUnitDict()
unitDict.value = results
const dict = results.map((item) => {
return item.name
})
process(dict)
}
},
},
// {
// title: '',
// width: 80,
// data: 'feeTypeName',
// type: 'dropdown',
// source: async (query, process) => {
// if (currencyDict.value.length) {
// process(currencyDict.value)
// } else {
// const results = [
// { label: '', value: 1 },
// { label: '', value: 2 },
// ]
// const dict = results.map((res) => {
// return res.label
// })
// process(dict)
// }
// },
// },
{
title: '是否箱型',
width: 100,
@ -574,19 +570,19 @@
if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') {
let dict = {}
changes.forEach((res) => {
//
if (changes[0][1] === 'feeTypeName') {
const res = [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
]
const item = res.filter((item) => {
return item.label === changes[0][3]
})
if (item) dict = item[0]
list.value[changes[0][0]]['feeType'] = dict?.value
list.value[changes[0][0]]['feeTypeName'] = dict?.label
}
// //
// if (changes[0][1] === 'feeTypeName') {
// const res = [
// { label: '', value: 1 },
// { label: '', value: 2 },
// ]
// const item = res.filter((item) => {
// return item.label === changes[0][3]
// })
// if (item) dict = item[0]
// list.value[changes[0][0]]['feeType'] = dict?.value
// list.value[changes[0][0]]['feeTypeName'] = dict?.label
// }
//
if (changes[0][1] === 'customerName') {
const item = companyDict.value.filter((item) => {

@ -23,6 +23,13 @@
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'ant-design:copy-outlined',
tooltip: '复制',
onClick: () => {
copyBooking(record)
},
},
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
@ -97,6 +104,13 @@
isUpdate: true,
})
}
function copyBooking(record) {
openModal(true, {
record,
isUpdate: false,
isCopy: true,
})
}
//
async function handleDelete(record: Recordable) {
const select = getSelectRows()

@ -71,7 +71,11 @@
}
// setModalProps({ confirmLoading: false });
} else {
setFieldsValue({ permissionIdentity: unref(2), clientId: data.clientId })
setFieldsValue({
permissionIdentity: unref(2),
clientId: data.clientId,
isDefault: data.first,
})
}
setModalProps({ loading: false })
})

@ -49,7 +49,7 @@
clientId: { type: String },
})
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
const [registerTable, { reload, getDataSource, getPaginationRef }] = useTable({
title: '',
api: async (p) => {
const res: API.DataResult = await ApiList(p)
@ -104,10 +104,12 @@
},
})
function handleCreate() {
const source = getDataSource()
openModal(true, {
clientId: props.clientId,
isParent: false,
isUpdate: false,
first: source.length ? false : true,
})
}
function handleAudit(record: Recordable) {

@ -55,6 +55,8 @@
import { ApiEdit, ApiInfo } from './api'
//
import { useMessage } from '/@/hooks/web/useMessage'
import { useUserStore } from '/@/store/modules/user'
const userStore = useUserStore()
const props = defineProps({
customerName: { type: String },
customerId: { type: String },
@ -62,6 +64,7 @@
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const isCopy = ref(false)
const detailId = ref()
// loading
const loading = ref(false)
@ -78,6 +81,7 @@
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
isCopy.value = !!data?.isCopy
if (unref(isUpdate)) {
setModalProps({ confirmLoading: true })
rowId.value = data.record.id
@ -91,13 +95,31 @@
detailId.value = res.data.id
}
} else {
detailId.value = ''
setFieldsValue({
customerName: props.customerName,
customerId: props.customerId,
})
feeField.value.SetData([])
feeField.value.condition = ''
if (isCopy.value) {
setModalProps({ confirmLoading: true })
const res: API.DataResult = await ApiInfo({ id: unref(data.record.id) })
if (res.succeeded) {
setFieldsValue({
...res.data,
id: '',
})
res.data.details.forEach((item) => {
delete item.id
})
feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition
// detailId.value = res.data.id
}
} else {
detailId.value = ''
setFieldsValue({
customerName: props.customerName,
customerId: props.customerId,
saleOrgId: userStore.getUserInfo.userOrgs[0].orgId,
})
feeField.value.SetData([])
feeField.value.condition = ''
}
}
setModalProps({ loading: false })
},

@ -3,8 +3,8 @@ import { BasicColumn, FormSchema } from '/@/components/Table'
import { Tag } from 'ant-design-vue'
// 引入字典数据
import { getDictOption } from '/@/utils/dictUtil'
// 下拉框数据接口
import { GetClientListByCode } from '/@/api/common'
import { getOrgList } from '/@/api/common'
// 往来单位下拉框数据
const companyDict = ref([])
let businessType: any = [
@ -32,10 +32,10 @@ export const columns: BasicColumn[] = [
dataIndex: 'feeCategory',
width: 120,
customRender: ({ text }) => {
if (text == 1) {
return '收'
} else if (text == 2) {
return '付'
if (text == '1') {
return '收'
} else if (text == '2') {
return '付'
}
return text
},
@ -99,8 +99,8 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 },
componentProps: {
options: [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
{ label: '收', value: '1' },
{ label: '付', value: '2' },
],
},
},
@ -245,8 +245,8 @@ export const formSchema: FormSchema[] = [
colProps: { span: 6 },
componentProps: {
options: [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
{ label: '收', value: '1' },
{ label: '付', value: '2' },
],
},
},
@ -293,6 +293,34 @@ export const formSchema: FormSchema[] = [
component: 'InputNumber',
colProps: { span: 6 },
},
{
field: 'saleOrgId',
label: '分公司',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
api: getOrgList,
labelField: 'label',
valueField: 'id',
resultField: 'data',
allowClear: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
if (e && obj) {
formModel.saleOrgName = obj.label
formModel.saleOrgId = obj.id
}
if (!e && !obj) {
formModel.saleOrgName = ''
formModel.saleOrgId = ''
}
},
}
},
},
{
field: 'description',
label: '模板说明',

@ -209,6 +209,10 @@
//
const addRow = () => {
list.value.push({})
const hot = hotTb.value.hotInstance
nextTick(() => {
hot.selectCell(list.value.length - 1, 1)
})
}
//
@ -265,49 +269,41 @@
data: 'unit',
type: 'dropdown',
source: async (query, process) => {
// if (unitDict.value && unitDict.value.length) {
// const dict = unitDict.value.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// } else {
// const results = await feeUnitDict()
// unitDict.value = results
// const dict = results.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// }
const results = [
{ label: '20GP', name: '20GP', value: '22G0' },
{ label: '40GP', name: '40GP', value: '42G0' },
]
const dict = results.map((res) => {
return res.label
})
process(dict)
},
},
{
title: '费用类型',
width: 80,
data: 'feeTypeName',
type: 'dropdown',
source: async (query, process) => {
if (currencyDict.value.length) {
process(currencyDict.value)
if (unitDict.value && unitDict.value.length) {
const dict = unitDict.value.map((item) => {
return item.name
})
process(dict)
} else {
const results = [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
]
const dict = results.map((res) => {
return res.label
const results = await feeUnitDict()
unitDict.value = results
const dict = results.map((item) => {
return item.name
})
process(dict)
}
},
},
// {
// title: '',
// width: 80,
// data: 'feeTypeName',
// type: 'dropdown',
// source: async (query, process) => {
// if (currencyDict.value.length) {
// process(currencyDict.value)
// } else {
// const results = [
// { label: '', value: 1 },
// { label: '', value: 2 },
// ]
// const dict = results.map((res) => {
// return res.label
// })
// process(dict)
// }
// },
// },
{
title: '是否箱型',
width: 100,
@ -574,19 +570,19 @@
if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') {
let dict = {}
changes.forEach((res) => {
//
if (changes[0][1] === 'feeTypeName') {
const res = [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
]
const item = res.filter((item) => {
return item.label === changes[0][3]
})
if (item) dict = item[0]
list.value[changes[0][0]]['feeType'] = dict?.value
list.value[changes[0][0]]['feeTypeName'] = dict?.label
}
// //
// if (changes[0][1] === 'feeTypeName') {
// const res = [
// { label: '', value: 1 },
// { label: '', value: 2 },
// ]
// const item = res.filter((item) => {
// return item.label === changes[0][3]
// })
// if (item) dict = item[0]
// list.value[changes[0][0]]['feeType'] = dict?.value
// list.value[changes[0][0]]['feeTypeName'] = dict?.label
// }
//
if (changes[0][1] === 'customerName') {
const item = companyDict.value.filter((item) => {

@ -23,6 +23,13 @@
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'ant-design:copy-outlined',
tooltip: '复制',
onClick: () => {
copyBooking(record)
},
},
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
@ -107,6 +114,13 @@
isUpdate: true,
})
}
function copyBooking(record) {
openModal(true, {
record,
isUpdate: false,
isCopy: true,
})
}
//
async function handleDelete(record: Recordable) {
const select = getSelectRows()

Loading…
Cancel
Save