wsm-in-order-model.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <el-dialog
  3. :title="title"
  4. :center="true"
  5. align="left"
  6. top="5vh"
  7. width="1040px"
  8. @close="showModelThis = false"
  9. :close-on-click-modal="false"
  10. :visible.sync="showModelThis"
  11. v-loading="loading"
  12. element-loading-text="拼命加载中"
  13. element-loading-spinner="el-icon-loading"
  14. element-loading-background="rgba(0, 0, 0, 0.8)"
  15. >
  16. <el-card style="margin-top: -20px">
  17. <el-row :gutter="10">
  18. <el-col :span="24">
  19. <wsm-in-order-addEdit-form
  20. v-if="newTime !== ''"
  21. :id="id"
  22. :newTime="newTime"
  23. :modelSitem="modelSitem"
  24. :sitem="sitem"
  25. @refresh="(showModelThis = false), $emit('refresh')"
  26. />
  27. </el-col>
  28. </el-row>
  29. </el-card>
  30. </el-dialog>
  31. </template>
  32. <script>
  33. import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder/detail";
  34. import resToken from "@/mixins/resToken";
  35. import wsmInOrderAddEditForm from "./wsm-in-order-addEdit-form";
  36. export default {
  37. name: "purchaseOrder",
  38. props: ["showModel", "id", "btn_code", "modelSitem"],
  39. components: { wsmInOrderAddEditForm},
  40. mixins: [resToken],
  41. data() {
  42. return {
  43. showModelThis: this.showModel,
  44. loading: false,
  45. title: "",
  46. sitem: null,
  47. newTime: "",
  48. };
  49. },
  50. watch: {
  51. showModel: function (val) {
  52. this.showModelThis = val;
  53. if (val) {
  54. this.initForm();
  55. }
  56. },
  57. showModelThis(val) {
  58. if (!val) {
  59. this.$emit("cancel");
  60. }
  61. },
  62. },
  63. methods: {
  64. async initForm() {
  65. this.loading = true;
  66. this.sitem = null;
  67. // btn_code
  68. switch (this.btn_code) {
  69. case "028":
  70. this.title = "新建备货入库单";
  71. break;
  72. case "007":
  73. this.title = "备货入库单详情";
  74. break;
  75. default:
  76. this.title = "新建备货入库单";
  77. }
  78. if (this.btn_code !== "028") {
  79. await this.initData();
  80. } else {
  81. this.sitem = {};
  82. this.getNewTime();
  83. }
  84. this.loading = false;
  85. },
  86. async initData() {
  87. const res = await asyncRequest.orderininfo({ wsm_in_code: this.id });
  88. if (res && res.code === 0 && res.data) {
  89. this.sitem = res.data;
  90. this.getNewTime();
  91. } else if (res && res.code >= 100 && res.code <= 104) {
  92. await this.logout();
  93. } else {
  94. this.$message.warning(res.message);
  95. }
  96. },
  97. getNewTime() {
  98. this.newTime = new Date().valueOf();
  99. },
  100. },
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. .purchaseOrder {
  105. }
  106. </style>