subquantity on each bancai added
This commit is contained in:
parent
cc6d2a4336
commit
5c5acf08d1
@ -106,46 +106,3 @@ const data = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default data;
|
export default data;
|
||||||
/*
|
|
||||||
{
|
|
||||||
id: 1235,
|
|
||||||
matierial: '生态板 ',
|
|
||||||
color: '暖白',
|
|
||||||
boardInfos: [
|
|
||||||
{
|
|
||||||
houseName: 'F01',
|
|
||||||
closetName: 'G01',
|
|
||||||
boardNo: 'B1816478862',
|
|
||||||
boardName: '背板',
|
|
||||||
length: 944,
|
|
||||||
width: 598,
|
|
||||||
thickness: 18,
|
|
||||||
quantity: 1,
|
|
||||||
area: 0.568,
|
|
||||||
mutation: '',
|
|
||||||
shape: '',
|
|
||||||
direction: '1/1/1/1 ',
|
|
||||||
stripe: '正纹',
|
|
||||||
boardAddOn: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
houseName: 'F01',
|
|
||||||
closetName: 'G01',
|
|
||||||
boardNo: 'B1816478861',
|
|
||||||
|
|
||||||
boardName: '背板',
|
|
||||||
length: 944,
|
|
||||||
width: 598,
|
|
||||||
thickness: 18,
|
|
||||||
quantity: 1,
|
|
||||||
area: 0.568,
|
|
||||||
mutation: '',
|
|
||||||
shape: '',
|
|
||||||
direction: '1/1/1/1 ',
|
|
||||||
stripe: '正纹',
|
|
||||||
boardAddOn: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
@ -704,7 +704,30 @@ const initialTemplateData = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ rowId: 8, rowTitle: '8', cells: [] },
|
{
|
||||||
|
rowId: 8,
|
||||||
|
rowTitle: '8',
|
||||||
|
cells: [
|
||||||
|
{
|
||||||
|
cellId: 9047,
|
||||||
|
title: '小计:',
|
||||||
|
colspan: 10,
|
||||||
|
height: 30,
|
||||||
|
textAlign: 'right',
|
||||||
|
fontSize: 16,
|
||||||
|
fontStyle: 'bold',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cellId: 9048,
|
||||||
|
title: 'subquantity',
|
||||||
|
colspan: 14,
|
||||||
|
height: 30,
|
||||||
|
textAlign: 'left',
|
||||||
|
fontSize: 16,
|
||||||
|
fontStyle: 'normal',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{ rowId: 9, rowTitle: '9', cells: [] },
|
{ rowId: 9, rowTitle: '9', cells: [] },
|
||||||
{ rowId: 10, rowTitle: '10', cells: [] },
|
{ rowId: 10, rowTitle: '10', cells: [] },
|
||||||
{ rowId: 11, rowTitle: '11', cells: [] },
|
{ rowId: 11, rowTitle: '11', cells: [] },
|
||||||
|
@ -69,7 +69,7 @@ import reportCell from './reportCell.vue';
|
|||||||
import test from './orderTitle.vue';
|
import test from './orderTitle.vue';
|
||||||
|
|
||||||
let rowId = 29; // this figure is for testing use
|
let rowId = 29; // this figure is for testing use
|
||||||
let cellId = 9046; // this figure is for testing use
|
let cellId = 9050; // this figure is for testing use
|
||||||
let undoRodoPointer = -1;
|
let undoRodoPointer = -1;
|
||||||
let isundoOrRedoClick = false;
|
let isundoOrRedoClick = false;
|
||||||
let isUpdateInfos = true;
|
let isUpdateInfos = true;
|
||||||
@ -317,6 +317,7 @@ export default Vue.extend({
|
|||||||
if (dataKey === cell.title) {
|
if (dataKey === cell.title) {
|
||||||
foundMatchedString = true;
|
foundMatchedString = true;
|
||||||
cell.title = this.data[dataKey];
|
cell.title = this.data[dataKey];
|
||||||
|
console.log('找到', this.data[dataKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,39 +365,60 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const banCaiRow of banCaiRowsHolder) {
|
for (const banCaiRow of banCaiRowsHolder) {
|
||||||
this.infos.splice(
|
if (banCaiRow.cells.length !== 0) {
|
||||||
index + 1 + banCaiRowsHolder.indexOf(banCaiRow),
|
this.infos.splice(
|
||||||
0,
|
index + 1 + banCaiRowsHolder.indexOf(banCaiRow),
|
||||||
banCaiRow,
|
0,
|
||||||
);
|
banCaiRow,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index) {
|
||||||
|
this.infos.splice(index, 1); // 删除matched 的字段
|
||||||
}
|
}
|
||||||
this.infos.splice(index, 1); // 删除matched 的字段
|
|
||||||
};
|
};
|
||||||
const copyBanCaiHeader = () => {
|
const copyBanCaiHeader = () => {
|
||||||
const matchedRowIdHolder = [];
|
const matchedRowIndexHolder = [];
|
||||||
|
const boardInfosKeysHolder = [];
|
||||||
|
for (const boardHeaderKey of Object.keys(data.boards[0])) {
|
||||||
|
if (boardInfosKeysHolder.indexOf(boardHeaderKey) === -1) {
|
||||||
|
boardInfosKeysHolder.push(boardHeaderKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const boardHeaderKey of Object.keys(
|
||||||
|
data.boards[0].boardInfos[0],
|
||||||
|
)) {
|
||||||
|
if (boardInfosKeysHolder.indexOf(boardHeaderKey) === -1) {
|
||||||
|
boardInfosKeysHolder.push(boardHeaderKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const row of this.infos) {
|
for (const row of this.infos) {
|
||||||
for (const cell of row.cells) {
|
for (const cell of row.cells) {
|
||||||
if (data.boards[0].hasOwnProperty(cell.title)) {
|
if (
|
||||||
if (matchedRowIdHolder.indexOf(this.infos.indexOf(row)) === -1) {
|
boardInfosKeysHolder.indexOf(cell.title) !== -1 ||
|
||||||
matchedRowIdHolder.push(this.infos.indexOf(row));
|
boardInfosKeysHolder.indexOf(cell.title.toString().slice(3)) !==
|
||||||
}
|
-1
|
||||||
} else if (
|
|
||||||
data.boards[0].boardInfos[0].hasOwnProperty(cell.title)
|
|
||||||
) {
|
) {
|
||||||
if (matchedRowIdHolder.indexOf(this.infos.indexOf(row)) === -1) {
|
if (
|
||||||
matchedRowIdHolder.push(this.infos.indexOf(row));
|
matchedRowIndexHolder.indexOf(this.infos.indexOf(row)) === -1
|
||||||
|
) {
|
||||||
|
matchedRowIndexHolder.push(this.infos.indexOf(row));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchedRowHolder = [];
|
const matchedRowHolder = [];
|
||||||
|
|
||||||
for (let index = 0; index <= matchedRowIdHolder[1]; index += 1) {
|
for (
|
||||||
|
let index = 0;
|
||||||
|
index <= matchedRowIndexHolder[matchedRowIndexHolder.length - 1];
|
||||||
|
index += 1
|
||||||
|
) {
|
||||||
if (
|
if (
|
||||||
index >= matchedRowIdHolder[0] &&
|
index >= matchedRowIndexHolder[0] &&
|
||||||
index <= matchedRowIdHolder[1]
|
index <= matchedRowIndexHolder[matchedRowIndexHolder.length - 1]
|
||||||
) {
|
) {
|
||||||
const matchedRow = JSON.parse(JSON.stringify(this.infos[index]));
|
const matchedRow = JSON.parse(JSON.stringify(this.infos[index]));
|
||||||
matchedRow.rowId = ++rowId;
|
matchedRow.rowId = ++rowId;
|
||||||
@ -432,12 +454,32 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const addSubTotal = (boardInfos) => {
|
||||||
|
let amountHolder = 0;
|
||||||
|
|
||||||
|
for (const row of this.infos) {
|
||||||
|
for (const cell of row.cells) {
|
||||||
|
if (cell.title === 'subquantity') {
|
||||||
|
for (const eachBoardInfo of boardInfos) {
|
||||||
|
for (const detail in eachBoardInfo) {
|
||||||
|
if (detail === cell.title.slice(3)) {
|
||||||
|
amountHolder += eachBoardInfo[detail];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cell.title = amountHolder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
if (addOrderTitle()) {
|
if (addOrderTitle()) {
|
||||||
addOrderTitle();
|
addOrderTitle();
|
||||||
for (const board of data.boards) {
|
for (const board of data.boards) {
|
||||||
const x = copyBanCaiHeader();
|
const x = copyBanCaiHeader(); // 复制板材表头备用
|
||||||
addBanCaiHeader(board);
|
addBanCaiHeader(board); // 添加板材表头
|
||||||
addBanCaiBody(board);
|
addBanCaiBody(board); // 添加板材表身
|
||||||
|
addSubTotal(board.boardInfos); // 添加 小计
|
||||||
|
// 添加 板材内的每一条信息
|
||||||
if (data.boards.indexOf(board) !== data.boards.length - 1) {
|
if (data.boards.indexOf(board) !== data.boards.length - 1) {
|
||||||
pasteBanCaiHeader(x);
|
pasteBanCaiHeader(x);
|
||||||
}
|
}
|
||||||
@ -507,60 +549,3 @@ table {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
/*
|
|
||||||
importData() {
|
|
||||||
x += 1;
|
|
||||||
for (const row of this.infos) {
|
|
||||||
for (const cell of row.cells) {
|
|
||||||
// userdata for loop
|
|
||||||
for (const userData in this.importedData) {
|
|
||||||
if (userData + ':' === cell.title) {
|
|
||||||
cell.title += this.importedData[userData];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const boards of this.importedData.boards) {
|
|
||||||
for (const board in boards) {
|
|
||||||
if (board + ':' === cell.title) {
|
|
||||||
cell.title += boards[board];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const row of this.infos) {
|
|
||||||
// get each cell
|
|
||||||
console.log(x);
|
|
||||||
const borderInfo: any = this.importedData.boards[x].boardInfos;
|
|
||||||
for (const details of borderInfo) {
|
|
||||||
const tem: any[] = [];
|
|
||||||
for (const each of Object.keys(details)) {
|
|
||||||
for (const cell of row.cells) {
|
|
||||||
if (each === cell.title) {
|
|
||||||
tem.push({
|
|
||||||
cellId: (cellId += 1),
|
|
||||||
title: details[each],
|
|
||||||
colspan: cell.colspan,
|
|
||||||
height: 30,
|
|
||||||
textAlign: 'center',
|
|
||||||
fontSize: 16,
|
|
||||||
fontStyle: 'normal',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tem.length) {
|
|
||||||
for (const eachRow in this.infos) {
|
|
||||||
if (!this.infos[eachRow].cells.length) {
|
|
||||||
this.infos[eachRow].cells = this.infos[eachRow].cells.concat(
|
|
||||||
tem,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user