notShow.js 47 KB

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