lijingjia 2 months ago
commit 23af430c7c

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

@ -3,8 +3,8 @@ import { BasicColumn, FormSchema } from '/@/components/Table'
import { Tag } from 'ant-design-vue' import { Tag } from 'ant-design-vue'
// 引入字典数据 // 引入字典数据
import { getDictOption } from '/@/utils/dictUtil' import { getDictOption } from '/@/utils/dictUtil'
// 下拉框数据接口
import { GetClientListByCode } from '/@/api/common' import { getOrgList } from '/@/api/common'
// 往来单位下拉框数据 // 往来单位下拉框数据
const companyDict = ref([]) const companyDict = ref([])
let businessType: any = [ let businessType: any = [
@ -32,10 +32,10 @@ export const columns: BasicColumn[] = [
dataIndex: 'feeCategory', dataIndex: 'feeCategory',
width: 120, width: 120,
customRender: ({ text }) => { customRender: ({ text }) => {
if (text == 1) { if (text == '1') {
return '收' return '收'
} else if (text == 2) { } else if (text == '2') {
return '付' return '付'
} }
return text return text
}, },
@ -99,8 +99,8 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 }, colProps: { span: 4 },
componentProps: { componentProps: {
options: [ options: [
{ label: '应收', value: 1 }, { label: '收', value: '1' },
{ label: '应付', value: 2 }, { label: '付', value: '2' },
], ],
}, },
}, },
@ -245,8 +245,8 @@ export const formSchema: FormSchema[] = [
colProps: { span: 6 }, colProps: { span: 6 },
componentProps: { componentProps: {
options: [ options: [
{ label: '应收', value: 1 }, { label: '收', value: '1' },
{ label: '应付', value: 2 }, { label: '付', value: '2' },
], ],
}, },
}, },
@ -293,6 +293,34 @@ export const formSchema: FormSchema[] = [
component: 'InputNumber', component: 'InputNumber',
colProps: { span: 6 }, 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', field: 'description',
label: '模板说明', label: '模板说明',

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

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

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

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

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

@ -3,8 +3,8 @@ import { BasicColumn, FormSchema } from '/@/components/Table'
import { Tag } from 'ant-design-vue' import { Tag } from 'ant-design-vue'
// 引入字典数据 // 引入字典数据
import { getDictOption } from '/@/utils/dictUtil' import { getDictOption } from '/@/utils/dictUtil'
// 下拉框数据接口
import { GetClientListByCode } from '/@/api/common' import { getOrgList } from '/@/api/common'
// 往来单位下拉框数据 // 往来单位下拉框数据
const companyDict = ref([]) const companyDict = ref([])
let businessType: any = [ let businessType: any = [
@ -32,10 +32,10 @@ export const columns: BasicColumn[] = [
dataIndex: 'feeCategory', dataIndex: 'feeCategory',
width: 120, width: 120,
customRender: ({ text }) => { customRender: ({ text }) => {
if (text == 1) { if (text == '1') {
return '收' return '收'
} else if (text == 2) { } else if (text == '2') {
return '付' return '付'
} }
return text return text
}, },
@ -99,8 +99,8 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 }, colProps: { span: 4 },
componentProps: { componentProps: {
options: [ options: [
{ label: '应收', value: 1 }, { label: '收', value: '1' },
{ label: '应付', value: 2 }, { label: '付', value: '2' },
], ],
}, },
}, },
@ -245,8 +245,8 @@ export const formSchema: FormSchema[] = [
colProps: { span: 6 }, colProps: { span: 6 },
componentProps: { componentProps: {
options: [ options: [
{ label: '应收', value: 1 }, { label: '收', value: '1' },
{ label: '应付', value: 2 }, { label: '付', value: '2' },
], ],
}, },
}, },
@ -293,6 +293,34 @@ export const formSchema: FormSchema[] = [
component: 'InputNumber', component: 'InputNumber',
colProps: { span: 6 }, 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', field: 'description',
label: '模板说明', label: '模板说明',

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

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

Loading…
Cancel
Save