no message

This commit is contained in:
setthawutttty 2024-02-23 11:25:02 +07:00
parent b85a61920d
commit d54a6c1fa9
3 changed files with 32 additions and 22 deletions

View file

@ -15,6 +15,7 @@ const $q = useQuasar();
const isActive = ref<boolean>(false); const isActive = ref<boolean>(false);
const period = ref<string>(""); const period = ref<string>("");
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const effective = defineModel<Date|null|string>("effective", { required: true });
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogConfirm, date2Thai, messageError } = mixin; const { dialogConfirm, date2Thai, messageError } = mixin;
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
@ -66,7 +67,7 @@ function saveData() {}
function clearForm() { function clearForm() {
isActive.value = false; isActive.value = false;
period.value = ""; period.value = "";
effectiveDate.value = null; effective.value = null;
} }
function close() { function close() {
@ -79,7 +80,7 @@ function editSummit(){
const body = { const body = {
period: period.value, period: period.value,
isActive: isActive.value, isActive: isActive.value,
effectiveDate: effectiveDate.value, effectiveDate: effective.value,
}; };
http http
.put(config.API.salaryPeriod()+`/${props.idRound}`, body) .put(config.API.salaryPeriod()+`/${props.idRound}`, body)
@ -100,7 +101,7 @@ function onSubmit() {
const body = { const body = {
period: period.value, period: period.value,
isActive: isActive.value, isActive: isActive.value,
effectiveDate: effectiveDate.value, effectiveDate: effective.value,
}; };
http http
.post(config.API.salaryPeriod(), body) .post(config.API.salaryPeriod(), body)
@ -124,12 +125,17 @@ function inputEdit(val: boolean) {
} }
watch( watch(
() => props.edit, () => modal.value,
() => { () => {
console.log(props.edit)
if (props.edit == true) { if (props.edit == true) {
period.value = props.period ? props.period :''; period.value = props.period ? props.period :'';
effectiveDate.value = props.effectiveDate ? props.effectiveDate:null; effectiveDate.value = props.effectiveDate ? props.effectiveDate:null;
isActive.value = props.isActive; isActive.value = props.isActive;
}else{
effective.value = null
period.value = ''
isActive.value = false
} }
} }
); );
@ -166,7 +172,7 @@ watch(
/> />
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="effectiveDate" v-model="effective"
:locale="'th'" :locale="'th'"
autoApply autoApply
borderless borderless
@ -190,7 +196,7 @@ watch(
:readonly="isReadonly" :readonly="isReadonly"
hide-bottom-space hide-bottom-space
:model-value=" :model-value="
effectiveDate != null ? date2Thai(effectiveDate) : null effective != null ? date2Thai(effective as Date) : null
" "
label="วันที่มีผลบังคับใช้งาน" label="วันที่มีผลบังคับใช้งาน"
:rules="[ :rules="[

View file

@ -18,7 +18,7 @@ export const useSalaryDataStore = defineStore("salaryDataStore", () => {
id: i.id, id: i.id,
period: i.period !== null ? statusTothai(i.period) : null, period: i.period !== null ? statusTothai(i.period) : null,
isActive: i.isActive !== null ? i.isActive : null, isActive: i.isActive !== null ? i.isActive : null,
effectiveDate: i.effectiveDate !== null ? date2Thai(i.effectiveDate as Date) : null, effectiveDate: i.effectiveDate !== null ? i.effectiveDate : null,
status: i.status !== null ? i.status : null, status: i.status !== null ? i.status : null,
})); }));
} }

View file

@ -14,7 +14,7 @@ import { useQuasar } from "quasar";
const idRound = ref<string>(""); const idRound = ref<string>("");
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogRemove, showLoader, hideLoader, messageError } = mixin; const { dialogRemove, showLoader, hideLoader, messageError,date2Thai } = mixin;
const dataStore = useSalaryDataStore(); const dataStore = useSalaryDataStore();
const year = ref<number>(0); const year = ref<number>(0);
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
@ -84,6 +84,7 @@ const columns = ref<QTableProps["columns"]>([
function clickAdd() { function clickAdd() {
dialog.value = true; dialog.value = true;
editCheck.value = false
} }
/** ดึงข้อมูลเริ่มต้น */ /** ดึงข้อมูลเริ่มต้น */
function getData() { function getData() {
@ -94,10 +95,8 @@ function getData() {
`?page=${page.value}&pageSise=${rowsPerPage.value}&keyword=${filterKeyword.value}&year=${year.value}` `?page=${page.value}&pageSise=${rowsPerPage.value}&keyword=${filterKeyword.value}&year=${year.value}`
) )
.then((res) => { .then((res) => {
// maxPage.value = Math.ceil(dataList[0].total / rowsPerPage.value); dataStore.fetchDataMap(res.data.result.data);
// dataStore.fetchDataMap(dataList[0].data);
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
// fetchAppealComplain(res.data.result.data);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -140,6 +139,17 @@ function deleteData(id: string) {
hideLoader(); hideLoader();
}); });
} }
function editPopup(data:RowList) {
console.log(data)
editCheck.value = true;
dialog.value = true;
console.log(dialog.value)
idRound.value = data.id;
period.value = data.period ? data.period:'';
effectiveDate.value = data.effectiveDate as Date;
isActive.value = data.isActive ? data.isActive:false;
}
onMounted(async () => { onMounted(async () => {
year.value = new Date().getFullYear(); year.value = new Date().getFullYear();
getData(); getData();
@ -301,6 +311,9 @@ onMounted(async () => {
1 1
}} }}
</div> </div>
<div v-if="col.name == 'effectiveDate'">
{{ date2Thai(props.row.effectiveDate)}}
</div>
<div v-else-if="col.name === 'isActive'"> <div v-else-if="col.name === 'isActive'">
<q-icon <q-icon
v-if="col.value == false" v-if="col.value == false"
@ -329,16 +342,7 @@ onMounted(async () => {
size="12px" size="12px"
icon="edit" icon="edit"
clickable clickable
@click.stop=" @click="editPopup(props.row)"
() => {
editCheck = true;
dialog = true;
idRound = props.row.id;
period = props.row.period;
effectiveDate = props.row.effectiveDate;
isActive = props.row.isActive;
}
"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn>
@ -370,7 +374,7 @@ onMounted(async () => {
:get-data="getData" :get-data="getData"
:idRound="idRound" :idRound="idRound"
:period="period" :period="period"
:effectiveDate?="effectiveDate" v-model:effective="effectiveDate"
:isActive="isActive" :isActive="isActive"
/> />
</template> </template>