delType.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. import tools from "@/utils/scan/tools"
  2. let tagsFun = (instance, td, row, col, prop, value, cellProperties) => {
  3. if (!!value) {
  4. let arr = value || [],
  5. dom = ``;
  6. arr = arr.sort()
  7. debugger
  8. arr.map((item, index) => {
  9. if (index > 2) {
  10. } else if (index == 2) {
  11. dom += '<span>...</span>'
  12. } else {
  13. dom += `<span style="display: inline-block;line-height:20px;height: 20px;box-sizing:border-box;padding: 0px 10px;background: #FFF5E4;border: 1px solid #F5A623;border-radius: 100px;font-size: 12px;color: #F5A623;text-align: center;margin: 4px 4px 0 0;">${item}</span>`
  14. }
  15. })
  16. td.innerHTML = dom
  17. return td;
  18. }
  19. return td
  20. }
  21. let switchRenderer = (instance, td, row, col, prop, value, cellProperties) => {
  22. // td.innerHTML = value
  23. if (value) {
  24. td.innerHTML = `<div role="switch" class="el-switch is-checked" aria-checked="true"><input type="checkbox" name="" true-value="true" class="el-switch__input"><!----><span class="el-switch__core" style="width: 40px; border-color: rgb(19, 206, 102); background-color: rgb(19, 206, 102);"></span><!----></div>`
  25. } else {
  26. td.innerHTML = `<span class="el-switch__core" style="width: 40px; border-color: #dcdfe6; background-color: #dcdfe6;"></span>`
  27. }
  28. return td
  29. }
  30. /**
  31. *
  32. * @param {表头数组} arr
  33. * @param {添加的参数} '
  34. *
  35. * @returns {对应数组} arr
  36. */
  37. export function showTypes(arr, infosKey = '') {
  38. let data = arr.map(item => {
  39. if (item.FirstTag == "控制参数" ||
  40. item.FirstTag == "设定参数" ||
  41. item.FirstTag == "运行参数") {
  42. return undefined
  43. }
  44. if (item.InfoPointCode == "BIMLocation") {
  45. return undefined
  46. }
  47. if (item.Visible) {
  48. //固定不显示的code
  49. // if (!showTools.cantShow(item.InfoPointCode)) {
  50. // return undefined
  51. // }
  52. if (item.InfoPointCode == "edit") {
  53. return {
  54. data: "Infos." + item.InfoPointCode,
  55. renderer: lookQRCode,
  56. readOnly: true
  57. }
  58. }
  59. //图片类型
  60. if (
  61. item.InfoPointCode == "InstallPic" ||
  62. item.InfoPointCode == "InstallDrawing" ||
  63. item.InfoPointCode == "Nameplate" ||
  64. item.InfoPointCode == "Pic" ||
  65. item.InfoPointCode == "Drawing"
  66. ) {
  67. return {
  68. data: infosKey + item.InfoPointCode,
  69. // renderer: text.picType,
  70. readOnly: true
  71. }
  72. }
  73. //文件类型
  74. if (item.InfoPointCode == "InsuranceFile" ||
  75. item.InfoPointCode == "Archive" ||
  76. item.InfoPointCode == "CheckReport") {
  77. return {
  78. data: infosKey + item.InfoPointCode,
  79. // renderer: text.fileType,
  80. readOnly: true
  81. }
  82. }
  83. if (item.InputMode == "D1") {
  84. return {
  85. data: infosKey + item.InfoPointCode,
  86. renderer: tools.customDropdownRenderer,
  87. editor: "chosen",
  88. chosenOptions: {
  89. // multiple: true,//多选
  90. data: item.DataSource || ""
  91. }
  92. };
  93. } else if (item.InputMode == "A1" || item.InputMode == "A2") {
  94. return {
  95. data: infosKey + item.InfoPointCode,
  96. type: "numeric",
  97. numericFormat: {
  98. pattern: "0,0.00"
  99. // culture: 'de-DE' // use this for EUR (German),
  100. // more cultures available on http://numbrojs.com/languages.html
  101. }
  102. };
  103. } else if (item.InputMode == "C5") {
  104. return {
  105. data: infosKey + item.InfoPointCode,
  106. type: "date",
  107. dateFormat: "YYYY-MM-DD",
  108. correctFormat: true
  109. };
  110. } else if (
  111. item.InputMode == "B1" ||
  112. item.InputMode == "L" ||
  113. item.InputMode == "L1" ||
  114. item.InputMode == "L2"
  115. ) {
  116. return {
  117. data: infosKey + item.InfoPointCode
  118. };
  119. } else if (
  120. item.InputMode == "X" ||
  121. item.InputMode == "F2"
  122. // item.InputMode == "L1" ||
  123. // item.InputMode == "L2"
  124. ) {
  125. // return undefined
  126. return {
  127. data: infosKey + item.InfoPointCode,
  128. readOnly: true
  129. };
  130. } else if (item.InputMode == "D2") {
  131. return {
  132. data: infosKey + item.InfoPointCode,
  133. // renderer: tools.customDropdownRenderer,
  134. editor: "chosen",
  135. chosenOptions: {
  136. multiple: true, //多选
  137. data: item.DataSource || ""
  138. }
  139. };
  140. } else if (item.InputMode == "Own") {
  141. return {
  142. data: infosKey + item.InfoPointCode,
  143. // renderer: text.idType,
  144. }
  145. } else if (item.InputMode == "myOwn") {
  146. return {
  147. data: infosKey + item.InfoPointCode,
  148. renderer: tagsFun,
  149. }
  150. } else if (item.InputMode == 'select') {
  151. return {
  152. data: infosKey + item.InfoPointCode,
  153. renderer: tools.customDropdownRenderer,
  154. editor: "chosen",
  155. chosenOptions: {
  156. // multiple: true,//多选
  157. data: item.DataSource || ""
  158. }
  159. }
  160. } else if (item.InputMode == 'switchBtn') {
  161. return {
  162. data: infosKey + item.InfoPointCode,
  163. renderer: switchRenderer,
  164. readOnly: true
  165. }
  166. } else {
  167. return undefined;
  168. }
  169. } else {
  170. return undefined
  171. }
  172. }).filter(item => item);
  173. return data
  174. }
  175. export function changeHeader(arr) {
  176. let data = arr.map(item => {
  177. // if (falg) {
  178. if (item.FirstTag == "控制参数" ||
  179. item.FirstTag == "设定参数" ||
  180. item.FirstTag == "运行参数") {
  181. return undefined
  182. }
  183. // }
  184. if (item.InfoPointCode == "BIMLocation") {
  185. return undefined
  186. }
  187. // if (
  188. // readArr.indexOf(item.InputMode) > -1
  189. // ) {
  190. if (item.Visible) {
  191. if (!item.Unit) {
  192. return item.InfoPointName;
  193. } else {
  194. return item.InfoPointName + "(" + item.Unit + ")";
  195. }
  196. } else {
  197. return undefined
  198. }
  199. // } else {
  200. // return undefined;
  201. // }
  202. }).filter(d => d);
  203. return data
  204. }
  205. let lookQRCode = (instance, td, row, col, prop, value, cellProperties) => {
  206. td.style.color = "#409EFF";
  207. td.style.cursor = "pointer";
  208. td.innerHTML = "编辑"
  209. return td
  210. }