import request from '@/utils/request'

// 查询固定资产列表
export function permanentList(query) {
  return request({
    url: '/asset/permanent/list',
    method: 'get',
    params: query
  })
}
// 查询一张图
export function pictureList(query) {
  return request({
    url: '/open/villageAffairs/public/picturePublicList',
    method: 'get',
    params: query
  })
}
// 新增一张图
export function pictureAdd(data) {
  return request({
    url: '/subcontract/picture/add',
    method: 'post',
    data: data
  })
}
// 修改一张图
export function pictureEdit(data) {
  return request({
    url: '/subcontract/picture/edit',
    method: 'post',
    data: data
  })
}

// 删除一张图
export function pictureRemove(id) {
  return request({
    url: '/subcontract/picture/remove/' + id,
    method: 'get'
  })
}

// 一张图详情
export function pictureGet(query) {
  return request({
    url: '/open/villageAffairs/public/picturePublicDetail',
    method: 'get',
    params: query
  })
}

// 查询合同
export function otherPublicList(query) {
  return request({
    url: '/open/villageAffairs/public/otherPublicList',
    method: 'get',
    params: query
  })
}

// 合同详情
export function otherPublicDetail(query) {
  return request({
    url: '/open/villageAffairs/public/otherPublicDetail',
    method: 'get',
    params: query
  })
}

// 删除合同
export function otherRemove(id) {
  return request({
    url: '/subcontract/other/remove/' + id,
    method: 'get'
  })
}

// 新增一张图
export function otherAdd(data) {
  return request({
    url: '/subcontract/other/add',
    method: 'post',
    data: data
  })
}

// 修改一张图
export function otherEdit(data) {
  return request({
    url: '/subcontract/other/edit',
    method: 'post',
    data: data
  })
}

// 查询合同信息列表
export function contractionList(query) {
  return request({
    url: '/contraction/info/list',
    method: 'get',
    params: query
  })
}
// 新增固定资产
export function addPermanent(data) {
  return request({
    url: '/asset/permanent/add',
    method: 'post',
    data: data
  })
}
// 查询固定资产详细
export function getPermanent(id) {
  return request({
    url: '/asset/permanent/get/' + id,
    method: 'get'
  })
}
// 修改固定资产
export function updatePermanent(data) {
  return request({
    url: '/asset/permanent/edit',
    method: 'post',
    data: data
  })
}
// 删除固定资产
export function delPermanent(id) {
  return request({
    url: '/asset/permanent/remove/' + id,
    method: 'get'
  })
}
//上传全局方法附件
export function commonAttach(data) {
  return request({
    url: '/common/attach',
    method: 'post',
    header: { "Content-Type": 'application/x-www-form-urlencoded' },
    data: data
  })
}
//上传全局方法附件
export function commonUpload(data) {
  return request({
    url: '/common/upload',
    method: 'post',
    header: { "Content-Type": 'application/x-www-form-urlencoded' },
    data: data
  })
}
//查询已上传附件
export const attachmentList = (data) => {
  return request({
    url: '/system/attachment/query',
    method: 'get',
    params: data
  })
}
//删除已上传附件
export function systemAttachment(ids) {
  if (ids != undefined) {
    return request({
      url: '/system/attachment/remove/' + ids,
      method: 'get'
    })
  }
}
// 新增合同信息
export function addInfo(data) {
  return request({
    url: '/contraction/info/add',
    method: 'post',
    data: data
  })
}
// 查询合同信息详细
export function getInfo(id) {
  return request({
    url: '/contraction/info/get/' + id,
    method: 'get'
  })
}
// 删除合同信息
export function delInfo(id) {
  return request({
    url: '/contraction/info/remove/' + id,
    method: 'get'
  })
}
// 修改合同信息
export function updateInfo(data) {
  return request({
    url: '/contraction/info/edit',
    method: 'post',
    data: data
  })
}
// 财务公开列表
export function financePublicList(query) {
  return request({
    url: '/open/villageAffairs/public/financePublicList',
    method: 'get',
    params: query
  })
}
// 零工公开列表
export function tempWorkerPublicList(query) {
  return request({
    url: '/open/villageAffairs/public/tempWorkerPublicList',
    method: 'get',
    params: query
  })
}
// 重大事项公开列表
export function majorEventPublicList(query) {
  return request({
    url: '/open/villageAffairs/public/majorEventPublicList',
    method: 'get',
    params: query
  })
}
// 财务公开详情
export function financePublicDetail(query) {
  return request({
    url: '/open/villageAffairs/public/financePublicDetail',
    method: 'get',
    params: query
  })
}
// 零工公开详情
export function tempWorkerPublicDetail(query) {
  return request({
    url: '/open/villageAffairs/public/tempWorkerPublicDetail',
    method: 'get',
    params: query
  })
}
// 重大事项公开详情
export function majorEventPublicDetail(query) {
  return request({
    url: '/open/villageAffairs/public/majorEventPublicDetail',
    method: 'get',
    params: query
  })
}

