|
@ -28,6 +28,7 @@ |
|
|
<a-select |
|
|
<a-select |
|
|
placeholder="请选择" |
|
|
placeholder="请选择" |
|
|
style="width: 200px" |
|
|
style="width: 200px" |
|
|
|
|
|
v-model:value="linkOrgId" |
|
|
:options="linkList" |
|
|
:options="linkList" |
|
|
:field-names="{ label: 'orgName', value: 'orgId' }" |
|
|
:field-names="{ label: 'orgName', value: 'orgId' }" |
|
|
@change="handleChange" /> |
|
|
@change="handleChange" /> |
|
@ -44,33 +45,46 @@ |
|
|
import { http } from '/nerv-lib/util'; |
|
|
import { http } from '/nerv-lib/util'; |
|
|
import { group, device } from '/@/api/deviceManage'; |
|
|
import { group, device } from '/@/api/deviceManage'; |
|
|
const orgId = ref(''); |
|
|
const orgId = ref(''); |
|
|
|
|
|
|
|
|
const key = ref(Date.now()); |
|
|
const key = ref(Date.now()); |
|
|
|
|
|
|
|
|
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|
|
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|
|
orgId.value = result; |
|
|
orgId.value = result; |
|
|
|
|
|
|
|
|
|
|
|
const linkOrgId = ref(''); |
|
|
|
|
|
|
|
|
// const selectOrgId = ref(orgId.value); |
|
|
// const selectOrgId = ref(orgId.value); |
|
|
|
|
|
const props = defineProps({ params: Object }); |
|
|
|
|
|
|
|
|
const linkList = JSON.parse(sessionStorage.getItem('LINKLIST')!); |
|
|
const linkList = JSON.parse(sessionStorage.getItem('LINKLIST')!); |
|
|
let config = editCarbonEquipmentConfig(orgId.value); |
|
|
linkOrgId.value = linkList[0].orgId; |
|
|
|
|
|
let config = editCarbonEquipmentConfig(orgId.value, props); |
|
|
const visible = ref(false); |
|
|
const visible = ref(false); |
|
|
const carbonEquipment = ref(); |
|
|
const carbonEquipment = ref(); |
|
|
// defineOptions({ |
|
|
// defineOptions({ |
|
|
// name: 'LedgerIndex', // 与页面路由name一致缓存才可生效 |
|
|
// name: 'LedgerIndex', // 与页面路由name一致缓存才可生效 |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
const changeEnergyType = (val) => { |
|
|
|
|
|
props.params.energyType = val; |
|
|
|
|
|
config = editCarbonEquipmentConfig(linkOrgId.value, props); |
|
|
|
|
|
key.value = Date.now(); |
|
|
|
|
|
}; |
|
|
const handleChange = (value: string) => { |
|
|
const handleChange = (value: string) => { |
|
|
// selectOrgId.value = value; |
|
|
// selectOrgId.value = value; |
|
|
config = editCarbonEquipmentConfig(value); |
|
|
config = editCarbonEquipmentConfig(value, props); |
|
|
debugger; |
|
|
|
|
|
key.value = Date.now(); |
|
|
key.value = Date.now(); |
|
|
// carbonEquipment.value?.nsTableRef.reload(); |
|
|
// carbonEquipment.value?.nsTableRef.reload(); |
|
|
// carbonEquipment.value?.nsTableRef.treeReload(); |
|
|
// carbonEquipment.value?.nsTableRef.treeReload(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const props = defineProps({ params: Object }); |
|
|
|
|
|
const emit = defineEmits(['sure']); |
|
|
const emit = defineEmits(['sure']); |
|
|
const toggle = () => { |
|
|
const toggle = (val) => { |
|
|
|
|
|
if (val) { |
|
|
|
|
|
config = editCarbonEquipmentConfig(linkOrgId.value, props); |
|
|
|
|
|
key.value = Date.now(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
visible.value = !visible.value; |
|
|
visible.value = !visible.value; |
|
|
// clearData(); |
|
|
// clearData(); |
|
|
// visible.value && getData(currentId.value); |
|
|
// visible.value && getData(currentId.value); |
|
@ -93,14 +107,35 @@ |
|
|
deviceInfoCode: selectedRowKeys[i], |
|
|
deviceInfoCode: selectedRowKeys[i], |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
http.post(group.addCarbonDevice, params).then(() => { |
|
|
if (props.params.energyType && props.params.energyType == 'CARBON_EMISSIONS') { |
|
|
emit('sure'); |
|
|
http.post(group.addCarbonDevice, params).then(() => { |
|
|
NsMessage.success('操作成功'); |
|
|
emit('sure'); |
|
|
toggle(); |
|
|
NsMessage.success('操作成功'); |
|
|
}); |
|
|
toggle(null); |
|
|
|
|
|
}); |
|
|
|
|
|
} else if (props.params.energyType && props.params.energyType != 'CARBON_EMISSIONS') { |
|
|
|
|
|
// if (!currentId.value) { |
|
|
|
|
|
// NsMessage.warn('请先选择公司'); |
|
|
|
|
|
// return; |
|
|
|
|
|
// } |
|
|
|
|
|
http |
|
|
|
|
|
.post(group.saveComputeList, { |
|
|
|
|
|
energyType: props.params.energyType, |
|
|
|
|
|
orgId: props.params?.orgId, |
|
|
|
|
|
hxDeviceGroupId: props.params?.hxDeviceGroupId, |
|
|
|
|
|
saveOrgId: linkOrgId.value, |
|
|
|
|
|
saveDeviceInfoCodes: selectedRowKeys, |
|
|
|
|
|
}) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
emit('sure'); |
|
|
|
|
|
NsMessage.success('操作成功'); |
|
|
|
|
|
toggle(null); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
defineExpose({ |
|
|
defineExpose({ |
|
|
toggle, |
|
|
toggle, |
|
|
|
|
|
changeEnergyType, |
|
|
}); |
|
|
}); |
|
|
</script> |
|
|
</script> |
|
|
<style lang="less" scoped> |
|
|
<style lang="less" scoped> |
|
|