From 28bbc32efb52fb10d51d2eb15304a01d1e202349 Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Fri, 15 Nov 2024 16:31:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(superManagement):=20=E6=8F=90?= =?UTF-8?q?=E5=8F=96=E5=90=88=E5=B9=B6=E5=8D=95=E5=85=83=E6=A0=BC=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 ckProjectDetail 和 deductedDetail 函数中的合并单元格计算逻辑提取到单独的函数 calculationMergeSpan 中- 在 assessmentRecord/index.tsx 中添加 calculationMergeSpan 函数实现合并单元格计算 - 通过提取公共逻辑,提高代码复用性和可维护性 --- .../police/assessmentCriteria/index.ts | 31 +-------- .../police/assessmentRecord/index.tsx | 65 ++++++++++--------- 2 files changed, 36 insertions(+), 60 deletions(-) diff --git a/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts index e5813a9..8b1bd57 100644 --- a/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts +++ b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts @@ -7,6 +7,7 @@ import {deleteDataModal, submitSimpleFormModal} from "@/components/tsx/ModalPro. import api from "@/axios"; import {message} from "ant-design-vue"; import {dictSelectNodes} from "@/config/dict.ts"; +import {calculationMergeSpan} from "@/views/unitManage/police/assessmentRecord"; export const saveOrUpdateCkProject = (params: SaveOrUpdateCkProjectParams = { name: '', @@ -62,35 +63,7 @@ export const deleteCkProjectById = (name: string, ckProjectId: string, callback: export const ckProjectDetail = async (ckProjectId: string): Promise => { const {data} = await api.get('/assessmentCriteria/ckProjectDetail', {ckProjectId}) - - const groupRowSpan: Record = {} - const itemRowSpan: Record = {} - - data.forEach((item, index) => { - //如果第一次没有值 - if (item.ckGroupId) { - if (!groupRowSpan[item.ckGroupId]) { - groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index} - } else { - groupRowSpan[item.ckGroupId].count++; - data[index].groupRowSpan = 0 - } - } - - if (item.ckItemId) { - if (!itemRowSpan[item.ckItemId]) { - itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index} - } else { - itemRowSpan[item.ckItemId].count++; - data[index].itemRowSpan = 0 - } - } - }) - - Object.values(groupRowSpan).forEach(({count, firstIndex}) => data[firstIndex].groupRowSpan = count) - - Object.values(itemRowSpan).forEach(({count, firstIndex}) => data[firstIndex].itemRowSpan = count) - + calculationMergeSpan(data) return data } diff --git a/superManagement/src/views/unitManage/police/assessmentRecord/index.tsx b/superManagement/src/views/unitManage/police/assessmentRecord/index.tsx index 0a62bbe..029dcc4 100644 --- a/superManagement/src/views/unitManage/police/assessmentRecord/index.tsx +++ b/superManagement/src/views/unitManage/police/assessmentRecord/index.tsx @@ -5,37 +5,8 @@ import {Modal, Table} from "ant-design-vue"; export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo) => { const {data} = await api.get('/assessmentRecord/deductedDetail', {assessmentRecordId: assessmentRecord.snowFlakeId}) - const groupRowSpan: Record = {} - const itemRowSpan: Record = {} - data.forEach((item, index) => { - //如果第一次没有值 - if (item.ckGroupId) { - if (!groupRowSpan[item.ckGroupId]) { - groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index} - } else { - groupRowSpan[item.ckGroupId].count++; - data[index].groupRowSpan = 0 - } - } - - if (item.ckItemId) { - if (!itemRowSpan[item.ckItemId]) { - itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index} - } else { - itemRowSpan[item.ckItemId].count++; - data[index].itemRowSpan = 0 - } - } - }) - - Object.values(groupRowSpan).forEach(({count, firstIndex}) => { - data[firstIndex].groupRowSpan = count; - }) - - Object.values(itemRowSpan).forEach(({count, firstIndex}) => { - data[firstIndex].itemRowSpan = count; - }) + calculationMergeSpan(data) const ckProjectDetailTableColumns: ColumnsType = [ { @@ -99,5 +70,37 @@ export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo) > }) - +} + +/** + * 计算合并数值 + * @param data + */ +export const calculationMergeSpan = (data: Record[]) => { + const groupRowSpan: Record = {} + const itemRowSpan: Record = {} + + data.forEach((item, index) => { + //如果第一次没有值 + if (item.ckGroupId) { + if (!groupRowSpan[item.ckGroupId]) { + groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index} + } else { + groupRowSpan[item.ckGroupId].count++; + data[index].groupRowSpan = 0 + } + } + + if (item.ckItemId) { + if (!itemRowSpan[item.ckItemId]) { + itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index} + } else { + itemRowSpan[item.ckItemId].count++; + data[index].itemRowSpan = 0 + } + } + }) + + Object.values(groupRowSpan).forEach(({count, firstIndex}) => data[firstIndex].groupRowSpan = count) + Object.values(itemRowSpan).forEach(({count, firstIndex}) => data[firstIndex].itemRowSpan = count) } From c228add1b3424004cf4cfc8d440f4b7aeab57d3b Mon Sep 17 00:00:00 2001 From: TimSpan Date: Fri, 15 Nov 2024 17:06:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=82=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- policeManagement/.env.development | 9 + policeManagement/.env.production | 7 +- policeManagement/package-lock.json | 8 + policeManagement/package.json | 1 + policeManagement/src/assets/scss/myAntD.scss | 178 ++++++++++++++++++ .../src/components/aMap/MapContainer.vue | 2 +- policeManagement/src/main.ts | 13 +- .../src/types/components/map/index.ts | 44 +++++ .../views/unitManage/police/policeUnit.ts | 110 +++++++++++ policeManagement/src/utils/aMapUtil.ts | 2 +- policeManagement/src/views/query/index.tsx | 5 +- policeManagement/src/vite-env.d.ts | 6 +- 12 files changed, 370 insertions(+), 15 deletions(-) create mode 100644 policeManagement/src/assets/scss/myAntD.scss create mode 100644 policeManagement/src/types/components/map/index.ts create mode 100644 policeManagement/src/types/views/unitManage/police/policeUnit.ts diff --git a/policeManagement/.env.development b/policeManagement/.env.development index 09fc9f3..8ecf877 100644 --- a/policeManagement/.env.development +++ b/policeManagement/.env.development @@ -11,3 +11,12 @@ VITE_APP_PROXY_URL=http://172.10.10.93:8765 # rsa 公钥 VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R0NWIOBciHCr7P7coDT8tNKfelgR7txcJOqHCO/MIWe7T04aHQTcpQxqx9hMca7dbqz8TZpz9jvLzE/6ZonVKxHsoFnNlHMp1/CPAJ9f6D9wYicum2KltJkmQ0g//D9W2zPCYoGOmSRFcZx/KEBa4EM53jQIDAQAB + +# 高德 +VITE_APP_GAODE_KEY=ca549d915cb38803582ca7e85c5f972c +VITE_APP_GAODE_VERSION=2.0 +VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f + +# VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +# VITE_APP_GAODE_VERSION=2.0 +# VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f \ No newline at end of file diff --git a/policeManagement/.env.production b/policeManagement/.env.production index d7a7d29..3d56736 100644 --- a/policeManagement/.env.production +++ b/policeManagement/.env.production @@ -7,4 +7,9 @@ VITE_DROP_CONSOLE=true VITE_APP_BASE_API=/api VITE_APP_PROXY_URL=http://172.10.10.93:8765 # rsa 公钥 -VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpu1C3JHZ+Ng/eVVCZtwKsOZv9RktpAL13pKy4FoRHyNv2t8TPV2AMzLzfEzlWx001nBxyVxEMR2N9jAcqFLHv7r16ciOzbtzB9dky2G+bc9jIs4/EdVK5bAZcPRh5Jrb78sC9PHyR4AeceDyCIKHLUbWBJB4NTZE0s1Wh5kMynQIDAQAB \ No newline at end of file +VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpu1C3JHZ+Ng/eVVCZtwKsOZv9RktpAL13pKy4FoRHyNv2t8TPV2AMzLzfEzlWx001nBxyVxEMR2N9jAcqFLHv7r16ciOzbtzB9dky2G+bc9jIs4/EdVK5bAZcPRh5Jrb78sC9PHyR4AeceDyCIKHLUbWBJB4NTZE0s1Wh5kMynQIDAQAB + +# 高德 +VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +VITE_APP_GAODE_VERSION=2.0 +VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f \ No newline at end of file diff --git a/policeManagement/package-lock.json b/policeManagement/package-lock.json index 249163b..31dd593 100644 --- a/policeManagement/package-lock.json +++ b/policeManagement/package-lock.json @@ -23,6 +23,7 @@ "vue-uuid": "^3.0.0" }, "devDependencies": { + "@amap/amap-jsapi-types": "^0.0.15", "@types/lodash-es": "^4.17.12", "@types/node": "^22.5.1", "@vitejs/plugin-vue": "^5.1.2", @@ -55,6 +56,13 @@ "integrity": "sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==", "license": "MIT" }, + "node_modules/@amap/amap-jsapi-types": { + "version": "0.0.15", + "resolved": "https://registry.npmmirror.com/@amap/amap-jsapi-types/-/amap-jsapi-types-0.0.15.tgz", + "integrity": "sha512-oqyRqHpVDZh5bUe2mAJh41ZsziSj0eUzwcfIbiaBNB0eiTJnZNhKsTdk77VOklOjwuwNfsblpKW9LjmWNpeQ7A==", + "dev": true, + "license": "MIT" + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", diff --git a/policeManagement/package.json b/policeManagement/package.json index 9ab1b46..ae7a398 100644 --- a/policeManagement/package.json +++ b/policeManagement/package.json @@ -25,6 +25,7 @@ "vue-uuid": "^3.0.0" }, "devDependencies": { + "@amap/amap-jsapi-types": "^0.0.15", "@types/lodash-es": "^4.17.12", "@types/node": "^22.5.1", "@vitejs/plugin-vue": "^5.1.2", diff --git a/policeManagement/src/assets/scss/myAntD.scss b/policeManagement/src/assets/scss/myAntD.scss new file mode 100644 index 0000000..f2e201e --- /dev/null +++ b/policeManagement/src/assets/scss/myAntD.scss @@ -0,0 +1,178 @@ +/* 扩展ant design pro按钮组件颜色 */ +$--my-antd-important: !important; + +.btn-danger { + color: #ffffff; + background-color: #F5222D; + border-color: #F5222D; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #ff4d4f $--my-antd-important; + border-color: #ff4d4f $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #cf1322 $--my-antd-important; + border-color: #cf1322 $--my-antd-important; + } +} + +.btn-volcano { + color: #ffffff; + background-color: #FA541C; + border-color: #FA541C; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #ff7a45 $--my-antd-important; + border-color: #ff7a45 $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #d4380d $--my-antd-important; + border-color: #d4380d $--my-antd-important; + } +} + +.btn-warn { + color: #ffffff; + background-color: #FAAD14; + border-color: #FAAD14; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #ffc53d $--my-antd-important; + border-color: #ffc53d $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #d48806 $--my-antd-important; + border-color: #d48806 $--my-antd-important; + } +} + +.btn-success { + color: #ffffff; + background-color: #52C41A; + border-color: #52C41A; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #73d13d $--my-antd-important; + border-color: #73d13d $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #389e0d $--my-antd-important; + border-color: #389e0d $--my-antd-important; + } +} + +.button-color-cyan { + color: #ffffff; + background-color: #13C2C2; + border-color: #13C2C2; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #36cfc9 $--my-antd-important; + border-color: #36cfc9 $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #08979c $--my-antd-important; + border-color: #08979c $--my-antd-important; + } +} + +.btn-daybreak { + color: #ffffff; + background-color: #1890FF; + border-color: #1890FF; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #096dd9 $--my-antd-important; + border-color: #096dd9 $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #40a9ff $--my-antd-important; + border-color: #40a9ff $--my-antd-important; + } +} + +.button-color-geekblue { + color: #ffffff; + background-color: #2F54EB; + border-color: #2F54EB; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #1d39c4 $--my-antd-important; + border-color: #1d39c4 $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #597ef7 $--my-antd-important; + border-color: #597ef7 $--my-antd-important; + } +} + +.btn-purple { + color: #ffffff; + background-color: #722ED1; + border-color: #722ED1; + + &:hover, + &:focus { + color: #ffffff $--my-antd-important; + background-color: #9254de $--my-antd-important; + border-color: #9254de $--my-antd-important; + } + + &:active, + &.active { + color: #ffffff $--my-antd-important; + background-color: #531dab $--my-antd-important; + border-color: #531dab $--my-antd-important; + } +} + +.table-row-warn td { + background-color: #fefca6; +} + +.table-row-danger td { + background-color: #f79988; +} + +.table-row-success td { + background-color: #b6fcbe; +} + +.ant-table-summary td { + background: #edeff6; +} \ No newline at end of file diff --git a/policeManagement/src/components/aMap/MapContainer.vue b/policeManagement/src/components/aMap/MapContainer.vue index cc287ff..8eb4f20 100644 --- a/policeManagement/src/components/aMap/MapContainer.vue +++ b/policeManagement/src/components/aMap/MapContainer.vue @@ -7,7 +7,7 @@