mainText.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. const text = {
  2. // 只读模式 or 编辑模式
  3. readOnly: false,
  4. //图片类型
  5. picType: (instance, td, row, col, prop, value, cellProperties) => {
  6. td.style.color = "#409EFF";
  7. td.style.cursor = "pointer";
  8. if (value instanceof Array && value.length > 0) {
  9. let i = 0
  10. value.map(item => {
  11. // if (item.type == "image" || item.type == "video") {
  12. i++
  13. // }
  14. })
  15. td.innerHTML = "已上传:" + i;
  16. } else {
  17. td.innerHTML = text.readOnly?'':'点击上传'
  18. }
  19. return td;
  20. },
  21. // 文件类型
  22. fileType: (instance, td, row, col, prop, value, cellProperties) => {
  23. td.style.color = "#409EFF";
  24. td.style.cursor = "pointer";
  25. if (value instanceof Array && value.length > 0) {
  26. td.innerHTML = "已上传:" + value.length;
  27. } else {
  28. td.innerHTML = text.readOnly?'':'点击上传'
  29. }
  30. return td;
  31. },
  32. //系统类型
  33. systemList: (instance, td, row, col, prop, value, cellProperties) => {
  34. td.style.color = "#409EFF";
  35. td.style.cursor = "pointer";
  36. if (value instanceof Array && value.length > 0) {
  37. if (value.length == 1) {
  38. td.innerHTML = (value[0].localName || value[0].name)? (value[0].localName || value[0].name) : (value[0].infos.localName || value[0].infos.name || "")
  39. } else {
  40. let text = ""
  41. for (let i = 0; i < value.length; i++) {
  42. if (!!value[i].localName || !!value[i].name) {
  43. if (i == value.length) {
  44. text += value[i].localName || value[i].name
  45. } else {
  46. text = value[i].localName || value[i].name + "、" + text
  47. }
  48. } else {
  49. if (i == value.length) {
  50. text += value[i].infos.localName || value[i].infos.name
  51. } else {
  52. text = value[i].infos.localName || value[i].infos.name + "、" + text
  53. }
  54. }
  55. }
  56. td.innerHTML = text.substring(0, 40) + "..."
  57. }
  58. } else {
  59. td.innerHTML = "无关联系统"
  60. }
  61. return td;
  62. },
  63. //建筑类型
  64. buildingList: (instance, td, row, col, prop, value, cellProperties) => {
  65. td.style.color = "#409EFF";
  66. td.style.cursor = "pointer";
  67. if (value instanceof Array && value.length > 0) {
  68. if (value.length == 1) {
  69. td.innerHTML = (value[0].localName || value[0].name)? (value[0].localName || value[0].name) : (value[0].infos.localName || value[0].infos.name || "")
  70. } else {
  71. let text = ""
  72. for (let i = 0; i < value.length; i++) {
  73. if (!!value[i].localName || !!value[i].name) {
  74. if (i == value.length) {
  75. text += value[i].localName || value[i].name
  76. } else {
  77. text = value[i].localName || value[i].name + "、" + text
  78. }
  79. } else {
  80. if (i == value.length) {
  81. text += value[i].infos.localName || value[i].infos.name
  82. } else {
  83. text = value[i].infos.localName || value[i].infos.name + "、" + text
  84. }
  85. }
  86. }
  87. td.innerHTML = text.substring(0, 40) + "..."
  88. }
  89. } else {
  90. td.innerHTML = "无所属建筑"
  91. }
  92. return td;
  93. },
  94. //四大厂商
  95. idType: (instance, td, row, col, prop, value, cellProperties) => {
  96. let html = ''
  97. let Manufacturer = instance.getDataAtRowProp(row,'infos.manufacturer') || '空',
  98. Brand = instance.getDataAtRowProp(row,'infos.brand') || '空',
  99. Specification = instance.getDataAtRowProp(row,'infos.specification') || '空';
  100. switch (prop){
  101. case 'dpManufacturerId':
  102. html = Manufacturer + '/' + Brand + '/' + Specification
  103. break;
  104. case 'dpSupplierId':
  105. html = instance.getDataAtRowProp(row,'infos.supplier')
  106. break;
  107. case 'dpMaintainerId':
  108. html = instance.getDataAtRowProp(row,'infos.maintainer')
  109. break;
  110. case 'dpInsurerId':
  111. html = instance.getDataAtRowProp(row,'infos.insurer')
  112. break;
  113. default:
  114. break;
  115. }
  116. td.style.color = "#409EFF";
  117. td.style.cursor = "pointer";
  118. if (!!value) {
  119. // let data = value.split("-")[1] || "空名"
  120. td.innerHTML = html
  121. } else {
  122. td.innerHTML = "点击选择"
  123. }
  124. return td
  125. },
  126. //查看二维码
  127. lookQRCode: (instance, td, row, col, prop, value, cellProperties) => {
  128. td.style.color = "#409EFF";
  129. td.style.cursor = "pointer";
  130. td.innerHTML = "查看二维码"
  131. return td
  132. },
  133. //系统所属建筑楼层
  134. sysInBuildFloor: (instance, td, row, col, prop, value, cellProperties) => {
  135. td.style.color = "#409EFF";
  136. td.style.cursor = "pointer";
  137. if (value instanceof Array && value.length > 0) {
  138. let text = ""
  139. for (let i = 0; i < value.length; i++) {
  140. if(value[i].BuildID && value[i].FloorID){
  141. text += `${value[i].BuildLocalName || value[i].BuildName}-${value[i].FloorLocalName || value[i].FloorName }、`
  142. } else {
  143. text += `${value[i].BuildLocalName || value[i].BuildName}、`
  144. }
  145. }
  146. text = text.substring(0,text.length-1);
  147. if(text.length>15){
  148. text = text.substring(0,15)+ "...";
  149. }
  150. td.innerHTML = text;
  151. } else {
  152. td.innerHTML = "无所属建筑楼层"
  153. }
  154. return td;
  155. },
  156. }
  157. export default text