//获取区、镇、村地区
export function treeselectByUser(query) {
  return request({
    url: '/system/dept/treeselectByUser',
    method: 'get',
    params: query
  })
}

// 查询部门下拉树结构
export function treeselect() {
  return request({
    url: '/open/depositm/dept/treeselect',
    method: 'get'
  })
}

//获取账套列表
export function listByDeptId(query) {
  return request({
    url: '/finance/book/listByDeptId',
    method: 'get',
    params: query
  })
}

// 切换部门
export function changeDept(query) {
  return request({
    url: '/system/user/changeDept',
    method: 'get',
    params: query
  })
}
// 切换账套
export function changeBook(query) {
  return request({
    url: '/system/user/changeBook',
    method: 'get',
    params: query
  })
}
// 财务公开新增
export function openAdd(data) {
  return request({
    url: '/open/open/add',
    method: 'post',
    data: data
  })
}
// 财务公开修改
export function openEdit(data) {
  return request({
    url: '/open/open/edit',
    method: 'post',
    data: data
  })
}
// 零工公开新增
export function tempWorkerOpenAdd(data) {
  return request({
    url: '/subcontract/tempWorkerOpen/add',
    method: 'post',
    data: data
  })
}
// 零工公开修改
export function tempWorkerOpenEdit(data) {
  return request({
    url: '/subcontract/tempWorkerOpen/edit',
    method: 'post',
    data: data
  })
}
// 重大事项新增
export function majorEventOpenAdd(data) {
  return request({
    url: '/subcontract/majorEventOpen/add',
    method: 'post',
    data: data
  })
}
// 重大事项修改
export function majorEventOpenEdit(data) {
  return request({
    url: '/subcontract/majorEventOpen/edit',
    method: 'post',
    data: data
  })
}
// 财务公开删除
export function openRemove(id) {
  return request({
    url: '/open/open/remove/' + id,
    method: 'get'
  })
}
// 零工公开删除
export function tempWorkerOpenRemove(id) {
  return request({
    url: '/subcontract/tempWorkerOpen/remove/' + id,
    method: 'get'
  })
}
// 零工公开删除
export function majorEventOpenRemove(id) {
  return request({
    url: '/subcontract/majorEventOpen/remove/' + id,
    method: 'get'
  })
}

// 查询零工登记列表
export function listOddjob(query) {
  return request({
    url: '/open/villageAffairs/public/oddjobList',
    method: 'get',
    params: query
  })
}

// 新增零工登记
export function addOddjob(data) {
  return request({
    url: '/subcontract/oddjob/add',
    method: 'post',
    data: data
  })
}

// 修改零工登记
export function updateOddjob(data) {
  return request({
    url: '/subcontract/oddjob/edit',
    method: 'post',
    data: data
  })
}

// 查询零工登记详细
export function getOddjob(id) {
  return request({
    url: '/subcontract/oddjob/get/' + id,
    method: 'get'
  })
}

// 删除零工登记
export function delOddjob(id) {
  return request({
    url: '/subcontract/oddjob/remove/' + id,
    method: 'get'
  })
}

