Commit 99679c94 by linjinhong

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

parent 093705dc
......@@ -67,6 +67,10 @@ export function getWarehouseList() {
export function getPlatformList() {
return axios.get<never, BaseRespData<never>>('/logisticsWay/platform')
}
//获取物流公司列表
export function getLogisticsCompanyList() {
return axios.get<never, BaseRespData<never>>('/logisticsCompany/all_options')
}
/**
* @description 发货地址
......@@ -120,6 +124,7 @@ export function deleteAddressByIds(params: { ids: string }) {
export function getlogisticsWayAllList() {
return axios.get<never, BaseRespData<never>>('/logisticsWay/all_list', {})
}
//物流报价列表
export function getlogisticsQuotationList(params: {
logisticsIdList?: number[]
......@@ -131,6 +136,16 @@ export function getlogisticsQuotationList(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) {
return axios.post<never, BaseRespData<never>>(
......
......@@ -64,6 +64,7 @@ const iptFn = (e: string) => {
if (decimalCount > 1) {
// 如果小数点个数大于1,则将多余的小数点替换为空字符串
val.value = e.replace(/\./g, (match: string, offset: number) => {
console.log(67, match)
return offset === e.lastIndexOf('.') ? '.' : ''
})
} else {
......
......@@ -17,6 +17,43 @@ const menu: MenuItem[] = [
// 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',
id: 13,
label: '库存',
......@@ -49,6 +86,7 @@ const menu: MenuItem[] = [
},
],
},
{
index: '1',
id: 2,
......@@ -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: '',
// id: 3,
......
......@@ -2,6 +2,7 @@ export interface BaseRespData<D> {
code: number
message?: string
data: D
total?: number
}
export interface PaginationData<D> {
......
......@@ -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 判断是否为数字
* @param value
* @returns {boolean}
......@@ -93,7 +84,7 @@ export function isAlphabets(value: string) {
* @param value
* @returns {boolean}
*/
export function isString(value: any) {
export function isString(value: unknown) {
return typeof value === 'string' || value instanceof String
}
......@@ -112,7 +103,7 @@ export function isArray(arg: string | (string | number)[]) {
* @description 判断是否是对象
* @param arg
*/
export function isObject(arg: any) {
export function isObject(arg: unknown) {
return Object.prototype.toString.call(arg) === '[object Object]'
}
......@@ -229,247 +220,6 @@ export function isJson(value: string | null) {
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 decimal2Regex = /^\d+(\.\d{1,2})?$/ // 2位小数
......
......@@ -40,6 +40,7 @@ export default defineComponent({
onClose={() => {
emit('close')
}}
destroy-on-close={true}
close-on-click-modal={false}
{...attrs}
>
......
......@@ -182,6 +182,7 @@ const formConfig = ref<IFormConfig[]>([
{ label: '比例', value: 2 },
],
onChange: (item: IOption, value: number) => {
console.log(185, item)
if (value === 2) {
editForm.value.fixedValue = ''
editForm.value.fixedWeight = ''
......
......@@ -79,6 +79,7 @@ import {
getRuleList,
getPlatformList,
getLogisticsLog,
getLogisticsCompanyList,
} from '@/api/logistics'
import { ISeachFormConfig } from '@/types/searchType'
import { TableColumn } from '@/components/VxeTable'
......@@ -162,8 +163,8 @@ const searchConfig = ref<ISeachFormConfig[]>([
const platformList = ref([])
const warehouseList = ref([])
const ruleNameList = ref([])
const formConfig = ref<IFormConfig[]>([
const logisticsCompanyList = ref([])
const formConfig = computed<IFormConfig[]>(() => [
{ title: '物流基础信息' },
{
prop: 'name',
......@@ -187,7 +188,7 @@ const formConfig = ref<IFormConfig[]>([
placeholder: '请选择仓库名称',
label: 'name',
value: 'id',
options: [],
options: [...(warehouseList.value || [])],
onChange: (value: { name: string; id: string | number }) => {
editForm.value.warehouseName = value.name
},
......@@ -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',
type: 'select',
label: '申报规则',
......@@ -207,7 +228,7 @@ const formConfig = ref<IFormConfig[]>([
placeholder: '请选择申报规则',
label: 'name',
value: 'id',
options: [],
options: [...(ruleNameList.value || [])],
onChange: (value: { name: string; id: string | number }) => {
editForm.value.ruleRef.ruleId = value.id
editForm.value.ruleRef.ruleName = value.name
......@@ -259,8 +280,10 @@ const formConfig = ref<IFormConfig[]>([
},
{
title: '平台物流名称',
render: (item, formData) =>
(formData?.platformList as platformObj[])?.map(
render: (item, formData) => {
console.log(283, item, formData)
return (formData?.platformList as platformObj[])?.map(
(item: platformObj, index: number) => (
<div style="display: flex; width:100%">
<el-form-item
......@@ -330,7 +353,8 @@ const formConfig = ref<IFormConfig[]>([
</div>
</div>
),
),
)
},
},
])
......@@ -669,6 +693,7 @@ async function getAllList() {
getWarehouseList(),
getRuleList(),
getPlatformList(),
getLogisticsCompanyList(),
])
res.forEach((item, index) => {
if (item.code === 200) {
......@@ -678,22 +703,11 @@ async function getAllList() {
ruleNameList.value = item.data || []
} else if (index == 2) {
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)
} catch (error) {
......
......@@ -89,6 +89,7 @@ const searchConfig = ref<ISeachFormConfig[]>([
attrs: {
placeholder: '请选择物流方式',
multiple: true,
clearable: true,
value: 'id',
label: 'name',
collapseTags: true,
......
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