แก้ การส่งไฟล์

This commit is contained in:
AnandaTon 2023-08-24 16:08:11 +07:00
parent f7c7959f1c
commit cb4e32c855
2 changed files with 270 additions and 13 deletions

View file

@ -120,6 +120,7 @@ const tranferOrg = ref("")
const dateCommand = ref<Date>(new Date())
const dateLeave = ref<Date>(new Date())
const noteReason = ref("")
const nameFile = ref<string>("")
onMounted(() => {
if (route.params.id !== undefined) {
@ -129,8 +130,8 @@ onMounted(() => {
})
const saveResing = () => {
$q.dialog({
title: "ยืนยันการยื่นข้อมูลลาออก",
message: "ต้องการยื่นข้อมูลลาออกนี้ใช่หรือไม่?",
title: "ยืนยันการยื่นข้อมูลแบบสอบถาม",
message: "ต้องการยื่นข้อมูลแบบสอบถามนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
@ -145,11 +146,16 @@ const saveResing = () => {
}
const createFormresign = async () => {
const formData = new FormData()
const blob = files.value.slice(0, files.value[0].size)
const newFile = new File(blob, nameFile.value, {
type: files.value[0].type,
})
formData.append("Location", tranferOrg.value)
formData.append("SendDate", dateToISO(dateCommand.value))
formData.append("ActiveDate", dateToISO(dateLeave.value))
formData.append("Reason", noteReason.value)
formData.append("file", files.value)
formData.append("file", newFile)
console.log(files.value)
await http
.post(config.API.listResign(), formData)
.then((res: any) => {

View file

@ -11,13 +11,99 @@ const route = useRoute()
const router = useRouter()
const $q = useQuasar()
const mixin = useCounterMixin()
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } = mixin
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader, dialogConfirm } = mixin
const leaveReason = ref("")
const id = ref<string>("")
const noteReason = ref("")
const routeName = router.currentRoute.value.name
const dataId = route.params.id.toString()
const dataId = ref<any>(route.params.id.toString())
const exitFactor = ref<any>([])
const reasonWork = ref<any>([])
const adjust = ref<any>([])
const timeThink = ref<any>([])
const realReason = ref<any>("")
const notExitFactor = ref<any>("")
const haveJob = ref<any>("")
const suggestFriends = ref<any>([])
const futureWork = ref<any>([])
const suggestion = ref<any>("")
const reasonWorkOther = ref("")
const reasonWork_option = ref<any>([
{ label: "ความมั่นคงในการทำงาน ", value: 0 },
{ label: "สิทธิประโยชน์/สวัสดิการ", value: 1 },
{ label: "อัตราเงินเดือน ", value: 2 },
{ label: "ลักษณะงาน ", value: 3 },
{ label: "วัฒนธรรมการทำงานของข้าราชการ ", value: 4 },
{ label: "นโยบายของหน่วยงาน ", value: 5 },
{ label: "ระบบการทำงาน", value: 6 },
{ label: "สมดุลชีวิตการทำงาน ", value: 7 },
{ label: "บรรยากาศในการทำงาน ", value: 8 },
{ label: "การพัฒนาในสายอาชีพ ", value: 9 },
{ label: "โอกาสความก้าวหน้า ", value: 10 },
{ label: "การได้รับการยอมรับจากสังคม ", value: 11 },
{ label: "อื่น ๆ (ระบุ) ", value: 12 },
])
const exitFactorOther = ref("")
const exitFactor_option = ref<any>([
{ label: "อัตราเงินเดือน ", value: 0 },
{ label: "สวัสดิการ", value: 1 },
{ label: "ลักษณะงาน ", value: 2 },
{ label: "ระบบการทำงาน ", value: 3 },
{ label: "ระบบสนับสนุนการปฏิบัติงาน ", value: 4 },
{ label: "การมอบหมายงานที่ชัดเจนและเหมาะสม ", value: 5 },
{ label: "การบริหารงานของผู้บังคับบัญชา", value: 6 },
{ label: "การทำงานเป็นทีมกับเพื่อนร่วมงาน ", value: 7 },
{ label: "ระบบบริหารงานภายในหน่วยงาน ", value: 8 },
{ label: "บรรยากาศในการทำงาน ", value: 9 },
{ label: "การปฏิบัติอย่างเป็นธรรม ", value: 10 },
{ label: "การยอมรับความแตกต่างหลากหลาย ", value: 11 },
{ label: "การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน ", value: 12 },
{ label: "การพัฒนาอย่างเป็นระบบและต่อเนื่อง ", value: 13 },
{ label: "โอกาสความก้าวหน้า ", value: 14 },
{ label: "อื่น ๆ (ระบุ) ", value: 15 },
])
const suggestFriendsReason = ref("")
const suggestFriends_option = ref<any>([
{ label: "แนะนำ ", value: 0 },
{ label: "ไม่แนะนำ (ระบุ)", value: 1 },
])
const timeThink_option = ref<any>([
{ label: "น้อยกว่า 2 สัปดาห์ ", value: 0 },
{ label: "1 เดือน - 3 เดือน", value: 1 },
{ label: "3 เดือน - 6 เดือน ", value: 2 },
{ label: "6 เดือนขึ้นไป ", value: 3 },
])
const haveJobReason = ref<any>("")
const haveJob_option = ref<any>([
{ label: "มี ", value: 0 },
{ label: "ไม่มี(ระบุ)", value: 1 },
])
const futureWorkReason = ref<any>("")
const futureWork_option = ref<any>([
{ label: "อยาก ", value: 0 },
{ label: "ไม่อยาก (ระบุ)", value: 1 },
])
const adjustOther = ref("")
const adjust_option = ref<any>([
{ label: "อัตราเงินเดือน ", value: 0 },
{ label: "สวัสดิการ", value: 1 },
{ label: "ลักษณะงาน ", value: 2 },
{ label: "ระบบการทำงาน ", value: 3 },
{ label: "ระบบสนับสนุนการปฏิบัติงาน ", value: 4 },
{ label: "การมอบหมายงานที่ชัดเจนและเหมาะสม ", value: 5 },
{ label: "การบริหารงานของผู้บังคับบัญชา", value: 6 },
{ label: "การทำงานเป็นทีมกับเพื่อนร่วมงาน ", value: 7 },
{ label: "ระบบบริหารงานภายในหน่วยงาน ", value: 8 },
{ label: "บรรยากาศในการทำงาน ", value: 9 },
{ label: "การปฏิบัติอย่างเป็นธรรม ", value: 10 },
{ label: "การยอมรับความแตกต่างหลากหลาย ", value: 11 },
{ label: "การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน ", value: 12 },
{ label: "การพัฒนาอย่างเป็นระบบและต่อเนื่อง ", value: 13 },
{ label: "โอกาสความก้าวหน้า ", value: 14 },
{ label: "อื่น ๆ (ระบุ) ", value: 15 },
])
const saveForm = () => {
$q.dialog({
title: "ยืนยันข้อมูลแบบสอบถาม",
@ -35,14 +121,48 @@ const saveForm = () => {
.onDismiss(() => {})
}
const createResult = async () => {
const formData = new FormData()
console.log(formData)
// const putData = () => {
// const data = {
// ReasonWork: reasonWork.value,
// ReasonWorkOther: reasonWorkOther.value,
// TimeThink: timeThink.value,
// ExitFactor: exitFactor.value,
// ExitFactorOther: exitFactorOther.value,
// Adjust: adjust.value,
// AdjustOther: adjustOther.value,
// RealReason: realReason.value,
// NotExitFactor: notExitFactor.value,
// Havejob: haveJob.value,
// HavejobReason: haveJobReason.value,
// SuggestFriends: suggestFriends.value,
// SuggestFriendsReason: suggestFriendsReason.value,
// FutureWork: futureWork.value,
// FutureWorkReason: futureWorkReason.value,
// }
// createResult(data)
// }
formData.append("Location", leaveReason.value)
formData.append("SendDate", noteReason.value)
const createResult = async () => {
const data = {
RetirementResignId: dataId.value,
ReasonWork: reasonWork.value,
ReasonWorkOther: reasonWorkOther.value,
TimeThink: timeThink.value,
ExitFactor: exitFactor.value,
ExitFactorOther: exitFactorOther.value,
Adjust: adjust.value,
AdjustOther: adjustOther.value,
RealReason: realReason.value,
NotExitFactor: notExitFactor.value,
Havejob: haveJob.value,
HavejobReason: haveJobReason.value,
SuggestFriends: suggestFriends.value,
SuggestFriendsReason: suggestFriendsReason.value,
FutureWork: futureWork.value,
FutureWorkReason: futureWorkReason.value,
}
await http
.post(config.API.questionnaireByid(dataId), formData)
.post(config.API.listquestionnaire(), data)
.then((res: any) => {
// console.log(res);
success($q, "บันทึกข้อมูลสำเร็จ")
@ -72,8 +192,139 @@ const createResult = async () => {
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">แบบสอบถาม</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input class="col-12" dense outlined v-model="leaveReason" label="ทำไมคุณถึงลาออก?" type="textarea" />
<q-input class="col-12" dense outlined v-model="noteReason" label="สิ่งที่คุณต้องการจะบอกเรา?" type="textarea" />
<div class="col-12 text-top0 items-center">1. เหตใดทานจงตดสนใจรวมงานกบกรงเทพมหานคร (เลอกไดมากกว 1 )</div>
<q-option-group :options="reasonWork_option" type="checkbox" v-model="reasonWork" />
<div class="col-12 text-top0 items-center">
<q-item-label>
<q-input
v-if="reasonWork.includes(12)"
v-model="reasonWorkOther"
label="กรอกอื่นๆ"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">2. สำหรบการลาออกในครงน านไดดทบทวนอยางจรงจงเปนระยะเวลานานเทาใด</div>
<q-option-group :options="timeThink_option" type="radio" v-model="timeThink" />
<div class="col-12 text-top0 items-center">3. จจยใดททำใหานตดสนใจลาออกจากราชการ (เลอกไดมากกว 1 )</div>
<q-option-group :options="exitFactor_option" type="checkbox" v-model="exitFactor" />
<div class="col-12 text-top0 items-center">
<q-item-label>
<q-input
v-if="exitFactor.includes(15)"
v-model="exitFactorOther"
label="กรอกอื่นๆ"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">4. อะไรคอสงทานเหนวาควรปรบปร (เลอกไดมากกว 1 )</div>
<q-list>
<q-option-group :options="adjust_option" type="checkbox" v-model="adjust" />
</q-list>
<div class="col-12 text-top0 items-center">
<q-item-label>
<q-input
v-if="adjust.includes(15)"
v-model="adjustOther"
label="กรอกอื่นๆ"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">5. โปรดระบสาเหตแทจร ทำใหานตดสนใจลาออกจากการปฏราชการกบกรงเทพมหานคร ?</div>
<q-input class="col-12" dense outlined v-model="realReason" label=" " type="textarea" />
<div class="col-12 text-top0 items-center">6. จจยใดทจะชวยทำใหานเปลยนใจ ไมอยากลาออกจากการปฏราชการกบกรงเทพมหานคร</div>
<q-input class="col-12" dense outlined v-model="notExitFactor" label=" " type="textarea" />
<div class="col-12 text-top0 items-center">
7. านมงานใหมหรอไม าม (โปรดระบ อบรทเอกชน/หนวยงานภาคร) และอะไรคอสงททำงานใหมใหบทาน
งทานรกวาเปนทาพอใจมากกวาการปฏราชการกบกรงเทพมหานคร
</div>
<q-option-group :options="haveJob_option" type="radio" v-model="haveJob" />
<div class="col-12 text-top0 items-center">
<q-item-label>
<q-input
v-if="haveJob === 0"
v-model="haveJobReason"
label="กรอกอื่นๆ"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">8. านจะแนะนำเพอนใหมารวมงานกบกรงเทพมหานครหรอไม (าไม โปรดระบเหตผล)</div>
<q-option-group :options="suggestFriends_option" type="radio" v-model="suggestFriends" />
<div class="col-12 text-top0 items-center">
<q-item-label>
<q-input
v-if="suggestFriends === 1"
v-model="suggestFriendsReason"
label="กรอกอื่นๆ"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">9. หากทานมโอกาสในอนาคต านอยากกลบมารวมงานกบกรงเทพมหานครหรอไม (าไม โปรดระบเหตผล)</div>
<q-option-group :options="futureWork_option" type="radio" v-model="futureWork" />
<div class="col-12 text-top0 items-center">
<q-item-label>
<q-input
v-if="futureWork === 1"
v-model="futureWorkReason"
label="กรอกอื่นๆ"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">10. ความคดเหนและขอเสนอแนะอ </div>
<q-input class="col-12" dense outlined v-model="suggestion" label=" " type="textarea" />
<q-separator />
</div>
</q-card>