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位小数
...@@ -489,4 +239,4 @@ export function isDecimal4(value: string) { ...@@ -489,4 +239,4 @@ export function isDecimal4(value: string) {
*/ */
export function isDecimal2(value: string) { export function isDecimal2(value: string) {
return decimal2Regex.test(value) return decimal2Regex.test(value)
} }
\ No newline at end of file
...@@ -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,
......
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