list.vue 11 KB

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