Commit c13d88ef authored by Medicean's avatar Medicean

(Fix:Setting) 修复解码器与编码器名称重复时不能添加的问题

parent 44d3afc2
...@@ -138,7 +138,7 @@ class Encoders { ...@@ -138,7 +138,7 @@ class Encoders {
toastr.error(LANG["message"]["ename_invalid"], LANG_T['error']); toastr.error(LANG["message"]["ename_invalid"], LANG_T['error']);
return return
} }
if (that._checkname(nValue, oetype)) { if (that._checkname(nValue, oetype, oedtype)) {
toastr.error(LANG['message']['ename_duplicate'], LANG_T['error']); toastr.error(LANG['message']['ename_duplicate'], LANG_T['error']);
return; return;
} }
...@@ -151,7 +151,7 @@ class Encoders { ...@@ -151,7 +151,7 @@ class Encoders {
toastr.error(LANG['message']["etype_error"], LANG_T['error']); toastr.error(LANG['message']["etype_error"], LANG_T['error']);
return return
} }
if (that._checkname(oename, nValue)) { if (that._checkname(oename, nValue, oedtype)) {
toastr.error(LANG['message']['ename_duplicate'], LANG_T['error']); toastr.error(LANG['message']['ename_duplicate'], LANG_T['error']);
return; return;
} }
...@@ -190,7 +190,7 @@ class Encoders { ...@@ -190,7 +190,7 @@ class Encoders {
toastr.error(LANG["message"]["ename_invalid"], LANG_T['error']); toastr.error(LANG["message"]["ename_invalid"], LANG_T['error']);
return return
} }
if (self._checkname(value, type)) { if (self._checkname(value, type, edtype)) {
toastr.error(LANG["message"]["ename_duplicate"], LANG_T['error']); toastr.error(LANG["message"]["ename_duplicate"], LANG_T['error']);
layer.close(i); layer.close(i);
return return
...@@ -550,8 +550,9 @@ module.exports = { ...@@ -550,8 +550,9 @@ module.exports = {
}`; }`;
} }
// 检查 name 是否重复 // 检查 name 是否重复
_checkname(name, t) { _checkname(name, t, edtype) {
let tstr = ',' + antSword['encoders'][t].join(',') + ','; let key = `${edtype}s`;
let tstr = ',' + antSword[key][t].join(',') + ',';
return tstr.indexOf("," + name + ",") != -1; return tstr.indexOf("," + name + ",") != -1;
} }
// 解析数据 // 解析数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment