import request from "@/utils/request";
import axios from "axios";
import qs from 'qs'; // 或者使用 URLSearchParams
const api = "/bpm";
const flowApproval = "/flowApproval";
const orgOrganization = '/orgOrganization'
// 解析数据
export function ParsingText(data, fun) {
  axios({
    method: 'post',
    url: '/chat/completions',
    data: data,
    headers: { 'Authorization': 'Bearer sk-064b5c53131c4046883b718f2b31c050' }
  }).then((res) => {
    fun(res)
  })
}


//get 请求

export const splFlvGet = (params = {}, url) => {
  return request({
    url: url,
    method: "get",
    params
  });
};



//get 请求
export const splGet = (params = {}, url) => {
  return request({
    url: api + url,
    method: "get",
    params
  });
};
//post 请求
export const splPost = (data = {}, url) => {
  return request({
    url: api + url,
    method: "post",
    data
  });
};
//put 请求
export const splPut = (data = {}, url) => {
  return request({
    url: api + url,
    method: "put",
    data
  });
};
//put 请求
export const splDelete = (data = {}, url) => {
  return request({

    url: api + url,
    method: "delete",
    data
  });
};




export const submitProcess = (data) => {
  return request({
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: api + '/process/createProcess',
    method: 'post',
    data: qs.stringify(data)
  });
};

export const queryProcessNode = (data) => {
  return request({
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: api + '/process/queryProcessNode',
    method: 'post',
    data: qs.stringify(data)
  });
};
export const queryProcessNodeLog = (data) => {
  return request({
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: api + '/process/queryProcessNodeLog',
    method: 'post',
    data: qs.stringify(data)
  });
};
export const queryProcess = (data) => {
  return request({
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: api + '/process/queryProcess',
    method: 'post',
    data: qs.stringify(data)
  });
};

export const queryUserListByRule = (params) => {
  return request({
    url: flowApproval + '/queryUserListByRule',
    method: 'get',
    params
  });
};
export const queryListByEntity = (params) => {
  return request({
    url: orgOrganization + '/queryListByEntity',
    method: 'get',
    params
  });
};


export const querysingleByEntity = (params) => {
  return request({
    url: orgOrganization + '/querySingleByEntity',
    method: 'get',
    params
  });
};

export const queryUporgsByEntity = (params) => {
  return request({
    url: orgOrganization + '/queryUpOrgsByEntity',
    method: 'get',
    params
  });
};

