diff --git a/src/permission.ts b/src/permission.ts index 266feeb..efb91bb 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -10,7 +10,7 @@ import useSettingsStore from '@/store/modules/settings'; import usePermissionStore from '@/store/modules/permission'; NProgress.configure({ showSpinner: false }); -const whiteList = ['/print', '/boardGenerate', '/boardView', '/boardConstruction', '/board1', '/board2', '/login', '/register', '/social-callback']; +const whiteList = ['/print', '/externalPrint', '/boardGenerate', '/boardView', '/boardConstruction', '/board1', '/board2', '/login', '/register', '/social-callback']; router.beforeEach(async (to, from, next) => { NProgress.start(); diff --git a/src/router/index.ts b/src/router/index.ts index 8a41fd8..e85723b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -26,6 +26,11 @@ import Layout from '@/layout/index.vue'; // 公共路由 export const constantRoutes: RouteRecordRaw[] = [ + { + path: '/externalPrint', + hidden: true, + component: () => import('@/views/print/externalPrint.vue') + }, { path: '/print', hidden: true, diff --git a/src/views/boardGenerate/dataSourceList.vue b/src/views/boardGenerate/dataSourceList.vue index b1a4e47..625ee45 100644 --- a/src/views/boardGenerate/dataSourceList.vue +++ b/src/views/boardGenerate/dataSourceList.vue @@ -109,12 +109,12 @@ @@ -164,7 +164,7 @@ const comparisonTable = { value: '值' }; -const isEasy = ref(false); +const isEasy = ref(true); const loading = ref(false); const paramsTableData = ref([]); const selectForm = ref({ @@ -210,6 +210,7 @@ const delData = () => { constructionDataFormVisible.value = true; }; const editDataSource = (e) => { + console.log(e); constructionDataFormVisible.value = true; constructionDataForm.value = e; }; @@ -243,8 +244,19 @@ const createData = () => { if (!constructionDataForm.value.designDataFieldList) { constructionDataForm.value.designDataFieldList = []; } + let params = JSON.parse(JSON.stringify(constructionDataForm.value)); + params.activeFlag = '1'; + params.designDataFieldList = params.designDataFieldList.map(e => { + return { + fieldType: '2', + activeFlag: '1', + dataSourceId: params.dataSourceId, + fieldOne: e.fieldOne, + fieldTwo: e.fieldTwo + }; + }); if (constructionDataForm.value.dataSourceId) { - editDataSourceApi(constructionDataForm.value).then(() => { + editDataSourceApi(params).then(() => { constructionDataFormVisible.value = false; ElMessage({ type: 'success', @@ -253,7 +265,7 @@ const createData = () => { getList(); }); } else { - addDataSourceApi(constructionDataForm.value).then(() => { + addDataSourceApi(params).then(() => { constructionDataFormVisible.value = false; ElMessage({ type: 'success', @@ -284,18 +296,18 @@ const findTier = () => { if (data?.data) { Object.keys(data.data?.[0]).forEach(key => { constructionDataForm.value.designDataFieldList.push({ - name: key, + fieldOne: key, remark: comparisonTable[key], - tier: `data,map%${key}` + fieldTwo: `data,map%${key}` }); }); } else if (data?.rows) { console.log(data?.rows); Object.keys(data.rows?.[0]).forEach(key => { constructionDataForm.value.designDataFieldList.push({ - name: key, + fieldOne: key, remark: comparisonTable[key], - tier: `rows,map%${key}` + fieldTwo: `rows,map%${key}` }); }); } else { @@ -304,9 +316,9 @@ const findTier = () => { if (!exclude.includes(key.toLowerCase())) { if (typeof data[key] === 'string' || typeof data[key] === 'string') { constructionDataForm.value.designDataFieldList.push({ - name: key, + fieldOne: key, remark: comparisonTable[key], - tier: `${key}` + fieldTwo: `${key}` }); } } diff --git a/src/views/boardGenerate/fieldMap.vue b/src/views/boardGenerate/fieldMap.vue index b1a4e47..2e122e5 100644 --- a/src/views/boardGenerate/fieldMap.vue +++ b/src/views/boardGenerate/fieldMap.vue @@ -210,6 +210,7 @@ const delData = () => { constructionDataFormVisible.value = true; }; const editDataSource = (e) => { + console.log(e); constructionDataFormVisible.value = true; constructionDataForm.value = e; }; diff --git a/src/views/boardGenerate/index.vue b/src/views/boardGenerate/index.vue index af60365..419505e 100644 --- a/src/views/boardGenerate/index.vue +++ b/src/views/boardGenerate/index.vue @@ -501,7 +501,8 @@ onMounted(async () => { return { name: e.dataSourceName, url: e.requestUrl, - method: e.requestMethod + method: e.requestMethod, + outputData: e.designDataFieldList }; }); }); diff --git a/src/views/boardGenerate/nodes/board/pieNode.vue b/src/views/boardGenerate/nodes/board/pieNode.vue index b043382..6e94c00 100644 --- a/src/views/boardGenerate/nodes/board/pieNode.vue +++ b/src/views/boardGenerate/nodes/board/pieNode.vue @@ -109,6 +109,7 @@ const getOption = () => { }; let xData = [props.inputData?.x1 || []]; let yData = [props.inputData?.y1 || []]; + console.log(props.inputData); let length = Math.min(...xData.map(e => e.length), ...yData.map(e => e.length)); let source = [['product', ...[props.data.options?.yNames?.[0] || '数量']]]; Array(length).fill(0).forEach((_, i) => { @@ -121,6 +122,7 @@ const getOption = () => { }); source.push(item); }); + console.log(source); return { ...chartOption, dataset: { diff --git a/src/views/boardGenerate/nodes/data/customDataNode.vue b/src/views/boardGenerate/nodes/data/customDataNode.vue index 9b4086a..5ac5605 100644 --- a/src/views/boardGenerate/nodes/data/customDataNode.vue +++ b/src/views/boardGenerate/nodes/data/customDataNode.vue @@ -82,8 +82,9 @@ const parseData = (data, rule) => { }; const getOutputData = () => { - let params = {}; - (props.data.customData.inputData || []).forEach((item) => { + + let params = props.inputData; + (Object.keys(props.inputData) || []).forEach((item) => { params[item.name] = props.inputData[item.name]; }); (options.isD ? request : axios.request)({ @@ -96,8 +97,9 @@ const getOutputData = () => { let data = (options.isD ? res : res.data); let output = {}; props.data.customData.outputData.forEach(item => { - output[item.name] = parseData(data, item.tier); + output[item.fieldOne] = parseData(data, item.fieldTwo); }); + console.log('output', output); props.data.outputData = output; }).catch(e => { isErr.value = true; diff --git a/src/views/boardGenerate/nodes/form/mapNode.vue b/src/views/boardGenerate/nodes/form/mapNode.vue index 176d0f1..707fddf 100644 --- a/src/views/boardGenerate/nodes/form/mapNode.vue +++ b/src/views/boardGenerate/nodes/form/mapNode.vue @@ -63,6 +63,8 @@ const convertData = () => { res[item] = props.inputData[item]; } }); + console.log(props.inputData); + console.log(props.data.options.dataMap); props.data.outputData = res; }; watch(() => JSON.parse(JSON.stringify(props.inputData)), (obj1, obj2) => { diff --git a/src/views/boardGenerate/tool.js b/src/views/boardGenerate/tool.js index 32b48e7..b3c9c1b 100644 --- a/src/views/boardGenerate/tool.js +++ b/src/views/boardGenerate/tool.js @@ -124,7 +124,7 @@ const tool = () => { }; export default tool; export const options = { - isD: false, isJSON: (str) => { + isD: true, isJSON: (str) => { if (typeof str === 'string') { try { JSON.parse(str); diff --git a/src/views/print/externalPrint.vue b/src/views/print/externalPrint.vue new file mode 100644 index 0000000..40db1a0 --- /dev/null +++ b/src/views/print/externalPrint.vue @@ -0,0 +1,261 @@ + + + + diff --git a/src/views/print/index.vue b/src/views/print/index.vue index 0c50829..171f0bd 100644 --- a/src/views/print/index.vue +++ b/src/views/print/index.vue @@ -567,7 +567,7 @@ const nodeChange = () => { .content { vertical-align: top; display: inline-block; - width: calc(100vw - 300px - 300px - 16px - 16px); + width: calc(100% - 300px - 300px - 16px - 16px); height: 100%; margin-top: 8px; border: 1px solid #ccc; diff --git a/src/views/print/view.vue b/src/views/print/view.vue index 322c985..01d6ca4 100644 --- a/src/views/print/view.vue +++ b/src/views/print/view.vue @@ -53,7 +53,7 @@ -
+
{ Promise.all(pros).then((values) => { window.print(); isPrint.value = false; + printPngList.value = []; }); }); } else {