import request from "@/utils/request";

export function getModelList(query) {
  return request({
    url: '/model/info/list',
    method: 'get',
    params: query
  })
}

export function getModelList2(data) {
  return request({
    url: "model/info/list2",
    method: 'get',
    params:data
  });
}

export function addModel(data) {
  return request.post("model/info", data);
}

export function getServiceApply(id) {
  return request.get(`/pt/service/apply/${id}`);
}

export function delMdid(id) {
  return request({
    url: '/model/info/' + id,
    method: 'delete'
  })
}

export function modelFile(data) {
  return request({
    url: '/model/file',
    method: 'post',
    data: data
  })
}

export function getModelFile(data) {
  return request.post("common/upload", data);
}

export function getModelDetail(id) {
  return request.get(`/model/info/${id}`);
}
// export function getModelDetail(data) {
//   return request({
//     url: "/model/params/allList",
//     method: 'get',
//     params:data
//   });
// }
export function updateModel(data) {
  return request({
    url: '/model/info',
    method: 'put',
    data: data
  })
}
export function getParamsList(query) {
  return request({
    url: '/model/params/allList',
    method: 'get',
    params: query
  })
}
export function changePar(data) {
  return request({
    url: "/model/params/addList",
    method: 'post',
    data:data
  });
}
export function delAllPar(id) {
  return request({
    url: '/model/params/' + id,
    method: 'delete'
  })
}
export function getModelParList(query) {
  return request({
    url: '/model/pargroup/allList',
    method: 'get',
    params: query
  })
}

export function getDataSourceList(query) {
  return request({
    url: '/meta/datasource/list',
    method: 'get',
    params: query
  })
}
export function getDataSourceDe(id) {
  return request.get(`/meta/datasource/${id}`);
}
export function editDataSource(data) {
  return request({
    url: '/meta/datasource',
    method: 'put',
    data: data
  })
}
export function delDataSource(id) {
  return request({
    url: '/meta/datasource/' + id,
    method: 'delete'
  })
}
export function addDataSource(data) {
  return request({
    url: "/meta/datasource",
    method: 'post',
    data:data
  });
}

export function getDataMetaList(query) {
  return request({
    url: '/meta/table/allList',
    method: 'get',
    params: query
  })
}
export function editMeta(data) {
  return request({
    url: '/meta/table',
    method: 'put',
    data: data
  })
}
export function delMeta(id) {
  return request({
    url: '/meta/table',
    method: 'delete',
    params: id
  })
}
export function addMeta(data) {
  return request({
    url: "/meta/table",
    method: 'post',
    data:data
  });
}
export function addPeiList(data) {
  return request({
    url: "/meta/field/addList",
    method: 'post',
    data:data
  });
}
export function getMetaFiele(query) {
  return request({
    url: '/meta/field/allList',
    method: 'get',
    params: query
  })
}
export function delMetaFiled(id) {
  return request({
    url: '/meta/field',
    method: 'delete',
    params: id
  })
}
export function cateTree(query) {
  return request({
    url: '/data/cate/treeselect',
    method: 'get',
    params: query
  })
}
export function addCate(data) {
  return request({
    url: "/data/cate",
    method: 'post',
    data:data
  });
}
export function delCate(id) {
  return request({
    url: '/data/cate/' + id,
    method: 'delete'
  })
}
export function fieldAll(query) {
  return request({
    url: '/data/field/allList',
    method: 'get',
    params: query
  })
}
export function addSet(data) {
  return request({
    url: "/data/set",
    method: 'post',
    data:data
  });
}
export function dataSetList(query) {
  return request({
    url: '/data/set/list',
    method: 'get',
    params: query
  })
}
export function editSet(data) {
  return request({
    url: '/data/set',
    method: 'put',
    data: data
  })
}
export function delSet(id) {
  return request({
    url: '/data/set/' + id,
    method: 'delete'
  })
}
export function fieldAdd(data) {
  return request({
    url: "/data/field/addList",
    method: 'post',
    data:data
  });
}
export function delField(id) {
  return request({
    url: '/data/field/removeOne',
    method: 'delete',
    params: id
  })
}
export function getModelLiu(query) {
  return request({
    url: '/interfaces/cate/treeFlow',
    method: 'get',
    params: query
  })
}
export function addLiu(data) {
  return request({
    url: "/model/flow",
    method: 'post',
    data:data
  });
}
export function getFlow(id) {
  return request.get(`/model/flow//${id}`);
}
export function delFlow(id) {
  return request({
    url: '/model/flow/' + id,
    method: 'delete'
  })
}
export function editFlow(data) {
  return request({
    url: '/model/flow',
    method: 'put',
    data: data
  })
}
export function delFile(id) {
  return request({
    url: '/common/deleteFile',
    method: 'delete',
    params: id
  })
}
export function addGroup(data) {
  return request({
    url: "/model/pargroup",
    method: 'post',
    data:data
  });
}
export function editGroup(data) {
  return request({
    url: '/model/pargroup',
    method: 'put',
    data: data
  })
}
export function delFen(id) {
  return request({
    url: '/model/pargroup/' + id,
    method: 'delete'
  })
}
export function testDatasource(id) {
  return request({
    url: '/meta/datasource/testConnection/' + id,
    method: 'get'
  })
}
export function dataJisql(data) {
  return request({
    url: "/meta/datasource/query",
    method: 'post',
    data:data
  });
}
export function dataJiApi(data) {
  return request({
    url: "/data/set/api",
    method: 'post',
    data:data
  });
}
export function dataJiFile(data) {
  return request({
    url: "/data/set/file",
    method: 'post',
    data:data
  });
}
export function dataJiSql(data) {
  return request({
    url: "/data/set/sql",
    method: 'post',
    data:data
  });
}
export function getDataJiSql(id) {
  return request({
    url: '/data/set/sql/' + id,
    method: 'get'
  })
}
export function getDataJiApi(id) {
  return request({
    url: '/data/set/api/' + id,
    method: 'get'
  })
}
export function getDataJiFile(id) {
  return request({
    url: '/data/set/file/' + id,
    method: 'get'
  })
}
export function getDataJiParam(query) {
  return request({
    url: '/data/set/param/list',
    method: 'get',
    params: query
  })
}
export function getDataJiParamRe(query) {
  return request({
    url: '/data/field/list',
    method: 'get',
    params: query
  })
}
export function addJiFan(data) {
  return request({
    url: "/data/field/addList",
    method: 'post',
    data:data
  });
}
export function addJiCan(data) {
  return request({
    url: "/data/set/param/addList",
    method: 'post',
    data:data
  });
}
export function changeShenhe(query) {
  return request({
    url: '/pt/service/audit',
    method: 'get',
    params: query
  })
}