|
@@ -48,6 +48,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
const res = yield call(service.fetch, {
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.DASHBOARD_LIST,
|
|
url: URLS.DASHBOARD_LIST,
|
|
|
|
|
+ method: 'GET',
|
|
|
body
|
|
body
|
|
|
});
|
|
});
|
|
|
console.log('请求看板列表', body, res);
|
|
console.log('请求看板列表', body, res);
|
|
@@ -64,6 +65,8 @@ export default {
|
|
|
creatorCode: d.createId + '',
|
|
creatorCode: d.createId + '',
|
|
|
creatorName: d.createBy,
|
|
creatorName: d.createBy,
|
|
|
createTime: d.createDate,
|
|
createTime: d.createDate,
|
|
|
|
|
+ shareCode: d.shareCode,
|
|
|
|
|
+ demo: d.demo
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
yield put({ type: 'list', list: list });
|
|
yield put({ type: 'list', list: list });
|
|
@@ -84,13 +87,17 @@ export default {
|
|
|
yield put({ type: 'dashboardDesigner/silentSetField', name: 'loading', value: true });
|
|
yield put({ type: 'dashboardDesigner/silentSetField', name: 'loading', value: true });
|
|
|
const res = yield call(service.fetch, {
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.DASHBOARD_DETAIL,
|
|
url: URLS.DASHBOARD_DETAIL,
|
|
|
- body: code
|
|
|
|
|
|
|
+ method: 'GET',
|
|
|
|
|
+ body: {
|
|
|
|
|
+ id: code
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
console.log('解析看板数据', code, res);
|
|
console.log('解析看板数据', code, res);
|
|
|
if(!res.err && res.data.code > 0) {
|
|
if(!res.err && res.data.code > 0) {
|
|
|
const resData = res.data.data;
|
|
const resData = res.data.data;
|
|
|
let items = resData.bdConfiguration ? JSON.parse(resData.bdConfiguration) : [];
|
|
let items = resData.bdConfiguration ? JSON.parse(resData.bdConfiguration) : [];
|
|
|
let relationColumns = resData.relationColumns ? JSON.parse(resData.relationColumns) : [];
|
|
let relationColumns = resData.relationColumns ? JSON.parse(resData.relationColumns) : [];
|
|
|
|
|
+ let chartCodes = resData.chartCodes ? resData.chartCodes.split(',') : [];
|
|
|
const main = yield select(state => state.present.main);
|
|
const main = yield select(state => state.present.main);
|
|
|
const { currentUser } = main;
|
|
const { currentUser } = main;
|
|
|
|
|
|
|
@@ -124,7 +131,10 @@ export default {
|
|
|
dataSources: dataSources,
|
|
dataSources: dataSources,
|
|
|
relationColumns: relationColumns,
|
|
relationColumns: relationColumns,
|
|
|
editMode: currentUser.code === resData.createId + '',
|
|
editMode: currentUser.code === resData.createId + '',
|
|
|
- filters: JSON.parse((resData.filters|| "[]"))
|
|
|
|
|
|
|
+ filters: JSON.parse((resData.filters|| "[]")),
|
|
|
|
|
+ shareCode: resData.shareCode,
|
|
|
|
|
+ chartCodes: chartCodes,
|
|
|
|
|
+ demo: resData.demo
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let fields = [];
|
|
let fields = [];
|
|
@@ -148,14 +158,16 @@ export default {
|
|
|
*remoteAdd(action, { select, call, put }) {
|
|
*remoteAdd(action, { select, call, put }) {
|
|
|
try {
|
|
try {
|
|
|
const dashboardDesigner = yield select(state => state.present.dashboardDesigner);
|
|
const dashboardDesigner = yield select(state => state.present.dashboardDesigner);
|
|
|
- const { name, items, thumbnail, relationColumns, filters } = dashboardDesigner;
|
|
|
|
|
|
|
+ const { name, items, thumbnail, relationColumns, filters, shareCode } = dashboardDesigner;
|
|
|
let body = {
|
|
let body = {
|
|
|
bdName: name,
|
|
bdName: name,
|
|
|
bdNote: '',
|
|
bdNote: '',
|
|
|
bdConfiguration: JSON.stringify(items),
|
|
bdConfiguration: JSON.stringify(items),
|
|
|
thumbnail: thumbnail,
|
|
thumbnail: thumbnail,
|
|
|
relationColumns: JSON.stringify(relationColumns),
|
|
relationColumns: JSON.stringify(relationColumns),
|
|
|
- filters: JSON.stringify(filters) || ''
|
|
|
|
|
|
|
+ filters: JSON.stringify(filters) || '',
|
|
|
|
|
+ shareCode: shareCode,
|
|
|
|
|
+ chartCodes: []
|
|
|
}
|
|
}
|
|
|
console.log('新增看板', body);
|
|
console.log('新增看板', body);
|
|
|
const res = yield call(service.fetch, {
|
|
const res = yield call(service.fetch, {
|
|
@@ -177,14 +189,16 @@ export default {
|
|
|
*remoteQucikAdd(action, { select, call, put }) {
|
|
*remoteQucikAdd(action, { select, call, put }) {
|
|
|
try {
|
|
try {
|
|
|
const dashboardDesigner = yield select(state => state.present.dashboardDesigner);
|
|
const dashboardDesigner = yield select(state => state.present.dashboardDesigner);
|
|
|
- const { name, items, thumbnail, description, relationColumns, filters } = dashboardDesigner;
|
|
|
|
|
|
|
+ const { name, items, thumbnail, description, relationColumns, filters, shareCode } = dashboardDesigner;
|
|
|
let body = {
|
|
let body = {
|
|
|
bdName: name,
|
|
bdName: name,
|
|
|
bdNote: description,
|
|
bdNote: description,
|
|
|
bdConfiguration: JSON.stringify(items),
|
|
bdConfiguration: JSON.stringify(items),
|
|
|
thumbnail: thumbnail,
|
|
thumbnail: thumbnail,
|
|
|
relationColumns: JSON.stringify(relationColumns),
|
|
relationColumns: JSON.stringify(relationColumns),
|
|
|
- filters: JSON.stringify(filters) || ""
|
|
|
|
|
|
|
+ filters: JSON.stringify(filters) || "",
|
|
|
|
|
+ shareCode: shareCode,
|
|
|
|
|
+ chartCodes: []
|
|
|
}
|
|
}
|
|
|
console.log('快速新增看板', body);
|
|
console.log('快速新增看板', body);
|
|
|
const res = yield call(service.fetch, {
|
|
const res = yield call(service.fetch, {
|
|
@@ -206,7 +220,7 @@ export default {
|
|
|
*remoteModify(action, { select, call, put }) {
|
|
*remoteModify(action, { select, call, put }) {
|
|
|
try {
|
|
try {
|
|
|
const dashboardDesigner = yield select(state => state.present.dashboardDesigner);
|
|
const dashboardDesigner = yield select(state => state.present.dashboardDesigner);
|
|
|
- const { code, name, items, thumbnail, description, relationColumns, filters } = dashboardDesigner;
|
|
|
|
|
|
|
+ const { code, name, items, thumbnail, description, relationColumns, filters, chartCodes, shareCode } = dashboardDesigner;
|
|
|
let body = {
|
|
let body = {
|
|
|
id: code,
|
|
id: code,
|
|
|
bdName: name,
|
|
bdName: name,
|
|
@@ -214,7 +228,9 @@ export default {
|
|
|
bdConfiguration: JSON.stringify(items.map(item => ({ ...item, chartOption: null }))),
|
|
bdConfiguration: JSON.stringify(items.map(item => ({ ...item, chartOption: null }))),
|
|
|
thumbnail: thumbnail,
|
|
thumbnail: thumbnail,
|
|
|
relationColumns: JSON.stringify(relationColumns),
|
|
relationColumns: JSON.stringify(relationColumns),
|
|
|
- filters: JSON.stringify(filters) || ""
|
|
|
|
|
|
|
+ filters: JSON.stringify(filters) || "",
|
|
|
|
|
+ chartCodes: chartCodes.join(','),
|
|
|
|
|
+ shareCode: shareCode
|
|
|
}
|
|
}
|
|
|
const res = yield call(service.fetch, {
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.DASHBOARD_UPDATE,
|
|
url: URLS.DASHBOARD_UPDATE,
|
|
@@ -328,6 +344,81 @@ export default {
|
|
|
message.error('移交失败: ' + e);
|
|
message.error('移交失败: ' + e);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ *remoteShareDetail(action, { select, call, put }) {
|
|
|
|
|
+ const code = action.code;
|
|
|
|
|
+ if(!code){
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ yield put({ type: 'dashboardDesigner/silentSetField', name: 'loading', value: true });
|
|
|
|
|
+ const res = yield call(service.fetch, {
|
|
|
|
|
+ url: URLS.DASHBOARD_SHARE_DETAIL,
|
|
|
|
|
+ method: 'GET',
|
|
|
|
|
+ body: {
|
|
|
|
|
+ id: code
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if(!res.err && res.data.code > 0) {
|
|
|
|
|
+ const resData = res.data.data;
|
|
|
|
|
+ let items = resData.bdConfiguration ? JSON.parse(resData.bdConfiguration) : [];
|
|
|
|
|
+ let relationColumns = resData.relationColumns ? JSON.parse(resData.relationColumns) : [];
|
|
|
|
|
+ let chartCodes = resData.chartCodes ? resData.chartCodes.split(',') : [];
|
|
|
|
|
+ const main = yield select(state => state.present.main);
|
|
|
|
|
+ const { currentUser } = main;
|
|
|
|
|
+
|
|
|
|
|
+ const allDataSources = items.map(item => {
|
|
|
|
|
+ if(item.viewType === 'chart') {
|
|
|
|
|
+ return {
|
|
|
|
|
+ code: item.dataSourceCode,
|
|
|
|
|
+ name: item.dataSourceName
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return null
|
|
|
|
|
+ }
|
|
|
|
|
+ }).filter(item => !!item);
|
|
|
|
|
+
|
|
|
|
|
+ const dataSources = [];
|
|
|
|
|
+ allDataSources.forEach(ad => {
|
|
|
|
|
+ if(!dataSources.find(d => d.code === ad.code)) {
|
|
|
|
|
+ dataSources.push(ad);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ code: resData.id+'',
|
|
|
|
|
+ name: resData.bdName,
|
|
|
|
|
+ items: items,
|
|
|
|
|
+ description: resData.bdNote || '',
|
|
|
|
|
+ thumbnail: resData.thumbnail,
|
|
|
|
|
+ creatorCode: resData.createId + '',
|
|
|
|
|
+ creatorName: resData.createBy,
|
|
|
|
|
+ createTime: resData.createDate,
|
|
|
|
|
+ dataSources: dataSources,
|
|
|
|
|
+ relationColumns: relationColumns,
|
|
|
|
|
+ editMode: currentUser.code === resData.createId + '',
|
|
|
|
|
+ filters: JSON.parse((resData.filters|| "[]")),
|
|
|
|
|
+ shareCode: resData.shareCode,
|
|
|
|
|
+ chartCodes: chartCodes,
|
|
|
|
|
+ demo: resData.demo
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let fields = [];
|
|
|
|
|
+ for(let key in data) {
|
|
|
|
|
+ fields.push({
|
|
|
|
|
+ name: key,
|
|
|
|
|
+ value: data[key]
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ yield put({ type: 'dashboardDesigner/silentSetFields', fields: fields });
|
|
|
|
|
+ }else {
|
|
|
|
|
+ message.error('解析看板错误: ' + (res.err || res.data.msg));
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch(e) {
|
|
|
|
|
+ message.error('解析看板错误: ' + e);
|
|
|
|
|
+ }finally {
|
|
|
|
|
+ yield put({ type: 'dashboardDesigner/silentSetField', name: 'loading', value: false });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
subscriptions: {
|
|
subscriptions: {
|
|
|
setup({ dispatch, history}) {
|
|
setup({ dispatch, history}) {
|