mainText.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. const text = {
  2. //图片类型
  3. picType: (instance, td, row, col, prop, value, cellProperties) => {
  4. td.style.color = "#409EFF";
  5. td.style.cursor = "pointer";
  6. if (value instanceof Array && value.length > 0) {
  7. let i = 0
  8. value.map(item => {
  9. // if (item.type == "image" || item.type == "video") {
  10. i++
  11. // }
  12. })
  13. td.innerHTML = "已上传:" + i;
  14. } else {
  15. td.innerHTML = "点击上传"
  16. }
  17. return td;
  18. },
  19. // 文件类型
  20. fileType: (instance, td, row, col, prop, value, cellProperties) => {
  21. td.style.color = "#409EFF";
  22. td.style.cursor = "pointer";
  23. if (value instanceof Array && value.length > 0) {
  24. td.innerHTML = "已上传:" + value.length;
  25. } else {
  26. td.innerHTML = "点击上传"
  27. }
  28. return td;
  29. },
  30. //系统类型
  31. systemList: (instance, td, row, col, prop, value, cellProperties) => {
  32. td.style.color = "#409EFF";
  33. td.style.cursor = "pointer";
  34. if (value instanceof Array && value.length > 0) {
  35. if (value.length == 1) {
  36. td.innerHTML = !!value[0].infos ? (value[0].infos.SysLocalName || value[0].infos.SysName) : (value[0].SysLocalName || value[0].SysName)
  37. } else {
  38. let text = ""
  39. for (let i = 0; i < value.length; i++) {
  40. if (!!value[i].SysLocalName || !!value[i].SysName) {
  41. if (i == value.length) {
  42. text += value[i].SysLocalName || value[i].SysName
  43. } else {
  44. text = value[i].SysLocalName || value[i].SysName + "、" + text
  45. }
  46. } else {
  47. if (i == value.length) {
  48. text += value[i].infos.SysLocalName || value[i].infos.SysName
  49. } else {
  50. text = value[i].infos.SysLocalName || value[i].infos.SysName + "、" + text
  51. }
  52. }
  53. }
  54. td.innerHTML = text.substring(0, 40) + "..."
  55. }
  56. } else {
  57. td.innerHTML = "无关联系统"
  58. }
  59. return td;
  60. },
  61. //四大厂商
  62. idType: (instance, td, row, col, prop, value, cellProperties) => {
  63. let html = ''
  64. switch (prop){
  65. case 'DPManufacturerID':
  66. html = instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Specification') + '/' + instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Brand')
  67. break;
  68. case 'DPSupplierID':
  69. html = instance.getDataAtRowProp(row,'LedgerParam.SupplyPurchase.Supplier')
  70. break;
  71. case 'DPMaintainerID':
  72. html = instance.getDataAtRowProp(row,'LedgerParam.OperationMainte.Maintainer')
  73. break;
  74. case 'DPInsurerID':
  75. html = instance.getDataAtRowProp(row,'LedgerParam.InsuranceDoc.Insurer')
  76. break;
  77. default:
  78. break;
  79. }
  80. td.style.color = "#409EFF";
  81. td.style.cursor = "pointer";
  82. if (!!value) {
  83. // let data = value.split("-")[1] || "空名"
  84. td.innerHTML = html
  85. } else {
  86. td.innerHTML = "点击选择"
  87. }
  88. return td
  89. },
  90. //查看二维码
  91. lookQRCode: (instance, td, row, col, prop, value, cellProperties) => {
  92. td.style.color = "#409EFF";
  93. td.style.cursor = "pointer";
  94. td.innerHTML = "查看二维码"
  95. return td
  96. },
  97. //系统所属建筑楼层
  98. sysInBuildFloor: (instance, td, row, col, prop, value, cellProperties) => {
  99. td.style.color = "#409EFF";
  100. td.style.cursor = "pointer";
  101. if (value instanceof Array && value.length > 0) {
  102. let text = ""
  103. for (let i = 0; i < value.length; i++) {
  104. if(value[i].BuildID && value[i].FloorID){
  105. text += `${value[i].BuildLocalName || value[i].BuildName}-${value[i].FloorLocalName || value[i].FloorName }、`
  106. } else {
  107. text += `${value[i].BuildLocalName || value[i].BuildName}、`
  108. }
  109. }
  110. text = text.substring(0,text.length-1);
  111. if(text.length>15){
  112. text = text.substring(0,15)+ "...";
  113. }
  114. td.innerHTML = text;
  115. } else {
  116. td.innerHTML = "无所属建筑楼层"
  117. }
  118. return td;
  119. },
  120. }
  121. export default text