จัดโค้ด
This commit is contained in:
parent
b0cd3af1ad
commit
376f2a7c61
1 changed files with 67 additions and 39 deletions
|
|
@ -85,41 +85,6 @@ const alerts = Array(20)
|
||||||
.fill(null)
|
.fill(null)
|
||||||
.map(() => ref<boolean>(false));
|
.map(() => ref<boolean>(false));
|
||||||
|
|
||||||
const fecthFormdata = async (id: string) => {
|
|
||||||
await http
|
|
||||||
.get(config.API.formevaluateRecordCommander(id))
|
|
||||||
.then((res: any) => {
|
|
||||||
evaluate_no.value = res.data.data.evaluate_no;
|
|
||||||
start_date.value = res.data.data.start_date;
|
|
||||||
date_finish.value = res.data.data.end_date;
|
|
||||||
round.value = res.data.data.evaluate_no;
|
|
||||||
|
|
||||||
person.value = res.data.data.person;
|
|
||||||
assign.value = res.data.data.assign;
|
|
||||||
option.value.push(res.data.data.director);
|
|
||||||
Autherise.value =
|
|
||||||
res.data.data.director.name +
|
|
||||||
` (${res.data.data.director.PositionLineName}, ${res.data.data.director.PositionLevelName}, ${res.data.data.director.Oc})`;
|
|
||||||
|
|
||||||
list1_1.value = res.data.data.assign_output;
|
|
||||||
res.data.data.assign_output.forEach((e: any) => {
|
|
||||||
list1_2.push({ id: "", label: "" });
|
|
||||||
});
|
|
||||||
evaluate_expenct_level.value = res.data.data.assign_output.map(
|
|
||||||
(e: any) => ({
|
|
||||||
id: e.id,
|
|
||||||
labal: e.output_desc,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
evaluate_ouptut.value = res.data.data.assign_output.map((e: any) => ({
|
|
||||||
id: e.id,
|
|
||||||
text: "",
|
|
||||||
}));
|
|
||||||
checkArray.value = list1_1.value.length;
|
|
||||||
})
|
|
||||||
.catch((e: any) => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
//rules
|
//rules
|
||||||
const evaluate_ouptutRules = [
|
const evaluate_ouptutRules = [
|
||||||
(val: any) => (val && val.length > 0) || "กรุณากรอกเหตุผลที่เกิดขึ้น",
|
(val: any) => (val && val.length > 0) || "กรุณากรอกเหตุผลที่เกิดขึ้น",
|
||||||
|
|
@ -242,7 +207,47 @@ const savaForm = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const putformData = () => {
|
/**
|
||||||
|
* get data เก็ฐในตัวแปร
|
||||||
|
* @param id person id
|
||||||
|
*/
|
||||||
|
async function fecthFormdata(id: string){
|
||||||
|
await http
|
||||||
|
.get(config.API.formevaluateRecordCommander(id))
|
||||||
|
.then((res: any) => {
|
||||||
|
evaluate_no.value = res.data.data.evaluate_no;
|
||||||
|
start_date.value = res.data.data.start_date;
|
||||||
|
date_finish.value = res.data.data.end_date;
|
||||||
|
round.value = res.data.data.evaluate_no;
|
||||||
|
|
||||||
|
person.value = res.data.data.person;
|
||||||
|
assign.value = res.data.data.assign;
|
||||||
|
option.value.push(res.data.data.director);
|
||||||
|
Autherise.value =
|
||||||
|
res.data.data.director.name +
|
||||||
|
` (${res.data.data.director.PositionLineName}, ${res.data.data.director.PositionLevelName}, ${res.data.data.director.Oc})`;
|
||||||
|
|
||||||
|
list1_1.value = res.data.data.assign_output;
|
||||||
|
res.data.data.assign_output.forEach((e: any) => {
|
||||||
|
list1_2.push({ id: "", label: "" });
|
||||||
|
});
|
||||||
|
evaluate_expenct_level.value = res.data.data.assign_output.map(
|
||||||
|
(e: any) => ({
|
||||||
|
id: e.id,
|
||||||
|
labal: e.output_desc,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
evaluate_ouptut.value = res.data.data.assign_output.map((e: any) => ({
|
||||||
|
id: e.id,
|
||||||
|
text: "",
|
||||||
|
}));
|
||||||
|
checkArray.value = list1_1.value.length;
|
||||||
|
})
|
||||||
|
.catch((e: any) => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** ยืนยัน save ข้อมูล */
|
||||||
|
function putformData(){
|
||||||
const data = {
|
const data = {
|
||||||
evaluate_no: evaluate_no.value,
|
evaluate_no: evaluate_no.value,
|
||||||
start_date: start_date.value,
|
start_date: start_date.value,
|
||||||
|
|
@ -282,7 +287,10 @@ const putformData = () => {
|
||||||
dialogConfirm($q, async () => await saveformdata(data));
|
dialogConfirm($q, async () => await saveformdata(data));
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveformdata = async (data: any) => {
|
/** ฟังชั่น save
|
||||||
|
* @param data ข้อมูลที่ save
|
||||||
|
*/
|
||||||
|
async function saveformdata(data: any){
|
||||||
await http
|
await http
|
||||||
.post(config.API.formevaluateCommander(assignId.value), data)
|
.post(config.API.formevaluateCommander(assignId.value), data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
@ -301,6 +309,7 @@ variablesToWatch.forEach((variable, index) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ArrayCountbotton.forEach((variable, index) => {
|
ArrayCountbotton.forEach((variable, index) => {
|
||||||
watch(variable, (item: any) => {
|
watch(variable, (item: any) => {
|
||||||
if (item !== null) {
|
if (item !== null) {
|
||||||
|
|
@ -308,36 +317,47 @@ ArrayCountbotton.forEach((variable, index) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(lengthevaluate_expenct_level, (newLength) => {
|
watch(lengthevaluate_expenct_level, (newLength) => {
|
||||||
if (newLength === evaluate_expenct_level.value.length) {
|
if (newLength === evaluate_expenct_level.value.length) {
|
||||||
alerts[0].value = false;
|
alerts[0].value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(lengthevaluate_ouptut, (newLength) => {
|
watch(lengthevaluate_ouptut, (newLength) => {
|
||||||
if (newLength === evaluate_ouptut.value.length) {
|
if (newLength === evaluate_ouptut.value.length) {
|
||||||
alerts[1].value = false;
|
alerts[1].value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(lengthconduct, (newLength) => {
|
watch(lengthconduct, (newLength) => {
|
||||||
if (newLength === 4) {
|
if (newLength === 4) {
|
||||||
alerts[8].value = false;
|
alerts[8].value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(lengthmoral_level, (newLength) => {
|
watch(lengthmoral_level, (newLength) => {
|
||||||
if (newLength === 3) {
|
if (newLength === 3) {
|
||||||
alerts[9].value = false;
|
alerts[9].value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(lengthdiscipline_level, (newLength) => {
|
watch(lengthdiscipline_level, (newLength) => {
|
||||||
if (newLength === 5) {
|
if (newLength === 5) {
|
||||||
alerts[10].value = false;
|
alerts[10].value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const getBordered = (i: boolean) => {
|
|
||||||
|
/**
|
||||||
|
* ฟังชั่น class
|
||||||
|
* @param i true/false
|
||||||
|
*/
|
||||||
|
function getBordered(i: boolean){
|
||||||
return {
|
return {
|
||||||
border_custom: i,
|
border_custom: i,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fecthFormdata(assignId.value);
|
await fecthFormdata(assignId.value);
|
||||||
});
|
});
|
||||||
|
|
@ -373,7 +393,6 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 q-pl-md q-pb-md">
|
<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">
|
<div class="col-12">
|
||||||
<span class="text-top0 q-pl-sm">ตำแหน่งในสายงาน</span>
|
<span class="text-top0 q-pl-sm">ตำแหน่งในสายงาน</span>
|
||||||
{{ person.PositionLineName }}
|
{{ person.PositionLineName }}
|
||||||
|
|
@ -401,12 +420,14 @@ onMounted(async () => {
|
||||||
date2Thai(assign.date_finish)
|
date2Thai(assign.date_finish)
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 text-top0 row items-center">
|
<div class="col-12 text-top0 row items-center">
|
||||||
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
||||||
บันทึกผล<span class="text-primary q-pr-sm">{{
|
บันทึกผล<span class="text-primary q-pr-sm">{{
|
||||||
"ครั้งที่ " + round
|
"ครั้งที่ " + round
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 text-top0 row items-center">
|
<div class="col-12 text-top0 row items-center">
|
||||||
<div class="col-6 q-px-sm">
|
<div class="col-6 q-px-sm">
|
||||||
<datepicker
|
<datepicker
|
||||||
|
|
@ -447,6 +468,7 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6 q-px-sm">
|
<div class="col-6 q-px-sm">
|
||||||
<datepicker
|
<datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
|
|
@ -487,6 +509,7 @@ onMounted(async () => {
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 q-pt-md">
|
<div class="col-12 q-pt-md">
|
||||||
<q-separator size="3px" color="grey-2" />
|
<q-separator size="3px" color="grey-2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -553,6 +576,7 @@ onMounted(async () => {
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
<div class="col-xs-12 col-sm-11 col-md-10 offset-md-1 text-top2">
|
<div class="col-xs-12 col-sm-11 col-md-10 offset-md-1 text-top2">
|
||||||
ผลผลิตของงานที่เกิดขึ้นจริง
|
ผลผลิตของงานที่เกิดขึ้นจริง
|
||||||
|
|
@ -1054,6 +1078,7 @@ onMounted(async () => {
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
<div class="col-12 text-top0 row items-center q-pl-lg">
|
<div class="col-12 text-top0 row items-center q-pl-lg">
|
||||||
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
||||||
|
|
@ -1108,6 +1133,7 @@ onMounted(async () => {
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
<div class="col-12 text-top0 row items-center q-pl-lg">
|
<div class="col-12 text-top0 row items-center q-pl-lg">
|
||||||
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
||||||
|
|
@ -1162,6 +1188,7 @@ onMounted(async () => {
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
<div class="col-12 text-top0 row items-center q-pl-lg">
|
<div class="col-12 text-top0 row items-center q-pl-lg">
|
||||||
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
|
||||||
|
|
@ -1235,6 +1262,7 @@ onMounted(async () => {
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <FormComment /> -->
|
<!-- <FormComment /> -->
|
||||||
<div class="row col-12 q-gutter-lg no-margin">
|
<div class="row col-12 q-gutter-lg no-margin">
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue