list.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <a-spin :spinning="spinning" tip="Loading...">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form-model
  6. id="storeTransOutReport-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. <rangeDate ref="outWareRangeDate" :value="outWareTime" @change="outWareDateChange" />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :md="4" :sm="24">
  27. <a-form-model-item label="店内调出单号">
  28. <a-input id="storeTransOutReport-storeCallOutNo" v-model.trim="queryParam.storeCallOutNo" allowClear placeholder="请输入店内调出单号"/>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="4" :sm="24">
  32. <a-form-item label="调往对象">
  33. <a-input id="sstoreTransOutReport-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入调往对象"/>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :md="4" :sm="24">
  37. <a-form-item label="调拨类型">
  38. <a-select id="sstoreTransOutReport-callOutType" v-model="queryParam.callOutType" placeholder="请选择调拨类型" allowClear >
  39. <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
  40. </a-select>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  44. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="storeTransOutReport-refresh">查询</a-button>
  45. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="storeTransOutReport-reset">重置</a-button>
  46. <a-button
  47. type="primary"
  48. style="margin-left: 5px"
  49. @click="handleExport"
  50. :disabled="disabled"
  51. :loading="exportLoading"
  52. v-if="$hasPermissions('M_storeTransferOutReportExport')"
  53. class="button-warning"
  54. id="storeTransOutReport-export-btn">导出</a-button>
  55. </a-col>
  56. </a-row>
  57. </a-form-model>
  58. </div>
  59. <!-- 合计 -->
  60. <a-alert type="info" style="margin-bottom:10px">
  61. <div class="ftext" slot="message">
  62. 总单数:<strong>{{ (totalData && (totalData.productTotalCategory || totalData.productTotalCategory==0)) ? totalData.productTotalCategory : '--' }}</strong>;
  63. 产品总数量:<strong>{{ (totalData && (totalData.productTotalQty || totalData.productTotalQty==0)) ? totalData.productTotalQty : '--' }}</strong>;
  64. 调出总成本:<strong>{{ (totalData && (totalData.productTotalCost || totalData.productTotalCost==0)) ? '¥'+totalData.productTotalCost : '--' }}</strong>;
  65. </div>
  66. </a-alert>
  67. <!-- 列表 -->
  68. <s-table
  69. class="sTable"
  70. ref="table"
  71. size="small"
  72. :rowKey="(record) => record.id"
  73. :columns="columns"
  74. :data="loadData"
  75. :defaultLoadData="false"
  76. bordered>
  77. </s-table>
  78. </a-spin>
  79. </template>
  80. <script>
  81. import { commonMixin } from '@/utils/mixin'
  82. import { STable, VSelect } from '@/components'
  83. import rangeDate from '@/views/common/rangeDate.vue'
  84. import { downloadExcel } from '@/libs/JGPrint.js'
  85. import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
  86. import { reportStoreCallOutPageList, reportStoreCallOutListTotal, reportStoreCallOutExport } from '@/api/reportData'
  87. export default {
  88. components: { STable, VSelect, rangeDate },
  89. mixins: [commonMixin],
  90. data () {
  91. return {
  92. spinning: false,
  93. labelCol: { span: 8 },
  94. wrapperCol: { span: 16 },
  95. advanced: false, // 高级搜索 展开/关闭
  96. tableHeight: 0,
  97. outWareTime: [],
  98. queryParam: { // 查询条件
  99. time: [],
  100. beginDate: '',
  101. endDate: '',
  102. putPersonName: '',
  103. callOutType: undefined,
  104. storeCallOutNo: ''
  105. },
  106. rules: {
  107. 'time': [{ required: true, message: '请选择审核时间', trigger: 'change' }]
  108. },
  109. disabled: false, // 查询、重置按钮是否可操作
  110. exportLoading: false,
  111. columns: [
  112. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  113. { title: '店内调出单号', dataIndex: 'storeCallOutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  114. { title: '调往对象', dataIndex: 'putPersonName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  115. { title: '调拨类型', dataIndex: 'callOutTypeName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  116. { title: '款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  117. { title: '数量', dataIndex: 'productTotalQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  118. { title: '成本', dataIndex: 'productTotalCost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  119. { title: '审核时间', dataIndex: 'auditTime', width: '13%', align: 'center', customRender: function (text) { return text || '--' } }
  120. ],
  121. // 加载数据方法 必须为 Promise 对象
  122. loadData: parameter => {
  123. this.disabled = true
  124. const params = Object.assign(parameter, this.queryParam)
  125. this.spinning = true
  126. delete params.time
  127. return reportStoreCallOutPageList(params).then(res => {
  128. let data
  129. if (res.status == 200) {
  130. data = res.data
  131. // 总计
  132. this.getCount(params)
  133. const no = (data.pageNo - 1) * data.pageSize
  134. for (var i = 0; i < data.list.length; i++) {
  135. data.list[i].no = no + i + 1
  136. }
  137. this.disabled = false
  138. }
  139. this.spinning = false
  140. return data
  141. })
  142. },
  143. totalData: null, // 合计
  144. storeCallOutTypeList: [] // 调拨类型
  145. }
  146. },
  147. methods: {
  148. // 合计
  149. getCount (params) {
  150. reportStoreCallOutListTotal(params).then(res => {
  151. if (res.status == 200) {
  152. this.totalData = res.data
  153. } else {
  154. this.totalData = null
  155. }
  156. })
  157. },
  158. // 创建时间 change
  159. dateChange (date) {
  160. this.queryParam.time = date
  161. this.queryParam.beginDate = date[0] || ''
  162. this.queryParam.endDate = date[1] || ''
  163. },
  164. outWareDateChange (date) {
  165. this.queryParam.outWarehouseBeginDate = date[0]
  166. this.queryParam.outWarehouseEndDate = date[1]
  167. },
  168. // 查询
  169. handleSearch () {
  170. this.$refs.ruleForm.validate(valid => {
  171. if (valid) {
  172. this.$refs.table.refresh(true)
  173. } else {
  174. console.log('error submit!!')
  175. return false
  176. }
  177. })
  178. },
  179. // 重置
  180. resetSearchForm () {
  181. this.$refs.rangeDate.resetDate()
  182. this.queryParam.time = []
  183. this.queryParam.beginDate = ''
  184. this.queryParam.endDate = ''
  185. this.$refs.outWareRangeDate.resetDate('')
  186. this.outWareTime = []
  187. this.queryParam.outWarehouseBeginDate = ''
  188. this.queryParam.outWarehouseEndDate = ''
  189. this.queryParam.putPersonName = ''
  190. this.queryParam.storeCallOutNo = ''
  191. this.queryParam.callOutType = undefined
  192. this.$refs.ruleForm.resetFields()
  193. this.totalData = null
  194. this.$refs.table.clearTable()
  195. },
  196. // 导出
  197. handleExport () {
  198. const _this = this
  199. this.$refs.ruleForm.validate(valid => {
  200. if (valid) {
  201. const params = _this.queryParam
  202. _this.exportLoading = true
  203. _this.spinning = true
  204. reportStoreCallOutExport(params).then(res => {
  205. downloadExcel(res, '店内调出报表')
  206. _this.exportLoading = false
  207. _this.spinning = false
  208. })
  209. } else {
  210. console.log('error submit!!')
  211. return false
  212. }
  213. })
  214. },
  215. // 调拨类型
  216. getStoreCallOutTypeAllList () {
  217. storeCallOutTypeAllList().then(res => {
  218. if (res.status == 200) {
  219. this.storeCallOutTypeList = res.data
  220. } else {
  221. this.storeCallOutTypeList = []
  222. }
  223. })
  224. },
  225. pageInit () {
  226. this.getStoreCallOutTypeAllList()
  227. }
  228. },
  229. mounted () {
  230. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  231. this.pageInit()
  232. this.resetSearchForm()
  233. }
  234. },
  235. activated () {
  236. // 如果是新页签打开,则重置当前页面
  237. if (this.$store.state.app.isNewTab) {
  238. this.pageInit()
  239. this.resetSearchForm()
  240. }
  241. },
  242. beforeRouteEnter (to, from, next) {
  243. next(vm => {})
  244. }
  245. }
  246. </script>