feat: 实时事件栏调用原系统框

This commit is contained in:
huanghao1412 2024-07-16 17:12:13 +08:00
parent bf138937dd
commit 206aaf7a3d
2 changed files with 87 additions and 59 deletions

View File

@ -38,8 +38,8 @@
<img src="@/assets/images/exception/nodata.svg" style="width: 100%;height: 50%" alt=""> <img src="@/assets/images/exception/nodata.svg" style="width: 100%;height: 50%" alt="">
<div style="color: #fff;text-align: center">查询结果为空</div> <div style="color: #fff;text-align: center">查询结果为空</div>
</div> </div>
<VModal v-model:show="modalObj.show" :data="modalObj.data" :select1Options="select1.options"/> <!-- <VModal v-model:show="modalObj.show" :data="modalObj.data" :select1Options="select1.options"/>-->
<VModalV1 v-model:show="modalV1Obj.show" :data="modalV1Obj.data" @confirm="confirm"/> <!-- <VModalV1 v-model:show="modalV1Obj.show" :data="modalV1Obj.data" @confirm="confirm"/>-->
</BorderBox> </BorderBox>
</template> </template>
@ -328,17 +328,23 @@ const getData = () => {
}) })
} }
const modalObj = reactive({ // const modalObj = reactive({
show: false, // show: false,
data: {} // data: {}
}) // })
const clickItem = (i:number) => { const clickItem = (i:number) => {
const obj = tableData[i] postMessageToParent({
modalObj.show = true type: 'openRealTimeEventDetail',
Object.assign(modalObj, { currentAlarm: tableData[i],
show: true,
data: obj
}) })
//
// const obj = tableData[i]
// modalObj.show = true
// Object.assign(modalObj, {
// show: true,
// data: obj
// })
} }
const originStore = useOriginStore() const originStore = useOriginStore()
@ -377,65 +383,86 @@ watch(() => select1.value.join('&&') + select2.value.join('&&'), (v) => {
getData() getData()
}) })
const modalV1Obj = reactive({ // const modalV1Obj = reactive({
show: false, // show: false,
data: { // data: {
// confirm_people_id: user.id, // // confirm_people_id: user.id,
confirm_people: user.name, // confirm_people: user.name,
is_misreport: false, // is_misreport: false,
remark: '', // remark: '',
reconfirmation_time_str: null, // reconfirmation_time_str: null,
}, // },
// batch single // // batch single
type: 'batch', // type: 'batch',
singleIds: [], // singleIds: [],
}) // })
const clickBatch = () => { const clickBatch = () => {
if(!tableData.filter(_ => _.checked).length) { if(!tableData.filter(_ => _.checked).length) {
window['$message'].warning('请先选择数据') window['$message'].warning('请先选择数据')
return return
} }
Object.assign(modalV1Obj, { let selectIds = tableData.filter(_ => _.checked && _.confirm_status !== 'ok').map(_ => _.id)
show: true, if(!selectIds.length) return
data: { postMessageToParent({
// confirm_people_id: user.id, type: 'openRealTimeEventDialog',
confirm_people: user.name, multipleConfirm: true,
is_misreport: false, selectIds,
remark: '',
reconfirmation_time_str: null,
},
type: 'batch',
singleIds: []
})
}
const clickSingle = (id: number) => {
Object.assign(modalV1Obj, {
show: true,
data: {
// confirm_people_id: user.id,
confirm_people: user.name,
is_misreport: false,
remark: '',
reconfirmation_time_str: null,
},
type: 'single',
singleIds: [id]
}) })
// Object.assign(modalV1Obj, {
// show: true,
// data: {
// // confirm_people_id: user.id,
// confirm_people: user.name,
// is_misreport: false,
// remark: '',
// reconfirmation_time_str: null,
// },
// type: 'batch',
// singleIds: []
// })
} }
const confirm = () => { getMessageByParent('', (e) => {
const obj = { if(e.data.type === 'openRealTimeEventDialog_confirmed' && e.data.page === 'customLargeScreen') {
id: null, console.log('openRealTimeEventDialog_confirmed')
ids: modalV1Obj.type === 'batch' ? tableData.filter(_ => _.checked).map(_ => _.id) : modalV1Obj.singleIds,
confirm_status: "ok",
...modalV1Obj.data
}
publicInterface('/dcim/dems/devie_active_alarm', 'confirms', obj).then(res => {
window['$message'].success('操作成功')
checkAll.value = false
getData() getData()
})
} }
})
const clickSingle = (id: number) => {
postMessageToParent({
type: 'openRealTimeEventDialog',
multipleConfirm: false,
selectIds: [id],
})
//
// Object.assign(modalV1Obj, {
// show: true,
// data: {
// // confirm_people_id: user.id,
// confirm_people: user.name,
// is_misreport: false,
// remark: '',
// reconfirmation_time_str: null,
// },
// type: 'single',
// singleIds: [id]
// })
}
// const confirm = () => {
// const obj = {
// id: null,
// ids: modalV1Obj.type === 'batch' ? tableData.filter(_ => _.checked).map(_ => _.id) : modalV1Obj.singleIds,
// confirm_status: "ok",
// ...modalV1Obj.data
// }
// publicInterface('/dcim/dems/devie_active_alarm', 'confirms', obj).then(res => {
// window['$message'].success('')
// checkAll.value = false
// getData()
// })
// }
const jumpTo = (row:any) => { const jumpTo = (row:any) => {
if (row.space && row.space.space_type !== 'device') { if (row.space && row.space.space_type !== 'device') {

View File

@ -271,6 +271,7 @@ const calcRowsData = () => {
if(statusIndex <= item.ceils.length) { if(statusIndex <= item.ceils.length) {
let v = item.ceils[statusIndex] let v = item.ceils[statusIndex]
let obj = statusOption.find((_: any) => _.value === v.toString()) || {label: ''} let obj = statusOption.find((_: any) => _.value === v.toString()) || {label: ''}
console.log(obj)
if(obj.remark) { if(obj.remark) {
item.ceils[statusIndex] = `<span style="background: ${colorToRgba(obj.remark)};color: ${obj.remark};border: 1px solid ${obj.remark};border-radius: 4px;padding: 2px 8px;font-size: 12px;">${obj.label}</span>` item.ceils[statusIndex] = `<span style="background: ${colorToRgba(obj.remark)};color: ${obj.remark};border: 1px solid ${obj.remark};border-radius: 4px;padding: 2px 8px;font-size: 12px;">${obj.label}</span>`
} }