From 015486c544708ae6fa92c890e3120f5182064f58 Mon Sep 17 00:00:00 2001 From: tk Date: Fri, 12 Jul 2024 18:28:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afactor=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E9=87=8D=E5=86=99questAss=E5=87=BD=E6=95=B0=20?= =?UTF-8?q?=E3=80=90=E6=8F=8F=09=E8=BF=B0=E3=80=91=EF=BC=9A=20=09[?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0]=EF=BC=9A=E5=8F=AF=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=88=96=E8=80=85=E6=95=B0=E7=BB=84?= =?UTF-8?q?=20=20=E6=95=B0=E7=BB=84=E5=8F=AF=E6=9B=B4=E6=94=B9=E5=A4=9A?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=86=85=E5=AE=B9=20=09[=E8=BF=87=E7=A8=8B]?= =?UTF-8?q?=EF=BC=9A=20=09[=E5=BD=B1=E5=93=8D]=EF=BC=9A=20=E3=80=90?= =?UTF-8?q?=E7=BB=93=09=E6=9D=9F=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- src/utils/api/table.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/utils/api/table.js b/src/utils/api/table.js index 86d822c..fa8eb47 100644 --- a/src/utils/api/table.js +++ b/src/utils/api/table.js @@ -20,16 +20,28 @@ export async function apiCrosFrequency (params) { return res } /** - * @description: 向改变订单承接任务api 提交数据 () ,并更新订单列表 + * @description: 向改变订单承接任务api 提交数据,参数可以是数组 提交多个字段和字段内容 () ,并更新订单列表 * @param {*} id 订单id - * @param {*} statusType 主状态"main_status" 货物状态"shipment_status" 退款状态"refund_status" - * @param {*} val 修改字段的值 + * @param {array string} type 主状态"main_status" 货物状态"shipment_status" 退款状态"refund_status" 执行飞机"by_plane_id" + * @param {array string} val 修改字段的值 ps:by_plane_id值给'null' 字符串或者留空 数据库改为null */ -export async function questAss (id, statusType, val) { +export async function questAss (id, type, val) { const params = new URLSearchParams()// post对象参数 转成 字符串连接 params.append('id', id) - params.append('state', statusType) - params.append('val', val) + // 判断 type 和 val 是否为数组 + if (Array.isArray(type) && Array.isArray(val)) { + if (type.length !== val.length) { + return + } + for (let i = 0; i < type.length; i++) { + params.append(type[i], val[i] === '' ? 'null' : val[i]) + } + } else if (typeof type === 'string' && typeof val === 'string') { + params.append(type, val === '' ? 'null' : val) + } else { + return + } + const res = await api.post('questAss', params) if (res.data.status === 1) { Message.success(res.data.msg)