ปรับยืม-คืน
This commit is contained in:
parent
4ca00ceadb
commit
bbe468a344
3 changed files with 51 additions and 58 deletions
|
|
@ -114,10 +114,16 @@ const fetchOrgList = async () => {
|
||||||
await http
|
await http
|
||||||
.get(config.API.typeOc())
|
.get(config.API.typeOc())
|
||||||
.then(async (response: any) => {
|
.then(async (response: any) => {
|
||||||
OrgList.value = response.data.result.map((e: any) => ({
|
const orgArr = response.data.result.map((e: any) => ({
|
||||||
id: e.organizationId,
|
id: e.organizationId,
|
||||||
name: e.organizationName
|
name: e.organizationName
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
if (props.action == 'editData') {
|
||||||
|
OrgList.value = [{id: "00000000-0000-0000-0000-000000000000", name: 'สำนักนายกรัฐมนตรี'},...orgArr]
|
||||||
|
} else {
|
||||||
|
OrgList.value = orgArr
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err)
|
messageError($q, err)
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ const fecthRound = async () => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
selectRoundAllOption.value = [{
|
selectRoundAllOption.value = [{
|
||||||
name: "ทั้งหมด",
|
name: "ทั้งหมด",
|
||||||
id: "all",
|
id: "00000000-0000-0000-0000-000000000000",
|
||||||
year: 0,
|
year: 0,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
@ -252,7 +252,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "returnDate",
|
name: "returnDate",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "วันที่ยืม",
|
label: "วันที่คืน",
|
||||||
field: "returnDate",
|
field: "returnDate",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
|
|
@ -280,45 +280,23 @@ watch(tab, async () => {
|
||||||
fecthlistInsignia();
|
fecthlistInsignia();
|
||||||
});
|
});
|
||||||
|
|
||||||
const selectorInsignia = () => {
|
const selectorInsignia = async() => {
|
||||||
fecthlistInsignia();
|
const dataCopy = await DataStore.listInsignia;
|
||||||
|
rows.value = DataStore.insignia != '' ? dataCopy.filter((x:any)=>x.requestInsigniaId == DataStore.insignia): dataCopy
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectorRound = (round: string) => {
|
// const selectorRound = (round: string) => {
|
||||||
selectRound.value = round;
|
// selectRound.value = round;
|
||||||
};
|
// };
|
||||||
|
|
||||||
const rows = ref<any[]>([]);
|
const rows = ref<any[]>([]);
|
||||||
|
|
||||||
const fecthlistInsignia = async () => {
|
const fecthlistInsignia = async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.insigniaManageBorrowList(Number(roundYear.value), tab.value))
|
.get(config.API.insigniaManageBorrowList(Number(roundYear.value), tab.value))
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
let data = res.data.result;
|
await DataStore.fetchlistinsignia(res.data.result)
|
||||||
rows.value = [];
|
rows.value = DataStore.rows
|
||||||
rows.value = data.map((e: any) => ({
|
|
||||||
id: e.id,
|
|
||||||
citizenId: e.citizenId,
|
|
||||||
prefix: e.prefix,
|
|
||||||
position: e.position,
|
|
||||||
// status: DataStore.status(e.status),
|
|
||||||
name: e.fullName,
|
|
||||||
type: e.requestInsignia,
|
|
||||||
employeeType: DataStore.profileType(e.profileType),
|
|
||||||
profileType: e.profileType,
|
|
||||||
page: e.page,
|
|
||||||
number: e.no,
|
|
||||||
vatnumber: e.number,
|
|
||||||
datepay: date2Thai(e.datePayment),
|
|
||||||
typepay: e.typePayment,
|
|
||||||
address: e.address,
|
|
||||||
borrowOrganization: e.borrowOrganization,
|
|
||||||
borrowDate: e.borrowDate !== null ? date2Thai(e.borrowDate) : '-',
|
|
||||||
returnOrganization: e.returnOrganization,
|
|
||||||
returnDate: e.returnDate !== null ? date2Thai(e.returnDate) : '-',
|
|
||||||
returnReason: e.returnReason !== null ? e.returnReason : '-',
|
|
||||||
}));
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
@ -350,6 +328,7 @@ const editData = (id: any) => {
|
||||||
profileId.value = id;
|
profileId.value = id;
|
||||||
action.value = "editData";
|
action.value = "editData";
|
||||||
modal.value = true;
|
modal.value = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetFilter = () => {
|
const resetFilter = () => {
|
||||||
|
|
@ -377,12 +356,12 @@ const resetFilter = () => {
|
||||||
<div v-for="item in DataStore.insigniaType">
|
<div v-for="item in DataStore.insigniaType">
|
||||||
<div v-if="tab == item.name" class="q-pa-md">
|
<div v-if="tab == item.name" class="q-pa-md">
|
||||||
<div class="row col-12 q-pb-sm q-col-gutter-x-xs">
|
<div class="row col-12 q-pb-sm q-col-gutter-x-xs">
|
||||||
<div>
|
<!-- <div>
|
||||||
<q-select v-model="selectRound" dense outlined lazy-rules hide-bottom-space
|
<q-select v-model="selectRound" dense outlined lazy-rules hide-bottom-space
|
||||||
:label="`${'รอบการขอเครื่องราชฯ'}`" emit-value map-options option-label="name"
|
:label="`${'รอบการเสนอขอเครื่องราชฯ'}`" emit-value map-options option-label="name"
|
||||||
:options="selectRoundAllOption" option-value="id" :readonly="false" :borderless="false"
|
:options="selectRoundAllOption" option-value="id" :borderless="false"
|
||||||
style="min-width: 150px" @update:emit-value="selectorRound" />
|
style="min-width: 150px" @update:emit-value="selectorRound" />
|
||||||
</div>
|
</div> -->
|
||||||
<div>
|
<div>
|
||||||
<q-select v-model="DataStore.insignia" dense outlined lazy-rules hide-bottom-space
|
<q-select v-model="DataStore.insignia" dense outlined lazy-rules hide-bottom-space
|
||||||
:label="`${'เครื่องราชฯ'}`" emit-value map-options option-label="name" :options="insigniaList"
|
:label="`${'เครื่องราชฯ'}`" emit-value map-options option-label="name" :options="insigniaList"
|
||||||
|
|
@ -420,8 +399,9 @@ const resetFilter = () => {
|
||||||
{{ props.rowIndex + 1 }}
|
{{ props.rowIndex + 1 }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="props.col.name == 'action'">
|
<div v-else-if="props.col.name == 'action' && props.row.returnDate == '-'">
|
||||||
<q-td>
|
<q-td>
|
||||||
|
|
||||||
<q-btn label="คืนเครื่องราชฯ" @click="editData(props.row.id)" color="blue" />
|
<q-btn label="คืนเครื่องราชฯ" @click="editData(props.row.id)" color="blue" />
|
||||||
</q-td>
|
</q-td>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -470,7 +450,7 @@ const resetFilter = () => {
|
||||||
{{ props.rowIndex + 1 }}
|
{{ props.rowIndex + 1 }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="props.col.name == 'action'">
|
<div v-else-if="props.col.name == 'action' && props.row.returnDate == '-'">
|
||||||
<q-td>
|
<q-td>
|
||||||
<q-btn label="คืนเครื่องราชฯ" @click="editData(props.row.id)" color="blue" />
|
<q-btn label="คืนเครื่องราชฯ" @click="editData(props.row.id)" color="blue" />
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
@ -519,7 +499,7 @@ const resetFilter = () => {
|
||||||
{{ props.rowIndex + 1 }}
|
{{ props.rowIndex + 1 }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="props.col.name == 'action'">
|
<div v-else-if="props.col.name == 'action' && props.row.returnDate == '-'">
|
||||||
<q-td>
|
<q-td>
|
||||||
<q-btn label="คืนเครื่องราชฯ" @click="editData(props.row.id)" color="blue" />
|
<q-btn label="คืนเครื่องราชฯ" @click="editData(props.row.id)" color="blue" />
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
@ -536,8 +516,9 @@ const resetFilter = () => {
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogForm :modal="modal" :close="close" :close-and-fecth="closeAndFecth" :round-id="selectRound" :action="action"
|
<DialogForm :modal="modal" :close="close" :close-and-fecth="closeAndFecth"
|
||||||
:profile-id="profileId" :selectRoundOption="selectRoundOption" :type-id="tab" />
|
:round-id="selectRound == '00000000-0000-0000-0000-000000000000' ? 'all' : selectRound" :action="action"
|
||||||
|
:profile-id="profileId" :select-round-option="selectRoundOption" :type-id="tab" />
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const {
|
||||||
date2Thai,
|
date2Thai,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
export const useResultDataStore = defineStore("insigniaResult", () => {
|
export const useResultDataStore = defineStore("insigniaAllocate", () => {
|
||||||
const insigniaName = ref<string>('')
|
const insigniaName = ref<string>('')
|
||||||
const insignia = ref<string>('')
|
const insignia = ref<string>('')
|
||||||
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "", type: "" }])
|
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "", type: "" }])
|
||||||
|
|
@ -39,9 +39,9 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
||||||
prefix: e.prefix,
|
prefix: e.prefix,
|
||||||
position: e.position,
|
position: e.position,
|
||||||
status: status(e.status),
|
status: status(e.status),
|
||||||
dateReceive: date2Thai(e.dateReceive),
|
|
||||||
name: e.fullName,
|
name: e.fullName,
|
||||||
type: e.requestInsignia,
|
type: e.requestInsignia,
|
||||||
|
requestInsigniaId: e.requestInsigniaId,
|
||||||
employeeType: profileType(e.profileType),
|
employeeType: profileType(e.profileType),
|
||||||
profileType: e.profileType,
|
profileType: e.profileType,
|
||||||
page: e.page,
|
page: e.page,
|
||||||
|
|
@ -50,23 +50,28 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
||||||
datepay: date2Thai(e.datePayment),
|
datepay: date2Thai(e.datePayment),
|
||||||
typepay: e.typePayment,
|
typepay: e.typePayment,
|
||||||
address: e.address,
|
address: e.address,
|
||||||
}));
|
borrowOrganization: e.borrowOrganization,
|
||||||
|
borrowDate: e.borrowDate !== null ? date2Thai(e.borrowDate) : '-',
|
||||||
|
returnOrganization: e.returnOrganization,
|
||||||
|
returnDate: e.returnDate !== null ? date2Thai(e.returnDate) : '-',
|
||||||
|
returnReason: e.returnReason !== null ? e.returnReason : '-',
|
||||||
|
}));
|
||||||
rows.value = alllist
|
rows.value = alllist
|
||||||
listInsignia.value = alllist
|
listInsignia.value = alllist
|
||||||
selectInvoice(invoiceType.value)
|
// selectInvoice(invoiceType.value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectInvoice = (invoice: string) => {
|
// const selectInvoice = (invoice: string) => {
|
||||||
console.log(invoice);
|
// console.log(invoice);
|
||||||
if (invoice === "noDate") {
|
// if (invoice === "noDate") {
|
||||||
let list = listInsignia.value.filter((e: any) => e.datepay === null)
|
// let list = listInsignia.value.filter((e: any) => e.datepay === null)
|
||||||
rows.value = list
|
// rows.value = list
|
||||||
} else if (invoice === "haveDate") {
|
// } else if (invoice === "haveDate") {
|
||||||
let list = listInsignia.value.filter((e: any) => e.datepay !== null)
|
// let list = listInsignia.value.filter((e: any) => e.datepay !== null)
|
||||||
rows.value = list
|
// rows.value = list
|
||||||
} else rows.value = listInsignia.value
|
// } else rows.value = listInsignia.value
|
||||||
}
|
// }
|
||||||
|
|
||||||
const status = (val: string) => {
|
const status = (val: string) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
|
|
@ -92,6 +97,7 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
rows,
|
rows,
|
||||||
|
listInsignia,
|
||||||
insignia,
|
insignia,
|
||||||
insigniaOp,
|
insigniaOp,
|
||||||
insigniaOp2,
|
insigniaOp2,
|
||||||
|
|
@ -103,7 +109,7 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
||||||
status,
|
status,
|
||||||
profileType,
|
profileType,
|
||||||
fetchlistinsignia,
|
fetchlistinsignia,
|
||||||
selectInvoice,
|
// selectInvoice,
|
||||||
insigniaName
|
insigniaName
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue