Showing
9 changed files
with
47 additions
and
38 deletions
| ... | ... | @@ -704,9 +704,6 @@ export const CommandSchemas = (transportType: TransportTypeEnum): FormSchema[] = |
| 704 | 704 | field: 'commandType', |
| 705 | 705 | component: 'RadioGroup', |
| 706 | 706 | label: '下发类型', |
| 707 | - colProps: { | |
| 708 | - span: 8, | |
| 709 | - }, | |
| 710 | 707 | defaultValue: 'OneWay', |
| 711 | 708 | componentProps: { |
| 712 | 709 | options: [ |
| ... | ... | @@ -746,7 +743,7 @@ export const CommandSchemas = (transportType: TransportTypeEnum): FormSchema[] = |
| 746 | 743 | }, |
| 747 | 744 | component: 'InputTextArea', |
| 748 | 745 | componentProps: { |
| 749 | - autosize: { | |
| 746 | + autoSize: { | |
| 750 | 747 | minRows: 6, |
| 751 | 748 | }, |
| 752 | 749 | }, | ... | ... |
| ... | ... | @@ -25,9 +25,9 @@ |
| 25 | 25 | <TabPane key="7" tab="历史数据" v-if="deviceDetail?.deviceType !== 'GATEWAY'"> |
| 26 | 26 | <HistoryData :deviceDetail="deviceDetail" /> |
| 27 | 27 | </TabPane> --> |
| 28 | - <TabPane key="5" tab="命令下发" v-if="deviceDetail?.deviceType !== 'SENSOR'"> | |
| 28 | + <!-- <TabPane key="5" tab="命令下发" v-if="deviceDetail?.deviceType !== 'SENSOR'"> | |
| 29 | 29 | <CommandIssuance :deviceDetail="deviceDetail" /> |
| 30 | - </TabPane> | |
| 30 | + </TabPane> --> | |
| 31 | 31 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> |
| 32 | 32 | <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'"> |
| 33 | 33 | <ChildDevice |
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | /> |
| 37 | 37 | </TabPane> |
| 38 | 38 | <TabPane key="7" tab="命令下发记录"> |
| 39 | - <CommandRecord :fromId="deviceDetail?.tbDeviceId" /> | |
| 39 | + <CommandRecord :deviceDetail="deviceDetail" :fromId="deviceDetail?.tbDeviceId" /> | |
| 40 | 40 | </TabPane> |
| 41 | 41 | <!-- 网关设备并且场家是TBox --> |
| 42 | 42 | <TabPane |
| ... | ... | @@ -67,7 +67,6 @@ |
| 67 | 67 | import Alarm from '../tabs/Alarm.vue'; |
| 68 | 68 | import ChildDevice from '../tabs/ChildDevice.vue'; |
| 69 | 69 | import TBoxDetail from '../tabs/TBoxDetail.vue'; |
| 70 | - import CommandIssuance from '../tabs/CommandIssuance.vue'; | |
| 71 | 70 | import { CommandRecord } from '../tabs/commandRecord/index'; |
| 72 | 71 | import { getDeviceDetail } from '/@/api/device/deviceManager'; |
| 73 | 72 | // import HistoryData from '../tabs/HistoryData.vue'; |
| ... | ... | @@ -86,7 +85,6 @@ |
| 86 | 85 | // RealTimeData, |
| 87 | 86 | Alarm, |
| 88 | 87 | ChildDevice, |
| 89 | - CommandIssuance, | |
| 90 | 88 | TBoxDetail, |
| 91 | 89 | // HistoryData, |
| 92 | 90 | ModelOfMatter, | ... | ... |
| ... | ... | @@ -12,10 +12,10 @@ |
| 12 | 12 | </div> |
| 13 | 13 | </template> |
| 14 | 14 | </BasicForm> |
| 15 | - <div> | |
| 15 | + <Space class="w-full justify-end" justify="end"> | |
| 16 | 16 | <Button :disabled="disable" type="primary" @click="handleOk" class="mr-2">确定</Button> |
| 17 | 17 | <Button type="default" @click="handleCancel" class="mr-2">重置</Button> |
| 18 | - </div> | |
| 18 | + </Space> | |
| 19 | 19 | </div> |
| 20 | 20 | </div> |
| 21 | 21 | </template> |
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | import jsoneditor from 'jsoneditor'; |
| 30 | 30 | import 'jsoneditor/dist/jsoneditor.min.css'; |
| 31 | 31 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
| 32 | - import { Tooltip } from 'ant-design-vue'; | |
| 32 | + import { Space, Tooltip } from 'ant-design-vue'; | |
| 33 | 33 | import { DeviceRecord } from '/@/api/device/model/deviceModel'; |
| 34 | 34 | import { TransportTypeEnum } from '../../../profiles/components/TransportDescript/const'; |
| 35 | 35 | |
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | export default defineComponent({ |
| 45 | - components: { BasicForm, Button, QuestionCircleOutlined, Tooltip }, | |
| 45 | + components: { BasicForm, Button, QuestionCircleOutlined, Tooltip, Space }, | |
| 46 | 46 | props: { |
| 47 | 47 | deviceDetail: { |
| 48 | 48 | type: Object as PropType<DeviceRecord>, |
| ... | ... | @@ -56,7 +56,7 @@ |
| 56 | 56 | const disable = ref(false); |
| 57 | 57 | |
| 58 | 58 | const [registerForm, { getFieldsValue, validate, resetFields }] = useForm({ |
| 59 | - labelWidth: 100, | |
| 59 | + labelWidth: 120, | |
| 60 | 60 | schemas: CommandSchemas( |
| 61 | 61 | props.deviceDetail.deviceProfile.transportType as TransportTypeEnum |
| 62 | 62 | ), | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <BasicTable class="command-record-table" @register="registerTable"> |
| 3 | + <template #toolbar> | |
| 4 | + <Space> | |
| 5 | + <Button type="primary" @click="openModal(true)">命令下发</Button> | |
| 6 | + </Space> | |
| 7 | + </template> | |
| 3 | 8 | <template #recordContent="{ record }"> |
| 4 | - <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button> | |
| 9 | + <Button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </Button> | |
| 5 | 10 | </template> |
| 6 | 11 | <template #responseContent="{ record }"> |
| 7 | 12 | <div v-if="!record.request?.oneway"> |
| 8 | - <a-button v-if="record?.response === null" type="text" class="ml-2"> 未响应 </a-button> | |
| 9 | - <a-button v-else type="link" class="ml-2" @click="handleRecordResponseContent(record)"> | |
| 13 | + <Button v-if="record?.response === null" type="text" class="ml-2"> 未响应 </Button> | |
| 14 | + <Button v-else type="link" class="ml-2" @click="handleRecordResponseContent(record)"> | |
| 10 | 15 | 查看 |
| 11 | - </a-button> | |
| 16 | + </Button> | |
| 12 | 17 | </div> |
| 13 | 18 | <div v-else>--</div> |
| 14 | 19 | </template> |
| 15 | 20 | </BasicTable> |
| 21 | + | |
| 22 | + <BasicModal | |
| 23 | + @register="registerCommandIssuanceModal" | |
| 24 | + width="600px" | |
| 25 | + title="命令下发" | |
| 26 | + :showOkBtn="false" | |
| 27 | + cancelText="关闭" | |
| 28 | + :footer="h('div')" | |
| 29 | + > | |
| 30 | + <CommandIssuance :deviceDetail="deviceDetail" /> | |
| 31 | + </BasicModal> | |
| 16 | 32 | </template> |
| 17 | 33 | <script lang="ts" setup> |
| 18 | 34 | import { h } from 'vue'; |
| 19 | 35 | import { configColumns, searchFormSchema } from './config'; |
| 20 | 36 | import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi'; |
| 21 | 37 | import { BasicTable, useTable } from '/@/components/Table'; |
| 22 | - import { Modal } from 'ant-design-vue'; | |
| 38 | + import { Button, Modal, Space } from 'ant-design-vue'; | |
| 23 | 39 | import { JsonPreview } from '/@/components/CodeEditor'; |
| 40 | + import { DeviceRecord } from '/@/api/device/model/deviceModel'; | |
| 41 | + import { BasicModal, useModal } from '/@/components/Modal'; | |
| 42 | + import CommandIssuance from '../CommandIssuance.vue'; | |
| 24 | 43 | |
| 25 | 44 | const props = defineProps({ |
| 26 | 45 | fromId: { |
| 27 | 46 | type: String, |
| 28 | 47 | default: '', |
| 29 | 48 | }, |
| 49 | + deviceDetail: { | |
| 50 | + type: Object as PropType<DeviceRecord>, | |
| 51 | + required: true, | |
| 52 | + }, | |
| 30 | 53 | }); |
| 54 | + | |
| 55 | + const [registerCommandIssuanceModal, { openModal }] = useModal(); | |
| 56 | + | |
| 31 | 57 | const [registerTable] = useTable({ |
| 32 | 58 | api: deviceCommandRecordGetQuery, |
| 33 | 59 | columns: configColumns, | ... | ... |
| ... | ... | @@ -212,9 +212,9 @@ |
| 212 | 212 | :title="`最后运行时间: ${dateUtil(getRecord.lastExecuteTime).format(DEFAULT_DATE_FORMAT)}`" |
| 213 | 213 | > |
| 214 | 214 | <div class="text-gray-400 text-xs truncate"> |
| 215 | - <span class="mr-2">间隔时间重复</span> | |
| 215 | + <span class="mr-2">最近执行</span> | |
| 216 | 216 | <span>{{ |
| 217 | - getLastExecuteTime.value | |
| 217 | + getLastExecuteTime.value > 0 | |
| 218 | 218 | ? `${getLastExecuteTime.value}${getLastExecuteTime.unitName}前` |
| 219 | 219 | : '刚刚' |
| 220 | 220 | }}</span> | ... | ... |
| ... | ... | @@ -19,7 +19,6 @@ |
| 19 | 19 | import { RunTaskModal } from './components/RunTaskModal'; |
| 20 | 20 | import { DetailDrawer } from './components/DetailDrawer'; |
| 21 | 21 | import { useDrawer } from '/@/components/Drawer'; |
| 22 | - import { CardLayoutButton } from '/@/components/Widget'; | |
| 23 | 22 | |
| 24 | 23 | const [registerModal, { openModal }] = useModal(); |
| 25 | 24 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| ... | ... | @@ -42,12 +41,10 @@ |
| 42 | 41 | getDataSource(); |
| 43 | 42 | }; |
| 44 | 43 | |
| 45 | - const colNumber = ref(5); | |
| 46 | 44 | const pagination = reactive({ |
| 47 | 45 | current: 1, |
| 48 | 46 | total: 0, |
| 49 | - pageSize: unref(colNumber) * 2, | |
| 50 | - showQuickJumper: true, | |
| 47 | + pageSize: 10, | |
| 51 | 48 | size: 'small', |
| 52 | 49 | showSizeChanger: false, |
| 53 | 50 | showTotal: (total: number) => `共 ${total} 条数据`, |
| ... | ... | @@ -61,15 +58,13 @@ |
| 61 | 58 | try { |
| 62 | 59 | loading.value = true; |
| 63 | 60 | const params = getFieldsValue(); |
| 64 | - const pageSize = unref(colNumber) * 2; | |
| 65 | 61 | const { items, total } = await getTaskCenterList({ |
| 66 | 62 | page: pagination.current, |
| 67 | - pageSize, | |
| 63 | + pageSize: pagination.pageSize, | |
| 68 | 64 | ...params, |
| 69 | 65 | }); |
| 70 | 66 | dataSource.value = items; |
| 71 | 67 | pagination.total = total; |
| 72 | - pagination.pageSize = pageSize; | |
| 73 | 68 | } catch (error) { |
| 74 | 69 | throw error; |
| 75 | 70 | } finally { |
| ... | ... | @@ -154,7 +149,7 @@ |
| 154 | 149 | <span class="text-lg font-medium">任务列表</span> |
| 155 | 150 | </div> |
| 156 | 151 | <Space> |
| 157 | - <CardLayoutButton v-model:value="colNumber" @change="reload" /> | |
| 152 | + <!-- <CardLayoutButton v-model:value="colNumber" :max="4" :min="1" @change="reload" /> --> | |
| 158 | 153 | <Tooltip v-if="dataSource.length" title="刷新"> |
| 159 | 154 | <Button type="primary" @click="getDataSource"> |
| 160 | 155 | <ReloadOutlined :spin="loading" /> | ... | ... |
| 1 | 1 | <script lang="ts" setup> |
| 2 | - import { ref, onMounted, unref, computed } from 'vue'; | |
| 2 | + import { ref, computed } from 'vue'; | |
| 3 | 3 | import { FrontComponent } from '../../../const/const'; |
| 4 | - import { DataSourceField, dataSourceSchema } from '../../config/basicConfiguration'; | |
| 5 | - import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | |
| 4 | + import { dataSourceSchema } from '../../config/basicConfiguration'; | |
| 6 | 5 | import { FormActionType } from '/@/components/Form'; |
| 7 | 6 | import BasicForm from '/@/components/Form/src/BasicForm.vue'; |
| 8 | 7 | const formEl = ref<Nullable<FormActionType>>(null); |
| ... | ... | @@ -19,10 +18,6 @@ |
| 19 | 18 | if (!frontId) return []; |
| 20 | 19 | return dataSourceSchema(isEdit, frontId); |
| 21 | 20 | }); |
| 22 | - | |
| 23 | - onMounted(() => { | |
| 24 | - unref(formEl)?.setFieldsValue({ [DataSourceField.DEVICE_TYPE]: DeviceTypeEnum.SENSOR }); | |
| 25 | - }); | |
| 26 | 21 | </script> |
| 27 | 22 | |
| 28 | 23 | <template> | ... | ... |
| ... | ... | @@ -128,7 +128,6 @@ export const dataSourceSchema = (isEdit: boolean, frontId?: FrontComponent): For |
| 128 | 128 | label: '设备类型', |
| 129 | 129 | colProps: { span: 8 }, |
| 130 | 130 | rules: [{ message: '请选择设备类型', required: true }], |
| 131 | - // defaultValue: DeviceTypeEnum.SENSOR, | |
| 132 | 131 | componentProps: ({ formActionType }) => { |
| 133 | 132 | const { setFieldsValue } = formActionType; |
| 134 | 133 | return { | ... | ... |