Refactor data grid components
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
</Filters>
|
||||
<div id="data">
|
||||
<DxDataGrid
|
||||
ref="dataGridRef"
|
||||
:allow-column-reordering="true"
|
||||
class="max-h-[calc(100vh-140px)] mb-10"
|
||||
:show-column-lines="true"
|
||||
@ -152,13 +153,13 @@
|
||||
/>
|
||||
|
||||
<template #formatTime="{ data }">
|
||||
<p class="cursor-pointer !text-right" @click="showDetail()">
|
||||
<p class="cursor-pointer !text-right">
|
||||
{{ parseInt(data.text) ? formatWaktu(data.text) : '-' }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<template #formatNumber="{ data }">
|
||||
<p class="text-right cursor-pointer" @click="showDetail()">
|
||||
<p class="text-right cursor-pointer">
|
||||
{{
|
||||
isNumber(data.text)
|
||||
? data.column.caption == '%'
|
||||
@ -170,7 +171,7 @@
|
||||
</template>
|
||||
|
||||
<template #formatText="{ data }">
|
||||
<p class="cursor-pointer !text-left" @click="showDetail()">
|
||||
<p class="cursor-pointer !text-left">
|
||||
{{ data.text }}
|
||||
</p>
|
||||
</template>
|
||||
@ -181,47 +182,47 @@
|
||||
<div class="w-full p-4 space-y-2 bg-white rounded-xl">
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">No Laporan:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.no_laporan" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.no_laporan" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">Tgl Lapor:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.waktu_lapor" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.waktu_lapor" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">IDPEL/NOMETER:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.idpel_nometer" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.idpel_nometer" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">Nama Pelapor:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.nama_pelapor" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.nama_pelapor" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">Alamat Pelapor:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.alamat_pelapor" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.alamat_pelapor" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">Status:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.status_akhir" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.status_akhir" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">UI Dist:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.nama_uid" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.nama_uid" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">UP3:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.nama_up3" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.nama_up3" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-sm font-medium w-[170px] text-gray-800">Posko/ULP:</h3>
|
||||
<InputText :readonly="true" :value="dataDetail?.nama_ulp" class-name="flex-1" />
|
||||
<InputText :readonly="true" :value="dataSelected?.nama_ulp" class-name="flex-1" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
@ -257,7 +258,7 @@ const showIndicator = ref(true)
|
||||
const shading = ref(true)
|
||||
const showPane = ref(true)
|
||||
const data = ref<any[]>([])
|
||||
const dataDetail = ref<any>()
|
||||
const dataSelected = ref<any>()
|
||||
const dialogDetail = ref(false)
|
||||
const filters = ref({
|
||||
type: '',
|
||||
@ -270,13 +271,21 @@ const closeDialog = () => {
|
||||
dialogDetail.value = false
|
||||
}
|
||||
|
||||
const dataGridRef = ref<DxDataGrid | null>(null)
|
||||
const clearSelection = () => {
|
||||
const dataGrid = dataGridRef.value!.instance!
|
||||
dataGrid.clearSelection()
|
||||
}
|
||||
const showDetail = () => {
|
||||
clearSelection()
|
||||
dialogDetail.value = true
|
||||
}
|
||||
|
||||
const onSelectionChanged = ({ selectedRowsData }: any) => {
|
||||
dataDetail.value = selectedRowsData[0]
|
||||
console.log(selectedRowsData[0])
|
||||
if (selectedRowsData[0] != undefined) {
|
||||
dataSelected.value = selectedRowsData[0]
|
||||
}
|
||||
showDetail()
|
||||
}
|
||||
|
||||
const { onResult, onError, loading, refetch } = useQuery(
|
||||
|
Reference in New Issue
Block a user