123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155 |
- // 不显示的信息点数组
- 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 = [
- "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",
- ]
- //在编辑模式下不显示的字段
- 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"//保险公司传真
- ]
- 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 = {
- 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) {
- let first = 0,
- scound = 0,
- three = 0,
- four = 0
- arr.find(function(value, index, arr) {
- if (
- (value.InfoPointName == "品牌" ||
- value.InfoPointName == "设备型号" ||
- value.InfoPointName == "生产厂家") && !first
- ) {
- first = index
- }
- if (
- (value.InfoPointName == "供应商单位名称" ||
- value.InfoPointName == "供应商联系人" ||
- value.InfoPointName == "供应商电子邮件" ||
- value.InfoPointName == "供应商网址" ||
- value.InfoPointName == "供应商传真" ||
- value.InfoPointName == "供应商联系电话") && !scound
- ) {
- scound = index
- }
- if (
- (value.InfoPointName == "维修商单位名称" ||
- value.InfoPointName == "维修商联系人" ||
- value.InfoPointName == "维修商联系电话" ||
- value.InfoPointName == "维修商电子邮件" ||
- value.InfoPointName == "维修商网址" ||
- value.InfoPointName == "维修商传真") && !three
- ) {
- three = index
- }
- if (
- (value.InfoPointName == "保险公司名称" ||
- value.InfoPointName == "保险公司联系人" ||
- value.InfoPointName == "保险公司联系电话" ||
- value.InfoPointName == "保险公司电子邮件" ||
- value.InfoPointName == "保险公司网址" ||
- value.InfoPointName == "保险公司传真") && !four
- ) {
- four = index
- }
- })
- let numList = [first, scound, three, four]
- numList.reverse().map((item, index) => {
- if (!!item) {
- if (index == 0) {
- arr.splice(item, 0, {
- InfoPointName: "保险公司信息",
- InfoPointCode: "DPInsurerID",
- Path: 'DPInsurerID',
- InputMode: "Own",
- Unit: "",
- SecondTag: "",
- FirstTag: "",
- Visible: true,
- })
- } else if (index == 1) {
- arr.splice(item, 0, {
- InfoPointName: "维修商信息",
- InfoPointCode: "DPMaintainerID",
- Path: 'DPMaintainerID',
- InputMode: "Own",
- Unit: "",
- SecondTag: "",
- FirstTag: "",
- Visible: true,
- })
- } else if (index == 2) {
- arr.splice(item, 0, {
- InfoPointName: "供应商信息",
- InfoPointCode: "DPSupplierID",
- Path: 'DPSupplierID',
- InputMode: "Own",
- Unit: "",
- SecondTag: "",
- FirstTag: "",
- Visible: true,
- })
- } else if (index == 3) {
- arr.splice(item, 0, {
- InfoPointName: "品牌型号",
- InfoPointCode: "DPManufacturerID",
- Path: 'DPManufacturerID',
- InputMode: "Own",
- Unit: "",
- SecondTag: "",
- FirstTag: "",
- 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 是否是台账类型
- *
- */
- headerTextFilter (arr, type, onlyRead, showType, taizhang = false) {
- let data = arr.map(item => {
- if (onlyRead) { //只读模式
- if (showType == "Visible" && item.Visible) { //只看要采集的信息
- return showTools.isUnit(item)
- } else if (showType == "all") { //显示全部
- return showTools.isUnit(item)
- } else {
- return undefined
- }
- } else { //编辑模式
- if (taizhang && !showTools.filterFirm(item.InfoPointCode)) {
- return undefined
- }
- if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
- return undefined
- }
- if (showType == "Visible" && item.Visible) { //只看要采集的信息
- return showTools.isUnit(item)
- } else if (showType == "all") { //显示全部
- return showTools.isUnit(item)
- } else if (showType == "partInfo" && showTools.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
- // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
- if (item.FirstTag == "TechParam") {
- return undefined
- } else {
- return showTools.isUnit(item)
- }
- } else {
- return undefined
- }
- }
- }).filter(d => d)
- return data
- },
- headerTypeFilter (arr, type, onlyRead, showType, taizhang = false) {
- let data = arr.map(item => {
- if (onlyRead) { //只读模式
- if (showType == "Visible" && item.Visible) { //只看要采集的信息
- return showTools.textFormat(item, onlyRead)
- } else if (showType == "all") { //显示全部
- return showTools.textFormat(item, onlyRead)
- } else {
- return undefined
- }
- } else { //编辑模式
- if (taizhang && !showTools.filterFirm(item.InfoPointCode)) {
- return undefined
- }
- if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
- return undefined
- }
- if (showType == "Visible" && item.Visible) { //只看要采集的信息
- return showTools.inputModeFilter(item)
- } else if (showType == "all") { //显示全部
- return showTools.inputModeFilter(item)
- } else if (showType == "partInfo" && showTools.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
- // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
- if (item.FirstTag == "TechParam") {
- return undefined
- } else {
- return showTools.inputModeFilter(item)
- }
- } 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") {
- 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
- }
- }
- return {
- data: item.Path,
- readOnly: onlyRead
- }
- },
- inputModeFilter (item) {
- if (item.InfoPointCode == "EquipQRCode") {
- 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 == "insurer"
- ) {
- return {
- data: item.Path,
- renderer: text.idType,
- readOnly: !item.Editable
- }
- }
- if (item.InputMode == "D1" || item.InputMode == "E1") { //单选输入
- 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 == "A3" ||
- item.InputMode == "A4" ||
- 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]
- console.log(fieldData)
- if (onlyRead) {
- data.onlyRead.map(item => {
- if (item == code) {
- falg = false
- }
- })
- return falg
- } else {
- data.onlyRead.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
|