orderListColumn.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import ywgdjs from "@/assets/ywgdjs.png"
  2. import yjs from "@/assets/yjs.png"
  3. export default {
  4. data() {
  5. return {
  6. }
  7. },
  8. methods: {
  9. // 表格列解析渲染数据更改
  10. columnParsing(item, defaultData) {
  11. if (item.jname === 'orderFlags') {
  12. defaultData.render = (h, { row, index, column }) => {
  13. return (
  14. <div style="padding:0 6px;display:flex;align-items:center;">
  15. {(row[column.columnAttributes.prop] || []).map(item => {
  16. if (item.tagName == "已完工") {
  17. return (
  18. <img src={ywgdjs} style="width:16px;height:16px;margin:0 3px;" />
  19. )
  20. } else if (item.tagName == "已结算") {
  21. return (
  22. <img src={yjs} style="width:16px;height:16px;margin:0 3px;" />
  23. )
  24. } else {
  25. return (
  26. <div style="display: inline-block;border:1px solid #409EFF; color:#409EFF;padding:4px;border-radius: 4px;margin:2px 2px 0 0; font-size: 12px!important; line-height: 12px !important;">
  27. {item.tagName}
  28. </div>
  29. )
  30. }
  31. })}
  32. </div>
  33. )
  34. }
  35. }
  36. if (item.jname === 'appointmentTime') {
  37. defaultData.render = (h, { row, index, column }) => {
  38. return (
  39. <div style="padding:0 6px;cursor: pointer;">
  40. {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(" ")[0] : ""}
  41. </div>
  42. )
  43. }
  44. }
  45. if (item.jname === "orderStatus") {
  46. defaultData.render = (h, { row, index, column }) => {
  47. var colors = {
  48. DJD: "#00acff",
  49. DSHPG: "#ff27bf",
  50. DWDPG: "#236cfe",
  51. DYY: "#0d07ff",
  52. FWZ: "#00ee5a",
  53. YCD: "#ff3030",
  54. YJS: "#02b100",
  55. YQX: "#ffbd2f",
  56. YWG: "#f77233",
  57. DQD:"#179f00",
  58. }
  59. return (
  60. <div style={`padding:0 6px;cursor: pointer;color:${colors[Object.entries(row.selectMapData.orderStatus).find(([key, val]) => val == row.orderStatus)?.[0] || '']};`}>
  61. {row[column.columnAttributes.prop]}
  62. </div>
  63. )
  64. }
  65. }
  66. return defaultData
  67. },
  68. }
  69. }