index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" class="queryForm" size="small" :inline="true" label-width="68px">
  4. <el-form-item label="盘点部门" prop="inventoryDepartment">
  5. <treeselect
  6. v-model="queryParams.deptId"
  7. :options="deptOptions"
  8. placeholder="选择盘点部门"
  9. @keyup.enter.native="onQueryLoss"
  10. />
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" icon="el-icon-search" size="mini" @click="onQueryLoss">搜索</el-button>
  14. </el-form-item>
  15. </el-form>
  16. <el-row :gutter="10" class="mb8">
  17. <el-button
  18. type="warning"
  19. plain
  20. icon="el-icon-download"
  21. size="mini"
  22. @click="onLossExport"
  23. v-hasPermi="['inventory:inventory:export']"
  24. >导出</el-button>
  25. </el-row>
  26. <el-table :data="lossList">
  27. <el-table-column type="expand">
  28. <template v-slot="slot">
  29. <el-table :data="slot.row.assetResultList" ref="table" :header-cell-style="{ background: '#dcdfe6' }" >
  30. <el-table-column
  31. prop="inventoryName"
  32. label="资产名称">
  33. </el-table-column>
  34. <el-table-column
  35. prop="inventoryLocationName"
  36. label="资产位置">
  37. </el-table-column>
  38. <el-table-column
  39. prop="expectInventoryNumber"
  40. label="账面数量">
  41. </el-table-column>
  42. <el-table-column
  43. prop="realityInventoryNumber"
  44. label="实点数量">
  45. </el-table-column>
  46. <el-table-column
  47. prop="lossNumber"
  48. label="损耗数量">
  49. </el-table-column>
  50. <el-table-column
  51. prop="units"
  52. label="计量单位">
  53. </el-table-column>
  54. <el-table-column
  55. prop="lossVal"
  56. label="资产损耗金额">
  57. </el-table-column>
  58. </el-table>
  59. </template>
  60. </el-table-column>
  61. <el-table-column
  62. prop="inventoryDepartment"
  63. label="盘点部门">
  64. </el-table-column>
  65. <el-table-column
  66. prop="lossTotal"
  67. label="损耗总额">
  68. </el-table-column>
  69. <el-table-column
  70. prop="date"
  71. label="盘点时间">
  72. </el-table-column>
  73. </el-table>
  74. <pagination
  75. v-show="total>0"
  76. :total="total"
  77. :page.sync="queryParams.pageNum"
  78. :limit.sync="queryParams.pageSize"
  79. @pagination="onQueryLoss"
  80. />
  81. </div>
  82. </template>
  83. <script>
  84. import { deptTreeSelect } from '@/api/system/user.js'
  85. import { getDepAssetLossTb } from '@/api/inventory/detail';
  86. import Treeselect from "@riophae/vue-treeselect";
  87. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  88. export default {
  89. components : {
  90. Treeselect
  91. },
  92. data() {
  93. return {
  94. // 总条数
  95. total: 0,
  96. lossList: [],
  97. deptOptions: [],
  98. // 查询参数
  99. queryParams: {
  100. pageNum: 1,
  101. pageSize: 10,
  102. deptId: null
  103. }
  104. }
  105. },
  106. created() {
  107. this.getDeptTree()
  108. },
  109. methods: {
  110. /** 查询部门下拉树结构 */
  111. getDeptTree() {
  112. deptTreeSelect().then((response) => {
  113. this.deptOptions = response.data;
  114. this.queryParams.deptId = this.deptOptions[0].id;
  115. this.onQueryLoss()
  116. });
  117. },
  118. onQueryLoss() {
  119. if (this.queryParams.deptId === null) {
  120. this.$modal.msgWarning("部门不能为空");
  121. return
  122. }
  123. getDepAssetLossTb(this.queryParams).then(response => {
  124. this.lossList = response.rows
  125. this.total = response.total;
  126. console.log('资产报表', this.lossData)
  127. })
  128. },
  129. onLossExport() {
  130. if (this.queryParams.deptId === null) {
  131. this.$modal.msgWarning("部门不能为空");
  132. return
  133. }
  134. const deptId = this.queryParams.deptId
  135. this.download('inventory/detail/exportDepAssetLossTb', {
  136. deptId
  137. }, `资产报表_${new Date().getTime()}.xlsx`)
  138. this.openExport = false
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="less" scoped>
  144. /deep/ .vue-treeselect {
  145. display: inline-block;
  146. }
  147. .queryForm {
  148. /deep/ .vue-treeselect {
  149. width: 205px;
  150. height: 32px;
  151. }
  152. }
  153. .clickNumber{
  154. color: #409EFF;
  155. &:hover{
  156. cursor: pointer;
  157. text-decoration: underline;
  158. }
  159. }
  160. </style>