consend form
This commit is contained in:
parent
6fe6aed921
commit
380eb0d10b
17 changed files with 482 additions and 346 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<q-dialog :model-value="modalError" persistent @update:model-value="updateClose">
|
||||
<q-dialog :model-value="modal" persistent @update:model-value="updateClose">
|
||||
<q-card class="q-pa-sm">
|
||||
<q-card-section class="row items-center">
|
||||
<div class="q-pr-md">
|
||||
|
|
@ -12,9 +12,9 @@
|
|||
/>
|
||||
</div>
|
||||
<div class="col text-dark">
|
||||
<span class="text-bold text-red">{{ modalErrorTittle }}</span>
|
||||
<span class="text-bold text-red">{{ tittle }}</span>
|
||||
<br />
|
||||
<span>{{ modalErrorDetail }}</span>
|
||||
<span>{{ detail }}</span>
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
|
|
@ -28,25 +28,21 @@
|
|||
import { ref, useAttrs } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
modalError: Boolean,
|
||||
modalErrorTittle: String,
|
||||
modalErrorDetail: String,
|
||||
modal: Boolean,
|
||||
tittle: String,
|
||||
detail: String,
|
||||
close: {
|
||||
type: Function,
|
||||
default: () => console.log('not function')
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:modalError',
|
||||
'update:modalErrorTittle',
|
||||
'update:modalErrorDetail'
|
||||
])
|
||||
const emit = defineEmits(['update:modal', 'update:tittle', 'update:detail'])
|
||||
|
||||
const updateClose = () => {
|
||||
emit('update:modalError', false)
|
||||
emit('update:modalErrorTittle', '')
|
||||
emit('update:modalErrorDetail', '')
|
||||
emit('update:modal', false)
|
||||
emit('update:tittle', '')
|
||||
emit('update:detail', '')
|
||||
props.close()
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@
|
|||
flat
|
||||
round
|
||||
:disabled="!(editvisible == true && updateData == true)"
|
||||
:color="
|
||||
!(editvisible == true && updateData == true) ? 'grey-7' : 'public'
|
||||
"
|
||||
:color="!(editvisible == true && updateData == true) ? 'grey-7' : 'public'"
|
||||
@click="checkSave"
|
||||
v-if="saveNoDraft == false"
|
||||
icon="mdi-content-save-outline"
|
||||
|
|
@ -72,9 +70,7 @@
|
|||
flat
|
||||
round
|
||||
:disabled="!(publicData == false || updateData == true)"
|
||||
:color="
|
||||
!(publicData == false || updateData == true) ? 'grey-7' : 'public'
|
||||
"
|
||||
:color="!(publicData == false || updateData == true) ? 'grey-7' : 'public'"
|
||||
@click="publishModal"
|
||||
icon="mdi-cloud-upload-outline"
|
||||
v-if="publicNoBtn == false"
|
||||
|
|
@ -87,9 +83,7 @@
|
|||
style="display: flex"
|
||||
v-if="publicData == false && publicNoBtn == false"
|
||||
>
|
||||
<div class="text-public text-body2 text-weight-medium q-px-sm">
|
||||
ข้อมูลยังไม่เผยแพร่
|
||||
</div>
|
||||
<div class="text-public text-body2 text-weight-medium q-px-sm">ข้อมูลยังไม่เผยแพร่</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -219,9 +213,7 @@
|
|||
</q-th>
|
||||
<q-th
|
||||
auto-width
|
||||
v-if="
|
||||
editvisible == true || nextPageVisible == true || history == true
|
||||
"
|
||||
v-if="editvisible == true || nextPageVisible == true || history == true"
|
||||
/>
|
||||
</q-tr>
|
||||
</template>
|
||||
|
|
@ -236,13 +228,7 @@
|
|||
<q-card class="q-pa-sm">
|
||||
<q-card-section class="row">
|
||||
<div class="q-pr-md">
|
||||
<q-avatar
|
||||
icon="public"
|
||||
size="lg"
|
||||
font-size="25px"
|
||||
color="blue-1"
|
||||
text-color="public"
|
||||
/>
|
||||
<q-avatar icon="public" size="lg" font-size="25px" color="blue-1" text-color="public" />
|
||||
</div>
|
||||
<div class="col text-dark">
|
||||
<span class="text-bold">ต้องการเผยแพร่ข้อมูลนี้หรือไม่?</span>
|
||||
|
|
@ -253,12 +239,7 @@
|
|||
|
||||
<q-card-actions align="right" class="bg-white text-teal">
|
||||
<q-btn label="ยกเลิก" flat color="grey-8" v-close-popup />
|
||||
<q-btn
|
||||
label="เผยแพร่"
|
||||
color="public"
|
||||
@click="publish()"
|
||||
v-close-popup
|
||||
/>
|
||||
<q-btn label="เผยแพร่" color="public" @click="publish()" v-close-popup />
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
|
@ -291,162 +272,157 @@
|
|||
</q-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, useAttrs } from "vue";
|
||||
import { ref, useAttrs } from 'vue'
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const table = ref<any>(null);
|
||||
const filterRef = ref<any>(null);
|
||||
const modalPublish = ref<boolean>(false);
|
||||
const modalDelete = ref<boolean>(false);
|
||||
const attrs = ref<any>(useAttrs())
|
||||
const table = ref<any>(null)
|
||||
const filterRef = ref<any>(null)
|
||||
const modalPublish = ref<boolean>(false)
|
||||
const modalDelete = ref<boolean>(false)
|
||||
const props = defineProps({
|
||||
inputfilter: String,
|
||||
inputvisible: Array,
|
||||
editvisible: Boolean,
|
||||
boss: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
defualt: false
|
||||
},
|
||||
saveNoDraft: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
defualt: false
|
||||
},
|
||||
history: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
defualt: false
|
||||
},
|
||||
paging: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
defualt: false
|
||||
},
|
||||
nornmalData: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
defualt: false
|
||||
},
|
||||
nextPageVisible: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
defualt: false
|
||||
},
|
||||
publicData: {
|
||||
type: Boolean,
|
||||
defualt: true,
|
||||
required: false,
|
||||
required: false
|
||||
},
|
||||
updateData: {
|
||||
type: Boolean,
|
||||
defualt: true,
|
||||
required: false,
|
||||
required: false
|
||||
},
|
||||
publicNoBtn: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
defualt: false
|
||||
},
|
||||
add: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
default: () => console.log('not function')
|
||||
},
|
||||
edit: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
default: () => console.log('not function')
|
||||
},
|
||||
save: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
default: () => console.log('not function')
|
||||
},
|
||||
deleted: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
default: () => console.log('not function')
|
||||
},
|
||||
cancel: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
default: () => console.log('not function')
|
||||
},
|
||||
publish: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
default: () => console.log('not function')
|
||||
},
|
||||
validate: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
});
|
||||
default: () => console.log('not function')
|
||||
}
|
||||
})
|
||||
const initialPagination = ref<any>({
|
||||
// descending: false,
|
||||
rowsPerPage: props.paging == true ? 25 : 0,
|
||||
});
|
||||
rowsPerPage: props.paging == true ? 25 : 0
|
||||
})
|
||||
|
||||
const emit = defineEmits([
|
||||
"update:inputfilter",
|
||||
"update:inputvisible",
|
||||
"update:editvisible",
|
||||
]);
|
||||
const emit = defineEmits(['update:inputfilter', 'update:inputvisible', 'update:editvisible'])
|
||||
|
||||
const updateEdit = (value: any) => {
|
||||
emit("update:editvisible", value);
|
||||
};
|
||||
emit('update:editvisible', value)
|
||||
}
|
||||
const updateInput = (value: any) => {
|
||||
emit("update:inputfilter", value);
|
||||
};
|
||||
emit('update:inputfilter', value)
|
||||
}
|
||||
const updateVisible = (value: any) => {
|
||||
emit("update:inputvisible", value);
|
||||
};
|
||||
emit('update:inputvisible', value)
|
||||
}
|
||||
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (props.paging == true)
|
||||
return " " + start + " ใน " + end + " จากจำนวน " + total + " รายการ";
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
if (props.paging == true) return ' ' + start + ' ใน ' + end + ' จากจำนวน ' + total + ' รายการ'
|
||||
else return start + '-' + end + ' ใน ' + total
|
||||
}
|
||||
|
||||
const checkSave = () => {
|
||||
props.validate();
|
||||
props.save();
|
||||
props.validate()
|
||||
props.save()
|
||||
// if (myForm.value !== null) {
|
||||
// myForm.value.validate().then((success) => {
|
||||
// if (success) {
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
};
|
||||
}
|
||||
|
||||
const publishModal = () => {
|
||||
props.validate();
|
||||
const filter = attrs.value.rows.filter((r: any) => r.name == "");
|
||||
props.validate()
|
||||
const filter = attrs.value.rows.filter((r: any) => r.name == '')
|
||||
|
||||
if (filter.length == 0 || attrs.value.rows.length == 0) {
|
||||
modalPublish.value = true;
|
||||
modalPublish.value = true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const DeleteModal = () => {
|
||||
modalDelete.value = true;
|
||||
};
|
||||
modalDelete.value = true
|
||||
}
|
||||
|
||||
const edit = async () => {
|
||||
updateEdit(!props.editvisible);
|
||||
props.edit();
|
||||
};
|
||||
updateEdit(!props.editvisible)
|
||||
props.edit()
|
||||
}
|
||||
|
||||
const add = async () => {
|
||||
// if (myForm.value !== null) {
|
||||
// myForm.value.validate();
|
||||
// }
|
||||
props.validate();
|
||||
props.add();
|
||||
await table.value.lastPage();
|
||||
await table.value.scrollTo(attrs.value.rows.length - 1);
|
||||
};
|
||||
props.validate()
|
||||
props.add()
|
||||
await table.value.lastPage()
|
||||
await table.value.scrollTo(attrs.value.rows.length - 1)
|
||||
}
|
||||
|
||||
const deleted = async () => {
|
||||
if (props.publicNoBtn === false) {
|
||||
updateEdit(false);
|
||||
updateEdit(false)
|
||||
}
|
||||
props.deleted();
|
||||
};
|
||||
props.deleted()
|
||||
}
|
||||
|
||||
const resetFilter = () => {
|
||||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
emit("update:inputfilter", "");
|
||||
filterRef.value.focus();
|
||||
};
|
||||
emit('update:inputfilter', '')
|
||||
filterRef.value.focus()
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.icon-color {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue