Commit 093705dc by linjinhong

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

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