| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- <navigation-bar background="{{themeMode === 'dark' ? '#111827' : '#FFF'}}"></navigation-bar>
- <view wx:if="{{toastText}}" class="page-toast page-toast--{{toastType}} {{themeClass}}">
- {{toastText}}
- </view>
- <view wx:if="{{activeParamView}}" class="subpage-fixed-header {{activeParamView == 'genericModbus' || activeParamView == 'genericModbusGroup' ? 'subpage-fixed-header--generic' : ''}} {{themeClass}}">
- <view class="subpage-page-header">
- <view wx:if="{{!(isGenericProtocol && activeParamView == 'genericModbus')}}" class="subpage-back" bindtap="backToParamsHome">
- <view class="subpage-back-icon"></view>
- </view>
- <view class="subpage-page-title">
- {{activeParamView == 'driver' ? '驱动器参数' : activeParamView == 'protection' ? '保护' : activeParamView == 'estimator' ? '估算器参数' : activeParamView == 'dq' ? 'DQ轴电流环参数' : activeParamView == 'startup' ? '启动位置管理' : activeParamView == 'speed' ? '速度管理' : activeParamView == 'genericModbus' ? '' : activeParamView == 'genericModbusGroup' ? (activeGenericGroup.name || '寄存器组') : activeParamView == 'status' ? '状态' : ''}}
- </view>
- <view wx:if="{{activeParamView == 'driver'}}" class="panel-actions subpage-actions">
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" bindtap="readDriverPageParameters">读取</view>
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" bindtap="writeMotorParameters">写入</view>
- </view>
- <view wx:elif="{{activeParamView == 'protection'}}" class="panel-actions subpage-actions">
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" data-group="protection" bindtap="onGroupRead">读取</view>
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" data-group="protection" bindtap="onGroupWrite">写入</view>
- </view>
- <view wx:elif="{{activeParamView == 'estimator'}}" class="panel-actions panel-actions--three subpage-actions">
- <view class="panel-action-button" bindtap="onEstimatorUpdate">更新</view>
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" data-group="estimator" bindtap="onGroupRead">读取</view>
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" data-group="estimator" bindtap="onGroupWrite">写入</view>
- </view>
- <view wx:elif="{{activeParamView == 'dq'}}" class="panel-actions subpage-actions">
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" data-group="dq" bindtap="onGroupRead">读取</view>
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" data-group="dq" bindtap="onGroupWrite">写入</view>
- </view>
- <view wx:elif="{{activeParamView == 'startup'}}" class="panel-actions subpage-actions">
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" bindtap="readStartupManagement">读取</view>
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" bindtap="writeStartupManagement">写入</view>
- </view>
- <view wx:elif="{{activeParamView == 'speed'}}" class="panel-actions subpage-actions">
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" bindtap="readSpeedManagement">读取</view>
- <view class="panel-action-button {{connectedDevice ? '' : 'is-disabled'}}" bindtap="writeSpeedManagement">写入</view>
- </view>
- <view wx:elif="{{activeParamView == 'genericModbus'}}" class="panel-actions subpage-actions">
- <view class="panel-action-button" bindtap="saveGenericModbusJson">保存</view>
- <view class="panel-action-button" bindtap="importGenericModbusJson">加载</view>
- <view class="panel-action-button panel-action-button--icon" bindtap="openGenericModbusDraft">+</view>
- </view>
- <view wx:elif="{{activeParamView == 'genericModbusGroup'}}" class="panel-actions subpage-actions">
- <view
- class="panel-action-button {{connectedDevice && !activeGenericGroup.addressOverflow ? '' : 'is-disabled'}}"
- data-group-id="{{activeGenericGroup.id}}"
- bindtap="readGenericModbusGroup"
- >读取</view>
- <view
- wx:if="{{activeGenericGroup.writable}}"
- class="panel-action-button {{connectedDevice && !activeGenericGroup.addressOverflow ? '' : 'is-disabled'}}"
- data-group-id="{{activeGenericGroup.id}}"
- bindtap="writeGenericModbusGroup"
- >写入</view>
- </view>
- <view wx:elif="{{activeParamView == 'status'}}" class="panel-actions subpage-actions">
- <view class="panel-action-button {{canReadStatus ? '' : 'is-disabled'}}" bindtap="readStatus">读取</view>
- </view>
- </view>
- </view>
- <scroll-view class="scrollarea {{themeClass}} {{activeParamView ? 'scrollarea--subpage' : ''}} {{activeParamView == 'genericModbus' || activeParamView == 'genericModbusGroup' ? 'scrollarea--generic' : ''}}" scroll-y type="list">
- <view class="page-shell">
- <block wx:if="{{activeParamView == 'driver'}}">
- <view class="panel driver-summary-panel">
- <view class="driver-summary-row driver-summary-row--top">
- <text class="driver-summary-chip">{{chipModel || '--'}}</text>
- <text class="driver-summary-checksum">{{flashChecksum || '--'}}</text>
- </view>
- <view class="driver-summary-row driver-summary-row--model">
- <text class="driver-summary-model">{{motorModel || '--'}}</text>
- </view>
- </view>
- <view class="panel params-section-panel">
- <view class="params-section-title">硬件参数</view>
- <view wx:for="{{readonlyParamRegisters}}" wx:key="name" class="param-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view wx:if="{{!item.hideMeta}}" class="param-meta">{{item.addressDisplay}}</view>
- </view>
- <view class="param-value">{{item.displayValue || '--'}}{{item.unit ? ' ' + item.unit : ''}}</view>
- </view>
- </view>
- <view class="panel params-section-panel">
- <view class="params-section-title">电机参数</view>
- <view wx:for="{{motorParameterInputRegisters}}" wx:key="name" class="param-row input-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input value-input--with-unit"
- type="{{item.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{item.inputValue}}"
- data-index="{{index}}"
- bindinput="onMotorParameterInput"
- bindblur="onMotorParameterBlur"
- />
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'protection'}}">
- <view
- wx:for="{{protectionSections}}"
- wx:for-item="section"
- wx:key="key"
- class="panel protection-section-panel"
- >
- <view class="params-section-title">{{section.title}}</view>
- <view
- wx:for="{{section.rows}}"
- wx:for-item="row"
- wx:key="key"
- class="protection-field-row"
- >
- <view
- wx:for="{{row.fields}}"
- wx:for-item="field"
- wx:key="name"
- class="protection-field protection-field--{{field.kind}}"
- >
- <view class="protection-field-main">
- <view class="param-name">{{field.label}}</view>
- <view class="param-meta {{field.isDirty ? 'param-meta--dirty' : ''}}">{{field.addressDisplay}} {{field.metaValue}}</view>
- </view>
- <switch
- wx:if="{{field.kind == 'switch'}}"
- checked="{{field.value}}"
- color="#0f766e"
- disabled="{{!connectedDevice}}"
- data-index="{{field.sourceIndex}}"
- bindchange="onProtectionSwitchChange"
- />
- <view wx:else class="input-wrap">
- <input
- class="value-input {{field.unit ? 'value-input--with-unit' : ''}}"
- type="{{field.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{field.inputValue}}"
- data-index="{{field.sourceIndex}}"
- data-input-group="protection"
- bindinput="onProtectionInputChange"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'estimator'}}">
- <view class="panel params-section-panel">
- <view wx:for="{{estimatorCalculatedDisplayRegisters}}" wx:key="name" class="param-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}</view>
- </view>
- <view class="param-value">{{item.writeValue || '--'}}{{item.unit ? ' ' + item.unit : ''}}</view>
- </view>
- <view
- wx:for="{{atoBandwidthDisplayRegisters}}"
- wx:for-item="atoItem"
- wx:key="name"
- class="param-row input-row"
- >
- <view class="param-main">
- <view class="param-name">{{atoItem.name}}</view>
- <view class="param-meta {{atoItem.isDirty ? 'param-meta--dirty' : ''}}">KP 0x{{atoItem.kpAddress}} {{atoItem.kpWriteValue || '--'}} KI 0x{{atoItem.kiAddress}} {{atoItem.kiWriteValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{atoItem.unit ? 'value-input--with-unit' : ''}}"
- type="{{atoItem.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{atoItem.inputValue}}"
- data-index="{{atoItem.sourceIndex}}"
- data-input-group="ato"
- bindinput="onAtoBandwidthInput"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'dq'}}">
- <view class="panel params-section-panel">
- <view
- wx:for="{{dqGainDisplayRegisters}}"
- wx:for-item="dqItem"
- wx:key="name"
- class="param-row input-row"
- >
- <view class="param-main">
- <view class="param-name">{{dqItem.name}}</view>
- <view class="param-meta {{dqItem.isDirty ? 'param-meta--dirty' : ''}}">{{dqItem.addressDisplay}} {{dqItem.writeValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{dqItem.unit ? 'value-input--with-unit' : ''}}"
- type="{{dqItem.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{dqItem.inputValue}}"
- data-index="{{dqItem.sourceIndex}}"
- data-input-group="dq"
- bindinput="onDqGainInput"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'startup'}}">
- <view class="panel params-section-panel">
- <view class="params-section-title">顺逆风配置</view>
- <view wx:for="{{tailwindControlRegisters}}" wx:key="address" class="param-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue}}</view>
- </view>
- <switch
- checked="{{item.value}}"
- color="#0f766e"
- disabled="{{!connectedDevice}}"
- data-index="{{item.sourceIndex}}"
- bindchange="onTailwindSwitchChange"
- />
- </view>
- <view wx:for="{{tailwindCalculatedDisplayRegisters}}" wx:key="name" class="param-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}</view>
- </view>
- <view class="param-value">{{item.writeValue || '--'}}{{item.unit ? ' ' + item.unit : ''}}</view>
- </view>
- <view
- wx:for="{{tailwindAtoBandwidthDisplayRegisters}}"
- wx:for-item="atoItem"
- wx:key="name"
- class="param-row input-row"
- >
- <view class="param-main">
- <view class="param-name">{{atoItem.name}}</view>
- <view class="param-meta {{atoItem.isDirty ? 'param-meta--dirty' : ''}}">KP 0x{{atoItem.kpAddress}} {{atoItem.kpWriteValue || '--'}} KI 0x{{atoItem.kiAddress}} {{atoItem.kiWriteValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{atoItem.unit ? 'value-input--with-unit' : ''}}"
- type="{{atoItem.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{atoItem.inputValue}}"
- data-index="{{atoItem.sourceIndex}}"
- data-input-group="ato"
- bindinput="onAtoBandwidthInput"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- <view class="panel params-section-panel">
- <view class="params-section-title">预定位配置</view>
- <view wx:for="{{prepositionSwitchRegisters}}" wx:key="address" class="param-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue}}</view>
- </view>
- <switch
- checked="{{item.value}}"
- color="#0f766e"
- disabled="{{!connectedDevice}}"
- data-index="{{item.sourceIndex}}"
- bindchange="onTailwindSwitchChange"
- />
- </view>
- <view wx:for="{{prepositionParameterDisplayRegisters}}" wx:key="name" class="param-row input-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{item.unit ? 'value-input--with-unit' : ''}}"
- type="{{item.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{item.inputValue}}"
- data-index="{{item.sourceIndex}}"
- data-input-group="preposition"
- bindinput="onPrepositionParameterInput"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'speed'}}">
- <view class="panel params-section-panel">
- <view class="params-section-title">速度环路</view>
- <view wx:for="{{speedLoopInputDisplayRegisters}}" wx:key="name">
- <view class="param-row input-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{item.unit ? 'value-input--with-unit' : ''}}"
- type="{{item.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{item.inputValue}}"
- data-index="{{item.sourceIndex}}"
- data-input-group="parameter"
- bindinput="onInputChange"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- <view wx:for="{{speedLoopExtraDisplayRegisters}}" wx:key="name">
- <view class="param-row input-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{item.unit ? 'value-input--with-unit' : ''}}"
- type="{{item.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{item.inputValue}}"
- data-index="{{item.sourceIndex}}"
- data-input-group="speedLoopExtra"
- bindinput="onSpeedLoopExtraInput"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- </view>
- <view class="panel params-section-panel">
- <view class="params-section-title">VSP曲线</view>
- <view wx:for="{{vspCurveRegisters}}" wx:key="name">
- <view class="param-row input-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}{{item.actualText ? ' ' + item.actualText : ''}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{item.unit ? 'value-input--with-unit' : ''}}"
- type="{{item.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{item.inputValue}}"
- data-index="{{item.sourceIndex}}"
- data-input-group="parameter"
- bindinput="onInputChange"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- <view class="param-row">
- <view class="param-main">
- <view class="param-name">{{speedSlopeRegister.name}}</view>
- <view class="param-meta {{speedSlopeRegister.isDirty ? 'param-meta--dirty' : ''}}">{{speedSlopeRegister.addressDisplay}} {{speedSlopeRegister.writeValue || '--'}}</view>
- </view>
- <view class="param-value">{{speedSlopeRegister.writeValue || '--'}}{{speedSlopeRegister.unit ? ' ' + speedSlopeRegister.unit : ''}}</view>
- </view>
- </view>
- <view class="panel params-section-panel">
- <view class="params-section-title">上油参数</view>
- <view wx:for="{{oilParameterInputRegisters}}" wx:key="name" class="param-row input-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta {{item.isDirty ? 'param-meta--dirty' : ''}}">{{item.addressDisplay}} {{item.writeValue || '--'}}</view>
- </view>
- <view class="input-wrap">
- <input
- class="value-input {{item.unit ? 'value-input--with-unit' : ''}}"
- type="{{item.unit ? 'text' : 'digit'}}"
- placeholder="--"
- value="{{item.inputValue}}"
- data-index="{{index}}"
- data-input-group="oil"
- bindinput="onOilParameterInput"
- bindblur="onInputBlur"
- />
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'genericModbus'}}">
- <view wx:if="{{!genericModbusGroups.length && !genericModbusDialog.visible}}" class="empty-state generic-empty-state">
- <view class="empty-title">暂无寄存器组</view>
- <view class="empty-text">点击右上角 + 添加,或从聊天记录导入 JSON</view>
- </view>
- <view
- wx:for="{{genericModbusGroups}}"
- wx:for-item="group"
- wx:key="id"
- class="generic-group-shell {{group.deleteVisible ? 'is-delete-visible' : ''}}"
- >
- <view
- wx:if="{{!group.expanded && group.deleteVisible}}"
- class="generic-delete-action"
- data-group-id="{{group.id}}"
- bindtap="deleteGenericModbusGroup"
- >
- -
- </view>
- <view
- class="panel generic-group-panel {{group.expanded ? '' : 'panel--collapsed'}}"
- data-group-id="{{group.id}}"
- bindtouchstart="onGenericGroupTouchStart"
- bindtouchend="onGenericGroupTouchEnd"
- >
- <view class="panel-header panel-header--with-actions">
- <view
- class="panel-heading-toggle"
- data-group-id="{{group.id}}"
- bindtap="openGenericModbusGroup"
- >
- <view class="panel-icon icon-terminal"></view>
- <view class="generic-group-title-wrap">
- <view class="panel-title" data-group-id="{{group.id}}" catchlongpress="openGenericGroupEdit">{{group.name}}</view>
- <view class="param-meta generic-group-meta">{{group.addressRangeText}} · {{group.quantity}}/{{group.wordQuantity}}{{group.addressWarningText ? ' · ' + group.addressWarningText : ''}}</view>
- </view>
- </view>
- <view class="panel-actions generic-group-actions">
- <view
- class="panel-action-button {{connectedDevice && !group.addressOverflow ? '' : 'is-disabled'}}"
- data-group-id="{{group.id}}"
- bindtap="readGenericModbusGroup"
- >
- 读取
- </view>
- <view
- wx:if="{{group.writable}}"
- class="panel-action-button {{connectedDevice && !group.addressOverflow ? '' : 'is-disabled'}}"
- data-group-id="{{group.id}}"
- bindtap="writeGenericModbusGroup"
- >
- 写入
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'genericModbusGroup'}}">
- <view wx:if="{{activeGenericGroup}}" class="panel generic-group-detail-panel">
- <view class="generic-group-detail-meta">
- {{activeGenericGroup.addressRangeText}} · {{activeGenericGroup.quantity}}/{{activeGenericGroup.wordQuantity}}{{activeGenericGroup.addressWarningText ? ' · ' + activeGenericGroup.addressWarningText : ''}}
- </view>
- <view
- wx:for="{{activeGenericRegisterRows.length ? activeGenericRegisterRows : activeGenericGroup.registers}}"
- wx:for-item="register"
- wx:for-index="registerIndex"
- wx:key="id"
- class="generic-register-row {{register.dragClass}}"
- style="{{register.dragStyle}}"
- >
- <view
- wx:if="{{!activeGenericGroup.isStructLayout}}"
- class="generic-register-drag-handle {{register.dragHandleClass}}"
- data-group-id="{{activeGenericGroup.id}}"
- data-index="{{register.sourceIndex !== undefined ? register.sourceIndex : registerIndex}}"
- catchtouchstart="onGenericRegisterDragStart"
- catchtouchmove="onGenericRegisterDragMove"
- catchtouchend="onGenericRegisterDragEnd"
- catchtouchcancel="onGenericRegisterDragCancel"
- >
- <view class="generic-register-drag-bar"></view>
- <view class="generic-register-drag-bar"></view>
- <view class="generic-register-drag-bar"></view>
- </view>
- <view wx:else class="generic-register-layout-spacer"></view>
- <view class="generic-register-main">
- <view
- class="generic-register-name"
- data-group-id="{{activeGenericGroup.id}}"
- data-index="{{register.sourceIndex !== undefined ? register.sourceIndex : registerIndex}}"
- bindtap="openGenericRegisterInfo"
- catchlongpress="openGenericRegisterEdit"
- >
- {{register.name}}
- </view>
- <view class="generic-register-meta">
- <text>{{register.addressText}} {{register.rawValueText}}</text>
- </view>
- </view>
- <view class="generic-register-input-wrap {{register.showUnit && register.unit ? 'generic-register-input-wrap--unit' : ''}}">
- <block wx:if="{{activeGenericGroup.writable}}">
- <input
- class="value-input generic-register-value {{register.isDirty ? 'value-input--dirty' : ''}}"
- placeholder="--"
- data-group-id="{{activeGenericGroup.id}}"
- data-index="{{register.sourceIndex !== undefined ? register.sourceIndex : registerIndex}}"
- value="{{register.inputValue}}"
- bindinput="onGenericRegisterValueInput"
- bindblur="onGenericRegisterValueBlur"
- />
- <view wx:if="{{register.showUnit && register.unit}}" class="generic-register-unit">{{register.unit}}</view>
- </block>
- <view wx:else class="param-value generic-readonly-value">{{register.displayValue || '--'}}{{register.showUnit && register.unit ? ' ' + register.unit : ''}}</view>
- </view>
- </view>
- </view>
- </block>
- <block wx:elif="{{activeParamView == 'status'}}">
- <view wx:for="{{statusRegisterGroups}}" wx:for-item="group" wx:key="key" class="panel params-section-panel">
- <view class="params-section-title">{{group.title}}</view>
- <view wx:for="{{group.registers}}" wx:for-item="item" wx:key="name" class="param-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta">{{item.addressDisplay}} {{item.rawValue}}</view>
- </view>
- <view class="param-value">{{item.displayValue}}{{item.displayUnit ? ' ' + item.displayUnit : ''}}</view>
- </view>
- </view>
- <view wx:if="{{userStatusRegisters.length}}" class="panel params-section-panel">
- <view class="params-section-title">用户状态</view>
- <view wx:for="{{userStatusRegisters}}" wx:for-item="item" wx:key="name" class="param-row">
- <view class="param-main">
- <view class="param-name">{{item.name}}</view>
- <view class="param-meta">{{item.addressDisplay}} {{item.rawValue}}</view>
- </view>
- <view class="param-value">{{item.displayValue}}{{item.displayUnit ? ' ' + item.displayUnit : ''}}</view>
- </view>
- </view>
- </block>
- <block wx:else>
- <view class="panel panel--collapsed param-entry-panel" data-view="driver" bindtap="openParamView">
- <view class="panel-header panel-header--with-actions">
- <view class="panel-heading-toggle">
- <view class="panel-icon icon-chip"></view>
- <view class="panel-title">驱动器参数</view>
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- <view class="panel panel--collapsed param-entry-panel" data-view="estimator" bindtap="openParamView">
- <view class="panel-header panel-header--with-actions">
- <view class="panel-heading-toggle">
- <view class="panel-icon icon-bars"></view>
- <view class="panel-title">估算器参数</view>
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- <view class="panel panel--collapsed param-entry-panel" data-view="dq" bindtap="openParamView">
- <view class="panel-header panel-header--with-actions">
- <view class="panel-heading-toggle">
- <view class="panel-icon icon-tune"></view>
- <view class="panel-title">DQ轴电流环参数</view>
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- <view class="panel panel--collapsed param-entry-panel" data-view="startup" bindtap="openParamView">
- <view class="panel-header panel-header--with-actions">
- <view class="panel-heading-toggle">
- <view class="panel-icon icon-target"></view>
- <view class="panel-title">启动位置管理</view>
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- <view class="panel panel--collapsed param-entry-panel" data-view="speed" bindtap="openParamView">
- <view class="panel-header panel-header--with-actions">
- <view class="panel-heading-toggle">
- <view class="panel-icon icon-speed"></view>
- <view class="panel-title">速度管理</view>
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- <view class="panel panel--collapsed param-entry-panel" data-view="protection" bindtap="openParamView">
- <view class="panel-header panel-header--with-actions">
- <view class="panel-heading-toggle">
- <view class="panel-icon icon-shield-check"></view>
- <view class="panel-title">保护</view>
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- <view class="panel panel--collapsed param-entry-panel" data-view="status" bindtap="openParamView">
- <view class="panel-header panel-header--with-actions">
- <view class="panel-heading-toggle">
- <view class="panel-icon icon-status"></view>
- <view class="panel-title">状态</view>
- </view>
- <view class="entry-chevron"></view>
- </view>
- </view>
- </block>
- </view>
- </scroll-view>
- <view wx:if="{{genericModbusDialog.visible}}" class="generic-dialog-mask {{themeClass}}" bindtap="closeGenericModbusDraft">
- <view class="generic-dialog" catchtap="noop">
- <view class="generic-dialog-header">
- <view class="generic-dialog-title">{{genericModbusDialog.title}}</view>
- <view class="generic-dialog-close" bindtap="closeGenericModbusDraft">×</view>
- </view>
- <block wx:if="{{genericModbusDialog.mode == 'createGroup' || genericModbusDialog.mode == 'editGroup'}}">
- <view class="generic-dialog-body">
- <view class="generic-config-row">
- <view class="param-main">
- <view class="param-name">寄存器组名</view>
- <view class="param-meta">每组寄存器地址连续</view>
- </view>
- <input
- class="value-input generic-value-input"
- data-field="groupName"
- value="{{genericModbusDialog.groupName}}"
- bindinput="onGenericDraftInput"
- />
- </view>
- <view class="generic-config-row">
- <view class="param-main">
- <view class="param-name">寄存器类型</view>
- <view class="param-meta">决定读取功能码与是否可写</view>
- </view>
- <picker
- mode="selector"
- range="{{genericModbusRegisterTypeOptions}}"
- range-key="label"
- value="{{genericModbusDialog.registerTypeIndex}}"
- bindchange="onGenericDraftTypeChange"
- >
- <view class="generic-picker-value">{{genericModbusDialog.registerTypeText}}</view>
- </picker>
- </view>
- <view class="generic-config-row">
- <view class="param-main">
- <view class="param-name">寄存器起始地址</view>
- <view class="param-meta">16进制,例如 00A0</view>
- </view>
- <input
- class="value-input generic-value-input"
- data-field="startAddress"
- value="{{genericModbusDialog.startAddress}}"
- bindinput="onGenericDraftInput"
- />
- </view>
- <view class="generic-config-row">
- <view class="param-main">
- <view class="param-name">寄存器数量</view>
- <view class="param-meta">{{genericModbusDialog.structParsedSummary || '1 - 256'}}</view>
- </view>
- <input
- class="value-input generic-value-input"
- type="number"
- data-field="quantity"
- value="{{genericModbusDialog.quantity}}"
- bindinput="onGenericDraftInput"
- />
- </view>
- <view wx:if="{{genericModbusDialog.mode == 'createGroup'}}" class="generic-struct-section">
- <view class="generic-struct-header">
- <view class="param-main">
- <view class="param-name">结构体定义</view>
- <view class="param-meta">支持 typedef struct、typedef 别名与数组</view>
- </view>
- <view class="panel-action-button" bindtap="parseGenericStructDefinition">解析</view>
- </view>
- <textarea
- class="generic-struct-input"
- maxlength="-1"
- placeholder="粘贴 C 结构体定义"
- data-field="structDefinition"
- value="{{genericModbusDialog.structDefinition}}"
- bindinput="onGenericDraftInput"
- />
- </view>
- </view>
- </block>
- <block wx:elif="{{genericModbusDialog.mode == 'editRegister' || genericModbusDialog.mode == 'viewRegister'}}">
- <view class="generic-dialog-body">
- <view class="generic-info-stack">
- <view class="generic-info-row">
- <view class="generic-info-label">名称</view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister'}}" class="generic-info-value">{{genericModbusDialog.name}}</view>
- <input wx:else class="value-input generic-value-input" data-field="name" value="{{genericModbusDialog.name}}" bindinput="onGenericDraftInput" />
- </view>
- <view class="generic-info-row">
- <view class="generic-info-label">地址</view>
- <view class="generic-info-value">{{genericModbusDialog.addressText}}</view>
- </view>
- <view wx:if="{{genericModbusDialog.showDataType}}" class="generic-info-row">
- <view class="generic-info-label">类型</view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister'}}" class="generic-info-value">{{genericModbusDialog.dataTypeText}}</view>
- <picker wx:else mode="selector" range="{{genericModbusDataTypeOptions}}" range-key="label" value="{{genericModbusDialog.dataTypeIndex}}" bindchange="onGenericDialogDataTypeChange">
- <view class="generic-picker-value">{{genericModbusDialog.dataTypeText}}</view>
- </picker>
- </view>
- <view wx:if="{{genericModbusDialog.showTextLength}}" class="generic-info-row">
- <view class="generic-info-label">长度</view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister'}}" class="generic-info-value">{{genericModbusDialog.textByteLength || '--'}}B</view>
- <input wx:else class="value-input generic-value-input" type="number" data-field="textByteLength" value="{{genericModbusDialog.textByteLength}}" bindinput="onGenericDraftInput" />
- </view>
- <view class="generic-info-row">
- <view class="generic-info-label">备注</view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister'}}" class="generic-info-value">{{genericModbusDialog.remark || '--'}}</view>
- <input wx:else class="value-input generic-value-input" data-field="remark" value="{{genericModbusDialog.remark}}" bindinput="onGenericDraftInput" />
- </view>
- <view wx:if="{{genericModbusDialog.showUnit}}" class="generic-info-row">
- <view class="generic-info-label">单位</view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister'}}" class="generic-info-value">{{genericModbusDialog.unit || '--'}}</view>
- <input wx:else class="value-input generic-value-input" data-field="unit" value="{{genericModbusDialog.unit}}" bindinput="onGenericDraftInput" />
- </view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister' || genericModbusDialog.showRange}}" class="generic-info-row">
- <view class="generic-info-label">最小值</view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister'}}" class="generic-info-value">{{genericModbusDialog.minValue || '--'}}</view>
- <input wx:else class="value-input generic-value-input" data-field="minValue" value="{{genericModbusDialog.minValue}}" bindinput="onGenericDraftInput" />
- </view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister' || genericModbusDialog.showRange}}" class="generic-info-row">
- <view class="generic-info-label">最大值</view>
- <view wx:if="{{genericModbusDialog.mode == 'viewRegister'}}" class="generic-info-value">{{genericModbusDialog.maxValue || '--'}}</view>
- <input wx:else class="value-input generic-value-input" data-field="maxValue" value="{{genericModbusDialog.maxValue}}" bindinput="onGenericDraftInput" />
- </view>
- </view>
- </view>
- </block>
- <view class="generic-draft-actions">
- <view class="panel-action-button" bindtap="closeGenericModbusDraft">{{genericModbusDialog.cancelText}}</view>
- <view wx:if="{{genericModbusDialog.confirmText}}" class="panel-action-button is-active" bindtap="confirmGenericModbusDialog">{{genericModbusDialog.confirmText}}</view>
- </view>
- </view>
- </view>
|