AssetInventoryStep6.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 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', 'next'],
  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. 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. end: function() {
  120. var _self = this;
  121. var param = _self.currentStep.assetInventoryStep3;
  122. _self.loading = true;
  123. AssetInventoryResource.departmentGeneratesCountSheet(param).then(
  124. data => {
  125. if(data.errorCode != 0){
  126. Notify.error('失败', data.errorMessage, false);
  127. }else{
  128. data.datas.forEach(function(item){
  129. var organizationName = {
  130. name: item.organizationName,
  131. documentNo: item.documentNo,
  132. documentName: item.name,
  133. id: item.id,
  134. };
  135. _self.organizationNames.push(organizationName);
  136. });
  137. Notify.success('成功', '全单位生成盘点单成功', 2000);
  138. }
  139. _self.isShow = true;
  140. _self.loading = false;
  141. }, xmlHttpRequest => {
  142. _self.loading = false;
  143. Common.processException(xmlHttpRequest);
  144. });
  145. },
  146. previous: function() {
  147. var data = {
  148. currentStep: 1,
  149. showPage: 1,
  150. assetInventoryStep3: undefined,
  151. };
  152. this.$emit('previous',data);
  153. },
  154. next: function() {
  155. var _self = this;
  156. _self.$router.push('/eam/assetInventory');
  157. },
  158. },
  159. };
  160. </script>
  161. <style >
  162. </style>