123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <template>
- <div>
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form-model
- id="chainPurchaseReceiptOrderList-form"
- ref="ruleForm"
- class="form-model-con"
- layout="inline"
- :model="queryParam"
- :rules="rules"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- @keyup.enter.native="handleSearch" >
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-model-item label="连锁店" prop="tenantId">
- <a-select
- placeholder="请选择连锁店"
- id="chainPurchaseReceiptOrderList-tenantId"
- allowClear
- v-model="queryParam.tenantId"
- :showSearch="true"
- option-filter-prop="children"
- :filter-option="filterOption">
- <a-select-option v-for="item in linkageGroupData" :key="item.dealerSn" :value="item.dealerSn">{{ item.dealerName }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="财务审核时间" prop="time">
- <rangeDate ref="rangeDate" @change="dateChange" />
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainPurchaseReceiptOrderList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainPurchaseReceiptOrderList-reset">重置</a-button>
- <a-button
- style="margin-left: 5px"
- type="primary"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- v-if="$hasPermissions('B_chainPurchaseReceiptReportExport')"
- id="chainPurchaseReceiptOrderList-export">导出</a-button>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- <!-- 合计 -->
- <a-alert type="info" style="margin-bottom:10px">
- <div class="ftext" slot="message">
- 总单数:<strong>{{ (totalData && (totalData.totalPutCategory || totalData.totalPutCategory==0)) ? totalData.totalPutCategory : '--' }}</strong>;
- 采购总数量:<strong>{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}</strong>;
- 采购总成本:<strong>{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? '¥'+totalData.totalAmount : '--' }}</strong>;
- 入库总数量:<strong>{{ (totalData && (totalData.totalPutQty || totalData.totalPutQty==0)) ? totalData.totalPutQty : '--' }}</strong>;
- 入库总成本:<strong>{{ (totalData && (totalData.totalPutAmount || totalData.totalPutAmount==0)) ? '¥'+totalData.totalPutAmount : '--' }}</strong>;
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.receivingBillSn"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- bordered>
- </s-table>
- </div>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { hdPrint } from '@/libs/JGPrint'
- import { reportChainReceivingBillList, reportChainReceivingBillCount, reportReceivingBillExport, linkageGroupList } from '@/api/reportData'
- export default {
- components: { STable, VSelect, rangeDate },
- data () {
- return {
- labelCol: { span: 8 },
- wrapperCol: { span: 16 },
- queryParam: { // 查询条件
- tenantId: undefined,
- time: [],
- beginDate: '',
- endDate: ''
- },
- productType: [],
- rules: {
- 'tenantId': [{ required: true, message: '请选择连锁店', trigger: 'change' }],
- 'time': [{ required: true, message: '请选择财务审核时间', trigger: 'change' }]
- },
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false,
- columns: [
- { title: '采购入库单号', dataIndex: 'receivingBillNo', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '入库款数', dataIndex: 'totalPutCategory', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '采购数量', dataIndex: 'totalQty', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '入库数量', dataIndex: 'totalPutQty', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '采购成本', dataIndex: 'totalAmount', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '入库成本', dataIndex: 'totalPutAmount', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '财务审核时间', dataIndex: 'auditTime', width: '17%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- const params = Object.assign(parameter, this.queryParam)
- this.$emit('spinning', true)
- delete params.time
- if (params.beginDate) {
- return reportChainReceivingBillList(params).then(res => {
- // 总计
- this.getCount(params)
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- this.$emit('spinning', false)
- return data
- })
- } else {
- const _this = this
- return new Promise(function (resolve, reject) {
- const data = {
- pageNo: 1,
- pageSize: 10,
- list: [],
- count: 0
- }
- _this.disabled = false
- _this.$emit('spinning', false)
- _this.$message.info('请选择财务审核时间')
- resolve(data)
- })
- }
- },
- totalData: null, // 合计
- linkageGroupData: []
- }
- },
- methods: {
- // 合计
- getCount (params) {
- reportChainReceivingBillCount(params).then(res => {
- if (res.status == 200) {
- this.totalData = res.data
- } else {
- this.totalData = null
- }
- })
- },
- // 创建时间 change
- dateChange (date) {
- this.queryParam.time = date
- this.queryParam.beginDate = date[0] || ''
- this.queryParam.endDate = date[1] || ''
- },
- // 查询
- handleSearch () {
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- this.$refs.table.refresh(true)
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- // 重置
- resetSearchForm () {
- this.queryParam.tenantId = undefined
- this.$refs.rangeDate.resetDate()
- this.queryParam.time = []
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.$refs.ruleForm.resetFields()
- this.totalData = null
- this.$refs.table.clearTable()
- },
- filterOption (input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- // 导出
- handleExport () {
- const _this = this
- _this.spinning = true
- _this.exportLoading = true
- // 打印或导出
- hdPrint('', 'export', reportReceivingBillExport, this.queryParam, '连锁采购入库单报表', function () {
- _this.exportLoading = false
- _this.spinning = false
- })
- },
- // 连锁店
- getLinkageGroup () {
- linkageGroupList({}).then(res => {
- if (res.status == 200) {
- this.linkageGroupData = res.data || []
- } else {
- this.linkageGroupData = []
- }
- })
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.getLinkageGroup()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.getLinkageGroup()
- this.resetSearchForm()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style>
- </style>
|