index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <template-page ref="pageRef" :getList="getList" :operation="operation()" :exportList="exportList"
  3. :columnParsing="columnParsing" :tableAttributes="tableAttributes" :tableEvents="tableEvents"
  4. :screeningAnalysis="screeningAnalysis" :filterMethod="filterMethod" :replaceOrNotMap="true">
  5. </template-page>
  6. </template>
  7. <script>
  8. import TemplatePage from '@/components/template/template-page-1.vue'
  9. import import_mixin from '@/components/template/import_mixin.js'
  10. import { orderBaseList, orderBaseListExport } from "@/api/workOrderPool.js"
  11. import ywgdjs from "@/assets/ywgdjs.png"
  12. import yjs from "@/assets/yjs.png"
  13. import operation_mixin from '@/components/template/operation_mixin.js'
  14. export default {
  15. components: {
  16. TemplatePage,
  17. },
  18. mixins: [import_mixin,operation_mixin],
  19. data() {
  20. return {
  21. // 表格属性
  22. tableAttributes: {
  23. // 启用勾选列
  24. selectColumn: false,
  25. },
  26. // 表格事件
  27. tableEvents: {
  28. 'selection-change': this.selectionChange
  29. },
  30. }
  31. },
  32. methods: {
  33. screeningAnalysis(jname, val) {
  34. if (jname == 'orderFlags') {
  35. return (val || []).map(item => item.tagName).join(',')
  36. } else {
  37. return val
  38. }
  39. },
  40. filterMethod(value, row, column) {
  41. if (column['property'] == 'orderFlags') {
  42. return (row[column['property']] || []).map(item => item.tagName).join(',') === value
  43. }
  44. return row[column['property']] === value
  45. },
  46. // 列表请求函数
  47. getList(p, cb) {
  48. var pam = JSON.parse(JSON.stringify(p))
  49. try {
  50. pam.params.push(
  51. { "param": "a.order_status", "compare": "=", "value": ["YWG","YJS"] }
  52. )
  53. pam.isYb = true
  54. cb && cb(pam)
  55. return orderBaseList(pam)
  56. } catch (err) {
  57. }
  58. },
  59. // 列表导出函数
  60. exportList: orderBaseListExport,
  61. // 表格列解析渲染数据更改
  62. columnParsing(item, defaultData) {
  63. if (item.jname === 'orderFlags') {
  64. defaultData.render = (h, { row, index, column }) => {
  65. return (
  66. <div style="padding:0 6px;display:flex;align-items:center;">
  67. {(row[column.columnAttributes.prop] || []).map(item => {
  68. if (item.tagName == "已完工") {
  69. return (
  70. <img src={ywgdjs} style="width:22px;height:22px;" />
  71. )
  72. } else if (item.tagName == "已结算") {
  73. return (
  74. <img src={yjs} style="width:22px;height:22px;" />
  75. )
  76. } else {
  77. return (
  78. <div style="display: inline-block;border:1px solid #409EFF; color:#409EFF;padding:0 2px;border-radius: 4px;margin:2px 2px 0 0;">
  79. {item.tagName}
  80. </div>
  81. )
  82. }
  83. })}
  84. </div>
  85. )
  86. }
  87. }
  88. if (item.jname === 'appointmentTime') {
  89. defaultData.render = (h, { row, index, column }) => {
  90. return (
  91. <div style="padding:0 6px;cursor: pointer;">
  92. {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(" ")[0] : ""}
  93. </div>
  94. )
  95. }
  96. }
  97. return defaultData
  98. },
  99. // 监听勾选变化
  100. selectionChange(data) {
  101. this.recordSelected = data
  102. },
  103. // 表格操作列
  104. operation() {
  105. return this.operationBtn({
  106. detail: {
  107. btnType: 'text',
  108. click: ({ row, index, column }) => {
  109. this.$router.push({
  110. name: 'workOrderPool',
  111. params: {
  112. pageName: row.id,
  113. pageType: 'detail',
  114. pageCode: row.id,
  115. },
  116. })
  117. }
  118. }
  119. })
  120. },
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped></style>