142 lines
3.8 KiB
TypeScript
142 lines
3.8 KiB
TypeScript
// 控制面板类
|
|
class ControlPanel {
|
|
cellId: string;
|
|
|
|
constructor(cellId) {
|
|
this.cellId = cellId;
|
|
}
|
|
render() {}
|
|
update(instanceOfCells) {
|
|
const cellInfoObject = {};
|
|
const cellInfoElements = document
|
|
.getElementById("cell-info")
|
|
.getElementsByTagName("input");
|
|
for (let x = 0; x < cellInfoElements.length; x++) {
|
|
cellInfoObject[cellInfoElements[x].name] = cellInfoElements[x].value;
|
|
}
|
|
for (const instance of instanceOfCells) {
|
|
if (instance.cellId === "A1") {
|
|
for (const key in cellInfoObject) {
|
|
instance[key] = cellInfoObject[key];
|
|
}
|
|
console.log(instance);
|
|
}
|
|
}
|
|
}
|
|
|
|
setFont() {}
|
|
setFontSize() {}
|
|
setFontColor() {}
|
|
setFontWeight() {}
|
|
setTextUnderline() {}
|
|
setTextDecoration() {}
|
|
setBorder() {}
|
|
setTextLineThrough() {}
|
|
setBackgroupColor() {}
|
|
setTextLeft() {}
|
|
setTextCenter() {}
|
|
setTextRight() {}
|
|
resetTextStyle() {}
|
|
insertTable() {}
|
|
tablePreview() {}
|
|
exportPdf() {}
|
|
exportExcel() {}
|
|
}
|
|
// 数据源类
|
|
class DataResource {
|
|
displayName: string;
|
|
sourceName: string;
|
|
sourceType: number;
|
|
items: DataResourceItem[];
|
|
}
|
|
|
|
class DataResourceItem {
|
|
displayName: string;
|
|
dataField: string;
|
|
constructor(name, field) {
|
|
this.displayName = name;
|
|
this.dataField = field;
|
|
}
|
|
}
|
|
|
|
let orderDetailsMatches = new DataResource();
|
|
orderDetailsMatches.displayName = "订单信息";
|
|
orderDetailsMatches.sourceName = "orders";
|
|
orderDetailsMatches.sourceType = 0;
|
|
orderDetailsMatches.items = [
|
|
new DataResourceItem("${订单号}", "orderNo"),
|
|
new DataResourceItem("${客户名}", "clientName"),
|
|
new DataResourceItem("${出售日期}", "soldDate"),
|
|
new DataResourceItem("${联系名字}", "contactNo"),
|
|
new DataResourceItem("${送货地址}", "deliveryAddress"),
|
|
new DataResourceItem("${订单备注}", "addOn")
|
|
];
|
|
|
|
let banCaiMatches = new DataResource();
|
|
banCaiMatches.displayName = "板材头信息";
|
|
banCaiMatches.sourceName = "banCaiHead";
|
|
banCaiMatches.sourceType = 1;
|
|
banCaiMatches.items = [
|
|
new DataResourceItem("${板材材料}", "material"),
|
|
new DataResourceItem("${板材颜色}", "color")
|
|
];
|
|
|
|
let banCaiInfoMatches = new DataResource();
|
|
banCaiInfoMatches.displayName = "板材身信息";
|
|
banCaiInfoMatches.sourceName = "banCaiBody";
|
|
banCaiInfoMatches.sourceType = 1;
|
|
banCaiInfoMatches.items = [
|
|
new DataResourceItem("${板材房名}", "houseName"),
|
|
new DataResourceItem("${板材柜名}", "closetName"),
|
|
new DataResourceItem("${板材编号}", "boardNo"),
|
|
new DataResourceItem("${板材名}", "boardName"),
|
|
new DataResourceItem("${板材长度}", "length"),
|
|
new DataResourceItem("${板材宽度}", "width"),
|
|
new DataResourceItem("${板材厚度}", "thickness"),
|
|
new DataResourceItem("${板材数量}", "quantity"),
|
|
new DataResourceItem("${板材面积}", "area"),
|
|
new DataResourceItem("${板材异型}", "mutation"),
|
|
new DataResourceItem("${板材形状}", "shape"),
|
|
new DataResourceItem("${板材方向}", "direction"),
|
|
new DataResourceItem("${板材条纹}", "stripe"),
|
|
new DataResourceItem("${板材备注}", "boardAddOn")
|
|
];
|
|
|
|
// typescript 类型定义
|
|
|
|
interface OrderDetailsFormat {
|
|
[index: string]: string | object;
|
|
orderNo: string;
|
|
clientName: string;
|
|
soldDate: string;
|
|
contactName: string;
|
|
contactNo: string;
|
|
deliveryAddress: string;
|
|
addOn: string;
|
|
boards: Array<{
|
|
[index: string]: number | string | object;
|
|
id: number;
|
|
material: string;
|
|
color: string;
|
|
boardInfos: Array<{
|
|
houseName: string;
|
|
closetName: string;
|
|
boardNo: string;
|
|
boardName: string;
|
|
length: number;
|
|
width: number;
|
|
thickness: number;
|
|
quantity: number;
|
|
area: number;
|
|
mutation: string;
|
|
shape: string;
|
|
direction: string;
|
|
stripe: string;
|
|
boardAddOn: string;
|
|
|
|
[index: string]: number | string;
|
|
}>;
|
|
}>;
|
|
}
|
|
export { ControlPanel };
|