AssetInventoryStep5.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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'],
  54. data: function () {
  55. this.treeList = [];
  56. return {
  57. treeData: [],
  58. expandedKeys: [],
  59. checkedKeys: [],
  60. autoExpandParent: true,
  61. inventorySheetName: null,
  62. currentStepTempory: {},
  63. isShow: false,
  64. loading: false,
  65. organizationNames: [],
  66. columns: [{
  67. title: '部门',
  68. dataIndex: 'name',
  69. key: 'name',
  70. }, {
  71. title: '盘点单名称',
  72. dataIndex: 'documentName',
  73. key: 'documentName',
  74. }, {
  75. title: '盘点单编号',
  76. dataIndex: 'documentNo',
  77. key: 'documentNo',
  78. },
  79. {
  80. title: '操作',
  81. dataIndex: 'operation',
  82. key: 'operation',
  83. },
  84. ],
  85. };
  86. },
  87. watch: {
  88. currentStep: {
  89. handler(newVal, oldVal) {
  90. console.log(newVal);
  91. if (newVal != null) {
  92. this.currentStepTempory = JSON.parse(JSON.stringify(newVal));
  93. }
  94. },
  95. immediate: true,
  96. },
  97. currentStepTempory: {
  98. handler(newVal, oldVal) {
  99. clearTimeout(this.timer); //清除延迟执行
  100. let _self = this;
  101. this.timer = setTimeout(() => { //设置延迟执行
  102. _self.$emit('update', _self.currentStepTempory);
  103. }, 1000);
  104. },
  105. deep: true,
  106. },
  107. },
  108. mounted: function () {
  109. },
  110. methods: {
  111. /**
  112. * 打开资产盘点单的CURD窗口
  113. */
  114. openCurdWindow: function (data) {
  115. let url = Common.getRedirectUrl('#/desktop/window1/window-read/view/041101/0/' + data +
  116. '?currPage=1&currIndex=1&totalCount=1&uuid=' + Uuid.createUUID());
  117. window.open(url);
  118. },
  119. // 确认生成抽盘盘点单
  120. end: function () {
  121. var _self = this;
  122. var param = _self.currentStep.assetInventoryStep3;
  123. console.log(param, '抽盘参数---');
  124. _self.loading = true;
  125. AssetInventoryResource.generateCountSheetBySampling(param).then(
  126. data => {
  127. _self.loading = false;
  128. if (data.errorCode == 0) {
  129. var organizationName = {
  130. name: data.organizationName,
  131. documentNo: data.documentNo,
  132. documentName: data.name,
  133. id: data.id,
  134. };
  135. _self.organizationNames.push(organizationName);
  136. Notify.success('成功', '抽盘生成盘点单成功', 2000);
  137. _self.isShow = true;
  138. } else {
  139. Notify.error('错误', data.errorMessage, 2000);
  140. }
  141. }, xmlHttpRequest => {
  142. _self.loading = false;
  143. Common.processException(xmlHttpRequest);
  144. });
  145. },
  146. previous: function () {
  147. var data = {
  148. currentStep: 1,
  149. showPage: 3,
  150. assetInventoryStep3: undefined,
  151. };
  152. this.$emit('previous', data);
  153. },
  154. next: function () {
  155. var _self = this;
  156. _self.$router.push('/wms/asset-inventory');
  157. },
  158. },
  159. };
  160. </script>
  161. <style></style>