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