// 详情和审批
export function getDetailAndApproveOption() {
	let option_detail = [{
			text: '详情',
			style: {
				backgroundColor: '#3C9CFF'
			}
		},
		{
			text: '提交\n审批',
			style: {
				backgroundColor: '#00CC33'
			}
		},
		{
			text: '关闭',
			style: {
				backgroundColor: '#ff0000'
			}
		}
	];
	return option_detail;
}
//详情、审批通过、审批驳回
export function getDetailAndApprovePassAndApproveNoOption() {
	let option_detail = [{
			text: '详情',
			style: {
				backgroundColor: '#3C9CFF'
			}
		},
		{
			text: '审批\n通过',
			style: {
				backgroundColor: '#00CC33'
			}
		},
		{
			text: '审批\n驳回',
			style: {
				backgroundColor: '#F56C6C'
			}
		},
		{
			text: '关闭',
			style: {
				backgroundColor: '#ff0000'
			}
		}
	];
	return option_detail;
}
//详情、处理、审批不通过
export function getDetailAndHandleOption() {
	let option_detail = [{
			text: '详情',
			style: {
				backgroundColor: '#3C9CFF'
			}
		},
		{
			text: '处理',
			style: {
				backgroundColor: '#00CC33'
			}
		},
		{
			text: '关闭',
			style: {
				backgroundColor: '#ff0000'
			}
		}
	];
	return option_detail;
}
//详情、重新添加、关闭
export function getDetailAndAddAndCloseOption() {
	let option_detail = [{
			text: '详情',
			style: {
				backgroundColor: '#3C9CFF'
			}
		},
		{
			text: '重新\n添加',
			style: {
				backgroundColor: '#E6A23C'
			}
		},
		{
			text: '关闭',
			style: {
				backgroundColor: '#F56C6C'
			}
		}
	];
	return option_detail;
}
// 采购退货返回侧滑按钮 详情 、编辑、库位、移除
export function getPurchaseReceiptOption(allowModifyQty, allowModifyLocation) {
	var option = []
	option.push(...getDetailOption())
	if (allowModifyQty == "TRUE") {
		option.push(...getEditOption())
	}
	if (allowModifyLocation == "TRUE") {
		option.push(...getLocationOption())
	}
	option.push(...getRemoveOption())
	return option;
}

//详情
export function getDetailOption() {
	let option_detail = [{
		text: '详情',
		style: {
			backgroundColor: '#3C9CFF'
		}
	}];
	return option_detail;
}

//详情移除(扫描后不允许修改数量)
export function getDetailRemoveOption() {
	let option_detail_edit_remove = [{
			text: '详情',
			style: {
				backgroundColor: '#3C9CFF'
			}
		},
		{
			text: '移除',
			style: {
				backgroundColor: '#F56C6C'
			}
		}
	];
	return option_detail_edit_remove;
}

export function getRemoveOption() {
	let option_detail_remove = [{
		text: '移除',
		style: {
			backgroundColor: '#F56C6C'
		}
	}];
	return option_detail_remove;
}

export function getAddAgainOption() {
	let option_detail_remove = [{
		text: '详情',
		style: {
			backgroundColor: '#3C9CFF'
		}
	}, {
		text: '重新\n添加',
		style: {
			backgroundColor: '#E6A23C'
		}
	}];
	return option_detail_remove;
}



export function getEditOption() {
	let option_detail_edit = [{
		text: '编辑',
		style: {
			backgroundColor: '#F1A532'
		}
	}];
	return option_detail_edit;
}
export function getLocationOption() {
	let option_detail_location = [{
		text: '库位',
		style: {
			backgroundColor: '#00A3FF'
		}
	}];
	return option_detail_location;
}


//清空
export function getClearOption() {
	let option_detail_edit_remove = [{
		text: '清空',
		style: {
			backgroundColor: '#F56C6C'
		}
	}];
	return option_detail_edit_remove;
}


//详情编辑移除
export function getDetailEditRemoveOption() {
	let option_detail_edit_remove = [{
			text: '详情',
			style: {
				backgroundColor: '#3C9CFF'
			}
		},
		{
			text: '编辑',
			style: {
				backgroundColor: '#F1A532'
			}
		},
		{
			text: '移除',
			style: {
				backgroundColor: '#F56C6C'
			}
		}
	];
	return option_detail_edit_remove;
}


//详情编辑放弃
export function getDetailGiveupOption() {
	let option_detail_giveup = [{
			text: '详情',
			style: {
				backgroundColor: '#3C9CFF'
			}
		},
		{
			text: '放弃',
			style: {
				backgroundColor: '#F56C6C'
			}
		}
	];
	return option_detail_giveup;
}



//详情编辑移除
export function getEditRemoveOption() {
	let option_edit_remove = [{
			text: '编辑',
			style: {
				backgroundColor: '#F1A532'
			}
		},
		{
			text: '移除',
			style: {
				backgroundColor: '#F56C6C'
			}
		}
	];
	return option_edit_remove;
}


// 库存状态字典项
export function getInventoryStatusArray() {
	let array = [{
		text: '待检',
		value: "INSP"
	}, {
		text: '合格',
		value: "OK"
	}, {
		text: '不合格',
		value: "NOK"
	}, {
		text: '隔离',
		value: "HOLD"
	}, {
		text: '报废',
		value: "SCRAP"
	}]
	return array;
}

// 业务类型字典项
export function getBusinessTypeArray() {
	let array = [{
		text: '供应商发货',
		value: "SupplierDeliver"
	}, {
		text: '采购收货',
		value: "PurchaseReceipt"
	}, {
		text: '采购退货',
		value: "PurchaseReturn"
	}, {
		text: '采购上架',
		value: "PurchasePutaway"
	}]
	return array;
}

export function getLocationTypeArray(data) {
	var list = []
	if (data == undefined || data == null || data == "") {
		return list
	}

	if (data.indexOf(',') < 0) {
		list.push(data)
	} else {
		var arrayItems = data.split(',')
		arrayItems.forEach(res => {
			list.push(res)
		})
	}

	return list
}