/*
 *    Copyright (c) 2018-2025, hnqz All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: hnqz
 */

import request from '@/router/axios';

// 导出汇总报告
export function taskExportNbqybg(query) {
  return request({
    url: '/admin/wmtask/exportNba',
    method: 'get',
    params: query
  });
}
// 导出汇总报告
export function taskExportExcelNbqybg(query) {
  return request({
    url: '/admin/report/excel/export/exportNba',
    method: 'get',
    params: query
  });
}

// 分页查询
export function selectWmScorePackageLists(query) {
  return request({
    url: '/admin/wmscorepackage/selectWmScorePackageLists',
    method: 'get',
    params: query
  });
}

//新增
export function saves(obj) {
  return request({
    url: '/admin/wmscorepackage/saves',
    method: 'post',
    data: obj
  });
}

// 编辑
export function updateByIds(obj) {
  return request({
    url: ' /admin/wmscorepackage/updateByIds',
    method: 'post',
    data: obj
  });
}

// 终止
export function updateStatusByIds(obj) {
  return request({
    url: ' /admin/wmscorepackage/updateStatusByIds',
    method: 'post',
    data: obj
  });
}
// 终止
export function stopWmScorePackage(obj) {
  return request({
    url: '/admin/wmscorepackage/stopWmScorePackage',
    method: 'post',
    data: obj
  });
}

// 关联积分包
export function lists(query) {
  return request({
    url: '/admin/wmscorepackage/lists',
    method: 'get',
    params: query
  });
}

export function selectKfpjf(query) {
  return request({
    url: '/admin/wmscorepackage/selectKfpjf',
    method: 'get',
    params: query
  });
}

// 接包对象
export function listCso(query) {
  return request({
    url: '/admin/wmdaagent/listCso',
    method: 'get',
    params: query
  });
}

export function listcsos(scoreId) {
  return request({
    url: '/admin/wmdaagent/listcsos?scoreId=' + scoreId,
    method: 'get'
  });
}

// 查看
export function selectWmScorePackage(obj) {
  return request({
    url: ' /admin/wmscorepackage/selectWmScorePackage',
    method: 'post',
    data: obj
  });
}

// 积分包任务类型
export function remote(type) {
  return request({
    url: '/admin/dict/type/' + type,
    method: 'get'
  });
}

// 有效任务类型
export function scoreTasktype(type) {
  return request({
    url: '/admin/dict/type/' + type,
    method: 'get'
  });
}

// 根据积分包任务类型 展示 可选的有效任务类型
export function showTask(value) {
  return request({
    url: '/admin/dict/types?value=' + value,
    method: 'get'
  });
}

//关联服务企业
export function listCsoById(query) {
  return request({
    url: '/admin/wmdaagent/listCsoById',
    method: 'get',
    params: query
  });
}

// 发包管理服务企业
export function getListAncestorApi(query) {
  return request({
    url: '/admin/dept/list/ancestor',
    method: 'get',
    params: query
  });
}

// 根据关联服务企业显示对应得积分包
export function selectRelationScoreId(query) {
  return request({
    url: ' /admin/wmscorepackage/selectRelationScoreId',
    method: 'get',
    params: query
  });
}

export function getTaskTree(query) {
  return request({
    url: '/admin/wmtasktype/getTaskTree',
    method: 'get',
    params: query
  });
}

// 保存

export function settleSave(obj) {
  return request({
    url: '/admin/wmscorepackage/p2p/amount',
    method: 'put',
    data: obj
  });
}

//
export function taskStatisticsApi(pacakgeId) {
  return request({
    url: `/admin/dept-task/task-statistics/${pacakgeId}`,
    method: 'get'
  });
}

// 导出新版汇总报告
export function taskNewExportNbqybg(query) {
  return request({
    url: '/admin/reportExport/new-nba-export',
    method: 'get',
    params: query
  });
}

// 导出汇总报告
export function taskExportNewExcelNbqybg(query) {
  return request({
    url: '/admin/reportExport/new-excel-export',
    method: 'get',
    params: query
  });
}

export function getSysFileApi(file_id) {
  return request({
    url: `/admin/sys-file/get/${file_id}`,
    method: 'get',
    responseType: 'arraybuffer'
  });
}

export function pkgInfoExportApi() {
  return request({
    url: `/admin/pkg/info/export`,
    method: 'get',
    responseType: 'arraybuffer'
  });
}
