diff --git a/src/option/base/common-address.js b/src/option/base/common-address.js index 4f431ca..4aeb0fe 100644 --- a/src/option/base/common-address.js +++ b/src/option/base/common-address.js @@ -122,8 +122,7 @@ export const createOption = () => ({ maxlength: 20, formslot: true, rules: [ - { max: 20, message: '联系方式不能超过20个字', trigger: 'blur' }, - { pattern: /^\d*$/, message: '联系方式只能输入数字', trigger: 'blur' }, + { pattern: /^1[3-9]\d{9}$/, message: '联系方式格式不正确', trigger: 'blur' }, ], }, { diff --git a/src/option/business/common.js b/src/option/business/common.js index 6c055d6..7ac8431 100644 --- a/src/option/business/common.js +++ b/src/option/business/common.js @@ -171,7 +171,7 @@ export const nonNegativeRule = label => ({ }); export const phoneRule = label => ({ - pattern: /^(1\d{10}|0\d{2,3}-?\d{7,8})$/, + pattern: /^1[3-9]\d{9}$/, message: `${label}格式不正确`, trigger: 'blur', }); diff --git a/src/option/business/loading-manage.js b/src/option/business/loading-manage.js index c459d5d..6f3e74e 100644 --- a/src/option/business/loading-manage.js +++ b/src/option/business/loading-manage.js @@ -39,7 +39,7 @@ export const loadingManageConfig = { { prop: 'transitAddress', label: '途经地' }, { prop: 'arrivalAddress', label: '到货地' }, { prop: 'carrierName', label: '承运商' }, - { prop: 'transportType', label: '运输类型' }, + { prop: 'transportType', label: '运输方式' }, { prop: 'dataSource', label: '数据来源' }, { prop: 'createTime', label: '创建时间' }, { prop: 'updateTime', label: '更新时间' }, diff --git a/src/option/business/shipping-template.js b/src/option/business/shipping-template.js index 6c95af5..fd40586 100644 --- a/src/option/business/shipping-template.js +++ b/src/option/business/shipping-template.js @@ -15,8 +15,6 @@ const templateTypeOptions = [ export const config = { title: '发货模板', permission: 'shipping_template', - exportUrl: '/blade-transport/shipping-template/export-shipping-template', - exportName: '发货模板', tableColumnOrder: [ 'templateCode', 'templateName', @@ -31,7 +29,7 @@ export const config = { { prop: 'templateCode', label: '模板编号' }, { prop: 'templateName', label: '模板名称' }, { prop: 'templateType', label: '模板类型' }, - { prop: 'transportType', label: '运输类型' }, + { prop: 'transportType', label: '运输方式' }, { prop: 'createUserName', label: '创建人' }, { prop: 'remark', label: '备注' }, { prop: 'updateTime', label: '更新时间' }, @@ -173,6 +171,19 @@ export const option = { rules: selectRule('运输方式'), display: true, }, + { + label: '备注', + prop: 'basicRemark', + type: 'textarea', + minRows: 3, + span: 24, + order: 315, + minWidth: 180, + maxlength: 200, + showWordLimit: true, + rules: textRule('备注', 200), + display: true, + }, { label: '', prop: 'shippingInfoTitle', @@ -259,4 +270,5 @@ export const option = { ]) ), dialogWidth: '96%', + dialogTop: '10px', }; diff --git a/src/option/business/transport-plan.js b/src/option/business/transport-plan.js index bca3550..b4a537c 100644 --- a/src/option/business/transport-plan.js +++ b/src/option/business/transport-plan.js @@ -172,6 +172,7 @@ export const config = { enableTransportPlanForm: true, enableTransportPlanCreateActions: true, enableTransportPlanImport: true, + fixedTransportAddressType: true, transportPlanImportTitle: '导入发货计划', transportPlanTemplateUrl: '/blade-transport/transport-plan/export-template', attachmentTitle: '附件', diff --git a/src/option/business/waybill-manage.js b/src/option/business/waybill-manage.js index 7ecc3c8..dc1d2b4 100644 --- a/src/option/business/waybill-manage.js +++ b/src/option/business/waybill-manage.js @@ -18,6 +18,7 @@ const transportTypeDict = { }; const isEmpty = value => value === undefined || value === null || value === ''; +const normalizeNumericDisplayValue = value => (Number(value) === -1 ? '' : value); const parseJsonArray = value => { if (Array.isArray(value)) return value; @@ -86,7 +87,9 @@ const formatGoodsInfo = row => { const name = getFirstValue(item, ['cargoName', 'goodsName', 'name']); const type = getFirstValue(item, ['cargoType', 'goodsType', 'typeName']); const quantity = joinText([ - getFirstValue(item, ['quantity', 'cargoQuantity', 'goodsQuantity']), + normalizeNumericDisplayValue( + getFirstValue(item, ['quantity', 'cargoQuantity', 'goodsQuantity']) + ), getFirstValue(item, ['quantityUnit', 'cargoUnit', 'unit']), ]); return joinText([name, type, quantity]); @@ -102,17 +105,17 @@ const formatGoodsField = (row, props) => { return goods ? getFirstValue(goods, props) : ''; }; -const formatTransportMode = row => - getFirstValue(row, ['transportModeName', 'transportMode', 'transportWayName', 'transportWay']); - const formatUnitPrice = row => { - const value = getFirstValue(row, ['unitPrice', 'price']); + const value = normalizeNumericDisplayValue(getFirstValue(row, ['unitPrice', 'price'])); const unit = getFirstValue(row, ['priceUnit', 'billingUnit', 'unit']); if (!isEmpty(value)) return unit ? `${value}(${unit})` : value; - const billing = getBillingRows(row).find(item => !isEmpty(item.unitPrice)); + const billing = getBillingRows(row).find( + item => !isEmpty(normalizeNumericDisplayValue(item.unitPrice)) + ); if (!billing) return ''; const billingUnit = getFirstValue(billing, ['priceUnit', 'billingUnit', 'unit']); - return billingUnit ? `${billing.unitPrice}(${billingUnit})` : billing.unitPrice; + const billingPrice = normalizeNumericDisplayValue(billing.unitPrice); + return billingUnit ? `${billingPrice}(${billingUnit})` : billingPrice; }; const formatAmount = (row, props) => getFirstValue(row, props); @@ -176,8 +179,6 @@ const auditColumn = prop => ({ ...auditColumns.find(item => item.prop === prop) export const config = { title: '运单管理', permission: 'waybill_manage', - exportUrl: '/blade-transport/waybill-manage/export-waybill-manage', - exportName: '运单管理', importUrl: '/blade-transport/waybill-manage/import-waybill-manage', defaultForm: { carrierType: '承运商', @@ -332,19 +333,6 @@ export const option = { }, { label: '运输方式', - prop: 'transportMode', - type: 'select', - search: true, - searchOrder: 1, - formatter: row => formatTransportMode(row), - ...transportTypeDict, - minWidth: 130, - addDisplay: false, - editDisplay: false, - viewDisplay: false, - }, - { - label: '运输类型', prop: 'transportType', type: 'select', search: true, @@ -353,7 +341,7 @@ export const option = { order: 850, ...transportTypeDict, minWidth: 130, - rules: selectRule('运输类型'), + rules: selectRule('运输方式'), }, { label: '过程节点', diff --git a/src/utils/validate.js b/src/utils/validate.js index cc55c08..ccba6e7 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -27,7 +27,7 @@ export function isEmail(s) { * @param {*} s */ export function isMobile(s) { - return /^1[0-9]{10}$/.test(s); + return /^1[3-9]\d{9}$/.test(String(s || '').trim()); } /** diff --git a/src/views/base/common-address.vue b/src/views/base/common-address.vue index 2331bb6..d913257 100644 --- a/src/views/base/common-address.vue +++ b/src/views/base/common-address.vue @@ -267,6 +267,7 @@ import { createOption } from '@/option/base/common-address'; import { mapGetters } from 'vuex'; import { downloadXls } from '@/utils/util'; import { getToken } from '@/utils/auth'; +import { isMobile } from '@/utils/validate'; import NProgress from 'nprogress'; import 'nprogress/nprogress.css'; @@ -830,12 +831,8 @@ export default { this.$message.warning('联系人不能超过50个字'); return false; } - if (row.contactPhone && row.contactPhone.length > 20) { - this.$message.warning('联系方式不能超过20个字'); - return false; - } - if (row.contactPhone && !/^\d+$/.test(row.contactPhone)) { - this.$message.warning('联系方式只能输入数字'); + if (row.contactPhone && !isMobile(row.contactPhone)) { + this.$message.warning('联系方式格式不正确'); return false; } if (row.remark && row.remark.length > 200) { diff --git a/src/views/business/common-route.vue b/src/views/business/common-route.vue index f178f76..28680a8 100644 --- a/src/views/business/common-route.vue +++ b/src/views/business/common-route.vue @@ -322,6 +322,7 @@ import { config, excelOption, option } from '@/option/business/common-route'; import { getToken } from '@/utils/auth'; import { openImportDialog } from '@/utils/import-excel'; import { downloadXls } from '@/utils/util'; +import { isMobile } from '@/utils/validate'; import { List, Search } from '@element-plus/icons-vue'; import { mapGetters } from 'vuex'; import NProgress from 'nprogress'; @@ -789,6 +790,14 @@ export default { this.$message.warning('收货地址不能超过255个字符'); return false; } + const invalidPhone = [ + [row.departurePhone, '发货联系方式'], + [row.arrivalPhone, '收货联系方式'], + ].find(([value]) => value && !isMobile(value)); + if (invalidPhone) { + this.$message.warning(`${invalidPhone[1]}格式不正确`); + return false; + } if (row.remark && row.remark.length > 500) { this.$message.warning('备注不能超过500个字符'); return false; diff --git a/src/views/business/components/business-crud-page.vue b/src/views/business/components/business-crud-page.vue index 566395c..7a5928c 100644 --- a/src/views/business/components/business-crud-page.vue +++ b/src/views/business/components/business-crud-page.vue @@ -109,12 +109,8 @@