เรื่องร้องเรียน เพิ่ม เเก้ไข
This commit is contained in:
parent
61026107cd
commit
e86b9eaf9d
8 changed files with 763 additions and 625 deletions
|
|
@ -16,6 +16,7 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
const columns = ref<QTableProps["columns"]>([]);
|
||||
function fetchComplainst(data: DataList[]) {
|
||||
let datalist = data.map((e: DataList) => ({
|
||||
id: e.id,
|
||||
subject: e.subject,
|
||||
detail: e.detail,
|
||||
complainant: e.complainant,
|
||||
|
|
@ -27,37 +28,45 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
rows.value = datalist
|
||||
}
|
||||
// filter options
|
||||
const complainantoptionsMain = ref<DataOption[]>()
|
||||
const complainantoptions = ref<DataOption[]>()
|
||||
const agencytoptionsMain = ref<DataOption[]>()
|
||||
const agencytoptions = ref<DataOption[]>()
|
||||
const complainantoptionsMain = ref<DataOption[]>([
|
||||
{ id: "0", name: "บุคคล" },
|
||||
{ id: "1", name: "หน่ายงาน" },
|
||||
{ id: "2", name: "กรุงเทพหมานคร" },
|
||||
]);
|
||||
const complainantoptions = ref<DataOption[]>(complainantoptionsMain.value)
|
||||
const agencytoptionsMain = ref<DataOption[]>([
|
||||
{ id: "0", name: "หน่ายงานเอ" },
|
||||
{ id: "1", name: "หน่ายงานบี" },
|
||||
{ id: "2", name: "หน่ายงานชี" },
|
||||
]);
|
||||
const agencytoptions = ref<DataOption[]>(agencytoptionsMain.value)
|
||||
const optionListNameMain = ref<DataOption[]>([])
|
||||
const optionListName = ref<DataOption[]>([])
|
||||
function fetchOptioin(complainantoptions: any, agencytoptions: any) {
|
||||
complainantoptionsMain.value = complainantoptions
|
||||
agencytoptionsMain.value = agencytoptions
|
||||
}
|
||||
|
||||
function selectComplainantTpye(list: any) {
|
||||
optionListNameMain.value = list
|
||||
optionListName.value = list
|
||||
}
|
||||
function filterSelector(val: string, update: Function, type: string) {
|
||||
update(() => {
|
||||
if (type === "filtercomplainantType" && complainantoptionsMain.value) {
|
||||
const needle = val.toLowerCase();
|
||||
|
||||
if (type === "filtercomplainantType") {
|
||||
complainantoptions.value = complainantoptionsMain.value.filter(
|
||||
(e) => e.name.search(val) !== -1
|
||||
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
);
|
||||
} else if (type === "filteragencytoptions" && agencytoptionsMain.value) {
|
||||
|
||||
} else if (type === "filteragencytoptions") {
|
||||
agencytoptions.value = agencytoptionsMain.value.filter(
|
||||
(e) => e.name.search(val) !== -1
|
||||
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
);
|
||||
} else if (type === "filtercomplainantOP" && optionListNameMain.value) {
|
||||
} else if (type === "filtercomplainantOP") {
|
||||
optionListName.value = optionListNameMain.value.filter(
|
||||
(e) => e.name.search(val) !== -1
|
||||
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
);
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
@ -67,7 +76,6 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
fetchComplainst,
|
||||
selectComplainantTpye,
|
||||
filterSelector,
|
||||
fetchOptioin,
|
||||
complainantoptions,
|
||||
agencytoptions,
|
||||
optionListName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue