feat: 开放服务器切换并修复扫码方式列表
This commit is contained in:
@@ -83,7 +83,7 @@ export default {
|
||||
const res = await this.$u.api.dictionary.getDetailEnumList({
|
||||
dictionary_id: DICTIONARY_TYPE_SCANNER,
|
||||
});
|
||||
const list = Array.isArray(res) ? res : [];
|
||||
const list = Array.isArray(res) ? res : (Array.isArray(res && res.list) ? res.list : []);
|
||||
const builtinConfigs = this.getScannerConfigs();
|
||||
if (list.length) {
|
||||
this.configList = list
|
||||
@@ -98,6 +98,7 @@ export default {
|
||||
this.useFallbackConfigList();
|
||||
}
|
||||
this.ensurePhoneScanOption();
|
||||
this.ensureNlscanOption();
|
||||
this.initFormFromSaved();
|
||||
},
|
||||
useFallbackConfigList() {
|
||||
@@ -110,6 +111,24 @@ export default {
|
||||
this.configList.push(phoneConfig);
|
||||
}
|
||||
},
|
||||
ensureNlscanOption() {
|
||||
const nlscanConfig = this.getScannerConfigs().find((item) => item.brand === 'nlscan');
|
||||
if (!nlscanConfig) {
|
||||
return;
|
||||
}
|
||||
const exists = this.configList.some((item) => {
|
||||
return item.brand === nlscanConfig.brand || item.action === nlscanConfig.action;
|
||||
});
|
||||
if (exists) {
|
||||
return;
|
||||
}
|
||||
const phoneIndex = this.configList.findIndex((item) => item.brand === PHONE_SCAN_BRAND);
|
||||
if (phoneIndex >= 0) {
|
||||
this.configList.splice(phoneIndex, 0, nlscanConfig);
|
||||
return;
|
||||
}
|
||||
this.configList.push(nlscanConfig);
|
||||
},
|
||||
initFormFromSaved() {
|
||||
const savedConfig = getScanConfig(this.getScannerConfigs());
|
||||
if (savedConfig) {
|
||||
|
||||
Reference in New Issue
Block a user