Browse Source

优化工艺状态

feature/three
LiLongLong 3 months ago
parent
commit
b8a83854f2
  1. 2
      src/apis/crafts.ts
  2. 1
      src/main.ts
  3. 33
      src/views/craft/CraftStatus.vue
  4. 4
      src/views/craft/craftType.ts
  5. 7
      src/views/craft/index.vue

2
src/apis/crafts.ts

@ -20,3 +20,5 @@ export const startCraft = (params: { heatId: string }): Promise<any> => http.pos
// 加热区配置工艺 // 加热区配置工艺
export const setCraft = (params: { heatId?: string | number, craftId?: string | number }): Promise<any> => http.post(`/crafts/set`, params) export const setCraft = (params: { heatId?: string | number, craftId?: string | number }): Promise<any> => http.post(`/crafts/set`, params)
export const craftstatus = (): Promise<any> => http.get(`/monitor/crafts/status`)

1
src/main.ts

@ -10,7 +10,6 @@ import { createApp } from 'vue'
import App from './app.vue' import App from './app.vue'
import router from './router' import router from './router'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import 'assets/styles/main.scss'
const app = createApp(App) const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { for (const [key, component] of Object.entries(ElementPlusIconsVue)) {

33
src/views/craft/CraftStatus.vue

@ -0,0 +1,33 @@
<script lang="ts" setup>
import { craftstatus } from '@/apis/crafts'
import { ref } from 'vue'
const statusVisible = ref(false)
const intervalTimes = ref()
const queryCraftStatus = () => {
intervalTimes.value = setInterval(() => {
craftstatus().then((res) => {
console.log('res====', res)
})
}, 1000)
}
const showDialog = () => {
statusVisible.value = true
queryCraftStatus()
}
defineExpose({
showDialog,
})
</script>
<template>
<el-dialog v-model="statusVisible">
<div>
<div></div>
<div></div>
</div>
</el-dialog>
</template>

4
src/views/craft/craftType.ts

@ -81,8 +81,8 @@ export interface AddCraftType {
editDialog: (params: Craft) => void editDialog: (params: Craft) => void
} }
export interface TransferRightType {
getstepInfo: () => void
export interface craftStatus {
showDialog: () => void
} }
export const StepCmdDescMap: { [k in StepCmd]: string } = { export const StepCmdDescMap: { [k in StepCmd]: string } = {

7
src/views/craft/index.vue

@ -1,9 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { AddCraftType, Craft } from './craftType'
import type { AddCraftType, Craft, craftStatus } from './craftType'
import { createCraft, delCraft, getCraftList, setCraft, startCraft, updateCraft } from '@/apis/crafts' import { createCraft, delCraft, getCraftList, setCraft, startCraft, updateCraft } from '@/apis/crafts'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import AddCraftDialog from './AddCraftDialog.vue' import AddCraftDialog from './AddCraftDialog.vue'
import CraftStatus from './CraftStatus.vue'
const tableData = ref([]) const tableData = ref([])
const addCraftRef = ref<AddCraftType | null>(null) const addCraftRef = ref<AddCraftType | null>(null)
@ -11,6 +12,7 @@ const selectable = ref()
const multipleSelection = ref<Craft[]>() const multipleSelection = ref<Craft[]>()
const heatVisible = ref(false) const heatVisible = ref(false)
const heatId = ref() const heatId = ref()
const craftStatusRef = ref<craftStatus | null>(null)
const oresId = 1 const oresId = 1
onMounted(() => { onMounted(() => {
queryCrafList() queryCrafList()
@ -116,6 +118,8 @@ const onStart = () => {
console.log('开始执行') console.log('开始执行')
ElMessage.success('工艺已开始执行') ElMessage.success('工艺已开始执行')
heatVisible.value = false heatVisible.value = false
//
craftStatusRef.value?.showDialog()
}) })
}) })
} }
@ -168,5 +172,6 @@ const onStart = () => {
</el-button> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<CraftStatus ref="craftStatusRef" />
</div> </div>
</template> </template>
Loading…
Cancel
Save