import request from '@/router/axios';

//分页获取清表
export const getList = (params) => {
    return request({
        url: '/api/blade-manager/exceltab/list',
        method: 'get',
        params
    })
}

// 关联清表树all
export const tabLazytreeAll = (params) => {
    return request({
        url: '/api/blade-manager/exceltab/tab-lazytree-all',
        method: 'get',
        params
    })
};



//清表树
export const tabLazytree = (params) => {
    return request({
        url: '/api/blade-manager/exceltab/tab-lazytree',
        method: 'get',
        params
    })
};

//获取列表信息
export const detailExcel = (params) => {
    return request({
        url: '/api/blade-manager/exceltab/detail',
        method: 'get',
        params
    })
}

//元素识别获取列表信息
export const getExcelHtmlCol = (params) => {
    return request({
        url: '/api/blade-manager/exceltab/get-excel-html-col',
        method: 'get',
        params
    })
}

//清表编辑 wbs 下拉框选择
export const getWbsTypeList = (params) => {
    return request({
        url: '/api/blade-manager/exceltab/getWbsTypeList',
        method: 'get',
        params
    })
}

//清表类型
export const excelType = (params) => {
    return request({
        url: ' /api/blade-system/dict-biz/dictionary',
        method: 'get',
        params
    })
}
//清表类型1
export const excelType1 = (params) => {
    return request({
        url: ' api/blade-system/dict/dictionary',
        method: 'get',
        params
    })
}

//懒加载节点树形结构
export const wbstree = (params) => {
    return request({
        url: ' /api/blade-manager/exceltab/lazy-tree',
        method: 'get',
        params
    })
}

//wbs树获取表
export const selectByNodeTable = (params) => {
    return request({
        url: ' /api/blade-manager/exceltab/selectByNodeTable',
        method: 'get',
        params
    })
}

// 添加编辑清表
export const Excelmodify = (row) => {
    return request({
        url: '/api/blade-manager/exceltab/sava-dataInfo',
        method: 'post',
        data: row
    })
}

// 上传清表
export const uploadExcel = (row) => {
    return request({
        // ty  application/json
        url: '/api/blade-manager/exceltab/put-file-attach',
        method: 'post',
        data: row
    })
}

// 删除excel文件
export const deleteExcel = (row) => {
    return request({
        url: '/api/blade-manager/exceltab/update',
        method: 'post',
        data: row
    })
}
//删除模板
export const deleteExcelmodel = (row) => {
    return request({
        url: '/api/blade-manager/exceltab/delete-template',
        method: 'post',
        data: row
    })
}
export const deleteExcelshu = (ids) => {
    return request({
        url: '/api/blade-manager/exceltab/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}

//关联清表保存
export const saveLinkTab = (params) => {
    return request({
        url: ' /api/blade-manager/exceltab/save-linkTab',
        method: 'get',
        params
    })
}

// 元素关联清表
export const savelinktableInfo = (params) => {
  return request({
    url: ' /api/blade-manager/exceltab/save-link-tableInfo',
    method: 'get',
    params
  })
}


//清表生成html
export const getExcelHtml = (params) => {
    return request({
        url: ' /api/blade-manager/exceltab/get-excel-html',
        method: 'get',
        params
    })
}

//清表生成html
export const submitExcelRelationWbsTreeAndElement = (data) => {
    return request({
        url: ' /api/blade-manager/wbsFormElement/submit-excel-relation-wbsTree-element',
        method: 'post',
        data
    })
}

//取消关联
export const cancelRelation = (params) => {
    return request({
        url: ' /api/blade-manager/wbsFormElement/cancel-relation',
        method: 'get',
        params
    })
}

//保存关联
export const saveRelation = (id,excelTabId,elementList) => {
    return request({
      url: '/api/blade-manager/wbsFormElement/save-relation',
      method: 'post',
      data: {
        id,
        excelTabId,
        elementList
      }
    })
}

export const getLazytree = (params) => {
    return request({
        url: '/api/blade-manager/wbsTree/lazy-tree',
        method: 'get',
        params
    })
}

//查看节点下已关联的元素表信息
export const searchNodeTables = (nodeId,excelTabId) => {
    return request({
        url: ' /api/blade-manager/wbsFormElement/get-node-tables',
        method: 'get',
        params:{
            nodeId,
            excelTabId
        }
    })
}

// 上传导入模板
export const uploadcoverfileExcel = (row) => {
    return request({
        // ty  application/json
        url: '/api/blade-manager/exceltab/put-coverfile-attach',
        method: 'post',
        data: row
    })
}
// 批量上清表
export const batchUploadExcelTab = (row) => {
    return request({
  // ty  application/json
        url: '/api/blade-manager/exceltab/batchUploadExcelTab',
        method: 'post',
   
        data: row,
     
    })
}
export const exctabcellSave = (row) => {
    return request({
      url: '/api/blade-manager/exctabcell/save',
      method: 'post',
      data: row
    })
  }

export const exctabcellRemove = (ids) => {
    return request({
        url: '/api/blade-manager/exctabcell/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}

export const exctabcellUpdate = (row) => {
    return request({
        url: '/api/blade-manager/exctabcell/update',
        method: 'post',
        data: row
    })
}

export const downExcelFile = (fileId) => {
    return request({
      url: '/api/blade-manager/exceltab/down-Excel-file',
      method: 'get',
      params: {
        fileId,
      },
      responseType: 'arraybuffer'
    })
}
//下载模板
export const downExcelFileModel = (fileId) => {
    return request({
      url: '/api/blade-manager/exceltab/down-template-file',
      method: 'get',
      params: {
        fileId,
      },
      responseType: 'arraybuffer'
    })
}
//清表模板树节点排序
export const exctabSort = (form) => {
    return request({
        url: '/api/blade-manager/exceltab/tab-sort',
        method: 'post',
        params: form
    })
}
//元素识别关联公共WBS模板-查询节点下已关联的所有表单并按照所属方分组
export const getNodeGroupTables = (form) => {
    return request({
        url: '/api//blade-manager/wbsFormElement/get-group-node-tables',
        method: 'get',
        params: form
    })
}
//元素识别关联公共WBS模板-查询节点下是否存在当前元素表
export const checkTableExist = (form) => {
    return request({
        url: '/api/blade-manager/wbsFormElement/checkTableExist',
        method: 'get',
        params: form
    })
}

//清表模板详情
export const getTemplateExcelDetail = (form) => {
    return request({
        url: '/api/blade-manager/exceltab/templateExcelDetail',
        method: 'get',
        params: form
    })
}