purchaseReceiptOrder.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 { hdPrint } from '@/libs/JGPrint'
  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: 'receivingBillNo', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
  100. { title: '入库款数', dataIndex: 'totalPutCategory', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  101. { title: '采购数量', dataIndex: 'totalQty', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  102. { title: '入库数量', dataIndex: 'totalPutQty', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  103. { title: '采购成本', dataIndex: 'totalAmount', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  104. { title: '入库成本', dataIndex: 'totalPutAmount', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  105. { title: '财务审核时间', dataIndex: 'auditTime', width: '17%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  106. ],
  107. // 加载数据方法 必须为 Promise 对象
  108. loadData: parameter => {
  109. this.disabled = true
  110. const params = Object.assign(parameter, this.queryParam)
  111. this.$emit('spinning', true)
  112. delete params.time
  113. if (params.beginDate) {
  114. return reportChainReceivingBillList(params).then(res => {
  115. // 总计
  116. this.getCount(params)
  117. const data = res.data
  118. const no = (data.pageNo - 1) * data.pageSize
  119. for (var i = 0; i < data.list.length; i++) {
  120. data.list[i].no = no + i + 1
  121. }
  122. this.disabled = false
  123. this.$emit('spinning', false)
  124. return data
  125. })
  126. } else {
  127. const _this = this
  128. return new Promise(function (resolve, reject) {
  129. const data = {
  130. pageNo: 1,
  131. pageSize: 10,
  132. list: [],
  133. count: 0
  134. }
  135. _this.disabled = false
  136. _this.$emit('spinning', false)
  137. _this.$message.info('请选择财务审核时间')
  138. resolve(data)
  139. })
  140. }
  141. },
  142. totalData: null, // 合计
  143. linkageGroupData: []
  144. }
  145. },
  146. methods: {
  147. // 合计
  148. getCount (params) {
  149. reportChainReceivingBillCount(params).then(res => {
  150. if (res.status == 200) {
  151. this.totalData = res.data
  152. } else {
  153. this.totalData = null
  154. }
  155. })
  156. },
  157. // 创建时间 change
  158. dateChange (date) {
  159. this.queryParam.time = date
  160. this.queryParam.beginDate = date[0] || ''
  161. this.queryParam.endDate = date[1] || ''
  162. },
  163. // 查询
  164. handleSearch () {
  165. this.$refs.ruleForm.validate(valid => {
  166. if (valid) {
  167. this.$refs.table.refresh(true)
  168. } else {
  169. console.log('error submit!!')
  170. return false
  171. }
  172. })
  173. },
  174. // 重置
  175. resetSearchForm () {
  176. this.queryParam.tenantId = undefined
  177. this.$refs.rangeDate.resetDate()
  178. this.queryParam.time = []
  179. this.queryParam.beginDate = ''
  180. this.queryParam.endDate = ''
  181. this.$refs.ruleForm.resetFields()
  182. this.totalData = null
  183. this.$refs.table.clearTable()
  184. },
  185. filterOption (input, option) {
  186. return (
  187. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  188. )
  189. },
  190. // 导出
  191. handleExport () {
  192. const _this = this
  193. _this.spinning = true
  194. _this.exportLoading = true
  195. // 打印或导出
  196. hdPrint('', 'export', reportReceivingBillExport, this.queryParam, '连锁采购入库单报表', function () {
  197. _this.exportLoading = false
  198. _this.spinning = false
  199. })
  200. },
  201. // 连锁店
  202. getLinkageGroup () {
  203. linkageGroupList({}).then(res => {
  204. if (res.status == 200) {
  205. this.linkageGroupData = res.data || []
  206. } else {
  207. this.linkageGroupData = []
  208. }
  209. })
  210. }
  211. },
  212. mounted () {
  213. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  214. this.getLinkageGroup()
  215. this.resetSearchForm()
  216. }
  217. },
  218. activated () {
  219. // 如果是新页签打开,则重置当前页面
  220. if (this.$store.state.app.isNewTab) {
  221. this.getLinkageGroup()
  222. this.resetSearchForm()
  223. }
  224. },
  225. beforeRouteEnter (to, from, next) {
  226. next(vm => {})
  227. }
  228. }
  229. </script>
  230. <style>
  231. </style>