From 13058f0936ad73b10f2cc19b46c777b4d4f0eb2f Mon Sep 17 00:00:00 2001 From: kaeery <3491123437@qq.com> Date: Wed, 26 Feb 2025 11:22:45 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=8B=9B=E7=94=9F=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=B8=BB=E6=8E=A7=E7=AB=AF=E3=80=91=20=E4=BC=98=E5=8C=96#=20?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/area-common/Map.vue | 41 --- src/components/area-common/Search.vue | 52 ---- src/components/area-common/Table.vue | 86 ------ .../area-common/hooks/useServiceArea.ts | 263 ------------------ src/components/area-common/styles/area.scss | 12 - src/components/area-common/styles/map.scss | 36 --- src/components/area-select/index.vue | 55 ---- .../channel-select-user/channel-popup.vue | 87 ------ .../channel-select-user/distributeTable.vue | 107 ------- src/components/channel-select-user/index.vue | 35 --- .../channel-select-user/table-detail.vue | 84 ------ .../channel-select-user/userTable.vue | 74 ----- src/components/footer-btns/index.vue | 30 -- src/components/good-select/good-popup.vue | 191 ------------- src/components/good-select/index.vue | 41 --- src/components/good-select/table-detail.vue | 71 ----- .../money-detail/moneyDetailDialog.vue | 55 ---- src/components/service-area/index.vue | 54 ---- src/components/service-area/table-detail.vue | 43 --- src/components/service-select/index.vue | 61 ---- .../service-select/service-popup.vue | 170 ----------- .../service-select/table-detail.vue | 91 ------ 22 files changed, 1739 deletions(-) delete mode 100644 src/components/area-common/Map.vue delete mode 100644 src/components/area-common/Search.vue delete mode 100644 src/components/area-common/Table.vue delete mode 100644 src/components/area-common/hooks/useServiceArea.ts delete mode 100644 src/components/area-common/styles/area.scss delete mode 100644 src/components/area-common/styles/map.scss delete mode 100644 src/components/area-select/index.vue delete mode 100644 src/components/channel-select-user/channel-popup.vue delete mode 100644 src/components/channel-select-user/distributeTable.vue delete mode 100644 src/components/channel-select-user/index.vue delete mode 100644 src/components/channel-select-user/table-detail.vue delete mode 100644 src/components/channel-select-user/userTable.vue delete mode 100644 src/components/footer-btns/index.vue delete mode 100644 src/components/good-select/good-popup.vue delete mode 100644 src/components/good-select/index.vue delete mode 100644 src/components/good-select/table-detail.vue delete mode 100644 src/components/money-detail/moneyDetailDialog.vue delete mode 100644 src/components/service-area/index.vue delete mode 100644 src/components/service-area/table-detail.vue delete mode 100644 src/components/service-select/index.vue delete mode 100644 src/components/service-select/service-popup.vue delete mode 100644 src/components/service-select/table-detail.vue diff --git a/src/components/area-common/Map.vue b/src/components/area-common/Map.vue deleted file mode 100644 index af1251d..0000000 --- a/src/components/area-common/Map.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/src/components/area-common/Search.vue b/src/components/area-common/Search.vue deleted file mode 100644 index b303582..0000000 --- a/src/components/area-common/Search.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/src/components/area-common/Table.vue b/src/components/area-common/Table.vue deleted file mode 100644 index 2bb176c..0000000 --- a/src/components/area-common/Table.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - - - diff --git a/src/components/area-common/hooks/useServiceArea.ts b/src/components/area-common/hooks/useServiceArea.ts deleted file mode 100644 index 1cf4bf3..0000000 --- a/src/components/area-common/hooks/useServiceArea.ts +++ /dev/null @@ -1,263 +0,0 @@ -import { nextTick, type Ref, unref, watch } from "vue" -import { useRequest } from "@/hooks/useFetchData" -import { usePaging } from "@/hooks/usePaging" -import { addArea, apiMapLocation, delArea, getAreaListByLocation, getLonAndLatByArea } from "@/api/service/area" -import type { Pager, Location } from '@/config/symbol' -import { VITE_MAP_KEY } from "@/config/env" -import { toast } from "@/utils/util" - -/**用户操作 */ -export function useAreaOperation(inited = true) { - const areaSearch = ref() - const tcMap = ref() - const zone = ref('') //地区 - const regionCode = ref() //地区编码 - const base = ref>() //区域列表信息 - const address = ref() //当前地址信息 - const isInited = ref(true) //初始化 - - // 查询 - const handleSearch = (form: any) => { - const params = { - address: encodeURIComponent(form.area.join('')), - key: VITE_MAP_KEY - } - const { runFn } = useRequest({ - apiFn: getLonAndLatByArea, - onSuccess(response) { - const { result: { location, address_components, ad_info } } = response - searchCommon({ location, address_components, ad_info }) - }, - }) - runFn(params) - } - // 查询后操作 - const searchCommon = (payload: any) => { - const { location, address_components, ad_info } = payload - if (isInited.value) { - tcMap.value?.setMapCenter(location) - areaSearch.value?.setCascaderValue(address_components) - } - address.value = payload - zone.value = address_components.district - regionCode.value = ad_info.adcode - fetchAreaList() - } - // 添加区域 - const increment = async (payload: any) => { - const { runFn } = useRequest({ - apiFn: addArea, - onSuccess(response) { - tcMap.value.removePolygon() - toast('添加成功', 'success') - fetchAreaList() - }, - }) - runFn(payload) - } - /**获取区域列表 */ - const fetchAreaList = async () => { - const params = { - regionId: regionCode.value - } - const { pager, getLists } = usePaging({ - fetchFun: getAreaListByLocation, - params - }) - await getLists() - base.value = Object.assign(pager, { - getLists - }) - } - /**初始化当前位置 */ - const initPosition = async () => { - const params = { key: VITE_MAP_KEY } - const { runFn } = useRequest({ - apiFn: apiMapLocation, - onSuccess(response) { - const { result: { location, ad_info } } = response - searchCommon({ location, address_components: ad_info, ad_info }) - } - }) - runFn(params) - isInited.value = inited - } - - onMounted(initPosition) - - return { - tcMap, - areaSearch, - zone, - regionCode, - increment, - searchCommon, - handleSearch, - base, - address, - isInited - } -} - -/**表格操作 */ -export function useAreaTableOperation({ tcMap, base, aTable }: { tcMap: any, base: Ref, aTable: any }) { - - /**选中 */ - const toggleRowSelection = (selectData: any[]) => { - const tableData = base.value.lists - const selectedIds = selectData?.map(item => item.id) as number[] - const selectedList = tableData.filter(data => selectedIds.includes(data.id)) - - tableData.forEach(data => { - aTable.value.tableRef.toggleRowSelection(data, false) - }) - selectedList.forEach(row => { - aTable.value.tableRef.toggleRowSelection(row, true) - }) - } - /**定位 */ - const handleLocation = (row: any) => { - const convertPolygons = row.polygongeo.replace("POLYGON((", '').replace("))", '').split(',') - const polygonPaths = convertPolygons.map((path: string) => { - const [lng, lat] = path.split(' ') - return { - lat: parseFloat(lat), - lng: parseFloat(lng) - } - }) - - tcMap.value.initPolygon({ - polygonId: row.id, - polygonPaths - }) - } - /**删除 */ - const handleDelete = async (id: number) => { - const { runFn } = useRequest({ - apiFn: delArea, - onSuccess(response) { - toast('删除成功', 'success') - base.value.getLists() - } - }) - runFn({ id }) - } - - return { - handleLocation, - handleDelete, - toggleRowSelection, - } -} - -/**地图 */ -export function useAreaMapOperation(parentApi: any) { - - let map, polygon, editor; - const TMap = (window as any).TMap - - const mapRef = ref() - const drawId = ref([]) - - /**初始化地图 */ - function initMap() { - map = new TMap.Map(mapRef.value, { - zoom: 12, - viewMode: '2D' - }) - } - /**设置地图中心 */ - function setMapCenter(location: Location) { - const { lat, lng } = location - map!.setCenter(new TMap.LatLng(lat, lng)) - } - /**绘制多边形 */ - const drawPolygon = () => { - polygon = new TMap.MultiPolygon({ - map: map - }) - editor = new TMap.tools.GeometryEditor({ - map: map, - overlayList: [ - { - overlay: polygon, - id: 'polygon', - } - ], - actionMode: TMap.tools.constants.EDITOR_ACTION.DRAW, // 编辑器的工作模式 - activeOverlayId: 'polygon', // 激活图层 - snappable: true, - }) - editor.on('draw_complete', geometry => { - drawId.value.push(geometry.id) - geometry.paths.splice(geometry.paths.length, 0, geometry.paths[0]) - parentApi?.showDialog({ - polygonPaths: geometry.paths - }) - }) - } - /**表格定位=>初始化多边形 */ - function initPolygon({ polygonId, polygonPaths }: { polygonId: number, polygonPaths: Location[] }) { - - if (polygonId === polygon?.id) return - - polygon = new TMap.MultiPolygon({ - id: polygonId, // 图层id - map: map, // 显示多边形图层的底图 - styles: { - // 多边形的相关样式 - polygon: new TMap.PolygonStyle({ - color: 'rgb(250, 250, 122)', // 面填充色 - showBorder: false, // 是否显示拔起面的边线 - borderColor: '#00FFFF', // 边线颜色 - }), - }, - geometries: [ - { - id: 'polygon', // 多边形图形数据的标志信息 - styleId: 'polygon', // 样式id - paths: polygonPaths, // 多边形的位置信息 - properties: { - // 多边形的属性数据 - title: 'polygon', - }, - }, - ], - }) - } - /**移除多边形 (先选中再删除)*/ - function removePolygon() { - editor!.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT).select(drawId.value).setSelectable(true) - editor!.delete() - } - - onMounted(() => { - nextTick(initMap) - }) - - return { - mapRef, - setMapCenter, - drawPolygon, - removePolygon, - initPolygon - } -} - -/**弹框 */ -export function useDialogOperation(regionCode: Ref) { - const infoDialogRef = ref() - - function showDialog(payload: any) { - const params = { - title: '绘制确认', - rawData: { ...payload, regionCode: regionCode.value } - } - infoDialogRef.value.acceptParams(params) - } - - return { - infoDialogRef, - showDialog - } -} \ No newline at end of file diff --git a/src/components/area-common/styles/area.scss b/src/components/area-common/styles/area.scss deleted file mode 100644 index 6e2afea..0000000 --- a/src/components/area-common/styles/area.scss +++ /dev/null @@ -1,12 +0,0 @@ -.area { - display: grid; - grid-template-columns: 1fr; - grid-template-rows: 50px minmax(100px, auto); - gap: 20px; - - &__part { - display: grid; - grid-template-columns: 1fr minmax(400px, 1fr); - gap: 20px; - } -} \ No newline at end of file diff --git a/src/components/area-common/styles/map.scss b/src/components/area-common/styles/map.scss deleted file mode 100644 index 2ef690d..0000000 --- a/src/components/area-common/styles/map.scss +++ /dev/null @@ -1,36 +0,0 @@ -.map { - position: relative; - flex: 1; - - &__inner { - width: 100%; - height: 100%; - } - - #toolControl { - position: absolute; - top: 10px; - left: 0px; - right: 0px; - margin: auto; - width: 252px; - z-index: 1001; - - .toolItem { - width: 30px; - height: 30px; - float: left; - margin: 1px; - padding: 4px; - border-radius: 3px; - background-size: 30px 30px; - background-position: 4px 4px; - background-repeat: no-repeat; - box-shadow: 0 1px 2px 0 #e4e7ef; - background-color: #ffffff; - border: 1px solid #ffffff; - background-image: url('https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/polygon.png'); - background-position: center; - } - } -} \ No newline at end of file diff --git a/src/components/area-select/index.vue b/src/components/area-select/index.vue deleted file mode 100644 index 1471e37..0000000 --- a/src/components/area-select/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - diff --git a/src/components/channel-select-user/channel-popup.vue b/src/components/channel-select-user/channel-popup.vue deleted file mode 100644 index b8a72fd..0000000 --- a/src/components/channel-select-user/channel-popup.vue +++ /dev/null @@ -1,87 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/channel-select-user/distributeTable.vue b/src/components/channel-select-user/distributeTable.vue deleted file mode 100644 index 28e2424..0000000 --- a/src/components/channel-select-user/distributeTable.vue +++ /dev/null @@ -1,107 +0,0 @@ - - - - - diff --git a/src/components/channel-select-user/index.vue b/src/components/channel-select-user/index.vue deleted file mode 100644 index 62dbc29..0000000 --- a/src/components/channel-select-user/index.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/src/components/channel-select-user/table-detail.vue b/src/components/channel-select-user/table-detail.vue deleted file mode 100644 index f9bca6a..0000000 --- a/src/components/channel-select-user/table-detail.vue +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/components/channel-select-user/userTable.vue b/src/components/channel-select-user/userTable.vue deleted file mode 100644 index 3690f66..0000000 --- a/src/components/channel-select-user/userTable.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - - - diff --git a/src/components/footer-btns/index.vue b/src/components/footer-btns/index.vue deleted file mode 100644 index fd7fe5b..0000000 --- a/src/components/footer-btns/index.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/src/components/good-select/good-popup.vue b/src/components/good-select/good-popup.vue deleted file mode 100644 index a414eed..0000000 --- a/src/components/good-select/good-popup.vue +++ /dev/null @@ -1,191 +0,0 @@ - - - - - diff --git a/src/components/good-select/index.vue b/src/components/good-select/index.vue deleted file mode 100644 index 6aaf9b9..0000000 --- a/src/components/good-select/index.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/good-select/table-detail.vue b/src/components/good-select/table-detail.vue deleted file mode 100644 index 9ea98a0..0000000 --- a/src/components/good-select/table-detail.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/components/money-detail/moneyDetailDialog.vue b/src/components/money-detail/moneyDetailDialog.vue deleted file mode 100644 index a66065d..0000000 --- a/src/components/money-detail/moneyDetailDialog.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - diff --git a/src/components/service-area/index.vue b/src/components/service-area/index.vue deleted file mode 100644 index e385897..0000000 --- a/src/components/service-area/index.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - diff --git a/src/components/service-area/table-detail.vue b/src/components/service-area/table-detail.vue deleted file mode 100644 index fd369ee..0000000 --- a/src/components/service-area/table-detail.vue +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/src/components/service-select/index.vue b/src/components/service-select/index.vue deleted file mode 100644 index d1eb95d..0000000 --- a/src/components/service-select/index.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - - diff --git a/src/components/service-select/service-popup.vue b/src/components/service-select/service-popup.vue deleted file mode 100644 index 3fe4e35..0000000 --- a/src/components/service-select/service-popup.vue +++ /dev/null @@ -1,170 +0,0 @@ - - - - - diff --git a/src/components/service-select/table-detail.vue b/src/components/service-select/table-detail.vue deleted file mode 100644 index 4fe6172..0000000 --- a/src/components/service-select/table-detail.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - - - -