fks-yangshouda
4 months ago
6 changed files with 708 additions and 13 deletions
@ -0,0 +1,123 @@ |
|||
<template> |
|||
<a-modal |
|||
v-model:visible="visible" |
|||
width="60%" |
|||
class="custom-class" |
|||
title="添加设备" |
|||
destroyOnClose |
|||
@ok="btnClick" |
|||
:cancel="() => (visible = false)" |
|||
placement="right"> |
|||
<template #header> |
|||
<div class="custom-header"> |
|||
<!-- 这里可以放置任何你想要的内容或组件 --> |
|||
<h2>自定义标题</h2> |
|||
</div> |
|||
</template> |
|||
<!-- <template #header> |
|||
<div class="modal-header"> |
|||
<span>Modal Title</span> |
|||
<a-select placeholder="Select an option" style="width: 150px"> |
|||
<a-select-option value="option1">Option 1</a-select-option> |
|||
<a-select-option value="option2">Option 2</a-select-option> |
|||
<a-select-option value="option3">Option 3</a-select-option> |
|||
</a-select> |
|||
</div> |
|||
</template> --> |
|||
<div class="custom-select-wrapper"> |
|||
<a-select |
|||
placeholder="请选择" |
|||
style="width: 200px" |
|||
:options="linkList" |
|||
:field-names="{ label: 'orgName', value: 'orgId' }" |
|||
@change="handleChange" /> |
|||
</div> |
|||
<div class="drawerContainer"> |
|||
<ns-view-list-table v-bind="config" ref="carbonEquipment" style="height: 500px" :key="key" /> |
|||
</div> |
|||
</a-modal> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { editCarbonEquipmentConfig } from './config'; |
|||
import { computed, nextTick, ref } from 'vue'; |
|||
import { NsMessage } from '/nerv-lib/saas'; |
|||
import { http } from '/nerv-lib/util'; |
|||
import { group, device } from '/@/api/deviceManage'; |
|||
const orgId = ref(''); |
|||
const key = ref(Date.now()); |
|||
|
|||
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|||
orgId.value = result; |
|||
|
|||
// const selectOrgId = ref(orgId.value); |
|||
|
|||
const linkList = JSON.parse(sessionStorage.getItem('LINKLIST')!); |
|||
let config = editCarbonEquipmentConfig(orgId.value); |
|||
const visible = ref(false); |
|||
const carbonEquipment = ref(); |
|||
// defineOptions({ |
|||
// name: 'LedgerIndex', // 与页面路由name一致缓存才可生效 |
|||
// }); |
|||
|
|||
const handleChange = (value: string) => { |
|||
// selectOrgId.value = value; |
|||
config = editCarbonEquipmentConfig(value); |
|||
debugger; |
|||
key.value = Date.now(); |
|||
// carbonEquipment.value?.nsTableRef.reload(); |
|||
// carbonEquipment.value?.nsTableRef.treeReload(); |
|||
}; |
|||
|
|||
const props = defineProps({ params: Object }); |
|||
const emit = defineEmits(['sure']); |
|||
const toggle = () => { |
|||
visible.value = !visible.value; |
|||
// clearData(); |
|||
// visible.value && getData(currentId.value); |
|||
}; |
|||
const btnClick = () => { |
|||
let selectedRowKeys = carbonEquipment.value?.nsTableRef.tableState.selectedRowKeys; |
|||
if (!selectedRowKeys || selectedRowKeys.lenght == 0) { |
|||
NsMessage.warn('请选择设备'); |
|||
return; |
|||
} |
|||
if (!props.params?.hxDeviceGroupId) { |
|||
NsMessage.warn('请选择分组'); |
|||
return; |
|||
} |
|||
let params = []; |
|||
for (let i = 0; i < selectedRowKeys.length; i++) { |
|||
params.push({ |
|||
orgId: props.params?.orgId, |
|||
groupId: props.params?.hxDeviceGroupId, |
|||
deviceInfoCode: selectedRowKeys[i], |
|||
}); |
|||
} |
|||
http.post(group.addCarbonDevice, params).then(() => { |
|||
emit('sure'); |
|||
NsMessage.success('操作成功'); |
|||
toggle(); |
|||
}); |
|||
}; |
|||
defineExpose({ |
|||
toggle, |
|||
}); |
|||
</script> |
|||
<style lang="less" scoped> |
|||
:deep(.ns-table-search), |
|||
:deep(.ns-part-tree), |
|||
:deep(.ns-table-main) { |
|||
box-shadow: @ns-content-box-shadow; |
|||
} |
|||
.drawerContainer { |
|||
height: 100%; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
} |
|||
.custom-select-wrapper { |
|||
position: absolute; |
|||
top: 10px; /* Adjust based on your modal's positioning */ |
|||
right: 50px; /* Adjust based on your modal's positioning */ |
|||
// z-index: 1050; /* Ensure it's above the modal's backdrop */ |
|||
} |
|||
</style> |
@ -0,0 +1,77 @@ |
|||
<template> |
|||
<a-modal |
|||
v-model:visible="visible" |
|||
width="60%" |
|||
class="custom-class" |
|||
title="关联因子值" |
|||
destroyOnClose |
|||
@ok="btnClick" |
|||
:cancel="() => (visible = false)" |
|||
placement="right"> |
|||
<div class="drawerContainer"> |
|||
<ns-view-list-table v-bind="config" ref="setFactorRef" style="height: 500px" /> |
|||
</div> |
|||
</a-modal> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { setFactorConfig } from './config'; |
|||
import { computed, nextTick, ref } from 'vue'; |
|||
import { NsMessage } from '/nerv-lib/saas'; |
|||
import { http } from '/nerv-lib/util'; |
|||
import { group, device } from '/@/api/deviceManage'; |
|||
const orgId = ref(''); |
|||
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|||
orgId.value = result; |
|||
const config = setFactorConfig(orgId.value); |
|||
const visible = ref(false); |
|||
const setFactorRef = ref(); |
|||
const ids = ref(); |
|||
// defineOptions({ |
|||
// name: 'LedgerIndex', // 与页面路由name一致缓存才可生效 |
|||
// }); |
|||
|
|||
const props = defineProps({ params: Object }); |
|||
const emit = defineEmits(['sure']); |
|||
const toggle = (idlist) => { |
|||
ids.value = idlist; |
|||
visible.value = !visible.value; |
|||
// clearData(); |
|||
// visible.value && getData(currentId.value); |
|||
}; |
|||
const btnClick = () => { |
|||
let selectedRowKeys = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys; |
|||
if (!selectedRowKeys) { |
|||
NsMessage.warn('请选择因子'); |
|||
return; |
|||
} |
|||
if (!ids.value) { |
|||
NsMessage.warn('请选择分组'); |
|||
return; |
|||
} |
|||
http |
|||
.post(group.updateCarbonFactor, { |
|||
deviceInfoCodeList: ids.value, |
|||
factorId: selectedRowKeys[0], |
|||
}) |
|||
.then(() => { |
|||
emit('sure'); |
|||
NsMessage.success('操作成功'); |
|||
toggle([]); |
|||
}); |
|||
}; |
|||
defineExpose({ |
|||
toggle, |
|||
}); |
|||
</script> |
|||
<style lang="less" scoped> |
|||
:deep(.ns-table-search), |
|||
:deep(.ns-part-tree), |
|||
:deep(.ns-table-main) { |
|||
box-shadow: @ns-content-box-shadow; |
|||
} |
|||
.drawerContainer { |
|||
height: 100%; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
} |
|||
</style> |
Loading…
Reference in new issue