list.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <a-card size="small" :bordered="false" class="warehousingOrderList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form-model
  7. id="warehousingOrderList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :model="queryParam"
  12. :rules="rules"
  13. @keyup.enter.native="handleSearch">
  14. <a-row :gutter="15">
  15. <a-col :md="6" :sm="24">
  16. <a-form-model-item label="完成日期" prop="time">
  17. <rangeDateTime ref="rangeDate" :value="queryParam.time" @change="dateChange" />
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :md="5" :sm="24">
  21. <a-form-model-item label="入库单号">
  22. <a-input id="warehousingOrderList-stockPutNo" v-model.trim="queryParam.stockPutNo" allowClear placeholder="请输入退货单号"/>
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="5" :sm="24">
  26. <a-form-model-item label="入库类型">
  27. <v-select
  28. v-model="queryParam.putBizType"
  29. ref="putBizType"
  30. id="warehousingOrderList-putBizType"
  31. code="PUT_STOCK_TYPE_REPORT"
  32. placeholder="请选择入库类型"
  33. allowClear></v-select>
  34. </a-form-model-item>
  35. </a-col>
  36. <template v-if="advanced">
  37. <a-col :md="8" :sm="24">
  38. <a-form-model-item label="散件入库子类型">
  39. <v-select
  40. v-model="queryParam.sparePartsType"
  41. ref="sparePartsType"
  42. id="warehousingOrderList-sparePartsType"
  43. code="SPARE_PARTS_TYPE"
  44. placeholder="请选择散件入库子类型"
  45. allowClear></v-select>
  46. </a-form-model-item>
  47. </a-col>
  48. </template>
  49. <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
  50. <a-button
  51. type="primary"
  52. class="button-info"
  53. size="small"
  54. @click="handleStock"
  55. id="warehousingOrderList-stockDate">盘点区间日期</a-button>
  56. <a-button style="margin-left: 5px" type="primary" @click="handleSearch" :disabled="disabled" id="warehousingOrderList-refresh">查询</a-button>
  57. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="warehousingOrderList-reset">重置</a-button>
  58. <a-button
  59. style="margin-left: 5px"
  60. type="primary"
  61. class="button-warning"
  62. @click="handleExport"
  63. :disabled="disabled"
  64. :loading="exportLoading"
  65. v-if="$hasPermissions('B_warehousingOrderExport')"
  66. id="warehousingOrderList-export">导出</a-button>
  67. <a @click="advanced=!advanced" style="margin-left: 5px">
  68. {{ advanced ? '收起' : '展开' }}
  69. <a-icon :type="advanced ? 'up' : 'down'"/>
  70. </a>
  71. </a-col>
  72. </a-row>
  73. </a-form-model>
  74. </div>
  75. <!-- 列表 -->
  76. <s-table
  77. class="sTable"
  78. ref="table"
  79. size="small"
  80. :rowKey="(record) => record.id"
  81. :columns="columns"
  82. :data="loadData"
  83. :defaultLoadData="false"
  84. bordered>
  85. <template slot="footer">
  86. <a-row :gutter="15">
  87. <a-col :md="4" :sm="24">
  88. 总数量:{{ (totalData && (totalData.productTotalQty || totalData.productTotalQty==0)) ? totalData.productTotalQty : '--' }}
  89. </a-col>
  90. <a-col :md="4" :sm="24">
  91. 总金额:{{ (totalData && (totalData.productTotalCost || totalData.productTotalCost==0)) ? totalData.productTotalCost : '--' }}
  92. </a-col>
  93. </a-row>
  94. </template>
  95. </s-table>
  96. </a-spin>
  97. </a-card>
  98. </template>
  99. <script>
  100. import { STable, VSelect } from '@/components'
  101. import rangeDateTime from '@/views/common/rangeDateTime.vue'
  102. import { hdExportExcel } from '@/libs/exportExcel'
  103. import { reportStockPutList, reportStockPutCount, reportStockPutExport } from '@/api/reportData'
  104. export default {
  105. components: { STable, VSelect, rangeDateTime },
  106. data () {
  107. return {
  108. spinning: false,
  109. advanced: false,
  110. tableHeight: 0,
  111. queryParam: { // 查询条件
  112. time: [],
  113. beginDate: '',
  114. endDate: '',
  115. stockPutNo: '',
  116. putBizType: undefined,
  117. sparePartsType: undefined
  118. },
  119. rules: {
  120. 'time': [{ required: true, message: '请选择完成日期', trigger: 'change' }]
  121. },
  122. disabled: false, // 查询、重置按钮是否可操作
  123. exportLoading: false,
  124. columns: [
  125. { title: '入库单号', dataIndex: 'stockPutNo', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
  126. { title: '入库开单日期', dataIndex: 'createDate', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '单位名称', dataIndex: 'supplierName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  128. { title: '入库数量', dataIndex: 'productTotalQty', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  129. { title: '入库金额', dataIndex: 'productTotalCost', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  130. { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '散件入库子类型', dataIndex: 'sparePartsTypeDictValue', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
  132. ],
  133. // 加载数据方法 必须为 Promise 对象
  134. loadData: parameter => {
  135. this.disabled = true
  136. this.spinning = true
  137. const params = Object.assign(parameter, this.queryParam)
  138. delete params.time
  139. return reportStockPutList(params).then(res => {
  140. this.getCount(params)
  141. const data = res.data
  142. const no = (data.pageNo - 1) * data.pageSize
  143. for (var i = 0; i < data.list.length; i++) {
  144. data.list[i].no = no + i + 1
  145. }
  146. this.disabled = false
  147. this.spinning = false
  148. return data
  149. })
  150. },
  151. totalData: null
  152. }
  153. },
  154. methods: {
  155. // 盘点库存日期
  156. handleStock () {
  157. this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
  158. },
  159. // 总计
  160. getCount (params) {
  161. reportStockPutCount(params).then(res => {
  162. if (res.status == 200 && res.data) {
  163. this.totalData = res.data
  164. } else {
  165. this.totalData = null
  166. }
  167. })
  168. },
  169. handleSearch () {
  170. const _this = this
  171. this.$refs.ruleForm.validate(valid => {
  172. if (valid) {
  173. _this.$refs.table.refresh(true)
  174. } else {
  175. return false
  176. }
  177. })
  178. },
  179. // 创建时间 change
  180. dateChange (date) {
  181. if (date[0] && date[1]) {
  182. this.queryParam.time = date
  183. } else {
  184. this.queryParam.time = []
  185. }
  186. this.queryParam.beginDate = date[0] || ''
  187. this.queryParam.endDate = date[1] || ''
  188. },
  189. // 重置
  190. resetSearchForm () {
  191. this.$refs.rangeDate.resetDate()
  192. this.queryParam.time = []
  193. this.queryParam.beginDate = ''
  194. this.queryParam.endDate = ''
  195. this.queryParam.stockPutNo = ''
  196. this.queryParam.putBizType = undefined
  197. this.queryParam.sparePartsType = undefined
  198. this.totalData = null
  199. this.$refs.ruleForm.resetFields()
  200. this.$refs.table.clearTable()
  201. },
  202. // 导出
  203. handleExport () {
  204. const _this = this
  205. this.$refs.ruleForm.validate(valid => {
  206. if (valid) {
  207. const params = _this.queryParam
  208. _this.exportLoading = true
  209. _this.spinning = true
  210. hdExportExcel(reportStockPutExport, params, '入库单报表', function () {
  211. _this.exportLoading = false
  212. _this.spinning = false
  213. })
  214. } else {
  215. return false
  216. }
  217. })
  218. },
  219. filterOption (input, option) {
  220. return (
  221. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  222. )
  223. },
  224. pageInit () {}
  225. },
  226. mounted () {
  227. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  228. this.pageInit()
  229. this.resetSearchForm()
  230. }
  231. },
  232. activated () {
  233. // 如果是新页签打开,则重置当前页面
  234. if (this.$store.state.app.isNewTab) {
  235. this.pageInit()
  236. this.resetSearchForm()
  237. }
  238. },
  239. beforeRouteEnter (to, from, next) {
  240. next(vm => {})
  241. }
  242. }
  243. </script>