diff --git a/.env.development b/.env.development index a322e76..6fd5bbc 100644 --- a/.env.development +++ b/.env.development @@ -35,8 +35,4 @@ VITE_APP_WEBSOCKET = false # sse 开关 VITE_APP_SSE = true -# 高德地图 Key(设备上图/地图选点/大屏使用,在高德开放平台申请 Web端(JS API)) -VITE_AMAP_KEY = '' -# 高德地图安全密钥(JSAPI 2.0 配合 key 使用) -VITE_AMAP_SECURITYCODE = '' VITE_DINGTALK_CORP_ID = 'dingac2932b8bc38a94735c2f4657eb6378f' diff --git a/.env.production b/.env.production index 2b4035f..8588fd3 100644 --- a/.env.production +++ b/.env.production @@ -38,8 +38,4 @@ VITE_APP_WEBSOCKET = false # sse 开关 VITE_APP_SSE = true -# 高德地图 Key(设备上图/地图选点/大屏使用,在高德开放平台申请 Web端(JS API)) -VITE_AMAP_KEY = '' -# 高德地图安全密钥(JSAPI 2.0 配合 key 使用) -VITE_AMAP_SECURITYCODE = '' VITE_DINGTALK_CORP_ID = 'dingac2932b8bc38a94735c2f4657eb6378f' diff --git a/dist.zip b/dist.zip new file mode 100644 index 0000000..c42ef46 Binary files /dev/null and b/dist.zip differ diff --git a/src/api/sbgl/common/index.ts b/src/api/sbgl/common/index.ts index 2f08a32..531577e 100644 --- a/src/api/sbgl/common/index.ts +++ b/src/api/sbgl/common/index.ts @@ -38,3 +38,21 @@ export function getDeptUsers(deptId: string | number, nickName?: string): AxiosP params: { deptId, nickName: nickName || undefined } }); } + +/** 地址解析为经纬度(后端代理高德服务,登录即可) */ +export function amapGeocode(address: string): AxiosPromise<{ lng: number; lat: number; address: string }> { + return request({ + url: '/sbgl/common/geocode', + method: 'get', + params: { address } + }); +} + +/** 经纬度解析为地址(后端代理高德服务,登录即可) */ +export function amapRegeo(lng: number, lat: number): AxiosPromise<{ address: string }> { + return request({ + url: '/sbgl/common/regeo', + method: 'get', + params: { lng, lat } + }); +} diff --git a/src/api/sbgl/device/index.ts b/src/api/sbgl/device/index.ts index 803ddfa..6530954 100644 --- a/src/api/sbgl/device/index.ts +++ b/src/api/sbgl/device/index.ts @@ -1,7 +1,7 @@ import request from '@/utils/request'; import { download } from '@/utils/request'; import { AxiosPromise } from 'axios'; -import { DeviceVO, DeviceQuery, DeviceForm, ImportResultVO, LifecycleVO } from './types'; +import { DeviceVO, DeviceQuery, DeviceForm, ImportResultVO, LifecycleVO, DeviceExportTaskVO } from './types'; // 设备分页列表 export function listDevice(query: DeviceQuery): AxiosPromise { @@ -94,6 +94,32 @@ export function exportDevice(query: DeviceQuery) { return download('/sbgl/device/export', query, `设备台账_${new Date().getTime()}.xlsx`); } +// 启动异步导出(大数据量) +export function exportDeviceAsync(query: DeviceQuery): AxiosPromise { + return request({ + url: '/sbgl/device/exportAsync', + method: 'post', + data: query + }); +} + +// 查询异步导出任务 +export function getDeviceExportTask(taskId: string): AxiosPromise { + return request({ + url: '/sbgl/device/exportTask/' + taskId, + method: 'get' + }); +} + +// 获取异步导出文件(Blob,前端自行保存,不弹下载 loading) +export function getDeviceExportFile(taskId: string): Promise { + return request({ + url: `/sbgl/device/exportTask/${taskId}/download`, + method: 'get', + responseType: 'blob' + }) as unknown as Promise; +} + // 设备全生命周期时间线 export function getLifecycle(id: string | number): AxiosPromise { return request({ diff --git a/src/api/sbgl/device/types.ts b/src/api/sbgl/device/types.ts index 41b3fda..745f1b7 100644 --- a/src/api/sbgl/device/types.ts +++ b/src/api/sbgl/device/types.ts @@ -25,6 +25,7 @@ export interface DeviceVO { export interface DeviceQuery extends PageQuery { deviceCode?: string; deviceName?: string; + keyword?: string; typeId?: string | number; deptId?: string | number; status?: string; @@ -54,13 +55,23 @@ export interface ImportResultVO { errors: string[]; } +export interface DeviceExportTaskVO { + taskId: string; + status: 'PENDING' | 'RUNNING' | 'SUCCESS' | 'FAIL'; + total: number; + fileName?: string; + url?: string; + message?: string; + createTime?: string; + finishTime?: string; +} + export interface LifecycleVO { deviceId: string | number; deviceCode: string; deviceName: string; status: string; createTime: string; - repairCount: number; timeline: TimelineItem[]; } @@ -69,5 +80,4 @@ export interface TimelineItem { nodeType: string; content: string; operator?: string; - orderId?: string | number; } diff --git a/src/api/sbgl/workorder/types.ts b/src/api/sbgl/workorder/types.ts index 673e672..96c4fd2 100644 --- a/src/api/sbgl/workorder/types.ts +++ b/src/api/sbgl/workorder/types.ts @@ -11,6 +11,9 @@ export interface WorkOrderVO { reportBy?: string | number; reportName?: string; reportTime?: string; + reportLng?: number; + reportLat?: number; + reportAddress?: string; dispatchTime?: string; handlerId?: string | number; handlerName?: string; @@ -73,6 +76,7 @@ export interface WorkOrderForm { deadline?: string; reportLng?: number; reportLat?: number; + reportAddress?: string; } export interface HandleForm { diff --git a/src/components/SbLocationPicker/index.vue b/src/components/SbLocationPicker/index.vue new file mode 100644 index 0000000..bcf92f0 --- /dev/null +++ b/src/components/SbLocationPicker/index.vue @@ -0,0 +1,262 @@ + + + + + diff --git a/src/components/SbMap/index.vue b/src/components/SbMap/index.vue index 09f8e87..a88de10 100644 --- a/src/components/SbMap/index.vue +++ b/src/components/SbMap/index.vue @@ -111,6 +111,10 @@ function initMap() { emit('pick', point); }); renderPoints(); + // 组件挂载时已有选中点(如设备已有坐标),补画标记 + if (props.pickMode && props.selected?.lng && props.selected?.lat) { + setPickMarker(props.selected); + } // 容器尺寸变化(如侧栏收起、页面切换)后重算地图,避免点击偏移/瓦片错位 resizeObserver = new ResizeObserver(() => { @@ -267,7 +271,13 @@ watch( watch( () => props.selected, (val) => { - if (val && val.lng) setPickMarker(val); + if (val && val.lng) { + setPickMarker(val); + } else if (pickMarker && map) { + map.removeLayer(pickMarker); + pickMarker = null; + lastValidPick = null; + } }, { deep: true } ); diff --git a/src/utils/amap.ts b/src/utils/amap.ts new file mode 100644 index 0000000..62f0d91 --- /dev/null +++ b/src/utils/amap.ts @@ -0,0 +1,31 @@ +/** + * 高德地理编码工具。 + * 地址解析/逆解析由后端代理高德 Web 服务完成,前端无需配置 JSAPI Key。 + */ + +import { amapGeocode, amapRegeo } from '@/api/sbgl/common'; + +/** 后端已配置高德服务,地址解析可用 */ +export const hasAmapKey = () => true; + +/** 地址 → 经纬度 */ +export async function geocodeAddress(address: string): Promise<{ lng: number; lat: number; address: string }> { + const res: any = await amapGeocode(address); + const data = res?.data; + const lng = Number(data?.lng); + const lat = Number(data?.lat); + if (!Number.isFinite(lng) || !Number.isFinite(lat)) { + throw new Error('未找到该地址,请换个地址或直接点击地图选点'); + } + return { lng, lat, address: data?.address || address }; +} + +/** 经纬度 → 地址 */ +export async function reverseGeocode(lng: number, lat: number): Promise { + const res: any = await amapRegeo(lng, lat); + const address = res?.data?.address; + if (!address) { + throw new Error('未获取到地址'); + } + return address; +} diff --git a/src/utils/geo.ts b/src/utils/geo.ts index 5841d13..d7dc15f 100644 --- a/src/utils/geo.ts +++ b/src/utils/geo.ts @@ -48,3 +48,88 @@ export function locateDistrict(geoJson: any, lng: number, lat: number): string { export function isPointInGeoJson(geoJson: any, lng: number, lat: number): boolean { return locateDistrict(geoJson, lng, lat) !== ''; } + +/** + * 按地址中的区县名称查找区划中心点(无地理编码服务时的粗略定位兜底)。 + * 返回点保证落在区划内。 + */ +export function findDistrictCenter(geoJson: any, address: string): { lng: number; lat: number; name: string } | null { + const features = geoJson?.features ?? []; + const feature = features.find((f: any) => { + const name = f?.properties?.name; + return name && (address.includes(name) || address.includes(name.replace(/[市县区]$/, ''))); + }); + if (!feature?.geometry) return null; + const geometry = feature.geometry; + const polygons: number[][][][] = geometry.type === 'MultiPolygon' + ? geometry.coordinates + : geometry.type === 'Polygon' ? [geometry.coordinates] : []; + const rings = polygons.flatMap((poly) => poly?.[0] ?? []).filter((ring) => ring?.length); + if (!rings.length) return null; + + let minLng = Infinity; + let minLat = Infinity; + let maxLng = -Infinity; + let maxLat = -Infinity; + let sumLng = 0; + let sumLat = 0; + let count = 0; + for (const ring of rings) { + for (const [lng, lat] of ring) { + minLng = Math.min(minLng, lng); + maxLng = Math.max(maxLng, lng); + minLat = Math.min(minLat, lat); + maxLat = Math.max(maxLat, lat); + sumLng += lng; + sumLat += lat; + count++; + } + } + const name = feature.properties.name; + const bboxCenter = { lng: (minLng + maxLng) / 2, lat: (minLat + maxLat) / 2 }; + if (isPointInGeoJson({ features: [feature] }, bboxCenter.lng, bboxCenter.lat)) { + return { ...bboxCenter, name }; + } + const avg = { lng: sumLng / count, lat: sumLat / count }; + if (isPointInGeoJson({ features: [feature] }, avg.lng, avg.lat)) { + return { ...avg, name }; + } + const [lng, lat] = rings[0][0]; + return { lng, lat, name }; +} + +const PI = Math.PI; +const A = 6378245.0; +const EE = 0.00669342162296594323; + +function transformLat(lng: number, lat: number): number { + let ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng)); + ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0; + ret += ((20.0 * Math.sin(lat * PI) + 40.0 * Math.sin((lat / 3.0) * PI)) * 2.0) / 3.0; + ret += ((160.0 * Math.sin((lat / 12.0) * PI) + 320 * Math.sin((lat * PI) / 30.0)) * 2.0) / 3.0; + return ret; +} + +function transformLng(lng: number, lat: number): number { + let ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng)); + ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0; + ret += ((20.0 * Math.sin(lng * PI) + 40.0 * Math.sin((lng / 3.0) * PI)) * 2.0) / 3.0; + ret += ((150.0 * Math.sin((lng / 12.0) * PI) + 300.0 * Math.sin((lng / 30.0) * PI)) * 2.0) / 3.0; + return ret; +} + +/** WGS84(浏览器 GPS)→ GCJ-02(高德底图),避免定位偏移 */ +export function wgs84ToGcj02(lng: number, lat: number): { lng: number; lat: number } { + if (lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271) { + return { lng, lat }; + } + let dLat = transformLat(lng - 105.0, lat - 35.0); + let dLng = transformLng(lng - 105.0, lat - 35.0); + const radLat = (lat / 180.0) * PI; + let magic = Math.sin(radLat); + magic = 1 - EE * magic * magic; + const sqrtMagic = Math.sqrt(magic); + dLat = (dLat * 180.0) / (((A * (1 - EE)) / (magic * sqrtMagic)) * PI); + dLng = (dLng * 180.0) / ((A / sqrtMagic) * Math.cos(radLat) * PI); + return { lng: lng + dLng, lat: lat + dLat }; +} diff --git a/src/views/sbgl/device/detail.vue b/src/views/sbgl/device/detail.vue index d3c106d..992d79a 100644 --- a/src/views/sbgl/device/detail.vue +++ b/src/views/sbgl/device/detail.vue @@ -117,7 +117,6 @@ {{ formatDate(device.createTime) }} {{ formatDate(device.updateTime) }} - {{ lifecycle?.repairCount ?? 0 }} 次 {{ lifecycle?.timeline?.length ?? 0 }} 条 @@ -125,18 +124,53 @@ - - - -
{{ item.content }}
-
- 操作人:{{ item.operator }} - 关联工单:{{ item.orderId }} -
-
-
- + + + + +
{{ item.content }}
+
+ 操作人:{{ item.operator }} +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
@@ -151,6 +185,7 @@ import { listDetailFields } from '@/api/sbgl/devicetype'; import { DeviceFieldVO } from '@/api/sbgl/devicetype/types'; import { getDevice, getLifecycle } from '@/api/sbgl/device'; import { DeviceVO, LifecycleVO } from '@/api/sbgl/device/types'; +import { listOrder } from '@/api/sbgl/workorder'; import { listBusinessOss } from '@/api/sbgl/common'; import { fieldValueArray, formatFieldValue } from '../devicetype/fieldTypes'; @@ -162,13 +197,19 @@ interface OssEntry { const route = useRoute(); const router = useRouter(); const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const { sb_device_status } = toRefs(proxy?.useDict('sb_device_status')); +const { sb_device_status, sb_order_status, sb_order_type } = toRefs( + proxy?.useDict('sb_device_status', 'sb_order_status', 'sb_order_type') +); const loading = ref(true); const device = ref(null); const fields = ref([]); const lifecycle = ref(null); const ossMap = ref>({}); +const activeTab = ref('lifecycle'); +const orderRows = ref([]); +const orderTotal = ref(0); +const orderLoading = ref(false); const deviceId = computed(() => String(route.params.id ?? '')); const attrs = computed>(() => parseAttrs(device.value?.attrs)); @@ -193,6 +234,29 @@ const formatDate = (value?: string | Date | null, pattern = '{y}-{m}-{d} {h}:{i} return proxy?.parseTime(value, pattern) ?? '-'; }; +const formatMoney = (value: any): string => + value === null || value === undefined || value === '' ? '-' : `¥${Number(value).toFixed(2)}`; + +/** 工单当前环节用待办动作展示 */ +const orderPhaseLabel = (type?: string) => + ({ APPROVAL: '待审批', ACCEPT: '待接单', DISPATCH: '待派单', FINISH: '待完工', VERIFY: '待验收', SUPERVISE: '待监理确认' }[type || ''] || ''); + +/** 设备关联工单 */ +const loadOrders = async () => { + if (!deviceId.value) return; + orderLoading.value = true; + try { + const res: any = await listOrder({ deviceId: deviceId.value, pageNum: 1, pageSize: 100 } as any); + orderRows.value = res.rows ?? []; + orderTotal.value = Number(res.total ?? orderRows.value.length); + } catch { + orderRows.value = []; + orderTotal.value = 0; + } finally { + orderLoading.value = false; + } +}; + /** 图片/附件字段存 OSS 文件ID,详情展示前批量换取访问地址 */ const loadOssUrls = async () => { const ids = new Set(); @@ -271,6 +335,7 @@ const loadDetail = async () => { } catch { lifecycle.value = null; } + await loadOrders(); await loadOssUrls(); } catch { device.value = null; diff --git a/src/views/sbgl/device/index.vue b/src/views/sbgl/device/index.vue index 16b4455..a8fdcea 100644 --- a/src/views/sbgl/device/index.vue +++ b/src/views/sbgl/device/index.vue @@ -5,7 +5,8 @@ - + @@ -121,7 +122,8 @@ - + @@ -323,7 +325,8 @@ import { listType, listTypeOptions, listEnabledFields } from '@/api/sbgl/devicetype'; import { DeviceTypeVO, DeviceFieldVO } from '@/api/sbgl/devicetype/types'; import { parseFieldOptions, fieldValueArray, formatFieldValue, normalizeFieldValue } from '../devicetype/fieldTypes'; -import { listDevice, getDevice, addDevice, updateDevice, delDevice, importTemplate, importData, exportDevice, listRecycleDevice, restoreDevice } from '@/api/sbgl/device'; +import FileSaver from 'file-saver'; +import { listDevice, getDevice, addDevice, updateDevice, delDevice, importTemplate, importData, exportDevice, exportDeviceAsync, getDeviceExportTask, getDeviceExportFile, listRecycleDevice, restoreDevice } from '@/api/sbgl/device'; import { DeviceVO, DeviceQuery, DeviceForm, ImportResultVO } from '@/api/sbgl/device/types'; import { getCommonDeptTree, listBusinessOss } from '@/api/sbgl/common'; import { isPointInGeoJson } from '@/utils/geo'; @@ -357,6 +360,17 @@ const importForm = reactive({ typeId: '' as any, mode: 'add' as 'add' | 'upsert' const importResult = ref(null); const fileInputRef = ref(); +/** 数据量超过该值转后台导出(不展示任务窗口,完成后自动下载) */ +const ASYNC_EXPORT_THRESHOLD = 1000; +let exportTaskTimer: ReturnType | null = null; + +const clearExportTimer = () => { + if (exportTaskTimer) { + clearInterval(exportTaskTimer); + exportTaskTimer = null; + } +}; + // ---------------- 回收站 ---------------- const recycleVisible = ref(false); const recycleLoading = ref(false); @@ -486,7 +500,7 @@ const parseAttrsJson = (attrs: any): Record => { const getList = async () => { loading.value = true; - queryParams.value.deviceCode = keyword.value; + queryParams.value.keyword = keyword.value || undefined; const res = await listDevice(queryParams.value); deviceList.value = (res.rows ?? []).map((row) => ({ ...row, attrs: parseAttrsJson(row.attrs) })); total.value = res.total; @@ -588,7 +602,7 @@ const handleUpdate = async (row: DeviceVO) => { deptId: data.deptId, lng: data.lng, lat: data.lat, - status: data.status, + status: data.status || '0', attrs: parseAttrsJson(data.attrs), installDate: data.installDate, installLocation: data.installLocation, @@ -605,13 +619,13 @@ const handleUpdate = async (row: DeviceVO) => { const submitForm = () => { deviceFormRef.value?.validate(async (valid: boolean) => { if (!valid) return; - const needLocation = formTypeOptions.value.find((t) => String(t.id) === String(form.value.typeId))?.needLocation === 1; - if (needLocation && (form.value.lng === undefined || form.value.lat === undefined)) { - proxy?.$modal.msgWarning('该类型设备必须填写经纬度(可使用地图选点)'); + const hasLng = form.value.lng !== undefined && form.value.lng !== null && String(form.value.lng).trim() !== ''; + const hasLat = form.value.lat !== undefined && form.value.lat !== null && String(form.value.lat).trim() !== ''; + if (hasLng !== hasLat) { + proxy?.$modal.msgWarning('经度和纬度需同时填写,或同时留空'); return; } - if (form.value.lng !== undefined && form.value.lat !== undefined - && !isPointInGeoJson(quzhouGeo, Number(form.value.lng), Number(form.value.lat))) { + if (hasLng && hasLat && !isPointInGeoJson(quzhouGeo, Number(form.value.lng), Number(form.value.lat))) { proxy?.$modal.msgWarning('设备位置必须在衢州市行政区划范围内'); return; } @@ -709,7 +723,52 @@ const handleImport = async () => { } }; +const saveExportFile = async (taskId: string, fileName?: string) => { + try { + const blob = await getDeviceExportFile(taskId); + if (blob && blob.size > 0) { + FileSaver.saveAs(blob, fileName || '设备台账.xlsx'); + } + } catch { + // 静默失败,不打扰当前操作 + } +}; + +const pollExportThenDownload = (taskId: string) => { + clearExportTimer(); + const tick = async () => { + try { + const res = await getDeviceExportTask(taskId); + if (res.data.status === 'SUCCESS') { + clearExportTimer(); + // 后台生成完成后自动保存文件,不弹窗 + void saveExportFile(taskId, res.data.fileName); + } else if (res.data.status === 'FAIL') { + clearExportTimer(); + } + } catch { + clearExportTimer(); + } + }; + void tick(); + exportTaskTimer = setInterval(tick, 2000); +}; + +const startBackgroundExport = async () => { + try { + const res = await exportDeviceAsync(queryParams.value); + pollExportThenDownload(res.data.taskId); + } catch { + // 后台导出失败不打扰当前操作 + } +}; + const handleExport = () => { + // 数据量较大时转后台导出:无窗口、无等待,完成后自动下载 + if (total.value > ASYNC_EXPORT_THRESHOLD) { + void startBackgroundExport(); + return; + } proxy?.$modal.confirm('是否按当前筛选条件导出设备台账?').then(() => { return exportDevice(queryParams.value); }); @@ -726,7 +785,18 @@ const loadTypeOptions = async () => { typeOptions.value = typeRes.data ?? []; }; -let typeOptionsActivated = false; +/** 打开类型下拉时刷新,保证刚新增的类型立即出现 */ +const handleTypeDropdownVisible = (visible: boolean) => { + if (visible) { + void loadTypeOptions(); + } +}; + +const refreshTypeOptionsIfVisible = () => { + if (!document.hidden) { + void loadTypeOptions(); + } +}; onMounted(async () => { await loadTypeOptions(); @@ -734,14 +804,19 @@ onMounted(async () => { const deptRes = await getCommonDeptTree(); deptOptions.value = (deptRes.data ?? []) as any[]; getList(); + document.addEventListener('visibilitychange', refreshTypeOptionsIfVisible); + window.addEventListener('focus', refreshTypeOptionsIfVisible); }); onActivated(() => { - // 首次激活由 onMounted 加载,之后每次从其他页签切回来都重新拉取类型 - if (typeOptionsActivated) { - loadTypeOptions(); - } - typeOptionsActivated = true; + // 每次从其他菜单/页签切回设备台账都重新拉取类型 + void loadTypeOptions(); +}); + +onBeforeUnmount(() => { + document.removeEventListener('visibilitychange', refreshTypeOptionsIfVisible); + window.removeEventListener('focus', refreshTypeOptionsIfVisible); + clearExportTimer(); }); diff --git a/src/views/sbgl/h5/order.vue b/src/views/sbgl/h5/order.vue index 5117051..0b8d875 100644 --- a/src/views/sbgl/h5/order.vue +++ b/src/views/sbgl/h5/order.vue @@ -37,9 +37,13 @@ {{ statusLabel(o.status) }}
设备:{{ o.deviceName }}
+
+ 当前环节:{{ nodePhaseLabel(o.currentNodeType) || o.currentNodeName }} + +
处理人:{{ o.handlerName }}
- {{ o.reportName }} 报修 · {{ formatTime(o.createTime) }} + {{ o.reportName }} 报修 · {{ formatTime(o.reportTime || o.createTime) }} 已超时
@@ -63,9 +67,10 @@
{{ detail.orderCode }}
{{ detail.title || '-' }}
{{ detail.deviceName }}
+
{{ detail.reportAddress }}
{{ typeLabel(detail.orderType) }}
{{ detail.description }}
-
{{ detail.reportName }} · {{ formatTime(detail.createTime) }}
+
{{ detail.reportName }} · {{ formatTime(detail.reportTime || detail.createTime) }}
{{ detail.handlerName }}
{{ detail.maintainer }}
{{ formatTime(detail.deadline) }}
@@ -122,8 +127,10 @@ 派 单 完工提交 - - 审 批 + + + {{ nodeActionName(detail.currentNodeType) }} + 修 改 - + 催 办 关 闭 @@ -197,27 +204,64 @@ - + {{ approveNode.nodeName }}({{ approveNodeTypeLabel(approveNode.nodeType) }}) - - {{ formatMoney(approveNode.amount) }} - - + + 通过 驳回 - - + + @@ -257,18 +301,27 @@ - +
- - + + 扫码
+ +
+ + 地图 +
+
@@ -288,6 +341,9 @@
+ +

{{ loginError }}

@@ -328,11 +384,11 @@ const perm = (p: string) => permissions.value.includes(p) || permissions.value.i /** 状态页签(与 Web 端状态口径一致;多状态用逗号分隔,后端 in 查询) */ const tabs = [ { label: '全部', value: '' }, + { label: '待审批', value: 'PENDING_APPROVAL' }, { label: '待接单', value: 'TO_ACCEPT' }, { label: '待派单', value: 'PENDING_INTERNAL_DISPATCH' }, { label: '处理中', value: 'ACCEPTED,PROCESSING' }, { label: '待监理', value: 'PENDING_SUPERVISE' }, - { label: '待审批', value: 'PENDING_APPROVAL' }, { label: '待验收', value: 'PENDING_VERIFY' }, { label: '已完成', value: 'FINISHED' } ]; @@ -368,7 +424,7 @@ const verifyOpinion = ref(''); const superviseRejectVisible = ref(false); const superviseOpinion = ref(''); const approveVisible = ref(false); -const approveNode = reactive({ nodeName: '', nodeType: '', amount: 0 }); +const approveNode = reactive({ nodeName: '', nodeType: '' }); const approveForm = reactive<{ approveResult: number; approveOpinion: string }>({ approveResult: 1, approveOpinion: '' }); const internalDispatchVisible = ref(false); const internalDispatchHandlerId = ref(''); @@ -382,17 +438,60 @@ const editId = ref(''); const ORDER_TYPES: Record = { bx: '故障报修', xj: '日常巡检', by: '维修保养', az: '设备安装', cc: '设备拆除' }; -const createForm = reactive<{ orderType: string; deviceId: any; title: string; description: string; images: string; deadline: string }>({ - orderType: 'bx', deviceId: '', title: '', description: '', images: '', deadline: '' +const createForm = reactive<{ + orderType: string; deviceId: any; title: string; description: string; images: string; deadline: string; + reportLng?: number; reportLat?: number; reportAddress: string; +}>({ + orderType: 'bx', deviceId: '', title: '', description: '', images: '', deadline: '', reportAddress: '' }); +const locationPickerVisible = ref(false); +const locationPickerLng = ref(); +const locationPickerLat = ref(); +const locationPickerAddress = ref(''); +const onTypeChange = () => { + createForm.deviceId = ''; + createForm.reportLng = undefined; + createForm.reportLat = undefined; + createForm.reportAddress = ''; + loadDevices(); +}; +const onDeviceChange = () => { + const device = deviceOpts.value.find((item) => String(item.id) === String(createForm.deviceId)); + if (!device) { + createForm.reportLng = undefined; + createForm.reportLat = undefined; + createForm.reportAddress = ''; + return; + } + if (device.lng != null && device.lat != null) { + createForm.reportLng = Number(device.lng); + createForm.reportLat = Number(device.lat); + } + if (device.installLocation) { + createForm.reportAddress = device.installLocation; + } +}; +const openLocationPicker = () => { + locationPickerLng.value = createForm.reportLng; + locationPickerLat.value = createForm.reportLat; + locationPickerAddress.value = createForm.reportAddress || ''; + locationPickerVisible.value = true; +}; +const onLocationConfirm = (value: { lng?: number; lat?: number; address: string }) => { + createForm.reportLng = value.lng; + createForm.reportLat = value.lat; + createForm.reportAddress = value.address; +}; const formTypeId = ref(''); const typeOpts = ref([]); const deviceOpts = ref([]); /* ---------- 状态字典(与后台字典键一致) ---------- */ const STATUS_LABELS: Record = { + PENDING_DISPATCH: '待派单', TO_ACCEPT: '待接单', ACCEPTED: '已接单', + ARRIVED: '已到场', PROCESSING: '处理中', PENDING_SUPERVISE: '待监理确认', PENDING_APPROVAL: '待审批', @@ -442,7 +541,7 @@ const canEdit = computed( () => perm('sbgl:order:edit') && (isReporter.value || isAdmin.value) && - ['PENDING_DISPATCH', 'REJECTED', 'TO_ACCEPT'].includes(detail.value.status) + ['PENDING_DISPATCH', 'REJECTED'].includes(detail.value.status) ); /** 验收:验收权限 + 待验收状态 + 非处理人本人 */ const canVerify = computed( @@ -465,11 +564,15 @@ const canApproveNode = computed(() => perm('sbgl:order:query') && detail.value.c const canAcceptNode = computed(() => perm('sbgl:order:handle') && detail.value.canAccept === true); const approveNodeTypeLabel = (type: string) => ({ SUPERVISE: '监理确认', VERIFY: '验收', APPROVAL: '审批' }[type] || '审批'); +const nodeActionName = (type?: string) => + (type === 'VERIFY' ? '验收' : type === 'SUPERVISE' ? '监理确认' : '审批'); const canUrge = computed( () => + perm('sbgl:order:query') && + isReporter.value && + !['FINISHED', 'CLOSED', 'REJECTED'].includes(detail.value.status) && (!!detail.value.currentNodeId || - ['PENDING_DISPATCH', 'TO_ACCEPT', 'ACCEPTED', 'PROCESSING'].includes(detail.value.status)) && - isReporter.value + ['TO_ACCEPT', 'ACCEPTED', 'ARRIVED', 'PROCESSING'].includes(detail.value.status)) ); const canClose = computed( () => @@ -555,9 +658,11 @@ const openDetail = async (o: any) => { detail.value = res.data; const r = await listOrderRecords(o.id); records.value = (r as any).data ?? []; - // 流转记录里存的是 ossId(逗号分隔),需换算成访问 URL 才能展示 + // 流转记录/完工照片存的是 ossId(逗号分隔),需换算成访问 URL 才能展示 try { - const allIds = [...new Set(records.value.flatMap((rec: any) => (rec.images ? rec.images.split(',') : [])))].filter(Boolean).join(','); + const recordIds = records.value.flatMap((rec: any) => (rec.images ? rec.images.split(',') : [])); + const finishIds = detail.value.finishImages ? detail.value.finishImages.split(',') : []; + const allIds = [...new Set([...recordIds, ...finishIds])].filter(Boolean).join(','); if (allIds) { const ossRes = await listBusinessOss(allIds); const urlMap: Record = {}; @@ -567,6 +672,7 @@ const openDetail = async (o: any) => { rec.imageUrls = rec.images.split(',').map((id: string) => urlMap[id]).filter(Boolean).join(','); } }); + detail.value.finishImageUrls = finishIds.map((id: string) => urlMap[id]).filter(Boolean); } } catch (e) { // 换算失败不阻断详情展示 @@ -578,133 +684,6 @@ const openDetail = async (o: any) => { /** 是否钉钉容器内(钉钉 WebView 的 UA 带 DingTalk 标识) */ const isDingTalk = () => /DingTalk/i.test(navigator.userAgent); -/** 浏览器定位(仅非钉钉环境使用),WGS84 坐标转为 GCJ-02 与高德底图一致;带硬超时防止个别环境卡死 */ -const browserLocate = (): Promise<{ lng?: number; lat?: number }> => - new Promise((resolve) => { - let settled = false; - const done = (v: { lng?: number; lat?: number }) => { - if (settled) return; - settled = true; - clearTimeout(hardTimer); - resolve(v); - }; - // 硬超时:部分 WebView 的 getCurrentPosition 报了 timeout 也不回调,强制兜底 - const hardTimer = setTimeout(() => done({}), 8000); - if (!navigator.geolocation) return done({}); - navigator.geolocation.getCurrentPosition( - (pos) => { - const gcj = wgs84ToGcj02(pos.coords.longitude, pos.coords.latitude); - done({ lng: gcj.lng, lat: gcj.lat }); - }, - () => done({}), - { enableHighAccuracy: true, timeout: 6000 } - ); - }); - -/** WGS84 → GCJ-02(火星坐标)转换,偏移算法适用于中国境内 */ -const wgs84ToGcj02 = (lng: number, lat: number): { lng: number; lat: number } => { - const a = 6378245.0; - const ee = 0.00669342162296594323; - const transformLat = (x: number, y: number) => { - let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x)); - ret += ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0) / 3.0; - ret += ((20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin((y / 3.0) * Math.PI)) * 2.0) / 3.0; - ret += ((160.0 * Math.sin((y / 12.0) * Math.PI) + 320 * Math.sin((y * Math.PI) / 30.0)) * 2.0) / 3.0; - return ret; - }; - const transformLng = (x: number, y: number) => { - let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x)); - ret += ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0) / 3.0; - ret += ((20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin((x / 3.0) * Math.PI)) * 2.0) / 3.0; - ret += ((150.0 * Math.sin((x / 12.0) * Math.PI) + 300.0 * Math.sin((x / 30.0) * Math.PI)) * 2.0) / 3.0; - return ret; - }; - if (lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271) return { lng, lat }; - let dLat = transformLat(lng - 105.0, lat - 35.0); - let dLng = transformLng(lng - 105.0, lat - 35.0); - const radLat = (lat / 180.0) * Math.PI; - let magic = Math.sin(radLat); - magic = 1 - ee * magic * magic; - const sqrtMagic = Math.sqrt(magic); - dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * Math.PI); - dLng = (dLng * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * Math.PI); - return { lng: lng + dLng, lat: lat + dLat }; -}; - -const showLocateLoading = () => { - if (isDingTalk()) { - dd.device?.notification?.showPreloader?.({ text: '正在获取定位…', showIcon: true }); - } -}; -const hideLocateLoading = () => { - if (isDingTalk()) { - dd.device?.notification?.hidePreloader?.(); - } -}; - -/** 钉钉容器内定位:JSAPI device.geolocation.get(原生手机定位,需 dd.config 签名鉴权) - * 注意:该 JSAPI 仅移动端钉钉支持,PC 端钉钉不支持;钉钉内不降级浏览器定位(HTTP 页面会卡住), - * 任何环节失败都直接以空坐标继续签到流程,不阻断操作。 */ -const dingLocate = (): Promise<{ lng?: number; lat?: number }> => - new Promise((resolve) => { - // PC 端钉钉不支持定位 JSAPI(geolocation 壳子存在但调用永不回调),直接空坐标秒返回,不弹加载。 - // platform 取值有 pc/gdtPc 等多种变体,用 UA 判断最可靠:非移动端 UA 一律视为 PC - const isMobileUA = /iPhone|iPad|iPod|Android|Mobile/i.test(navigator.userAgent || ''); - if (!isMobileUA || !dd.device?.geolocation?.get) { - resolve({}); - return; - } - showLocateLoading(); - let settled = false; - const done = (v: { lng?: number; lat?: number }) => { - if (settled) return; - settled = true; - clearTimeout(guardTimer); - hideLocateLoading(); - resolve(v); - }; - // 超时保护:10 秒未拿到定位直接空坐标继续,避免流程卡死无反应 - const fallback = () => done({}); - const guardTimer = setTimeout(fallback, 10000); - - // 签名 URL 必须与当前页面地址一致(不含 hash) - const signUrl = window.location.href.split('#')[0]; - jsapiSign(signUrl) - .then((res: any) => { - const cfg = res?.data || {}; - dd.config({ - agentId: String(cfg.agentId ?? ''), - corpId, - timeStamp: String(cfg.timeStamp ?? ''), - nonceStr: cfg.nonceStr, - signature: cfg.signature, - jsApiList: ['device.geolocation.get', 'biz.util.scan'] - }); - dd.ready(() => { - try { - dd.device.geolocation.get({ - targetAccuracy: 200, - coordinate: 1, // 高德坐标(GCJ-02),与系统地图底图一致 - withReGeocode: false, - useCache: false, - onSuccess: (r: any) => done({ lng: r.longitude, lat: r.latitude }), - onFail: fallback - }); - } catch { - fallback(); - } - }); - }) - .catch(fallback); - }); - -/** 获取定位:钉钉内只走原生 JSAPI 定位(失败/超时则不带坐标继续,绝不降级浏览器定位防卡死); - * 非钉钉环境(普通浏览器)走浏览器定位。均不阻断完工提交流程。 */ -const getLocation = (): Promise<{ lng?: number; lat?: number }> => { - if (isDingTalk()) return dingLocate(); - return browserLocate(); -}; - const doHandle = async (action: 'ACCEPT') => { submitting.value = true; try { @@ -864,7 +843,6 @@ const doSupervise = async (result: number) => { const openApproveNode = () => { approveNode.nodeName = detail.value.currentNodeName || ''; approveNode.nodeType = detail.value.currentNodeType || ''; - approveNode.amount = Number(detail.value.amount ?? 0); approveForm.approveResult = 1; approveForm.approveOpinion = ''; approveVisible.value = true; @@ -872,7 +850,7 @@ const openApproveNode = () => { const doApproveNode = async () => { if (approveForm.approveResult === 0 && !approveForm.approveOpinion.trim()) { - ElMessage.warning('驳回时请填写审批意见'); + ElMessage.warning(`驳回时请填写${nodeActionName(approveNode.nodeType)}意见`); return; } submitting.value = true; @@ -965,7 +943,14 @@ const scanDevice = async () => { formTypeId.value = device.typeId; await loadDevices(device.deviceName); createForm.deviceId = device.id; - ElMessage.success(`已匹配设备:${device.deviceName}(${device.deviceCode})`); + if (device.lng != null && device.lat != null) { + createForm.reportLng = Number(device.lng); + createForm.reportLat = Number(device.lat); + } + if (device.installLocation) { + createForm.reportAddress = device.installLocation; + } + ElMessage.success(`已匹配设备:${device.deviceName}${device.deviceCode ? '(' + device.deviceCode + ')' : ''}`); } catch { // 错误提示由请求拦截器统一处理 } @@ -977,12 +962,11 @@ const scanDevice = async () => { const openCreate = async () => { editId.value = ''; - Object.assign(createForm, { orderType: 'bx', deviceId: '', title: '', description: '', images: '', deadline: '' }); + Object.assign(createForm, { orderType: 'bx', deviceId: '', title: '', description: '', images: '', deadline: '', reportLng: undefined, reportLat: undefined, reportAddress: '' }); formTypeId.value = ''; - if (typeOpts.value.length === 0) { - const res = await listTypeOptions(); - typeOpts.value = (res as any).data ?? []; - } + // 每次打开都刷新类型,避免后台新增类型后 H5 看不到 + const typeRes = await listTypeOptions(); + typeOpts.value = (typeRes as any).data ?? []; await loadDevices(); submitVisible.value = true; }; @@ -995,19 +979,35 @@ const openEdit = async () => { title: detail.value.title, description: detail.value.description, images: detail.value.images || '', - deadline: detail.value.deadline || '' + deadline: detail.value.deadline || '', + reportLng: detail.value.reportLng, + reportLat: detail.value.reportLat, + reportAddress: detail.value.reportAddress || '' }); formTypeId.value = ''; - if (typeOpts.value.length === 0) { - const res = await listTypeOptions(); - typeOpts.value = (res as any).data ?? []; + // 每次打开都刷新类型,避免后台新增类型后 H5 看不到 + const typeRes = await listTypeOptions(); + typeOpts.value = (typeRes as any).data ?? []; + // 按设备名搜索候选项,避免原设备不在默认 20 条里导致下拉框显示为空 + await loadDevices(detail.value.deviceName || undefined); + // 历史工单没有报修位置时,用关联设备的安装位置补齐 + const currentDevice = deviceOpts.value.find((d) => String(d.id) === String(createForm.deviceId)); + if (currentDevice) { + if (!createForm.reportAddress && currentDevice.installLocation) { + createForm.reportAddress = currentDevice.installLocation; + } + if (createForm.reportLng == null && createForm.reportLat == null + && currentDevice.lng != null && currentDevice.lat != null) { + createForm.reportLng = Number(currentDevice.lng); + createForm.reportLat = Number(currentDevice.lat); + } } - await loadDevices(); submitVisible.value = true; }; const doSubmitOrder = async () => { if (!createForm.orderType) return ElMessage.warning('请选择工单类型'); + if (!createForm.reportAddress?.trim()) return ElMessage.warning('请选择报修位置'); if (!createForm.title?.trim()) return ElMessage.warning('请填写工单标题'); submitting.value = true; try { @@ -1056,6 +1056,32 @@ onMounted(async () => { color: #d9480f; } +.cost-tip { + margin-left: 4px; + color: #909399; + font-size: 12px; +} + +.approve-section-title { + margin: 10px 0 6px; + padding-left: 8px; + border-left: 3px solid #409eff; + font-weight: 600; + color: #303133; +} + +.finish-images { + display: flex; + gap: 8px; + flex-wrap: wrap; +} + +.finish-image { + width: 68px; + height: 68px; + border-radius: 4px; +} + .finish-cost { margin-bottom: 6px; color: #d9480f; @@ -1140,7 +1166,7 @@ onMounted(async () => { margin-left: 2px; } &__list { - padding: 10px 12px 30px; + padding: 10px 12px 90px; } &__tip { text-align: center; @@ -1179,11 +1205,17 @@ onMounted(async () => { display: flex; justify-content: space-between; align-items: center; + gap: 8px; margin-bottom: 6px; } &__title { + flex: 1; + min-width: 0; + overflow: hidden; font-weight: 600; color: #243244; + white-space: nowrap; + text-overflow: ellipsis; } &__row { color: #667; diff --git a/src/views/sbgl/screen/index.vue b/src/views/sbgl/screen/index.vue index 5671516..22c4935 100644 --- a/src/views/sbgl/screen/index.vue +++ b/src/views/sbgl/screen/index.vue @@ -77,8 +77,8 @@
类型:{{ selected.typeName }}
状态: - - {{ statusText(selected.status) }} + + {{ statusText(selected) }}
经纬度:{{ Number(selected.lng).toFixed(5) }}, {{ Number(selected.lat).toFixed(5) }}
@@ -108,8 +108,6 @@ import { formatFieldValue } from '../devicetype/fieldTypes'; import { locateDistrict } from '@/utils/geo'; import quzhouGeo from '@/assets/geo/quzhou.json'; -const { proxy } = getCurrentInstance() as any; -const { sb_device_status } = toRefs(proxy?.useDict('sb_device_status')); const overview = ref({}); const typeOptions = ref([]); @@ -127,13 +125,16 @@ const activeDistrict = ref(''); const mapRef = ref(); const geoFeatures = (quzhouGeo as any).features ?? []; -const statusText = (s?: string) => { - if (s === null || s === undefined || s === '') return '-'; - const hit = (sb_device_status?.value ?? []).find((d: any) => String(d.value) === String(s)); - return hit?.label ?? String(s); +const statusText = (device?: any) => { + const s = String(device?.status ?? ''); + return ({ '0': '在用', '1': '停用', '2': '维修中', '3': '已报废' } as Record)[s] || (s || '-'); +}; +const statusClass = (device?: any) => { + const s = String(device?.status ?? ''); + if (s === '2') return 'warn'; + if (s === '3' || s === '1') return 'bad'; + return 'ok'; }; -/** 状态标签颜色:0在用 1停用 2维修中 3已报废 */ -const statusClass = (s?: string) => (String(s) === '2' ? 'warn' : String(s) === '3' || String(s) === '1' ? 'bad' : 'ok'); /** 右侧详情面板的动态属性行 */ const attrRows = computed(() => { @@ -229,7 +230,7 @@ const visiblePoints = computed(() => .join(''); const popupHtml = `
${esc(d.deviceName)}
-
${esc(d.typeName ?? '')} · ${statusText(d.status)}
+
${esc(d.typeName ?? '')} · ${statusText(d)}
${attrRows}
${Number(d.lng).toFixed(5)}, ${Number(d.lat).toFixed(5)}
`; return { id: d.id, lng: Number(d.lng), lat: Number(d.lat), name: d.deviceName, icon: resolveIconUrl(d.typeIcon), popupHtml }; @@ -247,17 +248,16 @@ const onPointClick = (point: any) => { } }; -onMounted(async () => { - const [ov, types, byType, devStatus] = await Promise.all([getOverview(), listTypeOptions(), countByType(), deviceStatus()]); - overview.value = ov.data ?? {}; - typeOptions.value = types.data ?? []; - typeCountList.value = byType.data ?? []; - deviceStatusList.value = devStatus.data ?? []; - visibleTypes.value = typeOptions.value.map((t) => String(t.id)); +/* ---------- 大屏数据静默刷新 ---------- */ +const SCREEN_REFRESH_MS = 30000; +let refreshTimer: ReturnType | null = null; +let refreshing = false; +let typeSignature = ''; +let deviceSignature = ''; - // 拉取各类型的属性字段配置,用于点位弹窗与详情面板显示中文标签 +const loadFieldMeta = async (types: DeviceTypeVO[]) => { const labelEntries = await Promise.all( - typeOptions.value.map(async (t) => { + types.map(async (t) => { try { const res = await listEnabledFields(t.id as string | number); const map: Record = {}; @@ -269,12 +269,86 @@ onMounted(async () => { }) ); fieldMetaMap.value = Object.fromEntries(labelEntries); +}; - const res = await listMapDevice({}); - deviceList.value = (res.data ?? []).map((d: any) => ({ - ...d, - attrs: typeof d.attrs === 'string' ? JSON.parse(d.attrs) : d.attrs - })); +const loadScreenData = async (silent = false) => { + if (refreshing) return; + refreshing = true; + try { + const [ov, typesRes, byType, devStatus] = await Promise.all([ + getOverview(), listTypeOptions(), countByType(), deviceStatus() + ]); + overview.value = ov.data ?? {}; + typeCountList.value = byType.data ?? []; + deviceStatusList.value = devStatus.data ?? []; + + const types = typesRes.data ?? []; + const newTypeIds = types.map((t) => String(t.id)); + const nextTypeSignature = newTypeIds.join(','); + if (nextTypeSignature !== typeSignature) { + const oldTypeIds = typeOptions.value.map((t) => String(t.id)); + const wasAllSelected = oldTypeIds.length === 0 + || oldTypeIds.every((id) => visibleTypes.value.includes(id)); + typeOptions.value = types; + visibleTypes.value = wasAllSelected + ? newTypeIds + : newTypeIds.filter((id) => visibleTypes.value.includes(id) || !oldTypeIds.includes(id)); + typeSignature = nextTypeSignature; + // 类型变化时才重新拉取扩展字段配置,避免每轮刷新都发大量请求 + await loadFieldMeta(types); + } + + const res = await listMapDevice({}); + const nextDevices = (res.data ?? []).map((d: any) => ({ + ...d, + attrs: typeof d.attrs === 'string' ? JSON.parse(d.attrs) : d.attrs + })); + const nextDeviceSignature = nextDevices + .map((d: any) => [d.id, d.typeId, d.status, d.lng, d.lat, d.deviceName, d.deviceCode, d.updateTime].join(':')) + .join('|'); + if (nextDeviceSignature !== deviceSignature) { + deviceList.value = nextDevices; + deviceSignature = nextDeviceSignature; + if (selected.value) { + const current = nextDevices.find((d: any) => String(d.id) === String(selected.value?.id)); + selected.value = current + ? { ...current, attrs: typeof current.attrs === 'string' ? JSON.parse(current.attrs) : current.attrs } + : null; + } + } + } catch (e) { + // 自动刷新失败保留上一次数据,不打扰大屏展示 + if (!silent) { + console.warn('[大屏] 数据加载失败', e); + } + } finally { + refreshing = false; + } +}; + +const refreshWhenVisible = () => { + if (!document.hidden) { + void loadScreenData(true); + } +}; + +const stopRefreshTimer = () => { + if (refreshTimer) { + clearInterval(refreshTimer); + refreshTimer = null; + } +}; + +onMounted(async () => { + await loadScreenData(); + stopRefreshTimer(); + refreshTimer = setInterval(() => void loadScreenData(true), SCREEN_REFRESH_MS); + document.addEventListener('visibilitychange', refreshWhenVisible); +}); + +onBeforeUnmount(() => { + stopRefreshTimer(); + document.removeEventListener('visibilitychange', refreshWhenVisible); }); diff --git a/src/views/sbgl/workorder/index.vue b/src/views/sbgl/workorder/index.vue index 6fa9d07..228793e 100644 --- a/src/views/sbgl/workorder/index.vue +++ b/src/views/sbgl/workorder/index.vue @@ -92,7 +92,7 @@ v-hasPermi="['sbgl:order:handle']">完工 审批 + v-hasPermi="['sbgl:order:query']">{{ nodeActionName(scope.row.currentNodeType) }} 监理 @@ -127,10 +127,18 @@ - + placeholder="输入名称搜索设备(可空)" style="width: 100%" @change="onSubmitDeviceChange"> + + +
+ + 地图选择 +
+
@@ -151,6 +159,10 @@ + + + @@ -203,15 +215,36 @@ - + {{ approveDialog.title }} {{ approveDialog.nodeName }} {{ approveNodeTypeLabel(approveDialog.nodeType) }} -