inventoryOrder.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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)) ? toThousands(totalData.totalStockCost) : '--' }}</strong>;
  33. 盘盈总数量:<strong>{{ (totalData && (totalData.totalProfitQty || totalData.totalProfitQty==0)) ? totalData.totalProfitQty : '--' }}</strong>;
  34. 盘盈总成本:<strong>{{ (totalData && (totalData.totalProfitCost || totalData.totalProfitCost==0)) ? toThousands(totalData.totalProfitCost) : '--' }}</strong>;
  35. 盘亏总数量:<strong>{{ (totalData && (totalData.totalLossQty || totalData.totalLossQty==0)) ? totalData.totalLossQty : '--' }}</strong>;
  36. 盘亏总成本:<strong>{{ (totalData && (totalData.totalLossCost || totalData.totalLossCost==0)) ? toThousands(totalData.totalLossCost) : '--' }}</strong>;
  37. 盈亏总数量:<strong>{{ (totalData && (totalData.totalProfitLossQty || totalData.totalProfitLossQty==0)) ? totalData.totalProfitLossQty : '--' }}</strong>;
  38. 盈亏总成本:<strong>{{ (totalData && (totalData.totalProfitLossCost || totalData.totalProfitLossCost==0)) ? toThousands(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.id"
  47. :columns="columns"
  48. :data="loadData"
  49. :defaultLoadData="false"
  50. bordered>
  51. </s-table>
  52. </div>
  53. </template>
  54. <script>
  55. import { commonMixin } from '@/utils/mixin'
  56. import { STable, VSelect } from '@/components'
  57. import rangeDate from '@/views/common/rangeDate.vue'
  58. import { reportCheckWarehouseList, reportCheckWarehouseCount } from '@/api/reportData'
  59. export default {
  60. components: { STable, VSelect, rangeDate },
  61. mixins: [commonMixin],
  62. data () {
  63. const _this = this
  64. return {
  65. labelCol: { span: 8 },
  66. wrapperCol: { span: 16 },
  67. queryParam: { // 查询条件
  68. time: [],
  69. beginDate: '',
  70. endDate: ''
  71. },
  72. productType: [],
  73. rules: {
  74. 'time': [{ required: true, message: '请选择财务审核时间', trigger: 'change' }]
  75. },
  76. disabled: false, // 查询、重置按钮是否可操作
  77. exportLoading: false,
  78. columns: [
  79. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  80. { title: '盘点单号', dataIndex: 'checkWarehouseNo', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
  81. { title: '库存总数量', dataIndex: 'totalStockQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '库存总成本', dataIndex: 'totalStockCost', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  83. { title: '盘盈总数量', dataIndex: 'totalProfitQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  84. { title: '盘盈总成本', dataIndex: 'totalProfitCost', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  85. { title: '盘亏总数量', dataIndex: 'totalLossQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  86. { title: '盘亏总成本', dataIndex: 'totalLossCost', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  87. { title: '盈亏总数量', dataIndex: 'totalProfitLossQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  88. { title: '盈亏总成本', dataIndex: 'totalProfitLossCost', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  89. ],
  90. // 加载数据方法 必须为 Promise 对象
  91. loadData: parameter => {
  92. this.disabled = true
  93. const params = Object.assign(parameter, this.queryParam)
  94. this.$emit('spinning', true)
  95. delete params.time
  96. if (params.beginDate) {
  97. return reportCheckWarehouseList(params).then(res => {
  98. let data
  99. if (res.status == 200) {
  100. data = res.data
  101. // 总计
  102. this.getCount(params)
  103. const no = (data.pageNo - 1) * data.pageSize
  104. for (var i = 0; i < data.list.length; i++) {
  105. data.list[i].no = no + i + 1
  106. }
  107. this.disabled = false
  108. }
  109. this.$emit('spinning', false)
  110. return data
  111. })
  112. } else {
  113. const _this = this
  114. return new Promise(function (resolve, reject) {
  115. const data = {
  116. pageNo: 1,
  117. pageSize: 10,
  118. list: [],
  119. count: 0
  120. }
  121. _this.disabled = false
  122. // _this.spinning = false
  123. _this.$emit('spinning', false)
  124. _this.$message.info('请选择财务审核时间')
  125. resolve(data)
  126. })
  127. }
  128. },
  129. totalData: null // 合计
  130. }
  131. },
  132. methods: {
  133. // 合计
  134. getCount (params) {
  135. reportCheckWarehouseCount(params).then(res => {
  136. if (res.status == 200) {
  137. this.totalData = res.data
  138. } else {
  139. this.totalData = null
  140. }
  141. })
  142. },
  143. // 创建时间 change
  144. dateChange (date) {
  145. this.queryParam.time = date
  146. this.queryParam.beginDate = date[0] || ''
  147. this.queryParam.endDate = date[1] || ''
  148. },
  149. // 查询
  150. handleSearch () {
  151. this.$refs.ruleForm.validate(valid => {
  152. if (valid) {
  153. this.$refs.table.refresh(true)
  154. } else {
  155. console.log('error submit!!')
  156. return false
  157. }
  158. })
  159. },
  160. // 重置
  161. resetSearchForm () {
  162. this.$refs.rangeDate.resetDate()
  163. this.queryParam.time = []
  164. this.queryParam.beginDate = ''
  165. this.queryParam.endDate = ''
  166. this.$refs.ruleForm.resetFields()
  167. this.totalData = null
  168. this.$refs.table.clearTable()
  169. }
  170. },
  171. mounted () {
  172. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  173. this.resetSearchForm()
  174. }
  175. },
  176. activated () {
  177. // 如果是新页签打开,则重置当前页面
  178. if (this.$store.state.app.isNewTab) {
  179. this.resetSearchForm()
  180. }
  181. },
  182. beforeRouteEnter (to, from, next) {
  183. next(vm => {})
  184. }
  185. }
  186. </script>
  187. <style>
  188. </style>