InventoryDataProcessingStep4.vue 5.1 KB

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