import request from "@/utils/request";
import { useAppStore } from "@/stores/app";
import { useUserStore } from "@/stores/user";

const appStore = useAppStore()
const userStore = useUserStore()

/**
 * 获取当前督察组
 * @param {*} pid 督察类型
 */
export function getCurrGroup(pid) {
    return request({
        url: '/dc/insp/base/getCurrGroup',
        method: 'GET',
        params: { pid }
    })
}

/**
 * 获取历史稽察年份数据
 * @param {*} pid 督察类型
 */
export function getInspBaseByPersid(pid) {
    const ownApp = appStore.ownApp
    const userid = userStore.userId
    return request({
        url: '/dc/insp/base/getByPersid',
        method: 'GET',
        params: { pid, ownApp, userid, tabType: 0 }
    })
}

/**
 * 稽察获取分组下的任务
 * @param {分组ID} groupId 
 */
export function getObjectList(groupId) {
    const userid = userStore.userId
    return request({
        url: '/tac/insp/year/batch/obj/getObjList',
        method: 'POST',
        data: {"limit":-1,"pageNum":1,"pageSize":200,"groupId":groupId,"inspType":"","mainType":false,"ojbNm":"","persId":userid,"prjType":"","type":""}
    })
}

/**
 * 稽察获取问题列表
 * @param {任务ID} rgstrId
 * @param {问题类型} listType（1 前期与设计专业；2 建设管理专业；3 计划下达与执行专业；4 资金使用与管理专业；5 工程质量专业；6 工程安全专业）
 */
export function getTacQuestionList(rgstrId) {
    return request({
        url: '/tac/pblm/info/page',
        method: 'POST',
        data: {"listType":"","pageNum":1,"pageSize":200,"realPageNum":0,"rgstrId":rgstrId}
    })
}
