notShow.js 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. // 不显示的信息点数组
  2. import text from "@/utils/handsontable/mainText"
  3. import tools from "@/utils/scan/tools"
  4. import fieldData from "@/utils/handsontable/fillterField"
  5. let InputModeArr = ["A1", "A2", "B1", "C5", "D1", "D2", "E1", "L", "L1", "L2", "F1", "F2", "M", "Own"]
  6. //在编辑模式下并且勾选隐藏自动填充的信息点不显示的字段
  7. let noShowArr = [
  8. "Specification",
  9. "ServiceLife"
  10. ]
  11. //在编辑模式下不显示的字段
  12. let cantShow = [
  13. "EquipQRCode",
  14. "EquipID",
  15. "EquipName",
  16. "BIMLocation",
  17. "Brand",
  18. "Specification",
  19. "Manufacturer",
  20. "Supplier",
  21. "SupplierContactor",
  22. "SupplierPhone",
  23. "SupplierEmail",
  24. "SupplierWeb",
  25. "SupplierFax",
  26. "Maintainer",
  27. "MaintainerContactor",
  28. "MaintainerPhone",
  29. "MaintainerEmail",
  30. "MaintainerWeb",
  31. "Principal",
  32. "MaintainerFax",
  33. "Insurer",
  34. "InsurerContactor",
  35. "InsurerPhone",
  36. "InsurerEmail",
  37. "InsurerWeb",
  38. "InsurerFax",
  39. "InsuranceFile",
  40. "EquipID",
  41. "EquipName",
  42. "SpaceCount",
  43. "SpaceList",
  44. "TenantID",
  45. "ShaftID"
  46. ]
  47. //台账编辑页面不显示的厂商信息
  48. let firmArr = [
  49. "Brand", //品牌
  50. "Specification", //设备型号
  51. "Manufacturer", //生产厂家
  52. "Supplier", //供应商单位名称
  53. "SupplierContactor", //供应商联系人
  54. "SupplierPhone", //供应商联系电话
  55. "SupplierEmail", //供应商电子邮件
  56. "SupplierWeb", //供应商网址
  57. "SupplierFax", //供应商传真
  58. "Maintainer", //维修商单位名称
  59. "MaintainerContactor", //维修商联系人
  60. "MaintainerPhone", //维修商联系电话
  61. "MaintainerEmail", //维修商电子邮件
  62. "MaintainerWeb", //维修商网址
  63. "MaintainerFax", //维修商传真
  64. "Insurer", //保险公司名称
  65. "InsurerContactor", //保险公司联系人
  66. "InsurerPhone", //保险公司联系电话
  67. 'InsurerEmail', //保险公司电子邮件
  68. "InsurerWeb", //保险公司网址
  69. "InsurerFax" //保险公司传真
  70. // "DPManufacturerID",//品牌型号Id
  71. // "DPSupplierID",//供应商信息Id
  72. // "DPMaintainerID",//维修商信息Id
  73. // "DPInsurerID"//保险公司信息Id
  74. ]
  75. let cutArr = [{
  76. name: "品牌型号",
  77. code: "DPManufacturerID",
  78. num: 2,
  79. }, {
  80. name: "供应商信息",
  81. code: "DPSupplierID",
  82. num: 5
  83. }, {
  84. name: "维修商信息",
  85. code: "DPMaintainerID",
  86. num: 19
  87. }, {
  88. name: "保险公司信息",
  89. code: "DPInsurerID",
  90. num: 25
  91. }]
  92. let newData = [{
  93. name: "品牌型号",
  94. code: "DPManufacturerID",
  95. num: 2,
  96. }, {
  97. name: "供应商信息",
  98. code: "DPSupplierID",
  99. num: 8
  100. }, {
  101. name: "维修商信息",
  102. code: "DPMaintainerID",
  103. num: 35
  104. }, {
  105. name: "保险公司信息",
  106. code: "DPInsurerID",
  107. num: 42
  108. }]
  109. //创建部件固定不显示-管理部件固定不显示(即编辑模式)
  110. let partsAddNoShow = [
  111. 'EquipID',
  112. 'EquipName',
  113. 'EquipQRCode',
  114. 'BIMID',
  115. 'BIMLocation',
  116. 'Brand',
  117. 'Specification',
  118. 'Manufacturer',
  119. 'Supplier',
  120. 'SupplierContactor',
  121. 'SupplierPhone',
  122. 'SupplierEmail',
  123. 'SupplierWeb',
  124. 'SupplierFax',
  125. 'Maintainer',
  126. 'MaintainerContactor',
  127. 'MaintainerPhone',
  128. 'MaintainerEmail',
  129. 'MaintainerWeb',
  130. 'MaintainerFax',
  131. 'Insurer',
  132. "InsurerContactor",
  133. "InsurerPhone",
  134. "InsurerEmail",
  135. "InsurerWeb",
  136. "InsurerFax",
  137. ]
  138. const showTools = {
  139. InputModeArr: ["A1", "A2", "B1", "B2", "C5", "D1", "D1L", "D2", "E1", "E2", "L", "L1", "L2", "F1", "F2", "M"],
  140. addArr: () => {
  141. return cutArr
  142. },
  143. cantShow: (code) => {
  144. let falg = true
  145. cantShow.map(item => {
  146. if (item == code) {
  147. falg = false
  148. }
  149. })
  150. return falg
  151. },
  152. fixedNoShowField: (noShowList, code) => {
  153. let flag = true
  154. noShowList.map(item => {
  155. if (item == code) {
  156. flag = false
  157. }
  158. })
  159. return flag
  160. },
  161. //几种类型不显示
  162. technologyParam: (item) => {
  163. if (
  164. item.FirstTag == "控制参数" &&
  165. item.FirstTag == "设定参数" &&
  166. item.FirstTag == "运行参数"
  167. ) {
  168. return undefined
  169. }
  170. },
  171. isShow: (code) => {
  172. let falg = true
  173. noShowArr.map(item => {
  174. if (item == code) {
  175. falg = false
  176. }
  177. })
  178. return falg
  179. },
  180. //插入需要的关系
  181. insertionRea: (data) => {
  182. cutArr.map(item => {
  183. data.splice(item.num, 0, item.name)
  184. })
  185. return data
  186. },
  187. insertionRea2: (data) => {
  188. newData.map(item => {
  189. data.splice(item.num, 0, item.name)
  190. })
  191. return data
  192. },
  193. insertionType: (data, callback) => {
  194. cutArr.map(item => {
  195. data.splice(item.num, 0, {
  196. data: "infos." + item.code,
  197. renderer: callback,
  198. readOnly: false
  199. })
  200. })
  201. return data
  202. },
  203. insertionType2: (data, callback) => {
  204. newData.map(item => {
  205. data.splice(item.num, 0, {
  206. data: "infos." + item.code,
  207. renderer: callback,
  208. readOnly: false
  209. })
  210. })
  211. return data
  212. },
  213. arrToArr(arr, showType) {
  214. let first = 0,
  215. scound = 0,
  216. three = 0,
  217. four = 0
  218. arr.find(function (value, index, arr) {
  219. let flag = (showType != "Visible" || value.Visible)
  220. if (
  221. ((value.InfoPointCode == "Brand" && flag) ||
  222. (value.InfoPointCode == "Specification" && flag) ||
  223. (value.InfoPointCode == "Manufacturer" && flag)) && !first
  224. ) {
  225. first = index
  226. }
  227. if (
  228. ((value.InfoPointCode == "Supplier" && flag) ||
  229. (value.InfoPointCode == "SupplierContactor" && flag) ||
  230. (value.InfoPointCode == "SupplierEmail" && flag) ||
  231. (value.InfoPointCode == "SupplierWeb" && flag) ||
  232. (value.InfoPointCode == "SupplierFax" && flag) ||
  233. (value.InfoPointCode == "SupplierPhone" && flag)) && !scound
  234. ) {
  235. scound = index
  236. }
  237. if (
  238. ((value.InfoPointCode == "Maintainer" && flag) ||
  239. (value.InfoPointCode == "MaintainerContactor" && flag) ||
  240. (value.InfoPointCode == "MaintainerPhone" && flag) ||
  241. (value.InfoPointCode == "MaintainerEmail" && flag) ||
  242. (value.InfoPointCode == "MaintainerWeb" && flag) ||
  243. (value.InfoPointCode == "MaintainerFax" && flag)) && !three
  244. ) {
  245. three = index
  246. }
  247. if (
  248. ((value.InfoPointCode == "Insurer" && flag) ||
  249. (value.InfoPointCode == "InsurerContactor" && flag) ||
  250. (value.InfoPointCode == "InsurerPhone" && flag) ||
  251. (value.InfoPointCode == "InsurerEmail" && flag) ||
  252. (value.InfoPointCode == "InsurerWeb" && flag) ||
  253. (value.InfoPointCode == "InsurerFax" && flag)) && !four
  254. ) {
  255. four = index
  256. }
  257. })
  258. let numList = [first, scound, three, four]
  259. numList.reverse().map((item, index) => {
  260. if (item) {
  261. if (index == 0) {
  262. arr.splice(item, 0, {
  263. DataType: "Str",
  264. FirstName: "基本信息",
  265. InfoPointCode: "DPInsurerID",
  266. InfoPointName: "保险公司信息",
  267. InputMode: "X",
  268. Path: "DPInsurerID",
  269. Priority: "S",
  270. Editable: true,
  271. Visible: true
  272. })
  273. } else if (index == 1) {
  274. arr.splice(item, 0, {
  275. DataType: "Str",
  276. FirstName: "基本信息",
  277. InfoPointCode: "DPMaintainerID",
  278. InfoPointName: "维修商信息",
  279. InputMode: "X",
  280. Path: "DPMaintainerID",
  281. Priority: "S",
  282. Editable: true,
  283. Visible: true
  284. })
  285. } else if (index == 2) {
  286. arr.splice(item, 0, {
  287. DataType: "Str",
  288. FirstName: "基本信息",
  289. InfoPointCode: "DPSupplierID",
  290. InfoPointName: "供应商信息",
  291. InputMode: "X",
  292. Path: "DPSupplierID",
  293. Priority: "S",
  294. Editable: true,
  295. Visible: true
  296. })
  297. } else if (index == 3) {
  298. arr.splice(item, 0, {
  299. DataType: "Str",
  300. FirstName: "基本信息",
  301. InfoPointCode: "DPManufacturerID",
  302. InfoPointName: "生产厂家/品牌/型号",
  303. InputMode: "X",
  304. Path: "DPManufacturerID",
  305. Priority: "S",
  306. Editable: true,
  307. Visible: true
  308. })
  309. }
  310. }
  311. })
  312. return arr
  313. },
  314. changeTypes(arr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  315. let data = arr.map(item => {
  316. if (falg) {
  317. if (item.FirstTag == "控制参数" ||
  318. item.FirstTag == "设定参数" ||
  319. item.FirstTag == "运行参数") {
  320. return undefined
  321. }
  322. }
  323. if (item.InfoPointCode == "BIMLocation") {
  324. return undefined
  325. }
  326. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  327. if (item.Visible || !allMess) {
  328. //固定不显示的code
  329. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
  330. return undefined
  331. }
  332. if (!showTools.isShow(item.InfoPointCode) && !taizhang && !taizhang) {
  333. if (isWatch && !onlyRead) {
  334. return undefined
  335. }
  336. }
  337. if (item.InfoPointCode == "EquipQRCode") {
  338. return {
  339. data: "Infos." + item.InfoPointCode,
  340. renderer: text.lookQRCode,
  341. readOnly: true
  342. }
  343. }
  344. if (item.InputMode == "D1") {
  345. return {
  346. data: "Infos." + item.InfoPointCode,
  347. renderer: tools.customDropdownRenderer,
  348. editor: "chosen",
  349. chosenOptions: {
  350. // multiple: true,//多选
  351. data: item.DataSource || ""
  352. }
  353. };
  354. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  355. return {
  356. data: "Infos." + item.InfoPointCode,
  357. type: "numeric",
  358. numericFormat: {
  359. pattern: "0,0.00"
  360. // culture: 'de-DE' // use this for EUR (German),
  361. // more cultures available on http://numbrojs.com/languages.html
  362. }
  363. };
  364. } else if (item.InputMode == "C5") {
  365. return {
  366. data: "Infos." + item.InfoPointCode,
  367. type: "date",
  368. dateFormat: "YYYY-MM-DD",
  369. correctFormat: true
  370. };
  371. } else if (
  372. item.InputMode == "B1" ||
  373. item.InputMode == "L" ||
  374. item.InputMode == "L1" ||
  375. item.InputMode == "L2" ||
  376. item.InputMode == "M"
  377. ) {
  378. return {
  379. data: "Infos." + item.InfoPointCode
  380. };
  381. } else if (
  382. item.InputMode == "X"
  383. // item.InputMode == "L1" ||
  384. // item.InputMode == "L2"
  385. ) {
  386. // return undefined
  387. return {
  388. data: "Infos." + item.InfoPointCode,
  389. readOnly: true
  390. };
  391. } else if (item.InputMode == "D2") {
  392. return {
  393. data: "Infos." + item.InfoPointCode,
  394. renderer: tools.customDropdownRenderer,
  395. editor: "chosen",
  396. chosenOptions: {
  397. multiple: true, //多选
  398. data: item.DataSource || ""
  399. }
  400. };
  401. } else if (item.InputMode == "Own" && !onlyRead) {
  402. return {
  403. data: "Infos." + item.InfoPointCode,
  404. renderer: text.idType,
  405. }
  406. } else {
  407. return {
  408. data: "infos." + item.InfoPointCode
  409. }
  410. }
  411. } else {
  412. return undefined
  413. }
  414. } else {
  415. return false
  416. }
  417. }).filter(item => item);
  418. return data
  419. },
  420. showTypes(arr, onlyRead, isWatch, allMess, falg = false, typeArr = false) {
  421. let data = arr.map(item => {
  422. if (falg) {
  423. if (item.FirstTag == "控制参数" ||
  424. item.FirstTag == "设定参数" ||
  425. item.FirstTag == "运行参数") {
  426. return undefined
  427. }
  428. }
  429. if (item.InfoPointCode == "BIMLocation") {
  430. return undefined
  431. }
  432. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  433. if (item.Visible || !allMess) {
  434. //固定不显示的code
  435. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
  436. return undefined
  437. }
  438. if (!showTools.isShow(item.InfoPointCode) && !onlyRead) {
  439. if (isWatch && !onlyRead) {
  440. return undefined
  441. }
  442. }
  443. if (item.InfoPointCode == "EquipQRCode" || item.InfoPointCode == "RoomQRCode") {
  444. return {
  445. data: "infos." + item.InfoPointCode,
  446. renderer: text.lookQRCode,
  447. readOnly: true
  448. }
  449. }
  450. //图片类型
  451. if (
  452. item.InfoPointCode == "InstallPic" ||
  453. item.InfoPointCode == "Nameplate" ||
  454. item.InfoPointCode == "Pic"
  455. ) {
  456. return {
  457. data: "infos." + item.InfoPointCode,
  458. renderer: text.picType,
  459. readOnly: true
  460. }
  461. }
  462. //文件类型
  463. if (item.InfoPointCode == "InsuranceFile" ||
  464. item.InfoPointCode == "Archive" ||
  465. item.InfoPointCode == "CheckReport" ||
  466. item.InfoPointCode == "MaintainManual" ||
  467. item.InfoPointCode == "ApproachingAcceptance" ||
  468. item.InfoPointCode == "AcceptanceReport" ||
  469. item.InfoPointCode == "OperationManual" ||
  470. item.InfoPointCode == "OriginalCertificate" ||
  471. item.InfoPointCode == "TestReport" ||
  472. item.InfoPointCode == "ProductCertification" ||
  473. item.InfoPointCode == "InstallInstruction" ||
  474. item.InfoPointCode == "SupplierContract" ||
  475. item.InfoPointCode == "Drawing" ||
  476. item.InfoPointCode == "InstallDrawing"
  477. ) {
  478. return {
  479. data: "infos." + item.InfoPointCode,
  480. renderer: text.fileType,
  481. readOnly: true
  482. }
  483. }
  484. if (item.InputMode == "D1") {
  485. return {
  486. data: "infos." + item.InfoPointCode,
  487. renderer: tools.customDropdownRenderer,
  488. editor: "chosen",
  489. chosenOptions: {
  490. // multiple: true,//多选
  491. data: item.DataSource || ""
  492. }
  493. };
  494. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  495. return {
  496. data: "infos." + item.InfoPointCode,
  497. type: "numeric",
  498. numericFormat: {
  499. pattern: "0,0.00"
  500. // culture: 'de-DE' // use this for EUR (German),
  501. // more cultures available on http://numbrojs.com/languages.html
  502. }
  503. };
  504. } else if (item.InputMode == "C5") {
  505. return {
  506. data: "infos." + item.InfoPointCode,
  507. type: "date",
  508. dateFormat: "YYYY-MM-DD",
  509. correctFormat: true
  510. };
  511. } else if (
  512. item.InputMode == "B1" ||
  513. item.InputMode == "L" ||
  514. item.InputMode == "L1" ||
  515. item.InputMode == "L2" ||
  516. item.InputMode == "M"
  517. ) {
  518. return {
  519. data: "infos." + item.InfoPointCode
  520. }
  521. } else if (
  522. item.InputMode == "X" ||
  523. item.InputMode == "F2"
  524. ) {
  525. return {
  526. data: "infos." + item.InfoPointCode,
  527. readOnly: true
  528. };
  529. } else if (item.InputMode == "D2") {
  530. return {
  531. data: "infos." + item.InfoPointCode,
  532. renderer: tools.customDropdownRenderer,
  533. editor: "chosen",
  534. chosenOptions: {
  535. multiple: true, //多选
  536. data: item.DataSource || ""
  537. }
  538. };
  539. } else if (item.InputMode == "Own" && !onlyRead) {
  540. return {
  541. data: "infos." + item.InfoPointCode,
  542. renderer: text.idType,
  543. }
  544. } else {
  545. return {
  546. data: "infos." + item.InfoPointCode
  547. }
  548. }
  549. } else {
  550. return undefined
  551. }
  552. } else {
  553. return undefined
  554. }
  555. }).filter(item => item);
  556. return data
  557. },
  558. changeHeader(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  559. let data = arr.map(item => {
  560. if (falg) {
  561. if (item.FirstTag == "控制参数" ||
  562. item.FirstTag == "设定参数" ||
  563. item.FirstTag == "运行参数") {
  564. return undefined
  565. }
  566. }
  567. if (item.InfoPointCode == "BIMLocation") {
  568. return undefined
  569. }
  570. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  571. if (item.Visible || !allMess) {
  572. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
  573. return undefined
  574. }
  575. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  576. if (isWatch && !onlyRead) {
  577. return undefined
  578. }
  579. }
  580. if (!item.Unit || item.Unit == "") {
  581. return item.InfoPointName;
  582. } else {
  583. return item.InfoPointName + "(" + item.Unit + ")";
  584. }
  585. } else {
  586. return undefined
  587. }
  588. } else {
  589. return undefined
  590. }
  591. }).filter(d => d);
  592. return data
  593. },
  594. showHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false) {
  595. let data = arr.map(item => {
  596. if (falg) {
  597. if (item.FirstTag == "控制参数" ||
  598. item.FirstTag == "设定参数" ||
  599. item.FirstTag == "运行参数") {
  600. return undefined
  601. }
  602. }
  603. if (item.InfoPointCode == "BIMLocation") {
  604. return undefined
  605. }
  606. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  607. if (item.Visible || !allMess) {
  608. //固定不显示的code
  609. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
  610. return undefined
  611. }
  612. if (!showTools.isShow(item.InfoPointCode)) {
  613. if (isWatch && !onlyRead) {
  614. return undefined
  615. }
  616. }
  617. if (item.InfoPointCode == "EquipQRCode") {
  618. return {
  619. data: item.Path,
  620. renderer: text.lookQRCode,
  621. readOnly: onlyRead
  622. }
  623. }
  624. //图片类型
  625. if (
  626. item.InfoPointCode == "InstallPic" ||
  627. item.InfoPointCode == "Nameplate" ||
  628. item.InfoPointCode == "Pic"
  629. ) {
  630. return {
  631. data: item.Path,
  632. renderer: text.picType,
  633. readOnly: onlyRead
  634. }
  635. }
  636. //文件类型
  637. if (item.InfoPointCode == "InsuranceFile" ||
  638. item.InfoPointCode == "Archive" ||
  639. item.InfoPointCode == "CheckReport" ||
  640. item.InfoPointCode == "MaintainManual" ||
  641. item.InfoPointCode == "ApproachingAcceptance" ||
  642. item.InfoPointCode == "AcceptanceReport" ||
  643. item.InfoPointCode == "OperationManual" ||
  644. item.InfoPointCode == "OriginalCertificate" ||
  645. item.InfoPointCode == "TestReport" ||
  646. item.InfoPointCode == "ProductCertification" ||
  647. item.InfoPointCode == "InstallInstruction" ||
  648. item.InfoPointCode == "SupplierContract" ||
  649. item.InfoPointCode == "Drawing" ||
  650. item.InfoPointCode == "InstallDrawing"
  651. ) {
  652. return {
  653. data: item.Path,
  654. renderer: text.fileType,
  655. readOnly: onlyRead
  656. }
  657. }
  658. if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
  659. return {
  660. data: item.Path,
  661. renderer: tools.customDropdownRenderer,
  662. editor: "chosen",
  663. readOnly: onlyRead,
  664. chosenOptions: {
  665. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  666. }
  667. };
  668. } else if (item.InputMode == "D2") {
  669. return {
  670. data: item.Path,
  671. renderer: tools.customDropdownRenderer,
  672. editor: "chosen",
  673. readOnly: onlyRead,
  674. chosenOptions: {
  675. multiple: true, //多选
  676. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  677. }
  678. };
  679. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  680. return {
  681. data: item.Path,
  682. type: "numeric",
  683. readOnly: onlyRead,
  684. numericFormat: {
  685. pattern: "0,0.00"
  686. }
  687. };
  688. } else if (item.InputMode == "C5") {
  689. return {
  690. data: item.Path,
  691. type: "date",
  692. dateFormat: "YYYY-MM-DD",
  693. readOnly: onlyRead,
  694. correctFormat: true
  695. };
  696. } else if (item.InputMode == "Own" && !onlyRead) {
  697. return {
  698. data: item.Path,
  699. renderer: text.idType,
  700. readOnly: onlyRead
  701. }
  702. } else {
  703. return {
  704. data: item.Path,
  705. readOnly: onlyRead
  706. };
  707. }
  708. } else {
  709. return undefined
  710. }
  711. } else {
  712. return undefined
  713. }
  714. }).filter(item => item);
  715. return data
  716. },
  717. tableHeadFilter(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  718. if (!taizhang) {
  719. arr = showTools.arrToArr(arr)
  720. }
  721. let data = arr.map(item => {
  722. if (falg) {
  723. if (item.FirstTag == "控制参数" ||
  724. item.FirstTag == "设定参数" ||
  725. item.FirstTag == "运行参数") {
  726. return undefined
  727. }
  728. }
  729. if (item.InfoPointCode == "BIMLocation") {
  730. return undefined
  731. }
  732. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  733. if (item.Visible || !allMess) {
  734. if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
  735. return undefined
  736. }
  737. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  738. if (isWatch && !onlyRead) {
  739. return undefined
  740. }
  741. }
  742. if (!item.Unit || item.Unit == "") {
  743. return item.InfoPointName;
  744. } else {
  745. return item.InfoPointName + "(" + item.Unit + ")";
  746. }
  747. } else {
  748. return undefined
  749. }
  750. } else {
  751. return undefined;
  752. }
  753. }).filter(d => d);
  754. return data
  755. },
  756. tableHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  757. if (!taizhang) {
  758. arr = showTools.arrToArr(arr)
  759. }
  760. let data = arr.map(item => {
  761. if (falg) {
  762. if (item.FirstTag == "控制参数" ||
  763. item.FirstTag == "设定参数" ||
  764. item.FirstTag == "运行参数") {
  765. return undefined
  766. }
  767. }
  768. if (item.Path == "BIMLocation") {
  769. return undefined
  770. }
  771. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  772. if (item.Visible || !allMess) {
  773. //固定不显示的code
  774. if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
  775. return undefined
  776. }
  777. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  778. if (isWatch && !onlyRead) {
  779. return undefined
  780. }
  781. }
  782. if (item.InfoPointCode == "EquipQRCode") {
  783. return {
  784. data: item.Path,
  785. renderer: text.lookQRCode,
  786. readOnly: onlyRead
  787. }
  788. }
  789. //图片类型
  790. if (
  791. item.InfoPointCode == "InstallPic" ||
  792. item.InfoPointCode == "Nameplate" ||
  793. item.InfoPointCode == "Pic"
  794. ) {
  795. return {
  796. data: item.Path,
  797. renderer: text.picType,
  798. readOnly: onlyRead
  799. }
  800. }
  801. //文件类型
  802. if (item.InfoPointCode == "InsuranceFile" ||
  803. item.InfoPointCode == "Archive" ||
  804. item.InfoPointCode == "CheckReport" ||
  805. item.InfoPointCode == "MaintainManual" ||
  806. item.InfoPointCode == "ApproachingAcceptance" ||
  807. item.InfoPointCode == "AcceptanceReport" ||
  808. item.InfoPointCode == "OperationManual" ||
  809. item.InfoPointCode == "OriginalCertificate" ||
  810. item.InfoPointCode == "TestReport" ||
  811. item.InfoPointCode == "ProductCertification" ||
  812. item.InfoPointCode == "InstallInstruction" ||
  813. item.InfoPointCode == "SupplierContract" ||
  814. item.InfoPointCode == "Drawing" ||
  815. item.InfoPointCode == "InstallDrawing"
  816. ) {
  817. return {
  818. data: item.Path,
  819. renderer: text.fileType,
  820. readOnly: onlyRead
  821. }
  822. }
  823. if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
  824. return {
  825. data: item.Path,
  826. renderer: tools.customDropdownRenderer,
  827. editor: "chosen",
  828. readOnly: onlyRead,
  829. chosenOptions: {
  830. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  831. }
  832. };
  833. } else if (item.InputMode == "D2") {
  834. return {
  835. data: item.Path,
  836. renderer: tools.customDropdownRenderer,
  837. editor: "chosen",
  838. readOnly: onlyRead,
  839. chosenOptions: {
  840. multiple: true, //多选
  841. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  842. }
  843. };
  844. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  845. return {
  846. data: item.Path,
  847. type: "numeric",
  848. readOnly: onlyRead,
  849. numericFormat: {
  850. pattern: "0,0.00"
  851. }
  852. };
  853. } else if (item.InputMode == "C5") {
  854. return {
  855. data: item.Path,
  856. type: "date",
  857. dateFormat: "YYYY-MM-DD",
  858. readOnly: onlyRead,
  859. correctFormat: true
  860. };
  861. } else {
  862. return {
  863. data: item.Path,
  864. readOnly: onlyRead
  865. };
  866. }
  867. } else {
  868. return undefined
  869. }
  870. } else {
  871. return undefined
  872. }
  873. }).filter(item => item);
  874. return data
  875. },
  876. /**
  877. *
  878. * @param {*} arr 原始表头数组
  879. * @param {*} type 对应表格的模块类型
  880. * @param {*} onlyRead 是否只读
  881. * @param {*} showType 查看类型(全部;只看要采集的信息;隐藏部分信息)
  882. * @param {*} taizhang 是否是台账类型(默认为false)
  883. *
  884. */
  885. headerTextFilter(arr, type, onlyRead, showType, taizhang = false) {
  886. if (taizhang && !onlyRead) {
  887. arr = this.arrToArr(arr, showType)
  888. }
  889. let data = arr.map(item => {
  890. // if (type == "property" && item.FirstTag == "RunParam") { //资产台账不显示运行参数
  891. // return undefined
  892. // }
  893. if (onlyRead) { //只读模式
  894. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  895. return undefined
  896. }
  897. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  898. return this.isUnit(item)
  899. } else if (showType == "all") { //显示全部
  900. return this.isUnit(item)
  901. } else {
  902. return undefined
  903. }
  904. } else { //编辑模式
  905. if (taizhang && !this.filterFirm(item.InfoPointCode)) {
  906. return undefined
  907. }
  908. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  909. return undefined
  910. }
  911. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  912. return this.isUnit(item)
  913. } else if (showType == "all") { //显示全部
  914. return this.isUnit(item)
  915. } else if (showType == "partInfo" && item.Visible && this.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
  916. // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
  917. if (item.FirstTag == "TechParam") { //技术参数
  918. return undefined
  919. } else {
  920. return this.isUnit(item)
  921. }
  922. } else {
  923. return undefined
  924. }
  925. }
  926. }).filter(d => d)
  927. return data
  928. },
  929. headerTypeFilter(arr, type, onlyRead, showType, taizhang = false) {
  930. if (taizhang && !onlyRead) {
  931. arr = this.arrToArr(arr, showType)
  932. }
  933. text.readOnly = onlyRead;
  934. let data = arr.map(item => {
  935. // if (type == "property" && item.FirstTag == "RunParam") { //资产台账不显示运行参数
  936. // return undefined
  937. // }
  938. if (onlyRead) { //只读模式
  939. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  940. return undefined
  941. }
  942. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  943. return this.textFormat(item, onlyRead)
  944. } else if (showType == "all") { //显示全部
  945. return this.textFormat(item, onlyRead)
  946. } else {
  947. return undefined
  948. }
  949. } else { //编辑模式
  950. if (taizhang && !this.filterFirm(item.InfoPointCode)) {
  951. return undefined
  952. }
  953. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  954. return undefined
  955. }
  956. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  957. return this.inputModeFilter(item, onlyRead)
  958. } else if (showType == "all") { //显示全部
  959. return this.inputModeFilter(item, onlyRead)
  960. } else if (showType == "partInfo" && item.Visible && this.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
  961. // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
  962. if (item.FirstTag == "TechParam") { //技术参数
  963. return undefined
  964. } else {
  965. return this.inputModeFilter(item, onlyRead)
  966. }
  967. } else {
  968. return undefined
  969. }
  970. }
  971. }).filter(d => d)
  972. return data
  973. },
  974. isUnit(item) {
  975. if (!item.Unit || item.Unit == "") {
  976. return item.InfoPointName;
  977. } else {
  978. return item.InfoPointName + "(" + item.Unit + ")";
  979. }
  980. },
  981. textFormat(item, onlyRead) {
  982. if (
  983. item.InfoPointCode == "EquipQRCode" ||
  984. item.InfoPointCode == "RoomQRCode"
  985. ) {
  986. return {
  987. data: item.Path,
  988. renderer: text.lookQRCode,
  989. readOnly: onlyRead
  990. }
  991. }
  992. //图片类型
  993. if (
  994. item.InfoPointCode == "InstallPic" ||
  995. item.InfoPointCode == "Nameplate" ||
  996. item.InfoPointCode == "Pic"
  997. ) {
  998. return {
  999. data: item.Path,
  1000. renderer: text.picType,
  1001. readOnly: onlyRead
  1002. }
  1003. }
  1004. //文件类型
  1005. if (item.InfoPointCode == "InsuranceFile" ||
  1006. item.InfoPointCode == "Archive" ||
  1007. item.InfoPointCode == "CheckReport" ||
  1008. item.InfoPointCode == "MaintainManual" ||
  1009. item.InfoPointCode == "ApproachingAcceptance" ||
  1010. item.InfoPointCode == "AcceptanceReport" ||
  1011. item.InfoPointCode == "OperationManual" ||
  1012. item.InfoPointCode == "OriginalCertificate" ||
  1013. item.InfoPointCode == "TestReport" ||
  1014. item.InfoPointCode == "ProductCertification" ||
  1015. item.InfoPointCode == "InstallInstruction" ||
  1016. item.InfoPointCode == "SupplierContract" ||
  1017. item.InfoPointCode == "Drawing" ||
  1018. item.InfoPointCode == "InstallDrawing"
  1019. ) {
  1020. return {
  1021. data: item.Path,
  1022. renderer: text.fileType,
  1023. readOnly: onlyRead
  1024. }
  1025. }
  1026. if (item.InputMode == "D1" || item.InputMode == "E1" || item.InputMode == "D1L") { //单选输入
  1027. return {
  1028. data: item.Path,
  1029. renderer: tools.customDropdownRenderer,
  1030. editor: "chosen",
  1031. readOnly: onlyRead,
  1032. chosenOptions: {
  1033. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  1034. }
  1035. };
  1036. } else if (item.InputMode == "D2" || item.InputMode == "E2") { //多选输入
  1037. return {
  1038. data: item.Path,
  1039. renderer: tools.customDropdownRenderer,
  1040. editor: "chosen",
  1041. readOnly: onlyRead,
  1042. chosenOptions: {
  1043. multiple: true, //多选
  1044. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  1045. }
  1046. };
  1047. } else if (item.InputMode == "A1" || item.InputMode == "A2") { //数字输入
  1048. return {
  1049. data: item.Path,
  1050. type: "numeric",
  1051. readOnly: onlyRead,
  1052. numericFormat: {
  1053. pattern: "0,0.00"
  1054. }
  1055. };
  1056. } else if (item.InputMode == "C5") { //日期输入
  1057. return {
  1058. data: item.Path,
  1059. type: "date",
  1060. dateFormat: "YYYYMMDDHHmmss",
  1061. readOnly: onlyRead,
  1062. correctFormat: true
  1063. };
  1064. } else if (item.InputMode == "B1" ||
  1065. item.InputMode == "B2" ||
  1066. item.InputMode == "F1" ||
  1067. item.InputMode == "F2" ||
  1068. item.InputMode == "L1" ||
  1069. item.InputMode == "L2" ||
  1070. item.InputMode == "L" ||
  1071. item.InputMode == "M") { //文本输入
  1072. return {
  1073. data: item.Path,
  1074. readOnly: onlyRead
  1075. }
  1076. } else { //(未支持的输入方式)暂不支持编辑
  1077. return {
  1078. data: item.Path,
  1079. readOnly: onlyRead
  1080. }
  1081. }
  1082. },
  1083. inputModeFilter(item, onlyRead) {
  1084. if (
  1085. item.InfoPointCode == "EquipQRCode" ||
  1086. item.InfoPointCode == "RoomQRCode"
  1087. ) {
  1088. return {
  1089. data: item.Path,
  1090. renderer: text.lookQRCode,
  1091. readOnly: !item.Editable
  1092. }
  1093. }
  1094. //图片类型
  1095. if (
  1096. item.InfoPointCode == "InstallPic" ||
  1097. item.InfoPointCode == "Nameplate" ||
  1098. item.InfoPointCode == "Pic"
  1099. ) {
  1100. return {
  1101. data: item.Path,
  1102. renderer: text.picType,
  1103. readOnly: !item.Editable
  1104. }
  1105. }
  1106. //文件类型
  1107. if (item.InfoPointCode == "InsuranceFile" ||
  1108. item.InfoPointCode == "Archive" ||
  1109. item.InfoPointCode == "CheckReport" ||
  1110. item.InfoPointCode == "MaintainManual" ||
  1111. item.InfoPointCode == "ApproachingAcceptance" ||
  1112. item.InfoPointCode == "AcceptanceReport" ||
  1113. item.InfoPointCode == "OperationManual" ||
  1114. item.InfoPointCode == "OriginalCertificate" ||
  1115. item.InfoPointCode == "TestReport" ||
  1116. item.InfoPointCode == "ProductCertification" ||
  1117. item.InfoPointCode == "InstallInstruction" ||
  1118. item.InfoPointCode == "SupplierContract" ||
  1119. item.InfoPointCode == "Drawing" ||
  1120. item.InfoPointCode == "InstallDrawing"
  1121. ) {
  1122. return {
  1123. data: item.Path,
  1124. renderer: text.fileType,
  1125. readOnly: !item.Editable
  1126. }
  1127. }
  1128. //四大厂商
  1129. if (
  1130. item.InfoPointCode == "DPSupplierID" ||
  1131. item.InfoPointCode == "DPMaintainerID" ||
  1132. item.InfoPointCode == "DPInsurerID" ||
  1133. item.InfoPointCode == "DPManufacturerID"
  1134. ) {
  1135. return {
  1136. data: item.Path,
  1137. renderer: text.idType,
  1138. readOnly: !item.Editable
  1139. }
  1140. }
  1141. if (item.InputMode == "D1" || item.InputMode == "E1" || item.InputMode == "D1L") { //单选输入
  1142. return {
  1143. data: item.Path,
  1144. renderer: tools.customDropdownRenderer,
  1145. editor: "chosen",
  1146. readOnly: !item.Editable,
  1147. chosenOptions: {
  1148. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  1149. }
  1150. };
  1151. } else if (item.InputMode == "D2" || item.InputMode == "E2") { //多选输入
  1152. return {
  1153. data: item.Path,
  1154. renderer: tools.customDropdownRenderer,
  1155. editor: "chosen",
  1156. readOnly: !item.Editable,
  1157. chosenOptions: {
  1158. multiple: true, //多选
  1159. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  1160. }
  1161. };
  1162. } else if (item.InputMode == "A1" || item.InputMode == "A2") { //数字输入
  1163. return {
  1164. data: item.Path,
  1165. type: "numeric",
  1166. readOnly: !item.Editable,
  1167. numericFormat: {
  1168. pattern: "0,0.00"
  1169. }
  1170. };
  1171. } else if (item.InputMode == "C5") { //日期输入
  1172. return {
  1173. data: item.Path,
  1174. type: "date",
  1175. dateFormat: "YYYYMMDDHHmmss",
  1176. readOnly: !item.Editable,
  1177. correctFormat: true
  1178. };
  1179. } else if (item.InputMode == "B1" ||
  1180. item.InputMode == "B2" ||
  1181. item.InputMode == "F1" ||
  1182. item.InputMode == "F2" ||
  1183. item.InputMode == "L1" ||
  1184. item.InputMode == "L2" ||
  1185. item.InputMode == "L" ||
  1186. item.InputMode == "M") { //文本输入
  1187. return {
  1188. data: item.Path,
  1189. readOnly: !item.Editable
  1190. }
  1191. } else { //(未支持的输入方式)暂不支持编辑
  1192. return {
  1193. data: item.Path,
  1194. readOnly: !item.Editable
  1195. }
  1196. }
  1197. },
  1198. filterUnshow: (onlyRead, type, code) => {
  1199. let falg = true,
  1200. data = fieldData[type]
  1201. if (onlyRead) {
  1202. data.onlyRead.map(item => {
  1203. if (item == code) {
  1204. falg = false
  1205. }
  1206. })
  1207. return falg
  1208. } else {
  1209. data.edit.map(item => {
  1210. if (item == code) {
  1211. falg = false
  1212. }
  1213. })
  1214. return falg
  1215. }
  1216. },
  1217. filterFirm: (code) => {
  1218. let falg = true
  1219. firmArr.map(item => {
  1220. if (item == code) {
  1221. falg = false
  1222. }
  1223. })
  1224. return falg
  1225. }
  1226. }
  1227. export default showTools