StockInLineInstance.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div v-if="redDocument != undefined" class="container-fluid">
  3. <stockInLineInstanceBlue v-if="!redDocument" :stock-in-id="stockInId" />
  4. <stockInLineInstanceRed v-if="redDocument" :stock-in-id="stockInId" />
  5. </div>
  6. </template>
  7. <script>
  8. import stockInLineInstanceBlue from './StockInLineInstanceBlue.vue';
  9. import stockInLineInstanceRed from './StockInLineInstanceRed.vue';
  10. import Common from '../common/Common.js';
  11. import { UserStorageResource } from 'pc-component-v3';
  12. export default {
  13. components: {
  14. stockInLineInstanceBlue,
  15. stockInLineInstanceRed,
  16. },
  17. data: function () {
  18. return {
  19. redDocument: undefined,
  20. stockInId: 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.stockInId = 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. 'stockInResource/uniqueIsRedByStockInId?stockInId=' + _self.stockInId,
  50. ),
  51. beforeSend: function (request) {
  52. Common.addTokenToRequest(request);
  53. },
  54. success: function (data) {
  55. _self.redDocument = data;
  56. },
  57. error: function (XMLHttpRequest, textStatus, errorThrown) {
  58. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  59. },
  60. });
  61. },
  62. },
  63. };
  64. </script>