import CellsysUser from "@airkoon/cellsys/cellsysUser.js"; import { QueryType } from "@airkoon/cellsys/cellsysUtil"; import { Query, QueryTask } from "./artUtil"; import { artApi } from "./artApi"; import RepairFileAudit from "./repairFileAudit"; import RepairPlanAudit from "./repairPlanAudit"; import SynergyAudit from "./synergyAudit"; class ArtUser extends CellsysUser { constructor(params = {}) { super(params); } //查询修复档案归档申请列表 queryRepairFileArchive(params = {}) { let { pageInfo, order, filters } = params; let query = new Query(); if (pageInfo) { query.setCurrPage(pageInfo.currPage); query.setPageSize(pageInfo.pageSize); } query.addFilter("status", "=", 0); //查询审核中的记录 if (filters && filters.length > 0) { filters.forEach((item) => { query.addFilter(item["name"], item["operator"], item["value"]); }); } let queryTask = new QueryTask( artApi.viewRepairRecordArchiveReview, !!pageInfo ); return new Promise((resolve, reject) => { queryTask .execute(query) .then((res) => { if (pageInfo) { if (res.data) { res.data = res.data.map((item) => { return new RepairFileAudit(item); }); resolve(res); } } else { let resArr = res.map((item) => { return new RepairFileAudit(item); }); resolve(resArr); } }) .catch((err) => { reject(err); }); }); } //查询审核修复方案列表 queryRepairPlanArchive(params = {}) { let { pageInfo, order, filters } = params; let query = new Query(); if (pageInfo) { query.setCurrPage(pageInfo.currPage); query.setPageSize(pageInfo.pageSize); } query.addFilter("status", "=", 0); //查询审核中的记录 if (filters && filters.length > 0) { filters.forEach((item) => { query.addFilter(item["name"], item["operator"], item["value"]); }); } let queryTask = new QueryTask(artApi.viewRepairPlanReview, !!pageInfo); return new Promise((resolve, reject) => { queryTask .execute(query) .then((res) => { if (pageInfo) { if (res.data) { res.data = res.data.map((item) => { return new RepairPlanAudit(item); }); resolve(res); } } else { let resArr = res.map((item) => { return new RepairPlanAudit(item); }); resolve(resArr); } }) .catch((err) => { reject(err); }); }); } //查询待审核共享数据列表 querySyneryData(params = {}) { let { pageInfo, filters, order } = params; let query = new Query(); if (pageInfo) { query.setCurrPage(pageInfo.currPage); query.setPageSize(pageInfo.pageSize); } if (filters && filters.length > 0) { filters.forEach((item) => { query.addFilter(item["name"], item["operator"], item["value"]); }); } if (order) { query.setOrder(order); } else { query.setOrder({ id: "desc" }); } let queryTask = new QueryTask(QueryType.syneryData, false); return new Promise((resolve, reject) => { queryTask .execute(query) .then((res) => { let resArr = res.map((item) => { return new SynergyAudit(item); }); resolve(resArr); }) .catch((err) => { reject(err); }); }); } } export default ArtUser;