index.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <zj-page-container>
  3. <zj-page-fill class="neibuview">
  4. <zj-form-container>
  5. <zj-form-module title="评价信息">
  6. <zj-table
  7. :columns="evaluationColumns"
  8. :table-data="evaluationData"
  9. :table-attributes="{
  10. border: true
  11. }"
  12. />
  13. </zj-form-module>
  14. </zj-form-container>
  15. </zj-page-fill>
  16. </zj-page-container>
  17. </template>
  18. <script>
  19. import { listPageV2 } from '@/api/workOrder/appraise'
  20. import { tableDataParsing } from '@/utils/common.js'
  21. export default {
  22. props: {
  23. id: {
  24. type: [String, Number],
  25. default: null
  26. }
  27. },
  28. data() {
  29. return {
  30. evaluationData: [],
  31. evaluationColumns: []
  32. }
  33. },
  34. watch: {
  35. id: {
  36. handler(newVal, oldVal) {
  37. listPageV2({ pageNum: 1, pageSize: -1, params: [{ param: 'a.id', compare: '=', value: this.id }] }).then(
  38. res => {
  39. this.evaluationColumns = tableDataParsing(
  40. res.fieldBeans.filter(item => !~['orderFlags', 'orderType'].indexOf(item.jname))
  41. ).map(item => {
  42. if (item.columnAttributes.prop == 'appraiseImgUrl') {
  43. item.render = (h, { row, index, column }) => {
  44. return (
  45. <div style="padding:0 6px;cursor: pointer;">
  46. {row.appraiseImgUrl
  47. ? row.appraiseImgUrl
  48. .split(',')
  49. .map(url => (
  50. <el-image
  51. src={this.$showImgUrl(url)}
  52. preview-src-list={[this.$showImgUrl(url)]}
  53. fit="fit"
  54. style="width:80px;height:80px;"
  55. />
  56. ))
  57. : null}
  58. </div>
  59. )
  60. }
  61. }
  62. return item
  63. })
  64. this.$nextTick(() => {
  65. this.evaluationData = res.data.records.map(item => {
  66. Object.keys(item).map(key => {
  67. var val = JSON.parse(res?.fieldBeans?.find(val => val.jname == key)?.enumMap || '{}')[item[key]]
  68. if (val) item[key] = val
  69. })
  70. return item
  71. })
  72. })
  73. }
  74. )
  75. },
  76. deep: true,
  77. immediate: true
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .neibuview {
  84. box-sizing: border-box;
  85. padding-left: 16px;
  86. ::v-deep & > .zj-page-fill-scroll {
  87. box-sizing: border-box;
  88. padding-right: 16px;
  89. & > div:nth-child(1) {
  90. margin-top: 20px;
  91. }
  92. }
  93. }
  94. </style>