notShow.js 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  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 == "InstallDrawing" ||
  454. item.InfoPointCode == "Nameplate" ||
  455. item.InfoPointCode == "Pic" ||
  456. item.InfoPointCode == "Drawing"
  457. ) {
  458. return {
  459. data: "infos." + item.InfoPointCode,
  460. renderer: text.picType,
  461. readOnly: true
  462. }
  463. }
  464. //文件类型
  465. if (item.InfoPointCode == "InsuranceFile" ||
  466. item.InfoPointCode == "Archive" ||
  467. item.InfoPointCode == "CheckReport") {
  468. return {
  469. data: "infos." + item.InfoPointCode,
  470. renderer: text.fileType,
  471. readOnly: true
  472. }
  473. }
  474. if (item.InputMode == "D1") {
  475. return {
  476. data: "infos." + item.InfoPointCode,
  477. renderer: tools.customDropdownRenderer,
  478. editor: "chosen",
  479. chosenOptions: {
  480. // multiple: true,//多选
  481. data: item.DataSource || ""
  482. }
  483. };
  484. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  485. return {
  486. data: "infos." + item.InfoPointCode,
  487. type: "numeric",
  488. numericFormat: {
  489. pattern: "0,0.00"
  490. // culture: 'de-DE' // use this for EUR (German),
  491. // more cultures available on http://numbrojs.com/languages.html
  492. }
  493. };
  494. } else if (item.InputMode == "C5") {
  495. return {
  496. data: "infos." + item.InfoPointCode,
  497. type: "date",
  498. dateFormat: "YYYY-MM-DD",
  499. correctFormat: true
  500. };
  501. } else if (
  502. item.InputMode == "B1" ||
  503. item.InputMode == "L" ||
  504. item.InputMode == "L1" ||
  505. item.InputMode == "L2" ||
  506. item.InputMode == "M"
  507. ) {
  508. return {
  509. data: "infos." + item.InfoPointCode
  510. }
  511. } else if (
  512. item.InputMode == "X" ||
  513. item.InputMode == "F2"
  514. ) {
  515. return {
  516. data: "infos." + item.InfoPointCode,
  517. readOnly: true
  518. };
  519. } else if (item.InputMode == "D2") {
  520. return {
  521. data: "infos." + item.InfoPointCode,
  522. renderer: tools.customDropdownRenderer,
  523. editor: "chosen",
  524. chosenOptions: {
  525. multiple: true, //多选
  526. data: item.DataSource || ""
  527. }
  528. };
  529. } else if (item.InputMode == "Own" && !onlyRead) {
  530. return {
  531. data: "infos." + item.InfoPointCode,
  532. renderer: text.idType,
  533. }
  534. } else {
  535. return {
  536. data: "infos." + item.InfoPointCode
  537. }
  538. }
  539. } else {
  540. return undefined
  541. }
  542. } else {
  543. return undefined
  544. }
  545. }).filter(item => item);
  546. return data
  547. },
  548. changeHeader(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  549. let data = arr.map(item => {
  550. if (falg) {
  551. if (item.FirstTag == "控制参数" ||
  552. item.FirstTag == "设定参数" ||
  553. item.FirstTag == "运行参数") {
  554. return undefined
  555. }
  556. }
  557. if (item.InfoPointCode == "BIMLocation") {
  558. return undefined
  559. }
  560. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  561. if (item.Visible || !allMess) {
  562. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
  563. return undefined
  564. }
  565. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  566. if (isWatch && !onlyRead) {
  567. return undefined
  568. }
  569. }
  570. if (!item.Unit || item.Unit == "") {
  571. return item.InfoPointName;
  572. } else {
  573. return item.InfoPointName + "(" + item.Unit + ")";
  574. }
  575. } else {
  576. return undefined
  577. }
  578. } else {
  579. return undefined
  580. }
  581. }).filter(d => d);
  582. return data
  583. },
  584. showHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false) {
  585. let data = arr.map(item => {
  586. if (falg) {
  587. if (item.FirstTag == "控制参数" ||
  588. item.FirstTag == "设定参数" ||
  589. item.FirstTag == "运行参数") {
  590. return undefined
  591. }
  592. }
  593. if (item.InfoPointCode == "BIMLocation") {
  594. return undefined
  595. }
  596. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  597. if (item.Visible || !allMess) {
  598. //固定不显示的code
  599. if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
  600. return undefined
  601. }
  602. if (!showTools.isShow(item.InfoPointCode)) {
  603. if (isWatch && !onlyRead) {
  604. return undefined
  605. }
  606. }
  607. if (item.InfoPointCode == "EquipQRCode") {
  608. return {
  609. data: item.Path,
  610. renderer: text.lookQRCode,
  611. readOnly: onlyRead
  612. }
  613. }
  614. //图片类型
  615. if (
  616. item.InfoPointCode == "InstallPic" ||
  617. item.InfoPointCode == "InstallDrawing" ||
  618. item.InfoPointCode == "Nameplate" ||
  619. item.InfoPointCode == "Pic" ||
  620. item.InfoPointCode == "Drawing"
  621. ) {
  622. return {
  623. data: item.Path,
  624. renderer: text.picType,
  625. readOnly: onlyRead
  626. }
  627. }
  628. //文件类型
  629. if (item.InfoPointCode == "InsuranceFile" ||
  630. item.InfoPointCode == "Archive" ||
  631. item.InfoPointCode == "CheckReport") {
  632. return {
  633. data: item.Path,
  634. renderer: text.fileType,
  635. readOnly: onlyRead
  636. }
  637. }
  638. if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
  639. return {
  640. data: item.Path,
  641. renderer: tools.customDropdownRenderer,
  642. editor: "chosen",
  643. readOnly: onlyRead,
  644. chosenOptions: {
  645. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  646. }
  647. };
  648. } else if (item.InputMode == "D2") {
  649. return {
  650. data: item.Path,
  651. renderer: tools.customDropdownRenderer,
  652. editor: "chosen",
  653. readOnly: onlyRead,
  654. chosenOptions: {
  655. multiple: true, //多选
  656. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  657. }
  658. };
  659. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  660. return {
  661. data: item.Path,
  662. type: "numeric",
  663. readOnly: onlyRead,
  664. numericFormat: {
  665. pattern: "0,0.00"
  666. }
  667. };
  668. } else if (item.InputMode == "C5") {
  669. return {
  670. data: item.Path,
  671. type: "date",
  672. dateFormat: "YYYY-MM-DD",
  673. readOnly: onlyRead,
  674. correctFormat: true
  675. };
  676. } else if (item.InputMode == "Own" && !onlyRead) {
  677. return {
  678. data: item.Path,
  679. renderer: text.idType,
  680. readOnly: onlyRead
  681. }
  682. } else {
  683. return {
  684. data: item.Path,
  685. readOnly: onlyRead
  686. };
  687. }
  688. } else {
  689. return undefined
  690. }
  691. } else {
  692. return undefined
  693. }
  694. }).filter(item => item);
  695. return data
  696. },
  697. tableHeadFilter(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  698. if (!taizhang) {
  699. arr = showTools.arrToArr(arr)
  700. }
  701. let data = arr.map(item => {
  702. if (falg) {
  703. if (item.FirstTag == "控制参数" ||
  704. item.FirstTag == "设定参数" ||
  705. item.FirstTag == "运行参数") {
  706. return undefined
  707. }
  708. }
  709. if (item.InfoPointCode == "BIMLocation") {
  710. return undefined
  711. }
  712. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  713. if (item.Visible || !allMess) {
  714. if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
  715. return undefined
  716. }
  717. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  718. if (isWatch && !onlyRead) {
  719. return undefined
  720. }
  721. }
  722. if (!item.Unit || item.Unit == "") {
  723. return item.InfoPointName;
  724. } else {
  725. return item.InfoPointName + "(" + item.Unit + ")";
  726. }
  727. } else {
  728. return undefined
  729. }
  730. } else {
  731. return undefined;
  732. }
  733. }).filter(d => d);
  734. return data
  735. },
  736. tableHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
  737. if (!taizhang) {
  738. arr = showTools.arrToArr(arr)
  739. }
  740. let data = arr.map(item => {
  741. if (falg) {
  742. if (item.FirstTag == "控制参数" ||
  743. item.FirstTag == "设定参数" ||
  744. item.FirstTag == "运行参数") {
  745. return undefined
  746. }
  747. }
  748. if (item.Path == "BIMLocation") {
  749. return undefined
  750. }
  751. if (onlyRead || InputModeArr.indexOf(item.InputMode) > -1) {
  752. if (item.Visible || !allMess) {
  753. //固定不显示的code
  754. if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
  755. return undefined
  756. }
  757. if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
  758. if (isWatch && !onlyRead) {
  759. return undefined
  760. }
  761. }
  762. if (item.InfoPointCode == "EquipQRCode") {
  763. return {
  764. data: item.Path,
  765. renderer: text.lookQRCode,
  766. readOnly: onlyRead
  767. }
  768. }
  769. //图片类型
  770. if (
  771. item.InfoPointCode == "InstallPic" ||
  772. item.InfoPointCode == "InstallDrawing" ||
  773. item.InfoPointCode == "Nameplate" ||
  774. item.InfoPointCode == "Pic" ||
  775. item.InfoPointCode == "Drawing"
  776. ) {
  777. return {
  778. data: item.Path,
  779. renderer: text.picType,
  780. readOnly: onlyRead
  781. }
  782. }
  783. //文件类型
  784. if (item.InfoPointCode == "InsuranceFile" ||
  785. item.InfoPointCode == "Archive" ||
  786. item.InfoPointCode == "CheckReport") {
  787. return {
  788. data: item.Path,
  789. renderer: text.fileType,
  790. readOnly: onlyRead
  791. }
  792. }
  793. if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
  794. return {
  795. data: item.Path,
  796. renderer: tools.customDropdownRenderer,
  797. editor: "chosen",
  798. readOnly: onlyRead,
  799. chosenOptions: {
  800. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  801. }
  802. };
  803. } else if (item.InputMode == "D2") {
  804. return {
  805. data: item.Path,
  806. renderer: tools.customDropdownRenderer,
  807. editor: "chosen",
  808. readOnly: onlyRead,
  809. chosenOptions: {
  810. multiple: true, //多选
  811. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  812. }
  813. };
  814. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  815. return {
  816. data: item.Path,
  817. type: "numeric",
  818. readOnly: onlyRead,
  819. numericFormat: {
  820. pattern: "0,0.00"
  821. }
  822. };
  823. } else if (item.InputMode == "C5") {
  824. return {
  825. data: item.Path,
  826. type: "date",
  827. dateFormat: "YYYY-MM-DD",
  828. readOnly: onlyRead,
  829. correctFormat: true
  830. };
  831. } else {
  832. return {
  833. data: item.Path,
  834. readOnly: onlyRead
  835. };
  836. }
  837. } else {
  838. return undefined
  839. }
  840. } else {
  841. return undefined
  842. }
  843. }).filter(item => item);
  844. return data
  845. },
  846. /**
  847. *
  848. * @param {*} arr 原始表头数组
  849. * @param {*} type 对应表格的模块类型
  850. * @param {*} onlyRead 是否只读
  851. * @param {*} showType 查看类型(全部;只看要采集的信息;隐藏部分信息)
  852. * @param {*} taizhang 是否是台账类型(默认为false)
  853. *
  854. */
  855. headerTextFilter(arr, type, onlyRead, showType, taizhang = false) {
  856. if (taizhang && !onlyRead) {
  857. arr = this.arrToArr(arr, showType)
  858. }
  859. let data = arr.map(item => {
  860. // if (type == "property" && item.FirstTag == "RunParam") { //资产台账不显示运行参数
  861. // return undefined
  862. // }
  863. if (onlyRead) { //只读模式
  864. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  865. return undefined
  866. }
  867. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  868. return this.isUnit(item)
  869. } else if (showType == "all") { //显示全部
  870. return this.isUnit(item)
  871. } else {
  872. return undefined
  873. }
  874. } else { //编辑模式
  875. if (taizhang && !this.filterFirm(item.InfoPointCode)) {
  876. return undefined
  877. }
  878. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  879. return undefined
  880. }
  881. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  882. return this.isUnit(item)
  883. } else if (showType == "all") { //显示全部
  884. return this.isUnit(item)
  885. } else if (showType == "partInfo" && item.Visible && this.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
  886. // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
  887. if (item.FirstTag == "TechParam") { //技术参数
  888. return undefined
  889. } else {
  890. return this.isUnit(item)
  891. }
  892. } else {
  893. return undefined
  894. }
  895. }
  896. }).filter(d => d)
  897. return data
  898. },
  899. headerTypeFilter(arr, type, onlyRead, showType, taizhang = false) {
  900. if (taizhang && !onlyRead) {
  901. arr = this.arrToArr(arr, showType)
  902. }
  903. let data = arr.map(item => {
  904. // if (type == "property" && item.FirstTag == "RunParam") { //资产台账不显示运行参数
  905. // return undefined
  906. // }
  907. if (onlyRead) { //只读模式
  908. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  909. return undefined
  910. }
  911. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  912. return this.textFormat(item, onlyRead)
  913. } else if (showType == "all") { //显示全部
  914. return this.textFormat(item, onlyRead)
  915. } else {
  916. return undefined
  917. }
  918. } else { //编辑模式
  919. if (taizhang && !this.filterFirm(item.InfoPointCode)) {
  920. return undefined
  921. }
  922. if (!this.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
  923. return undefined
  924. }
  925. if (showType == "Visible" && item.Visible) { //只看要采集的信息
  926. return this.inputModeFilter(item, onlyRead)
  927. } else if (showType == "all") { //显示全部
  928. return this.inputModeFilter(item, onlyRead)
  929. } else if (showType == "partInfo" && item.Visible && this.isShow(item.InfoPointCode)) { //隐藏部分厂家信息(***需维护不显示列表***)
  930. // if (item.FirstName == "控制参数" || item.FirstName == "设定参数" || item.FirstName == "运行参数") {
  931. if (item.FirstTag == "TechParam") { //技术参数
  932. return undefined
  933. } else {
  934. return this.inputModeFilter(item, onlyRead)
  935. }
  936. } else {
  937. return undefined
  938. }
  939. }
  940. }).filter(d => d)
  941. return data
  942. },
  943. isUnit(item) {
  944. if (!item.Unit || item.Unit == "") {
  945. return item.InfoPointName;
  946. } else {
  947. return item.InfoPointName + "(" + item.Unit + ")";
  948. }
  949. },
  950. textFormat(item, onlyRead) {
  951. if (
  952. item.InfoPointCode == "EquipQRCode" ||
  953. item.InfoPointCode == "RoomQRCode"
  954. ) {
  955. return {
  956. data: item.Path,
  957. renderer: text.lookQRCode,
  958. readOnly: onlyRead
  959. }
  960. }
  961. //图片类型
  962. if (
  963. item.InfoPointCode == "InstallPic" ||
  964. item.InfoPointCode == "InstallDrawing" ||
  965. item.InfoPointCode == "Nameplate" ||
  966. item.InfoPointCode == "Pic" ||
  967. item.InfoPointCode == "Drawing"
  968. ) {
  969. return {
  970. data: item.Path,
  971. renderer: text.picType,
  972. readOnly: onlyRead
  973. }
  974. }
  975. //文件类型
  976. if (item.InfoPointCode == "InsuranceFile" ||
  977. item.InfoPointCode == "Archive" ||
  978. item.InfoPointCode == "CheckReport") {
  979. return {
  980. data: item.Path,
  981. renderer: text.fileType,
  982. readOnly: onlyRead
  983. }
  984. }
  985. if (item.InputMode == "D1" || item.InputMode == "E1" || item.InputMode == "D1L") { //单选输入
  986. return {
  987. data: item.Path,
  988. renderer: tools.customDropdownRenderer,
  989. editor: "chosen",
  990. readOnly: onlyRead,
  991. chosenOptions: {
  992. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  993. }
  994. };
  995. } else if (item.InputMode == "D2" || item.InputMode == "E2") { //多选输入
  996. return {
  997. data: item.Path,
  998. renderer: tools.customDropdownRenderer,
  999. editor: "chosen",
  1000. readOnly: onlyRead,
  1001. chosenOptions: {
  1002. multiple: true, //多选
  1003. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  1004. }
  1005. };
  1006. } else if (item.InputMode == "A1" || item.InputMode == "A2") { //数字输入
  1007. return {
  1008. data: item.Path,
  1009. type: "numeric",
  1010. readOnly: onlyRead,
  1011. numericFormat: {
  1012. pattern: "0,0.00"
  1013. }
  1014. };
  1015. } else if (item.InputMode == "C5") { //日期输入
  1016. return {
  1017. data: item.Path,
  1018. type: "date",
  1019. dateFormat: "YYYY-MM-DD",
  1020. readOnly: onlyRead,
  1021. correctFormat: true
  1022. };
  1023. } else if (item.InputMode == "B1" ||
  1024. item.InputMode == "B2" ||
  1025. item.InputMode == "F1" ||
  1026. item.InputMode == "F2" ||
  1027. item.InputMode == "L1" ||
  1028. item.InputMode == "L2" ||
  1029. item.InputMode == "L" ||
  1030. item.InputMode == "M") { //文本输入
  1031. return {
  1032. data: item.Path,
  1033. readOnly: onlyRead
  1034. }
  1035. } else { //(未支持的输入方式)暂不支持编辑
  1036. return {
  1037. data: item.Path,
  1038. readOnly: onlyRead
  1039. }
  1040. }
  1041. },
  1042. inputModeFilter(item, onlyRead) {
  1043. if (
  1044. item.InfoPointCode == "EquipQRCode" ||
  1045. item.InfoPointCode == "RoomQRCode"
  1046. ) {
  1047. return {
  1048. data: item.Path,
  1049. renderer: text.lookQRCode,
  1050. readOnly: !item.Editable
  1051. }
  1052. }
  1053. //图片类型
  1054. if (
  1055. item.InfoPointCode == "InstallPic" ||
  1056. item.InfoPointCode == "InstallDrawing" ||
  1057. item.InfoPointCode == "Nameplate" ||
  1058. item.InfoPointCode == "Pic" ||
  1059. item.InfoPointCode == "Drawing"
  1060. ) {
  1061. return {
  1062. data: item.Path,
  1063. renderer: text.picType,
  1064. readOnly: !item.Editable
  1065. }
  1066. }
  1067. //文件类型
  1068. if (item.InfoPointCode == "InsuranceFile" ||
  1069. item.InfoPointCode == "Archive" ||
  1070. item.InfoPointCode == "CheckReport") {
  1071. return {
  1072. data: item.Path,
  1073. renderer: text.fileType,
  1074. readOnly: !item.Editable
  1075. }
  1076. }
  1077. //四大厂商
  1078. if (
  1079. item.InfoPointCode == "DPSupplierID" ||
  1080. item.InfoPointCode == "DPMaintainerID" ||
  1081. item.InfoPointCode == "DPInsurerID" ||
  1082. item.InfoPointCode == "DPManufacturerID"
  1083. ) {
  1084. return {
  1085. data: item.Path,
  1086. renderer: text.idType,
  1087. readOnly: !item.Editable
  1088. }
  1089. }
  1090. if (item.InputMode == "D1" || item.InputMode == "E1" || item.InputMode == "D1L") { //单选输入
  1091. return {
  1092. data: item.Path,
  1093. renderer: tools.customDropdownRenderer,
  1094. editor: "chosen",
  1095. readOnly: !item.Editable,
  1096. chosenOptions: {
  1097. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  1098. }
  1099. };
  1100. } else if (item.InputMode == "D2" || item.InputMode == "E2") { //多选输入
  1101. return {
  1102. data: item.Path,
  1103. renderer: tools.customDropdownRenderer,
  1104. editor: "chosen",
  1105. readOnly: !item.Editable,
  1106. chosenOptions: {
  1107. multiple: true, //多选
  1108. data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
  1109. }
  1110. };
  1111. } else if (item.InputMode == "A1" || item.InputMode == "A2") { //数字输入
  1112. return {
  1113. data: item.Path,
  1114. type: "numeric",
  1115. readOnly: !item.Editable,
  1116. numericFormat: {
  1117. pattern: "0,0.00"
  1118. }
  1119. };
  1120. } else if (item.InputMode == "C5") { //日期输入
  1121. return {
  1122. data: item.Path,
  1123. type: "date",
  1124. dateFormat: "YYYY-MM-DD",
  1125. readOnly: !item.Editable,
  1126. correctFormat: true
  1127. };
  1128. } else if (item.InputMode == "B1" ||
  1129. item.InputMode == "B2" ||
  1130. item.InputMode == "F1" ||
  1131. item.InputMode == "F2" ||
  1132. item.InputMode == "L1" ||
  1133. item.InputMode == "L2" ||
  1134. item.InputMode == "L" ||
  1135. item.InputMode == "M") { //文本输入
  1136. return {
  1137. data: item.Path,
  1138. readOnly: !item.Editable
  1139. }
  1140. } else { //(未支持的输入方式)暂不支持编辑
  1141. return {
  1142. data: item.Path,
  1143. readOnly: onlyRead
  1144. }
  1145. }
  1146. },
  1147. filterUnshow: (onlyRead, type, code) => {
  1148. let falg = true,
  1149. data = fieldData[type]
  1150. if (onlyRead) {
  1151. data.onlyRead.map(item => {
  1152. if (item == code) {
  1153. falg = false
  1154. }
  1155. })
  1156. return falg
  1157. } else {
  1158. data.edit.map(item => {
  1159. if (item == code) {
  1160. falg = false
  1161. }
  1162. })
  1163. return falg
  1164. }
  1165. },
  1166. filterFirm: (code) => {
  1167. let falg = true
  1168. firmArr.map(item => {
  1169. if (item == code) {
  1170. falg = false
  1171. }
  1172. })
  1173. return falg
  1174. }
  1175. }
  1176. export default showTools