// 财务公开榜
export function financialAmountPublicMonthList(query) {
  return request({
    url: '/open/villageAffairs/public/financialAmountPublicMonthList',
    method: 'get',
    params: query // ?bookId=<账套ID 必填>&yearMonth=<查询年月 必填 yyyy-MM>
  })
}

// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile/get',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile/edit',
    method: 'post',
    data: data
  })
}

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'post',
    params: data
  })
}

// 查询账套基本信息
export function bookInfo(bookId) {
  return request({
    url: `/open/villageAffairs/public/bookInfo/${bookId}`,
    method: 'get',
  })
}

// 查询科目余额表 可分页 需授权
export function trailBalanceList(query) {
  return request({
    url: '/finance/balance/list',
    method: 'get',
    params: query // ?startDate=<开始年月 yyyy-MM>&startSubjectId=<起始科目ID>&endSubjectId=<结束科目ID 如果需要查询单个科目 则设置为和startSubjectId一样即可>&filterZero=<bool 是否过滤掉余额为0结果>&showSubSubject=<bool 是否显示下级科目>&分页参数...
  })
}

export function getLoginBook() {
  return request({
    url: '/finance/book/getLoginBook',
    method: 'get'
  })
}

// 查询投票主题列表
export function listPoll(deptId , query) {
  return request({
    url: `/open/villageAffairs/public/poll/list/${deptId}`,
    method: 'get',
    params: query
  })
}

// 姓名, 账套ID, 身份证, 返回里会有个id字段
export function checkFarmer(data) {
  return request({
    url: '/register/checkFarmer',
    method: 'post',
    data: data,
  })
}

// 查询投票主题详细
export function getPoll(id) {
  return request({
    url: `/open/villageAffairs/public/poll/detail/${id}`,
    method: 'get'
  })
}

// 投票 id为主题ID, option为投票选项ID, 多个用,分隔, userId为认证后的农户ID
export function votePoll(id, data) {
  return request({
    url: `/open/villageAffairs/public/poll/vote/${id}`,
    method: 'post',
    params: data,
  })
}

// 新增投票主题
export function addPoll(data) {
  return request({
    url: '/poll/poll/add',
    method: 'post',
    data: data
  })
}

// 修改投票主题
export function updatePoll(data) {
  return request({
    url: '/poll/poll/edit',
    method: 'post',
    data: data
  })
}

// 删除投票主题
export function delPoll(id) {
  return request({
    url: '/poll/poll/remove/' + id,
    method: 'get'
  })
}

// 发布投票主题
export function publicPoll(id) {
  return request({
    url: '/poll/poll/publicPoll/'+ id,
    method: 'get'
  })
}

// 获取会计科目列表
export const subjectData = (query) => {
  return request({
    url: '/finance/subject/listAll',
    method: 'get',
    params: query
  })
}

//普通明细账接口
export function listNormalDetails(query) {
  return request({
      url: '/finance/balance/listNormalDetails',
      method: 'get',
      params: query
  })
}
//查询凭证信息明细
export const voucherDetail = (data) => {
  return request({
    url: '/finance/voucher/detail',
    method: 'get',
    params: data
  })
}

//统计填报列表数据
export const statisticsList = (data) => {
  return request({
    url: '/entity/statistics/list',
    method: 'get',
    params: data
  })
}

// 删除统计填报列表数据
export function delStatisticsRemove(id) {
  return request({
    url: '/entity/statistics/remove/' + id,
    method: 'get'
  })
}

//统计填报 - 模板
export const entityStatisticsTemplate = (data) => {
  return request({
    url: '/entity/statistics/entityStatisticsTemplate',
    method: 'get',
    params: data
  })
}

//统计填报 -保存模板
export const entityStatisticsSave = (data) => {
  return request({
    url: '/entity/statistics/save',
    method: 'post',
    data: data
  })
}

//统计填报 - 编辑
export const entityStatisticsDetail = (id) => {
  return request({
    url: '/entity/statistics/detail/'+id,
    method: 'get'
  })
}

//阳光村务请求菜单
export function menus(query) {
  return request({
    url: '/system/mobile/menus',
    method: 'get',
    params: query
  })
}

