selectStockLedgerDialog1.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. :visible="selectStockLedgerDialogFLag"
  6. title="库存台账"
  7. append-to-body
  8. :close-on-click-modal="false"
  9. width="70%"
  10. :before-close="cancel"
  11. :maxable="true"
  12. :resizable="true"
  13. >
  14. <div id="stockLedger__index">
  15. <el-card shadow="never">
  16. <ele-split-layout
  17. width="256px"
  18. allow-collapse
  19. :right-style="{ overflow: 'hidden' }"
  20. >
  21. <div class="el-tree_box">
  22. <!-- <div class="tabs_box">-->
  23. <!-- <el-radio-group v-model="currentTab" @change="tabsChange">-->
  24. <!-- <el-radio-button label="products">分类维度</el-radio-button>-->
  25. <!-- <el-radio-button label="warehouse">仓库维度</el-radio-button>-->
  26. <!-- </el-radio-group>-->
  27. <!-- </div>-->
  28. <div class="ele-border-lighter sys-organization-list">
  29. <!-- <asset-tree
  30. @handleNodeClick="onNodeClick"
  31. ref="commonTree"
  32. :treeFormate="
  33. (list) => {
  34. return [
  35. {
  36. children: list,
  37. id: '0',
  38. level: 0,
  39. name: '库存台账',
  40. originId: null,
  41. originType: {},
  42. parentId: null,
  43. type: '',
  44. weight: 0
  45. }
  46. ];
  47. }
  48. "
  49. /> -->
  50. <el-tree
  51. :data="treeList"
  52. :props="defaultProps"
  53. ref="treeRef"
  54. :default-expanded-keys="
  55. current && current.id ? [current.id] : []
  56. "
  57. :highlight-current="true"
  58. node-key="id"
  59. :expand-on-click-node="false"
  60. @node-click="handleNodeClick"
  61. ><span class="custom-tree-node" slot-scope="{ node, data }">
  62. <span
  63. >{{ data.factoryName ? data.factoryName + '-' : ''
  64. }}{{ data.name }}</span
  65. >
  66. </span></el-tree
  67. >
  68. </div>
  69. </div>
  70. <template v-slot:content>
  71. <item-list ref="listRef" :current="current" :type="currentTab" />
  72. </template>
  73. </ele-split-layout>
  74. </el-card>
  75. </div>
  76. </ele-modal>
  77. </template>
  78. <script>
  79. import itemList from './item-list';
  80. import AssetTree from '@/components/AssetTree';
  81. import { getWarehouseTrees } from '@/api/wms';
  82. export default {
  83. components: { itemList, AssetTree },
  84. props: {
  85. selectStockLedgerDialogFLag: {
  86. type: Boolean,
  87. default: false
  88. }
  89. },
  90. data() {
  91. return {
  92. currentTab: 'products',
  93. treeData: [],
  94. current: {},
  95. defaultProps: {
  96. children: 'children',
  97. label: 'name'
  98. },
  99. currentId: '',
  100. treeList: [],
  101. treeLoading: false
  102. };
  103. },
  104. methods: {
  105. open() {
  106. this.getTreeData();
  107. },
  108. async getTreeData() {
  109. try {
  110. this.treeLoading = true;
  111. let res = null;
  112. res = await getWarehouseTrees();
  113. this.treeLoading = false;
  114. if (res?.code === '0') {
  115. this.treeList = res.data;
  116. return this.treeList;
  117. }
  118. } catch (error) {
  119. console.log(error);
  120. }
  121. this.treeLoading = false;
  122. },
  123. handleNodeClick(data, node) {
  124. if (data.id == this.currentId) {
  125. this.$refs.treeRef.setCurrentKey(null);
  126. this.currentId = '';
  127. this.current = {};
  128. this.$refs.listRef.reload();
  129. } else {
  130. this.currentId = data.id;
  131. this.current = node;
  132. }
  133. },
  134. cancel() {
  135. this.$emit('update:selectStockLedgerDialogFLag', false);
  136. }
  137. }
  138. };
  139. </script>
  140. <style lang="scss" scoped>
  141. #stockLedger__index {
  142. padding: 6px;
  143. .el-tree_box {
  144. height: 100%;
  145. display: flex;
  146. flex-direction: column;
  147. }
  148. .tabs_box {
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. box-sizing: border-box;
  153. margin-bottom: 3px;
  154. width: 100%;
  155. > div {
  156. width: 100%;
  157. display: flex;
  158. :deep(.el-radio-button) {
  159. flex: 1;
  160. .el-radio-button__inner {
  161. width: 100%;
  162. }
  163. }
  164. }
  165. }
  166. .sys-organization-list {
  167. height: calc(100vh - 185px);
  168. box-sizing: border-box;
  169. border-width: 1px;
  170. border-style: solid;
  171. overflow: auto;
  172. }
  173. .sys-organization-list :deep(.el-tree-node__content) {
  174. height: 40px;
  175. & > .el-tree-node__expand-icon {
  176. margin-left: 10px;
  177. }
  178. }
  179. }
  180. </style>