源程控-时间展示
This commit is contained in:
@@ -122,23 +122,26 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<el-button :icon="CirclePlus"
|
<div style="margin-top: 10px;">
|
||||||
|
<span>标准源加量输出:{{hour}}时{{minute}}分{{second}}秒</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px;">
|
||||||
|
<el-button :icon="VideoPlay"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="large"
|
size="large"
|
||||||
@click="startLoading"
|
@click="startLoading"
|
||||||
style="margin-left: 70px;margin-top: 10px;"
|
|
||||||
:disabled="startDisabeld"
|
:disabled="startDisabeld"
|
||||||
>启动</el-button>
|
>启动</el-button>
|
||||||
<el-button :icon="CirclePlus"
|
<el-button :icon="VideoPause"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="large"
|
size="large"
|
||||||
@click="stopLoading"
|
@click="stopLoading"
|
||||||
style="margin-top: 10px;"
|
|
||||||
:disabled="pauseDisabled"
|
:disabled="pauseDisabled"
|
||||||
>停止</el-button>
|
>停止</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
@@ -172,7 +175,7 @@ import Tree from './tree.vue'
|
|||||||
import Commun from './communication.vue'
|
import Commun from './communication.vue'
|
||||||
import {type CascaderOption, ElMessage} from 'element-plus'
|
import {type CascaderOption, ElMessage} from 'element-plus'
|
||||||
import { getTreeData } from '@/api/check/test'
|
import { getTreeData } from '@/api/check/test'
|
||||||
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, Check, CopyDocument, View, EditPen, VideoPlay,VideoPause} from '@element-plus/icons-vue'
|
||||||
import type { TestScript } from '@/api/device/interface/testScript'
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||||
import { CheckData } from '@/api/check/interface'
|
import { CheckData } from '@/api/check/interface'
|
||||||
@@ -246,6 +249,13 @@ const column = ref([
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
// 时间计数器
|
||||||
|
let timer: any = null
|
||||||
|
const timeCount = ref(0)
|
||||||
|
const hour = ref(0)
|
||||||
|
const minute = ref(0)
|
||||||
|
const second = ref(0)
|
||||||
|
|
||||||
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled'])
|
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled'])
|
||||||
const controlContent = ref<controlSource.ResControl>({
|
const controlContent = ref<controlSource.ResControl>({
|
||||||
userPageId: '',
|
userPageId: '',
|
||||||
@@ -414,6 +424,32 @@ const stopLoading = async () => {
|
|||||||
ElMessage.success({message:'停止中...',duration:5000})
|
ElMessage.success({message:'停止中...',duration:5000})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const startTimeCount = () => {
|
||||||
|
if (!timer) {
|
||||||
|
timer = setInterval(() => {
|
||||||
|
timeCount.value = timeCount.value + 1
|
||||||
|
secondToTime(timeCount.value)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const secondToTime = (secd: number) => {
|
||||||
|
//将秒数转换成时分秒
|
||||||
|
hour.value = Math.floor(secd / 3600)
|
||||||
|
minute.value = Math.floor((secd - hour.value * 3600) / 60)
|
||||||
|
second.value = Math.floor(secd % 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
const stopTimeCount = () => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer)
|
||||||
|
}
|
||||||
|
hour.value = 0
|
||||||
|
minute.value = 0
|
||||||
|
second.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
// 获取左边树数据
|
// 获取左边树数据
|
||||||
// 新增保存
|
// 新增保存
|
||||||
const addTab = (row: any) => {
|
const addTab = (row: any) => {
|
||||||
@@ -436,6 +472,11 @@ onMounted(() => {
|
|||||||
.getDictData('Script_Value_Type')
|
.getDictData('Script_Value_Type')
|
||||||
.filter(item => item.id == props.formContent.valueType)[0].code
|
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||||
})
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
startTimeCount,
|
||||||
|
stopTimeCount
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.data-check-content {
|
.data-check-content {
|
||||||
@@ -506,6 +547,12 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
.loading-container {
|
.loading-container {
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
@@ -515,6 +562,8 @@ onMounted(() => {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
input::-webkit-inner-spin-button {
|
input::-webkit-inner-spin-button {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ const childActiveName = ref('')
|
|||||||
const activeIndex = ref()
|
const activeIndex = ref()
|
||||||
const handleNodeClick = (data, node) => {
|
const handleNodeClick = (data, node) => {
|
||||||
console.log('handleNodeClick', props.treeData)
|
console.log('handleNodeClick', props.treeData)
|
||||||
|
if(data.index!= null){
|
||||||
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
||||||
const parents = getParentNodes(node, [])
|
const parents = getParentNodes(node, [])
|
||||||
parents.pop()
|
parents.pop()
|
||||||
@@ -50,7 +51,7 @@ const handleNodeClick = (data, node) => {
|
|||||||
let active = parents[0].scriptTypeCode
|
let active = parents[0].scriptTypeCode
|
||||||
let childActive = findTargetCodes(parents, code)[0] || ''
|
let childActive = findTargetCodes(parents, code)[0] || ''
|
||||||
// 获取当前节点的直接父节点
|
// 获取当前节点的直接父节点
|
||||||
if (activeName.value != active || childActiveName.value != childActive) {
|
if (activeName.value != active || childActiveName.value != childActive || activeIndex.value != data.index) {
|
||||||
activeName.value = active
|
activeName.value = active
|
||||||
childActiveName.value = childActive
|
childActiveName.value = childActive
|
||||||
emit('setTab', {
|
emit('setTab', {
|
||||||
@@ -60,6 +61,7 @@ const handleNodeClick = (data, node) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 返回父级
|
// 返回父级
|
||||||
const getParentNodes = (node, parents) => {
|
const getParentNodes = (node, parents) => {
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
v-model:startDisabeld="startDisabeld"
|
v-model:startDisabeld="startDisabeld"
|
||||||
@update:startDisabeld="startDisabeld=$event"
|
@update:startDisabeld="startDisabeld=$event"
|
||||||
v-model:pauseDisabled="pauseDisabled"
|
v-model:pauseDisabled="pauseDisabled"
|
||||||
@update:pauseDisabled="pauseDisabled=$event"/>
|
@update:pauseDisabled="pauseDisabled=$event"
|
||||||
|
ref="controlSourceDetailRef"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -77,6 +78,7 @@ const formContent = ref<TestScript.ResTestScript>({
|
|||||||
const connectDisabeld = ref(false)
|
const connectDisabeld = ref(false)
|
||||||
const startDisabeld = ref(true)
|
const startDisabeld = ref(true)
|
||||||
const pauseDisabled = ref(true)
|
const pauseDisabled = ref(true)
|
||||||
|
const controlSourceDetailRef=ref<InstanceType<typeof ControlSourceDetail>>()
|
||||||
|
|
||||||
const controlContent = ref<controlSource.ResControl>({
|
const controlContent = ref<controlSource.ResControl>({
|
||||||
userPageId: '',
|
userPageId: '',
|
||||||
@@ -154,6 +156,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
ElMessage.success('启动成功!')
|
ElMessage.success('启动成功!')
|
||||||
startDisabeld.value = false
|
startDisabeld.value = false
|
||||||
pauseDisabled.value = false
|
pauseDisabled.value = false
|
||||||
|
controlSourceDetailRef.value?.startTimeCount()
|
||||||
}else if(newValue.code !== 10201){
|
}else if(newValue.code !== 10201){
|
||||||
ElMessage.error('启动失败!')
|
ElMessage.error('启动失败!')
|
||||||
startDisabeld.value = false
|
startDisabeld.value = false
|
||||||
@@ -168,6 +171,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
connectDisabeld.value = false
|
connectDisabeld.value = false
|
||||||
startDisabeld.value = true
|
startDisabeld.value = true
|
||||||
pauseDisabled.value = true
|
pauseDisabled.value = true
|
||||||
|
controlSourceDetailRef.value?.stopTimeCount()
|
||||||
}, 5000)
|
}, 5000)
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('停止失败!')
|
ElMessage.error('停止失败!')
|
||||||
|
|||||||
Reference in New Issue
Block a user