fix unmatch import

This commit is contained in:
Mulia Nasution
2023-06-07 04:27:47 +07:00
parent e1225f3a98
commit c33056b2c0
3 changed files with 90 additions and 83 deletions

52
src/utils/http.js Normal file
View File

@@ -0,0 +1,52 @@
const http = {
async request(method, url, data, headers = {}) {
try {
const defaultHeaders = {
'Accept': 'application/json',
'Content-Type': 'application/json',
}
headers = Object.assign(defaultHeaders, headers);
const options = {
method: method,
headers,
}
if (data instanceof FormData) {
options.body = data;
delete options.headers['Accept'];
delete options.headers['Content-Type'];
} else {
options.body = JSON.stringify(data);
}
if (method === 'GET') {
delete options.body;
}
return await fetch(url, options)
} catch (e) {
console.error(e)
}
},
async get(url, headers = {}) {
return await this.request('GET', url, null, headers);
},
async post(url, data, headers) {
return await this.request('POST', url, data, headers);
},
async put(url, data, headers) {
return await this.request('PUT', url, data, headers);
},
async delete(url, data, headers) {
return await this.request('DELETE', url, data, headers);
},
}
export default http;

View File

@@ -5,58 +5,34 @@
<div class="content-block"> <div class="content-block">
<div class="dx-card responsive-paddings"> <div class="dx-card responsive-paddings">
<div id="app-container"> <div id="app-container">
<Popup <DxPopup
v-model:visible="popupVisible" v-model:visible="isPopupUploadDokumenPendukung"
:drag-enabled="false" :drag-enabled="false"
:hide-on-outside-click="true" :hide-on-outside-click="true"
:show-close-button="false" :show-close-button="true"
:show-title="true" :show-title="true"
:width="914" @showing="onShowing"
:height="672" title="Upload Dokumen Pendukung"
container=".dx-viewport"
:title="popupTitle"
> >
<template #content> <template #content>
<PopUpTabel :drpId="selectedDrpId" :drpTahun="selectedDrpTahun"/> <PopUpTabel :drpId="selectedDrpId" :drpTahun="selectedDrpTahun"/>
</template> </template>
<DxToolbarItem <DxToolbarItem
widget="dxButton" widget="dxButton"
toolbar="top"
locate-in-menu="always"
:options="closeButtonOptions"
:visible="!isShowButton"
/>
<DxToolbarItem
widget="dxButton"
toolbar="bottom"
location="after"
:options="closeButtonOptions"
v-model:visible="isShowButton"
/>
<DxToolbarItem
widget="dxButton"
toolbar="bottom"
location="after"
:options="saveButtonOptions" :options="saveButtonOptions"
v-model:visible="isShowButton" location="after"
toolbar="bottom"
/> />
<template #content> <DxToolbarItem
<div class="dx-fieldset"> widget="dxButton"
<div class="dx-field"> :options="cancelButtonOptions"
<div class="dx-field-label">Tahun DRP</div> location="after"
<div class="dx-field-value"> toolbar="bottom"
{{ year }} />
</div> </DxPopup>
</div>
</div>
<PopupUploadDokumen :id="passId" />
</template>
</Popup>
<DxDataGrid <DxDataGrid
ref="currDataGrid" ref="currDataGrid"
:data-source="dataSource" :data-source="dataSource"
key-expr="id"
:allow-column-reordering="true" :allow-column-reordering="true"
:column-auto-width="true" :column-auto-width="true"
> >
@@ -80,20 +56,6 @@
<DxRequiredRule message="Tahun harus diisi" /> <DxRequiredRule message="Tahun harus diisi" />
</DxItem> </DxItem>
</DxForm> </DxForm>
<DxPopup
:hide-on-outside-click="true"
:show-title="true"
:width="400"
:height="400"
title="Form Jenis Pengadaan"
>
<DxPosition
at="center"
my="center"
v-model:of="positionOf"
collision="fit"
/>
</DxPopup>
</DxEditing> </DxEditing>
<DxToolbar> <DxToolbar>
<DxItem name="groupPanel" /> <DxItem name="groupPanel" />
@@ -189,7 +151,6 @@ import DxDataGrid, {
DxButton, DxButton,
DxRequiredRule, DxRequiredRule,
// DxLookup, // DxLookup,
DxPopup,
} from "devextreme-vue/data-grid"; } from "devextreme-vue/data-grid";
import CustomStore from "devextreme/data/custom_store"; import CustomStore from "devextreme/data/custom_store";
import DxPopup, { DxToolbarItem } from 'devextreme-vue/popup'; import DxPopup, { DxToolbarItem } from 'devextreme-vue/popup';
@@ -274,52 +235,48 @@ export default {
DxRequiredRule, DxRequiredRule,
// DxLookup, // DxLookup,
DxPopup, DxPopup,
Popup,
DxToolbarItem, DxToolbarItem,
PopUpTabel, PopUpTabel,
}, },
methods: { methods: {
linkDokumen($event) { linkDokumen(e) {
// console.log($event); this.isPopupUploadDokumenPendukung = !this.isPopupUploadDokumenPendukung;
this.year = $event.row.data.tahun this.selectedDrpId = e.row.data.id;
this.passId = $event.row.key this.selectedDrpTahun = e.row.data.tahun;
this.popupVisible = true;
this.popupTitle = "Upload Dokumen Pendukung";
this.isShowButton = true;
}, },
linkDetail(e) { linkDetail(e) {
location.href='#/drp/drp-pengadaan?drpid='+e.row.data.id; location.href='#/drp/drp-pengadaan?drpid='+e.row.data.id;
}, },
linkKirim($event) { linkKirim($event) {
console.log("event: ", $event.row.values);
this.popupVisible = true;
this.popupTitle = "Review & Approval DRP";
this.dataDrp = $event.row.values; this.dataDrp = $event.row.values;
this.isShowButton = true; },
console.log("drp: ", this.dataDrp); onChangeUploadFile($event) {
this.fileNames = $event.value;
},
onShowing() {
//
}, },
}, },
data() { data() {
return { return {
//jsonUrl: URL, //jsonUrl: URL,
passId: '',
dataSource, dataSource,
year: "200", dropdown: "",
popupVisible: false, isPopupUploadDokumenPendukung: false,
popupTitle: "", selectedDrpId: null,
isShowButton: true, selectedDrpTahun: null,
fileNames: [],
saveButtonOptions: { saveButtonOptions: {
text: "Simpan", text: 'Simpan',
onClick: ($event) => { onClick: function(e) {
this.popupVisible = false; console.log(e);
console.log("simpan", $event); }
}, },
}, cancelButtonOptions: {
closeButtonOptions: { text: 'Batalkan',
text: "Batal",
onClick: () => { onClick: () => {
this.popupVisible = false; this.isPopupUploadDokumenPendukung = false;
}, }
}, },
}; };
}, },

View File

@@ -62,7 +62,6 @@ export default {
updated() { updated() {
this.filenameEdit = this.$props.dokumenData?.filename; this.filenameEdit = this.$props.dokumenData?.filename;
console.log("sda", this.$props.dokumenData);
}, },
methods: { methods: {
@@ -125,8 +124,7 @@ export default {
}) })
.then((res) => res.json()) .then((res) => res.json())
.then((json) => { .then((json) => {
console.log("updated: ", json); console.log(json);
console.log("data upload", data);
this.$emit("close"); this.$emit("close");
}) })