123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505 |
- import {message} from 'antd';
- import request from '@/utils/request';
- import {async} from '@antv/x6/lib/registry/marker/async';
- import {stringify} from 'qs';
- /**
- project_id
- version_id 大版本id
- template_id
- template_node_id 查询某流程和某节点下最新版本的数据记录
- node_id 查询某审批流程和某审批节点下最新版本的数据记录
- */
- export async function queryRecord(params) {
- return request(`/purchase/record?${stringify(params)}`);
- }
- //删除excel中单个sheet页
- export async function queryDelSheetRecord(params) {
- const response = await request(`/purchase/bom/del-purchase-excel-sheet?${stringify(params)}`);
- if (response.code == 200) {
- // message.success('删除成功');
- }
- }
- // 查询全部工作流
- export async function queryFlowList(params) {
- return request(`/purchase/bom/flows?${stringify(params)}`);
- }
- // 根据节点id查询所有version
- export async function queryVserionByNode(params, signal) {
- return request(`/purchase/bom/flow/node?${stringify(params)}`, {
- signal,
- });
- }
- export async function commitSheet(params) {
- return request(`/purchase/record`, {
- method: 'POST',
- body: params,
- });
- }
- export async function approve(params) {
- return request(`/purchase/audit/status`, {
- method: 'POST',
- body: params,
- });
- }
- export async function queryAuthority(params) {
- const depId = localStorage.depId;
- return request(`/purchase/bom/user/excel/col?depId=${depId}`, {
- method: 'POST',
- body: params,
- });
- }
- export async function addBomComment(params) {
- return request(`/purchase/comment`, {
- method: 'POST',
- body: params,
- });
- }
- export async function queryBomComment(params) {
- return request(`/purchase/comment?${stringify(params)}`);
- }
- /**
- * 提交流转
- "id":3, 当前流转文档id,必填
- "project_id":46, 所属项目id
- "template_id":1, 所属模板id ,必填
- "template_node_id":34,所属节点id,必填
- "next_template_id":1,跳转的下级业务模板id,必填
- "next_template_node_id":2,跳转的下级业务节点id,必填
- "flow_id":1, 跳转的下级审核流程id , 如果不为空,则说明流转的是审核节点,下级业务节点为审核通过后进入的业务节点
- "node_id":1,跳转的下级审核节点id
- "desc":"流转描述"
- */
- export async function submitNextNode(params) {
- return request(`/purchase/next/node/submit`, {
- method: 'POST',
- body: params,
- });
- }
- export async function advanceSubmitNextNode(params) {
- return request(`/api/v1/purchase/next/node/advance-submit`, {
- method: 'POST',
- body: params,
- });
- }
- export async function queryDetail(params) {
- let response = await request(`/purchase/record?${stringify(params)}`);
- let sheet = response.data;
- sheet.data = JSON.parse(sheet.data || '[]');
- sheet.data.forEach(item => {
- item.config = JSON.parse(item.config || '{}');
- item.celldata = JSON.parse(item.cell_data || '[]');
- delete item.cell_data;
- });
- return sheet;
- }
- export async function queryHistoryDetail(params) {
- return request(`/purchase/record/history/detail?${stringify(params)}`);
- }
- export async function queryHistoryList(params) {
- return request(`/purchase/record/history?${stringify(params)}`);
- }
- export async function queryBoomFlowList(params) {
- return request(`/purchase/bom/flows?${stringify(params)}`);
- }
- //请求历史版本
- export async function queryVersionsTree(params) {
- return request(`/api/v1/purchase/record/version/tree?${stringify(params)}`);
- }
- //查询业务节点的审核记录
- export async function queryAuditExcel(params) {
- return request(`/api/v1/purchase/audit/excel?${stringify(params)}`);
- }
- //查询审批节点的审核记录
- export async function queryAuditRecord(params) {
- return request(`/api/v1/purchase/audit/record?${stringify(params)}`);
- }
- //查询表单数据接口
- export async function queryDingSchema(params) {
- return request(`/api/v1/purchase/bom/ding/schema?${stringify(params)}`);
- }
- export async function queryDingInstanceDetail(params) {
- let res = await request(`/api/v1/purchase/bom/ding/instance-detail`, {
- method: 'POST',
- body: params,
- });
- if (res.data.errcode != 0) {
- message.error(res.data.errmsg);
- throw new Error(res.data.errmsg);
- }
- return res;
- }
- export async function queryDingInstanceExecute(params) {
- let res = await request(`/api/v1/purchase/bom/ding/instance-execute`, {
- method: 'POST',
- body: params,
- });
- if (res.data.errcode != 0) {
- message.error('审批失败,请联系管理员。');
- throw new Error(res.data.errmsg);
- }
- return res;
- }
- export async function queryListParentByUser(params) {
- return request(`/api/v1/purchase/bom/ding/department/list-parent-by-user`, {
- method: 'POST',
- body: params,
- });
- }
- /**
- * 查看项目流程列表
- * project_id
- */
- export async function queryProjectRecord(params) {
- return request(`/purchase/bom/project/record?${stringify(params)}`);
- }
- /** 查看版本列表
- * project_id
- template_id 流程id
- template_node_id 流程节点id
- */
- export async function queryVersionsList(params) {
- return request(`/purchase/record/versions?${stringify(params)}`);
- }
- export async function queryBoomFlowDetail(params) {
- let {data} = await request(`/purchase/bom/flow/info?${stringify(params)}`);
- const groups = {
- top: {
- position: {name: 'top'},
- attrs: {
- circle: {
- r: 4,
- magnet: true,
- stroke: '#31d0c6',
- strokeWidth: 2,
- fill: '#fff',
- style: {visibility: 'hidden'},
- },
- },
- zIndex: 10,
- },
- right: {
- position: {name: 'right'},
- attrs: {
- circle: {
- r: 4,
- magnet: true,
- stroke: '#31d0c6',
- strokeWidth: 2,
- fill: '#fff',
- style: {visibility: 'hidden'},
- },
- },
- zIndex: 10,
- },
- bottom: {
- position: {name: 'bottom'},
- attrs: {
- circle: {
- r: 4,
- magnet: true,
- stroke: '#31d0c6',
- strokeWidth: 2,
- fill: '#fff',
- style: {visibility: 'hidden'},
- },
- },
- zIndex: 10,
- },
- left: {
- position: {name: 'left'},
- attrs: {
- circle: {
- r: 4,
- magnet: true,
- stroke: '#31d0c6',
- strokeWidth: 2,
- fill: '#fff',
- style: {visibility: 'hidden'},
- },
- },
- zIndex: 10,
- },
- };
- const attrs = {
- line: {
- stroke: '#A2B1C3',
- targetMarker: {name: 'block', width: 12, height: 8},
- strokeDasharray: '5 5',
- strokeWidth: 1,
- },
- };
- let nodes = data.Nodes.map(item => {
- let node = {
- ...item,
- id: item.node_id,
- renderKey: item.render_key,
- zIndex: 1,
- isCustom: !!item.is_custom,
- ports: JSON.parse(item.ports || '{}'),
- };
- node.ports.groups = groups;
- node.parentKey = '1';
- return node;
- });
- let edges = data.Edges.map(item => {
- let edge = {
- id: item.edge_id,
- source: {
- cell: item.source_cell,
- port: item.source_port,
- },
- target: {
- cell: item.target_cell,
- port: item.target_port,
- },
- zIndex: 0
- };
- try {
- edge.attrs = item.attr ? JSON.parse(item.attr) : attrs;
- } catch (error) {
- edge.attrs = attrs;
- }
- return edge;
- });
- return {
- ...data,
- nodes,
- edges,
- };
- }
- export async function updateNode(data) {
- return request(`/purchase/bom/flow/${data.templateId}/${data.nodeId}`, {
- method: 'PUT',
- body: data.body,
- });
- }
- export async function addBoomFlow(data) {
- return request(`/purchase/bom/flow/info`, {
- method: 'POST',
- body: data,
- });
- }
- export async function queryAuditList(params) {
- return request(`/purchase/flow/info?${stringify(params)}`);
- }
- export async function addAudit(data) {
- return request(`/purchase/flow/info`, {
- method: 'POST',
- body: data,
- });
- }
- export async function addFlow(data) {
- return request(`/purchase/bom/flow/info`, {
- method: 'POST',
- body: data,
- });
- }
- /**
- * [
- {
- "flow_id": 23,
- "node": "主管",
- "desc": "desc",
- "auditor": 2,
- "seq": 1,
- "seq_relate": 0
- }
- ]
- */
- export async function addAuditNode(data) {
- return request(`/purchase/flow/info/${data.flowId}`, {
- method: 'POST',
- body: data.nodes,
- });
- }
- export async function queryOSSData() {
- return request(`/config/chart-template-img?destDir=public/bom`);
- }
- export async function queryRecordSheet(data) {
- return request(`/purchase/record/sheet?${stringify(data)}`, {
- method: 'POST',
- body: data,
- });
- }
- export async function queryDingTemplateList() {
- return request(`/purchase/bom/ding/template/list`);
- }
- export async function queryDDdepList(data) {
- let res = await request(`/api/v1/purchase/bom/ding/department-list`, {
- method: 'POST',
- body: data,
- });
- return res.data.result;
- }
- export async function queryDDProcessesForecast(data) {
- let res = await request(`/api/v1/purchase/bom/ding/processes-forecast`, {
- method: 'POST',
- body: data,
- });
- if (res.data.message) {
- // message.error(res.data.message);
- throw new Error(res.data.message);
- }
- return res.data.result;
- }
- export async function uploadFile(data) {
- let res = await request(`/api/v1/purchase/bom/ding/upload-file`, {
- method: 'POST',
- body: data,
- headers: {
- ContentType: 'application/x-www-form-urlencoded',
- },
- });
- if (!res.data.dentry) {
- message.error(res.data.errmsg);
- throw new Error(res.data.errmsg);
- }
- return res.data;
- }
- export async function bindDDCode(userId, code) {
- let res = await request(`/api/v1/purchase/bom/ding/set-ding-user-code?ucode=${userId}:${code}`, {
- method: 'GET',
- });
- return res.data;
- }
- export async function saveAuditFlowInfo(data) {
- return request(`/purchase/flow/info`, {
- method: 'POST',
- body: data,
- });
- }
- //获取部门结构
- export async function queryDepV2(params) {
- return request(`/api/v2/dep?${stringify(params)}`);
- }
- export async function queryProcessFlows(params) {
- let res = await request(`/purchase/process/get-flows?${stringify(params)}`, {
- method: 'GET',
- });
- return res.data;
- }
- export async function queryUserListByRoleID(params) {
- let res = await request(`/api/v1/purchase/process/get-role-user?${stringify(params)}`, {
- method: 'GET',
- });
- return res.data;
- }
- //新增工作流时调用接口 给项目绑定默认分类列表
- //purchase/bom/default-bind-classify?project_id=1
- export async function queryDefaultBindClassify(params) {
- let res = await request(`/purchase/bom/default-bind-classify?${stringify(params)}`, {
- method: 'GET',
- });
- return res.data;
- }
- //获取分类列表
- export async function queryClassify() {
- let res = await request(`/purchase/bom/get-classify`, {
- method: 'GET',
- });
- return res.data;
- }
- export async function queryBindClassify(params) {
- let res = await request(`/purchase/bom/get-bind-classify?${stringify(params)}`, {
- method: 'GET',
- });
- return res.data;
- }
- export async function queryAddBindClassify(data) {
- return request(`/purchase/bom/add-bind-classify`, {
- method: 'POST',
- body: data,
- });
- }
- export async function queryDelPurchaseExcel(params) {
- let res = await request(`/purchase/bom/del-purchase-excel?${stringify(params)}`, {
- method: 'GET',
- });
- return res;
- }
- //提交流转存储表单审批人历史记录
- export async function querySaveBomForm(data) {
- return request(`/purchase/bom/save-bom-form`, {
- method: 'POST',
- body: data,
- });
- }
- export async function queryGetBomForm(params) {
- let res = await request(`/purchase/bom/get-bom-form?${stringify(params)}`, {
- method: 'GET',
- });
- return res;
- }
- //章管家失败,重新申请用印
- export async function queryTrySeal(params) {
- let res = await request(`/purchase/bom/try-seal?${stringify(params)}`, {
- method: 'GET',
- });
- return res;
- }
- export async function ChartTempOSSData(params) {
- return request(`/purchase/bom/contract-file/${params.projectId}`);
- }
- // 设置最终版本
- export async function setLastVersion(excelId) {
- return request(`/purchase/bom/set-last-version/${excelId}`);
- }
- export async function getAuditDetail(params) {
- const res = await request(`/purchase/bom/get-audit-detail/${params.userId}?version_id=${params.versionID}`)
- return res.data
- }
|