Commit 141299b0 authored by yu's avatar yu

表单数据刷新

parent 268fb226
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
<div style="margin-right: 20px;width: 150px;text-align: right;"> <div style="margin-right: 20px;width: 150px;text-align: right;">
<span style="line-height: 55px;">文字分组</span> <span style="line-height: 55px;">文字分组</span>
</div> </div>
<div style="display: flex; justify-items: center; padding-top: 10px"> <div *ngIf="item.titleGroup.length<item.title.length" style="display: flex; justify-items: center; padding-top: 10px">
<button style="margin-bottom: 10px;" nz-button nzType="default" (click)="addGroup(i)"> <button style="margin-bottom: 10px;" nz-button nzType="default" (click)="addGroup(i)">
<span>增加分组</span> <span>增加分组</span>
</button> </button>
......
...@@ -186,13 +186,41 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -186,13 +186,41 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
deleteGroup(i, n) { deleteGroup(i, n) {
let item = this.picArr.list[i]; let item = this.picArr.list[i];
item.titleGroup.splice(n, 1); item.titleGroup.splice(n, 1);
let delArr = item.titleGroupUseWord[n];
item.titleGroupUseWord.forEach((arr, index) => {
if (index == n) return;
for (let m = 0; m < delArr.length; m++) {
if (delArr[m] == 0) arr[m] = 0;
}
})
item.titleGroupUseWord.splice(n, 1);
let lastArr = [];
item.titleGroupUseWord.forEach((arr, index) => {
for (let m = 0; m < arr.length; m++) {
if (arr[m] == 1) {
lastArr[m] = 1;
} else {
if (lastArr[m] != 1) {
lastArr[m] = 0;
}
}
}
})
item.titleGroupUseWord.push(lastArr);
if (item.titleGroup.length == 0) item.titleGroupUseWord.length = 0;
this.save(); this.save();
} }
onChoseGroup(arr, i, val, item, n) { onChoseGroup(arr, i, val, item, n) {
console.log(arr); console.log(arr);
arr[i] = val; arr[i] = val;
for (let index = 0; index < item.title.split("").length; index++) { for (let index = 0; index < item.title.split("").length; index++) {
if (n == index) continue; if (n == index) {
if (!item.titleGroupUseWord[index]) item.titleGroupUseWord[index] = [];
item.titleGroupUseWord[index][i] = 0;
console.log(item.titleGroupUseWord[index])
continue;
}
if (!item.titleGroupUseWord[index]) item.titleGroupUseWord[index] = []; if (!item.titleGroupUseWord[index]) item.titleGroupUseWord[index] = [];
item.titleGroupUseWord[index][i] = val; item.titleGroupUseWord[index][i] = val;
} }
......
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