|
@@ -62,19 +62,30 @@ function mount() {
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
- Vue.prototype.getControlItem = (nameList, funs, values, paramsList) => {
|
|
|
- let list = nameList.map(v => funs[v])
|
|
|
+ Vue.prototype.getControlItem = (nameList, detail, specialType = {}) => {
|
|
|
+ let list = nameList.map(v => detail.function[v])
|
|
|
for (const key in list) {
|
|
|
- const name = Object.entries(list[key].params)[0][0]
|
|
|
- list[key].paramName = name;
|
|
|
- list[key].params = paramsList[name];
|
|
|
- list[key].paramValue = values[name]
|
|
|
- list[key].isfeedback = list[key].isfeedback && (list[key].paramValue != list[key].params.lastvalue)
|
|
|
- if (list[key].params.datatype == "boolean") {
|
|
|
- list[key].inputType = 'switch';
|
|
|
- list[key].showValue = list[key].params.options.find(v => v.value == list[key].params.lastvalue).label
|
|
|
- } else {
|
|
|
- list[key].inputType = list[key].params.num_step ? 'step' : 'int';
|
|
|
+ try {
|
|
|
+ const name = Object.entries(list[key].params)[0][0]
|
|
|
+ list[key].paramName = name;
|
|
|
+ list[key].params = detail.params[name];
|
|
|
+ list[key].paramValue = detail.paramcmdvalues[name]
|
|
|
+ list[key].isfeedback = (detail.isfeedback == 1 && (detail.paramcmdvalues[name] != detail.paramvalues[name])) ? true : false;
|
|
|
+ if (list[key].params.datatype == "boolean") {
|
|
|
+ list[key].inputType = 'switch';
|
|
|
+ list[key].showValue = "";
|
|
|
+ if (list[key].params.lastvalue + '') list[key].showValue = list[key].params.options.find(v => v.value == list[key].params.lastvalue).label || ""
|
|
|
+ } else if (specialType[nameList[key]] || false) {
|
|
|
+ list[key].inputType = specialType[nameList[key]];
|
|
|
+ if (["radio"].includes(specialType[nameList[key]])) {
|
|
|
+ list[key].showValue = "";
|
|
|
+ if (list[key].params.lastvalue + '') list[key].showValue = list[key].params.options.find(v => v.value == list[key].params.lastvalue).label || ""
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list[key].inputType = list[key].params.num_step ? 'step' : 'int';
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log("出错项", list[key].funcname, list[key])
|
|
|
}
|
|
|
}
|
|
|
return list
|