Added global mixin onDynamicFormParams method.
This commit is contained in:
parent
60f79340fd
commit
a696f71069
16
public/css/custom.css
vendored
16
public/css/custom.css
vendored
@ -1740,12 +1740,22 @@ table .align-items-center td span.badge {
|
||||
|
||||
.input-number-disabled::-webkit-inner-spin-button,
|
||||
.input-number-disabled::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.input-number-disabled {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
/* 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
|
||||
onDeleteFile(file_id, url, title, message, button_cancel, button_delete) {
|
||||
let file_data = {
|
||||
@ -450,6 +477,6 @@ export default {
|
||||
let currency_code = (contact.currency_code) ? contact.currency_code : this.form.currency_code;
|
||||
|
||||
this.onChangeCurrency(currency_code);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user