Просмотр исходного кода

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/SCCommon

qinlaiqiao 5 лет назад
Родитель
Сommit
bd6f055dd1

+ 2 - 2
report/src/core/jpc_ex.ts

@@ -1,6 +1,6 @@
 
 import JE from './jpc_rte'; //Important: for self-define function execution purpose
-import JV from './jpc_value_define';
+import $JV from './jpc_value_define';
 import JpcBand from './jpc_band';
 import JpcFlowTab from './jpc_flow_tab';
 import JpcBillTab from './jpc_bill_tab';
@@ -18,7 +18,7 @@ import { IDefProperties, IFormula, IParams, ICurrent_RPT, ICurrent_DATA, ICustom
 import { IFlowTabClass, IBillTabClass, ICostTabClass } from '../interface/classType';
 import { IControlProps, IFontProps, IPagingOption } from '../interface/enum';
 import { Key } from 'readline';
-
+const JV=$JV;
 class JpcExClass {
     flowTab!: IFlowTabClass;
     flowTabEx!: IFlowTabClass;

+ 1 - 1
report/src/core/jpc_flow_tab.ts

@@ -1336,7 +1336,7 @@ function _addPageValue(ValuedIdxLst: number[][][], sortedSequence: number[], grp
     let private_addAutoHeightPageValue = function (vi: number) {
         let couldBreak = false, startIdx = 0;
         let ttlValAmt = 0;
-        if (segAutoHeightInfo && [segIdx].length > startRecIdx + vi) {
+        if (segAutoHeightInfo && segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
             ttlValAmt = segAutoHeightInfo[segIdx][startRecIdx + vi];
         }
         if (prePageLeftAutoHeightRecAmt > 0 && vi === 0) {

+ 7 - 0
report/src/interface/basic.ts

@@ -609,3 +609,10 @@ export interface IMergeBand {
     Top: number;
     style?: any;
 }
+//丢失的interface
+export interface IPretreatment{
+    [key: string]: any;
+}
+export interface ISubFilters{
+    [key: string]: any;
+}

+ 3 - 0
tree/README.md

@@ -51,3 +51,6 @@ node.getCtx().children();
 ```
 
 具体接口请参考声明文件。
+
+### 开发注意事项
+1. 为了响应式节点(proxy对象)可正常进行操作,**代码中关于节点是否相同的判断,需要判断节点ID相同,而不是节点引用是否相同。**

+ 1 - 1
tree/package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/tree",
-  "version": "1.0.3",
+  "version": "1.0.9",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

+ 10 - 6
tree/src/nodeCtx.ts

@@ -24,14 +24,14 @@ export class NodeContext<T = any> {
 
   // 节点在完整、排好序的树数据中的行号
   row(): number {
-    return this.tree.data.indexOf(this.ref);
+    return this.tree.data.findIndex(item => item.ID === this.ref.ID);
   }
 
   // 获取树结构展开显示的行号
   visualRow(): number {
     let row = 0;
     for (const n of this.tree.data) {
-      if (this.ref === n) return row;
+      if (this.ref.ID === n.ID) return row;
       if (n.getCtx().visible()) {
         row += 1;
       }
@@ -41,7 +41,7 @@ export class NodeContext<T = any> {
 
   // 节点在相同父节点下的行号
   rowInParent(): number {
-    return this.brothers().indexOf(this.ref);
+    return this.brothers().findIndex(item => item.ID === this.ref.ID);
   }
 
   // 节点的原始seq数据
@@ -144,7 +144,7 @@ export class NodeContext<T = any> {
   brothers(includeSelf = true): (TreeNode & T)[] {
     let nodes = this.tree.parentMap[this.parentID()] || [];
     if (!includeSelf) {
-      nodes = nodes.filter(node => node !== this.ref);
+      nodes = nodes.filter(node => node.ID !== this.ref.ID);
     }
     return nodes;
   }
@@ -156,13 +156,17 @@ export class NodeContext<T = any> {
   // 获取后兄弟节点们
   nextBrothers(): (TreeNode & T)[] {
     const nodes = this.tree.parentMap[this.parentID()] || [];
-    return nodes.filter(node => node.seq >= this.seq() && node !== this.ref);
+    return nodes.filter(
+      node => node.seq >= this.seq() && node.ID !== this.ref.ID
+    );
   }
 
   // 获取前兄弟节点们
   prevBrothers(): (TreeNode & T)[] {
     const nodes = this.tree.parentMap[this.parentID()] || [];
-    return nodes.filter(node => node.seq <= this.seq() && node !== this.ref);
+    return nodes.filter(
+      node => node.seq <= this.seq() && node.ID !== this.ref.ID
+    );
   }
 
   // 只有前节点存在才可上移

+ 18 - 14
tree/src/tree.ts

@@ -173,7 +173,7 @@ export class Tree<T = any> {
       return null;
     }
     const nodes = this.parentMap[node.parentID];
-    const nodeIndex = nodes.indexOf(node);
+    const nodeIndex = nodes.findIndex(item => item.ID === node.ID);
     if (nodeIndex < 0) {
       return null;
     }
@@ -187,7 +187,7 @@ export class Tree<T = any> {
       return null;
     }
     const nodes = this.parentMap[node.parentID];
-    const nodeIndex = nodes.indexOf(node);
+    const nodeIndex = nodes.findIndex(item => item.ID === node.ID);
     if (nodeIndex < 0) {
       return null;
     }
@@ -339,12 +339,14 @@ export class Tree<T = any> {
         delete this.parentMap[node.ID];
         const nodesInParentMap = this.parentMap[node.parentID];
         if (nodesInParentMap && nodesInParentMap.length) {
-          const nIndex = nodesInParentMap.indexOf(node);
+          const nIndex = nodesInParentMap.findIndex(
+            item => item.ID === node.ID
+          );
           if (nIndex >= 0) {
             toDels.push({ nodes: nodesInParentMap, delNode: node });
           }
         }
-        const index = this.rawData.indexOf(node);
+        const index = this.rawData.findIndex(item => item.ID === node.ID);
         if (index >= 0) {
           this.rawData.splice(index, 1);
         }
@@ -354,7 +356,9 @@ export class Tree<T = any> {
       });
       // 删除parentMap的数据
       toDels.forEach(delItem => {
-        const delIndex = delItem.nodes.indexOf(delItem.delNode);
+        const delIndex = delItem.nodes.findIndex(
+          item => item.ID === delItem.delNode.ID
+        );
         if (delIndex >= 0) {
           delItem.nodes.splice(delIndex, 1);
         }
@@ -467,10 +471,10 @@ export class Tree<T = any> {
       });
     });
     const parentNextBrothers = parent.getCtx().nextBrothers();
-    // 因为seq可能是不连号的,如果上移的最末节点seq,小于下一节点的seq,那就不更新所有下兄弟节点的seq,减少更新的数据量
+    // 因为seq可能是不连号的,如果升级块的最末节点seq,小于下一节点的seq,那就不更新所有下兄弟节点的seq,减少更新的数据量
     const lastNodeCurSeq = updateData[updateData.length - 1].update.seq;
-    const firstBrohter = parentNextBrothers[0];
-    if (lastNodeCurSeq && lastNodeCurSeq >= firstBrohter.seq) {
+    const firstBrother = parentNextBrothers[0];
+    if (lastNodeCurSeq && firstBrother && lastNodeCurSeq >= firstBrother.seq) {
       parentNextBrothers.forEach((node, index) => {
         updateData.push({
           ID: node.ID,
@@ -500,10 +504,8 @@ export class Tree<T = any> {
     const orgParentID = firstNode.parentID;
     const orgBrothers = this.parentMap[orgParentID];
     const lastNodeNextBrothers = lastNode.getCtx().nextBrothers();
-    orgBrothers.splice(
-      orgBrothers.indexOf(firstNode),
-      nodes.length + lastNodeNextBrothers.length
-    );
+    const index = orgBrothers.findIndex(item => item.ID === firstNode.ID);
+    orgBrothers.splice(index, nodes.length + lastNodeNextBrothers.length);
     (this.parentMap[lastNode.ID] || (this.parentMap[lastNode.ID] = [])).push(
       ...lastNodeNextBrothers
     );
@@ -545,7 +547,8 @@ export class Tree<T = any> {
       return;
     }
     const orgBrothers = this.parentMap[firstNode.parentID];
-    orgBrothers.splice(orgBrothers.indexOf(firstNode), nodes.length);
+    const index = orgBrothers.findIndex(item => item.ID === firstNode.ID);
+    orgBrothers.splice(index, nodes.length);
     (this.parentMap[prevNode.ID] || (this.parentMap[prevNode.ID] = [])).push(
       ...nodes
     );
@@ -606,7 +609,8 @@ export class Tree<T = any> {
     const newParentID = parent ? parent.ID : this.rootID;
     const orgParentID = firstNode.parentID;
     const orgBrothers = this.parentMap[orgParentID];
-    orgBrothers.splice(orgBrothers.indexOf(firstNode), nodes.length);
+    const index = orgBrothers.findIndex(item => item.ID === firstNode.ID);
+    orgBrothers.splice(index, nodes.length);
     (this.parentMap[newParentID] || (this.parentMap[newParentID] = [])).push(
       ...nodes
     );

+ 51 - 2
types/src/interface/glj.ts

@@ -48,11 +48,12 @@ export interface IBaseGlj {
   [key: string]: any;
 }
 
-export interface IDisplayType {
+export interface IGljTypeShortName {
   [type: number]: string;
 }
 
-export const DisplayType: IDisplayType = {
+// 人材机类型简称
+export const GljTypeShortName: IGljTypeShortName = {
   1: '人',
   201: '材',
   202: '砼',
@@ -82,6 +83,37 @@ export const DisplayType: IDisplayType = {
   8: '险',
 };
 
+// 人材机类型全称
+export const GljTypeFullName: Record<number, string> = {
+  1: '人工',
+  201: '普通材料',
+  202: '混凝土',
+  203: '砂浆',
+  204: '配合比',
+  205: '商品混凝土',
+  206: '商品砂浆',
+  207: '其他材料费',
+  208: '外购砼构件',
+  209: '绿化苗木',
+  301: '机械台班',
+  302: '机械组成物',
+  303: '机上人工',
+  304: '仪器仪表',
+  305: '燃料动力费',
+  306: '折旧费',
+  307: '检修费',
+  308: '维护费',
+  309: '安拆费及场外运费',
+  310: '校验费',
+  311: '其他费用',
+  312: '其他施工机具使用费',
+  4: '主材',
+  5: '设备',
+  6: '企业管理费',
+  7: '利润',
+  8: '一般风险费',
+};
+
 export interface IComponent {
   ID: string;
   consumption: number; // 消耗量(有别于总消耗,此字段记录配合比的消耗量)
@@ -221,6 +253,7 @@ export interface IRawStdGljTree {
 export interface IStdGljTree extends ITreeScm {
   repositoryID: number;
   name: string;
+  from: fromType;
 }
 /* 标准人材机相关 ↑ */
 
@@ -250,12 +283,28 @@ export interface ISelectGljLibItem {
   key: string; // 与gljLibID拼接的形成的唯一值
   isPrior: boolean; // 优先的
   from: fromType;
+  located?: boolean; // 定位到的库(替换时需要)
+}
+
+// 获取人材机分页数据接口选项
+export interface IGetPagingGljOptions {
+  classList?: number[]; // 需要匹配的分类
+  typeList?: GljType[]; // 需要匹配的人材机类型
+  libID?: number | string; // 人材机库ID
+  replaceGlj?: IBaseGlj; // 替换的人材机
+  located?: boolean; // 是否需要定位(打开替换窗口时)
+  limit?: number; // 分页数量
+  gtCode?: string; // 分页排序$gt code
+  search?: string; // 搜索的内容(匹配编号、名称)
 }
 
 // 选择人材机接口返回数据格式
 export interface ISelectGljResult {
   libData: ISelectGljLibItem[]; // 库下拉项
   treeData: IStdGljTree[]; // 人材机分类树
+  gljData: (IStdGlj | ICptGlj)[]; // 人材机数据
+  total: number; // 当前数据总数量
+  locatedGlj?: IStdGlj | ICptGlj; // 需要定位到的人材机
 }
 
 /* 选择人材机相关 ↑ */