fix re-import bug going to restruture...

This commit is contained in:
郑茂强 2018-10-12 09:55:19 +08:00
parent e7027941eb
commit afa11720ee
2 changed files with 38 additions and 27 deletions

View File

@ -93,7 +93,8 @@ import { hightlight } from '@/components/reportTemplate/rescource/hightlight';
let rowId = 30; // this figure is for testing use
let cellId = 9060; // this figure is for testing use
let copiedRowHolder: any;
let orderHeadTags = [
let copiedRemaingForm: any[] = [];
const orderHeadTags = [
'${订单号}',
'${客户名}',
'${出售日期}',
@ -102,8 +103,8 @@ let orderHeadTags = [
'${送货地址}',
'${订单备注}',
];
let banCaiHeadTags = ['${板材材料}', '${板材颜色}'];
let banCaiBodyTags = [
const banCaiHeadTags = ['${板材材料}', '${板材颜色}'];
const banCaiBodyTags = [
'${板材房名}',
'${板材柜名}',
'${板材号}',
@ -371,12 +372,16 @@ export default Vue.extend({
this.selectedCell = 0; // selectedCell 0 cell
this.designTemplate = JSON.parse(JSON.stringify(this.infos)); //
Tool.addOrderDetails(this); //
const copiedBanCaiTemplateRows = [];
for (const board of data.boards) {
copiedBanCaiTemplateRows.push(this.copyBanCaiTemplate());
}
const copiedRemaingForm = this.copyRemainingForm(); //
Tool.addOrderDetails(this); //
//
if (copiedRemaingForm.length === 0) {
copiedRemaingForm = this.copyRemainingForm();
}
if (this.hasBanCaiBodyTags()) {
for (let i = 0; i < data.boards.length; i++) {

View File

@ -96,23 +96,33 @@ const tagsObject: any = {
'${条纹}': 'stripe',
'${板材备注}': 'boardAddOn',
};
const orderDetailsKeys: string[] = [];
const banCaiHeaderKeys: string[] = [];
const banCaiDetailsKeys: string[] = [];
const orderDetailsKeys: string[] = [
'orderNo',
'clientName',
'soldDate',
'contactName',
'contactNo',
'deliveryAddress',
'addOn',
];
const banCaiHeaderKeys: string[] = ['id', 'material', 'color'];
const banCaiDetailsKeys: string[] = [
'houseName',
'closetName',
'boardNo',
'boardName',
'length',
'width',
'thickness',
'quantity',
'area',
'mutation',
'shape',
'direction',
'stripe',
'boardAddOn',
];
const temRowHolder: string[] = [];
for (const key in orderDetails) {
if (key !== 'boards') {
orderDetailsKeys.push(key);
}
}
for (const key in orderDetails.boards[0]) {
if (key !== 'boardInfos') {
banCaiHeaderKeys.push(key);
}
}
for (const key of Object.keys(orderDetails.boards[0].boardInfos[0])) {
banCaiDetailsKeys.push(key);
}
const Tool = {
addRow: (that: any, rowId: number) => {
@ -288,14 +298,10 @@ const Tool = {
}
}
},
copyBanCaiBodyTemplate: (that) => {
copyBanCaiBodyTemplate: (that: any) => {
for (const row of that.infos) {
for (const cell of row.cells) {
if (
Object.keys(data.boards[0].boardInfos[0]).indexOf(
tagsObject[cell.title],
) !== -1
) {
if (banCaiDetailsKeys.indexOf(tagsObject[cell.title]) !== -1) {
return that.infos.indexOf(row);
}
}