Added global mixin onDynamicFormParams method.
This commit is contained in:
parent
60f79340fd
commit
a696f71069
10
public/css/custom.css
vendored
10
public/css/custom.css
vendored
@ -1749,3 +1749,13 @@ table .align-items-center td span.badge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Disable default html styling for input[type="number] Finish */
|
/* Disable default html styling for input[type="number] Finish */
|
||||||
|
|
||||||
|
.remove-arrow-select .el-input__inner {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
cursor: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-arrow-select .el-select__caret {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
29
resources/assets/js/mixins/global.js
vendored
29
resources/assets/js/mixins/global.js
vendored
@ -364,6 +364,33 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onDynamicFormParams(path, params) {
|
||||||
|
let data = {};
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(params)) {
|
||||||
|
data[key] = eval(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.get(path, {
|
||||||
|
params: data
|
||||||
|
}).then(response => {
|
||||||
|
if (response.data.data) {
|
||||||
|
let rows = response.data.data;
|
||||||
|
|
||||||
|
if (!Array.isArray(rows)) {
|
||||||
|
for (const [key, value] of Object.entries(rows)) {
|
||||||
|
this.form[key] = value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rows.forEach(function (key, index) {
|
||||||
|
this.form[index] = key;
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// Delete attachment file
|
// Delete attachment file
|
||||||
onDeleteFile(file_id, url, title, message, button_cancel, button_delete) {
|
onDeleteFile(file_id, url, title, message, button_cancel, button_delete) {
|
||||||
let file_data = {
|
let file_data = {
|
||||||
@ -450,6 +477,6 @@ export default {
|
|||||||
let currency_code = (contact.currency_code) ? contact.currency_code : this.form.currency_code;
|
let currency_code = (contact.currency_code) ? contact.currency_code : this.form.currency_code;
|
||||||
|
|
||||||
this.onChangeCurrency(currency_code);
|
this.onChangeCurrency(currency_code);
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user