diff --git a/src/views/device/config/DeviceConfigList.vue b/src/views/device/config/DeviceConfigList.vue index c18f526..3f7e087 100644 --- a/src/views/device/config/DeviceConfigList.vue +++ b/src/views/device/config/DeviceConfigList.vue @@ -11,16 +11,7 @@ - - - - - 机构维度 - 区域维度 - - - - + 查询 diff --git a/src/views/device/config/components/DeviceConfigForm.vue b/src/views/device/config/components/DeviceConfigForm.vue index b055c43..f4c707f 100644 --- a/src/views/device/config/components/DeviceConfigForm.vue +++ b/src/views/device/config/components/DeviceConfigForm.vue @@ -13,7 +13,7 @@ - + @@ -31,16 +31,6 @@ - - - - - 机构维度 - 区域维度 - - - - @@ -72,7 +62,6 @@ const formData = reactive>({ deviceTypeLabel: '', deviceModel: '', factory: '', - dimension: '机构维度' }); const { createMessage } = useMessage(); const labelCol = ref({ xs: { span: 24 }, sm: { span: 5 } }); @@ -85,7 +74,6 @@ const validatorRules = reactive({ deviceType: [{ required: true, message: '请选择设备类型' }], deviceModel: [{ required: true, message: '请输入规格型号' }], factory: [{ required: true, message: '请输入生产厂家' }], - dimension: [{ required: true, message: '请选择设备维度' }], }); const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false }); @@ -106,14 +94,8 @@ function upDictCode(v_) { dictCode.value = v_ } -function changeType(value){ - formData.deviceTypeLabel = dictCode.value.find(d => d.value == value)?.label || ''; - getDeviceName(); -} - - - function getDeviceName(){ + formData.deviceTypeLabel = dictCode.value.find(d => d.value == formData.deviceType)?.label || ''; formData.deviceName = formData.deviceTypeLabel+"-"+formData.factory+"["+formData.deviceModel+"]" } diff --git a/src/views/device/config/config.data.ts b/src/views/device/config/config.data.ts index a825f37..aac96ee 100644 --- a/src/views/device/config/config.data.ts +++ b/src/views/device/config/config.data.ts @@ -24,12 +24,6 @@ export const columns: BasicColumn[] = [ align: "center", dataIndex: 'deviceModel' }, - { - title: '设备维度', - align: "center", - dataIndex: 'dimension', - width: 120 - }, ]; export const searchFormSchema: FormSchema[] = []; diff --git a/src/views/device/manager/DeviceManagerList.vue b/src/views/device/manager/DeviceManagerList.vue index aefbb98..163a771 100644 --- a/src/views/device/manager/DeviceManagerList.vue +++ b/src/views/device/manager/DeviceManagerList.vue @@ -128,7 +128,6 @@ * 成功回调 */ function handleSuccess() { - console.log(111111111); (selectedRowKeys.value = []) && reload(); } diff --git a/src/views/device/manager/components/batch/DeviceBatchList.vue b/src/views/device/manager/components/batch/DeviceBatchList.vue index 04a7707..c7454b7 100644 --- a/src/views/device/manager/components/batch/DeviceBatchList.vue +++ b/src/views/device/manager/components/batch/DeviceBatchList.vue @@ -48,7 +48,6 @@ - @@ -60,14 +59,13 @@ import { columns } from './batch.data'; import { batchList, deleteBatch, sendBatch } from './batch.api'; import { useUserStore } from '/@/store/modules/user'; import DeviceBatchFormModal from './DeviceBatchFormModal.vue'; -import DepartPreviewModal from "../preview/DepartPreviewModal.vue"; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import { changeTheme } from "@/logics/theme"; const formRef = ref(); const queryParam = reactive({}); const deviceBatchDrawer = ref(); -const previewDrawer = ref(); + const orgCode = ref(''); const departName = ref(''); const confirmLoading = ref(false); @@ -128,14 +126,6 @@ function addBatch() { deviceBatchDrawer.value.add(record); } -/** - * 清单 - */ -function handlePreview(record: Recordable) { - previewDrawer.value.disableSubmit = true; - previewDrawer.value.edit(record); -} - /** * 推送 */ @@ -183,15 +173,15 @@ async function handleDelete(record: Recordable) { */ function getTableAction(record) { return [ - { - label: '设备清单', - onClick: handleDeatail.bind(null, record), - }, { label: '推送清单', onClick: handleSend.bind(null, record), ifShow: record.izPush == 'N' && record.childrenCn > 0 }, + { + label: '详情', + onClick: handleDeatail.bind(null, record), + }, { label: '编辑', onClick: handleEdit.bind(null, record), diff --git a/src/views/device/manager/components/integration/integration.data.ts b/src/views/device/manager/components/integration/integration.data.ts index 07c43c7..46f422d 100644 --- a/src/views/device/manager/components/integration/integration.data.ts +++ b/src/views/device/manager/components/integration/integration.data.ts @@ -3,12 +3,6 @@ import {FormSchema} from '/@/components/Table'; //列表数据 export const deviceColumns: BasicColumn[] = [ - { - title: '设备维度', - align: "center", - dataIndex: 'dimension', - width: 100 - }, { title: '设备标识', align: "center", diff --git a/src/views/device/manager/components/log/DeviceLogList.vue b/src/views/device/manager/components/log/DeviceLogList.vue index 499cc9b..c1e82d7 100644 --- a/src/views/device/manager/components/log/DeviceLogList.vue +++ b/src/views/device/manager/components/log/DeviceLogList.vue @@ -10,15 +10,6 @@ - - - - - 机构维度 - 区域维度 - - - diff --git a/src/views/device/manager/components/log/log.data.ts b/src/views/device/manager/components/log/log.data.ts index e9949d6..dd4ed93 100644 --- a/src/views/device/manager/components/log/log.data.ts +++ b/src/views/device/manager/components/log/log.data.ts @@ -28,12 +28,6 @@ export const columns: BasicColumn[] = [ } }, }, - { - title: '设备维度', - align: "center", - dataIndex: 'dimension', - width: 100 - }, { title: '设备名称', align: "center", diff --git a/src/views/device/manager/components/preview/AddDepartPreviewForm.vue b/src/views/device/manager/components/preview/AddDepartPreviewForm.vue deleted file mode 100644 index 1e88109..0000000 --- a/src/views/device/manager/components/preview/AddDepartPreviewForm.vue +++ /dev/null @@ -1,214 +0,0 @@ - - - - - diff --git a/src/views/device/manager/components/preview/AddDepartPreviewModal.vue b/src/views/device/manager/components/preview/AddDepartPreviewModal.vue deleted file mode 100644 index 3bcb5a6..0000000 --- a/src/views/device/manager/components/preview/AddDepartPreviewModal.vue +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - diff --git a/src/views/device/manager/components/preview/AddNuPreviewForm copy.vue b/src/views/device/manager/components/preview/AddNuPreviewForm copy.vue deleted file mode 100644 index 191a4c8..0000000 --- a/src/views/device/manager/components/preview/AddNuPreviewForm copy.vue +++ /dev/null @@ -1,234 +0,0 @@ - - - - - diff --git a/src/views/device/manager/components/preview/AddNuPreviewForm.vue b/src/views/device/manager/components/preview/AddNuPreviewForm.vue deleted file mode 100644 index 3422b6e..0000000 --- a/src/views/device/manager/components/preview/AddNuPreviewForm.vue +++ /dev/null @@ -1,624 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/device/manager/components/preview/AddNuPreviewModal.vue b/src/views/device/manager/components/preview/AddNuPreviewModal.vue deleted file mode 100644 index f73db82..0000000 --- a/src/views/device/manager/components/preview/AddNuPreviewModal.vue +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - diff --git a/src/views/device/manager/components/preview/DepartPreviewList.vue b/src/views/device/manager/components/preview/DepartPreviewList.vue deleted file mode 100644 index 9ac0cef..0000000 --- a/src/views/device/manager/components/preview/DepartPreviewList.vue +++ /dev/null @@ -1,226 +0,0 @@ - - - - - diff --git a/src/views/device/manager/components/preview/DepartPreviewModal.vue b/src/views/device/manager/components/preview/DepartPreviewModal.vue deleted file mode 100644 index d09d455..0000000 --- a/src/views/device/manager/components/preview/DepartPreviewModal.vue +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - diff --git a/src/views/device/manager/components/preview/NuPreviewList copy.vue b/src/views/device/manager/components/preview/NuPreviewList copy.vue deleted file mode 100644 index 673dfc5..0000000 --- a/src/views/device/manager/components/preview/NuPreviewList copy.vue +++ /dev/null @@ -1,222 +0,0 @@ - - - - - diff --git a/src/views/device/manager/components/preview/NuPreviewList.vue b/src/views/device/manager/components/preview/NuPreviewList.vue index 082629e..21ef329 100644 --- a/src/views/device/manager/components/preview/NuPreviewList.vue +++ b/src/views/device/manager/components/preview/NuPreviewList.vue @@ -10,15 +10,6 @@ - - - - - 机构维度 - 区域维度 - - - @@ -42,12 +33,9 @@ - - - - - - - - - - - - - - - - - - @@ -283,7 +196,7 @@ import { ref, reactive, defineExpose, nextTick, createVNode, computed, onMounted import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { useListPage } from '/@/hooks/system/useListPage'; import { nuColumns } from './preview.data'; -import { nuPreview, deletePreview, configList, previewBatchSave, nuList, batchSave, queryQuantityByOrgCode, getNuListByOrgCode } from './preview.api'; +import { nuPreview, configList, nuList, batchSave, getNuListByOrgCode } from './preview.api'; import { useUserStore } from '/@/store/modules/user'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'; @@ -299,7 +212,6 @@ const props = defineProps({ const emit = defineEmits(['ok']); const { createMessage } = useMessage(); const formRef = ref(); -const departFormRef = ref(); const queryParam = reactive({}); const orgCode = ref(''); const batchNo = ref(''); @@ -307,50 +219,13 @@ const izPush = ref(''); const userStore = useUserStore(); // ==================== 本地数据存储 ==================== -// 存储机构维度的数据列表 -const localDepartList = ref([]); // 存储区域维度的数据列表 const localNuList = ref([]); // 用于编辑时记录的临时ID let tempIdCounter = 1; -// ==================== 机构维度相关 ==================== -const departDrawer = reactive({ - title: '', - width: 800, - visible: false, - disableSubmit: false, - confirmLoading: false, - isUpdate: false, - disabled: false -}); - -const departFormData = reactive>({ - id: undefined, - orgCode: undefined, - batchNo: undefined, - deviceName: undefined, - deviceType: undefined, - deviceType_dictText: undefined, - deviceModel: undefined, - factory: undefined, - dimension: "机构维度", - purchaseQuantity: undefined -}); - const deviceTypeDicts = ref() -const departDeviceConfigs = ref([]); - -const departValidatorRules = { - deviceName: [{ required: true, message: '请选择设备!' }], - purchaseQuantity: [ - { required: true, message: '请输入采购数量!' }, - { type: 'number', min: 1, message: '采购数量必须大于0!' } - ], -}; - -const { resetFields: resetDepartFields, validate: validateDepart, validateInfos: departValidateInfos } = Form.useForm(departFormData, departValidatorRules, { immediate: false }); // ==================== 区域维度相关 ==================== const nuDrawer = reactive({ @@ -371,7 +246,6 @@ interface DeviceConfig { deviceType: string; deviceModel: string; factory: string; - dimension: string; } interface NuInfo { @@ -449,27 +323,8 @@ function handleSuccess() { function filterLocalData() { const allData = []; - // 过滤机构维度数据 - let filteredDepartList = [...localDepartList.value]; - if (queryParam.dimension && queryParam.dimension !== '') { - filteredDepartList = filteredDepartList.filter(item => item.dimension === queryParam.dimension); - } - if (queryParam.deviceType && queryParam.deviceType !== '') { - filteredDepartList = filteredDepartList.filter(item => item.deviceType === queryParam.deviceType); - } - if (queryParam.nuName && queryParam.nuName !== '') { - filteredDepartList = [] - } // 区域维度数据处理 let filteredNuList = [...localNuList.value]; - if (queryParam.dimension && queryParam.dimension !== '') { - filteredNuList = filteredNuList.filter(item => item.dimension === queryParam.dimension); - } - - // 添加机构维度数据 - for (const item of filteredDepartList) { - allData.push(item); - } // 添加区域维度数据(需要按条件过滤 configData 内的设备) for (const item of filteredNuList) { @@ -499,15 +354,6 @@ function filterLocalData() { function loadLocalDataToTable() { const allData = []; - // 机构维度 - for (const item of localDepartList.value) { - if (item.deviceType && !item.deviceType_dictText) { - const match = deviceTypeDicts.value?.find(d => d.value == item.deviceType); - item.deviceType_dictText = match ? match.label : item.deviceType; - } - allData.push(item); - } - // 区域维度 for (const item of localNuList.value) { if (item.configData && item.configData.length) { @@ -528,21 +374,10 @@ function loadLocalDataToTable() { // 删除本地数据 function handleDelete(record: Recordable) { - // 1. 机构维度:用 deviceName 作为唯一标识(业务上同一设备名不会重复) - if (record.dimension === '机构维度') { - const index = localDepartList.value.findIndex( - item => item.deviceName === record.deviceName - ); - if (index !== -1) { - localDepartList.value.splice(index, 1); - } - } - // 2. 区域维度:用 [nuName + deviceName] 作为唯一标识 - else if (record.dimension === '区域维度') { for (const nuRecord of localNuList.value) { // 先匹配区域名(nuName) if (nuRecord.nuName !== record.nuName) continue; - + if (nuRecord.configData) { // 再匹配设备名(deviceName) const configIndex = nuRecord.configData.findIndex( @@ -559,8 +394,6 @@ function handleDelete(record: Recordable) { } } } - } - // 同步更新表格 loadLocalDataToTable(); } @@ -570,12 +403,7 @@ function getTableAction(record) { { label: '编辑', onClick: () => { - if (record.dimension == '机构维度') { - openDepartDrawer(record); - } - if (record.dimension == '区域维度') { - openEditNuDrawer(record); // 改成调用新函数 - } + openEditNuDrawer(record); // 改成调用新函数 }, ifShow: izPush.value == 'N' }, @@ -591,18 +419,13 @@ function getTableAction(record) { } function handleEdit(record) { - if (record.dimension == '机构维度') { - openDepartDrawer(record); - } - if (record.dimension == '区域维度') { - openNuDrawer(record); - } + openNuDrawer(record); } function searchQuery() { // 1. 先缓存当前的查询条件(用于后续筛选本地数据) const currentQuery = { ...queryParam }; - + // 更新必要的参数 currentQuery.orgCode = orgCode.value; currentQuery.batchNo = batchNo.value; @@ -618,16 +441,15 @@ function searchQuery() { function searchReset() { // 1. 缓存当前状态(重置时查询条件为空) - const currentQuery = { - orgCode: orgCode.value, - batchNo: batchNo.value + const currentQuery = { + orgCode: orgCode.value, + batchNo: batchNo.value // 其他条件都是 undefined }; // 2. 重置表单 formRef.value.resetFields(); queryParam.nuName = undefined; - queryParam.dimension = undefined; queryParam.deviceType = undefined; // 3. 调用接口加载全部数据 @@ -645,53 +467,27 @@ function searchReset() { function mergeServerWithFilteredLocal(query: any) { const serverData = JSON.parse(JSON.stringify(getDataSource())); const idMap = new Map(); - + serverData.forEach(item => { if (item.id != null) idMap.set(item.id, true); }); let finalData = [...serverData]; - // ===== 机构维度:当有区域名称搜索时,跳过机构数据(已正确) ===== - if (!query.nuName) { - const filteredDepart = localDepartList.value.filter(item => { - const matchesDimension = !query.dimension || item.dimension === query.dimension; - const matchesDeviceType = !query.deviceType || item.deviceType === query.deviceType; - return matchesDimension && matchesDeviceType; - }); - - filteredDepart.forEach(item => { - if (item.id != null) { - if (!idMap.has(item.id)) { - finalData.push(item); - idMap.set(item.id, true); - } - } else { - const tempKey = `temp_${item.deviceName}_${item.dimension}`; - if (!idMap.has(tempKey)) { - finalData.push(item); - idMap.set(tempKey, true); - } - } - }); - } - // ===== 修复点:区域维度必须按名称过滤 ===== // 1. 先筛选出符合区域名称的区域 let filteredNuList = [...localNuList.value]; - + // 👇 新增:当存在区域名称查询时,过滤 localNuList if (query.nuName) { - filteredNuList = filteredNuList.filter(nuItem => + filteredNuList = filteredNuList.filter(nuItem => nuItem.nuName.toLowerCase().includes(query.nuName.toLowerCase()) ); } // 2. 再处理筛选后的区域数据 filteredNuList.forEach(nuItem => { - // 2.1 按维度过滤(保留原有逻辑) - if (query.dimension && nuItem.dimension !== query.dimension) return; - + // 2.2 筛选区域下的设备配置 const filteredConfigs = (nuItem.configData || []).filter(config => { const matchesDeviceType = !query.deviceType || config.deviceType === query.deviceType; @@ -724,7 +520,6 @@ function add(record) { izPush.value = record.izPush; // 清空本地数据 - localDepartList.value = []; localNuList.value = []; } @@ -737,7 +532,6 @@ async function edit(record) { queryParam.batchNo = record.batchNo; // 清空本地数据 - localDepartList.value = []; localNuList.value = []; cardQuantities.value.clear(); @@ -759,20 +553,11 @@ function separateDataFromTable() { if (!tableData || tableData.length === 0) return; // 清空现有数据 - localDepartList.value = []; localNuList.value = []; cardQuantities.value.clear(); - // 遍历表格数据,按 dimension 分离 + // 遍历表格数据 tableData.forEach(item => { - if (item.dimension === '机构维度') { - // 机构维度数据 - localDepartList.value.push({ - ...item, - dimension: '机构维度' - }); - } - else if (item.dimension === '区域维度') { // 区域维度数据:按 nuId 分组 let nuRecord = localNuList.value.find(nu => nu.nuId === item.nuId); if (!nuRecord) { @@ -780,7 +565,6 @@ function separateDataFromTable() { id: item.nuId, orgCode: item.orgCode, batchNo: item.batchNo, - dimension: '区域维度', nuId: item.nuId, nuName: item.nuName, configData: [] @@ -799,8 +583,7 @@ function separateDataFromTable() { deviceType_dictText: item.deviceType_dictText, // 加上这行 deviceModel: item.deviceModel, factory: item.factory, - purchaseQuantity: item.purchaseQuantity, - dimension: '区域维度' + purchaseQuantity: item.purchaseQuantity }); // 填充到 cardQuantities 用于回显 @@ -815,173 +598,10 @@ function separateDataFromTable() { } } } - } }); } -// ==================== 机构维度抽屉方法 ==================== -async function openDepartDrawer(record?: any) { - await getDepartDeviceConfig(); - - if (record && record.id) { - // 编辑模式 - departDrawer.title = '编辑机构维度'; - departDrawer.isUpdate = true; - departDrawer.disableSubmit = false; - - // 赋值表单数据 - Object.keys(departFormData).forEach((key) => { - if (record.hasOwnProperty(key)) { - departFormData[key] = record[key]; - } - }); - - // 如果 record 中有 deviceType_dictText 则直接使用 - // 否则根据 deviceType 值设置对应的文本 - if (!departFormData.deviceType_dictText && departFormData.deviceType) { - // 从设备配置或字典中查找文本 - const deviceConfig = departDeviceConfigs.value.find( - item => item.deviceType === departFormData.deviceType - ); - if (deviceConfig && deviceConfig.deviceTypeText) { - departFormData.deviceType_dictText = deviceConfig.deviceTypeText; - } else { - departFormData.deviceType_dictText = departFormData.deviceType; - } - } - } else { - // 新增模式 - departDrawer.title = '新增机构维度'; - departDrawer.isUpdate = false; - departDrawer.disableSubmit = false; - - departFormData.orgCode = orgCode.value; - departFormData.batchNo = batchNo.value; - departFormData.id = undefined; - departFormData.deviceName = undefined; - departFormData.deviceType = undefined; - departFormData.deviceType_dictText = undefined; - departFormData.deviceModel = undefined; - departFormData.factory = undefined; - departFormData.dimension = "机构维度"; - departFormData.purchaseQuantity = undefined; - } - - departDrawer.visible = true; -} - -function handleDepartDrawerCancel() { - departDrawer.visible = false; - resetDepartFields(); -} - -async function handleDepartDrawerOk() { - try { - await validateDepart(); - } catch ({ errorFields }) { - if (errorFields) { - const firstField = errorFields[0]; - if (firstField && departFormRef.value) { - departFormRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); - } - } - return Promise.reject(errorFields); - } - - departDrawer.confirmLoading = true; - - try { - let model = { ...departFormData }; - if (model.deviceType && !model.deviceType_dictText) { - const match = deviceTypeDicts.value?.find(d => d.value == model.deviceType); - model.deviceType_dictText = match ? match.label : model.deviceType; - } - for (let data in model) { - if (model[data] instanceof Array) { - let valueType = getValueType(departFormRef.value?.getProps, data); - if (valueType === 'string') { - model[data] = model[data].join(','); - } - } - } - - // 不再调用后端保存,改为保存到本地列表 - if (departDrawer.isUpdate || model.id) { - // 编辑:更新本地列表中的数据 - const index = localDepartList.value.findIndex(item => item.id === model.id); - if (index !== -1) { - localDepartList.value[index] = { ...model }; - } else { - // 如果有 id 但没找到,按新增处理 - model.id = `temp_depart_${tempIdCounter++}`; - localDepartList.value.push(model); - } - } else { - // 新增前检查是否存在同名设备(防止重复) - const existingIndex = localDepartList.value.findIndex( - item => item.deviceName === model.deviceName && item.dimension === "机构维度" - ); - if (existingIndex !== -1) { - // 存在则更新 - localDepartList.value[existingIndex] = { ...model, id: localDepartList.value[existingIndex].id }; - } else { - // 不存在则新增 - model.id = `temp_depart_${tempIdCounter++}`; - localDepartList.value.push(model); - } - } - - handleDepartDrawerCancel(); - loadLocalDataToTable(); - createMessage.success('操作成功'); - } catch (error) { - createMessage.error('保存失败'); - console.error(error); - } finally { - departDrawer.confirmLoading = false; - } -} - -async function getDepartDeviceConfig() { - let params = { 'dimension': '机构维度' }; - try { - departDeviceConfigs.value = await configList(params); - } catch (error) { - departDeviceConfigs.value = []; - } -} - -function handleDepartDeviceChange(value, option) { - let vo = departDeviceConfigs.value.filter(item => item.deviceName === value); - if (vo.length) { - departFormData.deviceType = vo[0]["deviceType"]; - departFormData.deviceModel = vo[0]["deviceModel"]; - departFormData.factory = vo[0]["factory"]; - } - - departFormData.deviceType_dictText = deviceTypeDicts.value.filter(item => item.value == departFormData.deviceType)[0]?.label || ''; - - // 检查该设备是否已在 localDepartList 中存在 - const existingItem = localDepartList.value.find( - item => item.deviceName === value && item.dimension === "机构维度" - ); - - if (existingItem) { - // 存在则回填采购数量 - departFormData.purchaseQuantity = existingItem.purchaseQuantity; - departFormData.id = existingItem.id; - departDrawer.isUpdate = true; - departDrawer.title = '编辑机构维度'; - } else { - // 不存在则清空 - departFormData.purchaseQuantity = undefined; - departFormData.id = undefined; - departDrawer.isUpdate = false; - departDrawer.title = '新增机构维度'; - } -} - // ==================== 区域维度抽屉方法 ==================== async function openNuDrawer(record?: any) { await getNuDeviceConfig(); @@ -1052,7 +672,6 @@ async function handleNuDrawerOk() { deviceName: device.deviceName, deviceType: device.deviceType, deviceType_dictText: deviceTypeDicts.value?.find(d => d.value == device.deviceType)?.label || device.deviceType, - dimension: '区域维度', deviceModel: device.deviceModel, factory: device.factory, purchaseQuantity: quantity @@ -1070,7 +689,6 @@ async function handleNuDrawerOk() { const existingIndex = localNuList.value.findIndex( item => item.orgCode === orgCode.value && item.batchNo === batchNo.value && - item.dimension === "区域维度" && item.nuId === nu.nuId ); @@ -1084,7 +702,6 @@ async function handleNuDrawerOk() { id: nu.nuId, orgCode: orgCode.value, batchNo: batchNo.value, - dimension: "区域维度", nuId: nu.nuId, nuName: nu.nuName, configData: nuConfigData, @@ -1098,7 +715,7 @@ async function handleNuDrawerOk() { const currentNuIds = nuInfos.value.map(n => n.nuId); for (let i = localNuList.value.length - 1; i >= 0; i--) { const item = localNuList.value[i]; - if (item.dimension === "区域维度" && item.orgCode === orgCode.value && item.batchNo === batchNo.value) { + if (item.orgCode === orgCode.value && item.batchNo === batchNo.value) { if (!currentNuIds.includes(item.nuId)) { localNuList.value.splice(i, 1); } @@ -1117,9 +734,8 @@ async function handleNuDrawerOk() { } async function getNuDeviceConfig() { - const params = { dimension: '区域维度' }; try { - nuDeviceConfigs.value = await configList(params); + nuDeviceConfigs.value = await configList({}); } catch (error) { nuDeviceConfigs.value = []; } @@ -1199,17 +815,6 @@ function handleCardClick(nuId: string, event: Event) { * @returns 返回所有需要保存的数据 */ async function submitForm() { - const departData = localDepartList.value.map(item => ({ - id: item.id && typeof item.id === 'string' && item.id.startsWith('temp_') ? undefined : item.id, - orgCode: item.orgCode, - batchNo: item.batchNo, - deviceName: item.deviceName, - deviceType: item.deviceType, - deviceModel: item.deviceModel, - factory: item.factory, - dimension: item.dimension, - purchaseQuantity: item.purchaseQuantity - })); const nuData: any[] = []; for (const nuRecord of localNuList.value) { @@ -1226,7 +831,6 @@ async function submitForm() { deviceType: config.deviceType, deviceModel: config.deviceModel, factory: config.factory, - dimension: "区域维度", purchaseQuantity: config.purchaseQuantity }); } @@ -1234,20 +838,11 @@ async function submitForm() { } const submitData = { - departList: departData, nuList: nuData, batchNo: batchNo.value, orgCode: orgCode.value }; - // 如果 departData 为空,添加一个只包含 orgCode 和 batchNo 的对象 - if (departData.length === 0) { - departData.push({ - orgCode: orgCode.value, - batchNo: batchNo.value - }); - } - // 如果 nuData 为空,添加一个只包含 orgCode 和 batchNo 的对象 if (nuData.length === 0) { nuData.push({ @@ -1256,9 +851,6 @@ async function submitForm() { }); } - //机构维度 - await previewBatchSave(submitData.departList) - //区域维度 await batchSave(submitData.nuList); @@ -1272,7 +864,6 @@ async function submitForm() { */ function getAllData() { return { - departList: [...localDepartList.value], nuList: [...localNuList.value] }; } @@ -1281,7 +872,6 @@ function getAllData() { * 清空所有本地数据 */ function clearAllData() { - localDepartList.value = []; localNuList.value = []; loadLocalDataToTable(); } @@ -1303,7 +893,6 @@ const editNuFormData = reactive({ deviceType: undefined, deviceModel: undefined, factory: undefined, - dimension: '区域维度', purchaseQuantity: undefined }); @@ -1334,7 +923,7 @@ async function handleEditNuDrawerOk() { editNuDrawer.confirmLoading = true; try { - if (editNuFormData.dimension === '区域维度') { + for (const nuRecord of localNuList.value) { if (nuRecord.configData && nuRecord.configData.length) { const configIndex = nuRecord.configData.findIndex( @@ -1361,7 +950,7 @@ async function handleEditNuDrawerOk() { } } } - } + loadLocalDataToTable(); handleEditNuDrawerCancel(); @@ -1385,7 +974,6 @@ function openEditNuDrawer(record) { editNuFormData.deviceType = record.deviceType; editNuFormData.deviceModel = record.deviceModel; editNuFormData.factory = record.factory; - editNuFormData.dimension = '区域维度'; editNuFormData.purchaseQuantity = record.purchaseQuantity; } @@ -1627,4 +1215,4 @@ defineExpose({ color: rgba(0, 0, 0, 0.88) !important; } } - \ No newline at end of file + diff --git a/src/views/device/manager/components/preview/preview.api.ts b/src/views/device/manager/components/preview/preview.api.ts index a7b3b95..d0daa3e 100644 --- a/src/views/device/manager/components/preview/preview.api.ts +++ b/src/views/device/manager/components/preview/preview.api.ts @@ -1,16 +1,10 @@ import { defHttp } from '/@/utils/http/axios'; enum Api { - departPreview = '/iot/device/manager/departPreview', nuPreview = '/iot/device/manager/nuPreview', configList = '/iot/device/config/queryList', nuList = '/iot/device/manager/nuList', - savePreview = '/iot/device/manager/savePreview', - updatePreview = '/iot/device/manager/updatePreview', - previewBatchSave = '/iot/device/manager/previewBatchSave', - deletePreview = '/iot/device/manager/deletePreview', batchSave = '/iot/device/manager/batchSave', - queryQuantityByOrgCode = '/iot/device/manager/queryQuantityByOrgCode', getNuListByOrgCode = '/iot/device/manager/getNuListByOrgCode', } @@ -18,18 +12,9 @@ enum Api { * 列表 * @param params */ -export const departPreview = (params) => defHttp.get({ url: Api.departPreview, params }); export const nuPreview = (params) => defHttp.get({ url: Api.nuPreview, params }); export const configList = (params) => defHttp.get({ url: Api.configList, params }); export const nuList = (params) => defHttp.get({ url: Api.nuList, params }); -/** - * 新增机构 - * @param id - */ -export const savePreview = (params, isUpdate) => { - let url = isUpdate ? Api.updatePreview : Api.savePreview; - return defHttp.post({ url: url, params }); -}; /** * 批量保存 @@ -40,20 +25,6 @@ export const batchSave = (params) => { return defHttp.post({ url: Api.batchSave, params }, { isTransformResponse: false }); }; -/** - * 删除 - * @param id - */ -export const deletePreview = (params) => defHttp.post({ url: Api.deletePreview, params }); - -export const queryQuantityByOrgCode = (params) => { - return defHttp.get({ url: Api.queryQuantityByOrgCode, params }); -}; - export const getNuListByOrgCode = (params) => { return defHttp.get({ url: Api.getNuListByOrgCode, params }); }; - -export const previewBatchSave = (params) => { - return defHttp.post({ url: Api.previewBatchSave, params }, { isTransformResponse: false }); -}; diff --git a/src/views/device/manager/components/preview/preview.data.ts b/src/views/device/manager/components/preview/preview.data.ts index dd3968a..0288567 100644 --- a/src/views/device/manager/components/preview/preview.data.ts +++ b/src/views/device/manager/components/preview/preview.data.ts @@ -37,12 +37,6 @@ export const departColumns: BasicColumn[] = [ dataIndex: 'factory', width: 150 }, - { - title: '设备维度', - align: "center", - dataIndex: 'dimension', - width: 80 - }, { title: '采购数量', align: "center", @@ -74,7 +68,6 @@ export const nuColumns: BasicColumn[] = [ return record.nuId; } }, - width: 120 }, { title: '区域名称', @@ -91,32 +84,22 @@ export const nuColumns: BasicColumn[] = [ { title: '设备类型', align: "center", - dataIndex: 'deviceType_dictText', - width: 150 + dataIndex: 'deviceType_dictText' }, { title: '设备型号', align: "center", - dataIndex: 'deviceModel', - width: 150 + dataIndex: 'deviceModel' }, { title: '生产厂家', align: "center", dataIndex: 'factory', - width: 150 - }, - { - title: '设备维度', - align: "center", - dataIndex: 'dimension', - width: 100 }, { title: '采购数量', align: "center", - dataIndex: 'purchaseQuantity', - width: 100 + dataIndex: 'purchaseQuantity' }, ];