/*
 * @Author: zc
 * @Description: 工单管理
 * @version:
 * @Date: 2022-08-09 16:19:55
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-16 14:49:01
 */
import request from '/@/utils/request';
import qs from 'qs';
/**
 * 列表页面基础数据
 */
export const listBaseData = () => {
	return request({
		url: `/api/v1/Order/base-data`,
		method: 'get',
	});
};
/**
 * 工单列表
 * @param {any} params
 */
export const orderList = (params: any) => {
	return request({
		url: `/api/v1/Order?${qs.stringify(params)}`,
		method: 'get',
	});
};
/**
 * 历史工单
 * @param {object} params
 */
export const historyOrder = (params: object) => {
	return request({
		url: `/api/v1/Order/history`,
		method: 'get',
		params,
	});
};
/**
 * 新增工单
 * @param {object} data
 */
export const orderAdd = (data: object) => {
	return request({
		url: `/api/v1/Order`,
		method: 'post',
		data,
	});
};
/**
 * 更新工单
 * @param {object} data
 */
export const orderEdit = (data: object) => {
	return request({
		url: `/api/v1/Order`,
		method: 'put',
		data,
	});
};
/**
 * 工单详情
 * @param {string} id
 */
export const orderDetail = (id: string | any[]) => {
	return request({
		url: `/api/v1/Order/${id}`,
		method: 'get',
	});
};
/**
 * 删除工单
 * @param {string} id
 */
export const orderDelete = (id: string) => {
	return request({
		url: `/api/v1/Order/${id}`,
		method: 'delete',
	});
};
/**
 * 开始流程
 * @param {string} id 工单id
 * @param {object} data 开启参数
 */
export const orderStartFlow = (id: string, data: object) => {
	return request({
		url: `/api/v1/Order/${id}/startflow`,
		method: 'post',
		data,
	});
};
/**
 * 查询工单办理流程开启参数
 * @param {object}params
 */
export const OrderFlowParams = (params?: object) => {
	return request({
		url: `/api/v1/Order/flow-start`,
		method: 'get',
		params,
	});
};
/**
 * 新增页面基础数据
 * @param {object} params
 */
export const orderBaseDataAdd = (params?: object) => {
	return request({
		url: `/api/v1/Order/base-data-add`,
		method: 'get',
		params,
	});
};
/**
 * 扩展表单页面基础数据
 * @param {object} params
 */
export const orderBaseExt = (params?: object) => {
	return request({
		url: `/api/v1/Order/base-data-ext`,
		method: 'get',
		params,
	});
};
/**
 * 获取热点下一级
 * @param {object} params
 */
export const hotSpotType = (params?: object) => {
	return request({
		url: `/api/v1/HotSpot/children`,
		method: 'get',
		params,
	});
};
