| | |
| | | |
| | | enum Api { |
| | | sendCommand = '/dry/real/sendCommand', |
| | | sendWriteCommand = '/dry/opc/sendWriteCommand', |
| | | listAll = '/dry/dryOpcDevice/listAll' |
| | | } |
| | | /** |
| | | * åéå½ä»¤ |
| | |
| | | */ |
| | | export const sendCommand = (params) => defHttp.post({ url: Api.sendCommand, params },{ isTransformResponse: false }); |
| | | |
| | | /** |
| | | * åéOPCåæä»¤ |
| | | */ |
| | | |
| | | export const sendWriteCommand = (params) => defHttp.post({url: Api.sendWriteCommand, params},{isTransformResponse: false}) |
| | | |
| | | /** |
| | | * æ¥è¯¢ææOPCè®¾å¤ |
| | | */ |
| | | |
| | | export const listAll = (params) => defHttp.get({url:Api.listAll, params}) |
| | | |
| | |
| | | |
| | | </a-modal> |
| | | <div class="app"> |
| | | <a-card title="æä»¤"> |
| | | <a-row> |
| | | <a-card title="ç
§æ" style="width: 60%"> |
| | | <div class="light-box"> |
| | | <div v-for="item in lightList" :key="item.identifier" class="center"> |
| | | <!-- <a-button v-if="item.type == 0" type="primary" class="com-btn" |
| | | @click="deviceClick(item)"> |
| | | {{ item.name }} |
| | | </a-button> --> |
| | | <div v-if="item.type==0" @click="deviceClick(item)"> |
| | | <div :class="[ item.value?'lightOn':'lightOff' ,'device']"> |
| | | |
| | | |
| | | </div> |
| | | <div class="text-center">{{ item.name }}</div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </a-card> |
| | | <a-card title="çæ§" style="width: 35%; margin-left: 10px;"> |
| | | <div class="monitor-box"> |
| | | <div v-for="item in lightList" :key="item.identifier" class="center" > |
| | | <div v-if="item.type==1" @click="deviceClick(item)"> |
| | | <div :class="[ item.value?'camOn':'camOff' ,'device']"> |
| | | |
| | | |
| | | </div> |
| | | <div class="text-center">{{ item.name }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </a-card> |
| | | |
| | | </a-row> |
| | | |
| | | <a-card title="æä»¤" style="margin-top: 10px"> |
| | | <div class="com-box"> |
| | | <a-button v-for="item in comList" :key="item.id" type="primary" class="com-btn" |
| | | <!-- <a-button v-for="item in comList" :key="item.id" type="primary" class="com-btn" |
| | | @click="comClick(item)"> |
| | | {{ item.title }} |
| | | </a-button> --> |
| | | <div style="width: 500px;"> |
| | | |
| | | <a-row class="button-row"> |
| | | <a-button type="primary" @click="clickButton(1010, 'å¹²ç¥å¯å¨')" class="com-btn"> |
| | | <div> <PlayCircleOutlined style="font-size: 20px;" /> </div> |
| | | <div> å¹²ç¥å¯å¨ </div> |
| | | |
| | | </a-button> |
| | | <!-- <a-button type="normal" @click="clickButton(1012)" class="com-btn"> |
| | | <div> <SplitCellsOutlined style="font-size: 20px;" /> </div> |
| | | <div> åé¨å¼å
³ </div> |
| | | |
| | | </a-button> --> |
| | | <a-button type="default" @click="clickButton(1003,'æ»çå')" class="com-btn w300"> |
| | | <div> <UpCircleOutlined style="font-size: 20px;" /> </div> |
| | | <div> æ»çå </div> |
| | | |
| | | </a-button> |
| | | <a-button type="info" @click="clickButton(1014, 'å¼é¨è§å¯')" class="com-btn"> |
| | | <div> <SettingOutlined style="font-size: 20px;" /> </div> |
| | | <div> å¼é¨è§å¯ </div> |
| | | |
| | | </a-button> |
| | | </a-row> |
| | | <a-row class="button-row"> |
| | | <a-button type="normal" @click="clickButton(1005,'æ»çæ£è½¬')" class="com-btn h100"> |
| | | <div> <RedoOutlined style="font-size: 20px;" /> </div> |
| | | <div> æ»çæ£è½¬ </div> |
| | | </a-button> |
| | | <a-button type="danger" @click="clickButton(1007,'忢')" class="com-btn h100 w300 " > |
| | | <div> <PauseCircleOutlined style="font-size: 20px;" /> </div> |
| | | <div> 忢 </div> |
| | | </a-button> |
| | | <a-button type="normal" @click="clickButton(1006,'æ»çå转')" class="com-btn h100"> |
| | | <div> <UndoOutlined style="font-size: 20px;" /> </div> |
| | | <div> æ»çå转 </div> |
| | | </a-button> |
| | | </a-row> |
| | | <a-row class="button-row"> |
| | | <a-button type="success" @click="clickButton(1015,'åºæ')" class="com-btn"> |
| | | <div> <DownloadOutlined style="font-size: 20px;" /> </div> |
| | | <div> åºæ </div> |
| | | |
| | | </a-button> |
| | | <!-- <a-button type="normal" @click="clickButton(1010)" class="com-btn"> |
| | | <div> <SplitCellsOutlined style="font-size: 20px;" /> </div> |
| | | <div> åé¨å¼å
³ </div> |
| | | </a-button> --> |
| | | <a-button type="normal" @click="clickButton(1004,'æ»çé')" class="com-btn w300"> |
| | | <div> <DownCircleOutlined style="font-size: 20px;" /> </div> |
| | | <div> æ»çé </div> |
| | | </a-button> |
| | | <a-button type="normal" @click="clickButton(1013,'çé£å¯å¨')" class="com-btn"> |
| | | <div> <FireOutlined style="font-size: 20px;" /> </div> |
| | | <div> çé£å¯å¨ </div> |
| | | |
| | | </a-button> |
| | | </a-row> |
| | | |
| | | </div> |
| | | <div style="margin-left: 100px;"> |
| | | <div> |
| | | <a-button type="warning" @click="clickButton(1017,'æå¨/èªå¨')" class="com-btn"> |
| | | <div> <SyncOutlined style="font-size: 20px;" /> </div> |
| | | <div> æå¨/èªå¨ </div> |
| | | |
| | | </a-button> |
| | | </div> |
| | | <div> |
| | | <a-button type="normal" @click="clickButton(1016,'æ¸
é¤')" class="com-btn"> |
| | | <div> <ClearOutlined style="font-size: 20px;" /> </div> |
| | | <div> æ¸
é¤ </div> |
| | | |
| | | </a-button> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </a-card> |
| | | <a-card title="æ§å¶å°" style="margin-top: 10px"> |
| | |
| | | |
| | | <script setup lang="ts"> |
| | | import { ref, onMounted } from "vue"; |
| | | import { sendCommand } from "./api"; |
| | | import { sendCommand, sendWriteCommand, listAll } from "./api"; |
| | | import { useGlobSetting } from '/@/hooks/setting'; |
| | | import { connectWebSocket, onWebSocket } from '/@/hooks/web/useWebSocket'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { RedoOutlined ,SettingOutlined, UndoOutlined,FireOutlined, SplitCellsOutlined, DownloadOutlined, PauseCircleOutlined,ClearOutlined, SyncOutlined,PlayCircleOutlined, SwapOutlined , UpCircleOutlined, DownCircleOutlined, LeftCircleOutlined, RightCircleOutlined} from '@ant-design/icons-vue'; |
| | | |
| | | |
| | | const visible = ref<boolean>(false); |
| | | |
| | | const glob = useGlobSetting(); |
| | | interface Commant { |
| | | id: number; |
| | | title: string; |
| | | icon: string; |
| | | } |
| | | |
| | | interface Device { |
| | | name: string; |
| | | identifier: string; |
| | | value: boolean; |
| | | sort_order: number; |
| | | } |
| | | const userStore = useUserStore(); |
| | | const logList = ref<string[]>([]); |
| | | const comList = ref<Commant[]>([ |
| | | { |
| | |
| | | icon: "caret-right-outlined" |
| | | }]); |
| | | |
| | | |
| | | const lightList = ref<Device[]>([]); |
| | | const monitorList = ref<Device[]>([]); |
| | | function comClick(item) { |
| | | addLog("åé", item.title); |
| | | //åéæä»¤ |
| | |
| | | visible.value = false; |
| | | }; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¯åæå头å表 |
| | | */ |
| | | function queryDevice() { |
| | | listAll({}).then(res => { |
| | | console.log("ress000:",res); |
| | | lightList.value = res |
| | | }) |
| | | |
| | | |
| | | } |
| | | |
| | | function clickButton(cmd, msg) { |
| | | console.log("target::::",cmd); |
| | | var params = { msg: msg, code: cmd, tenantId: 1003, machineId: "GM001" }; |
| | | sendCommand(params).then(res => { |
| | | if (res.success) { |
| | | addLog("ååº", res.message); |
| | | console.info(res); |
| | | } else { |
| | | console.info(res); |
| | | addLog("ååº", res.message); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | function deviceClick(item) { |
| | | //console.log("item===",item.value); |
| | | let params = {code: item.identifier, msg: !item.value} |
| | | sendWriteCommand(params).then(res => { |
| | | console.log("åæä»¤ç»æï¼ï¼", res) |
| | | if(res.success) { |
| | | lightList.value.forEach(device => { |
| | | if(device.identifier == item.identifier) { |
| | | device.value = !item.value |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | // åå§å WebSocket |
| | | function initWebSocket() { |
| | | |
| | | let user = userStore.getUserInfo; |
| | | let tenantId = user.loginTenantId; |
| | | |
| | | console.log(user); |
| | | // WebSocket䏿®éçè¯·æ±æç¨åè®®ææä¸åï¼wsçåäºhttpï¼wssçåäºhttps |
| | | let url = glob.domainUrl?.replace('https://', 'wss://').replace('http://', 'ws://') + '/drySocket/' + tenantId; |
| | | |
| | | connectWebSocket(url); |
| | | onWebSocket(onWebSocketMessage); |
| | | } |
| | | |
| | | function onWebSocketMessage(data) { |
| | | console.log("drysocket:data::",data) |
| | | lightList.value.forEach(item => { |
| | | if(item.identifier == data.identifier) { |
| | | item.value = data.value |
| | | } |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | showModal(); |
| | | initWebSocket(); |
| | | }); |
| | | |
| | | queryDevice() |
| | | |
| | | |
| | | </script> |
| | |
| | | } |
| | | |
| | | .com-box { |
| | | // margin-left: 200px; |
| | | |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | |
| | | |
| | | .com-btn { |
| | | border-radius: 5px; |
| | | width: 100px; |
| | | margin: 10px; |
| | | height: 70px; |
| | | } |
| | | } |
| | | |
| | | .button-row { |
| | | display: flex; justify-content: space-between; |
| | | } |
| | | |
| | | .log-box { |
| | | min-height: 200px; |
| | | max-height: 300px; |
| | | overflow-y: scroll; |
| | | min-height: 150px; |
| | | max-height: 150px; |
| | | overflow-y: auto; |
| | | } |
| | | .indented-text { |
| | | text-indent: 20px; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .light-box { |
| | | display: flex; |
| | | justify-items: center; |
| | | justify-content: center; |
| | | flex-wrap: wrap; |
| | | |
| | | } |
| | | .center { |
| | | display: flex; |
| | | justify-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .text-center { |
| | | text-align: center; |
| | | } |
| | | |
| | | .lightOn { |
| | | background-image: url(/src/assets/images/dry/control/light.png); |
| | | background-repeat: no-repeat; |
| | | background-size: 50px; |
| | | /* border-radius: 10px; */ |
| | | background-position: 48px 0px; |
| | | } |
| | | .lightOff { |
| | | background-image: url(/src/assets/images/dry/control/light-close.png); |
| | | background-repeat: no-repeat; |
| | | background-size: 50px; |
| | | /* border-radius: 10px; */ |
| | | background-position: 48px 0px; |
| | | } |
| | | |
| | | .camOn { |
| | | background-image: url(/src/assets/images/dry/control/cam1.png); |
| | | background-repeat: no-repeat; |
| | | background-size: 50px; |
| | | /* border-radius: 10px; */ |
| | | background-position: 48px 0px; |
| | | } |
| | | .camOff { |
| | | background-image: url(/src/assets/images/dry/control/cam0.png); |
| | | background-repeat: no-repeat; |
| | | background-size: 50px; |
| | | /* border-radius: 10px; */ |
| | | background-position: 48px 0px; |
| | | } |
| | | |
| | | |
| | | .device { |
| | | width: 150px; height: 60px; |
| | | |
| | | } |
| | | |
| | | .h100 { |
| | | height: 70px !important; |
| | | } |
| | | |
| | | .w300 { |
| | | width: 100px !important; |
| | | } |
| | | |
| | | .monitor-box { |
| | | display: flex; |
| | | justify-items: center; |
| | | justify-content: center; |
| | | flex-wrap: wrap; |
| | | |
| | | } |
| | | |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <!--å¼ç¨è¡¨æ ¼--> |
| | | <BasicTable @register="registerTable" :rowSelection="rowSelection"> |
| | | <!--ææ§½:tableæ é¢--> |
| | | <template #tableTitle> |
| | | <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> æ°å¢</a-button> |
| | | <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导åº</a-button> |
| | | <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导å
¥</j-upload-button> |
| | | <a-dropdown v-if="selectedRowKeys.length > 0"> |
| | | <template #overlay> |
| | | <a-menu> |
| | | <a-menu-item key="1" @click="batchHandleDelete"> |
| | | <Icon icon="ant-design:delete-outlined"></Icon> |
| | | å é¤ |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | | <a-button>æ¹éæä½ |
| | | <Icon icon="mdi:chevron-down"></Icon> |
| | | </a-button> |
| | | </a-dropdown> |
| | | </template> |
| | | <!--æä½æ --> |
| | | <template #action="{ record }"> |
| | | <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> |
| | | </template> |
| | | <!--åæ®µåæ¾ææ§½--> |
| | | <template #htmlSlot="{text}"> |
| | | <div v-html="text"></div> |
| | | </template> |
| | | <!--çå¸åºåæ®µåæ¾ææ§½--> |
| | | <template #pcaSlot="{text}"> |
| | | {{ getAreaTextByCode(text) }} |
| | | </template> |
| | | <template #fileSlot="{text}"> |
| | | <span v-if="!text" style="font-size: 12px;font-style: italic;">æ æä»¶</span> |
| | | <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">ä¸è½½</a-button> |
| | | </template> |
| | | </BasicTable> |
| | | <!-- 表ååºå --> |
| | | <DryOpcDeviceModal @register="registerModal" @success="handleSuccess"></DryOpcDeviceModal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" name="dry-dryOpcDevice" setup> |
| | | import {ref, computed, unref} from 'vue'; |
| | | import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
| | | import {useModal} from '/@/components/Modal'; |
| | | import { useListPage } from '/@/hooks/system/useListPage' |
| | | import DryOpcDeviceModal from './components/DryOpcDeviceModal.vue' |
| | | import {columns, searchFormSchema} from './dataDefine/DryOpcDevice.data'; |
| | | import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './api/DryOpcDevice.api'; |
| | | import { downloadFile } from '/@/utils/common/renderUtils'; |
| | | const checkedKeys = ref<Array<string | number>>([]); |
| | | //注åmodel |
| | | const [registerModal, {openModal}] = useModal(); |
| | | //注åtableæ°æ® |
| | | const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ |
| | | tableProps:{ |
| | | title: 'dry_opc_device', |
| | | api: list, |
| | | columns, |
| | | canResize:false, |
| | | formConfig: { |
| | | //labelWidth: 120, |
| | | schemas: searchFormSchema, |
| | | autoSubmitOnEnter:true, |
| | | showAdvancedButton:true, |
| | | fieldMapToNumber: [ |
| | | ], |
| | | fieldMapToTime: [ |
| | | ], |
| | | }, |
| | | actionColumn: { |
| | | width: 120, |
| | | fixed:'right' |
| | | }, |
| | | }, |
| | | exportConfig: { |
| | | name:"dry_opc_device", |
| | | url: getExportUrl, |
| | | }, |
| | | importConfig: { |
| | | url: getImportUrl, |
| | | success: handleSuccess |
| | | }, |
| | | }) |
| | | |
| | | const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext |
| | | |
| | | /** |
| | | * æ°å¢äºä»¶ |
| | | */ |
| | | function handleAdd() { |
| | | openModal(true, { |
| | | isUpdate: false, |
| | | showFooter: true, |
| | | }); |
| | | } |
| | | /** |
| | | * ç¼è¾äºä»¶ |
| | | */ |
| | | function handleEdit(record: Recordable) { |
| | | openModal(true, { |
| | | record, |
| | | isUpdate: true, |
| | | showFooter: true, |
| | | }); |
| | | } |
| | | /** |
| | | * 详æ
|
| | | */ |
| | | function handleDetail(record: Recordable) { |
| | | openModal(true, { |
| | | record, |
| | | isUpdate: true, |
| | | showFooter: false, |
| | | }); |
| | | } |
| | | /** |
| | | * å é¤äºä»¶ |
| | | */ |
| | | async function handleDelete(record) { |
| | | console.log(record); |
| | | await deleteOne({id: record.id}, handleSuccess); |
| | | } |
| | | /** |
| | | * æ¹éå é¤äºä»¶ |
| | | */ |
| | | async function batchHandleDelete() { |
| | | await batchDelete({ids: selectedRowKeys.value}, handleSuccess); |
| | | } |
| | | /** |
| | | * æååè° |
| | | */ |
| | | function handleSuccess() { |
| | | (selectedRowKeys.value = []) && reload(); |
| | | } |
| | | /** |
| | | * æä½æ |
| | | */ |
| | | function getTableAction(record){ |
| | | return [ |
| | | { |
| | | label: 'ç¼è¾', |
| | | onClick: handleEdit.bind(null, record), |
| | | } |
| | | ] |
| | | } |
| | | /** |
| | | * 䏿æä½æ |
| | | */ |
| | | function getDropDownAction(record){ |
| | | return [ |
| | | { |
| | | label: '详æ
', |
| | | onClick: handleDetail.bind(null, record), |
| | | }, { |
| | | label: 'å é¤', |
| | | popConfirm: { |
| | | title: 'æ¯å¦ç¡®è®¤å é¤', |
| | | confirm: handleDelete.bind(null, record), |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import { useMessage } from "/@/hooks/web/useMessage"; |
| | | |
| | | const { createConfirm } = useMessage(); |
| | | |
| | | enum Api { |
| | | list = '/dry/dryOpcDevice/list', |
| | | save='/dry/dryOpcDevice/add', |
| | | edit='/dry/dryOpcDevice/edit', |
| | | deleteOne = '/dry/dryOpcDevice/delete', |
| | | deleteBatch = '/dry/dryOpcDevice/deleteBatch', |
| | | importExcel = '/dry/dryOpcDevice/importExcel', |
| | | exportXls = '/dry/dryOpcDevice/exportXls', |
| | | } |
| | | /** |
| | | * 导åºapi |
| | | * @param params |
| | | */ |
| | | export const getExportUrl = Api.exportXls; |
| | | /** |
| | | * 导å
¥api |
| | | */ |
| | | export const getImportUrl = Api.importExcel; |
| | | /** |
| | | * å表æ¥å£ |
| | | * @param params |
| | | */ |
| | | export const list = (params) => |
| | | defHttp.get({url: Api.list, params}); |
| | | |
| | | /** |
| | | * å é¤å个 |
| | | */ |
| | | export const deleteOne = (params,handleSuccess) => { |
| | | return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { |
| | | handleSuccess(); |
| | | }); |
| | | } |
| | | /** |
| | | * æ¹éå é¤ |
| | | * @param params |
| | | */ |
| | | export const batchDelete = (params, handleSuccess) => { |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: '确认å é¤', |
| | | content: 'æ¯å¦å é¤é䏿°æ®', |
| | | okText: '确认', |
| | | cancelText: 'åæ¶', |
| | | onOk: () => { |
| | | return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { |
| | | handleSuccess(); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /** |
| | | * ä¿åæè
æ´æ° |
| | | * @param params |
| | | */ |
| | | export const saveOrUpdate = (params, isUpdate) => { |
| | | let url = isUpdate ? Api.edit : Api.save; |
| | | return defHttp.post({url: url, params}); |
| | | } |
| | |
| | | <div style="display: flex; width: 120px"> |
| | | <Icon style="color: #ba9853" icon="mdi:home-temperature-outline" :size="28" /> |
| | | |
| | | <div style="font-size: 20px; line-height: 26px"> 26 â </div> |
| | | <div style="font-size: 20px; line-height: 26px"> {{envTemp}} â </div> |
| | | </div> |
| | | <div style="display: flex"> |
| | | <Icon style="color: #ba9853" icon="wi:humidity" :size="28" /> |
| | | |
| | | <div style="font-size: 20px; line-height: 26px"> 53 %rh </div> |
| | | <div style="font-size: 20px; line-height: 26px"> {{envHum}} %rh </div> |
| | | </div> |
| | | </div> |
| | | <div class="feed"> |
| | |
| | | çµéæ¶è |
| | | </div> |
| | | <div class="stat_value"> |
| | | 462 |
| | | {{dianneng.toFixed(2)}} |
| | | <span class="font16"> |
| | | Kwh |
| | | </span> |
| | |
| | | è¸æ±½æ¶è |
| | | </div> |
| | | <div class="stat_value"> |
| | | 683 |
| | | {{zhengqi.toFixed(2)}} |
| | | <span class="font16"> |
| | | m³ |
| | | </span> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="footer"> |
| | | |
| | | <div >{{ nowDate }}</div> |
| | |
| | | const eqps = ref([] as dryEquipment[]) |
| | | const title = ref("å
°æµ¦æºè½å¹²ç¥è½¦é´") |
| | | const userStore = useUserStore() |
| | | const envHum = ref(); |
| | | const envTemp = ref(); |
| | | const zhengqi = ref(); |
| | | const dianneng = ref() |
| | | |
| | | const steam = ref(); |
| | | const watt = ref() |
| | | console.log(userStore.dictItems.title) |
| | | userStore.dictItems.title?.forEach(element => { |
| | | if (element.value === "bigscreentitle") { |
| | |
| | | |
| | | function updateRealTime() { |
| | | //console.log(`output->宿¶å·æ°æ°æ®`) |
| | | eqps.value.forEach((item) => { |
| | | queryRealTime(item) |
| | | zhengqi.value = 0; |
| | | dianneng.value = 0 |
| | | |
| | | new Promise(async function(resolve){ |
| | | |
| | | await eqps.value.forEach(async (item) => { |
| | | await queryRealTime(item) |
| | | }) |
| | | resolve() |
| | | |
| | | console.log("æ§è¡å®æ"); |
| | | }).then(()=>{ |
| | | console.log("then:::::" + dianneng.value,zhengqi.value ); |
| | | |
| | | steam.value = zhengqi.value |
| | | watt.value = dianneng.value |
| | | }) |
| | | |
| | | |
| | | } |
| | | |
| | | function queryRealTime(eqp: dryEquipment) { |
| | | |
| | | async function queryRealTime(eqp: dryEquipment) { |
| | | console.log("sdkfjlasjdflkajsldfjlsd") |
| | | let tenantId = userStore.getTenant |
| | | let eqpCode = eqp.code |
| | | let queryRealTimeUrl = '/dry/real/getRealTimeData' |
| | | defHttp.get({ url: queryRealTimeUrl, params: { tenantid: tenantId, machineid: eqpCode } }).then((res) => { |
| | | //console.log(`output->res`, res) |
| | | await defHttp.get({ url: queryRealTimeUrl, params: { tenantid: tenantId, machineid: eqpCode } }).then( async (res) => { |
| | | console.log(`output->res`, res) |
| | | if (res && res.trendVo) { |
| | | res.tempValue = [res.windTemp, 100] |
| | | res.totalRemain = res.remain |
| | |
| | | } |
| | | |
| | | res.percent = ((res.dryTime / (res.dryTime + res.totalRemain)) * 100).toFixed(2) |
| | | envHum.value = res.envHum |
| | | envTemp.value = res.envTemp |
| | | zhengqi.value += res.steam |
| | | dianneng.value += res.watt |
| | | console.log("zhengqi:::" , res.steam); |
| | | } else { |
| | | res = { |
| | | tempValue: [0, 100], |
| | |
| | | } |
| | | |
| | | .stat_value { |
| | | font-size: 32px |
| | | font-size: 28px |
| | | } |
| | | |
| | | .herb_weight { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="min-height: 400px"> |
| | | <BasicForm @register="registerForm"></BasicForm> |
| | | <div style="width: 100%;text-align: center" v-if="!formDisabled"> |
| | | <a-button @click="submitForm" pre-icon="ant-design:check" type="primary">æ 交</a-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import {BasicForm, useForm} from '/@/components/Form/index'; |
| | | import {computed, defineComponent} from 'vue'; |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import { propTypes } from '/@/utils/propTypes'; |
| | | import {getBpmFormSchema} from '../dataDefine/DryOpcDevice.data'; |
| | | import {saveOrUpdate} from '../api/DryOpcDevice.api'; |
| | | |
| | | export default defineComponent({ |
| | | name: "DryOpcDeviceForm", |
| | | components:{ |
| | | BasicForm |
| | | }, |
| | | props:{ |
| | | formData: propTypes.object.def({}), |
| | | formBpm: propTypes.bool.def(true), |
| | | }, |
| | | setup(props){ |
| | | const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ |
| | | labelWidth: 150, |
| | | schemas: getBpmFormSchema(props.formData), |
| | | showActionButtonGroup: false, |
| | | baseColProps: {span: 24} |
| | | }); |
| | | |
| | | const formDisabled = computed(()=>{ |
| | | if(props.formData.disabled === false){ |
| | | return false; |
| | | } |
| | | return true; |
| | | }); |
| | | |
| | | let formData = {}; |
| | | const queryByIdUrl = '/dry/dryOpcDevice/queryById'; |
| | | async function initFormData(){ |
| | | let params = {id: props.formData.dataId}; |
| | | const data = await defHttp.get({url: queryByIdUrl, params}); |
| | | formData = {...data} |
| | | //设置表åçå¼ |
| | | await setFieldsValue(formData); |
| | | //é»è®¤æ¯ç¦ç¨ |
| | | await setProps({disabled: formDisabled.value}) |
| | | } |
| | | |
| | | async function submitForm() { |
| | | let data = getFieldsValue(); |
| | | let params = Object.assign({}, formData, data); |
| | | console.log('è¡¨åæ°æ®', params) |
| | | await saveOrUpdate(params, true) |
| | | } |
| | | |
| | | initFormData(); |
| | | |
| | | return { |
| | | registerForm, |
| | | formDisabled, |
| | | submitForm, |
| | | } |
| | | } |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> |
| | | <BasicForm @register="registerForm"/> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import {ref, computed, unref} from 'vue'; |
| | | import {BasicModal, useModalInner} from '/@/components/Modal'; |
| | | import {BasicForm, useForm} from '/@/components/Form/index'; |
| | | import {formSchema} from '../dataDefine/DryOpcDevice.data'; |
| | | import {saveOrUpdate} from '../api/DryOpcDevice.api'; |
| | | // Emits声æ |
| | | const emit = defineEmits(['register','success']); |
| | | const isUpdate = ref(true); |
| | | //表åé
ç½® |
| | | const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ |
| | | //labelWidth: 150, |
| | | schemas: formSchema, |
| | | showActionButtonGroup: false, |
| | | baseColProps: {span: 24} |
| | | }); |
| | | //表åèµå¼ |
| | | const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { |
| | | //é置表å |
| | | await resetFields(); |
| | | setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); |
| | | isUpdate.value = !!data?.isUpdate; |
| | | if (unref(isUpdate)) { |
| | | //表åèµå¼ |
| | | await setFieldsValue({ |
| | | ...data.record, |
| | | }); |
| | | } |
| | | // éèåºé¨æ¶ç¦ç¨æ´ä¸ªè¡¨å |
| | | setProps({ disabled: !data?.showFooter }) |
| | | }); |
| | | //设置æ é¢ |
| | | const title = computed(() => (!unref(isUpdate) ? 'æ°å¢' : 'ç¼è¾')); |
| | | //表åæäº¤äºä»¶ |
| | | async function handleSubmit(v) { |
| | | try { |
| | | let values = await validate(); |
| | | setModalProps({confirmLoading: true}); |
| | | //æäº¤è¡¨å |
| | | await saveOrUpdate(values, isUpdate.value); |
| | | //å
³éå¼¹çª |
| | | closeModal(); |
| | | //å·æ°å表 |
| | | emit('success'); |
| | | } finally { |
| | | setModalProps({confirmLoading: false}); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /** æ¶é´åæ°åè¾å
¥æ¡æ ·å¼ */ |
| | | :deep(.ant-input-number){ |
| | | width: 100% |
| | | } |
| | | |
| | | :deep(.ant-calendar-picker){ |
| | | width: 100% |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {BasicColumn} from '/@/components/Table'; |
| | | import {FormSchema} from '/@/components/Table'; |
| | | import { rules} from '/@/utils/helper/validator'; |
| | | import { render } from '/@/utils/common/renderUtils'; |
| | | //åè¡¨æ°æ® |
| | | export const columns: BasicColumn[] = [ |
| | | { |
| | | title: 'åç§°', |
| | | align:"center", |
| | | dataIndex: 'name' |
| | | }, |
| | | { |
| | | title: 'ç¹ä½æ è¯', |
| | | align:"center", |
| | | dataIndex: 'identifier' |
| | | }, |
| | | { |
| | | title: 'æåº', |
| | | align:"center", |
| | | dataIndex: 'sortOrder' |
| | | }, |
| | | { |
| | | title: 'ç±»å', |
| | | align:"center", |
| | | dataIndex: 'type_dictText' |
| | | }, |
| | | ]; |
| | | //æ¥è¯¢æ°æ® |
| | | export const searchFormSchema: FormSchema[] = [ |
| | | { |
| | | label: "åç§°", |
| | | field: 'name', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "ç±»å", |
| | | field: 'type', |
| | | component: 'JDictSelectTag', |
| | | componentProps:{ |
| | | dictCode:"device_type" |
| | | }, |
| | | colProps: {span: 6}, |
| | | }, |
| | | ]; |
| | | //è¡¨åæ°æ® |
| | | export const formSchema: FormSchema[] = [ |
| | | { |
| | | label: 'åç§°', |
| | | field: 'name', |
| | | component: 'Input', |
| | | dynamicRules: ({model,schema}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥åç§°!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'ç¹ä½æ è¯', |
| | | field: 'identifier', |
| | | component: 'Input', |
| | | dynamicRules: ({model,schema}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥ç¹ä½æ è¯!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æåº', |
| | | field: 'sortOrder', |
| | | component: 'InputNumber', |
| | | dynamicRules: ({model,schema}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥æåº!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'ç±»å', |
| | | field: 'type', |
| | | component: 'JDictSelectTag', |
| | | componentProps:{ |
| | | dictCode:"device_type" |
| | | }, |
| | | dynamicRules: ({model,schema}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥ç±»å!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | // TODO 主é®éèåæ®µï¼ç®ååæ»ä¸ºID |
| | | { |
| | | label: '', |
| | | field: 'id', |
| | | component: 'Input', |
| | | show: false |
| | | }, |
| | | ]; |
| | | |
| | | |
| | | |
| | | /** |
| | | * æµç¨è¡¨åè°ç¨è¿ä¸ªæ¹æ³è·åformSchema |
| | | * @param param |
| | | */ |
| | | export function getBpmFormSchema(_formData): FormSchema[]{ |
| | | // é»è®¤ååå§è¡¨åä¿æä¸è´ 妿æµç¨ä¸é
ç½®äºæéæ°æ®ï¼è¿ééè¦åç¬å¤çformSchema |
| | | return formSchema; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- 注æï¼è¯¥é¡µé¢å¯¹åºçåå°ç®å½ä¸ºviews/dryæä»¶å¤¹ä¸ |
| | | -- å¦æä½ æ³æ´æ¹å°å
¶ä»ç®å½ï¼è¯·ä¿®æ¹sqlä¸componentåæ®µå¯¹åºçå¼ |
| | | |
| | | |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
| | | VALUES ('2023112802425240080', NULL, 'dry_opc_device', '/dry/dryOpcDeviceList', 'dry/DryOpcDeviceList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2023-11-28 14:42:08', NULL, NULL, 0); |
| | | |
| | | -- æéæ§å¶sql |
| | | -- æ°å¢ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2023112802425240081', '2023112802425240080', 'æ·»å dry_opc_device', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_opc_device:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-11-28 14:42:08', NULL, NULL, 0, 0, '1', 0); |
| | | -- ç¼è¾ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2023112802425240082', '2023112802425240080', 'ç¼è¾dry_opc_device', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_opc_device:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-11-28 14:42:08', NULL, NULL, 0, 0, '1', 0); |
| | | -- å é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2023112802425240083', '2023112802425240080', 'å é¤dry_opc_device', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_opc_device:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-11-28 14:42:08', NULL, NULL, 0, 0, '1', 0); |
| | | -- æ¹éå é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2023112802425240084', '2023112802425240080', 'æ¹éå é¤dry_opc_device', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_opc_device:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-11-28 14:42:08', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导åºexcel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2023112802425240085', '2023112802425240080', '导åºexcel_dry_opc_device', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_opc_device:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-11-28 14:42:08', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导å
¥excel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2023112802425240086', '2023112802425240080', '导å
¥excel_dry_opc_device', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_opc_device:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-11-28 14:42:08', NULL, NULL, 0, 0, '1', 0); |