12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217 |
- // 不显示的信息点数组
- 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.InfoPointCode == "Brand" && flag) ||
- (value.InfoPointCode == "Specification" && flag) ||
- (value.InfoPointCode == "Manufacturer" && flag)) && !first
- ) {
- first = index
- }
- if (
- ((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.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.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 (index == 0) {
- arr.splice(item, 0, {
- DataType: "Str",
- FirstName: "基本信息",
- InfoPointCode: "DPInsurerID",
- InfoPointName: "保险公司信息",
- InputMode: "X",
- Path: "DPInsurerID",
- Priority: "S",
- Editable: true,
- Visible: true
- })
- } else if (index == 1) {
- arr.splice(item, 0, {
- DataType: "Str",
- FirstName: "基本信息",
- InfoPointCode: "DPMaintainerID",
- InfoPointName: "维修商信息",
- InputMode: "X",
- Path: "DPMaintainerID",
- Priority: "S",
- Editable: true,
- Visible: true
- })
- } else if (index == 2) {
- arr.splice(item, 0, {
- DataType: "Str",
- FirstName: "基本信息",
- InfoPointCode: "DPSupplierID",
- InfoPointName: "供应商信息",
- InputMode: "X",
- Path: "DPSupplierID",
- Priority: "S",
- Editable: true,
- Visible: true
- })
- } else if (index == 3) {
- arr.splice(item, 0, {
- DataType: "Str",
- FirstName: "基本信息",
- InfoPointCode: "DPManufacturerID",
- InfoPointName: "生产厂家/品牌/型号",
- 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.InfoPointCode == "BIMLocation") {
- return undefined
- }
- if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
- if (item.Visible || !allMess) {
- //固定不显示的code
- if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.InfoPointCode) && !taizhang && !taizhang) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.InfoPointCode == "EquipQRCode") {
- return {
- data: "Infos." + item.InfoPointCode,
- renderer: text.lookQRCode,
- readOnly: true
- }
- }
- if (item.InputMode == "D1") {
- return {
- data: "Infos." + item.InfoPointCode,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- // multiple: true,//多选
- data: item.DataSource || ""
- }
- };
- } else if (item.InputMode == "A1" || item.InputMode == "A2") {
- return {
- data: "Infos." + item.InfoPointCode,
- 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.InfoPointCode,
- 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.InfoPointCode
- };
- } else if (
- item.InputMode == "X"
- // item.InputMode == "L1" ||
- // item.InputMode == "L2"
- ) {
- // return undefined
- return {
- data: "Infos." + item.InfoPointCode,
- readOnly: true
- };
- } else if (item.InputMode == "D2") {
- return {
- data: "Infos." + item.InfoPointCode,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- multiple: true, //多选
- data: item.DataSource || ""
- }
- };
- } else if (item.InputMode == "Own" && !onlyRead) {
- return {
- data: "Infos." + item.InfoPointCode,
- renderer: text.idType,
- }
- } else {
- return {
- data: "infos." + item.InfoPointCode
- }
- }
- } 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.InfoPointCode == "BIMLocation") {
- return undefined
- }
- if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
- if (item.Visible || !allMess) {
- //固定不显示的code
- if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
- return undefined
- }
- if (!showTools.isShow(item.InfoPointCode) && !onlyRead) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.InfoPointCode == "EquipQRCode" || item.InfoPointCode == "RoomQRCode") {
- return {
- data: "infos." + item.InfoPointCode,
- renderer: text.lookQRCode,
- readOnly: true
- }
- }
- //图片类型
- if (
- item.InfoPointCode == "InstallPic" ||
- item.InfoPointCode == "InstallDrawing" ||
- item.InfoPointCode == "Nameplate" ||
- item.InfoPointCode == "Pic" ||
- item.InfoPointCode == "Drawing"
- ) {
- return {
- data: "infos." + item.InfoPointCode,
- renderer: text.picType,
- readOnly: true
- }
- }
- //文件类型
- if (item.InfoPointCode == "InsuranceFile" ||
- item.InfoPointCode == "Archive" ||
- item.InfoPointCode == "CheckReport") {
- return {
- data: "infos." + item.InfoPointCode,
- renderer: text.fileType,
- readOnly: true
- }
- }
- if (item.InputMode == "D1") {
- return {
- data: "infos." + item.InfoPointCode,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- // multiple: true,//多选
- data: item.DataSource || ""
- }
- };
- } else if (item.InputMode == "A1" || item.InputMode == "A2") {
- return {
- data: "infos." + item.InfoPointCode,
- 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.InfoPointCode,
- 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.InfoPointCode
- }
- } else if (
- item.InputMode == "X" ||
- item.InputMode == "F2"
- ) {
- return {
- data: "infos." + item.InfoPointCode,
- readOnly: true
- };
- } else if (item.InputMode == "D2") {
- return {
- data: "infos." + item.InfoPointCode,
- renderer: tools.customDropdownRenderer,
- editor: "chosen",
- chosenOptions: {
- multiple: true, //多选
- data: item.DataSource || ""
- }
- };
- } else if (item.InputMode == "Own" && !onlyRead) {
- return {
- data: "infos." + item.InfoPointCode,
- renderer: text.idType,
- }
- } else {
- return {
- data: "infos." + item.InfoPointCode
- }
- }
- } 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.InfoPointCode == "BIMLocation") {
- return undefined
- }
- if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
- if (item.Visible || !allMess) {
- if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.InfoPointCode) && !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.InfoPointCode == "BIMLocation") {
- return undefined
- }
- if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
- if (item.Visible || !allMess) {
- //固定不显示的code
- if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
- return undefined
- }
- if (!showTools.isShow(item.InfoPointCode)) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.InfoPointCode == "EquipQRCode") {
- return {
- data: item.Path,
- renderer: text.lookQRCode,
- readOnly: onlyRead
- }
- }
- //图片类型
- if (
- item.InfoPointCode == "InstallPic" ||
- item.InfoPointCode == "InstallDrawing" ||
- item.InfoPointCode == "Nameplate" ||
- item.InfoPointCode == "Pic" ||
- item.InfoPointCode == "Drawing"
- ) {
- return {
- data: item.Path,
- renderer: text.picType,
- readOnly: onlyRead
- }
- }
- //文件类型
- if (item.InfoPointCode == "InsuranceFile" ||
- item.InfoPointCode == "Archive" ||
- item.InfoPointCode == "CheckReport") {
- 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.InfoPointCode == "BIMLocation") {
- return undefined
- }
- if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
- if (item.Visible || !allMess) {
- if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.InfoPointCode) && !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.InfoPointCode) && !onlyRead && !taizhang) {
- return undefined
- }
- if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
- if (isWatch && !onlyRead) {
- return undefined
- }
- }
- if (item.InfoPointCode == "EquipQRCode") {
- return {
- data: item.Path,
- renderer: text.lookQRCode,
- readOnly: onlyRead
- }
- }
- //图片类型
- if (
- item.InfoPointCode == "InstallPic" ||
- item.InfoPointCode == "InstallDrawing" ||
- item.InfoPointCode == "Nameplate" ||
- item.InfoPointCode == "Pic" ||
- item.InfoPointCode == "Drawing"
- ) {
- return {
- data: item.Path,
- renderer: text.picType,
- readOnly: onlyRead
- }
- }
- //文件类型
- if (item.InfoPointCode == "InsuranceFile" ||
- item.InfoPointCode == "Archive" ||
- item.InfoPointCode == "CheckReport") {
- 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.InfoPointCode)) { //过滤固定不显示字段
- 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.InfoPointCode)) {
- return undefined
- }
- if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
- 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.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
- // 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)
- }
- let data = arr.map(item => {
- // if (type == "property" && item.FirstTag == "RunParam") { //资产台账不显示运行参数
- // return undefined
- // }
- if (onlyRead) { //只读模式
- if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
- 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.InfoPointCode)) {
- return undefined
- }
- if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
- 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.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
- // 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.InfoPointName;
- } else {
- return item.InfoPointName + "(" + item.Unit + ")";
- }
- },
- textFormat(item, onlyRead) {
- if (
- item.InfoPointCode == "EquipQRCode" ||
- item.InfoPointCode == "RoomQRCode"
- ) {
- return {
- data: item.Path,
- renderer: text.lookQRCode,
- readOnly: onlyRead
- }
- }
- //图片类型
- if (
- item.InfoPointCode == "InstallPic" ||
- item.InfoPointCode == "InstallDrawing" ||
- item.InfoPointCode == "Nameplate" ||
- item.InfoPointCode == "Pic" ||
- item.InfoPointCode == "Drawing"
- ) {
- return {
- data: item.Path,
- renderer: text.picType,
- readOnly: onlyRead
- }
- }
- //文件类型
- if (item.InfoPointCode == "InsuranceFile" ||
- item.InfoPointCode == "Archive" ||
- item.InfoPointCode == "CheckReport") {
- 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: "YYYY-MM-DD",
- 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") { //文本输入
- return {
- data: item.Path,
- readOnly: onlyRead
- }
- } else { //(未支持的输入方式)暂不支持编辑
- return {
- data: item.Path,
- readOnly: onlyRead
- }
- }
- },
- inputModeFilter(item, onlyRead) {
- if (
- item.InfoPointCode == "EquipQRCode" ||
- item.InfoPointCode == "RoomQRCode"
- ) {
- return {
- data: item.Path,
- renderer: text.lookQRCode,
- readOnly: !item.Editable
- }
- }
- //图片类型
- if (
- item.InfoPointCode == "InstallPic" ||
- item.InfoPointCode == "InstallDrawing" ||
- item.InfoPointCode == "Nameplate" ||
- item.InfoPointCode == "Pic" ||
- item.InfoPointCode == "Drawing"
- ) {
- return {
- data: item.Path,
- renderer: text.picType,
- readOnly: !item.Editable
- }
- }
- //文件类型
- if (item.InfoPointCode == "InsuranceFile" ||
- item.InfoPointCode == "Archive" ||
- item.InfoPointCode == "CheckReport") {
- return {
- data: item.Path,
- renderer: text.fileType,
- readOnly: !item.Editable
- }
- }
- //四大厂商
- if (
- item.InfoPointCode == "DPSupplierID" ||
- item.InfoPointCode == "DPMaintainerID" ||
- item.InfoPointCode == "DPInsurerID" ||
- item.InfoPointCode == "DPManufacturerID"
- ) {
- return {
- data: item.Path,
- renderer: text.idType,
- readOnly: !item.Editable
- }
- }
- 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: "YYYY-MM-DD",
- 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: onlyRead
- }
- }
- },
- 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
|