|
|
@@ -7,6 +7,12 @@ export default {
|
|
|
state: {
|
|
|
list: [],
|
|
|
filterLabel: '',
|
|
|
+ groupList: [],
|
|
|
+ currentGroup: [{
|
|
|
+ code: 'all',
|
|
|
+ label: '全部分组'
|
|
|
+ }],
|
|
|
+ groupDirty: false
|
|
|
},
|
|
|
reducers: {
|
|
|
add(state, action) {
|
|
|
@@ -20,7 +26,71 @@ export default {
|
|
|
return Object.assign({}, state, {list: list});
|
|
|
},
|
|
|
setFilterLabel(state, action) {
|
|
|
- return Object.assign({}, state, {filterLabel: action.label});
|
|
|
+ const { label } = action;
|
|
|
+ return Object.assign({}, state, {filterLabel: label});
|
|
|
+ },
|
|
|
+ groupList(state, action) {
|
|
|
+ let data = action.data;
|
|
|
+ return Object.assign({}, state, {groupList: data});
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 设置数据源过滤用分组
|
|
|
+ */
|
|
|
+ setCurrentGroup(state, action) {
|
|
|
+ const { group1, group2 } = action;
|
|
|
+ let g = [group1];
|
|
|
+ group2 && g.push(group2);
|
|
|
+ return Object.assign({}, state, {currentGroup: g});
|
|
|
+ },
|
|
|
+ addGroup(state, action) {
|
|
|
+ const { group } = action;
|
|
|
+ let list = state.groupList;
|
|
|
+ list.push(group);
|
|
|
+ return Object.assign({}, state, {groupList: list});
|
|
|
+ },
|
|
|
+ modifyGroup(state, action) {
|
|
|
+ const { group } = action;
|
|
|
+ let list = state.groupList;
|
|
|
+ let dirty = false;
|
|
|
+ for(let i = 0; i < list.length; i++) {
|
|
|
+ let l = list[i];
|
|
|
+ if(l.code === group.code) {
|
|
|
+ for(let k in l) {
|
|
|
+ if(group[k] !== undefined && l[k] !== group[k]) {
|
|
|
+ l[k] = group[k];
|
|
|
+ dirty = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Object.assign({}, state, {groupDirty: dirty, groupList: list});
|
|
|
+ },
|
|
|
+ modifyGroups(state, action) {
|
|
|
+ const { groups } = action;
|
|
|
+ let list = state.groupList;
|
|
|
+ const modifyGroupCodes = groups.map(g => g.code);
|
|
|
+
|
|
|
+ list = list.filter(l => modifyGroupCodes.indexOf(l.code) === -1);
|
|
|
+ list = list.concat(groups);
|
|
|
+
|
|
|
+ return Object.assign({}, state, {groupList: list});
|
|
|
+ },
|
|
|
+ deleteGroup(state, action) {
|
|
|
+ const { group } = action;
|
|
|
+ let list = state.groupList;
|
|
|
+ for(let i = 0; i < list.length; i++) {
|
|
|
+ let l = list[i];
|
|
|
+ if(l.code === group.code) {
|
|
|
+ list.splice(i, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Object.assign({}, state, {groupList: list});
|
|
|
+ },
|
|
|
+ setGroupDirty(state, action) {
|
|
|
+ let dirty = action.dirty;
|
|
|
+ return Object.assign({}, state, {groupDirty: dirty});
|
|
|
}
|
|
|
},
|
|
|
effects: {
|
|
|
@@ -137,6 +207,96 @@ export default {
|
|
|
message.error('解析图表错误');
|
|
|
}
|
|
|
},
|
|
|
+ *remoteAdd(action, { select, call, put }) {
|
|
|
+ try{
|
|
|
+ const chartDesigner = yield select(state => state.present.chartDesigner);
|
|
|
+ const { header, baseConfig, preparing, barConfig, pieConfig, lineConfig, otherConfig, description } = chartDesigner;
|
|
|
+
|
|
|
+ let body = {
|
|
|
+ chartName: header.label,
|
|
|
+ dataId: baseConfig.dataSource,
|
|
|
+ groupBy: preparing.groupBy && preparing.groupBy.key ? [{
|
|
|
+ columnName: preparing.groupBy.key,
|
|
|
+ columnRamane: preparing.groupBy.label
|
|
|
+ }] : [],
|
|
|
+ createBy: 'zhuth',
|
|
|
+ describes: description,
|
|
|
+ style: '',
|
|
|
+ otherConfig: JSON.stringify(otherConfig)
|
|
|
+ }; // 基本属性
|
|
|
+ if(baseConfig.viewType === 'bar') {
|
|
|
+ body.chartType = 'Histogram';
|
|
|
+ body.chartConfig = JSON.stringify(barConfig);
|
|
|
+ }else if(baseConfig.viewType === 'pie') {
|
|
|
+ body.chartType = 'Pie';
|
|
|
+ body.chartConfig = JSON.stringify(pieConfig);
|
|
|
+ }else if(baseConfig.viewType === 'line') {
|
|
|
+ body.chartType = 'Line';
|
|
|
+ body.chartConfig = JSON.stringify(lineConfig);
|
|
|
+ }
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
+ url: URLS.CHART_ADD,
|
|
|
+ body: body
|
|
|
+ })
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
+ message.success('新增成功!');
|
|
|
+ // yield put({ type: 'silentSetField', name: 'code', value: code });
|
|
|
+ yield put({ type: 'fetchList', mandatory: true });
|
|
|
+ }else {
|
|
|
+ message.error('新增失败');
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.error(e);
|
|
|
+ message.error('新增失败');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ *remoteModify(action, { select, call, put }) {
|
|
|
+ try{
|
|
|
+ const chartDesigner = yield select(state => state.present.chartDesigner);
|
|
|
+ const { code, header, baseConfig, pieConfig, lineConfig, preparing,
|
|
|
+ barConfig, scatterConfig, otherConfig, description } = chartDesigner;
|
|
|
+ let body = {
|
|
|
+ chartId: code,
|
|
|
+ chartName: header.label,
|
|
|
+ dataId: baseConfig.dataSource,
|
|
|
+ groupBy: preparing.groupBy ? [{
|
|
|
+ columnName: preparing.groupBy.key,
|
|
|
+ columnRamane: preparing.groupBy.label
|
|
|
+ }] : [],
|
|
|
+ createBy: 'zhuth',
|
|
|
+ describes: description,
|
|
|
+ style: '',
|
|
|
+ otherConfig: JSON.stringify(otherConfig)
|
|
|
+ }; // 基本属性
|
|
|
+ if(baseConfig.viewType === 'bar') {
|
|
|
+ body.chartType = 'Histogram';
|
|
|
+ body.chartConfig = JSON.stringify(barConfig);
|
|
|
+ }else if(baseConfig.viewType === 'pie') {
|
|
|
+ body.chartType = 'Pie';
|
|
|
+ body.chartConfig = JSON.stringify(pieConfig);
|
|
|
+ }else if(baseConfig.viewType === 'line') {
|
|
|
+ body.chartType = 'Line';
|
|
|
+ body.chartConfig = JSON.stringify(lineConfig);
|
|
|
+ }else if(baseConfig.viewType === 'scatter') {
|
|
|
+ body.chartType = 'scatter';
|
|
|
+ body.chartConfig = JSON.stringify(scatterConfig);
|
|
|
+ }
|
|
|
+ console.log(body);
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
+ url: URLS.CHART_UPDATE,
|
|
|
+ body: body
|
|
|
+ })
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
+ message.success('修改成功');
|
|
|
+ yield put({ type: 'fetchList', mandatory: true });
|
|
|
+ }else {
|
|
|
+ message.error('修改失败');
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.error(e);
|
|
|
+ message.error('修改失败');
|
|
|
+ }
|
|
|
+ },
|
|
|
*remoteDelete(action, { select, call, put, takeEvery, takeLatest }) {
|
|
|
const chart = yield select(state => state.present.chart);
|
|
|
const code = action.code;
|
|
|
@@ -162,7 +322,332 @@ export default {
|
|
|
message.error('删除失败');
|
|
|
console.log(e);
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ *remoteGroupList(action, { select, call, put }) {
|
|
|
+ try {
|
|
|
+ const chart = yield select(state => state.present.chart);
|
|
|
+ if(!action.mandatory && chart.groupList.length > 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
+ url: URLS.GROUP_CHART_LIST,
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(res);
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
+ const resData = res.data.data;
|
|
|
+ let data = resData.map(d => {
|
|
|
+ return {
|
|
|
+ code: d.id+'',
|
|
|
+ pcode: d.fatherId+'',
|
|
|
+ index: +d.groupIndex,
|
|
|
+ label: d.groupName+'',
|
|
|
+ }
|
|
|
+ });
|
|
|
+ yield put({ type: 'groupList', data });
|
|
|
+ }else {
|
|
|
+ message.error('读取数据源列表错误');
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 新增分组/子分组,需要传入父节点code
|
|
|
+ */
|
|
|
+ *remoteAddGroup(action, { select, call, put }) {
|
|
|
+ try {
|
|
|
+ const chart = yield select((state) => state.present.chart);
|
|
|
+ const group = chart.groupList;
|
|
|
+ const pgroups = group.filter(g => g.pcode === '-1');
|
|
|
+ const cgroups = group.filter(g => g.pcode !== '-1');
|
|
|
+ const { pgroup } = action;
|
|
|
+
|
|
|
+ let body = {};
|
|
|
+ if(pgroup) {
|
|
|
+ body = {
|
|
|
+ fatherId: pgroup.code,
|
|
|
+ groupName: '新子分组',
|
|
|
+ groupIndex: cgroups.filter(c => c.pcode === pgroup.code).length,
|
|
|
+ createBy: 'zhuth'
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ body = {
|
|
|
+ fatherId: '-1',
|
|
|
+ groupName: '新分组',
|
|
|
+ groupIndex: pgroups.length,
|
|
|
+ createBy: 'zhuth'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
+ url: URLS.GROUP_CHART_ADD,
|
|
|
+ body: body
|
|
|
+ });
|
|
|
+ console.log('新增分组', body, res);
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
+ let group = {
|
|
|
+ code: res.data.data + '',
|
|
|
+ pcode: body.fatherId + '',
|
|
|
+ index: body.groupIndex,
|
|
|
+ label: body.groupName+'',
|
|
|
+ }
|
|
|
+ yield put({ type: 'addGroup', group });
|
|
|
+ }else {
|
|
|
+ message.error('新增失败');
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.log(e);
|
|
|
+ message.error('新增失败');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 修改单个分组信息(因为不涉及顺序号的修改,所以一般只用于label的修改)
|
|
|
+ */
|
|
|
+ *remoteModifyGroup(action, { select, call, put }) {
|
|
|
+ try {
|
|
|
+ const chart = yield select((state) => state.present.chart);
|
|
|
+ const groupDirty = chart.groupDirty;
|
|
|
+ const group = action.group;
|
|
|
+
|
|
|
+ if(!groupDirty) { // 如果属性无改动则取消修改请求
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let body = {
|
|
|
+ id: group.code,
|
|
|
+ fatherId: group.pcode,
|
|
|
+ groupName: group.label,
|
|
|
+ groupIndex: group.index,
|
|
|
+ createBy: 'zhuth'
|
|
|
+ }
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
+ url: URLS.GROUP_CHART_UPDATE,
|
|
|
+ body: body
|
|
|
+ });
|
|
|
+
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
+ yield put({ type: 'setGroupDirty', dirty: false });
|
|
|
+ }else {
|
|
|
+ message.error('修改失败');
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.log(e);
|
|
|
+ message.error('修改失败');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 批量修改多个分组信息(在移动位置时用)
|
|
|
+ */
|
|
|
+ *remoteModifyGroups(action, { select, call, put }) {
|
|
|
+ try {
|
|
|
+ const groups = action.groups;
|
|
|
+
|
|
|
+ let body = groups.map(g => {
|
|
|
+ return {
|
|
|
+ id: g.code,
|
|
|
+ groupName: g.label,
|
|
|
+ groupIndex: g.index,
|
|
|
+ fatherId: g.pcode,
|
|
|
+ createBy: 'zhuth'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
+ url: URLS.GROUP_CHART_LIST_UPDATE,
|
|
|
+ body: body
|
|
|
+ });
|
|
|
+
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
+ yield put({ type: 'modifyGroups', groups: groups });
|
|
|
+ }else {
|
|
|
+ message.error('批量更新时发生异常');
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.log(e);
|
|
|
+ message.error('批量更新时发生异常');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ *remoteDeleteGroup(action, { select, call, put }) {
|
|
|
+ try {
|
|
|
+ const chart = yield select((state) => state.present.chart);
|
|
|
+ const groupList = chart.groupList;
|
|
|
+ const { group } = action;
|
|
|
+
|
|
|
+ let bgroups = groupList.filter(l => l.pcode === group.pcode);
|
|
|
+ bgroups.splice(group.index, 1);
|
|
|
+ bgroups = bgroups.map((b, i) => {
|
|
|
+ return { ...b, index: i }
|
|
|
+ });
|
|
|
+
|
|
|
+ yield put({ type: 'remoteModifyGroups', groups: bgroups });
|
|
|
+
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
+ url: URLS.GROUP_CHART_DELETE,
|
|
|
+ body: [group.code]
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(group.code, res);
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
+ yield put({ type: 'deleteGroup', group});
|
|
|
+ }else {
|
|
|
+ message.error('删除失败');
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.log(e);
|
|
|
+ message.error('删除失败');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ *remoteMoveGroup(action, { select, call, put }) {
|
|
|
+ try {
|
|
|
+ const { dragCode, dropCode, dropPosition } = action;
|
|
|
+ const chart = yield select((state) => state.present.chart);
|
|
|
+ let group = chart.groupList;
|
|
|
+
|
|
|
+ const dragGroup = group.filter(g => g.code === dragCode)[0];
|
|
|
+ const dropGroup = group.filter(g => g.code === dropCode)[0];
|
|
|
+
|
|
|
+ let modifyGroups = [];
|
|
|
+ if((dragGroup.pcode === '-1' || dropGroup.pcode === '-1') && (dragGroup.pcode !== dropGroup.pcode)) { // 跨级
|
|
|
+ console.log('跨级');
|
|
|
+ if(dropGroup.pcode !== '-1') { // 从父级到子级
|
|
|
+ console.log('error');
|
|
|
+ return; // 不允许
|
|
|
+ }else { // 从子级到父级
|
|
|
+ if(dragGroup.pcode === dropGroup.code) { // 不跨组
|
|
|
+ if(dropPosition === -1) { // 目标前
|
|
|
+ console.log('before');
|
|
|
+ let dragGroups = group.filter(g => g.pcode === dragGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ let dropGroups = group.filter(g => g.pcode === dropGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ dragGroups.splice(dragGroup.index, 1);
|
|
|
+ dragGroups = dragGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i }
|
|
|
+ });
|
|
|
+ dropGroups.splice(dropGroup.index, 0, dragGroup);
|
|
|
+ dropGroups = dropGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i, pcode: dropGroup.pcode }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dragGroups, dropGroups);
|
|
|
+ }else if(dropPosition === 0) { // 目标内
|
|
|
+ console.log('nothing');
|
|
|
+ return; // 无变化
|
|
|
+ }else if(dropPosition === 1) { // 目标后
|
|
|
+ console.log('after');
|
|
|
+ let dragGroups = group.filter(g => g.pcode === dragGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ let dropGroups = group.filter(g => g.pcode === dropGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ dragGroups.splice(dragGroup.index, 1);
|
|
|
+ dragGroups = dragGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i }
|
|
|
+ });
|
|
|
+ dropGroups.splice(dropGroup.index + 1, 0, dragGroup);
|
|
|
+ dropGroups = dropGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i, pcode: dropGroup.pcode }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dragGroups, dropGroups);
|
|
|
+ }
|
|
|
+ }else { // 跨组
|
|
|
+ let dragGroups = group.filter(g => g.pcode === dragGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ let dropGroups = group.filter(g => g.pcode === dropGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ let dropChildrenGroups = group.filter(g => g.pcode === dropGroup.code).sort((a, b) => a.index - b.index);
|
|
|
+
|
|
|
+ dragGroups.splice(dragGroup.index, 1);
|
|
|
+ dragGroups = dragGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i }
|
|
|
+ });
|
|
|
+ if(dropPosition === -1) { // 目标前
|
|
|
+ console.log('before');
|
|
|
+ dropGroups.splice(dropGroup.index, 0, dragGroup);
|
|
|
+ dropGroups = dropGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i, pcode: dropGroup.pcode }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dragGroups, dropGroups);
|
|
|
+ }else if(dropPosition === 0) { // 目标内
|
|
|
+ console.log('in');
|
|
|
+ dropChildrenGroups.push({
|
|
|
+ ...dragGroup,
|
|
|
+ index: dropChildrenGroups.length,
|
|
|
+ pcode: dropGroup.code
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dragGroups, dropChildrenGroups);
|
|
|
+ }else if(dropPosition === 1) { // 目标后
|
|
|
+ console.log('after');
|
|
|
+ dropGroups.splice(dropGroup.index + 1, 0, dragGroup);
|
|
|
+ dropGroups = dropGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i, pcode: dropGroup.pcode }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dragGroups, dropGroups);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else { // 不跨级
|
|
|
+ console.log('不跨级');
|
|
|
+ if(dragGroup.pcode === dropGroup.pcode) { // 不跨组
|
|
|
+ console.log('不跨组');
|
|
|
+ let dGroups = group.filter(g => g.pcode === dragGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ dGroups.splice(dragGroup.index, 1, {code: 'temp', index: dragGroup.index});
|
|
|
+ if(dropPosition === -1) { // 目标前
|
|
|
+ console.log('before');
|
|
|
+ dGroups.splice(dropGroup.index, 0, dragGroup);
|
|
|
+ dGroups = dGroups.filter(g => g.code !== 'temp').map((g, i) => {
|
|
|
+ return { ...g, index: i }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dGroups);
|
|
|
+ }else if(dropPosition === 0) { // 目标内
|
|
|
+ console.log('in');
|
|
|
+ return;
|
|
|
+ }else if(dropPosition === 1) { // 目标后
|
|
|
+ console.log('after');
|
|
|
+ dGroups.splice(dropGroup.index + 1, 0, dragGroup);
|
|
|
+ dGroups = dGroups.filter(g => g.code !== 'temp').map((g, i) => {
|
|
|
+ return { ...g, index: i }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dGroups);
|
|
|
+ }
|
|
|
+ }else { // 跨组
|
|
|
+ console.log('跨组');
|
|
|
+ let dragGroups = group.filter(g => g.pcode === dragGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+ let dropGroups = group.filter(g => g.pcode === dropGroup.pcode).sort((a, b) => a.index - b.index);
|
|
|
+
|
|
|
+ dragGroups.splice(dragGroup.index, 1);
|
|
|
+ dragGroups = dragGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i }
|
|
|
+ });
|
|
|
+ for(let i = 0; i < dropGroups.length; i++) {
|
|
|
+ if(dropGroups[i].code === dropGroup.code) {
|
|
|
+ if(dropPosition === -1) { // 目标前
|
|
|
+ console.log('before');
|
|
|
+ dropGroups.splice(i, 0, dragGroup);
|
|
|
+ dropGroups = dropGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i, pcode: dropGroup.pcode }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dragGroups, dropGroups);
|
|
|
+ }else if(dropPosition === 0) { // 目标内
|
|
|
+ console.log('in');
|
|
|
+ return; // 不允许
|
|
|
+ }else if(dropPosition === 1) { // 目标后
|
|
|
+ console.log('after');
|
|
|
+ dropGroups.splice(i + 1, 0, dragGroup);
|
|
|
+ dropGroups = dropGroups.map((g, i) => {
|
|
|
+ return { ...g, index: i, pcode: dropGroup.pcode }
|
|
|
+ });
|
|
|
+ modifyGroups = modifyGroups.concat(dragGroups, dropGroups);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(dragGroup, dropGroup, modifyGroups);
|
|
|
+ yield put({ type: 'remoteModifyGroups', groups: modifyGroups });
|
|
|
+ }catch(e) {
|
|
|
+ console.log(e);
|
|
|
+ message.error('位置调整失败');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 设置图表所属分组
|
|
|
+ */
|
|
|
+ *remoteSetGroup(action, { select, call, put, takeEvery, takeLatest }) {
|
|
|
+ yield console.log('remoteSetGroup', action);
|
|
|
+ },
|
|
|
},
|
|
|
subscriptions: {
|
|
|
setup({ dispatch, history }) {
|
|
|
@@ -170,6 +655,9 @@ export default {
|
|
|
if(pathname === '/chart') {
|
|
|
dispatch({ type: 'fetchList' });
|
|
|
}
|
|
|
+ if(pathname.startsWith('/chart')) {
|
|
|
+ dispatch({ type: 'remoteGroupList' });
|
|
|
+ }
|
|
|
let detail = pathname.match(/chart\/(\w+)/);
|
|
|
if(detail) {
|
|
|
let code = detail[1];
|