//阳光村务请求菜单
export function nologinMenus(query) {
  return request({
    url: '/open/system/mobile/nologinMenus',
    method: 'get',
    params: query
  })
}

//公章
export function current(query) {
  return request({
    url: '/system/dept/get/current',
    method: 'get',
    params: query
  })
}

//公章
export function updateSeal(data) {
  return request({
    url: '/system/dept/updateSeal/seal',
    method: 'post',
    data: data
  })
}

//公章
export function updateSeal2(data) {
  return request({
    url: '/system/dept/updateSeal/seal2',
    method: 'post',
    data: data
  })
}

//甲方合同网签
export function contractFirstList(query) {
  return request({
    url: '/transaction/contract/firstList',
    method: 'get',
    params: query
  })
}

//乙方合同网签
export function contractSecondList(query) {
  return request({
    url: '/transaction/contract/secondList',
    method: 'get',
    params: query
  })
}

//签名
export function signFirst(data,id) {
  return request({
    url: '/transaction/contract/sign/first/'+id,
    method: 'post',
    data: data
  })
}

//签名
export function signSecond(data,id) {
  return request({
    url: '/transaction/contract/sign/second/'+id,
    method: 'post',
    data: data
  })
}

//甲方合同网签详情
export function contractGet(query,id) {
  return request({
    url: '/transaction/contract/get/'+id,
    method: 'get',
    params:query
  })
}

//线下合同附件列表
export function contractFileList(id) {
  return request({
    url: '/transaction/website/contractFileList/id/'+id,
    method: 'get',
  })
}

//线上合同预览
export function previewContractFile(id) {
  return request({
    url: '/transaction/website/previewContractFile/id/'+id,
    method: 'get',
  })
}

// 查询多标段合同列表
export function listMultiplelots(query) {
  return request({
    url: '/transaction/multiplelots/list',
    method: 'get',
    params: query
  })
}

// 查询多标段合同详情
export function getMultiplelots(query, id) {
  return request({
    url: '/transaction/multiplelots/get/' + id,
    method: 'get',
    params: query
  })
}

// 标段合同甲方签字
export function multipleLotsFirstSign(data, id) {
  return request({
    url: '/transaction/multiplelots/firstSign/' + id,
    method: 'post',
    data: data
  })
}

// 查询标段农户信息
export function listMultipleLotsNh(query) {
  return request({
    url: '/open/home/mobile/multipleLotsNh/list',
    method: 'get',
    params: query
  })
}

// 查询标段农户详情
export function getMultiplelotsNh(query, id) {
  return request({
    url: '/open/home/mobile/multipleLotsNh/get/' + id,
    method: 'get',
    params: query
  })
}

// 标段合同乙方签字
export function multipleLotsSecondSign(data, id) {
  return request({
    url: '/open/home/mobile/multiplelotsnh/secondSign/' + id,
    method: 'post',
    data: data
  })
}

// 查询承包合同列表
export function listCbht(query) {
  return request({
    url: '/service/cbht/list',
    method: 'get',
    params: query
  })
}

// 承包合同甲方签名
export function cbhtFirstSign(data,id) {
  return request({
    url: '/open/home/mobile/cbht/sign/first/' + id,
    method: 'post',
    data: data
  })
}

// 签字流程归档
export function signProcessArchive(id) {
  return request({
    url: '/service/cbht/sign/archive/' + id,
    method: 'get'
  });
}

// 签署合同下载
export function signedContractDownload(id) {
  return request({
    url: '/service/cbht/sign/download/' + id,
    method: 'get'
  });
}

// 签字合同预览
export function viewSignedContract(id) {
  return request({
    url: '/service/cbht/sign/view/' + id,
    method: 'get'
  });
}

// 查询承包合同详细
export function getCbht(query, id) {
  return request({
    url: '/open/home/mobile/cbht/get/' + id,
    method: 'get',
    params: query
  })
}

// 查询承包方信息
export function getCbf(idcard) {
  return request({
    url: '/open/home/mobile/cbf/get/' + idcard,
    method: 'get'
  })
}

// 查询承包合同信息
export function getCbhtList(query) {
  return request({
    url: '/open/home/mobile/cbht/list',
    method: 'get',
    params: query
  })
}

