purchaseReceiptOrder.vue 7.8 KB

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