Merge pull request 'fix : 修复确认按钮防抖' (#335) from dengjie into dev

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/335
This commit is contained in:
2024-03-25 08:31:50 +00:00
7 changed files with 62 additions and 35 deletions

View File

@@ -29,6 +29,7 @@
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^4.2.1", "@vitejs/plugin-vue": "^4.2.1",
"lodash": "^4.17.21",
"unplugin-auto-import": "^0.15.3", "unplugin-auto-import": "^0.15.3",
"unplugin-vue-components": "^0.24.1", "unplugin-vue-components": "^0.24.1",
"vite": "^4.3.4" "vite": "^4.3.4"

View File

@@ -310,7 +310,7 @@
import {ElLoading, ElMessage} from "element-plus"; import {ElLoading, ElMessage} from "element-plus";
import {getEquipmentList, editEquipment, getTunnelDetail} from "@/api/tunnelManage"; import {getEquipmentList, editEquipment, getTunnelDetail} from "@/api/tunnelManage";
import TunnelTitle from "@/components/tunnelTitle/index.vue"; import TunnelTitle from "@/components/tunnelTitle/index.vue";
import { debounce } from 'lodash'
const router = useRouter() const router = useRouter()
const tunnelId = reactive(router.currentRoute.value.params.tunnelId) const tunnelId = reactive(router.currentRoute.value.params.tunnelId)
const userId = reactive(router.currentRoute.value.params.userId) const userId = reactive(router.currentRoute.value.params.userId)
@@ -373,7 +373,7 @@ const changeData = (item) => {
state: item.state, state: item.state,
} }
} }
const editEquip = () => { const editEquip = debounce(() => {
let newFrequency = [{ let newFrequency = [{
acquisitionPeriod: fanFrequency.value * 1000, acquisitionPeriod: fanFrequency.value * 1000,
tunnelId: parseInt(tunnelId), tunnelId: parseInt(tunnelId),
@@ -393,7 +393,7 @@ const editEquip = () => {
fanData.value.forEach(item => { fanData.value.forEach(item => {
let obj = { let obj = {
equipmentId: item.equipmentId, equipmentId: item.equipmentId,
ratedPower:parseInt(item.ratedPower), ratedPower: parseInt(item.ratedPower),
acurrentValue: parseInt(item.acurrentValue), acurrentValue: parseInt(item.acurrentValue),
bcurrentValue: parseInt(item.bcurrentValue), bcurrentValue: parseInt(item.bcurrentValue),
ccurrentValue: parseInt(item.ccurrentValue), ccurrentValue: parseInt(item.ccurrentValue),
@@ -423,7 +423,7 @@ const editEquip = () => {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
}) })
} }, 1000)
const handleChangeMenu = (e) => { const handleChangeMenu = (e) => {
changeIndex.value = e changeIndex.value = e

View File

@@ -78,7 +78,7 @@ import {editTunnel, getTunnelDetail} from "@/api/tunnelManage";
import {ElLoading, ElMessage} from "element-plus"; import {ElLoading, ElMessage} from "element-plus";
import {initSceneData} from "@/api/tunnelScene"; import {initSceneData} from "@/api/tunnelScene";
import TunnelTitle from "@/components/tunnelTitle/index.vue"; import TunnelTitle from "@/components/tunnelTitle/index.vue";
import { debounce } from 'lodash'
const router = useRouter(); const router = useRouter();
const tunnelId = reactive(router.currentRoute.value.params.tunnelId); const tunnelId = reactive(router.currentRoute.value.params.tunnelId);
const userId = reactive(router.currentRoute.value.params.userId); const userId = reactive(router.currentRoute.value.params.userId);
@@ -144,9 +144,9 @@ const getTunnelInfo = () => {
}); });
}) })
} }
const handleSave = () => { const handleSave =debounce(() => {
getTunnelInfo() getTunnelInfo()
}; },1000)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-form-item__content) { :deep(.el-form-item__content) {

View File

@@ -146,7 +146,7 @@ import {ElMessage, ElMessageBox} from "element-plus";
import TunnelTitle from "@/components/tunnelTitle/index.vue"; import TunnelTitle from "@/components/tunnelTitle/index.vue";
import {getToken} from '@/utils/auth' import {getToken} from '@/utils/auth'
import {ElLoading} from 'element-plus' import {ElLoading} from 'element-plus'
import { debounce } from 'lodash'
const router = useRouter() const router = useRouter()
const userId = reactive(router.currentRoute.value.params.userId) const userId = reactive(router.currentRoute.value.params.userId)
const siteId = reactive(router.currentRoute.value.params.siteId) const siteId = reactive(router.currentRoute.value.params.siteId)
@@ -294,7 +294,7 @@ const handleAdd = () => {
formInstance.value.clearValidate() formInstance.value.clearValidate()
}) })
} }
const handleSubmit = (instance) => { const handleSubmit =debounce((instance) => {
if (!instance) return if (!instance) return
instance.validate(valid => { instance.validate(valid => {
if (!valid) return if (!valid) return
@@ -320,8 +320,8 @@ const handleSubmit = (instance) => {
}); });
} }
}) })
} },1000)
const handleChooseAll = () => { const handleChooseAll = debounce(() => {
siteList.value.map(item => { siteList.value.map(item => {
item.checked = !item.checked item.checked = !item.checked
if (item.checked && !item.isDefault) { if (item.checked && !item.isDefault) {
@@ -334,8 +334,8 @@ const handleChooseAll = () => {
}) })
} }
}) })
} },1000)
const handleMoreDelete = () => { const handleMoreDelete =debounce(() => {
if (siteIds.value.length === 0) { if (siteIds.value.length === 0) {
ElMessage.warning('请先选择站点进行删除') ElMessage.warning('请先选择站点进行删除')
} else { } else {
@@ -372,7 +372,7 @@ const handleMoreDelete = () => {
}) })
} }
} }
} },1000)
const firstPage = () => { const firstPage = () => {
pageInfo.pageNum = 1 pageInfo.pageNum = 1
getList() getList()

View File

@@ -9,11 +9,11 @@
{{ siteName }} {{ siteName }}
</div> </div>
<div class="model-change"> <div class="model-change">
<div class="model" @click="clickModel=1"> <div class="model" @click="clickModel=1;showNull=false">
<div class="card-bg"></div> <div class="card-bg"></div>
<span>卡片模式</span> <span>卡片模式</span>
</div> </div>
<div class="model" @click="clickModel=2"> <div class="model" @click="clickModel=2;getSiteImg()">
<div class="img-bg"></div> <div class="img-bg"></div>
<span>图纸导航</span> <span>图纸导航</span>
</div> </div>
@@ -73,7 +73,10 @@
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div class="img-box"> <div v-if="showNull" class="showNull">
暂无图纸~ 请前往站点管理上传图纸~
</div>
<div class="img-box" v-else>
<!-- @/assets/images/tunnel/img.png--> <!-- @/assets/images/tunnel/img.png-->
<img :src="'data:image/png;base64,'+siteImage" style="width:3500px;height:1789px" id="imgModel" usemap="#image" <img :src="'data:image/png;base64,'+siteImage" style="width:3500px;height:1789px" id="imgModel" usemap="#image"
alt="" @click="clickHandler"> alt="" @click="clickHandler">
@@ -165,6 +168,7 @@ import {getTunnelList, addTunnel, deleteTunnel} from "@/api/tunnelManage";
import {getSiteDrawing, getSiteDetail} from "@/api/site"; import {getSiteDrawing, getSiteDetail} from "@/api/site";
import TunnelTitle from "@/components/tunnelTitle/index.vue"; import TunnelTitle from "@/components/tunnelTitle/index.vue";
import {getTunnelBySiteId} from "@/api/largeScreen"; import {getTunnelBySiteId} from "@/api/largeScreen";
import { debounce } from 'lodash'
const validateNumber = (rule, value) => { const validateNumber = (rule, value) => {
const reg = /^[A-Za-z0-9]+$/; const reg = /^[A-Za-z0-9]+$/;
@@ -260,6 +264,7 @@ const iconsList = ref([
}, },
]) ])
const title = ref('新增隧道') const title = ref('新增隧道')
const showNull = ref(false);
const isVisited = ref(false); const isVisited = ref(false);
const tunnelIds = ref([]) const tunnelIds = ref([])
const tunnelNameList = ref([]) const tunnelNameList = ref([])
@@ -287,13 +292,26 @@ onMounted(() => {
showOperation.value = localStorage.getItem('roleKey') !== 'tunnel_admin'; showOperation.value = localStorage.getItem('roleKey') !== 'tunnel_admin';
}) })
const getSiteImg = () => { const getSiteImg = () => {
showNull.value=false
getSiteDrawing(siteId).then((res) => { getSiteDrawing(siteId).then((res) => {
if (res.code === 1000) { if (res.code === 1000) {
siteImage.value = res.data.drawingData if(res.data.drawingData===null){
// ElMessageBox.confirm('暂无图纸, 是否前往站点管理上传图纸?', '系统提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// router.push('/site/' + userId + '/' + localStorage.getItem('currentSiteId'))
// }).catch(()=>{
showNull.value=true
// })
}else{
showNull.value=false
siteImage.value = res.data.drawingData
}
} }
}); });
} }
getSiteImg()
const clickHot = (id) => { const clickHot = (id) => {
console.log('点击热区===============') console.log('点击热区===============')
router.push('/' + id + '/' + siteId) router.push('/' + id + '/' + siteId)
@@ -358,8 +376,7 @@ const handleCurrentChange = (val) => {
pageInfo.pageNum = val pageInfo.pageNum = val
getList() getList()
} }
const handleSubmit = (instance) => { const handleSubmit = debounce((instance) => {
console.log('form.value', form.value)
if (!instance) return if (!instance) return
instance.validate(async (valid) => { instance.validate(async (valid) => {
if (!valid) return if (!valid) return
@@ -377,7 +394,7 @@ const handleSubmit = (instance) => {
} }
}) })
}) })
} },1000)
//预览隧道 //预览隧道
const handlePreview = (id) => { const handlePreview = (id) => {
console.log('预览') console.log('预览')
@@ -401,7 +418,7 @@ const handleGoToEditTunnel = (tunnelId) => {
router.push('/edit/' + tunnelId + '/byHome/' + userId) router.push('/edit/' + tunnelId + '/byHome/' + userId)
} }
} }
const handleChooseAll = () => { const handleChooseAll = debounce(() => {
tunnelList.value.map(item => { tunnelList.value.map(item => {
item.checked = !item.checked item.checked = !item.checked
if (item.checked && !item.isDefault) { if (item.checked && !item.isDefault) {
@@ -414,7 +431,7 @@ const handleChooseAll = () => {
}) })
} }
}) })
} },1000)
const handleEditDevice = (tunnelId) => { const handleEditDevice = (tunnelId) => {
if (type === 'bySite') { if (type === 'bySite') {
router.push('/device/' + tunnelId + '/bySite/' + userId) router.push('/device/' + tunnelId + '/bySite/' + userId)
@@ -466,7 +483,7 @@ const handleClickSite = (type) => {
}) })
} }
} }
const handleMoreDelete = () => { const handleMoreDelete = debounce(() => {
if (tunnelIds.value.length === 0) { if (tunnelIds.value.length === 0) {
ElMessage.warning('请先选择隧道进行删除') ElMessage.warning('请先选择隧道进行删除')
} else { } else {
@@ -488,11 +505,16 @@ const handleMoreDelete = () => {
}) })
}) })
} }
} },1000)
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.showNull{
margin-top: 150px;
font-size: 60px;
color: #05FEFF;
}
:deep(.el-form-item__error) { :deep(.el-form-item__error) {
font-size: 35px; font-size: 35px;
} }

