Refactor RGangguan_ALL.vue and api.graphql.ts
This commit is contained in:
		| @@ -28,15 +28,6 @@ | |||||||
|     > |     > | ||||||
|       <DxGrouping :auto-expand-all="false" :context-menu-enabled="true" /> |       <DxGrouping :auto-expand-all="false" :context-menu-enabled="true" /> | ||||||
|       <DxSelection mode="single" /> |       <DxSelection mode="single" /> | ||||||
|       <!-- <DxPaging :page-size="40" :enabled="true" /> |  | ||||||
|       <DxPager |  | ||||||
|         :visible="true" |  | ||||||
|         :allowed-page-sizes="[20, 40, 60]" |  | ||||||
|         display-mode="full" |  | ||||||
|         :show-page-size-selector="true" |  | ||||||
|         :show-info="true" |  | ||||||
|         :show-navigation-buttons="true" |  | ||||||
|       /> --> |  | ||||||
|       <DxLoadPanel |       <DxLoadPanel | ||||||
|         shading-color="rgba(0,0,0,0.4)" |         shading-color="rgba(0,0,0,0.4)" | ||||||
|         :position="position" |         :position="position" | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ | |||||||
|   </Filters> |   </Filters> | ||||||
|   <div> |   <div> | ||||||
|     <DxDataGrid |     <DxDataGrid | ||||||
|  |       @cell-click="onCellClicked" | ||||||
|       ref="dataGridRef" |       ref="dataGridRef" | ||||||
|       :allow-column-reordering="true" |       :allow-column-reordering="true" | ||||||
|       class="max-h-[calc(100vh-140px)] mb-10" |       class="max-h-[calc(100vh-140px)] mb-10" | ||||||
| @@ -23,10 +24,8 @@ | |||||||
|       :allow-column-resizing="true" |       :allow-column-resizing="true" | ||||||
|       column-resizing-mode="widget" |       column-resizing-mode="widget" | ||||||
|     > |     > | ||||||
|       <DxGrouping :auto-expand-all="false" :context-menu-enabled="true" expand-mode="rowClick" /> |       <DxGrouping :auto-expand-all="false" :context-menu-enabled="true" /> | ||||||
|       <DxSelection mode="single" /> |       <DxSelection mode="single" /> | ||||||
|       <DxPaging :enabled="false" /> |  | ||||||
|       <DxScrolling column-rendering-mode="virtual" mode="virtual" /> |  | ||||||
|       <DxLoadPanel |       <DxLoadPanel | ||||||
|         shading-color="rgba(0,0,0,0.4)" |         shading-color="rgba(0,0,0,0.4)" | ||||||
|         :position="position" |         :position="position" | ||||||
| @@ -42,7 +41,6 @@ | |||||||
|         :formats="['pdf', 'xlsx', 'document']" |         :formats="['pdf', 'xlsx', 'document']" | ||||||
|         :allow-export-selected-data="false" |         :allow-export-selected-data="false" | ||||||
|       /> |       /> | ||||||
|       <!-- <DxColumnFixing :enabled="true" /> --> |  | ||||||
|  |  | ||||||
|       <DxColumn |       <DxColumn | ||||||
|         alignment="center" |         alignment="center" | ||||||
| @@ -493,7 +491,7 @@ | |||||||
|           <DxColumn |           <DxColumn | ||||||
|             :width="150" |             :width="150" | ||||||
|             alignment="center" |             alignment="center" | ||||||
|             data-field="" |             data-field="dalam_proses_bidang" | ||||||
|             caption="Dalam Proses Bidang" |             caption="Dalam Proses Bidang" | ||||||
|             :allow-resizing="false" |             :allow-resizing="false" | ||||||
|             css-class="custom-table-column" |             css-class="custom-table-column" | ||||||
| @@ -502,7 +500,7 @@ | |||||||
|           <DxColumn |           <DxColumn | ||||||
|             :width="150" |             :width="150" | ||||||
|             alignment="center" |             alignment="center" | ||||||
|             data-field="" |             data-field="selesai_bidang_unit" | ||||||
|             caption="Selesai Bidang Unit" |             caption="Selesai Bidang Unit" | ||||||
|             :allow-resizing="false" |             :allow-resizing="false" | ||||||
|             css-class="custom-table-column" |             css-class="custom-table-column" | ||||||
| @@ -529,7 +527,7 @@ | |||||||
|           <DxColumn |           <DxColumn | ||||||
|             :width="150" |             :width="150" | ||||||
|             alignment="center" |             alignment="center" | ||||||
|             data-field="" |             data-field="status_akhir" | ||||||
|             caption="Status" |             caption="Status" | ||||||
|             :allow-resizing="false" |             :allow-resizing="false" | ||||||
|             css-class="custom-table-column" |             css-class="custom-table-column" | ||||||
| @@ -583,7 +581,7 @@ | |||||||
|           <DxColumn |           <DxColumn | ||||||
|             :width="150" |             :width="150" | ||||||
|             alignment="center" |             alignment="center" | ||||||
|             data-field="" |             data-field="nama_ulp" | ||||||
|             caption="Rayon" |             caption="Rayon" | ||||||
|             :allow-resizing="false" |             :allow-resizing="false" | ||||||
|             css-class="custom-table-column" |             css-class="custom-table-column" | ||||||
| @@ -592,7 +590,7 @@ | |||||||
|           <DxColumn |           <DxColumn | ||||||
|             :width="150" |             :width="150" | ||||||
|             alignment="center" |             alignment="center" | ||||||
|             data-field="" |             data-field="uraian" | ||||||
|             caption="Uraian" |             caption="Uraian" | ||||||
|             :allow-resizing="false" |             :allow-resizing="false" | ||||||
|             css-class="custom-table-column" |             css-class="custom-table-column" | ||||||
| @@ -601,7 +599,7 @@ | |||||||
|           <DxColumn |           <DxColumn | ||||||
|             :width="150" |             :width="150" | ||||||
|             alignment="center" |             alignment="center" | ||||||
|             data-field="" |             data-field="respon_pelanggan" | ||||||
|             caption="Respon Pelanggan" |             caption="Respon Pelanggan" | ||||||
|             :allow-resizing="false" |             :allow-resizing="false" | ||||||
|             css-class="custom-table-column" |             css-class="custom-table-column" | ||||||
| @@ -621,7 +619,7 @@ | |||||||
|           </template> |           </template> | ||||||
|  |  | ||||||
|           <template #formatTime="{ data }"> |           <template #formatTime="{ data }"> | ||||||
|             <p> |             <p class="text-right cursor-pointer"> | ||||||
|               {{ parseInt(data.text) ? formatWaktu(data.text) : '-' }} |               {{ parseInt(data.text) ? formatWaktu(data.text) : '-' }} | ||||||
|             </p> |             </p> | ||||||
|           </template> |           </template> | ||||||
| @@ -730,7 +728,7 @@ | |||||||
|  |  | ||||||
|         <div class="flex flex-row items-center justify-between w-full"> |         <div class="flex flex-row items-center justify-between w-full"> | ||||||
|           <h3 class="text-sm font-medium w-[135px] text-gray-800">Rayon:</h3> |           <h3 class="text-sm font-medium w-[135px] text-gray-800">Rayon:</h3> | ||||||
|           <InputText :readonly="true" :value="dataSubSelected?.rayon" class-name="flex-1" /> |           <InputText :readonly="true" :value="dataSubSelected?.nama_ulp" class-name="flex-1" /> | ||||||
|         </div> |         </div> | ||||||
|  |  | ||||||
|         <div class="flex flex-row items-center justify-between w-full"> |         <div class="flex flex-row items-center justify-between w-full"> | ||||||
| @@ -748,7 +746,7 @@ | |||||||
|           <InputText |           <InputText | ||||||
|             :readonly="true" |             :readonly="true" | ||||||
|             type="textarea" |             type="textarea" | ||||||
|             :value="dataSubSelected?.response_pelanggan" |             :value="dataSubSelected?.respon_pelanggan" | ||||||
|             class-name="flex-1" |             class-name="flex-1" | ||||||
|           /> |           /> | ||||||
|         </div> |         </div> | ||||||
| @@ -804,8 +802,77 @@ const dialogDetail = ref(false) | |||||||
| const closedialogDetail = () => (dialogDetail.value = false) | const closedialogDetail = () => (dialogDetail.value = false) | ||||||
| const loadingData = ref(false) | const loadingData = ref(false) | ||||||
| const loadingSubData = ref(false) | const loadingSubData = ref(false) | ||||||
|  | const agreeToShowDialog = ref(false) | ||||||
|  | const progressSelected = ref(0) | ||||||
|  | const groupIndex = ref(0) | ||||||
|  | const groupDialog = ref(false) | ||||||
|  | const groupData = ref<any>(null) | ||||||
|  |  | ||||||
|  | const onCellClicked = (e: any) => { | ||||||
|  |   console.log('cell clicked', e) | ||||||
|  |   //   console.log('group cell clicked', e.column.caption) | ||||||
|  |   //   console.log('value', e.values[e.row.groupIndex]) | ||||||
|  |   if (e.rowType == 'group') { | ||||||
|  |     groupDialog.value = true | ||||||
|  |     groupIndex.value = e.row.groupIndex | ||||||
|  |     setAgreementDialog(e.column.caption) | ||||||
|  |     if (e.row.groupIndex == 0) { | ||||||
|  |       // | ||||||
|  |     } else if (e.row.groupIndex == 1) { | ||||||
|  |       if (e.row.isExpanded) { | ||||||
|  |         const data = e.data.items[0].collapsedItems[0].items[0] | ||||||
|  |         groupData.value = data | ||||||
|  |       } else { | ||||||
|  |         const data = e.data.collapsedItems[0].items[0].items[0] | ||||||
|  |         groupData.value = data | ||||||
|  |       } | ||||||
|  |     } else if (e.row.groupIndex == 2) { | ||||||
|  |       if (e.row.isExpanded) { | ||||||
|  |         const data = e.data.items[0].collapsedItems[0] | ||||||
|  |         groupData.value = data | ||||||
|  |       } else { | ||||||
|  |         const data = e.data.collapsedItems[0].items[0] | ||||||
|  |         groupData.value = data | ||||||
|  |       } | ||||||
|  |     } else if (e.row.groupIndex == 3) { | ||||||
|  |       if (e.row.isExpanded) { | ||||||
|  |         const data = e.data.items[0] | ||||||
|  |         groupData.value = data | ||||||
|  |       } else { | ||||||
|  |         const data = e.data.collapsedItems[0] | ||||||
|  |         groupData.value = data | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     showDetail() | ||||||
|  |   } else { | ||||||
|  |     groupDialog.value = false | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const setAgreementDialog = (column: string) => { | ||||||
|  |   if (column == 'Total' || column == 'Selesai' || column == 'In Progress') { | ||||||
|  |     agreeToShowDialog.value = true | ||||||
|  |     if (column == 'Total') { | ||||||
|  |       progressSelected.value = 0 | ||||||
|  |     } else if (column == 'Selesai') { | ||||||
|  |       progressSelected.value = 1 | ||||||
|  |     } else { | ||||||
|  |       progressSelected.value = 2 | ||||||
|  |     } | ||||||
|  |   } else { | ||||||
|  |     agreeToShowDialog.value = false | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const resetData = () => { | ||||||
|  |   data.value = [] | ||||||
|  |   dataSub.value = [] | ||||||
|  |   dataSelected.value = null | ||||||
|  |   dataSubSelected.value = null | ||||||
|  | } | ||||||
|  |  | ||||||
| const filterData = async (params: any) => { | const filterData = async (params: any) => { | ||||||
|  |   resetData() | ||||||
|   const { ulp, uid, up3 } = params |   const { ulp, uid, up3 } = params | ||||||
|   const dateValue = params.periode.split(' s/d ') |   const dateValue = params.periode.split(' s/d ') | ||||||
|  |  | ||||||
| @@ -842,7 +909,51 @@ const getDetail = async () => { | |||||||
|   const dateValue = filters.value.periode.split(' s/d ') |   const dateValue = filters.value.periode.split(' s/d ') | ||||||
|   const selected = dataSelected.value |   const selected = dataSelected.value | ||||||
|  |  | ||||||
|   const query = { |   var query = { | ||||||
|  |     dateFrom: dateValue[0] | ||||||
|  |       ? dateValue[0].split('-').reverse().join('-') | ||||||
|  |       : new Date().toISOString().slice(0, 10), | ||||||
|  |     dateTo: dateValue[1] | ||||||
|  |       ? dateValue[1].split('-').reverse().join('-') | ||||||
|  |       : new Date().toISOString().slice(0, 10), | ||||||
|  |     idUlp: 0, | ||||||
|  |     idUid: 0, | ||||||
|  |     idUp3: 0, | ||||||
|  |     namaRegional: '', | ||||||
|  |     isSelesai: progressSelected.value, | ||||||
|  |     media: '', | ||||||
|  |     tanggal: '', | ||||||
|  |     namaIssuetype: '', | ||||||
|  |     namaSubissuetype: '' | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   if (groupDialog.value) { | ||||||
|  |     if (groupIndex.value == 0) { | ||||||
|  |       query = { | ||||||
|  |         ...query, | ||||||
|  |         isSelesai: progressSelected.value | ||||||
|  |       } | ||||||
|  |     } else if (groupIndex.value == 1) { | ||||||
|  |       query = { | ||||||
|  |         ...query, | ||||||
|  |         namaRegional: groupData.value?.nama_regional ? groupData.value?.nama_regional : '' | ||||||
|  |       } | ||||||
|  |     } else if (groupIndex.value == 2) { | ||||||
|  |       query = { | ||||||
|  |         ...query, | ||||||
|  |         idUid: groupData.value?.id_uid ? groupData.value?.id_uid : 0, | ||||||
|  |         namaRegional: groupData.value?.nama_regional ? groupData.value?.nama_regional : '' | ||||||
|  |       } | ||||||
|  |     } else if (groupIndex.value == 3) { | ||||||
|  |       query = { | ||||||
|  |         ...query, | ||||||
|  |         idUid: groupData.value?.id_uid ? groupData.value?.id_uid : 0, | ||||||
|  |         idUp3: groupData.value?.id_up3 ? groupData.value?.id_up3 : 0, | ||||||
|  |         namaRegional: groupData.value?.nama_regional ? groupData.value?.nama_regional : '' | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } else { | ||||||
|  |     query = { | ||||||
|       dateFrom: dateValue[0] |       dateFrom: dateValue[0] | ||||||
|         ? dateValue[0].split('-').reverse().join('-') |         ? dateValue[0].split('-').reverse().join('-') | ||||||
|         : new Date().toISOString().slice(0, 10), |         : new Date().toISOString().slice(0, 10), | ||||||
| @@ -851,7 +962,14 @@ const getDetail = async () => { | |||||||
|         : new Date().toISOString().slice(0, 10), |         : new Date().toISOString().slice(0, 10), | ||||||
|       idUlp: selected?.id_ulp ? selected?.id_ulp : 0, |       idUlp: selected?.id_ulp ? selected?.id_ulp : 0, | ||||||
|       idUid: selected?.id_uid ? selected?.id_uid : 0, |       idUid: selected?.id_uid ? selected?.id_uid : 0, | ||||||
|     idUp3: selected?.id_up3 ? selected?.id_up3 : 0 |       idUp3: selected?.id_up3 ? selected?.id_up3 : 0, | ||||||
|  |       namaRegional: selected?.nama_regional ? selected?.nama_regional : '', | ||||||
|  |       media: selected?.media ? selected?.media : '', | ||||||
|  |       isSelesai: progressSelected.value, | ||||||
|  |       tanggal: '', | ||||||
|  |       namaIssuetype: '', | ||||||
|  |       namaSubissuetype: '' | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   loadingSubData.value = true |   loadingSubData.value = true | ||||||
| @@ -881,10 +999,12 @@ const clearSelection = () => { | |||||||
| } | } | ||||||
| const showDetail = () => { | const showDetail = () => { | ||||||
|   clearSelection() |   clearSelection() | ||||||
|  |   if (agreeToShowDialog.value) { | ||||||
|     dataSub.value = [] |     dataSub.value = [] | ||||||
|     dataSubSelected.value = null |     dataSubSelected.value = null | ||||||
|     dialogDetail.value = true |     dialogDetail.value = true | ||||||
|     getDetail() |     getDetail() | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| const onExporting = (e: any) => { | const onExporting = (e: any) => { | ||||||
|   | |||||||
| @@ -636,6 +636,12 @@ export const queries = { | |||||||
|           $idUlp: Int! |           $idUlp: Int! | ||||||
|           $idUid: Int! |           $idUid: Int! | ||||||
|           $idUp3: Int! |           $idUp3: Int! | ||||||
|  |           $namaRegional: String | ||||||
|  |           $isSelesai: Int! | ||||||
|  |           $media: String | ||||||
|  |           $tanggal: String | ||||||
|  |           $namaIssuetype: String | ||||||
|  |           $namaSubissuetype: String | ||||||
|         ) { |         ) { | ||||||
|           detailKeluhanAll( |           detailKeluhanAll( | ||||||
|             dateFrom: $dateFrom |             dateFrom: $dateFrom | ||||||
| @@ -643,14 +649,25 @@ export const queries = { | |||||||
|             idUlp: $idUlp |             idUlp: $idUlp | ||||||
|             idUid: $idUid |             idUid: $idUid | ||||||
|             idUp3: $idUp3 |             idUp3: $idUp3 | ||||||
|  |             namaRegional: $namaRegional | ||||||
|  |             isSelesai: $isSelesai | ||||||
|  |             media: $media | ||||||
|  |             tanggal: $tanggal | ||||||
|  |             namaIssuetype: $namaIssuetype | ||||||
|  |             namaSubissuetype: $namaSubissuetype | ||||||
|           ) { |           ) { | ||||||
|             id |             id | ||||||
|  |             nama_regional | ||||||
|  |             id_uid | ||||||
|  |             nama_uid | ||||||
|  |             id_up3 | ||||||
|  |             nama_up3 | ||||||
|  |             id_ulp | ||||||
|  |             nama_ulp | ||||||
|             no_laporan |             no_laporan | ||||||
|             pembuat_laporan |  | ||||||
|             waktu_lapor |             waktu_lapor | ||||||
|             waktu_response |             waktu_response | ||||||
|             waktu_recovery |             waktu_recovery | ||||||
|             durasi_dispatch_time |  | ||||||
|             durasi_response_time |             durasi_response_time | ||||||
|             durasi_recovery_time |             durasi_recovery_time | ||||||
|             status_akhir |             status_akhir | ||||||
| @@ -659,14 +676,8 @@ export const queries = { | |||||||
|             alamat_pelapor |             alamat_pelapor | ||||||
|             no_telp_pelapor |             no_telp_pelapor | ||||||
|             keterangan_pelapor |             keterangan_pelapor | ||||||
|             media |             respon_pelanggan | ||||||
|             jarak_closing |             is_selesai | ||||||
|             dispatch_oleh |  | ||||||
|             diselesaikan_oleh |  | ||||||
|             penyebab |  | ||||||
|             tindakan |  | ||||||
|             kode_gangguan |  | ||||||
|             jenis_gangguan |  | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       ` |       ` | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user