From 985befd1aacce206d49925399aba85a51c50ea6e Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期二, 28 十一月 2023 17:20:03 +0800
Subject: [PATCH] feat: 下发后重连plc
---
src/views/dashboard/components/CraftDetailModal.vue | 72 ++++++++++++++++++++++--------------
1 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/src/views/dashboard/components/CraftDetailModal.vue b/src/views/dashboard/components/CraftDetailModal.vue
index 22c3030..7804aec 100644
--- a/src/views/dashboard/components/CraftDetailModal.vue
+++ b/src/views/dashboard/components/CraftDetailModal.vue
@@ -2,18 +2,18 @@
<div class="craft-detail-modal">
<BaseModal v-model="modelData" :wider="true" @close="closeModal">
<template #title>宸ヨ壓璇︽儏 </template>
- <div class="modal-content">
+ <div v-if="craftModel" class="modal-content">
<el-scrollbar always class="scroller">
- <div :class="processObj.isUpdate ? 'modal-t margin_bottom_20' : 'modal-t modal-t-two'">
+ <div :class="craftModel?.isUpdate ? 'modal-t margin_bottom_20' : 'modal-t modal-t-two'">
<div class="modal-t-l">
- <div class="modal-t-l-t">{{ processObj.procedure }}</div>
+ <div class="modal-t-l-t">{{ craftModel?.procedure }}</div>
<div class="modal-t-l-b">
- <span v-for="(item, index) in processObj.paramsMap" :key="index"> {{ index }} : {{ item }}锛� </span>
+ <span v-for="(item, index) in craftModel?.paramsMap" :key="index"> {{ index }} : {{ item }}锛� </span>
</div>
</div>
- <div class="modal-t-r">宸ヨ壓缂栧彿锛歿{ processObj.number }}</div>
+ <div class="modal-t-r">宸ヨ壓缂栧彿锛歿{ craftModel?.number }}</div>
</div>
- <div v-if="processObj.isUpdate" class="modal-b">
+ <div v-if="craftModel?.isUpdate" class="modal-b">
<div class="modal-b-t">鏇存柊璁剧疆</div>
<template v-if="isUpdate == 1">
<div class="modal-b-m">
@@ -23,25 +23,25 @@
</el-icon>
</div>
<div class="modal-b-m-r">
- <span>宸叉鏌ュ埌鏂扮増鏈細{{ processObj.newNumber }}</span>
+ <span>宸叉鏌ュ埌鏂扮増鏈細{{ craftModel?.newNumber }}</span>
<BigButton class="btn" bg-color="#4343f5" @click="updateProcess">鏇存柊宸ヨ壓</BigButton>
</div>
</div>
<div class="modal-b-b">
<div class="modal-b-b-l">
- <div class="modal-b-b-l-t">{{ processObj.procedure }}</div>
+ <div class="modal-b-b-l-t">{{ craftModel?.procedure }}</div>
<div class="modal-b-b-l-b">
- <span v-for="(item, index) in processObj.newParamsMap" :key="index">
+ <span v-for="(item, index) in craftModel?.newParamsMap" :key="index">
{{ index }} : {{ item }}锛�
</span>
</div>
</div>
- <div class="modal-b-b-r">鏂扮増鏈細{{ processObj.newNumber }}</div>
+ <div class="modal-b-b-r">鏂扮増鏈細{{ craftModel?.newNumber }}</div>
</div>
</template>
<template v-else-if="isUpdate == 2">
<div class="refresh-box">
- <template v-if="isLoading">
+ <template v-if="loading">
<el-icon class="refresh-icon transform">
<Refresh />
</el-icon>
@@ -65,42 +65,55 @@
import { Refresh, Top } from '@element-plus/icons-vue'
import { useVModel } from '@vueuse/core'
import BigButton from '@/views/dashboard/components/BigButton.vue'
-import { ref } from 'vue'
+import { ref, toRefs, watch } from 'vue'
+import type { CraftModel } from '@/api/craftModel'
export interface CraftDetailModalProps {
+ craftModel: CraftModel
+ activeArr: string[]
modelValue: boolean
}
const props = withDefaults(defineProps<CraftDetailModalProps>(), {
+ craftModel: undefined,
modelValue: false
})
-
+const { craftModel, activeArr, modelValue } = toRefs(props)
const emit = defineEmits<{
'update:modelValue': [show: boolean]
close: []
+ renew: [craftModel: CraftModel, true]
}>()
const modelData = useVModel(props, 'modelValue', emit)
-
function closeModal() {
emit('close')
}
-const processObj = {
- isUpdate: 1, //1==鏃犱笅闈㈢殑鏇存柊璁剧疆 2==鏈夋洿鏂拌缃�
- procedure: '111',
- number: 111,
- paramsMap: {
- 鍘嬪己: 111
- },
- newNumber: '鏂�222',
- newParamsMap: {
- 鍘嬪己: 222
- }
-}
// 鏈夋洿鏂拌缃殑鍒濆鍊�
const isUpdate = ref(1)
-const isLoading = ref(false)
+const loading = ref(false)
+watch(modelData, () => {
+ // 寮圭獥鏄剧ず鏃惰幏鍙栧伐鑹哄弬鏁�
+ if (modelData.value) {
+ getLoading()
+ }
+})
+function getLoading() {
+ for (let i in activeArr.value) {
+ if (activeArr.value[i] == craftModel?.value?.number) {
+ isUpdate.value = 2
+ loading.value = true
+ return true
+ }
+ }
+ isUpdate.value = 1
+ loading.value = false
+}
+
function updateProcess() {
isUpdate.value = 2
- isLoading.value = true
+ if (loading.value) {
+ return true
+ }
// 璇锋眰鏇存柊鎺ュ彛 鑾峰緱鏁版嵁涔嬪悗isLoading.value=false;
+ emit('renew', craftModel?.value, true)
}
//TODO: 宸ヨ壓璇︽儏寮圭獥
</script>
@@ -156,6 +169,9 @@
overflow: auto;
width: calc(100% - 60px);
margin: 0 auto;
+ :deep(.el-scrollbar__view) {
+ height: 100%;
+ }
.modal-t-two {
height: calc(100% - 55px) !important;
}
--
Gitblit v1.8.0