RepertoryCheck.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div style="padding: 0 10px;">
  3. <Navbar :title="'选择工装设备生成盘点详情'" :is-go-back="false" />
  4. <div class="action-buttons">
  5. <a-button type="primary" @click="searchDatas">搜索</a-button>
  6. <a-button type="dashed" @click="generateCheckVouchs">生成盘点明细</a-button>
  7. <a-button danger @click="clear">清空</a-button>
  8. </div>
  9. <div style="display: flex; gap: 10px;">
  10. <div style="width: 26%;">
  11. <div class="filter-section">
  12. <div class="category-panel">
  13. <a-form layout="horizontal" :model="formState">
  14. <a-form-item label="名称">
  15. <a-input v-model:value="formState.inventoryName" placeholder="请输入名称" @keyup.enter="getCurrentStock" />
  16. </a-form-item>
  17. <a-form-item label="编号">
  18. <a-input v-model:value="formState.inventoryNo" placeholder="请输入编号" @keyup.enter="getCurrentStock" />
  19. </a-form-item>
  20. <a-form-item label="类型">
  21. <a-select v-model:value="formState.inventoryType" placeholder="请选择类型" @change="getCurrentStock">
  22. <a-select-option :value="undefined">全部工装设备</a-select-option>
  23. <a-select-option value="Clamp">工装</a-select-option>
  24. <a-select-option value="Instrument">设备</a-select-option>
  25. <a-select-option value="FinishProduct">成品</a-select-option>
  26. </a-select>
  27. </a-form-item>
  28. </a-form>
  29. </div>
  30. </div>
  31. </div>
  32. <div style="width: 74%;margin:10px 0 0 10px;">
  33. <CommonTable
  34. ref="tableRef" :columns="currentStockColumns" :data-source="currentStocks"
  35. :total="currentStocks.length" :is-custom-row-click="true" @custom-row-click="openWindow"
  36. >
  37. <template #bodyCell="{ column, index }">
  38. <span v-if="column.dataIndex === 'index'">
  39. {{ index + 1 }}
  40. </span>
  41. </template>
  42. </CommonTable>
  43. </div>
  44. </div>
  45. <Loading v-if="loading" />
  46. </div>
  47. </template>
  48. <script>
  49. import Common from '../common/Common.js';
  50. import { UserStorageResource, Uuid, Notify } from 'pc-component-v3';
  51. import { message, Modal } from 'ant-design-vue';
  52. import CommonTable from '../common/CommonTable.vue';
  53. import { DownOutlined, RightOutlined } from '@ant-design/icons-vue';
  54. export default {
  55. components: { CommonTable, DownOutlined, RightOutlined },
  56. data() {
  57. return {
  58. checked: false,
  59. inventoryClasses: [],
  60. type: 0,
  61. warehouseId: null,
  62. warehouseName: null,
  63. checkVouchId: null,
  64. currentStocks: [],
  65. pagination: {
  66. total: 0,
  67. pageSize: 10,
  68. current: 1,
  69. },
  70. isCurrentStock: true,
  71. uuid: Uuid.createUUID(),
  72. loading: false,
  73. panelVisible: true,
  74. namePanelVisible: true,
  75. formState: {
  76. inventoryName: '',
  77. inventoryNo: '',
  78. inventoryType: undefined,
  79. },
  80. };
  81. },
  82. computed: {
  83. currentStockColumns() {
  84. return [
  85. { title: '序号', dataIndex: 'index', width: 50 },
  86. { title: '名称', dataIndex: 'inventoryName', width: 100 },
  87. { title: '编号', dataIndex: 'inventoryNo', width: 100 },
  88. { title: '类型', dataIndex: 'inventoryType', width: 140 },
  89. { title: '默认货位', dataIndex: 'inventoryPosition', width: 140 },
  90. { title: '实际货位', dataIndex: 'inventoryActulPosition', width: 140 },
  91. { title: '所在仓库', dataIndex: 'inventoryWarehouse', width: 100 },
  92. ].map(item => {
  93. return { ...item, align: 'center' };
  94. });
  95. },
  96. },
  97. created() {
  98. const _self = this;
  99. const uuid = this.$route.params.uuid;
  100. UserStorageResource.uniqueByKey(uuid + '_modelData').then(
  101. str => {
  102. if (str.data) {
  103. const modelData = JSON.parse(str.data);
  104. _self.checkVouchId = modelData.id;
  105. _self.warehouseId = modelData.data.warehouse.id;
  106. _self.warehouseName = modelData.data.warehouse.displayValue[0];
  107. }
  108. },
  109. errorData => {
  110. Common.processException(errorData);
  111. },
  112. );
  113. },
  114. mounted() {
  115. this.getCurrentStock();
  116. },
  117. methods: {
  118. searchDatas() {
  119. this.getCurrentStock();
  120. },
  121. getCurrentStock() {
  122. const _self = this;
  123. _self.loading = true;
  124. const obj = {
  125. inventoryName: _self.formState.inventoryName,
  126. inventoryNo: _self.formState.inventoryNo,
  127. inventoryType: _self.formState.inventoryType,
  128. };
  129. $.ajax({
  130. url: Common.getApiURL('InventoryResource/checkVouchFindInventoryByCondition'),
  131. type: 'post',
  132. dataType: 'json',
  133. contentType: 'application/json',
  134. data: JSON.stringify(obj),
  135. beforeSend: request => {
  136. Common.addTokenToRequest(request);
  137. },
  138. success: data => {
  139. if (data.errorCode === 0) {
  140. _self.currentStocks = data.datas;
  141. } else {
  142. message.warning(data.errorMessage);
  143. }
  144. _self.loading = false;
  145. },
  146. error: (XMLHttpRequest, textStatus, errorThrown) => {
  147. _self.loading = false;
  148. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  149. },
  150. });
  151. },
  152. generateCheckVouchs() {
  153. const _self = this;
  154. let information = '';
  155. if (!_self.formState.inventoryType && _self.formState.inventoryName === '' && _self.formState.inventoryNo === '') {
  156. information =
  157. `您确定要将仓库:【${_self.warehouseName}】下所有物料生成盘点明细`;
  158. } else {
  159. information = '您确定要根据选择的过滤条件生成对应的盘点明细';
  160. }
  161. Modal.confirm({
  162. title: '确认生成盘点明细',
  163. content: `${information} 吗?如果"是"的话,请点击"确定"按钮,否则点击"取消"按钮`,
  164. onOk() {
  165. _self.loading = true;
  166. const obj = {
  167. checkVouchId: _self.checkVouchId,
  168. inventoryIds: _self.currentStocks.map(item => item.id),
  169. };
  170. $.ajax({
  171. url: Common.getApiURL(
  172. 'CheckVouchResource/generateCheckVouchsByInventorys',
  173. ),
  174. type: 'post',
  175. dataType: 'json',
  176. contentType: 'application/json',
  177. data: JSON.stringify(obj),
  178. beforeSend: request => {
  179. Common.addTokenToRequest(request);
  180. },
  181. success: data => {
  182. if (data.errorCode === 0) {
  183. message.success(data.errorMessage);
  184. } else {
  185. message.warning(data.errorMessage);
  186. }
  187. _self.loading = false;
  188. },
  189. error: (XMLHttpRequest, textStatus, errorThrown) => {
  190. _self.loading = false;
  191. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  192. },
  193. });
  194. },
  195. onCancel() { },
  196. });
  197. },
  198. clear() {
  199. this.formState = {
  200. inventoryName: '',
  201. inventoryNo: '',
  202. inventoryType: undefined,
  203. };
  204. this.getCurrentStock();
  205. },
  206. openWindow(item) {
  207. console.log(item);
  208. // window.open(
  209. // `#/desktop/window1/window-read/view/050405/0/${item.id}?currPage=1&currIndex=1&totalCount=1&uuid=${Uuid.createUUID()}`,
  210. // );
  211. },
  212. togglePanel() {
  213. this.panelVisible = !this.panelVisible;
  214. },
  215. toggleNamePanel() {
  216. this.namePanelVisible = !this.namePanelVisible;
  217. },
  218. },
  219. };
  220. </script>
  221. <style scoped>
  222. .action-buttons {
  223. margin-top: 20px;
  224. display: flex;
  225. gap: 10px;
  226. }
  227. .panel-header {
  228. background-color: #fafafa;
  229. padding: 10px;
  230. border-radius: 5px;
  231. cursor: pointer;
  232. font-size: 14px;
  233. }
  234. .selected-positions {
  235. margin-top: 20px;
  236. display: flex;
  237. flex-wrap: wrap;
  238. gap: 5px;
  239. }
  240. .filter-section {
  241. margin-top: 20px;
  242. }
  243. .category-panel,
  244. .position-panel {
  245. margin-top: 20px;
  246. }
  247. .inventory-table {
  248. margin-top: 20px;
  249. }
  250. .pagination-info {
  251. margin-top: 20px;
  252. display: flex;
  253. justify-content: space-between;
  254. align-items: center;
  255. }
  256. :deep(.ant-form-item){
  257. margin-bottom: 10px !important;
  258. }
  259. :deep(.ant-form-item-label > label) {
  260. font-size: 14px !important;
  261. font-weight: 600 !important;
  262. }
  263. </style>