Show Test Result

This commit is contained in:
saeid_01
2019-05-09 04:24:27 +04:30
parent 940a1b01ab
commit 116ef9e130
21 changed files with 504 additions and 173 deletions
+176 -116
View File
@@ -157,6 +157,27 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
@@ -174,8 +195,10 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
formData: {
autoclave_id: "",
result: "",
img: null,
test_type_id: ""
}
},
image: null
};
},
created: function created() {
@@ -248,7 +271,6 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
if (result.data.data.inputs[key].children.hasOwnProperty(keyForm)) {
if (result.data.data.inputs[key].children[keyForm].type == 'Checkbox' || result.data.data.inputs[key].children[keyForm].type == 'Select') {
this.formData[result.data.data.inputs[key].children[keyForm].name] = [];
console.log(this.formData[result.data.data.inputs[key].children[keyForm].name]);
} else {
this.formData[result.data.data.inputs[key].children[keyForm].name] = '';
}
@@ -340,7 +362,31 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
}
return submitForm;
}()
}(),
onFileChange: function onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
this.createImage(files[0]);
},
createImage: function createImage(file) {
var image = new Image();
var reader = new FileReader();
var vm = this;
reader.onload = function (e) {
vm.image = e.target.result;
};
reader.readAsDataURL(file);
},
removeImage: function removeImage(e) {
this.image = null;
}
},
watch: {
image: function image(img) {
this.formData.img = img;
}
}
});
@@ -539,6 +585,26 @@ var render = function() {
1
),
_vm._v(" "),
_c("v-flex", { attrs: { xs12: "", sm4: "", md3: "" } }, [
!_vm.image
? _c("div", [
_c("input", {
attrs: { type: "file" },
on: { change: _vm.onFileChange }
})
])
: _c("div", [
_c("img", {
staticStyle: { width: "100%" },
attrs: { src: _vm.image }
}),
_vm._v(" "),
_c("button", { on: { click: _vm.removeImage } }, [
_vm._v("Remove image")
])
])
]),
_vm._v(" "),
_vm._l(_vm.form, function(item, key) {
return _c(
"v-flex",
@@ -610,123 +676,117 @@ var render = function() {
_vm._v(" "),
item.type == "Form"
? [
_c("v-layout", { attrs: { row: "", wrap: "" } }, [
_c("h3", [_vm._v(_vm._s(item.name))])
]),
_vm._v(" "),
_c(
"v-layout",
{ attrs: { row: "", wrap: "" } },
[
_c("h3", [_vm._v(_vm._s(item.name))]),
_vm._v(" "),
_vm._l(item.children, function(
children,
keyChildren
) {
return _c(
"v-flex",
{
key: keyChildren,
class: ["pa-2", children.size]
},
[
children.type == "Text"
? _c("v-text-field", {
attrs: {
label: children.name,
color: "black"
},
model: {
value:
_vm.formData[children.name],
callback: function($$v) {
_vm.$set(
_vm.formData,
children.name,
$$v
)
},
expression:
"formData[children.name]"
}
})
: _vm._e(),
_vm._v(" "),
children.type == "Select"
? _c("v-select", {
attrs: {
multiple: "",
items: children.options,
label: children.name,
color: "black",
"item-text": "title",
"item-value": "id"
},
model: {
value:
_vm.formData[children.name],
callback: function($$v) {
_vm.$set(
_vm.formData,
children.name,
$$v
)
},
expression:
"formData[children.name]"
}
})
: _vm._e(),
_vm._v(" "),
children.type == "Checkbox"
? _c(
"v-container",
{ attrs: { fluid: "" } },
[
_c("p", [
_vm._v(_vm._s(children.name))
]),
_vm._v(" "),
_vm._l(
children.options,
function(
optionValue,
keyOption
) {
return _c("v-checkbox", {
key: keyOption,
attrs: {
label:
optionValue.title,
value: optionValue.id
},
model: {
value:
_vm.formData[
children.name
],
callback: function(
$$v
) {
_vm.$set(
_vm.formData,
children.name,
$$v
)
},
expression:
"formData[children.name]"
}
})
}
_vm._l(item.children, function(
children,
keyChildren
) {
return _c(
"v-flex",
{
key: keyChildren,
class: ["pa-2", children.size]
},
[
children.type == "Text"
? _c("v-text-field", {
attrs: {
label: children.name,
color: "black"
},
model: {
value:
_vm.formData[children.name],
callback: function($$v) {
_vm.$set(
_vm.formData,
children.name,
$$v
)
],
2
)
: _vm._e()
],
1
)
})
],
2
},
expression:
"formData[children.name]"
}
})
: _vm._e(),
_vm._v(" "),
children.type == "Select"
? _c("v-select", {
attrs: {
multiple: "",
items: children.options,
label: children.name,
color: "black",
"item-text": "title",
"item-value": "id"
},
model: {
value:
_vm.formData[children.name],
callback: function($$v) {
_vm.$set(
_vm.formData,
children.name,
$$v
)
},
expression:
"formData[children.name]"
}
})
: _vm._e(),
_vm._v(" "),
children.type == "Checkbox"
? _c(
"v-container",
{ attrs: { fluid: "" } },
[
_c("p", [
_vm._v(_vm._s(children.name))
]),
_vm._v(" "),
_vm._l(children.options, function(
optionValue,
keyOption
) {
return _c("v-checkbox", {
key: keyOption,
attrs: {
label: optionValue.title,
value: optionValue.id
},
model: {
value:
_vm.formData[
children.name
],
callback: function($$v) {
_vm.$set(
_vm.formData,
children.name,
$$v
)
},
expression:
"formData[children.name]"
}
})
})
],
2
)
: _vm._e()
],
1
)
}),
1
)
]
: _vm._e()