item-list.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <div>
  3. <!-- 数据表格 -->
  4. <item-search @search="reload" ref="refSeavch" @handledime="handledime">
  5. </item-search>
  6. <ele-pro-table
  7. ref="table"
  8. :initLoad="false"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 265px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. cache-key="systemOrgUserTable"
  15. >
  16. <!-- 表头工具栏 -->
  17. <template v-slot:toolbar> </template>
  18. <!-- 操作列 -->
  19. <template v-slot:action="{ row }">
  20. <el-link
  21. type="primary"
  22. :underline="false"
  23. icon="el-icon-edit"
  24. @click="details(row)"
  25. >
  26. 详情
  27. </el-link>
  28. </template>
  29. </ele-pro-table>
  30. </div>
  31. </template>
  32. <script>
  33. import ItemSearch from './item-search.vue';
  34. // import {
  35. // getUserPage,
  36. // removePersonnel,
  37. // unbindLoginName
  38. // } from '@/api/system/organization';
  39. import {
  40. pageeLedgerMain,
  41. removeItem,
  42. getWarehouseList
  43. } from '@/api/classifyManage/itemInformation';
  44. import ouint from '@/api/warehouseManagement/outin';
  45. export default {
  46. components: { ItemSearch },
  47. props: {
  48. // 机构id
  49. organizationId: [Number, String],
  50. // 全部机构
  51. organizationList: Array,
  52. current: {
  53. type: Object,
  54. default: () => ({})
  55. }
  56. },
  57. data() {
  58. return {
  59. searchForm: {
  60. dimension: 1
  61. },
  62. isShow: false
  63. };
  64. },
  65. computed: {
  66. // 表格列配置
  67. columns() {
  68. let obj = [
  69. {
  70. columnKey: 'index',
  71. type: 'index',
  72. width: 50,
  73. align: 'center',
  74. label: '序号',
  75. showOverflowTooltip: true,
  76. fixed: 'left'
  77. },
  78. {
  79. prop: 'code',
  80. label: '编码',
  81. showOverflowTooltip: true
  82. },
  83. {
  84. prop: 'name',
  85. label: '名称',
  86. showOverflowTooltip: true
  87. },
  88. {
  89. prop: 'brandNum',
  90. label: '牌号',
  91. showOverflowTooltip: true
  92. },
  93. {
  94. prop: 'modelType',
  95. label: '型号',
  96. showOverflowTooltip: true
  97. },
  98. {
  99. prop: 'availableCountBase',
  100. label: '实时库存',
  101. sortable: 'custom',
  102. showOverflowTooltip: true
  103. },
  104. {
  105. prop: 'measuringUnit',
  106. label: '计量单位',
  107. align: 'center'
  108. },
  109. {
  110. prop: 'weightUnit',
  111. label: '重量单位',
  112. showOverflowTooltip: true
  113. },
  114. {
  115. prop: 'minUnit',
  116. label: '包装单位',
  117. showOverflowTooltip: true
  118. },
  119. // {
  120. // prop: '',
  121. // label: '安全库存',
  122. // showOverflowTooltip: true
  123. // },
  124. // {
  125. // prop: '',
  126. // label: '质保期',
  127. // showOverflowTooltip: true
  128. // },
  129. {
  130. columnKey: 'action',
  131. label: '操作',
  132. width: 100,
  133. align: 'left',
  134. resizable: false,
  135. slot: 'action'
  136. }
  137. ];
  138. if (this.isShow) {
  139. obj.splice(1, 0, {
  140. prop: 'batchNo',
  141. label: '批次号',
  142. showOverflowTooltip: true
  143. });
  144. }
  145. return obj;
  146. }
  147. },
  148. methods: {
  149. handledime(val) {
  150. this.$set(this, 'isShow', val == 2);
  151. },
  152. /* 表格数据源 */
  153. datasource({ page, limit, where }) {
  154. console.log();
  155. const dimension = this.$refs.refSeavch.dimension;
  156. return ouint.getRealTimeInventory({
  157. ...where,
  158. pageNum: page,
  159. size: limit,
  160. dimension: dimension
  161. });
  162. },
  163. /* 刷新表格 */
  164. reload(where) {
  165. this.$nextTick(() => {
  166. this.$refs.table.reload({
  167. pageNum: 1,
  168. where: {
  169. ...where,
  170. categoryLevelId: this.current?.data?.id || this.current?.id
  171. }
  172. });
  173. });
  174. },
  175. details(row) {
  176. const key = Date.now();
  177. this.$store.commit('stockManagement/CLEAR_BASEINFO');
  178. this.$store.commit('stockManagement/CHANGE_BASEINFO', {
  179. key,
  180. value: row
  181. });
  182. const url =
  183. this.$refs.refSeavch.dimension == 1
  184. ? '/warehouseManagement/stockLedger/allBatchDetails'
  185. : '/warehouseManagement/stockLedger/batchDetails';
  186. this.$router.push({
  187. path: url,
  188. query: {
  189. key,
  190. dimension: this.$refs.refSeavch.dimension,
  191. id: row.id,
  192. assetId: row.assetId
  193. }
  194. });
  195. }
  196. },
  197. watch: {
  198. // 监听机构id变化
  199. current: {
  200. handler() {
  201. this.reload();
  202. }
  203. }
  204. }
  205. };
  206. </script>
  207. <style lang="scss" scoped></style>