index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. export default {
  14. components: {
  15. TemplatePage,
  16. },
  17. mixins: [import_mixin],
  18. data() {
  19. return {
  20. // 表格属性
  21. tableAttributes: {
  22. // 启用勾选列
  23. selectColumn: false,
  24. },
  25. // 表格事件
  26. tableEvents: {
  27. 'selection-change': this.selectionChange
  28. },
  29. }
  30. },
  31. methods: {
  32. screeningAnalysis(jname, val) {
  33. if (jname == 'orderFlags') {
  34. return (val || []).map(item => item.tagName).join(',')
  35. } else {
  36. return val
  37. }
  38. },
  39. filterMethod(value, row, column) {
  40. if (column['property'] == 'orderFlags') {
  41. return (row[column['property']] || []).map(item => item.tagName).join(',') === value
  42. }
  43. return row[column['property']] === value
  44. },
  45. // 列表请求函数
  46. getList(p, cb) {
  47. var pam = JSON.parse(JSON.stringify(p))
  48. try {
  49. pam.params.push(
  50. { "param": "a.order_status", "compare": "=", "value": "YWG" },
  51. { "param": "a.order_status", "compare": "=", "value": "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. operation(h, { row, index, column }) {
  104. return (
  105. <div class='operation-btns'>
  106. <el-button type="text" onClick={() => {
  107. this.$router.push({
  108. name: "workOrderPool",
  109. query: {
  110. id: row.id,
  111. }
  112. })
  113. }}>详情</el-button>
  114. </div>
  115. )
  116. },
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped></style>