index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="reserved">
  3. <el-dialog :visible.sync="visible" :before-close="handleClose" width="70%">
  4. <el-descriptions
  5. class="margin-top"
  6. title="货权预留单"
  7. :column="3"
  8. size="small"
  9. border
  10. >
  11. <el-descriptions-item v-for="({ item }, index) in desColumns">
  12. <template slot="label"> {{ item.title }} </template>
  13. {{ resData[item.key] }}
  14. </el-descriptions-item>
  15. </el-descriptions>
  16. <el-super-ux-table
  17. v-model="items"
  18. :size="size"
  19. :columns="itemsColumns"
  20. @row-click="rowClick"
  21. height="300px"
  22. style="margin-top: 20px"
  23. ></el-super-ux-table>
  24. <el-super-ux-table
  25. v-model="showHistoryItems"
  26. :size="size"
  27. :dict="dict"
  28. :columns="historyColumns"
  29. height="300px"
  30. style="margin-top: 20px"
  31. >
  32. <template slot="allotQty" slot-scope="scope">
  33. {{
  34. scope.row.allotQty > 0
  35. ? "+" + scope.row.allotQty
  36. : scope.row.allotQty
  37. }}
  38. </template>
  39. </el-super-ux-table>
  40. </el-dialog>
  41. </div>
  42. </template>
  43. <script>
  44. import { getDetailBySource } from "@/api/purchase/ownership.js";
  45. import useColumns from "./columns";
  46. import { dicts } from "../dicts";
  47. export default {
  48. dicts: [...dicts],
  49. components: {
  50. ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
  51. },
  52. props: {
  53. isVisible: {
  54. type: Boolean,
  55. default: false,
  56. },
  57. info: {
  58. type: Object,
  59. default: null,
  60. },
  61. },
  62. mounted() {
  63. this.getDetails(this.info);
  64. },
  65. data() {
  66. const { desColumns, itemsColumns, historyColumns } = useColumns();
  67. return {
  68. size: "mini",
  69. desColumns: desColumns,
  70. itemsColumns: itemsColumns,
  71. historyColumns: historyColumns,
  72. visible: this.isVisible,
  73. resData: {},
  74. items: [],
  75. historyItems: [],
  76. showHistoryItems: [],
  77. };
  78. },
  79. methods: {
  80. getDetails(row) {
  81. getDetailBySource(row.code).then((res) => {
  82. if (res.code === 200) {
  83. this.resData = res.data || [];
  84. this.items = res.data ? res.data.stMaterialOwnershipItemList : [];
  85. this.historyItems = res.data
  86. ? res.data.stMaterialOwnershipHistoryList
  87. : [];
  88. this.showHistoryItems = this.historyItems.filter(
  89. (ele) => ele.ownerId == this.items[0].id
  90. );
  91. }
  92. });
  93. },
  94. handleClose() {
  95. this.$emit("updateReserved", false);
  96. },
  97. rowClick(row) {
  98. this.showHistoryItems = this.historyItems.filter(
  99. (ele) => ele.ownerId == row.id
  100. );
  101. },
  102. },
  103. };
  104. </script>
  105. <style scoped>
  106. >>> .el-dialog__body {
  107. padding: 5px 15px;
  108. }
  109. </style>