inventoryOrder.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div>
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form-model
  6. id="inventoryReportList-form"
  7. ref="ruleForm"
  8. class="form-model-con"
  9. layout="inline"
  10. :model="queryParam"
  11. :rules="rules"
  12. :labelCol="labelCol"
  13. :wrapperCol="wrapperCol"
  14. @keyup.enter.native="handleSearch" >
  15. <a-row :gutter="15">
  16. <a-col :md="6" :sm="24">
  17. <a-form-model-item label="财务审核时间" prop="time">
  18. <rangeDate ref="rangeDate" @change="dateChange" />
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  22. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="inventoryReportList-refresh">查询</a-button>
  23. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryReportList-reset">重置</a-button>
  24. </a-col>
  25. </a-row>
  26. </a-form-model>
  27. </div>
  28. <!-- 合计 -->
  29. <a-alert type="info" style="margin-bottom:10px">
  30. <div class="ftext" slot="message">
  31. 库存总数量:<strong>{{ (totalData && (totalData.totalStockQty || totalData.totalStockQty==0)) ? totalData.totalStockQty : '--' }}</strong>;
  32. 库存总成本:<strong>{{ (totalData && (totalData.totalStockCost || totalData.totalStockCost==0)) ? '¥'+totalData.totalStockCost : '--' }}</strong>;
  33. 盘盈总数量:<strong>{{ (totalData && (totalData.totalProfitQty || totalData.totalProfitQty==0)) ? totalData.totalProfitQty : '--' }}</strong>;
  34. 盘盈总成本:<strong>{{ (totalData && (totalData.totalProfitCost || totalData.totalProfitCost==0)) ? '¥'+totalData.totalProfitCost : '--' }}</strong>;
  35. 盘亏总数量:<strong>{{ (totalData && (totalData.totalLossQty || totalData.totalLossQty==0)) ? totalData.totalLossQty : '--' }}</strong>;
  36. 盘亏总成本:<strong>{{ (totalData && (totalData.totalLossCost || totalData.totalLossCost==0)) ? '¥'+totalData.totalLossCost : '--' }}</strong>;
  37. 盈亏总数量:<strong>{{ (totalData && (totalData.totalProfitLossQty || totalData.totalProfitLossQty==0)) ? totalData.totalProfitLossQty : '--' }}</strong>;
  38. 盈亏总成本:<strong>{{ (totalData && (totalData.totalProfitLossCost || totalData.totalProfitLossCost==0)) ? '¥'+totalData.totalProfitLossCost : '--' }}</strong>;
  39. </div>
  40. </a-alert>
  41. <!-- 列表 -->
  42. <s-table
  43. class="sTable"
  44. ref="table"
  45. size="small"
  46. :rowKey="(record) => record.salesTargetSn"
  47. :columns="columns"
  48. :data="loadData"
  49. :defaultLoadData="false"
  50. bordered>
  51. </s-table>
  52. </div>
  53. </template>
  54. <script>
  55. import { STable, VSelect } from '@/components'
  56. import rangeDate from '@/views/common/rangeDate.vue'
  57. import { reportCheckWarehouseList, reportCheckWarehouseCount } from '@/api/reportData'
  58. export default {
  59. components: { STable, VSelect, rangeDate },
  60. data () {
  61. return {
  62. labelCol: { span: 8 },
  63. wrapperCol: { span: 16 },
  64. queryParam: { // 查询条件
  65. time: [],
  66. beginDate: '',
  67. endDate: ''
  68. },
  69. productType: [],
  70. rules: {
  71. 'time': [{ required: true, message: '请选择财务审核时间', trigger: 'change' }]
  72. },
  73. disabled: false, // 查询、重置按钮是否可操作
  74. exportLoading: false,
  75. columns: [
  76. { title: '盘点单号', dataIndex: 'checkWarehouseNo', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
  77. { title: '库存总数量', dataIndex: 'totalStockQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  78. { title: '库存总成本', dataIndex: 'totalStockCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  79. { title: '盘盈总数量', dataIndex: 'totalProfitQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  80. { title: '盘盈总成本', dataIndex: 'totalProfitCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  81. { title: '盘亏总数量', dataIndex: 'totalLossQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '盘亏总成本', dataIndex: 'totalLossCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  83. { title: '盈亏总数量', dataIndex: 'totalProfitLossQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  84. { title: '盈亏总成本', dataIndex: 'totalProfitLossCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  85. ],
  86. // 加载数据方法 必须为 Promise 对象
  87. loadData: parameter => {
  88. this.disabled = true
  89. const params = Object.assign(parameter, this.queryParam)
  90. // this.spinning = true
  91. this.$emit('spinning', true)
  92. delete params.time
  93. if (params.beginDate) {
  94. return reportCheckWarehouseList(params).then(res => {
  95. // 总计
  96. this.getCount(params)
  97. const data = res.data
  98. const no = (data.pageNo - 1) * data.pageSize
  99. for (var i = 0; i < data.list.length; i++) {
  100. data.list[i].no = no + i + 1
  101. }
  102. this.disabled = false
  103. // this.spinning = false
  104. this.$emit('spinning', false)
  105. return data
  106. })
  107. } else {
  108. const _this = this
  109. return new Promise(function (resolve, reject) {
  110. const data = {
  111. pageNo: 1,
  112. pageSize: 10,
  113. list: [],
  114. count: 0
  115. }
  116. _this.disabled = false
  117. // _this.spinning = false
  118. _this.$emit('spinning', false)
  119. _this.$message.info('请选择财务审核时间')
  120. resolve(data)
  121. })
  122. }
  123. },
  124. totalData: null // 合计
  125. }
  126. },
  127. methods: {
  128. // 合计
  129. getCount (params) {
  130. reportCheckWarehouseCount(params).then(res => {
  131. if (res.status == 200) {
  132. this.totalData = res.data
  133. } else {
  134. this.totalData = null
  135. }
  136. })
  137. },
  138. // 创建时间 change
  139. dateChange (date) {
  140. this.queryParam.time = date
  141. this.queryParam.beginDate = date[0] || ''
  142. this.queryParam.endDate = date[1] || ''
  143. },
  144. // 查询
  145. handleSearch () {
  146. this.$refs.ruleForm.validate(valid => {
  147. if (valid) {
  148. this.$refs.table.refresh(true)
  149. } else {
  150. console.log('error submit!!')
  151. return false
  152. }
  153. })
  154. },
  155. // 重置
  156. resetSearchForm () {
  157. this.$refs.rangeDate.resetDate()
  158. this.queryParam.time = []
  159. this.queryParam.beginDate = ''
  160. this.queryParam.endDate = ''
  161. this.$refs.ruleForm.resetFields()
  162. this.totalData = null
  163. this.$refs.table.clearTable()
  164. }
  165. },
  166. mounted () {
  167. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  168. this.resetSearchForm()
  169. }
  170. },
  171. activated () {
  172. // 如果是新页签打开,则重置当前页面
  173. if (this.$store.state.app.isNewTab) {
  174. this.resetSearchForm()
  175. }
  176. },
  177. beforeRouteEnter (to, from, next) {
  178. next(vm => {})
  179. }
  180. }
  181. </script>
  182. <style>
  183. </style>