purchaseReceiptOrder.vue 9.1 KB

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