InventoryDataProcessingStep4.vue 4.8 KB

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