mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 20:01:06 +03:30
Edit Test Result
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<v-flex xs12 sm4 md3>
|
||||
<v-text-field
|
||||
name="autoclave"
|
||||
v-model="form.autoclave_id"
|
||||
v-model="formData.autoclave_id"
|
||||
label="ID AutoClave"
|
||||
color="black"
|
||||
class="pa-2"
|
||||
@@ -49,57 +49,54 @@
|
||||
<v-flex xs12 sm4 md3>
|
||||
<v-select
|
||||
:items="result"
|
||||
v-model="form.result"
|
||||
v-model="formData.result"
|
||||
label="Resualt"
|
||||
color="black"
|
||||
class="pa-2"
|
||||
></v-select>
|
||||
</v-flex>
|
||||
<v-flex v-for="(item, key) in form.data" :key="key">
|
||||
<v-flex :class="['pa-2', item.size]" v-for="(item, key) in form" :key="key">
|
||||
<v-text-field
|
||||
v-if="item.type == 'Text'"
|
||||
v-model="item[item.name]"
|
||||
v-model="formData[item.name]"
|
||||
:label="item.name"
|
||||
color="black"
|
||||
class="pa-2"
|
||||
></v-text-field>
|
||||
<v-select
|
||||
v-if="item.type == 'Select'"
|
||||
:items="item.options"
|
||||
v-model="item[item.name]"
|
||||
v-model="formData[item.name]"
|
||||
:label="item.name"
|
||||
color="black"
|
||||
class="pa-2"
|
||||
|
||||
item-text="title"
|
||||
></v-select>
|
||||
<v-container fluid v-if="item.type == 'Checkbox'">
|
||||
<v-container fluid v-if="item.type == 'Checkbox'" >
|
||||
<p>{{ item.name }}</p>
|
||||
<v-checkbox
|
||||
v-for="(optionValue, keyOption) in item.options"
|
||||
:key="keyOption"
|
||||
:label="optionValue.title"
|
||||
v-model="item[item.name]"
|
||||
v-model="formData[item.name]"
|
||||
:value="optionValue.title"
|
||||
></v-checkbox>
|
||||
</v-container>
|
||||
<template v-if="item.type == 'Form'">
|
||||
<v-layout row wrap>
|
||||
<h3>{{ item.name }}</h3>
|
||||
<v-flex v-for="(children, keyChildren) in item.children" :key="keyChildren">
|
||||
<v-flex :class="['pa-2', children.size]" v-for="(children, keyChildren) in item.children" :key="keyChildren">
|
||||
<v-text-field
|
||||
v-if="children.type == 'Text'"
|
||||
v-model="children[children.name]"
|
||||
v-model="formData[children.name]"
|
||||
:label="children.name"
|
||||
color="black"
|
||||
class="pa-2"
|
||||
></v-text-field>
|
||||
<v-select
|
||||
v-if="children.type == 'Select'"
|
||||
:items="children.options"
|
||||
v-model="children[children.name]"
|
||||
v-model="formData[children.name]"
|
||||
:label="children.name"
|
||||
color="black"
|
||||
class="pa-2"
|
||||
item-text="title"
|
||||
></v-select>
|
||||
<v-container fluid v-if="children.type == 'Checkbox'">
|
||||
@@ -108,7 +105,7 @@
|
||||
v-for="(optionValue, keyOption) in children.options"
|
||||
:key="keyOption"
|
||||
:label="optionValue.title"
|
||||
v-model="children[children.name]"
|
||||
v-model="formData[children.name]"
|
||||
:value="optionValue.title"
|
||||
></v-checkbox>
|
||||
</v-container>
|
||||
@@ -121,7 +118,7 @@
|
||||
<v-divider></v-divider>
|
||||
</v-layout>
|
||||
<v-layout align-center justify-center wrap class="px-5 mt-2">
|
||||
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
|
||||
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="submitForm">
|
||||
<v-icon class="white--text mr-2 caption">fas fa-check</v-icon>
|
||||
<span class="white--text">SAVE</span>
|
||||
</v-btn>
|
||||
@@ -144,14 +141,14 @@ export default {
|
||||
result: ["Accept", "Reject"],
|
||||
testTypeNames: [],
|
||||
searchInput: "",
|
||||
form: {
|
||||
autoclave_id: "",
|
||||
result: "",
|
||||
data: []
|
||||
},
|
||||
form: [],
|
||||
filter: {
|
||||
name: "",
|
||||
unique_code: ""
|
||||
},
|
||||
formData : {
|
||||
autoclave_id: "",
|
||||
result: "",
|
||||
}
|
||||
}),
|
||||
created() {
|
||||
@@ -165,9 +162,28 @@ export default {
|
||||
async selectTestType() {
|
||||
const result = await ApiService.post(urls.getInputs, this.filter);
|
||||
if (result && result.status == 200) {
|
||||
this.form.data = result.data.data;
|
||||
this.form = result.data.data;
|
||||
for (const key in result.data.data) {
|
||||
if (result.data.data.hasOwnProperty(key)) {
|
||||
if(result.data.data[key].type !== 'Form') {
|
||||
this.formData[result.data.data[key].name] = '';
|
||||
} else {
|
||||
for (const keyForm in result.data.data[key].children) {
|
||||
if (result.data.data[key].children.hasOwnProperty(keyForm)) {
|
||||
this.formData[result.data.data[key].children[keyForm].name] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async submitForm() {
|
||||
const result = await ApiService.post(urls.storeTestResult, this.formData);
|
||||
if (result && result.status == 200) {
|
||||
this.$router.push({name: 'Dashboard'})
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user