AssetInventoryStep8.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 />
  33. <Loading v-if="loading" />
  34. <a-button key="console" type="primary" @click="previous">上一步</a-button>
  35. <a-button key="console" style="float: right;" type="primary" @click="next">返回</a-button>
  36. </div>
  37. </template>
  38. <script>
  39. import Common from '../../common/Common.js';
  40. import AssetInventoryResource from '../../api/asset/AssetInventoryResource.js';
  41. import { Notify, Uuid } from 'pc-component-v3';
  42. export default {
  43. components: {
  44. },
  45. props: {
  46. currentStep: {
  47. type: Object,
  48. default () {
  49. return {};
  50. },
  51. },
  52. },
  53. // 定义抛出的事件名称
  54. emits: ['previous'],
  55. data: function() {
  56. this.treeList = [];
  57. return {
  58. treeData: [],
  59. expandedKeys: [],
  60. checkedKeys: [],
  61. autoExpandParent: true,
  62. inventorySheetName: null,
  63. currentStepTempory: {},
  64. isShow: false,
  65. loading: false,
  66. organizationNames: [],
  67. columns: [{
  68. title: '部门',
  69. dataIndex: 'name',
  70. key: 'name',
  71. }, {
  72. title: '盘点单名称',
  73. dataIndex: 'documentName',
  74. key: 'documentName',
  75. }, {
  76. title: '盘点单编号',
  77. dataIndex: 'documentNo',
  78. key: 'documentNo',
  79. },
  80. {
  81. title: '操作',
  82. dataIndex: 'operation',
  83. key: 'operation',
  84. },
  85. ],
  86. };
  87. },
  88. watch: {
  89. currentStep: {
  90. handler(newVal, oldVal) {
  91. console.log(newVal);
  92. if (newVal != null) {
  93. this.currentStepTempory = JSON.parse(JSON.stringify(newVal));
  94. }
  95. },
  96. immediate: true,
  97. },
  98. currentStepTempory: {
  99. handler(newVal, oldVal) {
  100. clearTimeout(this.timer); //清除延迟执行
  101. let _self = this;
  102. this.timer = setTimeout(() => { //设置延迟执行
  103. _self.$emit('update', _self.currentStepTempory);
  104. }, 1000);
  105. },
  106. deep: true,
  107. },
  108. },
  109. mounted: function() {
  110. },
  111. methods: {
  112. /**
  113. * 打开资产盘点单的CURD窗口
  114. */
  115. openCurdWindow: function(data) {
  116. let url = Common.getRedirectUrl('#/desktop/window/window-read/view/041101/0/' + data +
  117. '?currPage=1&currIndex=1&totalCount=1&uuid=' + Uuid.createUUID());
  118. window.open(url);
  119. },
  120. end: function() {
  121. var _self = this;
  122. var param = _self.currentStep.assetInventoryStep3;
  123. _self.loading = true;
  124. AssetInventoryResource.generateCountSheetBySampling(param).then(
  125. data => {
  126. _self.loading = false;
  127. if (data.errorCode == 0) {
  128. var organizationName = {
  129. name: data.organizationName,
  130. documentNo: data.documentNo,
  131. documentName: data.name,
  132. id: data.id,
  133. };
  134. _self.organizationNames.push(organizationName);
  135. Notify.success('成功', '抽盘生成盘点单成功', 2000);
  136. _self.isShow = true;
  137. } else {
  138. Notify.error('错误', data.errorMessage, 2000);
  139. }
  140. }, xmlHttpRequest => {
  141. _self.loading = false;
  142. Common.processException(xmlHttpRequest);
  143. });
  144. },
  145. previous: function() {
  146. var data = {
  147. currentStep: 1,
  148. showPage: 3,
  149. assetInventoryStep3: undefined,
  150. };
  151. this.$emit('previous', data);
  152. },
  153. next: function() {
  154. var _self = this;
  155. _self.$router.push('/eam/assetInventory');
  156. },
  157. },
  158. };
  159. </script>
  160. <style>
  161. </style>