AssetInventoryStep9.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="container">
  3. <a-space direction="vertical" :size="4" class="w-full">
  4. <!-- 操作按钮组 -->
  5. <a-row :gutter="4" align="middle">
  6. <a-col :xxl="4" :xl="4" :lg="6" :md="12" :sm="24" :xs="24" style="margin-top: 8px;">
  7. <a-space>
  8. <a-button type="primary" @click="getAssetInstance(false)">
  9. {{ $t("lang.AssetInventorySearch.query") }}
  10. </a-button>
  11. <a-button danger @click="clearFilter">
  12. {{ $t("lang.AssetInventorySearch.empty") }}(已选择:{{ selectedShelvesIdArray.length }})
  13. </a-button>
  14. </a-space>
  15. </a-col>
  16. <!-- 盘点单名称输入 -->
  17. <a-col :xxl="8" :xl="8" :lg="8" :md="12" :sm="24" :xs="24" style="margin-top: 8px; margin-left: 16px;">
  18. <a-form-item label="盘点单名称" class="mb-0">
  19. <a-input v-model:value="inventorySheetName" />
  20. </a-form-item>
  21. </a-col>
  22. </a-row>
  23. <!-- 货架表格 -->
  24. <a-table
  25. :row-selection="{
  26. selectedRowKeys: selectedShelvesIdArray,
  27. onChange: onSelectChange
  28. }" :columns="columns" :data-source="dataSource" :pagination="false" bordered
  29. />
  30. <!-- 操作按钮 -->
  31. <a-row justify="space-between">
  32. <a-button type="primary" @click="previous">上一步</a-button>
  33. <a-button type="primary" @click="next">下一步</a-button>
  34. </a-row>
  35. </a-space>
  36. <Loading v-if="loading" />
  37. </div>
  38. </template>
  39. <script>
  40. import Common from '../../common/Common.js';
  41. import { Notify, SqlApi } from 'pc-component-v3';
  42. export default {
  43. components: {
  44. },
  45. // 定义抛出的事件名称
  46. emits: ['previous', 'next'],
  47. data: function () {
  48. return {
  49. loading: false,
  50. inventorySheetName: undefined, //盘点单名称
  51. selectedShelvesIdArray: [],//选择的货架id集合
  52. columns: [
  53. {
  54. title: '货架名称',
  55. dataIndex: 'name',
  56. },
  57. {
  58. title: '货架类型',
  59. dataIndex: 'shelvesType',
  60. },
  61. ],
  62. dataSource: [],//系统所有货架
  63. };
  64. },
  65. mounted: function () {
  66. var _self = this;
  67. _self.getAllShelves();
  68. },
  69. methods: {
  70. onSelectChange: function (selectedRowKeys, selectedRows) {
  71. this.selectedShelvesIdArray = selectedRowKeys;
  72. },
  73. next: function () {
  74. var _self = this;
  75. if (_self.inventorySheetName == null || _self.inventorySheetName == undefined || _self.inventorySheetName ==
  76. '') {
  77. Notify.error('错误', '请填写盘点单名称', 2000);
  78. return;
  79. }
  80. if (_self.selectedShelvesIdArray == null || _self.selectedShelvesIdArray.length < 1) {
  81. Notify.error('错误', '请至少选择一个货架', 2000);
  82. return;
  83. }
  84. var param = {
  85. inventorySheetName: _self.inventorySheetName,
  86. shelvesIdArray: _self.selectedShelvesIdArray,
  87. };
  88. var data = {
  89. currentStep: 2,
  90. showPage: 8,
  91. assetInventoryStep10: param,
  92. };
  93. this.$emit('next', data);
  94. },
  95. previous: function () {
  96. var data = {
  97. currentStep: 0,
  98. showPage: 0,
  99. assetInventoryStep3: undefined,
  100. };
  101. this.$emit('previous', data);
  102. },
  103. /**
  104. * 清空界面的搜索条件
  105. * @author YangZhiJie 20200806
  106. * @author XiongLiuJie 20211119
  107. */
  108. clearFilter: function () {
  109. var _self = this;
  110. _self.selectedShelvesIdArray.splice(0, _self.selectedShelvesIdArray.length);
  111. },
  112. getAllShelves: function () {
  113. var _self = this;
  114. _self.dataSource.splice(0, _self.dataSource.length);
  115. SqlApi.execute('20221205_152704', null).then(
  116. successData => {
  117. if (successData.errorCode == 0) {
  118. successData.results.forEach(result => {
  119. var data = {
  120. key: result.shelvesId,
  121. name: result.shelvesName,
  122. shelvesType: result.shelvesTypeName,
  123. };
  124. _self.dataSource.push(data);
  125. });
  126. } else {
  127. Notify.error('查询货架异常', successData.errorMessage, true);
  128. }
  129. _self.loading = false;
  130. },
  131. errorData => {
  132. Common.processException(errorData);
  133. _self.loading = false;
  134. },
  135. );
  136. },
  137. },
  138. };
  139. </script>
  140. <style scoped>
  141. .container {
  142. display: flex;
  143. flex-direction: column;
  144. }
  145. .w-full {
  146. width: 100%;
  147. }
  148. :deep(.ant-table) {
  149. margin: 16px 0;
  150. }
  151. :deep(.ant-table-thead > tr > th) {
  152. background: #fafafa;
  153. font-weight: 600;
  154. }
  155. :deep(.ant-form-item) {
  156. margin-bottom: 0;
  157. }
  158. :deep(.ant-form-item-label > label) {
  159. font-size: 14px !important;
  160. font-weight: 500 !important;
  161. }
  162. </style>