AssetInventoryStep3.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div>
  3. <a-result v-if="isShow" status="success" title="操作成功!" sub-title="恭喜您,全盘生成盘点单成功.">
  4. <template #extra>
  5. <div style="text-align: left; margin-bottom: 20px;">
  6. <a-table :columns="columns" :data-source="organizationNames">
  7. <template #bodyCell="{ column, record }">
  8. <template v-if="column.key === 'name'" />
  9. <template v-else-if="column.key === 'documentName'">
  10. <span>
  11. {{ record.documentName }}
  12. </span>
  13. </template>
  14. <template v-else-if="column.key === 'documentNo'">
  15. <span>
  16. {{ record.documentNo }}
  17. </span>
  18. </template>
  19. <template v-else-if="column.key === 'operation'">
  20. <a-button type="primary" @click="openCurdWindow(record.id)">查看盘点单</a-button>
  21. </template>
  22. </template>
  23. </a-table>
  24. </div>
  25. </template>
  26. </a-result>
  27. <a-result v-else title="全盘生成一个盘点单">
  28. <template #extra>
  29. <a-button key="console" type="primary" @click="end">确认生成盘点单</a-button>
  30. </template>
  31. </a-result>
  32. <a-divider style="margin:14px 0 20px 0 !important;" />
  33. <a-button key="console" type="primary" @click="previous">上一步</a-button>
  34. <a-button key="console" style="float: right;" type="primary" @click="next">返回</a-button>
  35. <Loading v-if="loading" />
  36. </div>
  37. </template>
  38. <script>
  39. import Common from '../common/Common.js';
  40. import { Notify, Uuid } from 'pc-component-v3';
  41. import AssetInventoryResource from '../api/asset/AssetInventoryResource.js';
  42. export default {
  43. components: {},
  44. props: {
  45. currentStep: {
  46. type: Object,
  47. default() {
  48. return {};
  49. },
  50. },
  51. },
  52. // 定义抛出的事件名称
  53. emits: ['previous', 'next'],
  54. data: function () {
  55. return {
  56. currentStepTempory: {},
  57. isShow: false,
  58. loading: false,
  59. organizationNames: [],
  60. columns: [{
  61. title: '部门',
  62. dataIndex: 'name',
  63. key: 'name',
  64. }, {
  65. title: '盘点单名称',
  66. dataIndex: 'documentName',
  67. key: 'documentName',
  68. }, {
  69. title: '盘点单编号',
  70. dataIndex: 'documentNo',
  71. key: 'documentNo',
  72. },
  73. {
  74. title: '操作',
  75. dataIndex: 'operation',
  76. key: 'operation',
  77. }],
  78. };
  79. },
  80. watch: {
  81. currentStep: {
  82. handler(newVal, oldVal) {
  83. console.log(newVal);
  84. if (newVal != null) {
  85. this.currentStepTempory = JSON.parse(JSON.stringify(newVal));
  86. }
  87. },
  88. immediate: true,
  89. },
  90. currentStepTempory: {
  91. handler(newVal, oldVal) {
  92. clearTimeout(this.timer); //清除延迟执行
  93. let _self = this;
  94. this.timer = setTimeout(() => { //设置延迟执行
  95. _self.$emit('update', _self.currentStepTempory);
  96. }, 1000);
  97. },
  98. deep: true,
  99. },
  100. },
  101. mounted: function () {
  102. },
  103. methods: {
  104. /**
  105. * 打开资产盘点单的CURD窗口
  106. */
  107. openCurdWindow: function (data) {
  108. let url = Common.getRedirectUrl('#/desktop/window1/window-read/view/041101/0/' + data +
  109. '?currPage=1&currIndex=1&totalCount=1&uuid=' + Uuid.createUUID());
  110. window.open(url);
  111. },
  112. end: function () {
  113. var _self = this;
  114. var param = _self.currentStep.assetInventoryStep3;
  115. _self.loading = true;
  116. AssetInventoryResource.departmentGeneratesCountSheet(param).then(
  117. data => {
  118. if (data.errorCode != 0) {
  119. Notify.error('失败', data.errorMessage, false);
  120. } else {
  121. data.datas.forEach(function (item) {
  122. var organizationName = {
  123. name: item.organizationName,
  124. documentNo: item.documentNo,
  125. documentName: item.name,
  126. id: item.id,
  127. };
  128. _self.organizationNames.push(organizationName);
  129. });
  130. Notify.success('成功', '全单位生成盘点单成功', 2000);
  131. }
  132. _self.isShow = true;
  133. _self.loading = false;
  134. }, xmlHttpRequest => {
  135. _self.loading = false;
  136. Common.processException(xmlHttpRequest);
  137. });
  138. },
  139. previous: function () {
  140. var data = {
  141. currentStep: 1,
  142. showPage: 1,
  143. assetInventoryStep3: undefined,
  144. };
  145. this.$emit('previous', data);
  146. },
  147. next: function () {
  148. var _self = this;
  149. _self.$router.push('/wms/asset-inventory');
  150. },
  151. },
  152. };
  153. </script>
  154. <style></style>