mainText.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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].infos ? (value[0].infos.SysLocalName || value[0].infos.SysName) : (value[0].SysLocalName || value[0].SysName)
  39. } else {
  40. let text = ""
  41. for (let i = 0; i < value.length; i++) {
  42. if (!!value[i].SysLocalName || !!value[i].SysName) {
  43. if (i == value.length) {
  44. text += value[i].SysLocalName || value[i].SysName
  45. } else {
  46. text = value[i].SysLocalName || value[i].SysName + "、" + text
  47. }
  48. } else {
  49. if (i == value.length) {
  50. text += value[i].infos.SysLocalName || value[i].infos.SysName
  51. } else {
  52. text = value[i].infos.SysLocalName || value[i].infos.SysName + "、" + text
  53. }
  54. }
  55. }
  56. td.innerHTML = text.substring(0, 40) + "..."
  57. }
  58. } else {
  59. td.innerHTML = "无关联系统"
  60. }
  61. return td;
  62. },
  63. //四大厂商
  64. idType: (instance, td, row, col, prop, value, cellProperties) => {
  65. let html = ''
  66. let Manufacturer = instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Manufacturer')?instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Manufacturer'):'空',
  67. Brand = instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Brand')?instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Brand'):'空',
  68. Specification = instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Specification')?instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Specification'):'空';
  69. switch (prop){
  70. case 'DPManufacturerID':
  71. html = Manufacturer + '/' + Brand + '/' + Specification
  72. break;
  73. case 'DPSupplierID':
  74. html = instance.getDataAtRowProp(row,'LedgerParam.SupplyPurchase.Supplier')
  75. break;
  76. case 'DPMaintainerID':
  77. html = instance.getDataAtRowProp(row,'LedgerParam.OperationMainte.Maintainer')
  78. break;
  79. case 'DPInsurerID':
  80. html = instance.getDataAtRowProp(row,'LedgerParam.InsuranceDoc.Insurer')
  81. break;
  82. default:
  83. break;
  84. }
  85. td.style.color = "#409EFF";
  86. td.style.cursor = "pointer";
  87. if (!!value) {
  88. // let data = value.split("-")[1] || "空名"
  89. td.innerHTML = html
  90. } else {
  91. td.innerHTML = "点击选择"
  92. }
  93. return td
  94. },
  95. //查看二维码
  96. lookQRCode: (instance, td, row, col, prop, value, cellProperties) => {
  97. td.style.color = "#409EFF";
  98. td.style.cursor = "pointer";
  99. td.innerHTML = "查看二维码"
  100. return td
  101. },
  102. //系统所属建筑楼层
  103. sysInBuildFloor: (instance, td, row, col, prop, value, cellProperties) => {
  104. td.style.color = "#409EFF";
  105. td.style.cursor = "pointer";
  106. if (value instanceof Array && value.length > 0) {
  107. let text = ""
  108. for (let i = 0; i < value.length; i++) {
  109. if(value[i].BuildID && value[i].FloorID){
  110. text += `${value[i].BuildLocalName || value[i].BuildName}-${value[i].FloorLocalName || value[i].FloorName }、`
  111. } else {
  112. text += `${value[i].BuildLocalName || value[i].BuildName}、`
  113. }
  114. }
  115. text = text.substring(0,text.length-1);
  116. if(text.length>15){
  117. text = text.substring(0,15)+ "...";
  118. }
  119. td.innerHTML = text;
  120. } else {
  121. td.innerHTML = "无所属建筑楼层"
  122. }
  123. return td;
  124. },
  125. }
  126. export default text