-f 框架搭建
This commit is contained in:
parent
9b5753481f
commit
6ceb0dc45f
@ -39,3 +39,4 @@ VITE_APP_SSE = true
|
|||||||
VITE_AMAP_KEY = ''
|
VITE_AMAP_KEY = ''
|
||||||
# 高德地图安全密钥(JSAPI 2.0 配合 key 使用)
|
# 高德地图安全密钥(JSAPI 2.0 配合 key 使用)
|
||||||
VITE_AMAP_SECURITYCODE = ''
|
VITE_AMAP_SECURITYCODE = ''
|
||||||
|
VITE_DINGTALK_CORP_ID = 'dingac2932b8bc38a94735c2f4657eb6378f'
|
||||||
|
|||||||
@ -42,3 +42,4 @@ VITE_APP_SSE = true
|
|||||||
VITE_AMAP_KEY = ''
|
VITE_AMAP_KEY = ''
|
||||||
# 高德地图安全密钥(JSAPI 2.0 配合 key 使用)
|
# 高德地图安全密钥(JSAPI 2.0 配合 key 使用)
|
||||||
VITE_AMAP_SECURITYCODE = ''
|
VITE_AMAP_SECURITYCODE = ''
|
||||||
|
VITE_DINGTALK_CORP_ID = 'dingac2932b8bc38a94735c2f4657eb6378f'
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
"await-to-js": "3.0.0",
|
"await-to-js": "3.0.0",
|
||||||
"axios": "1.13.6",
|
"axios": "1.13.6",
|
||||||
"crypto-js": "4.2.0",
|
"crypto-js": "4.2.0",
|
||||||
|
"dingtalk-jsapi": "^3.2.9",
|
||||||
"echarts": "6.0.0",
|
"echarts": "6.0.0",
|
||||||
"element-plus": "2.13.5",
|
"element-plus": "2.13.5",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
|
|||||||
19
src/api/sbgl/ding/index.ts
Normal file
19
src/api/sbgl/ding/index.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
// 钉钉免登:authCode 换系统 token
|
||||||
|
export function dingLogin(code: string) {
|
||||||
|
return request({
|
||||||
|
url: '/sbgl/ding/login',
|
||||||
|
method: 'post',
|
||||||
|
data: { code }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd.config 鉴权签名(JSAPI 需鉴权能力用,如手机定位 device.geolocation.get)
|
||||||
|
export function jsapiSign(url: string) {
|
||||||
|
return request({
|
||||||
|
url: '/sbgl/ding/jsapiSign',
|
||||||
|
method: 'get',
|
||||||
|
params: { url }
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -67,9 +67,11 @@ function initMap() {
|
|||||||
map = L.map(mapRef.value, {
|
map = L.map(mapRef.value, {
|
||||||
center: [center[1], center[0]], // Leaflet 是 [lat, lng]
|
center: [center[1], center[0]], // Leaflet 是 [lat, lng]
|
||||||
zoom: props.zoom ?? 12,
|
zoom: props.zoom ?? 12,
|
||||||
zoomControl: true,
|
zoomControl: false,
|
||||||
attributionControl: false
|
attributionControl: false
|
||||||
});
|
});
|
||||||
|
// 缩放控件放右下角:左上角常被图层面板/标题栏遮挡
|
||||||
|
L.control.zoom({ position: 'bottomright' }).addTo(map);
|
||||||
L.tileLayer(TILE_URLS[props.base ?? 'road'], TILE_OPTS).addTo(map);
|
L.tileLayer(TILE_URLS[props.base ?? 'road'], TILE_OPTS).addTo(map);
|
||||||
markerLayer = L.layerGroup().addTo(map);
|
markerLayer = L.layerGroup().addTo(map);
|
||||||
map.on('click', (e: L.LeafletMouseEvent) => {
|
map.on('click', (e: L.LeafletMouseEvent) => {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { usePermissionStore } from '@/store/modules/permission';
|
|||||||
import { ElMessage } from 'element-plus/es';
|
import { ElMessage } from 'element-plus/es';
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false });
|
NProgress.configure({ showSpinner: false });
|
||||||
const whiteList = ['/login', '/register', '/register*', '/register/*'];
|
const whiteList = ['/login', '/register', '/register*', '/register/*', '/h5/order', '/h5/*'];
|
||||||
|
|
||||||
const isWhiteList = (path: string) => {
|
const isWhiteList = (path: string) => {
|
||||||
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
||||||
|
|||||||
@ -77,6 +77,13 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||||||
name: 'SbScreen',
|
name: 'SbScreen',
|
||||||
meta: { title: '设备资产大屏', noCache: true }
|
meta: { title: '设备资产大屏', noCache: true }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/h5/order',
|
||||||
|
component: () => import('@/views/sbgl/h5/order.vue'),
|
||||||
|
hidden: true,
|
||||||
|
name: 'H5Order',
|
||||||
|
meta: { title: '运维工单', noCache: true }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/user',
|
path: '/user',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
import { getToken } from '@/utils/auth';
|
import { getToken, setToken } from '@/utils/auth';
|
||||||
import { tansParams, blobValidate } from '@/utils/ruoyi';
|
import { tansParams, blobValidate } from '@/utils/ruoyi';
|
||||||
import cache from '@/plugins/cache';
|
import cache from '@/plugins/cache';
|
||||||
import { HttpStatus } from '@/enums/RespEnum';
|
import { HttpStatus } from '@/enums/RespEnum';
|
||||||
@ -16,6 +16,31 @@ const encryptHeader = 'encrypt-key';
|
|||||||
let downloadLoadingInstance: LoadingInstance;
|
let downloadLoadingInstance: LoadingInstance;
|
||||||
// 是否显示重新登录
|
// 是否显示重新登录
|
||||||
export const isRelogin = { show: false };
|
export const isRelogin = { show: false };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钉钉环境静默免登:401 会话过期时,用钉钉授权码重新换取系统 token 并刷新页面,
|
||||||
|
* 全程无弹窗无感续期;corpId 未配置或免登失败时抛错(由调用方降级处理)。
|
||||||
|
*/
|
||||||
|
const dingSilentRelogin = async (): Promise<void> => {
|
||||||
|
const corpId = import.meta.env.VITE_DINGTALK_CORP_ID as string;
|
||||||
|
if (!corpId) {
|
||||||
|
throw new Error('corpId 未配置');
|
||||||
|
}
|
||||||
|
const dd = (await import('dingtalk-jsapi')).default;
|
||||||
|
const authCode = await new Promise<string>((resolve, reject) => {
|
||||||
|
dd.ready(() => {
|
||||||
|
dd.runtime.permission.requestAuthCode({
|
||||||
|
corpId,
|
||||||
|
onSuccess: (result: any) => resolve(result.code),
|
||||||
|
onFail: (err: any) => reject(err)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const { dingLogin } = await import('@/api/sbgl/ding');
|
||||||
|
const res = await dingLogin(authCode);
|
||||||
|
setToken(res.data.accessToken);
|
||||||
|
};
|
||||||
|
|
||||||
export const globalHeaders = () => {
|
export const globalHeaders = () => {
|
||||||
return {
|
return {
|
||||||
Authorization: 'Bearer ' + getToken(),
|
Authorization: 'Bearer ' + getToken(),
|
||||||
@ -129,8 +154,18 @@ service.interceptors.response.use(
|
|||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
// prettier-ignore
|
// 钉钉环境:静默免登续期后刷新页面,无感重试,不弹重新登录确认框
|
||||||
if (!isRelogin.show) {
|
if (!isRelogin.show && navigator.userAgent.includes('DingTalk')) {
|
||||||
|
isRelogin.show = true;
|
||||||
|
dingSilentRelogin()
|
||||||
|
.then(() => {
|
||||||
|
location.reload();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
isRelogin.show = false;
|
||||||
|
ElMessage.warning('钉钉免登续期失败,请退出应用后重新进入');
|
||||||
|
});
|
||||||
|
} else if (!isRelogin.show) {
|
||||||
isRelogin.show = true;
|
isRelogin.show = true;
|
||||||
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
||||||
confirmButtonText: '重新登录',
|
confirmButtonText: '重新登录',
|
||||||
|
|||||||
1051
src/views/sbgl/h5/order.vue
Normal file
1051
src/views/sbgl/h5/order.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sb-screen">
|
<div class="sb-screen">
|
||||||
<header class="sb-screen__header">
|
<header class="sb-screen__header">
|
||||||
<span class="sb-screen__title">交管设备资产一张图</span>
|
<!-- 业务图层面板:与标题同一行,悬浮在导航栏左侧,可向下展开 -->
|
||||||
<div class="sb-screen__layers">
|
<div class="biz-layers">
|
||||||
<el-checkbox-group v-model="visibleTypes" class="layer-group">
|
<div class="biz-layers__title" @click="layersCollapsed = !layersCollapsed">
|
||||||
<el-checkbox v-for="t in typeOptions" :key="t.id" :value="String(t.id)">{{ t.typeName }}</el-checkbox>
|
<span class="biz-layers__arrow" :class="{ 'biz-layers__arrow--open': !layersCollapsed }"></span>
|
||||||
</el-checkbox-group>
|
<span class="biz-layers__title-text">设备</span>
|
||||||
|
<span class="biz-layers__toggle">{{ layersCollapsed ? '展开' : '收起' }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<template v-if="!layersCollapsed">
|
||||||
|
<div v-for="t in typeOptions" :key="t.id" class="biz-layers__row">
|
||||||
|
<input :id="'biz-layer-' + t.id" type="checkbox" :value="String(t.id)" v-model="visibleTypes" />
|
||||||
|
<label :for="'biz-layer-' + t.id">
|
||||||
|
<span class="biz-layers__name">{{ t.typeName }}</span>
|
||||||
|
<span class="biz-layers__count">{{ typeCount(t.typeName) }}</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<span class="sb-screen__title">交管设备资产一张图</span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="sb-screen__body">
|
<div class="sb-screen__body">
|
||||||
<!-- 左侧统计 -->
|
<!-- 左侧统计(透明悬浮于地图上) -->
|
||||||
<aside class="sb-screen__side">
|
<aside class="sb-screen__side sb-screen__side--left">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel__title">设备总览</div>
|
<div class="panel__title">设备总览</div>
|
||||||
<div class="big-num">{{ overview.deviceTotal ?? '-' }}</div>
|
<div class="big-num">{{ overview.deviceTotal ?? '-' }}</div>
|
||||||
@ -37,8 +49,8 @@
|
|||||||
<sb-map height="100%" :points="visiblePoints" @point-click="onPointClick" />
|
<sb-map height="100%" :points="visiblePoints" @point-click="onPointClick" />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- 右侧 -->
|
<!-- 右侧(透明悬浮于地图上) -->
|
||||||
<aside class="sb-screen__side">
|
<aside class="sb-screen__side sb-screen__side--right">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel__title">各类型设备数量</div>
|
<div class="panel__title">各类型设备数量</div>
|
||||||
<div v-for="item in typeCountList" :key="item.name" class="stat-row">
|
<div v-for="item in typeCountList" :key="item.name" class="stat-row">
|
||||||
@ -91,6 +103,8 @@ const deviceList = ref<DeviceVO[]>([]);
|
|||||||
const typeCountList = ref<StatItemVO[]>([]);
|
const typeCountList = ref<StatItemVO[]>([]);
|
||||||
const deviceStatusList = ref<StatItemVO[]>([]);
|
const deviceStatusList = ref<StatItemVO[]>([]);
|
||||||
const visibleTypes = ref<string[]>([]);
|
const visibleTypes = ref<string[]>([]);
|
||||||
|
/** 业务图层面板是否收起 */
|
||||||
|
const layersCollapsed = ref(true);
|
||||||
const selected = ref<DeviceVO | null>(null);
|
const selected = ref<DeviceVO | null>(null);
|
||||||
/** 各类型启用的属性字段配置:typeId -> fieldKey -> label */
|
/** 各类型启用的属性字段配置:typeId -> fieldKey -> label */
|
||||||
const fieldLabelMap = ref<Record<string, Record<string, string>>>({});
|
const fieldLabelMap = ref<Record<string, Record<string, string>>>({});
|
||||||
@ -136,6 +150,10 @@ const visiblePoints = computed(() =>
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** 各类型设备数量(业务图层面板行内徽标) */
|
||||||
|
const typeCount = (typeName?: string) =>
|
||||||
|
typeCountList.value.find((i) => i.name === typeName)?.count ?? 0;
|
||||||
|
|
||||||
const onPointClick = (point: any) => {
|
const onPointClick = (point: any) => {
|
||||||
const device = deviceList.value.find((d) => String(d.id) === String(point.id));
|
const device = deviceList.value.find((d) => String(d.id) === String(point.id));
|
||||||
if (device) {
|
if (device) {
|
||||||
@ -179,64 +197,190 @@ onMounted(async () => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
background: #0b1c33;
|
background: #0b1c33;
|
||||||
color: #d6e4ff;
|
color: #d6e4ff;
|
||||||
}
|
}
|
||||||
.sb-screen__header {
|
.sb-screen__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
height: 56px;
|
height: 56px;
|
||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
background: linear-gradient(90deg, rgba(23, 62, 116, 0.95), rgba(11, 28, 51, 0.6));
|
background: linear-gradient(90deg, rgba(23, 62, 116, 0.95), rgba(11, 28, 51, 0.6));
|
||||||
border-bottom: 1px solid #1d4a8a;
|
border-bottom: 1px solid #1d4a8a;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.sb-screen__title {
|
.sb-screen__title {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 4px;
|
letter-spacing: 4px;
|
||||||
}
|
}
|
||||||
.layer-group {
|
/* 业务图层面板:仿 ZHJTQY 图层控制形式,与标题同行悬浮在导航栏左侧,图层多时向下展开滚动 */
|
||||||
:deep(.el-checkbox__label) {
|
.biz-layers {
|
||||||
color: #d6e4ff;
|
position: absolute;
|
||||||
|
left: 16px;
|
||||||
|
top: 6px;
|
||||||
|
z-index: 600;
|
||||||
|
width: 176px;
|
||||||
|
padding: 6px 4px;
|
||||||
|
background: rgba(6, 24, 46, 0.92);
|
||||||
|
border: 1px solid #008aff;
|
||||||
|
border-radius: 3px;
|
||||||
|
max-height: calc(100vh - 72px);
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&__title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 2px 8px 6px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
color: #4ecbff;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
border-bottom: 1px solid rgba(0, 138, 255, 0.35);
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
&:hover {
|
||||||
|
background: rgba(0, 138, 255, 0.14);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__arrow {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
margin-right: 6px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-left: 5px solid rgba(255, 255, 255, 0.6);
|
||||||
|
border-top: 4px solid transparent;
|
||||||
|
border-bottom: 4px solid transparent;
|
||||||
|
transition: transform 0.15s;
|
||||||
|
&--open {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__title-text {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
&__toggle {
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgba(255, 255, 255, 0.55);
|
||||||
|
}
|
||||||
|
&__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 3px 8px;
|
||||||
|
border-radius: 3px;
|
||||||
|
&:hover {
|
||||||
|
background: rgba(0, 138, 255, 0.14);
|
||||||
|
}
|
||||||
|
input[type='checkbox'] {
|
||||||
|
flex-shrink: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
accent-color: #008aff;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__name {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 22px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
&__count {
|
||||||
|
margin-left: 8px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.sb-screen__body {
|
.sb-screen__body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
|
||||||
.sb-screen__side {
|
|
||||||
width: 280px;
|
|
||||||
padding: 10px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
.sb-screen__map {
|
|
||||||
flex: 1;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
/* 左右统计栏脱离文档流、透明悬浮在整幅地图上 */
|
||||||
|
/* 覆盖全局 index.scss 的 aside / .panel 白底样式 */
|
||||||
|
.sb-screen__side {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
bottom: 8px;
|
||||||
|
width: 280px;
|
||||||
|
z-index: 500;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
line-height: normal;
|
||||||
|
background: transparent;
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&--left {
|
||||||
|
left: 8px;
|
||||||
|
}
|
||||||
|
&--right {
|
||||||
|
right: 8px;
|
||||||
|
}
|
||||||
|
/* 侧栏容器透明区域不拦截点击(穿透到地图/缩放控件),仅面板本身可交互 */
|
||||||
|
pointer-events: none;
|
||||||
|
.panel {
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sb-screen__map {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
/* 面板:白底深字(全局 aside 字色为深色,白底更清晰) */
|
||||||
.panel {
|
.panel {
|
||||||
background: rgba(20, 48, 92, 0.55);
|
background: rgba(255, 255, 255, 0.82);
|
||||||
border: 1px solid #1d4a8a;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
|
||||||
|
transition: none;
|
||||||
|
border: 1px solid #d9e4f3;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
color: #243244;
|
||||||
|
&:hover {
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.panel__title {
|
.panel__title {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
border-left: 3px solid #409eff;
|
border-left: 3px solid #1d6fd0;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
|
color: #1d3a66;
|
||||||
}
|
}
|
||||||
.panel__sub {
|
.panel__sub {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #8fb3e3;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
.big-num {
|
.big-num {
|
||||||
font-size: 34px;
|
font-size: 34px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #4ecbff;
|
color: #1d6fd0;
|
||||||
}
|
}
|
||||||
.stat-row {
|
.stat-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -247,14 +391,14 @@ onMounted(async () => {
|
|||||||
.stat-num {
|
.stat-num {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
.stat-num.warn { color: #ffb45a; }
|
.stat-num.warn { color: #d97a1f; }
|
||||||
.stat-num.info { color: #4ecbff; }
|
.stat-num.info { color: #1d6fd0; }
|
||||||
.stat-num.ok { color: #7be2a1; }
|
.stat-num.ok { color: #2ca35e; }
|
||||||
.detail-name {
|
.detail-name {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
color: #4ecbff;
|
color: #1d6fd0;
|
||||||
}
|
}
|
||||||
.detail-row {
|
.detail-row {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@ -263,12 +407,12 @@ onMounted(async () => {
|
|||||||
.detail-attrs-title {
|
.detail-attrs-title {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #8fb3e3;
|
color: #64748b;
|
||||||
margin: 8px 0 2px;
|
margin: 8px 0 2px;
|
||||||
border-top: 1px dashed #1d4a8a;
|
border-top: 1px dashed #d9e4f3;
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
}
|
}
|
||||||
.status-tag.ok { color: #7be2a1; }
|
.status-tag.ok { color: #2ca35e; }
|
||||||
.status-tag.warn { color: #ffb45a; }
|
.status-tag.warn { color: #d97a1f; }
|
||||||
.status-tag.bad { color: #ff7d7d; }
|
.status-tag.bad { color: #d64545; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -241,6 +241,9 @@
|
|||||||
<el-timeline-item v-for="rec in records" :key="rec.id" :timestamp="proxy?.parseTime(rec.createTime)">
|
<el-timeline-item v-for="rec in records" :key="rec.id" :timestamp="proxy?.parseTime(rec.createTime)">
|
||||||
<b>{{ actionLabel(rec.action) }}</b> - {{ rec.operatorName }}
|
<b>{{ actionLabel(rec.action) }}</b> - {{ rec.operatorName }}
|
||||||
<div v-if="rec.opinion" class="text-gray-500">{{ rec.opinion }}</div>
|
<div v-if="rec.opinion" class="text-gray-500">{{ rec.opinion }}</div>
|
||||||
|
<div v-if="rec.imageUrls" class="record-images">
|
||||||
|
<ImagePreview v-for="(img, i) in rec.imageUrls.split(',')" :key="i" :src="img" width="64" height="64" />
|
||||||
|
</div>
|
||||||
</el-timeline-item>
|
</el-timeline-item>
|
||||||
</el-timeline>
|
</el-timeline>
|
||||||
</template>
|
</template>
|
||||||
@ -249,6 +252,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="WorkOrder" lang="ts">
|
<script setup name="WorkOrder" lang="ts">
|
||||||
|
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||||
|
import { listByIds } from '@/api/system/oss';
|
||||||
import { listOrder, getOrder, submitOrder, updateOrder, dispatchOrder, handleOrder, verifyOrder, closeOrder, urgeOrder, listOrderRecords } from '@/api/sbgl/workorder';
|
import { listOrder, getOrder, submitOrder, updateOrder, dispatchOrder, handleOrder, verifyOrder, closeOrder, urgeOrder, listOrderRecords } from '@/api/sbgl/workorder';
|
||||||
import { WorkOrderVO, WorkOrderQuery, WorkOrderForm, OrderRecordVO } from '@/api/sbgl/workorder/types';
|
import { WorkOrderVO, WorkOrderQuery, WorkOrderForm, OrderRecordVO } from '@/api/sbgl/workorder/types';
|
||||||
import { listDevice, getDeviceOptions } from '@/api/sbgl/device';
|
import { listDevice, getDeviceOptions } from '@/api/sbgl/device';
|
||||||
@ -552,6 +557,22 @@ const openDetail = async (row: WorkOrderVO) => {
|
|||||||
detail.value = res.data;
|
detail.value = res.data;
|
||||||
const recRes = await listOrderRecords(row.id);
|
const recRes = await listOrderRecords(row.id);
|
||||||
records.value = recRes.data ?? [];
|
records.value = recRes.data ?? [];
|
||||||
|
// 流转记录里存的是 ossId(逗号分隔),需换算成访问 URL 才能展示
|
||||||
|
try {
|
||||||
|
const allIds = [...new Set(records.value.flatMap((r: any) => (r.images ? r.images.split(',') : [])))].filter(Boolean).join(',');
|
||||||
|
if (allIds) {
|
||||||
|
const ossRes = await listByIds(allIds);
|
||||||
|
const urlMap: Record<string, string> = {};
|
||||||
|
(ossRes.data ?? []).forEach((o: any) => (urlMap[o.ossId] = o.url));
|
||||||
|
records.value.forEach((r: any) => {
|
||||||
|
if (r.images) {
|
||||||
|
r.imageUrls = r.images.split(',').map((id: string) => urlMap[id]).filter(Boolean).join(',');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 换算失败不阻断详情展示
|
||||||
|
}
|
||||||
detailVisible.value = true;
|
detailVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -561,3 +582,12 @@ onMounted(async () => {
|
|||||||
typeOptions.value = res.data ?? [];
|
typeOptions.value = res.data ?? [];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.record-images {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user