notShow.js 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  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.code == "brand" && flag) ||
  222. (value.code == "specification" && flag) ||
  223. (value.code == "manufacturer" && flag)) && !first
  224. ) {
  225. first = index
  226. }
  227. if (
  228. ((value.code == "supplier" && flag) ||
  229. (value.code == "supplierContactor" && flag) ||
  230. (value.code == "supplierEmail" && flag) ||
  231. (value.code == "supplierWeb" && flag) ||
  232. (value.code == "supplierFax" && flag) ||
  233. (value.code == "supplierPhone" && flag)) && !scound
  234. ) {
  235. scound = index
  236. }
  237. if (
  238. ((value.code == "maintainer" && flag) ||
  239. (value.code == "maintainerContactor" && flag) ||
  240. (value.code == "maintainerPhone" && flag) ||
  241. (value.code == "maintainerEmail" && flag) ||
  242. (value.code == "maintainerWeb" && flag) ||
  243. (value.code == "maintainerFax" && flag)) && !three
  244. ) {
  245. three = index
  246. }
  247. if (
  248. ((value.code == "insurer" && flag) ||
  249. (value.code == "insurerContactor" && flag) ||
  250. (value.code == "insurerPhone" && flag) ||
  251. (value.code == "insurerEmail" && flag) ||
  252. (value.code == "insurerWeb" && flag) ||
  253. (value.code == "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. aliasCode: "DPInsurerID",
  266. aliasName: "保险公司信息",
  267. name: "保险公司信息",
  268. code: "DPInsurerID",
  269. origCode: "DPInsurerID",
  270. origDataType: "Str",
  271. inputMode: "X",
  272. path: "DPInsurerID",
  273. priority: "S",
  274. editable: true,
  275. visible: true
  276. })
  277. } else if (index == 1) {
  278. arr.splice(item, 0, {
  279. dataType: "STR",
  280. firstName: "基本信息",
  281. aliasCode: "DPMaintainerID",
  282. aliasName: "维修商信息",
  283. name: "维修商信息",
  284. code: "DPMaintainerID",
  285. origCode: "DPMaintainerID",
  286. origDataType: "Str",
  287. inputMode: "X",
  288. path: "DPMaintainerID",
  289. priority: "S",
  290. editable: true,
  291. visible: true
  292. })
  293. } else if (index == 2) {
  294. arr.splice(item, 0, {
  295. dataType: "STR",
  296. firstName: "基本信息",
  297. aliasCode: "DPSupplierID",
  298. aliasName: "供应商信息",
  299. name: "供应商信息",
  300. code: "DPSupplierID",
  301. origCode: "DPSupplierID",
  302. origDataType: "Str",
  303. inputMode: "X",
  304. path: "DPSupplierID",
  305. priority: "S",
  306. editable: true,
  307. visible: true
  308. })
  309. } else if (index == 3) {
  310. arr.splice(item, 0, {
  311. dataType: "STR",
  312. firstName: "基本信息",
  313. aliasCode: "DPManufacturerID",
  314. aliasName: "生产厂家/品牌/型号",
  315. name: "生产厂家/品牌/型号",
  316. code: "DPManufacturerID",
  317. origCode: "DPManufacturerID",
  318. origDataType: "Str",
  319. inputMode: "X",
  320. path: "DPManufacturerID",
  321. priority: "S",
  322. editable: true,
  323. visible: true
  324. })
  325. }
  326. }
  327. })
  328. return arr
  329. },
  330. changeTypes(arr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  331. let data = arr.map(item => {
  332. if (falg) {
  333. if (item.firstTag == "控制参数" ||
  334. item.firstTag == "设定参数" ||
  335. item.firstTag == "运行参数") {
  336. return undefined
  337. }
  338. }
  339. if (item.code == "BIMLocation") {
  340. return undefined
  341. }
  342. if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
  343. if (item.Visible || !allMess) {
  344. //固定不显示的code
  345. if (!showTools.cantShow(item.code) && !onlyRead && !taizhang) {
  346. return undefined
  347. }
  348. if (!showTools.isShow(item.code) && !taizhang && !taizhang) {
  349. if (isWatch && !onlyRead) {
  350. return undefined
  351. }
  352. }
  353. if (item.code == "EquipQRCode") {
  354. return {
  355. data: "Infos." + item.code,
  356. renderer: text.lookQRCode,
  357. readOnly: true
  358. }
  359. }
  360. if (item.inputMode == "D1") {
  361. return {
  362. data: "Infos." + item.code,
  363. renderer: tools.customDropdownRenderer,
  364. editor: "chosen",
  365. chosenOptions: {
  366. // multiple: true,//多选
  367. data: item.dataSource || ""
  368. }
  369. };
  370. } else if (item.inputMode == "A1" || item.inputMode == "A2") {
  371. return {
  372. data: "Infos." + item.code,
  373. type: "numeric",
  374. numericFormat: {
  375. pattern: "0,0.00"
  376. // culture: 'de-DE' // use this for EUR (German),
  377. // more cultures available on http://numbrojs.com/languages.html
  378. }
  379. };
  380. } else if (item.inputMode == "C5") {
  381. return {
  382. data: "Infos." + item.code,
  383. type: "date",
  384. dateFormat: "YYYY-MM-DD",
  385. correctFormat: true
  386. };
  387. } else if (
  388. item.inputMode == "B1" ||
  389. item.inputMode == "L" ||
  390. item.inputMode == "L1" ||
  391. item.inputMode == "L2" ||
  392. item.inputMode == "M"
  393. ) {
  394. return {
  395. data: "Infos." + item.code
  396. };
  397. } else if (
  398. item.inputMode == "X"
  399. // item.inputMode == "L1" ||
  400. // item.inputMode == "L2"
  401. ) {
  402. // return undefined
  403. return {
  404. data: "Infos." + item.code,
  405. readOnly: true
  406. };
  407. } else if (item.inputMode == "D2") {
  408. return {
  409. data: "Infos." + item.code,
  410. renderer: tools.customDropdownRenderer,
  411. editor: "chosen",
  412. chosenOptions: {
  413. multiple: true, //多选
  414. data: item.dataSource || ""
  415. }
  416. };
  417. } else if (item.inputMode == "Own" && !onlyRead) {
  418. return {
  419. data: "Infos." + item.code,
  420. renderer: text.idType,
  421. }
  422. } else {
  423. return {
  424. data: "infos." + item.code
  425. }
  426. }
  427. } else {
  428. return undefined
  429. }
  430. } else {
  431. return false
  432. }
  433. }).filter(item => item);
  434. return data
  435. },
  436. showTypes(arr, onlyRead, isWatch, allMess, falg = false, typeArr = false) {
  437. let data = arr.map(item => {
  438. if (falg) {
  439. if (item.firstTag == "控制参数" ||
  440. item.firstTag == "设定参数" ||
  441. item.firstTag == "运行参数") {
  442. return undefined
  443. }
  444. }
  445. if (item.code == "BIMLocation") {
  446. return undefined
  447. }
  448. if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
  449. if (item.Visible || !allMess) {
  450. //固定不显示的code
  451. if (!showTools.cantShow(item.code) && !onlyRead) {
  452. return undefined
  453. }
  454. if (!showTools.isShow(item.code) && !onlyRead) {
  455. if (isWatch && !onlyRead) {
  456. return undefined
  457. }
  458. }
  459. if (item.code == "EquipQRCode" || item.code == "RoomQRCode") {
  460. return {
  461. data: "infos." + item.code,
  462. renderer: text.lookQRCode,
  463. readOnly: true
  464. }
  465. }
  466. //图片类型
  467. if (
  468. item.code == "InstallPic" ||
  469. item.code == "Nameplate" ||
  470. item.code == "Pic"
  471. ) {
  472. return {
  473. data: "infos." + item.code,
  474. renderer: text.picType,
  475. readOnly: true
  476. }
  477. }
  478. //文件类型
  479. if (item.code == "InsuranceFile" ||
  480. item.code == "Archive" ||
  481. item.code == "CheckReport" ||
  482. item.code == "MaintainManual" ||
  483. item.code == "ApproachingAcceptance" ||
  484. item.code == "AcceptanceReport" ||
  485. item.code == "OperationManual" ||
  486. item.code == "OriginalCertificate" ||
  487. item.code == "TestReport" ||
  488. item.code == "ProductCertification" ||
  489. item.code == "InstallInstruction" ||
  490. item.code == "SupplierContract" ||
  491. item.code == "Drawing" ||
  492. item.code == "InstallDrawing"
  493. ) {
  494. return {
  495. data: "infos." + item.code,
  496. renderer: text.fileType,
  497. readOnly: true
  498. }
  499. }
  500. if (item.inputMode == "D1") {
  501. return {
  502. data: "infos." + item.code,
  503. renderer: tools.customDropdownRenderer,
  504. editor: "chosen",
  505. chosenOptions: {
  506. // multiple: true,//多选
  507. data: item.dataSource || ""
  508. }
  509. };
  510. } else if (item.inputMode == "A1" || item.inputMode == "A2") {
  511. return {
  512. data: "infos." + item.code,
  513. type: "numeric",
  514. numericFormat: {
  515. pattern: "0,0.00"
  516. // culture: 'de-DE' // use this for EUR (German),
  517. // more cultures available on http://numbrojs.com/languages.html
  518. }
  519. };
  520. } else if (item.inputMode == "C5") {
  521. return {
  522. data: "infos." + item.code,
  523. type: "date",
  524. dateFormat: "YYYY-MM-DD",
  525. correctFormat: true
  526. };
  527. } else if (
  528. item.inputMode == "B1" ||
  529. item.inputMode == "L" ||
  530. item.inputMode == "L1" ||
  531. item.inputMode == "L2" ||
  532. item.inputMode == "M"
  533. ) {
  534. return {
  535. data: "infos." + item.code
  536. }
  537. } else if (
  538. item.inputMode == "X" ||
  539. item.inputMode == "F2"
  540. ) {
  541. return {
  542. data: "infos." + item.code,
  543. readOnly: true
  544. };
  545. } else if (item.inputMode == "D2") {
  546. return {
  547. data: "infos." + item.code,
  548. renderer: tools.customDropdownRenderer,
  549. editor: "chosen",
  550. chosenOptions: {
  551. multiple: true, //多选
  552. data: item.dataSource || ""
  553. }
  554. };
  555. } else if (item.inputMode == "Own" && !onlyRead) {
  556. return {
  557. data: "infos." + item.code,
  558. renderer: text.idType,
  559. }
  560. } else {
  561. return {
  562. data: "infos." + item.code
  563. }
  564. }
  565. } else {
  566. return undefined
  567. }
  568. } else {
  569. return undefined
  570. }
  571. }).filter(item => item);
  572. return data
  573. },
  574. changeHeader(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  575. let data = arr.map(item => {
  576. if (falg) {
  577. if (item.firstTag == "控制参数" ||
  578. item.firstTag == "设定参数" ||
  579. item.firstTag == "运行参数") {
  580. return undefined
  581. }
  582. }
  583. if (item.code == "BIMLocation") {
  584. return undefined
  585. }
  586. if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
  587. if (item.Visible || !allMess) {
  588. if (!showTools.cantShow(item.code) && !onlyRead && !taizhang) {
  589. return undefined
  590. }
  591. if (!showTools.isShow(item.code) && !taizhang) {
  592. if (isWatch && !onlyRead) {
  593. return undefined
  594. }
  595. }
  596. if (!item.Unit || item.Unit == "") {
  597. return item.InfoPointName;
  598. } else {
  599. return item.InfoPointName + "(" + item.Unit + ")";
  600. }
  601. } else {
  602. return undefined
  603. }
  604. } else {
  605. return undefined
  606. }
  607. }).filter(d => d);
  608. return data
  609. },
  610. showHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false) {
  611. let data = arr.map(item => {
  612. if (falg) {
  613. if (item.firstTag == "控制参数" ||
  614. item.firstTag == "设定参数" ||
  615. item.firstTag == "运行参数") {
  616. return undefined
  617. }
  618. }
  619. if (item.code == "BIMLocation") {
  620. return undefined
  621. }
  622. if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
  623. if (item.Visible || !allMess) {
  624. //固定不显示的code
  625. if (!showTools.cantShow(item.code) && !onlyRead) {
  626. return undefined
  627. }
  628. if (!showTools.isShow(item.code)) {
  629. if (isWatch && !onlyRead) {
  630. return undefined
  631. }
  632. }
  633. if (item.code == "EquipQRCode") {
  634. return {
  635. data: item.Path,
  636. renderer: text.lookQRCode,
  637. readOnly: onlyRead
  638. }
  639. }
  640. //图片类型
  641. if (
  642. item.code == "InstallPic" ||
  643. item.code == "Nameplate" ||
  644. item.code == "Pic"
  645. ) {
  646. return {
  647. data: item.Path,
  648. renderer: text.picType,
  649. readOnly: onlyRead
  650. }
  651. }
  652. //文件类型
  653. if (item.code == "InsuranceFile" ||
  654. item.code == "Archive" ||
  655. item.code == "CheckReport" ||
  656. item.code == "MaintainManual" ||
  657. item.code == "ApproachingAcceptance" ||
  658. item.code == "AcceptanceReport" ||
  659. item.code == "OperationManual" ||
  660. item.code == "OriginalCertificate" ||
  661. item.code == "TestReport" ||
  662. item.code == "ProductCertification" ||
  663. item.code == "InstallInstruction" ||
  664. item.code == "SupplierContract" ||
  665. item.code == "Drawing" ||
  666. item.code == "InstallDrawing"
  667. ) {
  668. return {
  669. data: item.Path,
  670. renderer: text.fileType,
  671. readOnly: onlyRead
  672. }
  673. }
  674. if (item.inputMode == "D1" || item.inputMode == "E1") { //单选
  675. return {
  676. data: item.Path,
  677. renderer: tools.customDropdownRenderer,
  678. editor: "chosen",
  679. readOnly: onlyRead,
  680. chosenOptions: {
  681. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  682. }
  683. };
  684. } else if (item.inputMode == "D2") {
  685. return {
  686. data: item.Path,
  687. renderer: tools.customDropdownRenderer,
  688. editor: "chosen",
  689. readOnly: onlyRead,
  690. chosenOptions: {
  691. multiple: true, //多选
  692. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  693. }
  694. };
  695. } else if (item.inputMode == "A1" || item.inputMode == "A2") {
  696. return {
  697. data: item.Path,
  698. type: "numeric",
  699. readOnly: onlyRead,
  700. numericFormat: {
  701. pattern: "0,0.00"
  702. }
  703. };
  704. } else if (item.inputMode == "C5") {
  705. return {
  706. data: item.Path,
  707. type: "date",
  708. dateFormat: "YYYY-MM-DD",
  709. readOnly: onlyRead,
  710. correctFormat: true
  711. };
  712. } else if (item.inputMode == "Own" && !onlyRead) {
  713. return {
  714. data: item.Path,
  715. renderer: text.idType,
  716. readOnly: onlyRead
  717. }
  718. } else {
  719. return {
  720. data: item.Path,
  721. readOnly: onlyRead
  722. };
  723. }
  724. } else {
  725. return undefined
  726. }
  727. } else {
  728. return undefined
  729. }
  730. }).filter(item => item);
  731. return data
  732. },
  733. tableHeadFilter(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  734. if (!taizhang) {
  735. arr = showTools.arrToArr(arr)
  736. }
  737. let data = arr.map(item => {
  738. if (falg) {
  739. if (item.firstTag == "控制参数" ||
  740. item.firstTag == "设定参数" ||
  741. item.firstTag == "运行参数") {
  742. return undefined
  743. }
  744. }
  745. if (item.code == "BIMLocation") {
  746. return undefined
  747. }
  748. if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
  749. if (item.Visible || !allMess) {
  750. if (!showTools.fixedNoShowField(partsAddNoShow, item.code) && !onlyRead && !taizhang) {
  751. return undefined
  752. }
  753. if (!showTools.isShow(item.code) && !taizhang) {
  754. if (isWatch && !onlyRead) {
  755. return undefined
  756. }
  757. }
  758. if (!item.Unit || item.Unit == "") {
  759. return item.InfoPointName;
  760. } else {
  761. return item.InfoPointName + "(" + item.Unit + ")";
  762. }
  763. } else {
  764. return undefined
  765. }
  766. } else {
  767. return undefined;
  768. }
  769. }).filter(d => d);
  770. return data
  771. },
  772. tableHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  773. if (!taizhang) {
  774. arr = showTools.arrToArr(arr)
  775. }
  776. let data = arr.map(item => {
  777. if (falg) {
  778. if (item.firstTag == "控制参数" ||
  779. item.firstTag == "设定参数" ||
  780. item.firstTag == "运行参数") {
  781. return undefined
  782. }
  783. }
  784. if (item.Path == "BIMLocation") {
  785. return undefined
  786. }
  787. if (onlyRead || inputModeArr.indexOf(item.inputMode) > -1) {
  788. if (item.Visible || !allMess) {
  789. //固定不显示的code
  790. if (!showTools.fixedNoShowField(partsAddNoShow, item.code) && !onlyRead && !taizhang) {
  791. return undefined
  792. }
  793. if (!showTools.isShow(item.code) && !taizhang) {
  794. if (isWatch && !onlyRead) {
  795. return undefined
  796. }
  797. }
  798. if (item.code == "EquipQRCode") {
  799. return {
  800. data: item.Path,
  801. renderer: text.lookQRCode,
  802. readOnly: onlyRead
  803. }
  804. }
  805. //图片类型
  806. if (
  807. item.code == "InstallPic" ||
  808. item.code == "Nameplate" ||
  809. item.code == "Pic"
  810. ) {
  811. return {
  812. data: item.Path,
  813. renderer: text.picType,
  814. readOnly: onlyRead
  815. }
  816. }
  817. //文件类型
  818. if (item.code == "InsuranceFile" ||
  819. item.code == "Archive" ||
  820. item.code == "CheckReport" ||
  821. item.code == "MaintainManual" ||
  822. item.code == "ApproachingAcceptance" ||
  823. item.code == "AcceptanceReport" ||
  824. item.code == "OperationManual" ||
  825. item.code == "OriginalCertificate" ||
  826. item.code == "TestReport" ||
  827. item.code == "ProductCertification" ||
  828. item.code == "InstallInstruction" ||
  829. item.code == "SupplierContract" ||
  830. item.code == "Drawing" ||
  831. item.code == "InstallDrawing"
  832. ) {
  833. return {
  834. data: item.Path,
  835. renderer: text.fileType,
  836. readOnly: onlyRead
  837. }
  838. }
  839. if (item.inputMode == "D1" || item.inputMode == "E1") { //单选
  840. return {
  841. data: item.Path,
  842. renderer: tools.customDropdownRenderer,
  843. editor: "chosen",
  844. readOnly: onlyRead,
  845. chosenOptions: {
  846. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  847. }
  848. };
  849. } else if (item.inputMode == "D2") {
  850. return {
  851. data: item.Path,
  852. renderer: tools.customDropdownRenderer,
  853. editor: "chosen",
  854. readOnly: onlyRead,
  855. chosenOptions: {
  856. multiple: true, //多选
  857. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  858. }
  859. };
  860. } else if (item.inputMode == "A1" || item.inputMode == "A2") {
  861. return {
  862. data: item.Path,
  863. type: "numeric",
  864. readOnly: onlyRead,
  865. numericFormat: {
  866. pattern: "0,0.00"
  867. }
  868. };
  869. } else if (item.inputMode == "C5") {
  870. return {
  871. data: item.Path,
  872. type: "date",
  873. dateFormat: "YYYY-MM-DD",
  874. readOnly: onlyRead,
  875. correctFormat: true
  876. };
  877. } else {
  878. return {
  879. data: item.Path,
  880. readOnly: onlyRead
  881. };
  882. }
  883. } else {
  884. return undefined
  885. }
  886. } else {
  887. return undefined
  888. }
  889. }).filter(item => item);
  890. return data
  891. },
  892. /**
  893. *
  894. * @param {*} arr 原始表头数组
  895. * @param {*} type 对应表格的模块类型
  896. * @param {*} onlyRead 是否只读
  897. * @param {*} showType 查看类型(全部;只看要采集的信息;隐藏部分信息)
  898. * @param {*} taizhang 是否是台账类型(默认为false)
  899. *
  900. */
  901. headerTextFilter(arr, type, onlyRead, showType, taizhang = false) {
  902. if (taizhang && !onlyRead) {
  903. arr = this.arrToArr(arr, showType)
  904. }
  905. let data = arr.map(item => {
  906. // if (type == "property" && item.firstTag == "RunParam") { //资产台账不显示运行参数
  907. // return undefined
  908. // }
  909. if (onlyRead) { //只读模式
  910. if (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
  911. return undefined
  912. }
  913. if (showType == "Visible" && item.visible) { //只看要采集的信息
  914. return this.isUnit(item)
  915. } else if (showType == "all") { //显示全部
  916. return this.isUnit(item)
  917. } else {
  918. return undefined
  919. }
  920. } else { //编辑模式
  921. if (taizhang && !this.filterFirm(item.code)) {
  922. return undefined
  923. }
  924. if (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
  925. return undefined
  926. }
  927. if (showType == "Visible" && item.visible) { //只看要采集的信息
  928. return this.isUnit(item)
  929. } else if (showType == "all") { //显示全部
  930. return this.isUnit(item)
  931. } else if (showType == "partInfo" && item.visible && this.isShow(item.code)) { //隐藏部分厂家信息(***需维护不显示列表***)
  932. // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
  933. if (item.firstTag == "techParam") { //技术参数
  934. return undefined
  935. } else {
  936. return this.isUnit(item)
  937. }
  938. } else {
  939. return undefined
  940. }
  941. }
  942. }).filter(d => d)
  943. return data
  944. },
  945. headerTypeFilter(arr, type, onlyRead, showType, taizhang = false) {
  946. if (taizhang && !onlyRead) {
  947. arr = this.arrToArr(arr, showType)
  948. }
  949. text.readOnly = onlyRead;
  950. let data = arr.map(item => {
  951. // if (type == "property" && item.firstTag == "runParam") { //资产台账不显示运行参数
  952. // return undefined
  953. // }
  954. if (onlyRead) { //只读模式
  955. if (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
  956. return undefined
  957. }
  958. if (showType == "Visible" && item.visible) { //只看要采集的信息
  959. return this.textFormat(item, onlyRead)
  960. } else if (showType == "all") { //显示全部
  961. return this.textFormat(item, onlyRead)
  962. } else {
  963. return undefined
  964. }
  965. } else { //编辑模式
  966. if (taizhang && !this.filterFirm(item.code)) {
  967. return undefined
  968. }
  969. if (!this.filterUnshow(onlyRead, type, item.code)) { //过滤固定不显示字段
  970. return undefined
  971. }
  972. if (showType == "Visible" && item.visible) { //只看要采集的信息
  973. return this.inputModeFilter(item, onlyRead)
  974. } else if (showType == "all") { //显示全部
  975. return this.inputModeFilter(item, onlyRead)
  976. } else if (showType == "partInfo" && item.visible && this.isShow(item.code)) { //隐藏部分厂家信息(***需维护不显示列表***)
  977. // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
  978. if (item.firstTag == "techParam") { //技术参数
  979. return undefined
  980. } else {
  981. return this.inputModeFilter(item, onlyRead)
  982. }
  983. } else {
  984. return undefined
  985. }
  986. }
  987. }).filter(d => d)
  988. return data
  989. },
  990. isUnit(item) {
  991. if (!item.unit || item.unit == "") {
  992. return item.name;
  993. } else {
  994. return item.name + "(" + item.unit + ")";
  995. }
  996. },
  997. textFormat(item, onlyRead) {
  998. if (
  999. // item.code == "EquipQRCode" ||
  1000. // item.code == "RoomQRCode"
  1001. item.code == "defaultQRCode"
  1002. ) {
  1003. return {
  1004. data: item.path,
  1005. renderer: text.lookQRCode,
  1006. readOnly: onlyRead
  1007. }
  1008. }
  1009. //图片类型
  1010. if (
  1011. item.code == "installPic" ||
  1012. item.code == "nameplate" ||
  1013. item.code == "pic"
  1014. ) {
  1015. return {
  1016. data: item.path,
  1017. renderer: text.picType,
  1018. readOnly: onlyRead
  1019. }
  1020. }
  1021. //文件类型
  1022. if (item.code == "insuranceFile" ||
  1023. item.code == "archive" ||
  1024. item.code == "checkReport" ||
  1025. item.code == "maintainManual" ||
  1026. item.code == "approachingAcceptance" ||
  1027. item.code == "acceptanceReport" ||
  1028. item.code == "operationManual" ||
  1029. item.code == "originalCertificate" ||
  1030. item.code == "testReport" ||
  1031. item.code == "productCertification" ||
  1032. item.code == "installInstruction" ||
  1033. item.code == "supplierContract" ||
  1034. item.code == "drawing" ||
  1035. item.code == "installDrawing"
  1036. ) {
  1037. return {
  1038. data: item.path,
  1039. renderer: text.fileType,
  1040. readOnly: onlyRead
  1041. }
  1042. }
  1043. if (item.inputMode == "D1" || item.inputMode == "E1" || item.inputMode == "D1L") { //单选输入
  1044. return {
  1045. data: item.path,
  1046. renderer: tools.customDropdownRenderer,
  1047. editor: "chosen",
  1048. readOnly: onlyRead,
  1049. chosenOptions: {
  1050. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  1051. }
  1052. };
  1053. } else if (item.inputMode == "D2" || item.inputMode == "E2") { //多选输入
  1054. return {
  1055. data: item.path,
  1056. renderer: tools.customDropdownRenderer,
  1057. editor: "chosen",
  1058. readOnly: onlyRead,
  1059. chosenOptions: {
  1060. multiple: true, //多选
  1061. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  1062. }
  1063. };
  1064. } else if (item.inputMode == "A1" || item.inputMode == "A2") { //数字输入
  1065. return {
  1066. data: item.path,
  1067. type: "numeric",
  1068. readOnly: onlyRead,
  1069. numericFormat: {
  1070. pattern: "0,0.00"
  1071. }
  1072. };
  1073. } else if (item.inputMode == "C5") { //日期输入
  1074. return {
  1075. data: item.path,
  1076. type: "date",
  1077. dateFormat: "YYYYMMDDHHmmss",
  1078. readOnly: onlyRead,
  1079. correctFormat: true
  1080. };
  1081. } else if (item.inputMode == "B1" ||
  1082. item.inputMode == "B2" ||
  1083. item.inputMode == "F1" ||
  1084. item.inputMode == "F2" ||
  1085. item.inputMode == "L1" ||
  1086. item.inputMode == "L2" ||
  1087. item.inputMode == "L" ||
  1088. item.inputMode == "M") { //文本输入
  1089. // console.log(item)
  1090. return {
  1091. data: item.path,
  1092. readOnly: onlyRead
  1093. }
  1094. } else { //(未支持的输入方式)暂不支持编辑
  1095. return {
  1096. data: item.path,
  1097. readOnly: onlyRead
  1098. }
  1099. }
  1100. },
  1101. inputModeFilter(item, onlyRead) {
  1102. if (
  1103. // item.code == "EquipQRCode" ||
  1104. // item.code == "RoomQRCode"
  1105. item.code == "defaultQRCode"
  1106. ) {
  1107. return {
  1108. data: item.path,
  1109. renderer: text.lookQRCode,
  1110. readOnly: !item.editable
  1111. }
  1112. }
  1113. //图片类型
  1114. if (
  1115. item.code == "installPic" ||
  1116. item.code == "nameplate" ||
  1117. item.code == "pic"
  1118. ) {
  1119. return {
  1120. data: item.path,
  1121. renderer: text.picType,
  1122. readOnly: !item.editable
  1123. }
  1124. }
  1125. //文件类型
  1126. if (item.code == "insuranceFile" ||
  1127. item.code == "archive" ||
  1128. item.code == "checkReport" ||
  1129. item.code == "maintainManual" ||
  1130. item.code == "approachingAcceptance" ||
  1131. item.code == "acceptanceReport" ||
  1132. item.code == "operationManual" ||
  1133. item.code == "originalCertificate" ||
  1134. item.code == "testReport" ||
  1135. item.code == "productCertification" ||
  1136. item.code == "installInstruction" ||
  1137. item.code == "supplierContract" ||
  1138. item.code == "drawing" ||
  1139. item.code == "installDrawing"
  1140. ) {
  1141. return {
  1142. data: item.path,
  1143. renderer: text.fileType,
  1144. readOnly: !item.editable
  1145. }
  1146. }
  1147. //四大厂商
  1148. if (
  1149. item.code == "DPSupplierID" ||
  1150. item.code == "DPMaintainerID" ||
  1151. item.code == "DPInsurerID" ||
  1152. item.code == "DPManufacturerID"
  1153. ) {
  1154. return {
  1155. data: item.path,
  1156. renderer: text.idType,
  1157. readOnly: !item.editable
  1158. }
  1159. }
  1160. if (!item.inputMode) {
  1161. this.$message.error('新版字典不支持')
  1162. }
  1163. if (item.inputMode == "D1" || item.inputMode == "E1" || item.inputMode == "D1L") { //单选输入
  1164. return {
  1165. data: item.path,
  1166. renderer: tools.customDropdownRenderer,
  1167. editor: "chosen",
  1168. readOnly: !item.editable,
  1169. chosenOptions: {
  1170. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  1171. }
  1172. };
  1173. } else if (item.inputMode == "D2" || item.inputMode == "E2") { //多选输入
  1174. return {
  1175. data: item.path,
  1176. renderer: tools.customDropdownRenderer,
  1177. editor: "chosen",
  1178. readOnly: !item.editable,
  1179. chosenOptions: {
  1180. multiple: true, //多选
  1181. data: item.dataSource ? tools.formatdataSource(item.dataSource) : ""
  1182. }
  1183. };
  1184. } else if (item.inputMode == "A1" || item.inputMode == "A2") { //数字输入
  1185. return {
  1186. data: item.path,
  1187. type: "numeric",
  1188. readOnly: !item.editable,
  1189. numericFormat: {
  1190. pattern: "0,0.00"
  1191. }
  1192. };
  1193. } else if (item.inputMode == "C5") { //日期输入
  1194. return {
  1195. data: item.path,
  1196. type: "date",
  1197. dateFormat: "YYYYMMDDHHmmss",
  1198. readOnly: !item.editable,
  1199. correctFormat: true
  1200. };
  1201. } else if (item.inputMode == "B1" ||
  1202. item.inputMode == "B2" ||
  1203. item.inputMode == "F1" ||
  1204. item.inputMode == "F2" ||
  1205. item.inputMode == "L1" ||
  1206. item.inputMode == "L2" ||
  1207. item.inputMode == "L" ||
  1208. item.inputMode == "M") { //文本输入
  1209. return {
  1210. data: item.path,
  1211. readOnly: !item.editable
  1212. }
  1213. } else { //(未支持的输入方式)暂不支持编辑
  1214. return {
  1215. data: item.path,
  1216. readOnly: !item.editable
  1217. }
  1218. }
  1219. },
  1220. filterUnshow: (onlyRead, type, code) => {
  1221. let falg = true,
  1222. data = fieldData[type]
  1223. if (onlyRead) {
  1224. data.onlyRead.map(item => {
  1225. if (item == code) {
  1226. falg = false
  1227. }
  1228. })
  1229. return falg
  1230. } else {
  1231. data.edit.map(item => {
  1232. if (item == code) {
  1233. falg = false
  1234. }
  1235. })
  1236. return falg
  1237. }
  1238. },
  1239. filterFirm: (code) => {
  1240. let falg = true
  1241. firmArr.map(item => {
  1242. if (item == code) {
  1243. falg = false
  1244. }
  1245. })
  1246. return falg
  1247. }
  1248. }
  1249. export default showTools