notShow.js 34 KB

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