1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288 |
- // 不显示的信息点数组
- import text from "@/utils/handsontable/mainText"
- import tools from "@/utils/scan/tools"
- import fieldData from "@/utils/handsontable/fillterField"
- let inputModeArr = ["A1", "A2", "B1", "C5", "D1", "D2", "E1", "L", "L1", "L2", "F1", "F2", "M", "Own"]
- //在编辑模式下并且勾选隐藏自动填充的信息点不显示的字段
- let noShowArr = [
- "specification",
- "serviceLife"
- ]
- //在编辑模式下不显示的字段
- let cantShow = [
- "EquipQRCode",
- "EquipID",
- "EquipName",
- "BIMLocation",
- "Brand",
- "Specification",
- "Manufacturer",
- "Supplier",
- "SupplierContactor",
- "SupplierPhone",
- "SupplierEmail",
- "SupplierWeb",
- "SupplierFax",
- "Maintainer",
- "MaintainerContactor",
- "MaintainerPhone",
- "MaintainerEmail",
- "MaintainerWeb",
- "Principal",
- "MaintainerFax",
- "Insurer",
- "InsurerContactor",
- "InsurerPhone",
- "InsurerEmail",
- "InsurerWeb",
- "InsurerFax",
- "InsuranceFile",
- "EquipID",
- "EquipName",
- "SpaceCount",
- "SpaceList",
- "TenantID",
- "ShaftID"
- ]
- //台账编辑页面不显示的厂商信息
- let firmArr = [
- "brand", //品牌
- "specification", //设备型号
- "manufacturer", //生产厂家
- "supplier", //供应商单位名称
- "supplierContactor", //供应商联系人
- "supplierPhone", //供应商联系电话
- "supplierEmail", //供应商电子邮件
- "supplierWeb", //供应商网址
- "supplierFax", //供应商传真
- "maintainer", //维修商单位名称
- "maintainerContactor", //维修商联系人
- "maintainerPhone", //维修商联系电话
- "maintainerEmail", //维修商电子邮件
- "maintainerWeb", //维修商网址
- "maintainerFax", //维修商传真
- "insurer", //保险公司名称
- "insurerContactor", //保险公司联系人
- "insurerPhone", //保险公司联系电话
- 'insurerEmail', //保险公司电子邮件
- "insurerWeb", //保险公司网址
- "insurerFax" //保险公司传真
- // "DPManufacturerID",//品牌型号Id
- // "DPSupplierID",//供应商信息Id
- // "DPMaintainerID",//维修商信息Id
- // "DPInsurerID"//保险公司信息Id
- ]
- let cutArr = [{
- name: "品牌型号",
- code: "DPManufacturerID",
- num: 2,
- }, {
- name: "供应商信息",
- code: "DPSupplierID",
- num: 5
- }, {
- name: "维修商信息",
- code: "DPMaintainerID",
- num: 19
- }, {
- name: "保险公司信息",
- code: "DPInsurerID",
- num: 25
- }]
- let newData = [{
- name: "品牌型号",
- code: "DPManufacturerID",
- num: 2,
- }, {
- name: "供应商信息",
- code: "DPSupplierID",
- num: 8
- }, {
- name: "维修商信息",
- code: "DPMaintainerID",
- num: 35
- }, {
- name: "保险公司信息",
- code: "DPInsurerID",
- num: 42
- }]
- //创建部件固定不显示-管理部件固定不显示(即编辑模式)
- let partsAddNoShow = [
- 'EquipID',
- 'EquipName',
- 'EquipQRCode',
- 'BIMID',
- 'BIMLocation',
- 'Brand',
- 'Specification',
- 'Manufacturer',
- 'Supplier',
- 'SupplierContactor',
- 'SupplierPhone',
- 'SupplierEmail',
- 'SupplierWeb',
- 'SupplierFax',
- 'Maintainer',
- 'MaintainerContactor',
- 'MaintainerPhone',
- 'MaintainerEmail',
- 'MaintainerWeb',
- 'MaintainerFax',
- 'Insurer',
- "InsurerContactor",
- "InsurerPhone",
- "InsurerEmail",
- "InsurerWeb",
- "InsurerFax",
- ]
- const showTools = {
- inputModeArr: ["A1", "A2", "B1", "B2", "C5", "D1", "D1L", "D2", "E1", "E2", "L", "L1", "L2", "F1", "F2", "M"],
- addArr: () => {
- return cutArr
- },
- cantShow: (code) => {
- let falg = true
- cantShow.map(item => {
- if (item == code) {
- falg = false
- }
- })
- return falg
- },
- fixedNoShowField: (noShowList, code) => {
- let flag = true
- noShowList.map(item => {
- if (item == code) {
- flag = false
- }
- })
- return flag
- },
- //几种类型不显示
- technologyParam: (item) => {
- if (
- item.firstTag == "控制参数" &&
- item.firstTag == "设定参数" &&
- item.firstTag == "运行参数"
- ) {
- return undefined
- }
- },
- isShow: (code) => {
- let falg = true
- noShowArr.map(item => {
- if (item == code) {
- falg = false
- }
- })
- return falg
- },
- //插入需要的关系
- insertionRea: (data) => {
- cutArr.map(item => {
- data.splice(item.num, 0, item.name)
- })
- return data
- },
- insertionRea2: (data) => {
- newData.map(item => {
- data.splice(item.num, 0, item.name)
- })
- return data
- },
- insertionType: (data, callback) => {
- cutArr.map(item => {
- data.splice(item.num, 0, {
- data: "infos." + item.code,
- renderer: callback,
- readOnly: false
- })
- })
- return data
- },
- insertionType2: (data, callback) => {
- newData.map(item => {
- data.splice(item.num, 0, {
- data: "infos." + item.code,
- renderer: callback,
- readOnly: false
- })
- })
- return data
- },
- 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.code == "brand" && flag) ||
- (value.code == "specification" && flag) ||
- (value.code == "manufacturer" && flag)) && !first
- ) {
- first = index
- }
- if (
- ((value.code == "supplier" && flag) ||
- (value.code == "supplierContactor" && flag) ||
- (value.code == "supplierEmail" && flag) ||
- (value.code == "supplierWeb" && flag) ||
- (value.code == "supplierFax" && flag) ||
- (value.code == "supplierPhone" && flag)) && !scound
- ) {
- scound = index
- }
- if (
- ((value.code == "maintainer" && flag) ||
- (value.code == "maintainerContactor" && flag) ||
- (value.code == "maintainerPhone" && flag) ||
- (value.code == "maintainerEmail" && flag) ||
- (value.code == "maintainerWeb" && flag) ||
- (value.code == "maintainerFax" && flag)) && !three
- ) {
- three = index
- }
- if (
- ((value.code == "insurer" && flag) ||
- (value.code == "insurerContactor" && flag) ||
- (value.code == "insurerPhone" && flag) ||
- (value.code == "insurerEmail" && flag) ||
- (value.code == "insurerWeb" && flag) ||
- (value.code == "insurerFax" && flag)) && !four
- ) {
- four = index
- }
- })
- let numList = [first, scound, three, four]
- numList.reverse().map((item, index) => {
- if (item) {
- if (index == 0) {
- arr.splice(item, 0, {
- dataType: "STR",
- firstName: "基本信息",
- aliasCode: "DPInsurerID",
- aliasName: "保险公司信息",
- name: "保险公司信息",
- code: "DPInsurerID",
- origCode: "DPInsurerID",
- origDataType: "Str",
- inputMode: "X",
- path: "DPInsurerID",
- priority: "S",
- editable: true,
- visible: true
- })
- } else if (index == 1) {
- arr.splice(item, 0, {
- dataType: "STR",
- firstName: "基本信息",
- aliasCode: "DPMaintainerID",
- aliasName: "维修商信息",
- name: "维修商信息",
- code: "DPMaintainerID",
- origCode: "DPMaintainerID",
- origDataType: "Str",
- inputMode: "X",
- path: "DPMaintainerID",
- priority: "S",
- editable: true,
- visible: true
- })
- } else if (index == 2) {
- arr.splice(item, 0, {
- dataType: "STR",
- firstName: "基本信息",
- aliasCode: "DPSupplierID",
- aliasName: "供应商信息",
- name: "供应商信息",
- code: "DPSupplierID",
- origCode: "DPSupplierID",
- origDataType: "Str",
- inputMode: "X",
- path: "DPSupplierID",
- priority: "S",
- editable: true,
- visible: true
- })
- } else if (index == 3) {
- arr.splice(item, 0, {
- dataType: "STR",
- firstName: "基本信息",
- aliasCode: "DPManufacturerID",
- aliasName: "生产厂家/品牌/型号",
- name: "生产厂家/品牌/型号",
- code: "DPManufacturerID",
- origCode: "DPManufacturerID",
- origDataType: "Str",
- inputMode: "X",
- path: "DPManufacturerID",
- priority: "S",
- editable: true,
- visible: true
- })
- }
- }
- })
- return arr
- },
- changeTypes(arr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
- let data = arr.map(item => {
- if (falg) {
- if (item.firstTag == "控制参数" ||
- item.firstTag == "设定参数" ||
- item.firstTag == "运行参数") {
- return undefined
- }
- }
- if (item.code == "BIMLocation") {
- return undefined
- }
- if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
- if (item.Visible || !allMess) {
- //固定不显示的code
- if (!showTools.cantShow(item.code) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.code) && !taizhang && !taizhang) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.code == "EquipQRCode") {
- return {
- data: "Infos." + item.code,
- renderer: text.lookQRCode,
- readOnly: true
- }
- }
- if (item.inputMode == "D1") {
- return {
- data: "Infos." + item.code,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- // multiple: true,//多选
- data: item.dataSource || ""
- }
- };
- } else if (item.inputMode == "A1" || item.inputMode == "A2") {
- return {
- data: "Infos." + item.code,
- type: "numeric",
- numericFormat: {
- pattern: "0,0.00"
- // culture: 'de-DE' // use this for EUR (German),
- // more cultures available on http://numbrojs.com/languages.html
- }
- };
- } else if (item.inputMode == "C5") {
- return {
- data: "Infos." + item.code,
- type: "date",
- dateFormat: "YYYY-MM-DD",
- correctFormat: true
- };
- } else if (
- item.inputMode == "B1" ||
- item.inputMode == "L" ||
- item.inputMode == "L1" ||
- item.inputMode == "L2" ||
- item.inputMode == "M"
- ) {
- return {
- data: "Infos." + item.code
- };
- } else if (
- item.inputMode == "X"
- // item.inputMode == "L1" ||
- // item.inputMode == "L2"
- ) {
- // return undefined
- return {
- data: "Infos." + item.code,
- readOnly: true
- };
- } else if (item.inputMode == "D2") {
- return {
- data: "Infos." + item.code,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- multiple: true, //多选
- data: item.dataSource || ""
- }
- };
- } else if (item.inputMode == "Own" && !onlyRead) {
- return {
- data: "Infos." + item.code,
- renderer: text.idType,
- }
- } else {
- return {
- data: "infos." + item.code
- }
- }
- } else {
- return undefined
- }
- } else {
- return false
- }
- }).filter(item => item);
- return data
- },
- showTypes(arr, onlyRead, isWatch, allMess, falg = false, typeArr = false) {
- let data = arr.map(item => {
- if (falg) {
- if (item.firstTag == "控制参数" ||
- item.firstTag == "设定参数" ||
- item.firstTag == "运行参数") {
- return undefined
- }
- }
- if (item.code == "BIMLocation") {
- return undefined
- }
- if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
- if (item.Visible || !allMess) {
- //固定不显示的code
- if (!showTools.cantShow(item.code) && !onlyRead) {
- return undefined
- }
- if (!showTools.isShow(item.code) && !onlyRead) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.code == "EquipQRCode" || item.code == "RoomQRCode") {
- return {
- data: "infos." + item.code,
- renderer: text.lookQRCode,
- readOnly: true
- }
- }
- //图片类型
- if (
- item.code == "InstallPic" ||
- item.code == "Nameplate" ||
- item.code == "Pic"
- ) {
- return {
- data: "infos." + item.code,
- renderer: text.picType,
- readOnly: true
- }
- }
- //文件类型
- if (item.code == "InsuranceFile" ||
- item.code == "Archive" ||
- item.code == "CheckReport" ||
- item.code == "MaintainManual" ||
- item.code == "ApproachingAcceptance" ||
- item.code == "AcceptanceReport" ||
- item.code == "OperationManual" ||
- item.code == "OriginalCertificate" ||
- item.code == "TestReport" ||
- item.code == "ProductCertification" ||
- item.code == "InstallInstruction" ||
- item.code == "SupplierContract" ||
- item.code == "Drawing" ||
- item.code == "InstallDrawing"
- ) {
- return {
- data: "infos." + item.code,
- renderer: text.fileType,
- readOnly: true
- }
- }
- if (item.inputMode == "D1") {
- return {
- data: "infos." + item.code,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- // multiple: true,//多选
- data: item.dataSource || ""
- }
- };
- } else if (item.inputMode == "A1" || item.inputMode == "A2") {
- return {
- data: "infos." + item.code,
- type: "numeric",
- numericFormat: {
- pattern: "0,0.00"
- // culture: 'de-DE' // use this for EUR (German),
- // more cultures available on http://numbrojs.com/languages.html
- }
- };
- } else if (item.inputMode == "C5") {
- return {
- data: "infos." + item.code,
- type: "date",
- dateFormat: "YYYY-MM-DD",
- correctFormat: true
- };
- } else if (
- item.inputMode == "B1" ||
- item.inputMode == "L" ||
- item.inputMode == "L1" ||
- item.inputMode == "L2" ||
- item.inputMode == "M"
- ) {
- return {
- data: "infos." + item.code
- }
- } else if (
- item.inputMode == "X" ||
- item.inputMode == "F2"
- ) {
- return {
- data: "infos." + item.code,
- readOnly: true
- };
- } else if (item.inputMode == "D2") {
- return {
- data: "infos." + item.code,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- multiple: true, //多选
- data: item.dataSource || ""
- }
- };
- } else if (item.inputMode == "Own" && !onlyRead) {
- return {
- data: "infos." + item.code,
- renderer: text.idType,
- }
- } else {
- return {
- data: "infos." + item.code
- }
- }
- } else {
- return undefined
- }
- } else {
- return undefined
- }
- }).filter(item => item);
- return data
- },
- changeHeader(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
- let data = arr.map(item => {
- if (falg) {
- if (item.firstTag == "控制参数" ||
- item.firstTag == "设定参数" ||
- item.firstTag == "运行参数") {
- return undefined
- }
- }
- if (item.code == "BIMLocation") {
- return undefined
- }
- if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
- if (item.Visible || !allMess) {
- if (!showTools.cantShow(item.code) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.code) && !taizhang) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (!item.Unit || item.Unit == "") {
- return item.InfoPointName;
- } else {
- return item.InfoPointName + "(" + item.Unit + ")";
- }
- } else {
- return undefined
- }
- } else {
- return undefined
- }
- }).filter(d => d);
- return data
- },
- showHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false) {
- let data = arr.map(item => {
- if (falg) {
- if (item.firstTag == "控制参数" ||
- item.firstTag == "设定参数" ||
- item.firstTag == "运行参数") {
- return undefined
- }
- }
- if (item.code == "BIMLocation") {
- return undefined
- }
- if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
- if (item.Visible || !allMess) {
- //固定不显示的code
- if (!showTools.cantShow(item.code) && !onlyRead) {
- return undefined
- }
- if (!showTools.isShow(item.code)) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.code == "EquipQRCode") {
- return {
- data: item.Path,
- renderer: text.lookQRCode,
- readOnly: onlyRead
- }
- }
- //图片类型
- if (
- item.code == "InstallPic" ||
- item.code == "Nameplate" ||
- item.code == "Pic"
- ) {
- return {
- data: item.Path,
- renderer: text.picType,
- readOnly: onlyRead
- }
- }
- //文件类型
- if (item.code == "InsuranceFile" ||
- item.code == "Archive" ||
- item.code == "CheckReport" ||
- item.code == "MaintainManual" ||
- item.code == "ApproachingAcceptance" ||
- item.code == "AcceptanceReport" ||
- item.code == "OperationManual" ||
- item.code == "OriginalCertificate" ||
- item.code == "TestReport" ||
- item.code == "ProductCertification" ||
- item.code == "InstallInstruction" ||
- item.code == "SupplierContract" ||
- item.code == "Drawing" ||
- item.code == "InstallDrawing"
- ) {
- return {
- data: item.Path,
- renderer: text.fileType,
- readOnly: onlyRead
- }
- }
- if (item.inputMode == "D1" || item.inputMode == "E1") { //单选
- return {
- data: item.Path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: onlyRead,
- chosenOptions: {
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "D2") {
- return {
- data: item.Path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: onlyRead,
- chosenOptions: {
- multiple: true, //多选
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "A1" || item.inputMode == "A2") {
- return {
- data: item.Path,
- type: "numeric",
- readOnly: onlyRead,
- numericFormat: {
- pattern: "0,0.00"
- }
- };
- } else if (item.inputMode == "C5") {
- return {
- data: item.Path,
- type: "date",
- dateFormat: "YYYY-MM-DD",
- readOnly: onlyRead,
- correctFormat: true
- };
- } else if (item.inputMode == "Own" && !onlyRead) {
- return {
- data: item.Path,
- renderer: text.idType,
- readOnly: onlyRead
- }
- } else {
- return {
- data: item.Path,
- readOnly: onlyRead
- };
- }
- } else {
- return undefined
- }
- } else {
- return undefined
- }
- }).filter(item => item);
- return data
- },
- tableHeadFilter(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
- if (!taizhang) {
- arr = showTools.arrToArr(arr)
- }
- let data = arr.map(item => {
- if (falg) {
- if (item.firstTag == "控制参数" ||
- item.firstTag == "设定参数" ||
- item.firstTag == "运行参数") {
- return undefined
- }
- }
- if (item.code == "BIMLocation") {
- return undefined
- }
- if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
- if (item.Visible || !allMess) {
- if (!showTools.fixedNoShowField(partsAddNoShow, item.code) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.code) && !taizhang) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (!item.Unit || item.Unit == "") {
- return item.InfoPointName;
- } else {
- return item.InfoPointName + "(" + item.Unit + ")";
- }
- } else {
- return undefined
- }
- } else {
- return undefined;
- }
- }).filter(d => d);
- return data
- },
- tableHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
- if (!taizhang) {
- arr = showTools.arrToArr(arr)
- }
- let data = arr.map(item => {
- if (falg) {
- if (item.firstTag == "控制参数" ||
- item.firstTag == "设定参数" ||
- item.firstTag == "运行参数") {
- return undefined
- }
- }
- if (item.Path == "BIMLocation") {
- return undefined
- }
- if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
- if (item.Visible || !allMess) {
- //固定不显示的code
- if (!showTools.fixedNoShowField(partsAddNoShow, item.code) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.code) && !taizhang) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.code == "EquipQRCode") {
- return {
- data: item.Path,
- renderer: text.lookQRCode,
- readOnly: onlyRead
- }
- }
- //图片类型
- if (
- item.code == "InstallPic" ||
- item.code == "Nameplate" ||
- item.code == "Pic"
- ) {
- return {
- data: item.Path,
- renderer: text.picType,
- readOnly: onlyRead
- }
- }
- //文件类型
- if (item.code == "InsuranceFile" ||
- item.code == "Archive" ||
- item.code == "CheckReport" ||
- item.code == "MaintainManual" ||
- item.code == "ApproachingAcceptance" ||
- item.code == "AcceptanceReport" ||
- item.code == "OperationManual" ||
- item.code == "OriginalCertificate" ||
- item.code == "TestReport" ||
- item.code == "ProductCertification" ||
- item.code == "InstallInstruction" ||
- item.code == "SupplierContract" ||
- item.code == "Drawing" ||
- item.code == "InstallDrawing"
- ) {
- return {
- data: item.Path,
- renderer: text.fileType,
- readOnly: onlyRead
- }
- }
- if (item.inputMode == "D1" || item.inputMode == "E1") { //单选
- return {
- data: item.Path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: onlyRead,
- chosenOptions: {
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "D2") {
- return {
- data: item.Path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: onlyRead,
- chosenOptions: {
- multiple: true, //多选
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "A1" || item.inputMode == "A2") {
- return {
- data: item.Path,
- type: "numeric",
- readOnly: onlyRead,
- numericFormat: {
- pattern: "0,0.00"
- }
- };
- } else if (item.inputMode == "C5") {
- return {
- data: item.Path,
- type: "date",
- dateFormat: "YYYY-MM-DD",
- readOnly: onlyRead,
- correctFormat: true
- };
- } else {
- return {
- data: item.Path,
- readOnly: onlyRead
- };
- }
- } else {
- return undefined
- }
- } else {
- return undefined
- }
- }).filter(item => item);
- return data
- },
- /**
- *
- * @param {*} arr 原始表头数组
- * @param {*} type 对应表格的模块类型
- * @param {*} onlyRead 是否只读
- * @param {*} showType 查看类型(全部;只看要采集的信息;隐藏部分信息)
- * @param {*} taizhang 是否是台账类型(默认为false)
- *
- */
- 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 (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
- return undefined
- }
- if (showType == "Visible" && item.visible) { //只看要采集的信息
- return this.isUnit(item)
- } else if (showType == "all") { //显示全部
- return this.isUnit(item)
- } else {
- return undefined
- }
- } else { //编辑模式
- if (taizhang && !this.filterFirm(item.code)) {
- return undefined
- }
- if (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
- return undefined
- }
- if (showType == "Visible" && item.visible) { //只看要采集的信息
- return this.isUnit(item)
- } else if (showType == "all") { //显示全部
- return this.isUnit(item)
- } else if (showType == "partInfo" && item.visible && this.isShow(item.code)) { //隐藏部分厂家信息(***需维护不显示列表***)
- // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
- if (item.firstTag == "techParam") { //技术参数
- return undefined
- } else {
- return this.isUnit(item)
- }
- } else {
- return undefined
- }
- }
- }).filter(d => d)
- return data
- },
- headerTypeFilter(arr, type, onlyRead, showType, taizhang = false) {
- if (taizhang && !onlyRead) {
- arr = this.arrToArr(arr, showType)
- }
- text.readOnly = onlyRead;
- let data = arr.map(item => {
- // if (type == "property" && item.firstTag == "runParam") { //资产台账不显示运行参数
- // return undefined
- // }
- if (onlyRead) { //只读模式
- if (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
- return undefined
- }
- if (showType == "Visible" && item.visible) { //只看要采集的信息
- return this.textFormat(item, onlyRead)
- } else if (showType == "all") { //显示全部
- return this.textFormat(item, onlyRead)
- } else {
- return undefined
- }
- } else { //编辑模式
- if (taizhang && !this.filterFirm(item.code)) {
- return undefined
- }
- if (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
- return undefined
- }
- if (showType == "Visible" && item.visible) { //只看要采集的信息
- return this.inputModeFilter(item, onlyRead)
- } else if (showType == "all") { //显示全部
- return this.inputModeFilter(item, onlyRead)
- } else if (showType == "partInfo" && item.visible && this.isShow(item.code)) { //隐藏部分厂家信息(***需维护不显示列表***)
- // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
- if (item.firstTag == "techParam") { //技术参数
- return undefined
- } else {
- return this.inputModeFilter(item, onlyRead)
- }
- } else {
- return undefined
- }
- }
- }).filter(d => d)
- return data
- },
- isUnit(item) {
- if (!item.unit || item.unit == "") {
- return item.name;
- } else {
- return item.name + "(" + item.unit + ")";
- }
- },
- textFormat(item, onlyRead) {
- if (
- // item.code == "EquipQRCode" ||
- // item.code == "RoomQRCode"
- item.code == "defaultQRCode"
- ) {
- return {
- data: item.path,
- renderer: text.lookQRCode,
- readOnly: onlyRead
- }
- }
- //图片类型
- if (
- item.code == "installPic" ||
- item.code == "nameplate" ||
- item.code == "pic"
- ) {
- return {
- data: item.path,
- renderer: text.picType,
- readOnly: onlyRead
- }
- }
- //文件类型
- if (item.code == "insuranceFile" ||
- item.code == "archive" ||
- item.code == "checkReport" ||
- item.code == "maintainManual" ||
- item.code == "approachingAcceptance" ||
- item.code == "acceptanceReport" ||
- item.code == "operationManual" ||
- item.code == "originalCertificate" ||
- item.code == "testReport" ||
- item.code == "productCertification" ||
- item.code == "installInstruction" ||
- item.code == "supplierContract" ||
- item.code == "drawing" ||
- item.code == "installDrawing"
- ) {
- return {
- data: item.path,
- renderer: text.fileType,
- readOnly: onlyRead
- }
- }
- if (item.inputMode == "D1" || item.inputMode == "E1" || item.inputMode == "D1L") { //单选输入
- return {
- data: item.path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: onlyRead,
- chosenOptions: {
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "D2" || item.inputMode == "E2") { //多选输入
- return {
- data: item.path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: onlyRead,
- chosenOptions: {
- multiple: true, //多选
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "A1" || item.inputMode == "A2") { //数字输入
- return {
- data: item.path,
- type: "numeric",
- readOnly: onlyRead,
- numericFormat: {
- pattern: "0,0.00"
- }
- };
- } else if (item.inputMode == "C5") { //日期输入
- return {
- data: item.path,
- type: "date",
- dateFormat: "YYYYMMDDHHmmss",
- readOnly: onlyRead,
- correctFormat: true
- };
- } else if (item.inputMode == "B1" ||
- item.inputMode == "B2" ||
- item.inputMode == "F1" ||
- item.inputMode == "F2" ||
- item.inputMode == "L1" ||
- item.inputMode == "L2" ||
- item.inputMode == "L" ||
- item.inputMode == "M") { //文本输入
- // console.log(item)
- return {
- data: item.path,
- readOnly: onlyRead
- }
- } else { //(未支持的输入方式)暂不支持编辑
- return {
- data: item.path,
- readOnly: onlyRead
- }
- }
- },
- inputModeFilter(item, onlyRead) {
- if (
- // item.code == "EquipQRCode" ||
- // item.code == "RoomQRCode"
- item.code == "defaultQRCode"
- ) {
- return {
- data: item.path,
- renderer: text.lookQRCode,
- readOnly: !item.editable
- }
- }
- //图片类型
- if (
- item.code == "installPic" ||
- item.code == "nameplate" ||
- item.code == "pic"
- ) {
- return {
- data: item.path,
- renderer: text.picType,
- readOnly: !item.editable
- }
- }
- //文件类型
- if (item.code == "insuranceFile" ||
- item.code == "archive" ||
- item.code == "checkReport" ||
- item.code == "maintainManual" ||
- item.code == "approachingAcceptance" ||
- item.code == "acceptanceReport" ||
- item.code == "operationManual" ||
- item.code == "originalCertificate" ||
- item.code == "testReport" ||
- item.code == "productCertification" ||
- item.code == "installInstruction" ||
- item.code == "supplierContract" ||
- item.code == "drawing" ||
- item.code == "installDrawing"
- ) {
- return {
- data: item.path,
- renderer: text.fileType,
- readOnly: !item.editable
- }
- }
- //四大厂商
- if (
- item.code == "DPSupplierID" ||
- item.code == "DPMaintainerID" ||
- item.code == "DPInsurerID" ||
- item.code == "DPManufacturerID"
- ) {
- return {
- data: item.path,
- renderer: text.idType,
- readOnly: !item.editable
- }
- }
- if (!item.inputMode) {
- this.$message.error('新版字典不支持')
- }
- if (item.inputMode == "D1" || item.inputMode == "E1" || item.inputMode == "D1L") { //单选输入
- return {
- data: item.path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: !item.editable,
- chosenOptions: {
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "D2" || item.inputMode == "E2") { //多选输入
- return {
- data: item.path,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- readOnly: !item.editable,
- chosenOptions: {
- multiple: true, //多选
- data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
- }
- };
- } else if (item.inputMode == "A1" || item.inputMode == "A2") { //数字输入
- return {
- data: item.path,
- type: "numeric",
- readOnly: !item.editable,
- numericFormat: {
- pattern: "0,0.00"
- }
- };
- } else if (item.inputMode == "C5") { //日期输入
- return {
- data: item.path,
- type: "date",
- dateFormat: "YYYYMMDDHHmmss",
- readOnly: !item.editable,
- correctFormat: true
- };
- } else if (item.inputMode == "B1" ||
- item.inputMode == "B2" ||
- item.inputMode == "F1" ||
- item.inputMode == "F2" ||
- item.inputMode == "L1" ||
- item.inputMode == "L2" ||
- item.inputMode == "L" ||
- item.inputMode == "M") { //文本输入
- return {
- data: item.path,
- readOnly: !item.editable
- }
- } else { //(未支持的输入方式)暂不支持编辑
- return {
- data: item.path,
- readOnly: !item.editable
- }
- }
- },
- filterUnshow: (onlyRead, type, code) => {
- let falg = true,
- data = fieldData[type]
- if (onlyRead) {
- data.onlyRead.map(item => {
- if (item == code) {
- falg = false
- }
- })
- return falg
- } else {
- data.edit.map(item => {
- if (item == code) {
- falg = false
- }
- })
- return falg
- }
- },
- filterFirm: (code) => {
- let falg = true
- firmArr.map(item => {
- if (item == code) {
- falg = false
- }
- })
- return falg
- }
- }
- export default showTools
|