Sfoglia il codice sorgente

厂商信息选择动态生成

zhangyu 5 anni fa
parent
commit
166fd39d78
1 ha cambiato i file con 81 aggiunte e 69 eliminazioni
  1. 81 69
      src/utils/handsontable/notShow.js

+ 81 - 69
src/utils/handsontable/notShow.js

@@ -215,100 +215,106 @@ const showTools = {
         })
         return data
     },
-    arrToArr(arr) {
+    arrToArr(arr, showType) {
         let first = 0,
             scound = 0,
             three = 0,
             four = 0
         arr.find(function (value, index, arr) {
+            let flag = (showType != "Visible" ||  value.Visible)
             if (
-                (value.InfoPointName == "品牌" ||
-                    value.InfoPointName == "设备型号" ||
-                    value.InfoPointName == "生产厂家") && !first
+                ((value.InfoPointCode == "Brand" && flag) ||
+                (value.InfoPointCode == "Specification" && flag) ||
+                (value.InfoPointCode == "Manufacturer" && flag)) && !first
             ) {
                 first = index
             }
             if (
-                (value.InfoPointName == "供应商单位名称" ||
-                    value.InfoPointName == "供应商联系人" ||
-                    value.InfoPointName == "供应商电子邮件" ||
-                    value.InfoPointName == "供应商网址" ||
-                    value.InfoPointName == "供应商传真" ||
-                    value.InfoPointName == "供应商联系电话") && !scound
+                ((value.InfoPointCode == "Supplier" && flag) ||
+                (value.InfoPointCode == "SupplierContactor" && flag) ||
+                (value.InfoPointCode == "SupplierEmail" && flag) ||
+                (value.InfoPointCode == "SupplierWeb" && flag) ||
+                (value.InfoPointCode == "SupplierFax" && flag) ||
+                (value.InfoPointCode == "SupplierPhone" && flag)) && !scound
             ) {
                 scound = index
             }
             if (
-                (value.InfoPointName == "维修商单位名称" ||
-                    value.InfoPointName == "维修商联系人" ||
-                    value.InfoPointName == "维修商联系电话" ||
-                    value.InfoPointName == "维修商电子邮件" ||
-                    value.InfoPointName == "维修商网址" ||
-                    value.InfoPointName == "维修商传真") && !three
+                ((value.InfoPointCode == "Maintainer" && flag) ||
+                (value.InfoPointCode == "MaintainerContactor" && flag) ||
+                (value.InfoPointCode == "MaintainerPhone" && flag) ||
+                (value.InfoPointCode == "MaintainerEmail" && flag) ||
+                (value.InfoPointCode == "MaintainerWeb" && flag) ||
+                (value.InfoPointCode == "MaintainerFax" && flag)) && !three
             ) {
                 three = index
             }
             if (
-                (value.InfoPointName == "保险公司名称" ||
-                    value.InfoPointName == "保险公司联系人" ||
-                    value.InfoPointName == "保险公司联系电话" ||
-                    value.InfoPointName == "保险公司电子邮件" ||
-                    value.InfoPointName == "保险公司网址" ||
-                    value.InfoPointName == "保险公司传真") && !four
+                ((value.InfoPointCode == "Insurer" && flag) ||
+                (value.InfoPointCode == "InsurerContactor" && flag) ||
+                (value.InfoPointCode == "InsurerPhone" && flag) ||
+                (value.InfoPointCode == "InsurerEmail" && flag) ||
+                (value.InfoPointCode == "InsurerWeb" && flag) ||
+                (value.InfoPointCode == "InsurerFax" && flag)) && !four
             ) {
                 four = index
             }
         })
         let numList = [first, scound, three, four]
         numList.reverse().map((item, index) => {
-            if (!!item) {
+            if (item) {
                 if (index == 0) {
                     arr.splice(item, 0, {
-                        InfoPointName: "保险公司信息",
+                        DataType: "Str",
+                        FirstName: "基本信息",
                         InfoPointCode: "DPInsurerID",
-                        Path: 'DPInsurerID',
-                        InputMode: "Own",
-                        Unit: "",
-                        SecondTag: "",
-                        FirstTag: "",
-                        Visible: true,
+                        InfoPointName: "保险公司信息",
+                        InputMode: "X",
+                        Path: "DPInsurerID",
+                        Priority: "S",
+                        Editable: true,
+                        Visible: true
                     })
                 } else if (index == 1) {
                     arr.splice(item, 0, {
-                        InfoPointName: "维修商信息",
+                        DataType: "Str",
+                        FirstName: "基本信息",
                         InfoPointCode: "DPMaintainerID",
-                        Path: 'DPMaintainerID',
-                        InputMode: "Own",
-                        Unit: "",
-                        SecondTag: "",
-                        FirstTag: "",
-                        Visible: true,
+                        InfoPointName: "维修商信息",
+                        InputMode: "X",
+                        Path: "DPMaintainerID",
+                        Priority: "S",
+                        Editable: true,
+                        Visible: true
                     })
                 } else if (index == 2) {
                     arr.splice(item, 0, {
-                        InfoPointName: "供应商信息",
+                        DataType: "Str",
+                        FirstName: "基本信息",
                         InfoPointCode: "DPSupplierID",
-                        Path: 'DPSupplierID',
-                        InputMode: "Own",
-                        Unit: "",
-                        SecondTag: "",
-                        FirstTag: "",
-                        Visible: true,
+                        InfoPointName: "供应商信息",
+                        InputMode: "X",
+                        Path: "DPSupplierID",
+                        Priority: "S",
+                        Editable: true,
+                        Visible: true
                     })
                 } else if (index == 3) {
                     arr.splice(item, 0, {
-                        InfoPointName: "品牌型号",
+                        DataType: "Str",
+                        FirstName: "基本信息",
                         InfoPointCode: "DPManufacturerID",
-                        Path: 'DPManufacturerID',
-                        InputMode: "Own",
-                        Unit: "",
-                        SecondTag: "",
-                        FirstTag: "",
-                        Visible: true,
+                        InfoPointName: "品牌型号",
+                        InputMode: "X",
+                        Path: "DPManufacturerID",
+                        Priority: "S",
+                        Editable: true,
+                        Visible: true
                     })
                 }
             }
         })
+        debugger
         return arr
     },
     changeTypes(arr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
@@ -877,38 +883,41 @@ const showTools = {
      * 
      */
     headerTextFilter(arr, type, onlyRead, showType, taizhang = false) {
+        if (taizhang && !onlyRead) {
+            arr = this.arrToArr(arr, showType)
+        }
         let data = arr.map(item => {
             if (type == "property" && item.FirstTag == "RunParam") { //资产台账不显示运行参数
                 return undefined
             }
             if (onlyRead) { //只读模式
-                if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
+                if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
                     return undefined
                 }
                 if (showType == "Visible" && item.Visible) { //只看要采集的信息
-                    return showTools.isUnit(item)
+                    return this.isUnit(item)
                 } else if (showType == "all") { //显示全部
-                    return showTools.isUnit(item)
+                    return this.isUnit(item)
                 } else {
                     return undefined
                 }
             } else { //编辑模式
-                if (taizhang && !showTools.filterFirm(item.InfoPointCode)) {
+                if (taizhang && !this.filterFirm(item.InfoPointCode)) {
                     return undefined
                 }
-                if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
+                if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
                     return undefined
                 }
                 if (showType == "Visible" && item.Visible) { //只看要采集的信息
-                    return showTools.isUnit(item)
+                    return this.isUnit(item)
                 } else if (showType == "all") { //显示全部
-                    return showTools.isUnit(item)
-                } else if (showType == "partInfo" && showTools.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
+                    return this.isUnit(item)
+                } else if (showType == "partInfo" && this.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
                     // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
                     if (item.FirstTag == "TechParam") {
                         return undefined
                     } else {
-                        return showTools.isUnit(item)
+                        return this.isUnit(item)
                     }
                 } else {
                     return undefined
@@ -919,38 +928,41 @@ const showTools = {
         return data
     },
     headerTypeFilter(arr, type, onlyRead, showType, taizhang = false) {
+        if (taizhang && !onlyRead) {
+            arr = this.arrToArr(arr, showType)
+        }
         let data = arr.map(item => {
             if (type == "property" && item.FirstTag == "RunParam") { //资产台账不显示运行参数
                 return undefined
             }
             if (onlyRead) { //只读模式
-                if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
+                if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
                     return undefined
                 }
                 if (showType == "Visible" && item.Visible) { //只看要采集的信息
-                    return showTools.textFormat(item, onlyRead)
+                    return this.textFormat(item, onlyRead)
                 } else if (showType == "all") { //显示全部
-                    return showTools.textFormat(item, onlyRead)
+                    return this.textFormat(item, onlyRead)
                 } else {
                     return undefined
                 }
             } else { //编辑模式
-                if (taizhang && !showTools.filterFirm(item.InfoPointCode)) {
+                if (taizhang && !this.filterFirm(item.InfoPointCode)) {
                     return undefined
                 }
-                if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
+                if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
                     return undefined
                 }
                 if (showType == "Visible" && item.Visible) { //只看要采集的信息
-                    return showTools.inputModeFilter(item, onlyRead)
+                    return this.inputModeFilter(item, onlyRead)
                 } else if (showType == "all") { //显示全部
-                    return showTools.inputModeFilter(item, onlyRead)
-                } else if (showType == "partInfo" && showTools.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
+                    return this.inputModeFilter(item, onlyRead)
+                } else if (showType == "partInfo" && this.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
                     // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
                     if (item.FirstTag == "TechParam") {
                         return undefined
                     } else {
-                        return showTools.inputModeFilter(item, onlyRead)
+                        return this.inputModeFilter(item, onlyRead)
                     }
                 } else {
                     return undefined