InventoryDataProcessingStep4.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div>
  3. <div>
  4. <label>单据号</label>
  5. <a-input v-model:value="searchParams.documentNo" class="common" @press-enter="searchChange" />
  6. <label class="common">单据名称</label>
  7. <a-input v-model:value="searchParams.documentName" class="common" @press-enter="searchChange" />
  8. <a-button class="common" type="primary" @click="searchChange">
  9. 查询
  10. </a-button>
  11. </div>
  12. <CommonTable
  13. :columns="columns"
  14. :data-source="dataSource"
  15. :total="total"
  16. @get-page="getPageParams"
  17. >
  18. <template #bodyCell="{ column, record }">
  19. <template v-if="column.key === 'processed'">
  20. <span>
  21. {{
  22. record.processed === null || record.processed === false
  23. ? "关闭"
  24. : "打开"
  25. }}</span>
  26. </template>
  27. <template v-if="column.key === 'operation'">
  28. <a-button
  29. v-if="
  30. record.processed === undefined ||
  31. record.processed === null ||
  32. record.processed === false
  33. "
  34. @click="operate(record)"
  35. >
  36. 打开
  37. </a-button>
  38. <a-button v-if="record.processed === true" @click="operate(record)">
  39. 关闭
  40. </a-button>
  41. </template>
  42. </template>
  43. </CommonTable>
  44. <a-button style="margin-top: 20px" type="primary" @click="previous">
  45. 上一步
  46. </a-button>
  47. </div>
  48. </template>
  49. <script setup>
  50. import Common from '../../common/Common';
  51. import { SqlApi, Notify } from 'pc-component-v3';
  52. import { ref, reactive, defineEmits, onMounted, createVNode } from 'vue';
  53. import CommonTable from './CommonTable.vue';
  54. import { Modal } from 'ant-design-vue';
  55. import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
  56. import AssetInventoryResource from '../../api/asset/AssetInventoryResource.js';
  57. // 查询参数
  58. const searchParams = reactive({
  59. documentNo: '',
  60. documentName: '',
  61. offset: 0,
  62. limit: 20,
  63. });
  64. // 表格数据
  65. const columns = reactive(
  66. [
  67. {
  68. title: '单位名称',
  69. key: 'cname',
  70. dataIndex: 'cname',
  71. width:180,
  72. },
  73. {
  74. title: '单据号',
  75. key: 'documentNo',
  76. dataIndex: 'documentNo',
  77. width:200,
  78. },
  79. {
  80. title: '单据名称',
  81. key: 'name',
  82. dataIndex: 'name',
  83. width:200,
  84. },
  85. {
  86. title: '盘点状态',
  87. key: 'inventoryStatus',
  88. dataIndex: 'inventoryStatus',
  89. width:180,
  90. },
  91. {
  92. title: '盘点总数',
  93. key: 'totalCount',
  94. dataIndex: 'totalCount',
  95. width:180,
  96. },
  97. {
  98. title: '已盘点数量',
  99. key: 'countedQuantity',
  100. dataIndex: 'countedQuantity',
  101. width:180,
  102. },
  103. {
  104. title: '状态',
  105. key: 'processed',
  106. dataIndex: 'processed',
  107. width:180,
  108. },
  109. {
  110. title: '操作',
  111. key: 'operation',
  112. dataIndex: 'operation',
  113. width:180,
  114. fixed:'right',
  115. },
  116. ].map(item => ({ ...item, align: 'center' })),
  117. );
  118. const dataSource = ref([]);
  119. const total = ref(0); // 数据总数
  120. // 打开关闭盘点单操作
  121. const operate = record => {
  122. Modal.confirm({
  123. title:
  124. record.processed === null || record.processed === false
  125. ? '打开盘点单'
  126. : '关闭盘点单',
  127. icon: createVNode(ExclamationCircleOutlined),
  128. content: createVNode(
  129. 'div',
  130. {
  131. style: 'color:red;',
  132. },
  133. record.processed === null || record.processed === false
  134. ? `您确定要打开盘点单:${record.documentNo} 吗?`
  135. : `您确定要关闭盘点单:${record.documentNo} 吗?`,
  136. ),
  137. onOk() {
  138. if (record.processed === null || record.processed === false) {
  139. AssetInventoryResource.setProcessed(record.id, true);
  140. } else {
  141. AssetInventoryResource.setProcessed(record.id, false);
  142. }
  143. queryAssetDiscovery();
  144. },
  145. class: 'setProcessed',
  146. });
  147. };
  148. // 查询按钮功能
  149. const searchChange = () => {
  150. searchParams.offset = 0;
  151. queryAssetDiscovery();
  152. };
  153. const emits = defineEmits(['previous']);
  154. // const amisWindowNo = '20220516_164216';
  155. // 从子组件获取的分页参数
  156. const getPageParams = (start, length) => {
  157. searchParams.offset = (start - 1) * length;
  158. searchParams.limit = length;
  159. queryAssetDiscovery();
  160. };
  161. onMounted(() => {
  162. queryAssetDiscovery();
  163. });
  164. // 资产盘点单查询,用于界面设置盘点单状态
  165. const queryAssetDiscovery = () => {
  166. SqlApi.execute('20220520_145516', searchParams).then(
  167. successData => {
  168. if (successData.errorCode === 0) {
  169. dataSource.value = successData.items;
  170. total.value = successData.total;
  171. }
  172. },
  173. errorData => {
  174. Common.processException(errorData);
  175. },
  176. );
  177. };
  178. const previous = () => {
  179. var data = {
  180. currentStep: 0,
  181. showPage: 0,
  182. };
  183. emits('previous', data);
  184. };
  185. </script>
  186. <style scoped>
  187. input {
  188. width: 200px;
  189. }
  190. .common {
  191. margin-left: 8px;
  192. }
  193. </style>