View File

@@ -165,7 +165,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
import { getUserInfo } from "@/api/login"; import { getUserInfo } from "@/api/login";
import { initSceneData } from "@/api/tunnelScene"; import { initSceneData } from "@/api/tunnelScene";
import { getTunnelList } from "@/api/tunnelManage"; import { getTunnelList } from "@/api/tunnelManage";
import { debounce, throttle } from 'lodash' import { debounce } from 'lodash'
const authStore = useAuthStore(); const authStore = useAuthStore();
const router = useRouter(); const router = useRouter();
const previewId = reactive(router.currentRoute.value.params.tunnelId) const previewId = reactive(router.currentRoute.value.params.tunnelId)
@@ -503,7 +503,7 @@ const changeTunnel = (e) => {
} }
const manageSelect = (index) => { const manageSelect = (index) => {
socket.close()
if (index === '站点管理') { if (index === '站点管理') {
if (currentUserId.value) { if (currentUserId.value) {
router.push("/site/" + currentUserId.value + '/' + currentSiteId.value); router.push("/site/" + currentUserId.value + '/' + currentSiteId.value);
@@ -517,6 +517,7 @@ const manageSelect = (index) => {
router.push("/user/" + localStorage.getItem('currentSiteId')); router.push("/user/" + localStorage.getItem('currentSiteId'));
} }
} }
socket.close()
}; };
const handleChangeSite = debounce((item) => { const handleChangeSite = debounce((item) => {
socket.close() socket.close()

View File

@@ -146,6 +146,7 @@ import {addUser, editUser, getUser, getRoleOption, deleteUser, getUserDetail} fr
import {ElLoading, ElMessage, ElMessageBox} from "element-plus"; import {ElLoading, ElMessage, ElMessageBox} from "element-plus";
import {getTunnelOption} from "@/api/tunnel"; import {getTunnelOption} from "@/api/tunnel";
import TunnelTitle from "@/components/tunnelTitle/index.vue"; import TunnelTitle from "@/components/tunnelTitle/index.vue";
import {debounce} from 'lodash'
const router = useRouter() const router = useRouter()
const title = ref('添加用户') const title = ref('添加用户')
@@ -218,7 +219,7 @@ const handleEditUser = (row) => {
lock: true, lock: true,
text: '正在加载系统资源...', text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading' customClass: 'allLoading'
}) })
getUserDetail(row.userId).then(res => { getUserDetail(row.userId).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
@@ -234,7 +235,7 @@ const handleEditUser = (row) => {
} }
const handleDelete = () => { const handleDelete = debounce(() => {
if (userIds.value === undefined) { if (userIds.value === undefined) {
ElMessage.warning('请先选择用户进行删除') ElMessage.warning('请先选择用户进行删除')
} else { } else {
@@ -251,7 +252,7 @@ const handleDelete = () => {
}) })
}) })
} }
} }, 1000)
const reset = () => { const reset = () => {
form.value = { form.value = {
password: '', password: '',
@@ -276,7 +277,7 @@ const getInfo = () => {
lock: true, lock: true,
text: '正在加载系统资源...', text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading' customClass: 'allLoading'
}) })
getUser({ getUser({
siteId: siteId, siteId: siteId,
@@ -305,7 +306,7 @@ const handleCurrentChange = (val) => {
pageInfo.pageNum = val pageInfo.pageNum = val
getInfo() getInfo()
} }
const handleSubmit = (formInstance) => { const handleSubmit = debounce((formInstance) => {
if (!formInstance) return; if (!formInstance) return;
formInstance.validate((valid) => { formInstance.validate((valid) => {
if (!valid) return; if (!valid) return;
@@ -345,7 +346,7 @@ const handleSubmit = (formInstance) => {
}) })
} }
}) })
} }, 1000)
const handleSelect = async (selection, row) => { const handleSelect = async (selection, row) => {
if (selection.length !== 0) { if (selection.length !== 0) {
// disabled.value = false // disabled.value = false
@@ -368,6 +369,7 @@ const handleSelect = async (selection, row) => {
} }
} }
} }
.el-select__wrapper { .el-select__wrapper {
min-height: 75px; min-height: 75px;
height: auto !important; height: auto !important;
@@ -775,8 +777,9 @@ const handleSelect = async (selection, row) => {
color: #60DDDE; color: #60DDDE;
font-size: 38px; font-size: 38px;
font-weight: bold; font-weight: bold;
:deep(.el-pagination.is-background ) { :deep(.el-pagination.is-background ) {
.btn-next,.btn-prev { .btn-next, .btn-prev {
background-color: transparent; background-color: transparent;
} }