จัดโค้ด

This commit is contained in:
setthawutttty 2023-11-17 18:00:02 +07:00
parent 50298e9976
commit 1e16bd7b2d
7 changed files with 174 additions and 86 deletions

View file

@ -373,7 +373,9 @@ onMounted(async () => {
การทดลองปฏหนาทราชการของ {{ person.name }}
</div>
</q-toolbar>
<q-separator />
<q-card-section>
<div class="row col-12 no-margin q-px-md q-pt-md">
<div class="row col-12 q-gutter-lg">
@ -384,7 +386,6 @@ onMounted(async () => {
</div>
<div class="col-12 q-pl-md q-pb-md">
<!-- <div class="col-12"><span class="text-top0 q-pl-sm">ตำแหน</span> {{ person.Position }}</div> -->
<div class="col-12">
<span class="text-top0 q-pl-sm">ตำแหนงในสายงาน</span>
{{ person.PositionLineName }}
@ -412,12 +413,14 @@ onMounted(async () => {
date2Thai(assign.date_finish)
}}</span>
</div>
<div class="col-12 text-top0 row items-center">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
นทกผล<span class="text-primary q-pr-sm">{{
"ครั้งที่ " + round
}}</span>
</div>
<div class="col-12 text-top0 row items-center">
<div class="col-6 q-px-sm">
<datepicker
@ -458,6 +461,7 @@ onMounted(async () => {
</template>
</datepicker>
</div>
<div class="col-6 q-px-sm">
<datepicker
menu-class-name="modalfix"
@ -498,6 +502,7 @@ onMounted(async () => {
</datepicker>
</div>
</div>
<div class="col-12 q-pt-md">
<q-separator size="3px" color="grey-2" />
</div>
@ -1346,6 +1351,7 @@ onMounted(async () => {
<q-item-section>
<q-item-label>2. การเรยนรวยตนเอง</q-item-label>
</q-item-section>
<q-item-section side>
<div class="row">
<q-radio
@ -1364,10 +1370,10 @@ onMounted(async () => {
/>
</div>
</q-item-section>
</q-item>
<q-separator class="q-my-xs" />
<q-item
dense
tag="label"
@ -1407,6 +1413,7 @@ onMounted(async () => {
>
</q-item-section>
<q-item-section side>
<div class="row">
<q-radio
checked-icon="task_alt"
@ -1423,6 +1430,7 @@ onMounted(async () => {
label=" ยังไม่ได้ดำเนินการ"
/>
</div>
</q-item-section>
</q-item>
</q-list>
@ -1430,8 +1438,6 @@ onMounted(async () => {
</div>
</div>
<!-- Footer -->
<!-- <Footer /> -->
<div class="row col-12 q-gutter-lg no-margin justify-center">
<div class="col-xs-12 col-sm-11">
<div class="col-12 text-top2 row items-center">
@ -1492,6 +1498,7 @@ onMounted(async () => {
</div>
</div>
</div>
<div class="col-12">
<q-separator size="3px" color="grey-2" />
</div>

View file

@ -24,6 +24,7 @@ const {
dialogConfirm,
dialogMessageNotify,
} = mixin;
const { ratingColors } = probationStore;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.id.toString());
@ -81,6 +82,7 @@ const other_training = ref<any>(null);
const Autherise = ref<any>(null);
const dateAutherise = ref<any>(new Date());
const checkArray = ref<number>(0);
const alerts = Array(20)
.fill(null)
.map(() => ref<boolean>(false));
@ -133,7 +135,9 @@ const variablesToWatch = [
success_level,
];
const ArrayCountbotton = [orientation, self_learning, training_seminar];
const savaForm = () => {
/** เช็คข้อมูลก่อน save */
function savaForm(){
achievement_strengthRef.value.validate();
behavio_strengthRef.value.validate();
@ -207,11 +211,11 @@ const savaForm = () => {
}
};
/**
* get data เกฐในตวแปร
* @param id person id
*/
async function fecthFormdata(id: string){
/**
* get data เกฐในตวแปร
* @param id person id
*/
async function fecthFormdata(id: string) {
await http
.get(config.API.formevaluateRecordCommander(id))
.then((res: any) => {
@ -244,10 +248,10 @@ const savaForm = () => {
checkArray.value = list1_1.value.length;
})
.catch((e: any) => {});
};
}
/** ยืนยัน save ข้อมูล */
function putformData(){
function putformData() {
const data = {
evaluate_no: evaluate_no.value,
start_date: start_date.value,
@ -285,12 +289,12 @@ function putformData(){
assessor_dated: dateToISO(dateAutherise.value),
};
dialogConfirm($q, async () => await saveformdata(data));
};
}
/** save
* @param data อมลท save
*/
async function saveformdata(data: any){
*/
async function saveformdata(data: any) {
await http
.post(config.API.formevaluateCommander(assignId.value), data)
.then(() => {
@ -300,7 +304,7 @@ async function saveformdata(data: any){
.catch((e: any) => {
messageError($q, e);
});
};
}
variablesToWatch.forEach((variable, index) => {
watch(variable, (item: any) => {
@ -352,11 +356,11 @@ watch(lengthdiscipline_level, (newLength) => {
* งช class
* @param i true/false
*/
function getBordered(i: boolean){
function getBordered(i: boolean) {
return {
border_custom: i,
};
};
}
onMounted(async () => {
await fecthFormdata(assignId.value);
@ -1262,7 +1266,7 @@ onMounted(async () => {
</q-list>
</q-card>
</div>
<!-- <FormComment /> -->
<div class="row col-12 q-gutter-lg no-margin">
<div class="col-12 row">

View file

@ -84,14 +84,33 @@ const achievement_inproveRef = ref<any>(null);
const behavio_strengthRef = ref<any>(null);
const behavio_inproveRef = ref<any>(null);
const edit = () => {
status.value = true;
};
const list1_2 = [
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
];
const cancel = () => {
status.value = false;
props.fecthAssign?.(assignId.value);
};
const list2_1 = probationStore.behavior_no1;
const list2_2 = probationStore.behavior_no2;
const list2_3 = probationStore.behavior_no3;
const achievement_strengthRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น",
];
const behavio_strengthRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น",
];
/** รับค่า props มาจากหน้าหลัก */
const props = defineProps({
tab: String,
data: Object,
@ -99,7 +118,21 @@ const props = defineProps({
fecthAssign: Function,
});
const fecthFormdata = async () => {
/** ให้ status true */
function edit(){
status.value = true;
};
/** status false
* เรยกใช งช จากหนาหล
*/
function cancel(){
status.value = false;
props.fecthAssign?.(assignId.value);
};
/** get data */
async function fecthFormdata(){
await http
.get(config.API.formevaluateRecordCommander(assignId.value))
.then(async (res: any) => {
@ -113,7 +146,9 @@ const fecthFormdata = async () => {
}
});
};
const fectFormfull = async () => {
/** get data */
async function fectFormfull(){
Autherise.value =
probationStore.director.name +
` (${probationStore.director.PositionLineName}, ${probationStore.director.PositionLevelName}, ${probationStore.director.Oc})`;
@ -130,7 +165,9 @@ const fectFormfull = async () => {
checkArray.value = list1_1.value.length;
fecthFormRound();
};
const fecthFormRound = async () => {
/** get data */
async function fecthFormRound(){
try {
let data = await dataArr.value;
evaluate_id.value = data.id;
@ -190,32 +227,8 @@ const fecthFormRound = async () => {
}
};
const list1_2 = [
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
{ id: "", label: "" },
];
const list2_1 = probationStore.behavior_no1;
const list2_2 = probationStore.behavior_no2;
const list2_3 = probationStore.behavior_no3;
const achievement_strengthRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น",
];
const behavio_strengthRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น",
];
const savaForm = () => {
/** เช็คก่อน save */
function savaForm(){
achievement_strengthRef.value.validate();
achievement_inproveRef.value.validate();
behavio_strengthRef.value.validate();
@ -258,7 +271,8 @@ const savaForm = () => {
}
};
const putformData = () => {
/** ยืนยัน save data */
function putformData(){
const data = {
evaluate_no: evaluate_no.value,
start_date: start_date.value,
@ -300,7 +314,8 @@ const putformData = () => {
);
};
const saveformdata = async (data: any) => {
/** save data */
async function saveformdata(data: any){
await http
.post(config.API.formevaluateCommander(assignId.value), data)
.then((res: any) => {
@ -312,7 +327,8 @@ const saveformdata = async (data: any) => {
});
};
const editData = async (data: any) => {
/** update data */
async function editData(data: any){
await http
.put(
config.API.editEvaluateCommander(assignId.value, evaluate_id.value),
@ -334,6 +350,7 @@ watch(props, async () => {
fectFormfull();
}
});
onMounted(async () => {
if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4));
@ -376,6 +393,7 @@ onMounted(async () => {
</q-btn>
</div>
</div>
<div class="col-12 row q-gutter-lg">
<div class="col-12 row">
<div class="col-12 row text-top0">
@ -487,6 +505,7 @@ onMounted(async () => {
</q-list>
</q-card>
</div>
<div class="col-12 row">
<div class="col-xs-12 col-sm-11 col-md-10 offset-md-1 text-top2">
ผลผลตของงานทเกดขนจร
@ -745,6 +764,7 @@ onMounted(async () => {
</q-item>
</q-list>
</q-card>
<q-card class="text-top0 col-xs-12 col-sm-11 q-pa-xs q-pl-sm">
<q-list dense>
<q-item dense tag="label" v-ripple>
@ -920,6 +940,7 @@ onMounted(async () => {
</q-list>
</q-card>
</div>
<div class="col-12 row">
<div class="col-12 text-top0 row items-center q-pl-lg">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
@ -968,6 +989,7 @@ onMounted(async () => {
</q-list>
</q-card>
</div>
<div class="col-12 row">
<div class="col-12 text-top0 row items-center q-pl-lg">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
@ -1016,6 +1038,7 @@ onMounted(async () => {
</q-list>
</q-card>
</div>
<div class="col-12 row">
<div class="col-12 text-top0 row items-center q-pl-lg">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
@ -1085,6 +1108,7 @@ onMounted(async () => {
</q-list>
</q-card>
</div>
<!-- <FormComment /> -->
<div class="row col-12 q-gutter-lg no-margin">
<div class="col-12 row">
@ -1168,6 +1192,7 @@ onMounted(async () => {
</div>
</q-item-section>
</q-item>
<q-separator class="q-my-xs" />
<q-item dense tag="label" v-ripple>
<q-item-section>
@ -1194,6 +1219,7 @@ onMounted(async () => {
</div>
</q-item-section>
</q-item>
<q-separator class="q-my-xs" />
<q-item dense tag="label" v-ripple>
<q-item-section>
@ -1220,6 +1246,7 @@ onMounted(async () => {
</div>
</q-item-section>
</q-item>
<q-separator class="q-my-xs" />
<q-item dense tag="label" v-ripple>
<q-item-section>
@ -1315,6 +1342,7 @@ onMounted(async () => {
</div>
</div>
</div>
<q-toolbar
class="text-primary"
v-if="routeName == 'probationFormAddresult'"

View file

@ -2,6 +2,8 @@
import { ref, watch } from "vue";
const tabHead = ref<string>("save1");
/** รับค่ามาจากหน้าหลัก */
const props = defineProps({
FileDownload: {
type: Function,
@ -25,7 +27,9 @@ const props = defineProps({
},
},
});
const downloadFile = (type: string) => {
/** เรียกใช้ฟังชั่นจากหน้าหลัก */
function downloadFile(type: string){
props.FileDownload(type);
};
@ -33,7 +37,8 @@ watch(tabHead, () => {
props.changeTab(tabHead.value);
});
const nextPage = () => {
/** ไปยัง step ต่อไป */
function nextPage(){
if (props.loop !== undefined) {
if (props.loop < 3) {
props.addData();

View file

@ -33,10 +33,11 @@ const fullname = ref<string>("");
const tab = ref<string>("save1");
const dataArrayNumber = ref<number>();
const dataRole = ref<string>("mentor");
onMounted(async () => {
await fecthAssign(assignId.value);
});
const fecthAssign = async (id: string) => {
/** get
* @param id person id
*/
async function fecthAssign(id: string){
showLoader();
await http
.get(config.API.formevaluate(id))
@ -52,11 +53,18 @@ const fecthAssign = async (id: string) => {
hideLoader();
});
};
const changeTab = (tabVal: string) => {
/**
* เปลยน tab
* @param tabVal type
*/
function changeTab(tabVal: string){
tab.value = tabVal;
dataArrayNumber.value = Number(tabVal.charAt(4));
};
const downloadFile = (response: any, filename: string) => {
/** convert file */
function downloadFile(response: any, filename: string){
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
@ -65,7 +73,9 @@ const downloadFile = (response: any, filename: string) => {
link.click();
document.body.removeChild(link);
};
const FileDownload = async (type: string) => {
/** download file */
async function FileDownload(type: string){
let numTab = probationStore.evaluate.find(
(e: any) => e.no === dataArrayNumber.value
);
@ -109,11 +119,17 @@ const FileDownload = async (type: string) => {
});
}
};
const addData = () => {
/** ไปหน้า page add */
function addData(){
router.push(
`/probation/detail/addresult/${personalId.value}/${assignId.value}`
);
};
onMounted(async () => {
await fecthAssign(assignId.value);
});
</script>
<template>
@ -146,14 +162,6 @@ const addData = () => {
action="edit"
/>
</q-tab-panel>
<!-- <q-page-container>
<FormSaveResult
:tab="tab"
:data="probationStore.evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit"
/>
</q-page-container> -->
</q-tab-panels>
<div class="q-gutter-md" v-else-if="probationStore.tabs.length == 0">

View file

@ -33,10 +33,16 @@ const fullname = ref<string>("");
const tab = ref<string>("save1");
const dataArrayNumber = ref<number>();
const dataRole = ref<string>("mentor");
onMounted(async () => {
await fecthAssign(assignId.value);
});
const fecthAssign = async (id: string) => {
/**
* get data
* @param id person id
*/
async function fecthAssign(id: string){
showLoader();
await http
.get(config.API.formevaluateCommander(id))
@ -54,11 +60,18 @@ const fecthAssign = async (id: string) => {
hideLoader();
});
};
const changeTab = (tabVal: string) => {
/**
* เปลยน tab
* @param tabVal type
*/
function changeTab(tabVal: string){
tab.value = tabVal;
dataArrayNumber.value = Number(tabVal.charAt(4));
};
const downloadFile = (response: any, filename: string) => {
/** เปลี่ยน type file */
function downloadFile(response: any, filename: string){
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
@ -67,7 +80,12 @@ const downloadFile = (response: any, filename: string) => {
link.click();
document.body.removeChild(link);
};
const FileDownload = async (type: string) => {
/**
* download file
* @param type type
*/
async function FileDownload(type: string){
let numTab = probationStore.evaluate.find(
(e: any) => e.no === dataArrayNumber.value
);
@ -111,7 +129,9 @@ const FileDownload = async (type: string) => {
});
}
};
const addData = () => {
/** เปลี่ยนหน้า เพิ่ม */
function addData(){
router.push(
`/probation/detail/addevaluacommander/${personalId.value}/${assignId.value}`
);

View file

@ -35,7 +35,11 @@ const tabs = ref<any>([]);
const dataArrayNumber = ref<number>(1);
const evaluate = ref<any>([]);
const changeTab = (tabVal: string) => {
/**
* เปลยน tab
* @param tabVal type
*/
function changeTab(tabVal: string){
tab.value = tabVal;
dataArrayNumber.value = Number(tabVal.charAt(4));
};
@ -44,7 +48,11 @@ onMounted(() => {
fecthAssign(assignId.value);
});
const fecthAssign = async (id: string) => {
/**
* get data
* @param id person id
*/
async function fecthAssign(id: string){
showLoader();
await http
.get(config.API.createformCommader(id))
@ -62,7 +70,9 @@ const fecthAssign = async (id: string) => {
hideLoader();
});
};
const downloadFile = (response: any, filename: string) => {
/** เปลี่ยน type file */
function downloadFile(response: any, filename: string){
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
@ -72,7 +82,11 @@ const downloadFile = (response: any, filename: string) => {
document.body.removeChild(link);
};
const FileDownload = async (type: string) => {
/**
* download file
* @param type type
*/
async function FileDownload(type: string){
let numTab = evaluate.value.find((e: any) => e.no === dataArrayNumber.value);
showLoader();
await http
@ -92,7 +106,9 @@ const FileDownload = async (type: string) => {
hideLoader();
});
};
const addData = () => {
/** เปลี่ยนหน้า เพิ่ม */
function addData(){
router.push(
`/probation/detail/addevalua/${personalId.value}/${assignId.value}`
);