首页:右键菜单添加 标杆风机设置或者取消按钮

This commit is contained in:
fengrong 2024-12-16 16:24:33 +08:00
parent dd967451fd
commit dde8081959

View File

@ -98,13 +98,13 @@
<el-button
class="control-btn"
type="primary"
@click=""
@click="editstandard(1)"
v-if="realTimeData.standard == 0"
>标杆设置</el-button>
<el-button
class="control-btn"
type="primary"
@click=""
@click="editstandard(0)"
v-else
>标杆取消</el-button>
</div>
@ -120,6 +120,7 @@ import { adminBaseRoutePath } from '/@/router/static/adminBase'
import ContextMenu from '/@/views/backend/auth/model/contextMenu.vue'
import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request'
import {ElMessage, ElMessageBox} from "element-plus";
import {equipUpdate} from '/@/api/backend/index.ts'
const router = useRouter()
const props = defineProps({
@ -190,7 +191,9 @@ const realTimeData = ref<any>({
locked: 0,
deviceId: '',
name:'',
standard:''
code:'',
standard:'',
iotModelId:''
})
const windContextMenu = (event: any,curnodeData) => {
contextMenuPos.value.x = event.pageX
@ -199,7 +202,9 @@ const windContextMenu = (event: any,curnodeData) => {
realTimeData.value.locked=curnodeData.attributeMap.locked
realTimeData.value.deviceId=curnodeData.irn
realTimeData.value.name=curnodeData.name
realTimeData.value.code=curnodeData.deviceCode
realTimeData.value.standard=curnodeData.standard
realTimeData.value.iotModelId=curnodeData.modelId
OperateVisible.value = true
}
const sendCommand = (type: 'setTurbineFastStart' | 'setTurbineStop' | 'setTurbineResetStatusCode') => {
@ -254,6 +259,31 @@ const sendManualCommand = (type: 1 | 0) => {
})
}
const editstandard = (type: 1 | 0) => {
const standardName = type === 0 ? '取消风机标杆' : '设置风机标杆'
ElMessageBox.confirm('确认' + standardName + '吗?', '', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
equipUpdate({
id: realTimeData.value.deviceId,
code: realTimeData.value.code,
name:realTimeData.value.name,
iotModelId: realTimeData.value.iotModelId,
standard: type
}).then((res) => {
if (res.code == 200) {
ElMessage.success('设置成功')
} else {
ElMessage.error('设置失败')
}
})
})
}
</script>
<style scoped lang="scss">