hand in for review
This commit is contained in:
parent
a1cc5c7677
commit
e2d7f832ad
@ -102,6 +102,101 @@ const data = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 1234,
|
||||||
|
material: '颗粒板',
|
||||||
|
color: '暖白',
|
||||||
|
boardInfos: [
|
||||||
|
{
|
||||||
|
houseName: 'F01',
|
||||||
|
closetName: 'G01',
|
||||||
|
boardNo: 'B1816478862',
|
||||||
|
boardName: '背板',
|
||||||
|
length: 944,
|
||||||
|
width: 59,
|
||||||
|
thickness: 18,
|
||||||
|
quantity: 1,
|
||||||
|
area: 0.568,
|
||||||
|
mutation: '',
|
||||||
|
shape: '',
|
||||||
|
direction: '1/1/1/1 ',
|
||||||
|
stripe: '正纹',
|
||||||
|
boardAddOn: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: '2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
houseName: 'F01',
|
||||||
|
closetName: 'G01',
|
||||||
|
boardNo: 'B1816478875',
|
||||||
|
boardName: '右侧板',
|
||||||
|
length: 1198,
|
||||||
|
width: 548,
|
||||||
|
thickness: 18,
|
||||||
|
quantity: 1,
|
||||||
|
area: 0.66,
|
||||||
|
mutation: '',
|
||||||
|
shape: '造型',
|
||||||
|
direction: '1/1/1/1 ',
|
||||||
|
stripe: '正纹',
|
||||||
|
boardAddOn: '3',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1235,
|
||||||
|
material: '生态板 ',
|
||||||
|
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: '4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: '5',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
const Tool = {
|
const Tool = {
|
||||||
addRow: (that, rowId) => {
|
addRow: (that: any, rowId: number) => {
|
||||||
if (that.selectedRow) {
|
if (that.selectedRow) {
|
||||||
for (const index in that.infos) {
|
for (const index in that.infos) {
|
||||||
if (that.selectedRow === that.infos[index].rowId) {
|
if (that.selectedRow === that.infos[index].rowId) {
|
||||||
that.infos.splice(Number(index), 0, {
|
that.infos.splice(Number(index), 0, {
|
||||||
rowId: rowId,
|
rowId,
|
||||||
rowTitle: rowId.toString(),
|
rowTitle: rowId.toString(),
|
||||||
cells: [],
|
cells: [],
|
||||||
});
|
});
|
||||||
@ -20,21 +20,23 @@ const Tool = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteRow: (that) => {
|
deleteRow: (that: any) => {
|
||||||
if (!that.selectedRow) {
|
if (!that.selectedRow) {
|
||||||
return alert('请选择要删除行');
|
return alert('请选择要删除行');
|
||||||
}
|
}
|
||||||
that.infos = that.infos.filter((item) => item.rowId !== that.selectedRow);
|
that.infos = that.infos.filter(
|
||||||
|
(item: any) => item.rowId !== that.selectedRow,
|
||||||
|
);
|
||||||
that.selectedRow = 0;
|
that.selectedRow = 0;
|
||||||
},
|
},
|
||||||
addCell: (that, cellId) => {
|
addCell: (that: any, cellId: number) => {
|
||||||
if (!that.selectedRow) {
|
if (!that.selectedRow) {
|
||||||
return alert('请选择要添加单元的行');
|
return alert('请选择要添加单元的行');
|
||||||
}
|
}
|
||||||
for (const row of that.infos) {
|
for (const row of that.infos) {
|
||||||
if (that.selectedRow === row.rowId) {
|
if (that.selectedRow === row.rowId) {
|
||||||
row.cells.push({
|
row.cells.push({
|
||||||
cellId: cellId,
|
cellId,
|
||||||
title: '列' + cellId,
|
title: '列' + cellId,
|
||||||
colspan: 0,
|
colspan: 0,
|
||||||
height: 30,
|
height: 30,
|
||||||
@ -46,7 +48,7 @@ const Tool = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteCell: (that) => {
|
deleteCell: (that: any) => {
|
||||||
// 9000 is initial cell Id.
|
// 9000 is initial cell Id.
|
||||||
if (that.selectedCell === 9000) {
|
if (that.selectedCell === 9000) {
|
||||||
return alert('请选择要删除的单元');
|
return alert('请选择要删除的单元');
|
||||||
|
@ -728,30 +728,7 @@ const initialTemplateData = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
rowId: 9,
|
|
||||||
rowTitle: '9',
|
|
||||||
cells: [
|
|
||||||
{
|
|
||||||
cellId: 9050,
|
|
||||||
title: '总计:',
|
|
||||||
colspan: '10',
|
|
||||||
height: 30,
|
|
||||||
textAlign: 'right',
|
|
||||||
fontSize: 16,
|
|
||||||
fontStyle: 'bold',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
cellId: 9051,
|
|
||||||
title: 'totalquantity',
|
|
||||||
colspan: '14',
|
|
||||||
height: 30,
|
|
||||||
textAlign: 'center',
|
|
||||||
fontSize: 16,
|
|
||||||
fontStyle: 'normal',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{ rowId: 10, rowTitle: '10', cells: [] },
|
{ rowId: 10, rowTitle: '10', cells: [] },
|
||||||
{ rowId: 11, rowTitle: '11', cells: [] },
|
{ rowId: 11, rowTitle: '11', cells: [] },
|
||||||
{ rowId: 12, rowTitle: '12', cells: [] },
|
{ rowId: 12, rowTitle: '12', cells: [] },
|
||||||
|
@ -42,16 +42,16 @@
|
|||||||
<label for="three">居右</label>
|
<label for="three">居右</label>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div>
|
|
||||||
<span>选择板材头模板:</span><br>
|
|
||||||
<span>开始:</span><input type="number" v-model="banCaiHeadStartLine"><br>
|
|
||||||
<span>结束:</span><input type="number" v-model="banCaiHeadEndLine">
|
|
||||||
<button @click="copyBanCaiHeadTemplate">确定板材头</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<p style="color: blue">以下功能用于测试使用</p>
|
<p style="color: blue">以下功能用于测试使用</p>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>选择板材头模板:</span><br>
|
||||||
|
<span>开始:</span><input type="number" v-model="banCaiHeadStartLine"><br>
|
||||||
|
<span>结束:</span><input type="number" v-model="banCaiHeadEndLine">
|
||||||
|
<button @click="copyBanCaiHeadTemplate">确定板材头</button>
|
||||||
|
</div>
|
||||||
<button @click="importTemplate">导入设计样式</button>
|
<button @click="importTemplate">导入设计样式</button>
|
||||||
<button @click="importData">导入数据</button><br>
|
<button @click="importData">导入数据</button><br>
|
||||||
<label>单元ID:</label>
|
<label>单元ID:</label>
|
||||||
@ -74,13 +74,9 @@ import data from '@/assets/data'; // userdata for testing use
|
|||||||
import reportCell from './reportCell.vue';
|
import reportCell from './reportCell.vue';
|
||||||
import test from './orderTitle.vue';
|
import test from './orderTitle.vue';
|
||||||
import { Tool } from '@/assets/methodTool';
|
import { Tool } from '@/assets/methodTool';
|
||||||
import { debug } from 'util';
|
|
||||||
|
|
||||||
let rowId = 30; // this figure is for testing use
|
let rowId = 30; // this figure is for testing use
|
||||||
let cellId = 9050; // this figure is for testing use
|
let cellId = 9050; // this figure is for testing use
|
||||||
let undoRodoPointer = -1;
|
|
||||||
let isundoOrRedoClick = false;
|
|
||||||
let isUpdateInfos = true;
|
|
||||||
let copiedRowHolder: any;
|
let copiedRowHolder: any;
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
@ -120,6 +116,8 @@ export default Vue.extend({
|
|||||||
fontSize: number;
|
fontSize: number;
|
||||||
fontStyle: string;
|
fontStyle: string;
|
||||||
};
|
};
|
||||||
|
banCaiHeadStartLine: string;
|
||||||
|
banCaiHeadEndLine: string;
|
||||||
} {
|
} {
|
||||||
return {
|
return {
|
||||||
infos: startUpRowColumn,
|
infos: startUpRowColumn,
|
||||||
@ -143,8 +141,8 @@ export default Vue.extend({
|
|||||||
fontSize: 0,
|
fontSize: 0,
|
||||||
fontStyle: '',
|
fontStyle: '',
|
||||||
},
|
},
|
||||||
banCaiHeadStartLine: 5,
|
banCaiHeadStartLine: '5',
|
||||||
banCaiHeadEndLine: 8,
|
banCaiHeadEndLine: '8',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -235,7 +233,7 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
copyBanCaiHeadTemplate() {
|
copyBanCaiHeadTemplate() {
|
||||||
let temStartLine = Number(this.banCaiHeadStartLine);
|
let temStartLine = Number(this.banCaiHeadStartLine);
|
||||||
let banCaiHeadTemplateHolder = [];
|
const banCaiHeadTemplateHolder = [];
|
||||||
|
|
||||||
while (temStartLine <= Number(this.banCaiHeadEndLine)) {
|
while (temStartLine <= Number(this.banCaiHeadEndLine)) {
|
||||||
banCaiHeadTemplateHolder.push(
|
banCaiHeadTemplateHolder.push(
|
||||||
@ -245,7 +243,7 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
return banCaiHeadTemplateHolder;
|
return banCaiHeadTemplateHolder;
|
||||||
},
|
},
|
||||||
pasteBanCaiHeadTemplate(copyBanCaiTemplate) {
|
pasteBanCaiHeadTemplate(copyBanCaiTemplate: any) {
|
||||||
const temCopyBanCaiTemplate = copyBanCaiTemplate;
|
const temCopyBanCaiTemplate = copyBanCaiTemplate;
|
||||||
for (const banCaiRow of temCopyBanCaiTemplate) {
|
for (const banCaiRow of temCopyBanCaiTemplate) {
|
||||||
for (const row of this.infos) {
|
for (const row of this.infos) {
|
||||||
@ -268,11 +266,11 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pasteBanCaiBodyTemplate(boardIndex) {
|
pasteBanCaiBodyTemplate(boardIndex: number) {
|
||||||
const boardInfosTemplateHolder = [];
|
const boardInfosTemplateHolder = [];
|
||||||
const copyBanCaiBodyTemplateIndex = this.copyBanCaiBodyTemplate();
|
const copyBanCaiBodyTemplateIndex: any = this.copyBanCaiBodyTemplate();
|
||||||
|
|
||||||
for (let i = 0; i < data.boards[boardIndex].boardInfos.length; i++) {
|
for (const i of data.boards[boardIndex].boardInfos) {
|
||||||
boardInfosTemplateHolder.push(
|
boardInfosTemplateHolder.push(
|
||||||
this.copySingleRow(this.infos[copyBanCaiBodyTemplateIndex].rowId),
|
this.copySingleRow(this.infos[copyBanCaiBodyTemplateIndex].rowId),
|
||||||
);
|
);
|
||||||
@ -298,10 +296,10 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
importData() {
|
importData() {
|
||||||
const orderDetailsKeys = [];
|
const orderDetailsKeys: string[] = [];
|
||||||
const banCaiHeaderKeys = [];
|
const banCaiHeaderKeys: string[] = [];
|
||||||
const banCaiDetailsKeys = [];
|
const banCaiDetailsKeys: string[] = [];
|
||||||
const temRowHolder = [];
|
const temRowHolder: string[] = [];
|
||||||
const banCaiTemplateIndexHolder = [];
|
const banCaiTemplateIndexHolder = [];
|
||||||
for (const key in data) {
|
for (const key in data) {
|
||||||
if (key !== 'boards') {
|
if (key !== 'boards') {
|
||||||
@ -313,11 +311,11 @@ export default Vue.extend({
|
|||||||
banCaiHeaderKeys.push(key);
|
banCaiHeaderKeys.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const key in data.boards[0].boardInfos[0]) {
|
for (const key of Object.keys(data.boards[0].boardInfos[0])) {
|
||||||
banCaiDetailsKeys.push(key);
|
banCaiDetailsKeys.push(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const orderDetails = () => {
|
const addOrderDetails = () => {
|
||||||
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 (orderDetailsKeys.indexOf(cell.title) !== -1) {
|
if (orderDetailsKeys.indexOf(cell.title) !== -1) {
|
||||||
@ -327,21 +325,20 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const banCaiHeader = (index) => {
|
const addBanCaiHeader = (index: number) => {
|
||||||
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 (banCaiHeaderKeys.indexOf(cell.title) !== -1) {
|
if (banCaiHeaderKeys.indexOf(cell.title) !== -1) {
|
||||||
if (temRowHolder.indexOf(row) === -1) {
|
if (temRowHolder.indexOf(row) === -1) {
|
||||||
temRowHolder.push(this.copySingleRow(row.rowId));
|
temRowHolder.push(this.copySingleRow(row.rowId));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell.title = data.boards[index][cell.title];
|
cell.title = data.boards[index][cell.title];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const subQuantityMatch = (query) => {
|
const subQuantityMatch = (query: string) => {
|
||||||
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 (cell.title === query) {
|
if (cell.title === query) {
|
||||||
@ -350,33 +347,22 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const totalQuantityMatch = (query) => {
|
|
||||||
for (const row of this.infos) {
|
|
||||||
for (const cell of row.cells) {
|
|
||||||
if (cell.title === query) {
|
|
||||||
cell.title = '总共板材数量';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 复制板材的模板
|
// 复制完整板材的模板
|
||||||
const copyBanCaiTemplate = [];
|
const copyBanCaiTemplate = [];
|
||||||
for (let i = 0; i < data.boards.length - 1; i++) {
|
for (const board of data.boards) {
|
||||||
copyBanCaiTemplate.push(this.copyBanCaiHeadTemplate());
|
copyBanCaiTemplate.push(this.copyBanCaiHeadTemplate());
|
||||||
}
|
}
|
||||||
|
|
||||||
// orderDetails();
|
addOrderDetails();
|
||||||
for (let i = 0; i < data.boards.length - 1; i++) {
|
for (let i = 0; i < data.boards.length; i++) {
|
||||||
banCaiHeader(i);
|
addBanCaiHeader(i);
|
||||||
this.pasteBanCaiBodyTemplate(i);
|
this.pasteBanCaiBodyTemplate(i);
|
||||||
subQuantityMatch('subquantity');
|
subQuantityMatch('subquantity');
|
||||||
this.pasteBanCaiHeadTemplate(copyBanCaiTemplate[i]);
|
if (i < data.boards.length - 1) {
|
||||||
banCaiHeader(i + 1);
|
this.pasteBanCaiHeadTemplate(copyBanCaiTemplate[i]);
|
||||||
this.pasteBanCaiBodyTemplate(i + 1);
|
}
|
||||||
subQuantityMatch('subquantity');
|
|
||||||
}
|
}
|
||||||
totalQuantityMatch('totalquantity');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// for testing use -----import data from other file
|
// for testing use -----import data from other file
|
||||||
|
Loading…
Reference in New Issue
Block a user