Commit 093705dc by linjinhong

添加物流菜单下注释以及修改部分bug

parent ae599fbd
......@@ -4,7 +4,11 @@ import {
LogisticsMethod,
LogisticsMethodList,
UpdateLogisticsMethodStatus,
} from '@/types/api/logistics'
} from '@/views/logistics/types/logistics'
import { AddDeclarationRuleObj } from '@/views/logistics/types/declarationRule'
import { LogisticsQuotation } from '@/views/logistics/types/logisticsQuotation'
import { LogisticsPartitionObj } from '@/views/logistics/types/logisticsPartition'
import { ShippingAddressObj } from '@/views/logistics/types/shippingAddress'
interface Ikey {
[key: string]: unknown
}
......@@ -68,13 +72,16 @@ export function getPlatformList() {
* @description 发货地址
*/
//列表
export function getAddressByIdList(params: any) {
export function getAddressByIdList(params: {
pageSize?: number
currentPage?: number
}) {
return axios.get<never, BaseRespData<never>>('/logisticsAddress/list_page', {
params,
})
}
//根据id查询地址
export function getAddressById(params: any) {
export function getAddressById(params: { id: number | string }) {
return axios.get<never, BaseRespData<never>>(
'/logisticsAddress/getAddressById',
{
......@@ -83,21 +90,21 @@ export function getAddressById(params: any) {
)
}
//新增
export function addAddress(params: any) {
export function addAddress(params: ShippingAddressObj) {
return axios.post<never, BaseRespData<never>>(
'/logisticsAddress/addAddress',
params,
)
}
//修改
export function updateAddress(params: any) {
export function updateAddress(params: ShippingAddressObj) {
return axios.post<never, BaseRespData<never>>(
'/logisticsAddress/updateAddress',
params,
)
}
//删除
export function deleteAddressByIds(params: any) {
export function deleteAddressByIds(params: { ids: string }) {
return axios.get<never, BaseRespData<never>>(
'/logisticsAddress/deleteAddressByIds',
{
......@@ -114,28 +121,32 @@ export function getlogisticsWayAllList() {
return axios.get<never, BaseRespData<never>>('/logisticsWay/all_list', {})
}
//物流报价列表
export function getlogisticsQuotationList(params: any) {
export function getlogisticsQuotationList(params: {
logisticsIdList?: number[]
pageSize: number
currentPage: number
}) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/list_page',
params,
)
}
//新增
export function addLogisticsQuotation(params: any) {
export function addLogisticsQuotation(params: LogisticsQuotation) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/add',
params,
)
}
//修改
export function updateLogisticsQuotation(params: any) {
export function updateLogisticsQuotation(params: LogisticsQuotation) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/update',
params,
)
}
//删除
export function deleteLogisticsQuotation(params: any) {
export function deleteLogisticsQuotation(params: { ids: string }) {
return axios.get<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/delete',
{
......@@ -144,7 +155,7 @@ export function deleteLogisticsQuotation(params: any) {
)
}
//导入
export function importLogisticsQuotation(formData: any) {
export function importLogisticsQuotation(formData: FormData) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/import',
formData,
......@@ -165,7 +176,7 @@ export function downloadLogisticsQuotationTemplate() {
)
}
//根据ID查对象
export function getLogisticsQuotationByID(params: any) {
export function getLogisticsQuotationByID(params: { id: number | string }) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/get',
params,
......@@ -176,28 +187,32 @@ export function getLogisticsQuotationByID(params: any) {
* @description 申报规则
*/
//列表
export function getLogisticsCustomsRuleList(params: any) {
export function getLogisticsCustomsRuleList(params: {
name?: string
pageSize: number
currentPage: number
}) {
return axios.post<never, BaseRespData<never>>(
'/logisticsCustomsRule/list_page',
params,
)
}
//新增
export function addLogisticsCustomsRule(params: any) {
export function addLogisticsCustomsRule(params: AddDeclarationRuleObj) {
return axios.post<never, BaseRespData<never>>(
'/logisticsCustomsRule/add',
params,
)
}
//修改
export function updateLogisticsCustomsRule(params: any) {
export function updateLogisticsCustomsRule(params: AddDeclarationRuleObj) {
return axios.post<never, BaseRespData<never>>(
'/logisticsCustomsRule/update',
params,
)
}
//删除
export function deleteLogisticsCustomsRule(params: any) {
export function deleteLogisticsCustomsRule(params: { ids: string }) {
return axios.get<never, BaseRespData<never>>('/logisticsCustomsRule/delete', {
params,
})
......@@ -207,35 +222,41 @@ export function deleteLogisticsCustomsRule(params: any) {
* @description 物流分区
*/
//列表
export function getLogisticsZoneList(params: any) {
export function getLogisticsZoneList(params: {
logisticsIdList?: string[] | string | number[] | number
codePrefix?: string
}) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsZone/list',
params,
)
}
//新增
export function addLogisticsZone(params: any) {
export function addLogisticsZone(params: LogisticsPartitionObj) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsZone/add',
params,
)
}
//修改
export function updateLogisticsZone(params: any) {
export function updateLogisticsZone(params: LogisticsPartitionObj) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsZone/update',
params,
)
}
//删除
export function deleteLogisticsZone(params: any) {
export function deleteLogisticsZone(params: {
logisticsList: string[]
zoneNameList: string[]
}) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsZone/delete',
params,
)
}
//物流分区导入
export function importLogisticsZone(formData: any) {
export function importLogisticsZone(formData: FormData) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsZone/import',
formData,
......@@ -259,7 +280,10 @@ export function exportExcelLogisticsZone() {
/**
* @description 运费试算
*/
export function getLogisticsTrialCalculation(params: any) {
export function getLogisticsTrialCalculation(params: {
code?: string
weight?: string
}) {
return axios.get<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/logisticsTrialCalculation',
{
......
......@@ -92,7 +92,10 @@ import { Edit, Delete, List } from '@element-plus/icons-vue'
import { ISeachFormConfig } from '@/types/searchType'
const [searchForm] = useValue({})
const [editForm, resetEditForm] = useValue<AddDeclarationRuleObj>({ type: 1 })
const [editForm, resetEditForm] = useValue<AddDeclarationRuleObj>({
type: 1,
currency: 'USD',
})
const {
currentPage,
pageSize,
......@@ -130,9 +133,12 @@ const searchConfig = ref<ISeachFormConfig[]>([
interface IOption {
[key: string]: unknown
}
const mapData = ref(new Map<number, string[]>())
mapData.value.set(1, ['fixedValue', 'fixedWeight'])
mapData.value.set(2, ['orderPercent', 'valueUp', 'weightPercent', 'weightUp'])
const mapData = ref(
new Map<number, string[]>([
[1, ['fixedValue', 'fixedWeight']],
[2, ['orderPercent', 'valueUp', 'weightPercent', 'weightUp']],
]),
)
const formConfig = ref<IFormConfig[]>([
{
......@@ -400,12 +406,18 @@ const tableConfig = ref([
const loading = ref(false)
/**
* @description: 取消按钮
*/
function cancelFn() {
dialogVisible.value = false
editFormRef.value?.resetFields()
resetEditForm()
}
/**
* @description: 编辑按钮
*/
async function editRule(item: AddDeclarationRuleObj) {
try {
editForm.value = { ...item }
......@@ -421,6 +433,9 @@ async function editRule(item: AddDeclarationRuleObj) {
}
}
/**
* @description: 检查数据
*/
async function checkData() {
const [isValid, postData] = await Promise.all([
new Promise<boolean>((resolve) => {
......@@ -438,11 +453,12 @@ async function checkData() {
resolve(params)
}),
])
console.log(isValid, postData)
return { isValid, postData }
}
/**
* @description: 保存按钮
*/
const save = debounce(async () => {
const { isValid, postData } = await checkData()
if (isValid) {
......@@ -457,9 +473,8 @@ const save = debounce(async () => {
})
}
ElMessage({
message: '保存成功',
message: postData.id ? '更新成功' : '新增成功',
type: 'success',
offset: window.innerHeight / 2,
})
cancelFn()
......@@ -470,6 +485,9 @@ const save = debounce(async () => {
}
}, 400)
/**
* @description: 新增按钮打开弹窗
*/
function addDialog() {
dialogVisible.value = true
nextTick(() => {
......@@ -478,11 +496,17 @@ function addDialog() {
})
}
/**
* @description: 获取选中数据
*/
function handleCheckboxRecords(value: never[]) {
console.log(351, value)
selection.value = value
}
/**
* @description: 多选删除按钮
*/
async function deleteFn() {
if (!selection.value.length) {
return ElMessage({
......@@ -514,9 +538,13 @@ async function deleteFn() {
// showError(e)
}
}
/**
* @description: 单个删除按钮
*/
async function deleteRule(item: AddDeclarationRuleObj) {
try {
await showConfirm('是否删除物流方式', {
await showConfirm('是否删除申报规则', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
......@@ -537,12 +565,17 @@ async function deleteRule(item: AddDeclarationRuleObj) {
// showError(e)
}
}
/**
* @description: 日志弹窗
*/
interface LogList {
id?: number
createTime?: string
description?: string
}
const logList = ref<LogList[]>([])
async function showLog(row: AddDeclarationRuleObj) {
logDialogVisible.value = true
try {
......
......@@ -28,7 +28,6 @@
highlight-current-row
:isShowCheckBox="false"
border="full"
@getCheckboxRecords="handleCheckboxRecords"
></CustomizeTable>
</div>
</div>
......@@ -50,7 +49,7 @@ import { TableColumn } from '@/components/VxeTable'
const [searchForm] = useValue({ code: '', weight: '' })
const tableRef = ref<InstanceType<typeof CustomizeTable> | null>(null)
const selection = ref([])
const mergeCells = ref<VxeTablePropTypes.MergeCells>([])
const tableData = ref([])
const searchConfig = ref<ISeachFormConfig[]>([
......@@ -117,6 +116,9 @@ const tableConfig = ref<TableColumn[]>([
},
])
/**
* @description: 计算按钮
*/
async function search() {
if (!searchForm.value.code) {
ElMessage.warning('请输入邮编')
......@@ -138,6 +140,9 @@ async function search() {
}
}
/**
* @description: 获取列表数据
*/
const loading = ref(false)
async function getList(data?: { code: string; weight: string }) {
loading.value = true
......@@ -153,11 +158,6 @@ async function getList(data?: { code: string; weight: string }) {
loading.value = false
}
}
function handleCheckboxRecords(value: never[]) {
console.log(351, value)
selection.value = value
}
</script>
<style lang="scss" scoped>
......
......@@ -83,7 +83,10 @@ import {
import { ISeachFormConfig } from '@/types/searchType'
import { TableColumn } from '@/components/VxeTable'
import type { LogisticsMethod, platformObj } from '@/types/api/logistics'
import type {
LogisticsMethod,
platformObj,
} from '@/views/logistics/types/logistics.ts'
import SearchForm from '@/components/SearchForm.tsx'
import LogDialog from './components/LogDialog.tsx'
import CustomizeForm from '@/components/CustomizeForm.tsx'
......@@ -103,6 +106,7 @@ const [editForm, resetEditForm] = useValue<LogisticsMethod>({
})
const {
loading,
currentPage,
pageSize,
total,
......@@ -117,7 +121,6 @@ const {
pageSize: pageSize,
currentPage: page,
}).then(({ data }) => {
console.log(130, data)
return data
}),
})
......@@ -456,11 +459,10 @@ onMounted(() => {
getAllList()
})
const loading = ref(false)
/**
* @description: 更改状态
*/
async function changeStatus(data: LogisticsMethod) {
console.log(data)
loading.value = true
try {
const params = {
id: data.id,
......@@ -474,16 +476,21 @@ async function changeStatus(data: LogisticsMethod) {
search()
} catch (error) {
console.log(error)
// data.status
} finally {
loading.value = false
}
}
/**
* @description: 取消按钮
*/
function cancelFn() {
dialogVisible.value = false
editFormRef.value?.resetFields()
resetEditForm()
}
/**
* @description: 删除按钮
*/
async function deleteWay(item: LogisticsMethod) {
try {
await showConfirm('是否删除物流方式', {
......@@ -507,6 +514,10 @@ async function deleteWay(item: LogisticsMethod) {
// showError(e)
}
}
/**
* @description: 编辑按钮
*/
async function editWay(item: LogisticsMethod) {
try {
editForm.value = { ...item }
......@@ -524,6 +535,9 @@ async function editWay(item: LogisticsMethod) {
}
}
/**
* @description: 检查数据
*/
async function checkData() {
const [isValid, postData] = await Promise.all([
new Promise<boolean>((resolve) => {
......@@ -550,6 +564,9 @@ async function checkData() {
return { isValid, postData }
}
/**
* @description: 保存按钮
*/
const save = debounce(async () => {
const { isValid, postData } = await checkData()
if (isValid) {
......@@ -576,18 +593,26 @@ const save = debounce(async () => {
}
}
}, 400)
/**
* @description: 新增按钮打开弹窗
*/
function addDialog() {
dialogVisible.value = true
}
/**
* @description: 多选删除按钮
*/
async function deleteFn() {
if (!selection.value.length) {
return ElMessage({
message: '请选择用户',
message: '请选择物流方式',
type: 'warning',
})
}
try {
await showConfirm('是否删除用户', {
await showConfirm('是否删除物流方式', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
......@@ -609,11 +634,17 @@ async function deleteFn() {
}
}
/**
* @description: 获取选中数据
*/
function handleCheckboxRecords(value: never[]) {
console.log(351, value)
selection.value = value
}
/**
* @description: 新增平台物流行
*/
function addCol() {
editForm.value.platformList?.push({
platform: '',
......@@ -621,10 +652,17 @@ function addCol() {
showPlatform: [],
})
}
/**
* @description: 删除平台物流行
*/
function deleteCol(index: number) {
editForm.value.platformList?.splice(index, 1)
}
/**
* @description: 获取列表数据
*/
async function getAllList() {
try {
const res = await Promise.all([
......@@ -663,6 +701,9 @@ async function getAllList() {
}
}
/**
* @description: 日志弹窗
*/
interface LogList {
id?: number
createTime?: string
......
......@@ -47,7 +47,7 @@
:merge-cells="mergeCells"
:seq-config="{
seqMethod: (row:any) => {
if (searchForm.logisticsIdList?.length) {
if (mergeCells?.length) {
return row.row.seq
}
......@@ -404,65 +404,78 @@ const tableConfig = ref<TableColumn[]>([
},
])
/**
* @description: 监听表格合并单元格数据
*/
watch(
() => data.value as LogisticsQuotation[],
(val) => {
console.log(410, 111)
try {
tableData.value = getTableData(val as LogisticsQuotation[])
if (searchForm.value.logisticsIdList?.length) {
let startRow = 0
mergeCells.value = []
val.forEach((item) => {
if (item.logisticsQuotationList?.length) {
const rowspan = item.logisticsQuotationList.length
const newMergeCells = []
for (let i = 0; i < val.length; i++) {
const item = val[i]
const rowspan = item.logisticsQuotationList?.length || 0
if (rowspan > 0) {
for (let col = 0; col < 5; col++) {
mergeCells.value.push({
newMergeCells.push({
row: startRow,
col: col,
rowspan: rowspan,
colspan: 1,
})
}
startRow += rowspan
}
})
}
mergeCells.value = newMergeCells
} else {
mergeCells.value = []
}
} catch (e) {
console.log(e)
}
},
{ immediate: true, deep: true },
{ deep: true },
)
onMounted(() => {
// loading.value = true
getAllList()
})
/**
* @description: 转换表格数据
*/
function getTableData(arr: LogisticsQuotation[]) {
const newArr: LogisticsQuotation[] = []
if (arr.length) {
arr.forEach((item, index) => {
if (item.logisticsQuotationList?.length) {
item.logisticsQuotationList.forEach((item) => {
item.seq = index + 1
newArr.push(item)
})
}
})
return newArr
}
return []
if (!arr.length) return []
return arr.flatMap((parentItem, index) => {
const quotations = parentItem.logisticsQuotationList
if (!quotations?.length) return []
return quotations.map((quotation) => ({
...quotation,
seq: index + 1,
}))
})
}
/**
* @description: 取消按钮
*/
function cancelFn() {
dialogVisible.value = false
editFormRef.value?.resetFields()
resetEditForm()
}
/**
* @description: 编辑按钮
*/
async function editWay(item: LogisticsQuotation) {
try {
editForm.value = { ...item }
......@@ -474,6 +487,9 @@ async function editWay(item: LogisticsQuotation) {
}
}
/**
* @description: 检查数据
*/
async function checkData() {
const [isValid, postData] = await Promise.all([
new Promise<boolean>((resolve) => {
......@@ -496,6 +512,9 @@ async function checkData() {
return { isValid, postData }
}
/**
* @description: 保存提交表单数据
*/
const save = debounce(async () => {
const { isValid, postData } = await checkData()
if (isValid) {
......@@ -510,9 +529,8 @@ const save = debounce(async () => {
})
}
ElMessage({
message: '保存成功',
message: postData.id ? '更新成功' : '新增成功',
type: 'success',
offset: window.innerHeight / 2,
})
cancelFn()
......@@ -522,19 +540,27 @@ const save = debounce(async () => {
}
}
}, 400)
/**
* @description: 新增按钮打开弹窗
*/
function addDialog() {
dialogVisible.value = true
console.log(502, editForm.value)
}
/**
* @description: 删除按钮
*/
async function deleteFn() {
if (!selection.value.length) {
return ElMessage({
message: '请选择用户',
message: '请选择物流报价',
type: 'warning',
})
}
try {
await showConfirm('是否删除用户', {
await showConfirm('是否删除物流报价', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
......@@ -562,11 +588,17 @@ async function deleteFn() {
}
}
/**
* @description: 获取选中数据
*/
function handleCheckboxRecords(value: never[]) {
console.log(351, value)
selection.value = value
}
/**
* @description: 获取物流方式列表
*/
async function getAllList() {
try {
const res = await Promise.all([getlogisticsWayAllList()])
......@@ -579,6 +611,9 @@ async function getAllList() {
}
}
/**
* @description: 上传文件
*/
function onBeforeUploadImage(file: File) {
const isIMAGE =
file.type ==
......@@ -590,6 +625,10 @@ function onBeforeUploadImage(file: File) {
return isIMAGE
}
/**
* @description: 下载模版
*/
async function downloadExcel() {
try {
const res = await downloadLogisticsQuotationTemplate()
......@@ -604,6 +643,10 @@ async function downloadExcel() {
console.log(error)
}
}
/**
* @description: 导入文件
*/
async function exportExcel(file: { file: File }) {
try {
const formData = new FormData()
......@@ -619,6 +662,10 @@ async function exportExcel(file: { file: File }) {
ElMessage.error('导入失败!')
}
}
/**
* @description: 更新文件
*/
async function updateExcel(file: { file: File }) {
try {
const formData = new FormData()
......@@ -634,6 +681,10 @@ async function updateExcel(file: { file: File }) {
ElMessage.error('导入失败!')
}
}
/**
* @description: 日志弹窗
*/
interface LogList {
id?: number
createTime?: string
......
......@@ -5,11 +5,11 @@
{{ '新增' }}
</el-button>
<el-button
:disabled="(tableData as ShippingAddress[]).filter((el) => el.checked).length === 0"
:disabled="(tableData as ShippingAddressObj[]).filter((el) => el.checked).length === 0"
type="danger"
@click="
deleteSection(
(tableData as ShippingAddress[])
(tableData as ShippingAddressObj[])
.filter((el) => el.checked)
.map((el) => el.id as number)
)
......@@ -22,7 +22,7 @@
<div class="user-list flex-1 overflow-hidden" v-loading="loading">
<el-row :gutter="20">
<el-col
v-for="(item, index) in tableData as ShippingAddress[]"
v-for="(item, index) in tableData as ShippingAddressObj[]"
:key="index"
:span="12"
>
......@@ -191,13 +191,12 @@ import CustomizeForm from '@/components/CustomizeForm.tsx'
import { Edit, Delete, List } from '@element-plus/icons-vue'
import { debounce } from 'lodash-es'
import { ShippingAddress } from './types/shippingAddress.ts'
import { ShippingAddressObj } from './types/shippingAddress.ts'
import usePageList from '@/utils/hooks/usePageList'
import { useValue } from './hooks/useValue'
import { showConfirm } from '@/utils/ui'
const [searchForm] = useValue({})
const [editForm, resetEditForm] = useValue<ShippingAddress>({
const [editForm, resetEditForm] = useValue<ShippingAddressObj>({
swDefault: false,
})
const {
......@@ -211,7 +210,6 @@ const {
} = usePageList({
query: (page, pageSize) =>
getAddressByIdList({
...searchForm.value,
pageSize: pageSize,
currentPage: page,
}).then(({ data }) => {
......@@ -363,12 +361,19 @@ const formConfig = ref<IFormConfig[]>([
const loading = ref(false)
/**
* @description: 取消按钮
*/
function cancelFn() {
dialogVisible.value = false
editFormRef.value?.resetFields()
resetEditForm()
}
async function deleteAddress(item: ShippingAddress) {
/**
* @description: 删除按钮
*/
async function deleteAddress(item: ShippingAddressObj) {
try {
await showConfirm('是否删除发货地址', {
confirmButtonText: '确认',
......@@ -392,7 +397,11 @@ async function deleteAddress(item: ShippingAddress) {
// showError(e)
}
}
async function editAddress(item: ShippingAddress) {
/**
* @description: 编辑按钮
*/
async function editAddress(item: ShippingAddressObj) {
try {
editForm.value = { ...item }
console.log(395, editForm.value)
......@@ -401,7 +410,10 @@ async function editAddress(item: ShippingAddress) {
console.log(e)
}
}
//表格校验&&更改parasm数据
/**
* @description: 检查数据
*/
async function checkData() {
const [isValid, postData] = await Promise.all([
new Promise<boolean>((resolve) => {
......@@ -413,7 +425,7 @@ async function checkData() {
console.log(err)
})
}),
new Promise<ShippingAddress>((resolve) => {
new Promise<ShippingAddressObj>((resolve) => {
const params = { ...editForm.value }
resolve(params)
}),
......@@ -423,6 +435,9 @@ async function checkData() {
return { isValid, postData }
}
/**
* @description: 保存按钮
*/
const save = debounce(async () => {
const { isValid, postData } = await checkData()
if (isValid) {
......@@ -437,7 +452,7 @@ const save = debounce(async () => {
})
}
ElMessage({
message: '保存成功',
message: postData.id ? '更新成功' : '新增成功',
type: 'success',
offset: window.innerHeight / 2,
})
......@@ -450,9 +465,16 @@ const save = debounce(async () => {
}
}, 400)
/**
* @description: 新增按钮打开弹窗
*/
function addDialog() {
dialogVisible.value = true
}
/**
* @description: 多选删除按钮
*/
async function deleteSection(arr: number[]) {
try {
await showConfirm('是否删除发货地址', {
......@@ -477,6 +499,9 @@ async function deleteSection(arr: number[]) {
}
}
/**
* @description: 日志弹窗
*/
interface LogList {
id?: number
createTime?: string
......@@ -484,7 +509,7 @@ interface LogList {
}
const logList = ref<LogList[]>([])
async function showLog(row: ShippingAddress) {
async function showLog(row: ShippingAddressObj) {
logDialogVisible.value = true
try {
const { data } = await getLogisticsLog({
......
export interface LogisticsPartitionObj {
zoneName?: string
logistics?: string
codePrefix?: string
logisticsId?: string
}
export interface ShippingAddress {
export interface ShippingAddressObj {
addressLine1?: string
addressLine2?: string
addressLine3?: string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment