Commit 0e010dc1969b65a534ceeee87703ec1ca0696891

Authored by xp.Huang
2 parents ede3dea5 632f3eab

Merge branch 'dev-fix-ww' into 'main_dev'

fix: 修复teambition中BUG

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