123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { queryAuthList } from '@/services/bomAuth';
- export default {
- namespace: 'authList',
- state: {
- authList: [],
- authVersionList: [],
- },
- effects: {
- *queryAuthList({ payload }, { call, put }) {
- const responce = yield call(queryAuthList, payload);
- if (responce) {
- let data = responce.data;
- let ret = [];
- data.forEach(e => {
- let item = ret.find(item => item.key == `${e.template_id}_${e.project_id}`);
- if (!item) {
- item = {
- key: `${e.template_id}_${e.project_id}`,
- name: e.name,
- project_name: e.ding_schema,
- nodes: [],
- };
- ret.push(item);
- }
- item.nodes.push({
- template_id: e.template_id,
- project_id: e.project_id,
- version_name: e.version_name,
- node_name: e.TemplateNodeInfo?.label,
- node_id: e.TemplateNodeInfo?.Id,
- author: e.AuthorInfo?.CName,
- classify_id: e.classify_id,
- version_id: e.version_id,
- id: e.id,
- type: 'auth',
- });
- });
- yield put({
- type: 'save',
- payload: { authList: ret, authVersionList: data },
- });
- }
- },
- },
- reducers: {
- save(state, action) {
- return {
- ...state,
- ...action.payload,
- };
- },
- },
- };
|