index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div id="inventoryBalance">
  3. <el-card shadow="never">
  4. <!-- 数据表格 -->
  5. <div>
  6. <el-form
  7. label-width="60px"
  8. label-position="left"
  9. class="ele-form-search"
  10. @keyup.enter.native="search"
  11. @submit.native.prevent
  12. >
  13. <el-row :gutter="15">
  14. <el-col :span="6">
  15. <el-form-item label="关键词:" prop="keyWord">
  16. <el-input
  17. clearable
  18. v-model="keyWord"
  19. placeholder="请输入关键词"
  20. ></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="18">
  24. <div class="ele-form-actions">
  25. <el-button
  26. type="primary"
  27. icon="el-icon-search"
  28. class="ele-btn-icon"
  29. @click="search"
  30. size="small"
  31. >
  32. 查询
  33. </el-button>
  34. <el-button
  35. @click="reset"
  36. icon="el-icon-refresh-left"
  37. size="small"
  38. type="primary"
  39. >重置</el-button
  40. >
  41. </div>
  42. </el-col>
  43. </el-row>
  44. </el-form>
  45. </div>
  46. <ele-pro-table
  47. ref="table"
  48. class="table"
  49. :columns="columns"
  50. :datasource="datasource"
  51. :pageSize="20"
  52. height="calc(100vh - 405px)"
  53. full-height="calc(100vh - 116px)"
  54. tool-class="ele-toolbar-form"
  55. >
  56. <template v-slot:toolbar="{ row }">
  57. <el-button
  58. size="small"
  59. type="primary"
  60. icon="el-icon-plus"
  61. class="ele-btn-icon"
  62. @click="add(false)"
  63. >
  64. 新增
  65. </el-button>
  66. </template>
  67. <template v-slot:action="{ row }">
  68. <el-link
  69. type="primary"
  70. :underline="false"
  71. icon="el-icon-view"
  72. @click="add(true, row)"
  73. >
  74. 详情
  75. </el-link>
  76. <el-link
  77. type="primary"
  78. :underline="false"
  79. icon="el-icon-download"
  80. @click="downLoad(row)"
  81. >
  82. 下载
  83. </el-link>
  84. </template>
  85. </ele-pro-table>
  86. </el-card>
  87. <add ref="addRef" @reload="search" />
  88. </div>
  89. </template>
  90. <script>
  91. import add from './add.vue';
  92. import ItemSearch from './components/item-search.vue';
  93. import {
  94. getStatementLogPage,
  95. exportStockExcel
  96. } from '@/api/warehouseManagement/statisticalReports';
  97. export default {
  98. components: { ItemSearch, add },
  99. data() {
  100. return {
  101. keyWord: '',
  102. columns: [
  103. {
  104. type: 'index',
  105. label: '序号',
  106. width: 50,
  107. align: 'center'
  108. },
  109. {
  110. prop: 'code',
  111. label: '编码',
  112. align: 'center',
  113. showOverflowTooltip: true
  114. },
  115. {
  116. prop: 'name',
  117. label: '名称',
  118. align: 'center',
  119. showOverflowTooltip: true
  120. },
  121. {
  122. prop: 'createUserName',
  123. label: '创建人',
  124. align: 'center',
  125. showOverflowTooltip: true
  126. },
  127. {
  128. prop: 'startTime',
  129. label: '开始时间',
  130. slot: 'startTime',
  131. align: 'center',
  132. showOverflowTooltip: true
  133. },
  134. {
  135. prop: 'endTime',
  136. label: '结束时间',
  137. align: 'center',
  138. showOverflowTooltip: true
  139. },
  140. {
  141. columnKey: 'action',
  142. label: '操作',
  143. fixed: 'right',
  144. width: 250,
  145. align: 'center',
  146. slot: 'action',
  147. showOverflowTooltip: true
  148. }
  149. ]
  150. };
  151. },
  152. methods: {
  153. downLoad(row) {
  154. exportStockExcel({
  155. code: row.code,
  156. name: row.name,
  157. startTime: row.startTime,
  158. endTime: row.endTime,
  159. exportStatus: 1
  160. }).then((data) => {
  161. try {
  162. let objectUrl1 = window.URL.createObjectURL(new Blob([data]));
  163. let elink = document.createElement('a');
  164. elink.setAttribute(
  165. 'download',
  166. decodeURI(decodeURI('库存余额.xlsx'))
  167. );
  168. elink.style.display = 'none';
  169. elink.href = objectUrl1;
  170. document.body.appendChild(elink);
  171. elink.click();
  172. document.body.removeChild(elink);
  173. window.URL.revokeObjectURL(elink.href);
  174. this.search();
  175. } catch (err) {
  176. this.$message.error('导出失败,请联系管理员!');
  177. }
  178. });
  179. },
  180. add(isView, row) {
  181. console.log('isView--', isView);
  182. console.log('row-----', row);
  183. this.$refs.addRef.open(isView, row);
  184. },
  185. /* 表格数据源 */
  186. datasource({ page, limit, where, order }) {
  187. const data = getStatementLogPage({
  188. ...where,
  189. ...order,
  190. type: 1,
  191. keyWord: this.keyWord,
  192. pageNum: page,
  193. size: limit
  194. });
  195. return data;
  196. },
  197. search() {
  198. this.$refs.table.reload();
  199. },
  200. reset() {
  201. this.keyWord = '';
  202. this.search();
  203. }
  204. }
  205. };
  206. </script>
  207. <style lang="scss" scoped>
  208. #inventoryBalance {
  209. height: 100%;
  210. width: 100%;
  211. padding: 10px;
  212. box-sizing: border-box;
  213. // element-ui样式穿透
  214. :deep(.el-card) {
  215. height: 100%;
  216. .el-card__body {
  217. height: 100%;
  218. box-sizing: border-box;
  219. display: flex;
  220. flex-direction: column;
  221. .ele-pro-table {
  222. flex: 1;
  223. display: flex;
  224. flex-direction: column;
  225. .el-table {
  226. flex: 1;
  227. // display: flex;
  228. // flex-direction: column;
  229. // .el-table__body-wrapper {
  230. // flex: 1;
  231. // }
  232. }
  233. }
  234. }
  235. .el-form-item {
  236. margin-bottom: 5px !important;
  237. }
  238. }
  239. .ele-form-actions {
  240. display: flex;
  241. justify-content: flex-end;
  242. }
  243. }
  244. </style>