| | |
| | | //下拉框所有值 select option |
| | | var OptionList = []; |
| | | const ddElementsOptionList = document.querySelectorAll("select option"); |
| | | |
| | | // 遍历元素并获取内容 |
| | | ddElementsOptionList.forEach((dd, index) => { |
| | | OptionList.push(dd.innerText.trim()); |
| | | }); |
| | | |
| | | |
| | | //表格列数据 |
| | | var tableColData = []; |
| | | const tableColDataList = document.querySelectorAll(".layui-table tr span"); |
| | | // 遍历元素并获取内容 |
| | | tableColDataList.forEach((dd, index) => { |
| | | tableColData.push(dd.innerText.trim()); |
| | | }); |
| | | |
| | | for (var i = 0; i < data.length; i++) { |
| | | var HTranslationText = ""; |
| | | |
| | |
| | | if (document.querySelectorAll("#" + data[i].HFieldCode)[0].innerHTML == data[i].HFieldName) { |
| | | document.querySelectorAll("#" + data[i].HFieldCode)[0].innerHTML = document.querySelectorAll("#" + data[i].HFieldCode)[0].innerHTML.replace(data[i].HFieldName.replace('*', ''), HTranslationText.replace('*', '')); |
| | | } else if (document.querySelectorAll("#" + data[i].HFieldCode)[0].innerText == data[i].HFieldName) { |
| | | document.querySelectorAll("#" + data[i].HFieldCode)[0].innerHTML = document.querySelectorAll("#" + data[i].HFieldCode)[0].innerHTML.replace(data[i].HFieldName.replace('*', ''), HTranslationText.replace('*', '')); |
| | | document.querySelectorAll("#" + data[i].HFieldCode)[0].innerHTML = document.querySelectorAll("#" + data[i].HFieldCode)[0].innerText.replace(data[i].HFieldName.replace('*', ''), HTranslationText.replace('*', '')); |
| | | } else { |
| | | document.querySelectorAll("#" + data[i].HFieldCode)[0].innerText = document.querySelectorAll("#" + data[i].HFieldCode)[0].innerText.replace(data[i].HFieldName.replace('*', ''), HTranslationText.replace('*', '')); |
| | | } |
| | |
| | | |
| | | if (InitiaType != 2) { |
| | | if (data[i].HFieldCode != "select option") { |
| | | var count = document.querySelectorAll(data[i].HFieldCode).length; |
| | | for (var j = 0; j < count; j++) { |
| | | if (document.querySelectorAll(data[i].HFieldCode)[j].innerText.trim() == data[i].HFieldName) { |
| | | document.querySelectorAll(data[i].HFieldCode)[j].innerHTML = document.querySelectorAll(data[i].HFieldCode)[j].innerHTML.replace(data[i].HFieldName, HTranslationText); |
| | | if (data[i].HFieldCode != ".layui-table tr span") { |
| | | var count = document.querySelectorAll(data[i].HFieldCode).length; |
| | | for (var j = 0; j < count; j++) { |
| | | if (document.querySelectorAll(data[i].HFieldCode)[j].innerText.trim() == data[i].HFieldName) { |
| | | document.querySelectorAll(data[i].HFieldCode)[j].innerHTML = document.querySelectorAll(data[i].HFieldCode)[j].innerHTML.replace(data[i].HFieldName, HTranslationText); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | |
| | | } |
| | | |
| | | for (var j = 0; j < indicesList.length; j++) { |
| | | document.querySelectorAll(data[i].HFieldCode)[indicesList[j]].innerHTML = document.querySelectorAll(data[i].HFieldCode)[indicesList[j]].innerHTML.replace(data[i].HFieldName, HTranslationText); |
| | | document.querySelectorAll(data[i].HFieldCode)[indicesList[j]].innerText = document.querySelectorAll(data[i].HFieldCode)[indicesList[j]].innerText.replace(data[i].HFieldName, HTranslationText); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | if (data[i].HFieldCode != "select option") { |
| | | if (data[i].HFieldCode != "select option" && data[i].HFieldCode != ".layui-table tr span") { |
| | | var count = document.querySelectorAll(data[i].HFieldCode).length; |
| | | for (var j = 0; j < count; j++) { |
| | | if (document.querySelectorAll(data[i].HFieldCode)[j].innerText.trim() == data[i].HFieldName) { |
| | |
| | | } |
| | | } |
| | | |
| | | //表格列数据 |
| | | if (data[i].HFieldCode == ".layui-table tr span") { |
| | | var indicesData = []; |
| | | var currentIndex = -1; |
| | | while ((currentIndex = tableColData.indexOf(data[i].HFieldName, currentIndex + 1)) !== -1) { |
| | | indicesData.push(currentIndex); |
| | | } |
| | | if (data[i].HFieldCode != "select option") { |
| | | for (var j = 0; j < indicesData.length; j++) { |
| | | document.querySelectorAll(data[i].HFieldCode)[indicesData[j]].innerHTML = document.querySelectorAll(data[i].HFieldCode)[indicesData[j]].innerHTML.replace(data[i].HFieldName, HTranslationText); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //下拉框的默认值 |
| | | if (data[i].HFieldCode == ".layui-unselect input") { |
| | | var uncount = document.querySelectorAll(".layui-unselect input").length; |