Commit 99679c94 by linjinhong

修改文档问题已经ts打包报错

parent 093705dc
...@@ -67,6 +67,10 @@ export function getWarehouseList() { ...@@ -67,6 +67,10 @@ export function getWarehouseList() {
export function getPlatformList() { export function getPlatformList() {
return axios.get<never, BaseRespData<never>>('/logisticsWay/platform') return axios.get<never, BaseRespData<never>>('/logisticsWay/platform')
} }
//获取物流公司列表
export function getLogisticsCompanyList() {
return axios.get<never, BaseRespData<never>>('/logisticsCompany/all_options')
}
/** /**
* @description 发货地址 * @description 发货地址
...@@ -120,6 +124,7 @@ export function deleteAddressByIds(params: { ids: string }) { ...@@ -120,6 +124,7 @@ export function deleteAddressByIds(params: { ids: string }) {
export function getlogisticsWayAllList() { 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: { export function getlogisticsQuotationList(params: {
logisticsIdList?: number[] logisticsIdList?: number[]
...@@ -131,6 +136,16 @@ export function getlogisticsQuotationList(params: { ...@@ -131,6 +136,16 @@ export function getlogisticsQuotationList(params: {
params, params,
) )
} }
export function getlogisticsQuotationPage(params: {
logisticsIdList?: number[]
pageSize: number
currentPage: number
}) {
return axios.post<never, BaseRespData<never>>(
'/logistics/logisticsQuotation/page',
params,
)
}
//新增 //新增
export function addLogisticsQuotation(params: LogisticsQuotation) { export function addLogisticsQuotation(params: LogisticsQuotation) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
......
...@@ -64,6 +64,7 @@ const iptFn = (e: string) => { ...@@ -64,6 +64,7 @@ const iptFn = (e: string) => {
if (decimalCount > 1) { if (decimalCount > 1) {
// 如果小数点个数大于1,则将多余的小数点替换为空字符串 // 如果小数点个数大于1,则将多余的小数点替换为空字符串
val.value = e.replace(/\./g, (match: string, offset: number) => { val.value = e.replace(/\./g, (match: string, offset: number) => {
console.log(67, match)
return offset === e.lastIndexOf('.') ? '.' : '' return offset === e.lastIndexOf('.') ? '.' : ''
}) })
} else { } else {
......
...@@ -17,6 +17,43 @@ const menu: MenuItem[] = [ ...@@ -17,6 +17,43 @@ const menu: MenuItem[] = [
// label: '商品', // label: '商品',
// }, // },
{ {
index: '4',
id: 7,
label: '物流',
children: [
{
index: '/logistics/logisticsMethod',
id: 1,
label: '物流方式',
},
{
index: '/logistics/shippingAddress',
id: 2,
label: '发货地址',
},
{
index: '/logistics/logisticsQuotation',
id: 3,
label: '物流报价',
},
{
index: '/logistics/declarationRule',
id: 4,
label: '申报规则',
},
{
index: '/logistics/logisticsPartition',
id: 5,
label: '物流分区',
},
{
index: '/logistics/logisticsCalculate',
id: 6,
label: '运费试算',
},
],
},
{
index: '13', index: '13',
id: 13, id: 13,
label: '库存', label: '库存',
...@@ -49,6 +86,7 @@ const menu: MenuItem[] = [ ...@@ -49,6 +86,7 @@ const menu: MenuItem[] = [
}, },
], ],
}, },
{ {
index: '1', index: '1',
id: 2, id: 2,
...@@ -124,43 +162,7 @@ const menu: MenuItem[] = [ ...@@ -124,43 +162,7 @@ const menu: MenuItem[] = [
}, },
], ],
}, },
{
index: '4',
id: 7,
label: '物流',
children: [
{
index: '/logistics/logisticsMethod',
id: 1,
label: '物流方式',
},
{
index: '/logistics/shippingAddress',
id: 2,
label: '发货地址',
},
{
index: '/logistics/logisticsQuotation',
id: 3,
label: '物流报价',
},
{
index: '/logistics/declarationRule',
id: 4,
label: '申报规则',
},
{
index: '/logistics/logisticsPartition',
id: 5,
label: '物流分区',
},
{
index: '/logistics/logisticsCalculate',
id: 6,
label: '运费试算',
},
],
},
// { // {
// index: '', // index: '',
// id: 3, // id: 3,
......
...@@ -2,6 +2,7 @@ export interface BaseRespData<D> { ...@@ -2,6 +2,7 @@ export interface BaseRespData<D> {
code: number code: number
message?: string message?: string
data: D data: D
total?: number
} }
export interface PaginationData<D> { export interface PaginationData<D> {
......
...@@ -8,15 +8,6 @@ export function isExternal(path: string) { ...@@ -8,15 +8,6 @@ export function isExternal(path: string) {
} }
/** /**
* @description 校验密码是否小于6位
* @param value
* @returns {boolean}
*/
export function isPassword(value: string | any[]) {
return value.length >= 6
}
/**
* @description 判断是否为数字 * @description 判断是否为数字
* @param value * @param value
* @returns {boolean} * @returns {boolean}
...@@ -93,7 +84,7 @@ export function isAlphabets(value: string) { ...@@ -93,7 +84,7 @@ export function isAlphabets(value: string) {
* @param value * @param value
* @returns {boolean} * @returns {boolean}
*/ */
export function isString(value: any) { export function isString(value: unknown) {
return typeof value === 'string' || value instanceof String return typeof value === 'string' || value instanceof String
} }
...@@ -112,7 +103,7 @@ export function isArray(arg: string | (string | number)[]) { ...@@ -112,7 +103,7 @@ export function isArray(arg: string | (string | number)[]) {
* @description 判断是否是对象 * @description 判断是否是对象
* @param arg * @param arg
*/ */
export function isObject(arg: any) { export function isObject(arg: unknown) {
return Object.prototype.toString.call(arg) === '[object Object]' return Object.prototype.toString.call(arg) === '[object Object]'
} }
...@@ -229,247 +220,6 @@ export function isJson(value: string | null) { ...@@ -229,247 +220,6 @@ export function isJson(value: string | null) {
return false return false
} }
/**
* @description: 限制input框输入8位整数
* @param {*} rule :校验规则
* @param {*} value:表单的值
* @param {*} callback 返回的函数
*/
export const validateFloatNumber = (rule, value, callback) => {
if (!value) {
callback()
return
}
if (isNaN(value)) {
callback(new Error('请输入数字'))
return
}
parseFloat(value)
const reg = /^([1-9][0-9]*)$/
const bool = reg.test(value)
if (!bool) {
callback(new Error('请输入整数'))
} else {
if (value.length > 8) {
callback(new Error('不得超过8位数'))
} else {
callback()
}
}
}
/**
* @description: 限制input框输入小数点前10位,小数点后两位
* @param {*} rule :校验规则
* @param {*} value:表单的值
* @param {*} callback 返回的函数
*/
export const validateNumberValue = (rule, value, callback) => {
if (!value) {
callback()
return
}
if (isNaN(value)) {
callback(new Error('请输入数字'))
return
}
let integerPart, decimalPart
const decimalIndex = String(value).indexOf('.')
if (decimalIndex < 0) {
// 没有小数点的情况
if (value <= 0) {
return callback(new Error('数字不得小于等于零'))
}
integerPart = value
} else if (decimalIndex === 0) {
return callback(new Error('数字不能以小数点开头'))
} else {
// 有小数点的情况
if (value <= 0) {
return callback(new Error('数字不得小于等于零'))
}
integerPart = String(value).substring(0, decimalIndex)
decimalPart = String(value).substring(decimalIndex + 1)
}
if (integerPart.length > 10) {
return callback(new Error('小数点前最多允许10位'))
} else if (decimalPart && decimalPart.length > 2) {
return callback(new Error('小数点后最多允许2位'))
} else {
if (integerPart < 0) {
return callback(new Error('数字不得小于零'))
} else {
callback()
}
}
}
export const validateNumberValueis0 = (rule, value, callback) => {
if (!value) {
callback()
return
}
if (isNaN(value)) {
callback(new Error('请输入数字'))
return
}
let integerPart, decimalPart
const decimalIndex = String(value).indexOf('.')
if (decimalIndex < 0) {
// 没有小数点的情况
if (value < 0) {
return callback(new Error('数字不得小于零'))
}
integerPart = value
} else if (decimalIndex === 0) {
return callback(new Error('数字不能以小数点开头'))
} else {
// 有小数点的情况
if (value < 0) {
return callback(new Error('数字不得小于零'))
}
integerPart = String(value).substring(0, decimalIndex)
decimalPart = String(value).substring(decimalIndex + 1)
}
if (integerPart.length > 10) {
return callback(new Error('小数点前最多允许10位'))
} else if (decimalPart && decimalPart.length > 2) {
return callback(new Error('小数点后最多允许2位'))
} else {
if (integerPart < 0) {
return callback(new Error('数字不得小于零'))
} else {
callback()
}
}
}
/**
* @description: 限制input框输入小数点前10位,小数点后两位可以等于0
* @param {*} rule :校验规则
* @param {*} value:表单的值
* @param {*} callback 返回的函数
*/
export const validateValue = (rule, value, callback) => {
if (!value) {
callback()
return
}
if (isNaN(value)) {
callback(new Error('请输入数字'))
return
}
let integerPart, decimalPart
const decimalIndex = String(value).indexOf('.')
if (decimalIndex < 0) {
// 没有小数点的情况
integerPart = value
} else if (decimalIndex === 0) {
callback(new Error('数字不能以小数点开头'))
} else {
// 有小数点的情况
integerPart = String(value).substring(0, decimalIndex)
decimalPart = String(value).substring(decimalIndex + 1)
}
if (integerPart.length > 10) {
callback(new Error('小数点前最多允许10位'))
} else if (decimalPart && decimalPart.length > 2) {
callback(new Error('小数点后最多允许2位'))
} else {
if (integerPart < 0) {
callback(new Error('数字不得小于零'))
} else {
callback()
}
}
}
/**
* @description: 税率
* @param {*} rule :校验规则
* @param {*} value:表单的值
* @param {*} callback 返回的函数
*/
export const validateTaxRate = (rule, value, callback) => {
if (!value) {
callback()
return
}
if (isNaN(value)) {
callback(new Error('请输入数字'))
return
}
let integerPart, decimalPart
const decimalIndex = String(value).indexOf('.')
if (decimalIndex < 0) {
if (value <= 0) {
callback(new Error('数字不得小于等于零'))
}
// 没有小数点的情况
integerPart = value
} else if (decimalIndex === 0) {
callback(new Error('数字不能以小数点开头'))
} else {
// 有小数点的情况
// 有小数点的情况
if (value <= 0) {
callback(new Error('数字不得小于等于零'))
}
integerPart = String(value).substring(0, decimalIndex)
decimalPart = String(value).substring(decimalIndex + 1)
}
if (integerPart.length > 10) {
callback(new Error('小数点前最多允许10位'))
} else if (decimalPart && decimalPart.length > 6) {
callback(new Error('小数点后最多允许6位'))
} else {
if (integerPart < 0) {
callback(new Error('数字不得小于等于零'))
} else {
callback()
}
}
}
export function arrToTree(
arr: Array<any>,
parField: string,
chilField: string
) {
const map = new Map()
const tree = []
// 首先,将所有节点放入映射表,并初始化每个节点的 `children` 属性
arr.forEach((el) => {
map.set(el[chilField], { ...el, children: [] })
})
// 然后,构建树形结构
arr.forEach((el) => {
const node = map.get(el[chilField])
if (el[parField] === 0) {
tree.push(node)
} else {
const parent = map.get(el[parField])
if (parent) {
parent.children.push(node)
}
}
})
return tree
}
const decimal4Regex = /^\d+(\.\d{1,4})?$/ // 4位小数 const decimal4Regex = /^\d+(\.\d{1,4})?$/ // 4位小数
const decimal2Regex = /^\d+(\.\d{1,2})?$/ // 2位小数 const decimal2Regex = /^\d+(\.\d{1,2})?$/ // 2位小数
......
...@@ -40,6 +40,7 @@ export default defineComponent({ ...@@ -40,6 +40,7 @@ export default defineComponent({
onClose={() => { onClose={() => {
emit('close') emit('close')
}} }}
destroy-on-close={true}
close-on-click-modal={false} close-on-click-modal={false}
{...attrs} {...attrs}
> >
......
...@@ -182,6 +182,7 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -182,6 +182,7 @@ const formConfig = ref<IFormConfig[]>([
{ label: '比例', value: 2 }, { label: '比例', value: 2 },
], ],
onChange: (item: IOption, value: number) => { onChange: (item: IOption, value: number) => {
console.log(185, item)
if (value === 2) { if (value === 2) {
editForm.value.fixedValue = '' editForm.value.fixedValue = ''
editForm.value.fixedWeight = '' editForm.value.fixedWeight = ''
......
...@@ -79,6 +79,7 @@ import { ...@@ -79,6 +79,7 @@ import {
getRuleList, getRuleList,
getPlatformList, getPlatformList,
getLogisticsLog, getLogisticsLog,
getLogisticsCompanyList,
} from '@/api/logistics' } from '@/api/logistics'
import { ISeachFormConfig } from '@/types/searchType' import { ISeachFormConfig } from '@/types/searchType'
import { TableColumn } from '@/components/VxeTable' import { TableColumn } from '@/components/VxeTable'
...@@ -162,8 +163,8 @@ const searchConfig = ref<ISeachFormConfig[]>([ ...@@ -162,8 +163,8 @@ const searchConfig = ref<ISeachFormConfig[]>([
const platformList = ref([]) const platformList = ref([])
const warehouseList = ref([]) const warehouseList = ref([])
const ruleNameList = ref([]) const ruleNameList = ref([])
const logisticsCompanyList = ref([])
const formConfig = ref<IFormConfig[]>([ const formConfig = computed<IFormConfig[]>(() => [
{ title: '物流基础信息' }, { title: '物流基础信息' },
{ {
prop: 'name', prop: 'name',
...@@ -187,7 +188,7 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -187,7 +188,7 @@ const formConfig = ref<IFormConfig[]>([
placeholder: '请选择仓库名称', placeholder: '请选择仓库名称',
label: 'name', label: 'name',
value: 'id', value: 'id',
options: [], options: [...(warehouseList.value || [])],
onChange: (value: { name: string; id: string | number }) => { onChange: (value: { name: string; id: string | number }) => {
editForm.value.warehouseName = value.name editForm.value.warehouseName = value.name
}, },
...@@ -200,6 +201,26 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -200,6 +201,26 @@ const formConfig = ref<IFormConfig[]>([
], ],
}, },
{ {
prop: 'companyId',
type: 'select',
label: '物流公司',
attrs: {
placeholder: '请选择物流公司',
label: 'name',
value: 'id',
options: [...(logisticsCompanyList.value || [])],
onChange: (value: { name: string; id: string | number }) => {
editForm.value.company = value.name
},
},
rules: [
{
required: true,
message: '请选择仓库名称',
},
],
},
{
prop: 'ruleId', prop: 'ruleId',
type: 'select', type: 'select',
label: '申报规则', label: '申报规则',
...@@ -207,7 +228,7 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -207,7 +228,7 @@ const formConfig = ref<IFormConfig[]>([
placeholder: '请选择申报规则', placeholder: '请选择申报规则',
label: 'name', label: 'name',
value: 'id', value: 'id',
options: [], options: [...(ruleNameList.value || [])],
onChange: (value: { name: string; id: string | number }) => { onChange: (value: { name: string; id: string | number }) => {
editForm.value.ruleRef.ruleId = value.id editForm.value.ruleRef.ruleId = value.id
editForm.value.ruleRef.ruleName = value.name editForm.value.ruleRef.ruleName = value.name
...@@ -259,8 +280,10 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -259,8 +280,10 @@ const formConfig = ref<IFormConfig[]>([
}, },
{ {
title: '平台物流名称', title: '平台物流名称',
render: (item, formData) => render: (item, formData) => {
(formData?.platformList as platformObj[])?.map( console.log(283, item, formData)
return (formData?.platformList as platformObj[])?.map(
(item: platformObj, index: number) => ( (item: platformObj, index: number) => (
<div style="display: flex; width:100%"> <div style="display: flex; width:100%">
<el-form-item <el-form-item
...@@ -330,7 +353,8 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -330,7 +353,8 @@ const formConfig = ref<IFormConfig[]>([
</div> </div>
</div> </div>
), ),
), )
},
}, },
]) ])
...@@ -669,6 +693,7 @@ async function getAllList() { ...@@ -669,6 +693,7 @@ async function getAllList() {
getWarehouseList(), getWarehouseList(),
getRuleList(), getRuleList(),
getPlatformList(), getPlatformList(),
getLogisticsCompanyList(),
]) ])
res.forEach((item, index) => { res.forEach((item, index) => {
if (item.code === 200) { if (item.code === 200) {
...@@ -678,22 +703,11 @@ async function getAllList() { ...@@ -678,22 +703,11 @@ async function getAllList() {
ruleNameList.value = item.data || [] ruleNameList.value = item.data || []
} else if (index == 2) { } else if (index == 2) {
platformList.value = item.data platformList.value = item.data
} else if (index == 3) {
logisticsCompanyList.value = item.data
} }
} }
}) })
if (
formConfig.value[2] &&
formConfig.value[3] &&
'attrs' in formConfig.value[2]
) {
// 非空断言强制类型
;(formConfig.value[2]!.attrs as Record<string, unknown>).options = [
...warehouseList.value,
]
;(formConfig.value[3]!.attrs as Record<string, unknown>).options = [
...ruleNameList.value,
]
}
console.log(545, res) console.log(545, res)
} catch (error) { } catch (error) {
......
...@@ -89,6 +89,7 @@ const searchConfig = ref<ISeachFormConfig[]>([ ...@@ -89,6 +89,7 @@ const searchConfig = ref<ISeachFormConfig[]>([
attrs: { attrs: {
placeholder: '请选择物流方式', placeholder: '请选择物流方式',
multiple: true, multiple: true,
clearable: true,
value: 'id', value: 'id',
label: 'name', label: 'name',
collapseTags: true, collapseTags: true,
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
:page-sizes="[100, 200, 300, 400, 500]" :page-sizes="[100, 200, 300, 400, 500]"
background background
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="total" :total="allTotal"
style="margin: 10px auto 0; text-align: right" style="margin: 10px auto 0; text-align: right"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
@close="cancelFn" @close="cancelFn"
> >
<CustomizeForm <CustomizeForm
v-if="formVisible"
ref="editFormRef" ref="editFormRef"
v-model="editForm" v-model="editForm"
:config="formConfig" :config="formConfig"
...@@ -120,6 +121,7 @@ import { ...@@ -120,6 +121,7 @@ import {
importLogisticsQuotation, importLogisticsQuotation,
downloadLogisticsQuotationTemplate, downloadLogisticsQuotationTemplate,
getLogisticsLog, getLogisticsLog,
getlogisticsQuotationPage,
} from '@/api/logistics' } from '@/api/logistics'
import { ISeachFormConfig } from '@/types/searchType' import { ISeachFormConfig } from '@/types/searchType'
import { TableColumn } from '@/components/VxeTable' import { TableColumn } from '@/components/VxeTable'
...@@ -139,32 +141,37 @@ const [searchForm] = useValue({ logisticsIdList: [] }) ...@@ -139,32 +141,37 @@ const [searchForm] = useValue({ logisticsIdList: [] })
const [editForm, resetEditForm] = useValue<LogisticsQuotation>({ const [editForm, resetEditForm] = useValue<LogisticsQuotation>({
unit: 'oz', unit: 'oz',
}) })
const { // const {
loading, // loading,
currentPage, // currentPage,
pageSize, // pageSize,
total, // data,
data, // total,
refresh: search, // refresh: search,
onCurrentPageChange: handleCurrentChange, // onCurrentPageChange: handleCurrentChange,
onPageSizeChange: handleSizeChange, // onPageSizeChange: handleSizeChange,
} = usePageList({ // } = usePageList({
query: (page, pageSize) => // query: (page, pageSize) =>
getlogisticsQuotationList({ // getlogisticsQuotationPage({
...searchForm.value, // ...searchForm.value,
pageSize: pageSize, // pageSize: pageSize,
currentPage: page, // currentPage: page,
}).then(({ data }) => { // }).then(({ data }) => {
console.log(130, data) // return data
return data // }),
}), // })
})
const allTotal = ref(0)
const dialogVisible = ref(false) const dialogVisible = ref(false)
const formVisible = ref(false)
const editFormRef = ref<InstanceType<typeof CustomizeForm> | null>(null) const editFormRef = ref<InstanceType<typeof CustomizeForm> | null>(null)
const selection = ref([]) const selection = ref([])
const mergeCells = ref<VxeTablePropTypes.MergeCells>([]) const mergeCells = ref<VxeTablePropTypes.MergeCells>([])
const tableData = ref<LogisticsQuotation[]>([]) const tableData = ref<LogisticsQuotation[]>([])
const searchConfig = ref<ISeachFormConfig[]>([ const currentPage = ref<number>(1)
const pageSize = ref<number>(100)
const loading = ref<boolean>(false)
const searchConfig = computed<ISeachFormConfig[]>(() => [
{ {
prop: 'logisticsIdList', prop: 'logisticsIdList',
type: 'select', type: 'select',
...@@ -173,11 +180,12 @@ const searchConfig = ref<ISeachFormConfig[]>([ ...@@ -173,11 +180,12 @@ const searchConfig = ref<ISeachFormConfig[]>([
attrs: { attrs: {
placeholder: '请选择物流方式', placeholder: '请选择物流方式',
multiple: true, multiple: true,
clearable: true,
value: 'id', value: 'id',
label: 'name', label: 'name',
collapseTags: true, collapseTags: true,
collapseTagsTooltip: true, collapseTagsTooltip: true,
options: [], options: [...(logisticsWayList.value || [])],
}, },
}, },
]) ])
...@@ -192,7 +200,7 @@ const formConfig = computed(() => [ ...@@ -192,7 +200,7 @@ const formConfig = computed(() => [
placeholder: '请选择物流方式', placeholder: '请选择物流方式',
value: 'name', value: 'name',
label: 'name', label: 'name',
options: [], options: [...(logisticsWayList.value || [])],
disabled: editForm.value?.['id'] ? true : false, disabled: editForm.value?.['id'] ? true : false,
onChange: (val: { name: string; id: number }) => { onChange: (val: { name: string; id: number }) => {
editForm.value['logisticsId'] = val.id editForm.value['logisticsId'] = val.id
...@@ -231,7 +239,7 @@ const formConfig = computed(() => [ ...@@ -231,7 +239,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone1', prop: 'zone1',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 1', label: 'ZONE 1($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 1', placeholder: '请输入ZONE 1',
...@@ -240,7 +248,7 @@ const formConfig = computed(() => [ ...@@ -240,7 +248,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone2', prop: 'zone2',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 2', label: 'ZONE 2($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 2', placeholder: '请输入ZONE 2',
...@@ -249,7 +257,7 @@ const formConfig = computed(() => [ ...@@ -249,7 +257,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone3', prop: 'zone3',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 3', label: 'ZONE 3($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 3', placeholder: '请输入ZONE 3',
...@@ -258,7 +266,7 @@ const formConfig = computed(() => [ ...@@ -258,7 +266,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone4', prop: 'zone4',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 4', label: 'ZONE 4($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 4', placeholder: '请输入ZONE 4',
...@@ -267,7 +275,7 @@ const formConfig = computed(() => [ ...@@ -267,7 +275,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone5', prop: 'zone5',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 5', label: 'ZONE 5($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 5', placeholder: '请输入ZONE 5',
...@@ -276,7 +284,7 @@ const formConfig = computed(() => [ ...@@ -276,7 +284,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone6', prop: 'zone6',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 6', label: 'ZONE 6($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 6', placeholder: '请输入ZONE 6',
...@@ -285,7 +293,7 @@ const formConfig = computed(() => [ ...@@ -285,7 +293,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone7', prop: 'zone7',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 7', label: 'ZONE 7($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 7', placeholder: '请输入ZONE 7',
...@@ -294,7 +302,7 @@ const formConfig = computed(() => [ ...@@ -294,7 +302,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone8', prop: 'zone8',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 8', label: 'ZONE 8($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 8', placeholder: '请输入ZONE 8',
...@@ -303,7 +311,7 @@ const formConfig = computed(() => [ ...@@ -303,7 +311,7 @@ const formConfig = computed(() => [
{ {
prop: 'zone9', prop: 'zone9',
type: 'amountInput', type: 'amountInput',
label: 'ZONE 9', label: 'ZONE 9($)',
attrs: { attrs: {
hasSuffix: false, hasSuffix: false,
placeholder: '请输入ZONE 9', placeholder: '请输入ZONE 9',
...@@ -336,39 +344,39 @@ const tableConfig = ref<TableColumn[]>([ ...@@ -336,39 +344,39 @@ const tableConfig = ref<TableColumn[]>([
}, },
{ {
prop: 'zone1', prop: 'zone1',
label: 'ZONE 1', label: 'ZONE 1($)',
}, },
{ {
prop: 'zone2', prop: 'zone2',
label: 'ZONE 2', label: 'ZONE 2($)',
}, },
{ {
prop: 'zone3', prop: 'zone3',
label: 'ZONE 3', label: 'ZONE 3($)',
}, },
{ {
prop: 'zone4', prop: 'zone4',
label: 'ZONE 4', label: 'ZONE 4($)',
}, },
{ {
prop: 'zone5', prop: 'zone5',
label: 'ZONE 5', label: 'ZONE 5($)',
}, },
{ {
prop: 'zone6', prop: 'zone6',
label: 'ZONE 6', label: 'ZONE 6($)',
}, },
{ {
prop: 'zone7', prop: 'zone7',
label: 'ZONE 7', label: 'ZONE 7($)',
}, },
{ {
prop: 'zone8', prop: 'zone8',
label: 'ZONE 8', label: 'ZONE 8($)',
}, },
{ {
prop: 'zone9', prop: 'zone9',
label: 'ZONE 9', label: 'ZONE 9($)',
}, },
{ {
...@@ -407,47 +415,43 @@ const tableConfig = ref<TableColumn[]>([ ...@@ -407,47 +415,43 @@ const tableConfig = ref<TableColumn[]>([
/** /**
* @description: 监听表格合并单元格数据 * @description: 监听表格合并单元格数据
*/ */
watch( // watch(
() => data.value as LogisticsQuotation[], // () => data.value as LogisticsQuotation[],
(val) => { // (val) => {
console.log(410, 111) // console.log(1111111111111)
try { // const isEqual =
tableData.value = getTableData(val as LogisticsQuotation[]) // JSON.stringify(searchForm.value) ===
// JSON.stringify({ logisticsIdList: [] })
// if (isEqual) {
// tableData.value = [...val]
// allTotal.value = total.value as number
// mergeCells.value = []
// }
// },
// { deep: true },
// )
if (searchForm.value.logisticsIdList?.length) { onMounted(() => {
let startRow = 0 getAllList()
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++) {
newMergeCells.push({
row: startRow,
col: col,
rowspan: rowspan,
colspan: 1,
})
}
startRow += rowspan
}
}
mergeCells.value = newMergeCells async function search() {
loading.value = true
const isEqual =
JSON.stringify(searchForm.value) === JSON.stringify({ logisticsIdList: [] })
try {
if (isEqual) {
await getList()
} else { } else {
mergeCells.value = [] await getSearchList()
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} finally {
loading.value = false
} }
}, }
{ deep: true },
)
onMounted(() => {
getAllList()
})
/** /**
* @description: 转换表格数据 * @description: 转换表格数据
...@@ -469,7 +473,8 @@ function getTableData(arr: LogisticsQuotation[]) { ...@@ -469,7 +473,8 @@ function getTableData(arr: LogisticsQuotation[]) {
*/ */
function cancelFn() { function cancelFn() {
dialogVisible.value = false dialogVisible.value = false
editFormRef.value?.resetFields() // editFormRef.value?.resetFields()
formVisible.value = false
resetEditForm() resetEditForm()
} }
...@@ -544,8 +549,10 @@ const save = debounce(async () => { ...@@ -544,8 +549,10 @@ const save = debounce(async () => {
/** /**
* @description: 新增按钮打开弹窗 * @description: 新增按钮打开弹窗
*/ */
function addDialog() { async function addDialog() {
// await getAllList()
dialogVisible.value = true dialogVisible.value = true
formVisible.value = true
console.log(502, editForm.value) console.log(502, editForm.value)
} }
...@@ -553,25 +560,42 @@ function addDialog() { ...@@ -553,25 +560,42 @@ function addDialog() {
* @description: 删除按钮 * @description: 删除按钮
*/ */
async function deleteFn() { async function deleteFn() {
try {
if (!selection.value.length) { if (!selection.value.length) {
return ElMessage({ return ElMessage({
message: '请选择物流报价', message: '请选择物流报价',
type: 'warning', type: 'warning',
}) })
} }
try {
await showConfirm('是否删除物流报价', { await showConfirm('是否删除物流报价', {
confirmButtonText: '确认', confirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}) })
} catch {
return const isEqual =
} JSON.stringify(searchForm.value) ===
try { JSON.stringify({ logisticsIdList: [] })
const ids = { let ids
if (isEqual) {
ids = {
ids: selection.value.map((item: { id: number }) => item.id).join(','), ids: selection.value.map((item: { id: number }) => item.id).join(','),
} }
} else {
console.log(589, selection.value)
const rateTypes = selection.value.map(
(item: { rateType: string }) => item.rateType,
)
const data = templeData.value.filter((item) =>
rateTypes.includes(item.rateType as string),
)
ids = {
ids: getTableData(data)
.map((item) => item.id)
.join(','),
}
}
await deleteLogisticsQuotation(ids) await deleteLogisticsQuotation(ids)
ElMessage({ ElMessage({
message: '删除成功', message: '删除成功',
...@@ -599,13 +623,12 @@ function handleCheckboxRecords(value: never[]) { ...@@ -599,13 +623,12 @@ function handleCheckboxRecords(value: never[]) {
/** /**
* @description: 获取物流方式列表 * @description: 获取物流方式列表
*/ */
const logisticsWayList = ref([])
async function getAllList() { async function getAllList() {
try { try {
const res = await Promise.all([getlogisticsWayAllList()]) const res = await Promise.all([getlogisticsWayAllList(), getList()])
console.log(545, res) console.log(545, res)
logisticsWayList.value = res[0]?.data || []
searchConfig.value[0].attrs!.options = [...(res[0]?.data || [])]
formConfig.value[0].attrs!.options = [...(res[0]?.data || [])]
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
...@@ -632,7 +655,7 @@ function onBeforeUploadImage(file: File) { ...@@ -632,7 +655,7 @@ function onBeforeUploadImage(file: File) {
async function downloadExcel() { async function downloadExcel() {
try { try {
const res = await downloadLogisticsQuotationTemplate() const res = await downloadLogisticsQuotationTemplate()
console.log(483, data)
const blob = new Blob([res as unknown as BlobPart]) const blob = new Blob([res as unknown as BlobPart])
const filename = '物流报价模版.xlsx' const filename = '物流报价模版.xlsx'
const link = document.createElement('a') const link = document.createElement('a')
...@@ -682,6 +705,75 @@ async function updateExcel(file: { file: File }) { ...@@ -682,6 +705,75 @@ async function updateExcel(file: { file: File }) {
} }
} }
function handleCurrentChange(val: number) {
currentPage.value = val
search()
}
function handleSizeChange(val: number) {
pageSize.value = val
search()
}
async function getList() {
try {
const { data } = await getlogisticsQuotationPage({
...searchForm.value,
pageSize: pageSize.value,
currentPage: currentPage.value,
})
tableData.value = [...(data as { records: LogisticsQuotation[] }).records]
allTotal.value = (data as { total: number }).total
mergeCells.value = []
} catch (error) {
console.log(error)
}
}
const templeData = ref<LogisticsQuotation[]>([])
async function getSearchList() {
try {
const { data } = await getlogisticsQuotationList({
...searchForm.value,
pageSize: pageSize.value,
currentPage: currentPage.value,
})
templeData.value = [...(data as { records: LogisticsQuotation[] }).records]
tableData.value = getTableData([
...(data as { records: LogisticsQuotation[] }).records,
])
allTotal.value = (data as { total: number }).total
let startRow = 0
const newMergeCells = []
console.log(477, tableData.value)
for (
let i = 0;
i < (data as { records: LogisticsQuotation[] }).records.length;
i++
) {
const item = (data as { records: LogisticsQuotation[] }).records[i]
const rowspan = item.logisticsQuotationList?.length || 0
if (rowspan > 0) {
for (let col = 0; col < 5; col++) {
newMergeCells.push({
row: startRow,
col: col,
rowspan: rowspan,
colspan: 1,
})
}
startRow += rowspan
}
}
mergeCells.value = newMergeCells
} catch (error) {
console.log(error)
}
}
/** /**
* @description: 日志弹窗 * @description: 日志弹窗
*/ */
......
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