// 承包合同乙方签名
export function cbhtSecondSign(data,id) {
  return request({
    url: '/open/home/mobile/cbht/sign/second/' + id,
    method: 'post',
    data: data
  })
}
// 承包方公示结果签字
export function updateGsjgSign(data) {
  return request({
    url: '/open/home/mobile/updateGsjgSign',
    method: 'post',
    data: data
  })
}

// 附件查询
export function attachmentQuery(query) {
  return request({
    url: '/open/home/mobile/attach/query',
    method: 'get',
    params: query
  })
}

// 附件删除
export function attachmentRemove(ids) {
  return request({
    url: '/open/home/mobile/attach/remove/' + ids,
    method: 'get'
  })
}

// 附件上传
export function attachmentUpload(data) {
  return request({
    url: '/open/home/mobile/common/attach',
    method: 'post',
    header: { "Content-Type": 'application/x-www-form-urlencoded' },
    data: data
  })
}

// 附件上传
export function publicUpload(data) {
  return request({
    url: '/open/villageAffairs/public/upload',
    method: 'post',
    header: { "Content-Type": 'application/x-www-form-urlencoded' },
    data: data
  })
}

// 投诉建议列表
export function adviceList(query) {
  return request({
    url: '/open/villageAffairs/public/adviceList',
    method: 'get',
    params: query
  })
}

// 新增投诉建议
export function addAdvice(data) {
  return request({
    url: '/open/villageAffairs/public/addAdvice',
    method: 'post',
    data: data
  })
}

// 投诉建议详情
export function getAdvice(id) {
  return request({
    url: '/open/villageAffairs/public/getAdvice/'+id,
    method: 'get',
  })
}

// 留言板列表
export function listMessage(query) {
  return request({
    url: '/open/villageAffairs/public/listMessage',
    method: 'get',
    params: query
  })
}

// 留言板新增
export function addMessage(data) {
  return request({
    url: '/open/villageAffairs/public/addMessage',
    method: 'post',
    data: data
  })
}

// 留言板详情
export function getMessage(id) {
  return request({
    url: '/open/villageAffairs/public/getMessage/'+id,
    method: 'get',
  })
}
//e签宝-发包方合同网签
export function eqbFbfhtwq(data){
  return request({
    url: '/open/villageAffairs/public/eqbFbfhtwq',
    method: 'post',
    data: data
  })
}
//e签宝-发包方批量生成签署流程
export function batchEqbContractSignProcess(data){
  return request({
    url: '/service/cbf/batchEqbContractSignProcess',
    method: 'post',
    data: data
  })
}
//e签宝-发包方批量签署
export function batchEqbContractSigning(data){
  return request({
    url: '/service/cbf/batchEqbContractSigning',
    method: 'post',
    data: data
  })
}
//e签宝-合同网签
export function eqbCbfhtwq(data){
  return request({
    url: '/open/villageAffairs/public/eqbCbfhtwq',
    method: 'post',
    data: data
  })
}
// 资源公开
export function orcodeList(query) {
  return request({
    url: '/open/assetresource/orcode/list',
    method: 'get',
    params: query
  })
}

// 资产公开
export function orcodeListZC(query) {
  return request({
    url: '/open/asset/orcode/list',
    method: 'get',
    params: query
  })
}

// 5、合同公开
export function contractionListNew(query) {
  return request({
    url: '/open/contraction/list',
    method: 'get',
    params: query
  })
}

export function listResource(query) {
  return request({
    url: '/asset/resource/list',
    method: 'get',
    params: query
  })
}

export function getResource(id) {
  return request({
    url: '/asset/resource/get/' + id,
    method: 'get'
  })
}

// 资源新增
export function addResource(data) {
  return request({
    url: '/asset/resource/add',
    method: 'post',
    data: data
  })
}

// 资源新增
export function updateResource(data) {
  return request({
    url: '/asset/resource/edit',
    method: 'post',
    data: data
  })
}

// 删除资源性资产
export function delResource(id) {
  return request({
    url: '/asset/resource/remove/' + id,
    method: 'get'
  })
}

