diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts index 6b5407cc..1a441511 100644 --- a/src/api/iot/device/index.ts +++ b/src/api/iot/device/index.ts @@ -102,6 +102,9 @@ export const DeviceApi = { getAvailableList: async () => { return await request.get({ url: `/iot/device/available-list` }) }, + getAvailableListPage: async (params: any) => { + return await request.get({ url: `/iot/device/available-page` , params}) + }, // 新增物联设备 createDevice: async (data: DeviceVO) => { return await request.post({ url: `/iot/device/create`, data }) @@ -147,6 +150,10 @@ export const DeviceApi = { return await request.get({ url: `/iot/device/singleDevice`, params }) }, + getSingleDeviceFrom: async (params: SingleDeviceParams) => { + return await request.get({ url: `/iot/device/singleDeviceFrom`, params }) + }, + getHistoryRecord: async (params: HistoryRecordParams) => { return await request.get({ url: `/iot/device/historyRecord`, @@ -155,6 +162,15 @@ export const DeviceApi = { }) }, + + getHistoryAnalyse: async (params: HistoryRecordParams) => { + return await request.get({ + url: `/iot/device/historyAnalyse`, + params, + paramsSerializer: (p) => qs.stringify(p, { allowDots: true, arrayFormat: 'repeat' }) + }) + }, + devicePointList: async () => { return await request.get({ url: `/iot/device/devicePointList` }) }, @@ -170,6 +186,10 @@ export const DeviceApi = { getDeviceAttributePage: async (params) => { return await request.get({ url: `/iot/device/device-attribute/page`, params }) }, + // 获得设备属性按类型分租 + getDeviceAttributeGroupList: async (params) => { + return await request.get({ url: `/iot/device/device-attribute/groupList`, params }) + }, // 获得设备属性列表 getDeviceAttributeList: async (deviceId: number | string) => { return await request.get({ url: `/iot/device/device-attribute/list?deviceId=` + deviceId }) diff --git a/src/components/TableSelectDialog/TableSelectDialog.vue b/src/components/TableSelectDialog/TableSelectDialog.vue index bed9363b..edc0cfab 100644 --- a/src/components/TableSelectDialog/TableSelectDialog.vue +++ b/src/components/TableSelectDialog/TableSelectDialog.vue @@ -64,13 +64,16 @@ const props = withDefaults( pageSize?: number initialRows?: any[] queryParams?: Record // 新增 + /** ✅ 新增 */ + defaultSelectedKeys?: (string | number)[] }>(), { selectionType: 'multiple', rowKey: 'id', pageSize: 10, initialRows: () => [], - queryParams: () => ({}) // 默认值 + queryParams: () => ({}), // 默认值 + defaultSelectedKeys: () => [] } ) @@ -111,6 +114,16 @@ const refreshSelectionOnTable = async () => { syncingSelection.value = false } } +/** + * ✅ 新增:根据 defaultSelectedKeys 初始化选中状态 + */ +const initDefaultSelection = () => { + if (!props.defaultSelectedKeys.length) return + + props.defaultSelectedKeys.forEach((key) => { + selectedMap.value.set(key, { [props.rowKey]: key }) + }) +} const getList = async () => { loading.value = true @@ -161,12 +174,30 @@ const handleRowClick = (row: any) => { } const open = async (rows?: any[]) => { + /* selectedMap.value.clear() + const initialRows = rows || props.initialRows + const nextRows = isSingleSelect.value ? initialRows.slice(0, 1) : initialRows + nextRows.forEach((row) => { + selectedMap.value.set(resolveRowKey(row), row) + }) + queryParams.pageNo = 1 + queryParams.pageSize = props.pageSize + dialogVisible.value = true + await getList()*/ selectedMap.value.clear() + + // ✅ 优先使用 defaultSelectedKeys + if (props.defaultSelectedKeys.length) { + initDefaultSelection() + } + + // ✅ 兼容原来的 initialRows / rows const initialRows = rows || props.initialRows const nextRows = isSingleSelect.value ? initialRows.slice(0, 1) : initialRows nextRows.forEach((row) => { selectedMap.value.set(resolveRowKey(row), row) }) + queryParams.pageNo = 1 queryParams.pageSize = props.pageSize dialogVisible.value = true diff --git a/src/locales/en.ts b/src/locales/en.ts index 5c7a1810..a1eebaa9 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -1848,6 +1848,8 @@ export default { moduleName: 'Product Material Information', searchNameLabel: 'Name', searchNamePlaceholder: 'Please enter name', + searchCodeLabel: 'Code', + searchCodePlaceholder: 'Please enter code', searchButtonText: 'Search', resetButtonText: 'Reset', addButtonText: 'Add', @@ -4227,9 +4229,11 @@ export default { tableCollectionTimeColumn: 'Collection Time', tableOperateColumn: 'Operation', tableActionHistoryLabel: 'History', - + tableActionHistoryAnalyseLabel: 'History Data Analysis', dialogTitlePrefix: 'History: ', dialogCollectionTimeLabel: 'Collection Time', + dialogPointFilterLabel:'Point Filter', + dialogPointFilterPlaceholder: 'Please enter point name', dialogCollectionTimeStartPlaceholder: 'Start Time', dialogCollectionTimeEndPlaceholder: 'End Time', dialogSearchButtonText: 'Search', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 8b896efa..2bee9216 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -2680,6 +2680,8 @@ export default { moduleName: '产品物料信息', searchNameLabel: '名称', searchNamePlaceholder: '请输入名称', + searchCodeLabel: '编码', + searchCodePlaceholder: '请输入编码', searchButtonText: '搜索', resetButtonText: '重置', addButtonText: '新增', @@ -4070,9 +4072,11 @@ export default { tableCollectionTimeColumn: '采集时间', tableOperateColumn: '操作', tableActionHistoryLabel: '历史记录', - + tableActionHistoryAnalyseLabel: '数据分析', dialogTitlePrefix: '历史记录:', dialogCollectionTimeLabel: '采集时间', + dialogPointFilterLabel: '点位筛选', + dialogPointFilterPlaceholder: '请输入点位名称', dialogCollectionTimeStartPlaceholder: '开始时间', dialogCollectionTimeEndPlaceholder: '结束时间', dialogSearchButtonText: '查询', @@ -4442,9 +4446,11 @@ export default { tableCollectionTimeColumn: '采集时间', tableOperateColumn: '操作', tableActionHistoryLabel: '历史记录', - + tableActionHistoryAnalyseLabel: '数据分析', dialogTitlePrefix: '历史记录:', dialogCollectionTimeLabel: '采集时间', + dialogPointFilterLabel: '点位筛选', + dialogPointFilterPlaceholder: '请输入点位名称', dialogCollectionTimeStartPlaceholder: '开始时间', dialogCollectionTimeEndPlaceholder: '结束时间', dialogSearchButtonText: '查询', diff --git a/src/views/erp/product/product/index.vue b/src/views/erp/product/product/index.vue index b821a479..82e7df02 100644 --- a/src/views/erp/product/product/index.vue +++ b/src/views/erp/product/product/index.vue @@ -2,41 +2,29 @@ - + - - + + - + + + + + + + + +