You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.4 KiB

2 months ago
  1. <template>
  2. <div class="detail-container">
  3. <!-- 明细表格 -->
  4. <el-table :data="detailList" border v-loading="loading" style="width: 100%;" :height="tableHeight" :row-class-name="tableRowClassName">
  5. <el-table-column label="序号" header-align="center" align="center" width="80">
  6. <template slot-scope="scope">
  7. {{ scope.$index + 1 }}
  8. </template>
  9. </el-table-column>
  10. <el-table-column prop="orderRef1" label="PO号" header-align="center" align="left" min-width="150" show-overflow-tooltip/>
  11. <el-table-column prop="orderRef2" label="PO行号" header-align="center" align="center" width="100"/>
  12. <el-table-column prop="partNo" label="产品编码" header-align="center" align="left" min-width="150" show-overflow-tooltip/>
  13. <el-table-column prop="partDesc" label="产品名称" header-align="center" align="left" min-width="150" show-overflow-tooltip/>
  14. <el-table-column prop="sku" label="SKU" header-align="center" align="left" min-width="150" show-overflow-tooltip/>
  15. <el-table-column prop="categoryLevel2" label="一级物料分类" header-align="center" align="left" min-width="150" show-overflow-tooltip/>
  16. <el-table-column prop="categoryLevel3" label="二级物料分类" header-align="center" align="left" min-width="150" show-overflow-tooltip/>
  17. <el-table-column prop="qty" label="验货数量" header-align="center" align="right" width="120"/>
  18. <el-table-column prop="approveQty" label="检验通过数量" header-align="center" align="right" width="120"/>
  19. <el-table-column prop="shipMothod" label="运输方式" header-align="center" align="center" width="120"/>
  20. <el-table-column prop="crd" label="CRD日期" header-align="center" align="center" width="120"/>
  21. </el-table>
  22. </div>
  23. </template>
  24. <script>
  25. import { getInspectionRequestDetailSubList } from '@/api/inspection/inspectionRequestHeader.js'
  26. export default {
  27. name: 'InspectionRequestPoDetailTab',
  28. props: {
  29. detailData: {
  30. type: Object,
  31. default: () => ({})
  32. },
  33. tableHeight: {
  34. type: Number,
  35. default: 400
  36. }
  37. },
  38. data () {
  39. return {
  40. detailList: [],
  41. loading: false
  42. }
  43. },
  44. watch: {
  45. detailData: {
  46. handler (newVal) {
  47. if (newVal && newVal.requestNo && newVal.site) {
  48. this.loadDetailList()
  49. } else {
  50. this.detailList = []
  51. }
  52. },
  53. deep: true,
  54. immediate: true
  55. }
  56. },
  57. methods: {
  58. // 根据 isChanged 字段判断是否需要红色背景
  59. tableRowClassName ({ row }) {
  60. return row.isChanged === 'Y' ? 'modified-row' : ''
  61. },
  62. // 加载明细列表
  63. loadDetailList () {
  64. if (!this.detailData.requestNo || !this.detailData.site) {
  65. this.detailList = []
  66. return
  67. }
  68. this.loading = true
  69. getInspectionRequestDetailSubList({
  70. requestNo: this.detailData.requestNo,
  71. site: this.detailData.site
  72. }).then(({ data }) => {
  73. if (data.code === 0) {
  74. this.detailList = (data.page && data.page.list) || []
  75. }
  76. this.loading = false
  77. }).catch(() => {
  78. this.loading = false
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. .detail-container {
  86. padding: 0;
  87. background: #fff;
  88. }
  89. .el-table .modified-row td {
  90. background-color: #ffe6e6 !important;
  91. color: #f56c6c !important;
  92. }
  93. .el-table .modified-row:hover td {
  94. background-color: #ffd6d6 !important;
  95. }
  96. </style>