玉溪前端修改

玉溪
LAPTOP-S9HJSOEB\昊天 4 months ago
parent 3a2580cb82
commit 5b269882fc

@ -7,7 +7,7 @@ const config: {
/** /**
* api * api
*/ */
base_url: import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL, base_url: `http://${window.location.hostname}:48080` + import.meta.env.VITE_API_URL,
/** /**
* *
*/ */

@ -1,3 +1,6 @@
// 动态生成 baseUrl 并共享给其他模块
const baseUrl = `http://${window.location.hostname}:48080`;
// 引入unocss css // 引入unocss css
import '@/plugins/unocss' import '@/plugins/unocss'

@ -257,11 +257,6 @@ const getShortcut = async () => {
icon: 'ep:pointer', icon: 'ep:pointer',
url: 'logistics/stock' url: 'logistics/stock'
}, },
{
name: '实时视频',
icon: 'ep:magic-stick',
url: 'cameraTree/cameraStreet'
},
{ {
name: '巷道管理', name: '巷道管理',
icon: 'fa-solid:rainbow', icon: 'fa-solid:rainbow',
@ -292,24 +287,6 @@ const laneInventoryLineOptions = ref<EChartsOption>({})
const orderChartOption = ref<EChartsOption>({}) const orderChartOption = ref<EChartsOption>({})
let eventSource: any = null
const sseUid = ref(`${Date.now()}-${Math.floor(Math.random() * 10000)}`)
const sse = ()=>{
// EventSource SSE
eventSource = new EventSource('http://192.168.0.10:48080/app-api/sse/createSse?uid=' + sseUid.value );
//
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log(data);
};
//
eventSource.onerror = (error) => {
console.error('SSE 连接发生错误:', error);
};
}
// //
const stockPieOptions = reactive({ const stockPieOptions = reactive({
@ -415,14 +392,12 @@ onMounted(() => {
CameraApi.getCameraList().then((res) => { CameraApi.getCameraList().then((res) => {
cameraList.value = res cameraList.value = res
}) })
sse()
}) })
onUnmounted(() => { onUnmounted(() => {
// EventSource // EventSource
if (eventSource) {
eventSource.close();
}
}) })
</script> </script>
<style scoped> <style scoped>

@ -166,7 +166,7 @@ const loginData = reactive({
captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE !== 'false', captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE !== 'false',
loginForm: { loginForm: {
username: 'admin', username: 'admin',
password: 'admin123', password: '',
captchaVerification: '', captchaVerification: '',
rememberMe: false rememberMe: false
} }

@ -68,7 +68,7 @@ const formRules = reactive({
}) })
const formRef = ref() // Ref const formRef = ref() // Ref
const uploadRef = ref() // Ref const uploadRef = ref() // Ref
const importUrl = import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/bpm/model/import' const importUrl = `http://${window.location.hostname}:48080` + import.meta.env.VITE_API_URL + '/bpm/model/import'
const uploadHeaders = ref() // Header const uploadHeaders = ref() // Header
const fileList = ref([]) // const fileList = ref([]) //

@ -12,7 +12,7 @@ import * as ConfigApi from '@/api/infra/config'
defineOptions({ name: 'InfraDruid' }) defineOptions({ name: 'InfraDruid' })
const loading = ref(true) // const loading = ref(true) //
const url = ref(import.meta.env.VITE_BASE_URL + '/druid/index.html') const url = ref(`http://${window.location.hostname}:48080` + '/druid/index.html')
/** 初始化 */ /** 初始化 */
onMounted(async () => { onMounted(async () => {

@ -11,7 +11,7 @@ import * as ConfigApi from '@/api/infra/config'
defineOptions({ name: 'InfraAdminServer' }) defineOptions({ name: 'InfraAdminServer' })
const loading = ref(true) // const loading = ref(true) //
const src = ref(import.meta.env.VITE_BASE_URL + '/admin/applications') const src = ref(`http://${window.location.hostname}:48080` + '/admin/applications')
/** 初始化 */ /** 初始化 */
onMounted(async () => { onMounted(async () => {

@ -11,8 +11,8 @@ import * as ConfigApi from '@/api/infra/config'
defineOptions({ name: 'InfraSwagger' }) defineOptions({ name: 'InfraSwagger' })
const loading = ref(true) // const loading = ref(true) //
const src = ref(import.meta.env.VITE_BASE_URL + '/doc.html') // Knife4j UI const src = ref(`http://${window.location.hostname}:48080` + '/doc.html') // Knife4j UI
// const src = ref(import.meta.env.VITE_BASE_URL + '/swagger-ui') // Swagger UI // const src = ref(`http://${window.location.hostname}:48080` + '/swagger-ui') // Swagger UI
/** 初始化 */ /** 初始化 */
onMounted(async () => { onMounted(async () => {

@ -79,7 +79,7 @@ defineOptions({ name: 'InfraWebSocket' })
const message = useMessage() // const message = useMessage() //
const server = ref( const server = ref(
(import.meta.env.VITE_BASE_URL + '/infra/ws').replace('http', 'ws') + '?token=' + getAccessToken() (`http://${window.location.hostname}:48080` + '/infra/ws').replace('http', 'ws') + '?token=' + getAccessToken()
) // WebSocket ) // WebSocket
const getIsOpen = computed(() => status.value === 'OPEN') // WebSocket const getIsOpen = computed(() => status.value === 'OPEN') // WebSocket
const getTagColor = computed(() => (getIsOpen.value ? 'success' : 'red')) // WebSocket const getTagColor = computed(() => (getIsOpen.value ? 'success' : 'red')) // WebSocket

@ -11,7 +11,7 @@
highlight-current highlight-current
class="camera-tree" class="camera-tree"
/> />
<ptz :cameraId="cameraId" /> <ptz @childTriggerParent="reVideo" v-if="cameraId" :cameraId="cameraId" />
</el-col> </el-col>
<el-col :span="19"> <el-col :span="19">
<div class="container"> <div class="container">
@ -38,11 +38,12 @@
@click="clickCameraFun((rowIndex-1)*topNum +colIndex)" @click="clickCameraFun((rowIndex-1)*topNum +colIndex)"
> >
<div v-if="((rowIndex-1)*topNum +colIndex)==cameraIndex" class="floating-text"><Icon :size="15" icon="ep:circle-close" <div v-if="((rowIndex-1)*topNum +colIndex)==cameraIndex" class="floating-text">
/></div> <Icon :size="15" icon="ep:circle-close" @click="deleteCameraFun((rowIndex-1)*topNum +colIndex)"/>
</div>
<Camera v-if="getCameraId((rowIndex - 1) * topNum + colIndex)!== 0" <Camera v-if="getCameraId((rowIndex - 1) * topNum + colIndex)!== 0"
:cameraId="getCameraId((rowIndex-1)*topNum +colIndex)" :ptzShow="false" /> :cameraId="getCameraId((rowIndex-1)*topNum +colIndex)" :ref="'camera'+((rowIndex-1)*topNum +colIndex)" :ptzShow="false" />
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
@ -53,10 +54,9 @@
<script setup lang="ts"> <script setup lang="ts">
import Camera from '@/components/camera/camera.vue' import Camera from '@/components/camera/camera.vue'
import { ref } from 'vue';
import ptz from '@/components/camera/ptzNotFlow.vue' import ptz from '@/components/camera/ptzNotFlow.vue'
import { CameraApi, CameraVO } from '@/api/logistics/camera' import { CameraApi, CameraVO } from '@/api/logistics/camera'
import { el, ta } from 'element-plus/es/locale'
import { flatMap } from 'lodash-es'
/** 相机 列表 */ /** 相机 列表 */
defineOptions({ name: 'Camera' }) defineOptions({ name: 'Camera' })
@ -69,8 +69,22 @@ const topNum = ref(2) // 默认值
const cameraIndex = ref() const cameraIndex = ref()
// //
const clickCamera = ref(false) const clickCamera = ref(false)
const refs = {};
// const refs = reactive({});
const CameraMap = ref<Map<number, number | undefined>>() const CameraMap = ref<Map<number, number | undefined>>()
const reVideo = async (cameraId: number) => {
if (CameraMap.value) {
for (const [index, id] of CameraMap.value.entries()) {
if (id === cameraId) {
console.log("刷新摄像头 index:", index);
const cameraRef = refs[`camera${index}`];
if (cameraRef && cameraRef.startVideo) {
cameraRef.startVideo();
}
}
}
}
}
/** 查询列表 */ /** 查询列表 */
const getTree = async () => { const getTree = async () => {
try { try {
@ -80,6 +94,15 @@ const getTree = async () => {
} }
} }
const selectedNodeId = ref<string | null>(null) const selectedNodeId = ref<string | null>(null)
//
const deleteCameraFun = (index)=>{
console.log("删除摄像头 index:",index );
clickCamera.value = true
CameraMap.value?.delete(index)
cameraIndex.value = index
cameraId.value = null
}
// //
const clickCameraFun = (index)=>{ const clickCameraFun = (index)=>{
@ -97,6 +120,7 @@ const handleNodeClick = (data: any) => {
if (data.id != null) { if (data.id != null) {
// //
if(clickCamera.value){ if(clickCamera.value){
deleteCameraFun(cameraIndex.value)
CameraMap.value?.set(cameraIndex.value, data.id) CameraMap.value?.set(cameraIndex.value, data.id)
}else{ }else{
// cameraId // cameraId

@ -233,7 +233,7 @@ const handleQuery = async () => {
const data = await StockApi.getStreetList(queryParams) const data = await StockApi.getStreetList(queryParams)
saveQueryParamsToCookie() saveQueryParamsToCookie()
getStreetStatus() getStreetStatus()
buttons.value = data.buttons
rows = ref(data.rows) rows = ref(data.rows)
columns =ref(data.columns) columns =ref(data.columns)
const page = columns.value/columnMax.value const page = columns.value/columnMax.value

@ -63,7 +63,7 @@ import { getAccessToken } from '@/utils/auth'
import { Reply } from './types' import { Reply } from './types'
const message = useMessage() const message = useMessage()
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-temporary' const UPLOAD_URL = `http://${window.location.hostname}:48080` + '/admin-api/mp/material/upload-temporary'
const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } //
const props = defineProps<{ const props = defineProps<{

@ -67,7 +67,7 @@ import { Reply } from './types'
const message = useMessage() const message = useMessage()
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-temporary' const UPLOAD_URL = `http://${window.location.hostname}:48080` + '/admin-api/mp/material/upload-temporary'
const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } //
const props = defineProps<{ const props = defineProps<{

@ -58,7 +58,7 @@ import { Reply } from './types'
const message = useMessage() const message = useMessage()
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-temporary' const UPLOAD_URL = `http://${window.location.hostname}:48080` + '/admin-api/mp/material/upload-temporary'
const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } const HEADERS = { Authorization: 'Bearer ' + getAccessToken() }
const props = defineProps<{ const props = defineProps<{

@ -61,7 +61,7 @@ import { getAccessToken } from '@/utils/auth'
import { Reply } from './types' import { Reply } from './types'
const message = useMessage() const message = useMessage()
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-temporary' const UPLOAD_URL = `http://${window.location.hostname}:48080` + '/admin-api/mp/material/upload-temporary'
const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } //
const props = defineProps<{ const props = defineProps<{

@ -67,7 +67,7 @@ import { UploadType, useBeforeUpload } from '@/views/mp/hooks/useUpload'
import { NewsItem } from './types' import { NewsItem } from './types'
const message = useMessage() const message = useMessage()
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-permanent' // const UPLOAD_URL = `http://${window.location.hostname}:48080` + '/admin-api/mp/material/upload-permanent' //
const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } //
const props = defineProps<{ const props = defineProps<{

@ -143,7 +143,7 @@ const props = defineProps<{
const accountId = inject<number>('accountId') const accountId = inject<number>('accountId')
// ========== ========== // ========== ==========
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-permanent' // const UPLOAD_URL = `http://${window.location.hostname}:48080` + '/admin-api/mp/material/upload-permanent' //
const editorConfig = createEditorConfig(UPLOAD_URL, accountId) const editorConfig = createEditorConfig(UPLOAD_URL, accountId)
// v-model=newsList // v-model=newsList

@ -3,7 +3,7 @@ import { getAccessToken } from '@/utils/auth'
import { UploadType, useBeforeUpload } from '@/views/mp/hooks/useUpload' import { UploadType, useBeforeUpload } from '@/views/mp/hooks/useUpload'
const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // 请求头 const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // 请求头
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-permanent' // 上传地址 const UPLOAD_URL = `http://${window.location.hostname}:48080` + '/admin-api/mp/material/upload-permanent' // 上传地址
interface UploadData { interface UploadData {
type: UploadType type: UploadType

@ -10,6 +10,6 @@ import { getAccessToken } from '@/utils/auth'
defineOptions({ name: 'JimuReport' }) defineOptions({ name: 'JimuReport' })
const BASE_URL = import.meta.env.VITE_BASE_URL const BASE_URL = `http://${window.location.hostname}:48080`
const src = ref(BASE_URL + '/jmreport/list?token=' + getAccessToken()) const src = ref(BASE_URL + '/jmreport/list?token=' + getAccessToken())
</script> </script>

@ -52,7 +52,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // const formLoading = ref(false) //
const uploadRef = ref() const uploadRef = ref()
const importUrl = const importUrl =
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/user/import' `http://${window.location.hostname}:48080` + import.meta.env.VITE_API_URL + '/system/user/import'
const uploadHeaders = ref() // Header const uploadHeaders = ref() // Header
const fileList = ref([]) // const fileList = ref([]) //
const updateSupport = ref(0) // const updateSupport = ref(0) //

Loading…
Cancel
Save