diff --git a/src/renderer/public/excel/header.csv b/src/renderer/public/excel/header.csv new file mode 100644 index 0000000..42bcfef --- /dev/null +++ b/src/renderer/public/excel/header.csv @@ -0,0 +1,2 @@ +1,唯一标识,id +2,姓名,name diff --git a/src/renderer/public/sdk/custom/css/index.css b/src/renderer/public/sdk/custom/css/index.css index 491ccbf..5473aac 100644 --- a/src/renderer/public/sdk/custom/css/index.css +++ b/src/renderer/public/sdk/custom/css/index.css @@ -161,7 +161,7 @@ background: rgba(var(--color-base1), 0.2); border: 1px solid rgba(var(--color-base1), 0.5); display: flex; - justify-content: flex-start; + justify-content: center; align-items: center; padding: 5px 16px 4px 16px; color: #ffffff; @@ -448,6 +448,7 @@ .YJ-custom-base-dialog>.content .table { background-color: #ffffff00; color: #000; + font-size: 12px; } .YJ-custom-base-dialog>.content .table { @@ -475,9 +476,6 @@ border-top: none; } -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr, -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr {} - .YJ-custom-base-dialog>.content .table .table-empty { display: flex; align-items: center; @@ -554,8 +552,6 @@ background-color: rgba(var(--color-base1), 0.1); } -.YJ-custom-base-dialog>.content .table .table-body .tr:last-child {} - .YJ-custom-base-dialog>.content .table .tr .th, .YJ-custom-base-dialog>.content .table .tr .td { flex: 1; @@ -573,40 +569,7 @@ justify-content: center; } -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr .th:nth-child(1), -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr .td:nth-child(1), -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr .th:nth-child(1), -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr .td:nth-child(1) { - width: 164px; - flex: 0 0 164px; -} -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr .th:nth-child(2), -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr .td:nth-child(2), -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr .th:nth-child(2), -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr .td:nth-child(2) { - width: 226px; - flex: 0 0 226px; -} - -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr .th:nth-child(3), -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr .td:nth-child(3), -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr .th:nth-child(3), -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr .td:nth-child(3) { - flex: 0 0 150px; - width: 150px; - justify-content: center; -} - -.YJ-custom-base-dialog>.content .attribute-content-link .table .tr .td .input-group .input, -.YJ-custom-base-dialog>.content .attribute-content-vr .table .tr .td .input-group .input { - border-radius: 5px 0 0 5px; -} - -.YJ-custom-base-dialog>.content .attribute-content-materials .table .tr .th:nth-child(1), -.YJ-custom-base-dialog>.content .attribute-content-materials .table .tr .td:nth-child(1) { - flex: 0 0 60px; -} .YJ-custom-base-dialog>.content .table .tr .td .link-edit { min-height: 32px; @@ -621,68 +584,6 @@ border-right: none; } -.YJ-custom-base-dialog>.content .table.camera-table { - overflow-x: auto; -} - -.YJ-custom-base-dialog>.content .table.isc-table { - overflow: hidden; -} - -.YJ-custom-base-dialog>.content .table.camera-table .tr { - display: inline-flex; -} - -.YJ-custom-base-dialog>.content .table.isc-table .tr { - display: flex; -} - -.YJ-custom-base-dialog>.content .table.camera-table .tr:last-child, -.YJ-custom-base-dialog>.content .table.isc-table .tr:last-child { - border-bottom: 1px solid rgba(var(--color-base1), 0.5); -} - -.YJ-custom-base-dialog>.content .table.camera-table .tr .td span, -.YJ-custom-base-dialog>.content .table.isc-table .tr .td span { - white-space: nowrap; - margin-left: 10px; -} - -.YJ-custom-base-dialog>.content .table.camera-table .tr .td input[type=checkbox], -.YJ-custom-base-dialog>.content .table.isc-table .tr .td input[type=checkbox] { - cursor: pointer; -} - -.YJ-custom-base-dialog>.content .table.camera-table .table-body, -.YJ-custom-base-dialog>.content .table.isc-table .table-body { - display: inline-flex; - flex-direction: column; - height: 186px; - width: auto; -} - -.YJ-custom-base-dialog>.content .table.camera-table .tr .th, -.YJ-custom-base-dialog>.content .table.camera-table .tr .td { - flex: 0 100px; - width: 100px; - min-width: 100px; -} - -.YJ-custom-base-dialog>.content .table.isc-table .tr .th, -.YJ-custom-base-dialog>.content .table.isc-table .tr .td { - flex: 1; - width: auto; - min-width: auto; -} - -.YJ-custom-base-dialog>.content .table.camera-table .tr .th:first-child, -.YJ-custom-base-dialog>.content .table.camera-table .tr .td:first-child, -.YJ-custom-base-dialog>.content .table.isc-table .tr .th:first-child, -.YJ-custom-base-dialog>.content .table.isc-table .tr .td:first-child { - flex: 0 74px; - min-width: 74px; -} - .YJ-custom-base-dialog>.content select>option { color: #000; } @@ -1215,9 +1116,9 @@ line-height: 28px; } -.YJ-custom-base-dialog .ew-color-picker .ew-color-dropbtngroup button.ew-color-clear { +/* .YJ-custom-base-dialog .ew-color-picker .ew-color-dropbtngroup button.ew-color-clear { margin-right: 8px; -} +} */ .YJ-custom-base-dialog .ew-color-picker-box { border-width: 4px; @@ -1779,58 +1680,6 @@ top: 10px; } -/* 鐐规爣娉 */ -.YJ-custom-base-dialog.billboard-object>.content { - width: 590px; -} - -.YJ-custom-base-dialog.billboard-object>.content button.primary { - padding: 6px 14px; -} - -.YJ-custom-base-dialog.billboard-object>.content>div .row .col { - margin: 0 10px; -} - -.YJ-custom-base-dialog.billboard-object>.content>div .row .col:first-child { - margin-left: 0; -} - -.YJ-custom-base-dialog.billboard-object>.content>div .row .col:last-child { - margin-right: 0; -} - -.YJ-custom-base-dialog.billboard-object>.content>div .row .label { - flex: 0 0 56px; - white-space: nowrap; -} - -.YJ-custom-base-dialog.billboard-object>.content .DIV-cy-tab-content-pane .input-select { - width: 100px; -} - -.YJ-custom-base-dialog.billboard-object>.content .DIV-cy-tab-content-pane h4 { - font-size: 16px; - margin-bottom: 10px; -} - -.YJ-custom-base-dialog.billboard-object>.content div .image-box { - width: 23px; - height: 26px; - cursor: pointer; - border: 1px solid rgba(var(--color-base1), 0.2); - display: flex; - align-items: center; - justify-content: center; -} - -.YJ-custom-base-dialog.billboard-object>.content div .image { - max-width: 100%; - max-height: 100%; - width: auto; - height: auto; -} - /* 瀵屾枃鏈 */ .richText-box { position: absolute; diff --git a/src/renderer/src/components/Pagination/index.vue b/src/renderer/src/components/Pagination/index.vue index e89cf7b..c426b7a 100644 --- a/src/renderer/src/components/Pagination/index.vue +++ b/src/renderer/src/components/Pagination/index.vue @@ -10,7 +10,7 @@ :total="total" :small="isSmall" class="pagination" - :layout='"total, prev, pager, next, jumper" + (pageSizes===false?"":"sizes")' + :layout='"total, prev, pager, next, jumper" + (pageSizes===false?"":", sizes")' @size-change="handleSizeChange" @current-change="handleCurrentChange" /> @@ -94,9 +94,39 @@ const handleCurrentChange = (val) => { emit('pagination', { page: val, limit: pageSize.value }) } - diff --git a/src/renderer/src/icons/svg/download.svg b/src/renderer/src/icons/svg/download.svg new file mode 100644 index 0000000..bf49251 --- /dev/null +++ b/src/renderer/src/icons/svg/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/renderer/src/icons/svg/export.svg b/src/renderer/src/icons/svg/export.svg new file mode 100644 index 0000000..010445b --- /dev/null +++ b/src/renderer/src/icons/svg/export.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/renderer/src/icons/svg/importHeader.svg b/src/renderer/src/icons/svg/importHeader.svg index 9786685..7c38135 100644 --- a/src/renderer/src/icons/svg/importHeader.svg +++ b/src/renderer/src/icons/svg/importHeader.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/renderer/src/icons/svg/importHeader1.svg b/src/renderer/src/icons/svg/importHeader1.svg new file mode 100644 index 0000000..9786685 --- /dev/null +++ b/src/renderer/src/icons/svg/importHeader1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/renderer/src/icons/svg/search.svg b/src/renderer/src/icons/svg/search.svg new file mode 100644 index 0000000..ab7c475 --- /dev/null +++ b/src/renderer/src/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/renderer/src/views/components/propertyBox/vectorAttr.vue b/src/renderer/src/views/components/propertyBox/vectorAttr.vue index 7c7c4a5..209d882 100644 --- a/src/renderer/src/views/components/propertyBox/vectorAttr.vue +++ b/src/renderer/src/views/components/propertyBox/vectorAttr.vue @@ -2,12 +2,32 @@ - @@ -52,9 +69,17 @@ import { ref } from 'vue' import { inject } from 'vue' import { TreeApi } from '@/api/tree' +import { GisApi } from '@/api/gisApi' import { ElMessage, ElMessageBox } from 'element-plus' import Dialog from '@/components/dialog/baseDialog.vue' +import { + $sendElectronChanel, + $recvElectronChanel, + $removeElectronChanel +} from '@/utils/communication' import { useTreeNode } from '../tree/hooks/treeNode' +import { useI18n } from 'vue-i18n' +const { t } = useI18n() const FileSaver = require('file-saver') const XLSX = require('xlsx') @@ -69,6 +94,7 @@ let originalOptions: any let that: any const tableData: any = ref([]) const total: any = ref(0) +const pageSizes: any = ref([20, 50, 100]) const pageSize: any = ref(20) const pageNum: any = ref(1) const maxPageNum: any = ref(0) @@ -80,6 +106,7 @@ const closeCallback = () => { eventBus.emit("destroyComponent") } const getKeys = () => { + keyData.value = [] for (let key in that.geojson.features[0].properties) { let label = key for (let index = 0; index < that.options.headTables.length; index++) { @@ -219,9 +246,84 @@ const exportExcel = () => { const data = new Blob([excelBuffer], { type: 'application/octet-stream' }) FileSaver.saveAs(data, title.value + '.xlsx') } +const importHeader = () => { + let node + let selectNodes = getSelectedNodes(window.treeObj); + if (selectNodes && selectNodes[selectNodes.length - 1]) { + node = selectNodes[selectNodes.length - 1] + } + const dialogParams = { + properties: ["openFile", "multiSelections"], + filters: [ + { + name: "excel", + extensions: ["csv"], + }, + ], + }; + + openDirectoryDialog(dialogParams, (paths) => { + if (!paths.length) { + return; + } + let entity = (window as any)._entityMap.get(node.id) + if (!entity) { + return + } + GisApi.parseCsv({ filePath: paths[0] }).then((res) => { + if (res.code === 0 || res.code === 200) { + let params = JSON.parse(node.params) + params.headTables = res.data + entity.options.headTables = [...params.headTables] + let params2 = { + "id": node.id, + "sourceName": node.sourceName, + "params": params, + "isShow": node.isShow ? 1 : 0, + } + TreeApi.updateDirectoryInfo(params2) + cusUpdateNode({ "id": params2.id, "sourceName": params2.sourceName, "params": JSON.stringify(params) }) + getKeys() + } + }) + }); +} +const downloadHeader = async () => { + let p = 'csv' + + const { ipcRenderer } = require('electron') + let availablePort = await ipcRenderer.invoke('get-available-port') + + let url = `http://localhost:${availablePort}/excel/header.` + p + $sendElectronChanel('saveNetFile', { + title: '淇濆瓨鏂囦欢', + filename: '瀛楀吀妯℃澘', + filters: [{ name: '淇濆瓨鏂囦欢', extensions: [p] }], + url + }) + + $recvElectronChanel('saveNetFileRes', (e, key) => { + console.log(key, 'key') + ElMessage({ + message: '涓嬭浇缁撴潫', + type: 'success' + }) + $removeElectronChanel('saveNetFileRes', (res) => { + console.log(res) + }) + }) +} const close = () => { baseDialog.value?.close() } + +function openDirectoryDialog(option, cb) { + const { ipcRenderer } = require('electron') + ipcRenderer.send("open-directory-dialog", option); + ipcRenderer.once("selectedItem", (e, paths) => { + cb(paths); + }); +} defineExpose({ open, close @@ -263,4 +365,9 @@ defineExpose({ } } } +.YJ-custom-base-dialog { + ::v-deep .foot { + padding: 4px; + } +} \ No newline at end of file diff --git a/src/renderer/src/views/components/tree/hooks/treeNode.ts b/src/renderer/src/views/components/tree/hooks/treeNode.ts index 9aea6d0..ef37680 100644 --- a/src/renderer/src/views/components/tree/hooks/treeNode.ts +++ b/src/renderer/src/views/components/tree/hooks/treeNode.ts @@ -325,7 +325,7 @@ export const useTreeNode = () => { allowChildren: false }, vector: { - rightMenus: ['edit', 'del', 'setView', 'resetView', 'showAttr', 'importHeader'] + rightMenus: ['edit', 'del', 'setView', 'resetView', 'showAttr'] // render: renderShp, // detailFun: get_detail_shp, // allowChildren: true,