【类 型】:factor
【主 题】:重写questAss函数 【描 述】: [原因]:可接收字符串或者数组 数组可更改多字段内容 [过程]: [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
d15c3bc753
commit
015486c544
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user