notShow.js 41 KB

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