notShow.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. // 不显示的信息点数组
  2. import text from "@/utils/handsontable/mainText"
  3. import tools from "@/utils/scan/tools"
  4. let InputModeArr = ["A1", "A2", "B1", "C5", "D1", "D2", "E1", "L", "L1", "L2", "F1", "F2", "M", "Own"]
  5. //在编辑模式下并且勾选隐藏自动填充的信息点不显示的字段
  6. let noShowArr = [
  7. "Brand",
  8. "Specification",
  9. "Manufacturer",
  10. "Supplier",
  11. "SupplierContactor",
  12. "SupplierPhone",
  13. "SupplierEmail",
  14. "SupplierWeb",
  15. "SupplierFax",
  16. "Maintainer",
  17. "MaintainerContactor",
  18. "MaintainerPhone",
  19. "MaintainerEmail",
  20. "MaintainerWeb",
  21. "Principal",
  22. "MaintainerFax",
  23. "Insurer",
  24. "InsurerContactor",
  25. "InsurerPhone",
  26. "InsurerEmail",
  27. "InsurerWeb",
  28. "InsurerFax",
  29. "InsuranceFile",
  30. "EquipID",
  31. "EquipName",
  32. ]
  33. //在编辑模式下不显示的字段
  34. let cantShow = [
  35. "EquipQRCode",
  36. "EquipID",
  37. "EquipName",
  38. "BIMLocation",
  39. "Brand",
  40. "Specification",
  41. "Manufacturer",
  42. "Supplier",
  43. "SupplierContactor",
  44. "SupplierPhone",
  45. "SupplierEmail",
  46. "SupplierWeb",
  47. "SupplierFax",
  48. "Maintainer",
  49. "MaintainerContactor",
  50. "MaintainerPhone",
  51. "MaintainerEmail",
  52. "MaintainerWeb",
  53. "Principal",
  54. "MaintainerFax",
  55. "Insurer",
  56. "InsurerContactor",
  57. "InsurerPhone",
  58. "InsurerEmail",
  59. "InsurerWeb",
  60. "InsurerFax",
  61. "InsuranceFile",
  62. "EquipID",
  63. "EquipName",
  64. "SpaceCount",
  65. "SpaceList",
  66. "TenantID",
  67. "ShaftID"
  68. ]
  69. let cutArr = [{
  70. name: "品牌型号",
  71. code: "DPManufacturerID",
  72. num: 2,
  73. }, {
  74. name: "供应商信息",
  75. code: "DPSupplierID",
  76. num: 5
  77. }, {
  78. name: "维修商信息",
  79. code: "DPMaintainerID",
  80. num: 19
  81. }, {
  82. name: "保险公司信息",
  83. code: "DPInsurerID",
  84. num: 25
  85. }]
  86. let newData = [{
  87. name: "品牌型号",
  88. code: "DPManufacturerID",
  89. num: 2,
  90. }, {
  91. name: "供应商信息",
  92. code: "DPSupplierID",
  93. num: 8
  94. }, {
  95. name: "维修商信息",
  96. code: "DPMaintainerID",
  97. num: 35
  98. }, {
  99. name: "保险公司信息",
  100. code: "DPInsurerID",
  101. num: 42
  102. }]
  103. //创建部件固定不显示-管理部件固定不显示(即编辑模式)
  104. let partsAddNoShow = [
  105. 'EquipID',
  106. 'EquipName',
  107. 'EquipQRCode',
  108. 'BIMID',
  109. 'BIMLocation',
  110. 'Brand',
  111. 'Specification',
  112. 'Manufacturer',
  113. 'Supplier',
  114. 'SupplierContactor',
  115. 'SupplierPhone',
  116. 'SupplierEmail',
  117. 'SupplierWeb',
  118. 'SupplierFax',
  119. 'Maintainer',
  120. 'MaintainerContactor',
  121. 'MaintainerPhone',
  122. 'MaintainerEmail',
  123. 'MaintainerWeb',
  124. 'MaintainerFax',
  125. 'Insurer',
  126. "InsurerContactor",
  127. "InsurerPhone",
  128. "InsurerEmail",
  129. "InsurerWeb",
  130. "InsurerFax",
  131. ]
  132. const showTools = {
  133. addArr: () => {
  134. return cutArr
  135. },
  136. cantShow: (code) => {
  137. let falg = true
  138. cantShow.map(item => {
  139. if (item == code) {
  140. falg = false
  141. }
  142. })
  143. return falg
  144. },
  145. fixedNoShowField: (noShowList, code) => {
  146. let flag = true
  147. noShowList.map(item => {
  148. if (item == code) {
  149. flag = false
  150. }
  151. })
  152. return flag
  153. },
  154. //几种类型不显示
  155. technologyParam: (item) => {
  156. if (
  157. item.FirstTag == "控制参数" &&
  158. item.FirstTag == "设定参数" &&
  159. item.FirstTag == "运行参数"
  160. ) {
  161. return undefined
  162. }
  163. },
  164. isShow: (code) => {
  165. let falg = true
  166. noShowArr.map(item => {
  167. if (item == code) {
  168. falg = false
  169. }
  170. })
  171. return falg
  172. },
  173. //插入需要的关系
  174. insertionRea: (data) => {
  175. cutArr.map(item => {
  176. data.splice(item.num, 0, item.name)
  177. })
  178. return data
  179. },
  180. insertionRea2: (data) => {
  181. newData.map(item => {
  182. data.splice(item.num, 0, item.name)
  183. })
  184. return data
  185. },
  186. insertionType: (data, callback) => {
  187. cutArr.map(item => {
  188. data.splice(item.num, 0, {
  189. data: "infos." + item.code,
  190. renderer: callback,
  191. readOnly: false
  192. })
  193. })
  194. return data
  195. },
  196. insertionType2: (data, callback) => {
  197. newData.map(item => {
  198. data.splice(item.num, 0, {
  199. data: "infos." + item.code,
  200. renderer: callback,
  201. readOnly: false
  202. })
  203. })
  204. return data
  205. },
  206. arrToArr(arr) {
  207. let first = 0,
  208. scound = 0,
  209. three = 0,
  210. four = 0
  211. arr.find(function(value, index, arr) {
  212. if (
  213. (value.InfoPointName == "品牌" ||
  214. value.InfoPointName == "设备型号" ||
  215. value.InfoPointName == "生产厂家") && !first
  216. ) {
  217. first = index
  218. }
  219. if (
  220. (value.InfoPointName == "供应商单位名称" ||
  221. value.InfoPointName == "供应商联系人" ||
  222. value.InfoPointName == "供应商电子邮件" ||
  223. value.InfoPointName == "供应商网址" ||
  224. value.InfoPointName == "供应商传真" ||
  225. value.InfoPointName == "供应商联系电话") && !scound
  226. ) {
  227. scound = index
  228. }
  229. if (
  230. (value.InfoPointName == "维修商单位名称" ||
  231. value.InfoPointName == "维修商联系人" ||
  232. value.InfoPointName == "维修商联系电话" ||
  233. value.InfoPointName == "维修商电子邮件" ||
  234. value.InfoPointName == "维修商网址" ||
  235. value.InfoPointName == "维修商传真") && !three
  236. ) {
  237. three = index
  238. }
  239. if (
  240. (value.InfoPointName == "保险公司名称" ||
  241. value.InfoPointName == "保险公司联系人" ||
  242. value.InfoPointName == "保险公司联系电话" ||
  243. value.InfoPointName == "保险公司电子邮件" ||
  244. value.InfoPointName == "保险公司网址" ||
  245. value.InfoPointName == "保险公司传真") && !four
  246. ) {
  247. four = index
  248. }
  249. })
  250. let numList = [first, scound, three, four]
  251. numList.reverse().map((item, index) => {
  252. if (!!item) {
  253. if (index == 0) {
  254. arr.splice(item, 0, {
  255. InfoPointName: "保险公司信息",
  256. InfoPointCode: "DPInsurerID",
  257. Path: 'DPInsurerID',
  258. InputMode: "Own",
  259. Unit: "",
  260. SecondTag: "",
  261. FirstTag: "",
  262. Visible: true,
  263. })
  264. } else if (index == 1) {
  265. arr.splice(item, 0, {
  266. InfoPointName: "维修商信息",
  267. InfoPointCode: "DPMaintainerID",
  268. Path: 'DPMaintainerID',
  269. InputMode: "Own",
  270. Unit: "",
  271. SecondTag: "",
  272. FirstTag: "",
  273. Visible: true,
  274. })
  275. } else if (index == 2) {
  276. arr.splice(item, 0, {
  277. InfoPointName: "供应商信息",
  278. InfoPointCode: "DPSupplierID",
  279. Path: 'DPSupplierID',
  280. InputMode: "Own",
  281. Unit: "",
  282. SecondTag: "",
  283. FirstTag: "",
  284. Visible: true,
  285. })
  286. } else if (index == 3) {
  287. arr.splice(item, 0, {
  288. InfoPointName: "品牌型号",
  289. InfoPointCode: "DPManufacturerID",
  290. Path: 'DPManufacturerID',
  291. InputMode: "Own",
  292. Unit: "",
  293. SecondTag: "",
  294. FirstTag: "",
  295. Visible: true,
  296. })
  297. }
  298. }
  299. })
  300. return arr
  301. },
  302. changeTypes(arr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  303. let data = arr.map(item => {
  304. if (falg) {
  305. if (item.FirstTag == "控制参数" ||
  306. item.FirstTag == "设定参数" ||
  307. item.FirstTag == "运行参数") {
  308. return undefined
  309. }
  310. }
  311. if (item.InfoPointCode == "BIMLocation") {
  312. return undefined
  313. }
  314. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  315. if (item.Visible || !allMess) {
  316. //固定不显示的code
  317. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
  318. return undefined
  319. }
  320. if (!showTools.isShow(item.InfoPointCode) && !taizhang && !taizhang) {
  321. if (isWatch && !onlyRead) {
  322. return undefined
  323. }
  324. }
  325. if (item.InfoPointCode == "EquipQRCode") {
  326. return {
  327. data: "Infos." + item.InfoPointCode,
  328. renderer: text.lookQRCode,
  329. readOnly: true
  330. }
  331. }
  332. if (item.InputMode == "D1") {
  333. return {
  334. data: "Infos." + item.InfoPointCode,
  335. renderer: tools.customDropdownRenderer,
  336. editor: "chosen",
  337. chosenOptions: {
  338. // multiple: true,//多选
  339. data: item.DataSource || ""
  340. }
  341. };
  342. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  343. return {
  344. data: "Infos." + item.InfoPointCode,
  345. type: "numeric",
  346. numericFormat: {
  347. pattern: "0,0.00"
  348. // culture: 'de-DE' // use this for EUR (German),
  349. // more cultures available on http://numbrojs.com/languages.html
  350. }
  351. };
  352. } else if (item.InputMode == "C5") {
  353. return {
  354. data: "Infos." + item.InfoPointCode,
  355. type: "date",
  356. dateFormat: "YYYY-MM-DD",
  357. correctFormat: true
  358. };
  359. } else if (
  360. item.InputMode == "B1" ||
  361. item.InputMode == "L" ||
  362. item.InputMode == "L1" ||
  363. item.InputMode == "L2" ||
  364. item.InputMode == "M"
  365. ) {
  366. return {
  367. data: "Infos." + item.InfoPointCode
  368. };
  369. } else if (
  370. item.InputMode == "X"
  371. // item.InputMode == "L1" ||
  372. // item.InputMode == "L2"
  373. ) {
  374. // return undefined
  375. return {
  376. data: "Infos." + item.InfoPointCode,
  377. readOnly: true
  378. };
  379. } else if (item.InputMode == "D2") {
  380. return {
  381. data: "Infos." + item.InfoPointCode,
  382. renderer: tools.customDropdownRenderer,
  383. editor: "chosen",
  384. chosenOptions: {
  385. multiple: true, //多选
  386. data: item.DataSource || ""
  387. }
  388. };
  389. } else if (item.InputMode == "Own" && !onlyRead) {
  390. return {
  391. data: "Infos." + item.InfoPointCode,
  392. renderer: text.idType,
  393. }
  394. } else {
  395. return {
  396. data: "infos." + item.InfoPointCode
  397. }
  398. }
  399. } else {
  400. return undefined
  401. }
  402. } else {
  403. return false
  404. }
  405. }).filter(item => item);
  406. return data
  407. },
  408. showTypes(arr, onlyRead, isWatch, allMess, falg = false, typeArr = false) {
  409. let data = arr.map(item => {
  410. if (falg) {
  411. if (item.FirstTag == "控制参数" ||
  412. item.FirstTag == "设定参数" ||
  413. item.FirstTag == "运行参数") {
  414. return undefined
  415. }
  416. }
  417. if (item.InfoPointCode == "BIMLocation") {
  418. return undefined
  419. }
  420. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  421. if (item.Visible || !allMess) {
  422. //固定不显示的code
  423. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
  424. return undefined
  425. }
  426. if (!showTools.isShow(item.InfoPointCode) && !onlyRead) {
  427. if (isWatch && !onlyRead) {
  428. return undefined
  429. }
  430. }
  431. if (item.InfoPointCode == "EquipQRCode" || item.InfoPointCode == "RoomQRCode") {
  432. return {
  433. data: "infos." + item.InfoPointCode,
  434. renderer: text.lookQRCode,
  435. readOnly: true
  436. }
  437. }
  438. //图片类型
  439. if (
  440. item.InfoPointCode == "InstallPic" ||
  441. item.InfoPointCode == "InstallDrawing" ||
  442. item.InfoPointCode == "Nameplate" ||
  443. item.InfoPointCode == "Pic" ||
  444. item.InfoPointCode == "Drawing"
  445. ) {
  446. return {
  447. data: "infos." + item.InfoPointCode,
  448. renderer: text.picType,
  449. readOnly: true
  450. }
  451. }
  452. //文件类型
  453. if (item.InfoPointCode == "InsuranceFile" ||
  454. item.InfoPointCode == "Archive" ||
  455. item.InfoPointCode == "CheckReport") {
  456. return {
  457. data: "infos." + item.InfoPointCode,
  458. renderer: text.fileType,
  459. readOnly: true
  460. }
  461. }
  462. if (item.InputMode == "D1") {
  463. return {
  464. data: "infos." + item.InfoPointCode,
  465. renderer: tools.customDropdownRenderer,
  466. editor: "chosen",
  467. chosenOptions: {
  468. // multiple: true,//多选
  469. data: item.DataSource || ""
  470. }
  471. };
  472. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  473. return {
  474. data: "infos." + item.InfoPointCode,
  475. type: "numeric",
  476. numericFormat: {
  477. pattern: "0,0.00"
  478. // culture: 'de-DE' // use this for EUR (German),
  479. // more cultures available on http://numbrojs.com/languages.html
  480. }
  481. };
  482. } else if (item.InputMode == "C5") {
  483. return {
  484. data: "infos." + item.InfoPointCode,
  485. type: "date",
  486. dateFormat: "YYYY-MM-DD",
  487. correctFormat: true
  488. };
  489. } else if (
  490. item.InputMode == "B1" ||
  491. item.InputMode == "L" ||
  492. item.InputMode == "L1" ||
  493. item.InputMode == "L2" ||
  494. item.InputMode == "M"
  495. ) {
  496. return {
  497. data: "infos." + item.InfoPointCode
  498. }
  499. } else if (
  500. item.InputMode == "X" ||
  501. item.InputMode == "F2"
  502. ) {
  503. return {
  504. data: "infos." + item.InfoPointCode,
  505. readOnly: true
  506. };
  507. } else if (item.InputMode == "D2") {
  508. return {
  509. data: "infos." + item.InfoPointCode,
  510. renderer: tools.customDropdownRenderer,
  511. editor: "chosen",
  512. chosenOptions: {
  513. multiple: true, //多选
  514. data: item.DataSource || ""
  515. }
  516. };
  517. } else if (item.InputMode == "Own" && !onlyRead) {
  518. return {
  519. data: "infos." + item.InfoPointCode,
  520. renderer: text.idType,
  521. }
  522. } else {
  523. return {
  524. data: "infos." + item.InfoPointCode
  525. }
  526. }
  527. } else {
  528. return undefined
  529. }
  530. } else {
  531. return undefined
  532. }
  533. }).filter(item => item);
  534. return data
  535. },
  536. changeHeader(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  537. let data = arr.map(item => {
  538. if (falg) {
  539. if (item.FirstTag == "控制参数" ||
  540. item.FirstTag == "设定参数" ||
  541. item.FirstTag == "运行参数") {
  542. return undefined
  543. }
  544. }
  545. if (item.InfoPointCode == "BIMLocation") {
  546. return undefined
  547. }
  548. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  549. if (item.Visible || !allMess) {
  550. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
  551. return undefined
  552. }
  553. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  554. if (isWatch && !onlyRead) {
  555. return undefined
  556. }
  557. }
  558. if (!item.Unit || item.Unit == "") {
  559. return item.InfoPointName;
  560. } else {
  561. return item.InfoPointName + "(" + item.Unit + ")";
  562. }
  563. } else {
  564. return undefined
  565. }
  566. } else {
  567. return undefined
  568. }
  569. }).filter(d => d);
  570. return data
  571. },
  572. showHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false) {
  573. let data = arr.map(item => {
  574. if (falg) {
  575. if (item.FirstTag == "控制参数" ||
  576. item.FirstTag == "设定参数" ||
  577. item.FirstTag == "运行参数") {
  578. return undefined
  579. }
  580. }
  581. if (item.InfoPointCode == "BIMLocation") {
  582. return undefined
  583. }
  584. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  585. if (item.Visible || !allMess) {
  586. //固定不显示的code
  587. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
  588. return undefined
  589. }
  590. if (!showTools.isShow(item.InfoPointCode)) {
  591. if (isWatch && !onlyRead) {
  592. return undefined
  593. }
  594. }
  595. if (item.InfoPointCode == "EquipQRCode") {
  596. return {
  597. data: item.Path,
  598. renderer: text.lookQRCode,
  599. readOnly: onlyRead
  600. }
  601. }
  602. //图片类型
  603. if (
  604. item.InfoPointCode == "InstallPic" ||
  605. item.InfoPointCode == "InstallDrawing" ||
  606. item.InfoPointCode == "Nameplate" ||
  607. item.InfoPointCode == "Pic" ||
  608. item.InfoPointCode == "Drawing"
  609. ) {
  610. return {
  611. data: item.Path,
  612. renderer: text.picType,
  613. readOnly: onlyRead
  614. }
  615. }
  616. //文件类型
  617. if (item.InfoPointCode == "InsuranceFile" ||
  618. item.InfoPointCode == "Archive" ||
  619. item.InfoPointCode == "CheckReport") {
  620. return {
  621. data: item.Path,
  622. renderer: text.fileType,
  623. readOnly: onlyRead
  624. }
  625. }
  626. if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
  627. return {
  628. data: item.Path,
  629. renderer: tools.customDropdownRenderer,
  630. editor: "chosen",
  631. readOnly: onlyRead,
  632. chosenOptions: {
  633. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  634. }
  635. };
  636. } else if (item.InputMode == "D2") {
  637. return {
  638. data: item.Path,
  639. renderer: tools.customDropdownRenderer,
  640. editor: "chosen",
  641. readOnly: onlyRead,
  642. chosenOptions: {
  643. multiple: true, //多选
  644. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  645. }
  646. };
  647. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  648. return {
  649. data: item.Path,
  650. type: "numeric",
  651. readOnly: onlyRead,
  652. numericFormat: {
  653. pattern: "0,0.00"
  654. // culture: 'de-DE' // use this for EUR (German),
  655. // more cultures available on http://numbrojs.com/languages.html
  656. }
  657. };
  658. } else if (item.InputMode == "C5") {
  659. return {
  660. data: item.Path,
  661. type: "date",
  662. dateFormat: "YYYY-MM-DD",
  663. readOnly: onlyRead,
  664. correctFormat: true
  665. };
  666. } else if (item.InputMode == "Own" && !onlyRead) {
  667. return {
  668. data: item.Path,
  669. renderer: text.idType,
  670. readOnly: onlyRead
  671. }
  672. } else {
  673. return {
  674. data: item.Path,
  675. readOnly: onlyRead
  676. };
  677. }
  678. } else {
  679. return undefined
  680. }
  681. } else {
  682. return undefined
  683. }
  684. }).filter(item => item);
  685. return data
  686. },
  687. tableHeadFilter(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  688. if (!taizhang) {
  689. arr = showTools.arrToArr(arr)
  690. }
  691. let data = arr.map(item => {
  692. if (falg) {
  693. if (item.FirstTag == "控制参数" ||
  694. item.FirstTag == "设定参数" ||
  695. item.FirstTag == "运行参数") {
  696. return undefined
  697. }
  698. }
  699. if (item.InfoPointCode == "BIMLocation") {
  700. return undefined
  701. }
  702. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  703. if (item.Visible || !allMess) {
  704. if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
  705. return undefined
  706. }
  707. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  708. if (isWatch && !onlyRead) {
  709. return undefined
  710. }
  711. }
  712. if (!item.Unit || item.Unit == "") {
  713. return item.InfoPointName;
  714. } else {
  715. return item.InfoPointName + "(" + item.Unit + ")";
  716. }
  717. } else {
  718. return undefined
  719. }
  720. } else {
  721. return undefined;
  722. }
  723. }).filter(d => d);
  724. return data
  725. },
  726. tableHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  727. if (!taizhang) {
  728. arr = showTools.arrToArr(arr)
  729. }
  730. let data = arr.map(item => {
  731. if (falg) {
  732. if (item.FirstTag == "控制参数" ||
  733. item.FirstTag == "设定参数" ||
  734. item.FirstTag == "运行参数") {
  735. return undefined
  736. }
  737. }
  738. if (item.Path == "BIMLocation") {
  739. return undefined
  740. }
  741. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  742. if (item.Visible || !allMess) {
  743. //固定不显示的code
  744. if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
  745. return undefined
  746. }
  747. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  748. if (isWatch && !onlyRead) {
  749. return undefined
  750. }
  751. }
  752. if (item.InfoPointCode == "EquipQRCode") {
  753. return {
  754. data: item.Path,
  755. renderer: text.lookQRCode,
  756. readOnly: onlyRead
  757. }
  758. }
  759. //图片类型
  760. if (
  761. item.InfoPointCode == "InstallPic" ||
  762. item.InfoPointCode == "InstallDrawing" ||
  763. item.InfoPointCode == "Nameplate" ||
  764. item.InfoPointCode == "Pic" ||
  765. item.InfoPointCode == "Drawing"
  766. ) {
  767. return {
  768. data: item.Path,
  769. renderer: text.picType,
  770. readOnly: onlyRead
  771. }
  772. }
  773. //文件类型
  774. if (item.InfoPointCode == "InsuranceFile" ||
  775. item.InfoPointCode == "Archive" ||
  776. item.InfoPointCode == "CheckReport") {
  777. return {
  778. data: item.Path,
  779. renderer: text.fileType,
  780. readOnly: onlyRead
  781. }
  782. }
  783. if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
  784. return {
  785. data: item.Path,
  786. renderer: tools.customDropdownRenderer,
  787. editor: "chosen",
  788. readOnly: onlyRead,
  789. chosenOptions: {
  790. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  791. }
  792. };
  793. } else if (item.InputMode == "D2") {
  794. return {
  795. data: item.Path,
  796. renderer: tools.customDropdownRenderer,
  797. editor: "chosen",
  798. readOnly: onlyRead,
  799. chosenOptions: {
  800. multiple: true, //多选
  801. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  802. }
  803. };
  804. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  805. return {
  806. data: item.Path,
  807. type: "numeric",
  808. readOnly: onlyRead,
  809. numericFormat: {
  810. pattern: "0,0.00"
  811. }
  812. };
  813. } else if (item.InputMode == "C5") {
  814. return {
  815. data: item.Path,
  816. type: "date",
  817. dateFormat: "YYYY-MM-DD",
  818. readOnly: onlyRead,
  819. correctFormat: true
  820. };
  821. } else if (item.InputMode == "Own" && !onlyRead) {
  822. return {
  823. data: item.Path,
  824. renderer: text.idType,
  825. readOnly: onlyRead
  826. }
  827. } else {
  828. return {
  829. data: item.Path,
  830. readOnly: onlyRead
  831. };
  832. }
  833. } else {
  834. return undefined
  835. }
  836. } else {
  837. return undefined
  838. }
  839. }).filter(item => item);
  840. return data
  841. },
  842. }
  843. export default showTools