Index: vue/src/assets/images/devops/DevSupport/github.png =================================================================== diff -u -r49f8f74c8cdfbaea5889e5a3b3e6470ab0b50463 -r30b75fcc938cea7e2e25feb948cddbfcf80473bc --- vue/src/assets/images/devops/DevSupport/github.png (.../github.png) (revision 49f8f74c8cdfbaea5889e5a3b3e6470ab0b50463) +++ vue/src/assets/images/devops/DevSupport/github.png (.../github.png) (revision 30b75fcc938cea7e2e25feb948cddbfcf80473bc) @@ -1538,7 +1538,7 @@ #reqDataTable { margin-bottom: 0; min-height: 300px; - max-height: 800px; + max-height: 721px; overflow: auto; } @@ -1564,6 +1564,12 @@ text-align: left; } +#reqDataTable .reqTable .tbody input { + width: 100%; + border: 0 none; + background: 0 none; +} + #reqDataTable .reqTable .tbody tr:nth-child(odd) { background-color: rgba(51, 51, 51, 0.325); } Index: arms/js/reqAddTable.js =================================================================== diff -u -ra8086ba49f0bda615f950a395933c7fbd1081e0e -r30b75fcc938cea7e2e25feb948cddbfcf80473bc --- arms/js/reqAddTable.js (.../reqAddTable.js) (revision a8086ba49f0bda615f950a395933c7fbd1081e0e) +++ arms/js/reqAddTable.js (.../reqAddTable.js) (revision 30b75fcc938cea7e2e25feb948cddbfcf80473bc) @@ -12,6 +12,8 @@ makeRow(rows, tag) { return rows.reduce((acc, cur) => { const $tr = this.makeElement("tr"); + $tr.setAttribute("data-id", cur.id); + Object.keys(this.options.content).forEach((key) => { const $col = this.makeElement(tag); $col.className = key; @@ -36,11 +38,39 @@ return $tbody; } + removeInput(input, node) { + const { origin } = this.$data.find((item) => item.id === Number(node.parentElement.dataset.id)); + origin.data = input.value; + node.textContent = input.value; + + console.log("#### update ", origin); + } + + addInput(node) { + const uuid = crypto.randomUUID(); + const text = node.textContent; + const $input = document.createElement("input"); + $input.id = uuid; + $input.addEventListener("blur", () => this.removeInput($input, node)); + + node.textContent = ""; + node.appendChild($input); + document.getElementById(uuid).value = text; + document.getElementById(uuid).focus(); + } + makeSection(rowData, name, col) { const $el = this.makeElement(name); $el.className = name; this.makeRow(rowData, col).forEach((r) => $el.append(r)); + $el.addEventListener("click", (e) => { + if (e.target.tagName !== "TD") return; + if (e.target.classList.contains("content")) { + this.addInput(e.target); + } + }); + return $el; }