StockOutLineInstance.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div v-if="redDocument != undefined" class="container-fluid">
  3. <stockOutLineInstanceBlue v-if="!redDocument" :stock-out-id="stockOutId" />
  4. <stockOutLineInstanceRed v-if="redDocument" :stock-out-id="stockOutId" />
  5. </div>
  6. </template>
  7. <script>
  8. import stockOutLineInstanceBlue from './StockOutLineInstanceBlue.vue';
  9. import stockOutLineInstanceRed from './StockOutLineInstanceRed.vue';
  10. import Common from '../common/Common.js';
  11. import { UserStorageResource } from 'pc-component-v3';
  12. export default {
  13. components: {
  14. stockOutLineInstanceBlue,
  15. stockOutLineInstanceRed,
  16. },
  17. data: function () {
  18. return {
  19. redDocument: undefined,
  20. stockOutId: undefined,
  21. };
  22. },
  23. mounted: function () {
  24. var uuid = this.$route.params.uuid;
  25. UserStorageResource.uniqueByKey(uuid + '_modelData').then(
  26. str => {
  27. // if(str.errorCode != 0) {
  28. // Notify.error('提示', str.errorMessage, false);
  29. // return;
  30. // }
  31. if (str.data != null) {
  32. console.log(str.data);
  33. var modelData = JSON.parse(str.data);
  34. this.stockOutId = modelData.id;
  35. this.getDocumentType();
  36. }
  37. },
  38. errorData => {
  39. Common.processException(errorData);
  40. },
  41. );
  42. },
  43. methods: {
  44. getDocumentType: function () {
  45. var _self = this;
  46. $.ajax({
  47. type: 'get',
  48. url: Common.getApiURL(
  49. 'StockOutResource/uniqueIsRedDocByStockOutId?stockOutId=' +
  50. _self.stockOutId,
  51. ),
  52. beforeSend: function (request) {
  53. Common.addTokenToRequest(request);
  54. },
  55. success: function (data) {
  56. _self.redDocument = data;
  57. },
  58. error: function (XMLHttpRequest, textStatus, errorThrown) {
  59. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  60. },
  61. });
  62. },
  63. },
  64. };
  65. </script>