import { transaction, dict, file, FileApi } from '@/api'
import request from '@/utils/require'

// /transaction/trademark/get/{id}
// 交易标的--查看--通过主键
export function getTrademark(id) {
	return request({ url: `${transaction}/trademark/get/${id}`, method: 'get' })
}
// ;/transaction/aadekmrrt / update
// 交易标的 - 修改
export function updateTrademark(data) {
	return request({ url: `${transaction}/trademark/update`, method: 'post', data: data })
}
// 导出接口
export function excalOut(apbm) {
	return request({
		url: `${transaction}/trademark/export/${apbm}`,
		method: 'get',
	})
}
//标的列表
// ;/transaction/aadekmrrt / selectPage
// 获取标的列表
export function selectOwnList(data) {
	return request({
		url: `${transaction}/trademark/selectPage?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		method: 'post',
		data,
	})
}
// export function selectOwnList(data) {
// 	return request({
// 		url: `${transaction}/warehousingarrangement/select?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
// 		method: 'post',
// 		data: data,
// 	})
// }
//列表页 删除
export function deleteListItem(data) {
	return request({
		url: `${transaction}/traderule/deleteTradeRule`,
		method: 'post',
		data: data,
	})
}

//字典查品种
export function varietys() {
	return request({
		url: `${dict}/dataDictionary/getDataGroup?groupId=PM001&pdictCode=11`,
		method: 'get',
	})
}

//获取盟市 旗县 下拉数据
// export function getScalePlanCityOptions(data) {
//   return request({
//     url: `${loginUrl}/org/findByPid?parentCode=${data.parentCode}`,
//     method: 'post',
//     data:data
//   })
// }

//详情页 保存
export function getScalePlanInsert(data) {
	return request({
		url: `${transaction}/purchaseplanexecute/insertPurchasePlanExecute`,
		method: 'post',
		data: data,
	})
}
//details默认带出的
export function getMores(data) {
	return request({
		url: `${transaction}/purchaseplanexecute/selectInsertInit`,
		method: 'post',
		data: data,
	})
}
// 查询文件信息
export function downloadFile(id) {
	return request({
		url: `${FileApi}/file/findById?id=${id}`,
		method: 'post',
	})
}
//详情页 修改
export function getScalePlanUpdate(data) {
	return request({
		url: `${transaction}/transaction/traderule/updateTradeRule`,
		method: 'post',
		data: data,
	})
}
export function showMaterialInfo(xzbm) {
	return request({
		url: `${transaction}/client/MaterialManagement/getInformation/${xzbm}`,
		method: 'get',
	})
}
//详情页   下发
export function getScalePlanIssued(data) {
	return request({
		url: `${transaction}/manager/reservePlan/updateStatusByEntity`,
		method: 'post',
		data: data,
	})
}

//详情页  获取详情里的table

export function getScalePlanDetails(id) {
	return request({
		url: `${transaction}/warehousingarrangement/get/${id}`,
		method: 'get',
	})
}
//标的页面
export function DetailsTable(data) {
	return request({
		url: `${transaction}/trademark/selectDetail`,
		method: 'post',
		data: data,
	})
}
//详情页  初始化显示的数据
export function getScalePlanInitDetails(data) {
	return request({
		url: `${transaction}/manager/reservePlan/selectInitData`,
		method: 'post',
		data: data,
	})
}

//计划制定新增  获取品种质量详情
export function getScalePlanDrawUpDetail(data) {
	return request({
		url: `${transaction}/manager/reserveQuality/selectById?lsdjbm=${data.lsdjbm}&lspzbm=${data.lspzbm}&zlbm=${data.zlbm}`,
		method: 'get',
	})
}
//标的新增
export function getScalePlanDrawUpAdd(data) {
	return request({
		url: `${transaction}/trademark/insert`,
		method: 'post',
		data: data,
	})
}
//品种下拉框
export function findByPid(pid) {
	return request({
		url: `${dict}/dataDictionaryGroup/findByPidList/${pid}`,
		method: 'get',
	})
}
//等级下拉框
export function findByGroupId(groupId) {
	return request({
		url: `${dict}/dataDictionary/findByGroupId/${groupId}`,
		method: 'get',
	})
}
//获取质量和品质
export function getDataGroups(data) {
	return request({
		url: `${dict}/dataDictionary/getDataGroup/${data.groupId}/${data.pdictCode}`,
		method: 'get',
	})
}

//获取本单位名称
export function findByCode(orgCode) {
	return request({
		url: `${dict}/org/findByCode/${orgCode}`,
		method: 'get',
	})
}
//文件回显
export function fileInfo(data) {
	return request({
		url: `${file}/file/findByIds?ids=${data}`,
		method: 'get',
	})
}

//批量删除
export function deleteTrade(data) {
	return request({
		url: `${transaction}/trademark/deleteTrade/${data}`,
		method: 'delete',
		// data: data
	})
}

