inventoryDetail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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">
  22. <a-form-item label="产品编码">
  23. <a-input id="productPricingList-code" v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
  24. </a-form-item>
  25. </a-col>
  26. <a-col :md="6" :sm="24">
  27. <a-form-item label="产品名称">
  28. <a-input id="productPricingList-name" v-model.trim="queryParam.productEntity.name" allowClear placeholder="请输入产品名称"/>
  29. </a-form-item>
  30. </a-col>
  31. <template v-if="advanced">
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="产品品牌">
  34. <ProductBrand id="productPricingList-productBrandSn" v-model="queryParam.productEntity.productBrandSn"></ProductBrand>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :md="6" :sm="24">
  38. <a-form-item label="产品分类">
  39. <ProductType id="productPricingList-productType" @change="changeProductType" v-model="productType"></ProductType>
  40. </a-form-item>
  41. </a-col>
  42. </template>
  43. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  44. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="inventoryReportList-refresh">查询</a-button>
  45. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryReportList-reset">重置</a-button>
  46. <a @click="advanced=!advanced" style="margin-left: 5px">
  47. {{ advanced ? '收起' : '展开' }}
  48. <a-icon :type="advanced ? 'up' : 'down'"/>
  49. </a>
  50. </a-col>
  51. </a-row>
  52. </a-form-model>
  53. </div>
  54. <!-- 合计 -->
  55. <a-alert type="info" style="margin-bottom:10px">
  56. <div class="ftext" slot="message">
  57. 库存总数量:<strong>{{ (totalData && (totalData.stockQty || totalData.stockQty==0)) ? totalData.stockQty : '--' }}</strong>;
  58. 盘盈总数量:<strong>{{ (totalData && (totalData.checkProfitQty || totalData.checkProfitQty==0)) ? totalData.checkProfitQty : '--' }}</strong>;
  59. 盘亏总数量:<strong>{{ (totalData && (totalData.checkLossQty || totalData.checkLossQty==0)) ? totalData.checkLossQty : '--' }}</strong>;
  60. 盈亏总数量:<strong>{{ (totalData && (totalData.checkProfitLossQty || totalData.checkProfitLossQty==0)) ? totalData.checkProfitLossQty : '--' }}</strong>;
  61. 盈亏总成本:<strong>{{ (totalData && (totalData.checkProfitLossCost || totalData.checkProfitLossCost==0)) ? '¥'+totalData.checkProfitLossCost : '--' }}</strong>;
  62. </div>
  63. </a-alert>
  64. <!-- 列表 -->
  65. <s-table
  66. class="sTable"
  67. ref="table"
  68. size="small"
  69. :rowKey="(record) => record.checkWarehouseSn"
  70. :columns="columns"
  71. :data="loadData"
  72. :defaultLoadData="false"
  73. bordered>
  74. </s-table>
  75. </div>
  76. </template>
  77. <script>
  78. import { STable, VSelect } from '@/components'
  79. import ProductType from '../../common/productType.js'
  80. import ProductBrand from '../../common/productBrand.js'
  81. import rangeDate from '@/views/common/rangeDate.vue'
  82. import { reportCheckWarehouseDetailList, reportCheckWarehouseDetailCount } from '@/api/reportData'
  83. export default {
  84. components: { STable, VSelect, rangeDate, ProductType, ProductBrand },
  85. data () {
  86. return {
  87. labelCol: { span: 8 },
  88. wrapperCol: { span: 16 },
  89. tableHeight: 0,
  90. advanced: true, // 高级搜索 展开/关闭
  91. queryParam: { // 查询条件
  92. time: [],
  93. beginDate: '',
  94. endDate: '',
  95. productEntity: {
  96. name: '',
  97. code: '',
  98. productBrandSn: undefined,
  99. productTypeSn1: '',
  100. productTypeSn2: '',
  101. productTypeSn3: ''
  102. }
  103. },
  104. productType: [],
  105. rules: {
  106. 'time': [{ required: true, message: '请选择财务审核时间', trigger: 'change' }]
  107. },
  108. disabled: false, // 查询、重置按钮是否可操作
  109. exportLoading: false,
  110. columns: [
  111. { title: '盘点单号', dataIndex: 'checkWarehouseNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  112. { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  113. { title: '产品名称', dataIndex: 'productEntity.name', width: '19%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  114. { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  115. { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  116. { title: '仓位', dataIndex: 'warehouseLocationName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  117. { title: '库存数量', dataIndex: 'stockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  118. { title: '盘点数量', dataIndex: 'checkQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  119. { title: '盈亏数量', dataIndex: 'checkProfitLossQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  120. { title: '盈亏总成本', dataIndex: 'checkProfitLossCost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  121. ],
  122. // 加载数据方法 必须为 Promise 对象
  123. loadData: parameter => {
  124. this.disabled = true
  125. const params = Object.assign(parameter, this.queryParam)
  126. this.$emit('spinning', true)
  127. delete params.time
  128. if (params.beginDate) {
  129. return reportCheckWarehouseDetailList(params).then(res => {
  130. let data
  131. if (res.status == 200) {
  132. data = res.data
  133. // 总计
  134. this.getCount(params)
  135. const no = (data.pageNo - 1) * data.pageSize
  136. for (var i = 0; i < data.list.length; i++) {
  137. data.list[i].no = no + i + 1
  138. }
  139. this.disabled = false
  140. }
  141. this.$emit('spinning', false)
  142. return data
  143. })
  144. } else {
  145. const _this = this
  146. return new Promise(function (resolve, reject) {
  147. const data = {
  148. pageNo: 1,
  149. pageSize: 10,
  150. list: [],
  151. count: 0
  152. }
  153. _this.disabled = false
  154. _this.$emit('spinning', false)
  155. _this.$message.info('请选择财务审核时间')
  156. resolve(data)
  157. })
  158. }
  159. },
  160. totalData: null // 合计
  161. }
  162. },
  163. methods: {
  164. // 合计
  165. getCount (params) {
  166. reportCheckWarehouseDetailCount(params).then(res => {
  167. if (res.status == 200) {
  168. this.totalData = res.data
  169. } else {
  170. this.totalData = null
  171. }
  172. })
  173. },
  174. // 创建时间 change
  175. dateChange (date) {
  176. this.queryParam.time = date
  177. this.queryParam.beginDate = date[0] || ''
  178. this.queryParam.endDate = date[1] || ''
  179. },
  180. // 查询
  181. handleSearch () {
  182. this.$refs.ruleForm.validate(valid => {
  183. if (valid) {
  184. this.$refs.table.refresh(true)
  185. } else {
  186. console.log('error submit!!')
  187. return false
  188. }
  189. })
  190. },
  191. // 重置
  192. resetSearchForm () {
  193. this.$refs.rangeDate.resetDate()
  194. this.queryParam.time = []
  195. this.queryParam.beginDate = ''
  196. this.queryParam.endDate = ''
  197. this.queryParam.productEntity.name = ''
  198. this.queryParam.productEntity.code = ''
  199. this.queryParam.productEntity.productBrandSn = undefined
  200. this.queryParam.productEntity.productTypeSn1 = ''
  201. this.queryParam.productEntity.productTypeSn2 = ''
  202. this.queryParam.productEntity.productTypeSn3 = ''
  203. this.productType = []
  204. this.$refs.ruleForm.resetFields()
  205. this.totalData = null
  206. this.$refs.table.clearTable()
  207. },
  208. // 产品分类 change
  209. changeProductType (val, opt) {
  210. this.queryParam.productEntity.productTypeSn1 = val[0] ? val[0] : ''
  211. this.queryParam.productEntity.productTypeSn2 = val[1] ? val[1] : ''
  212. this.queryParam.productEntity.productTypeSn3 = val[2] ? val[2] : ''
  213. }
  214. },
  215. mounted () {
  216. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  217. this.resetSearchForm()
  218. }
  219. },
  220. activated () {
  221. // 如果是新页签打开,则重置当前页面
  222. if (this.$store.state.app.isNewTab) {
  223. this.resetSearchForm()
  224. }
  225. },
  226. beforeRouteEnter (to, from, next) {
  227. next(vm => {})
  228. }
  229. }
  230. </script>
  231. <style>
  232. </style>