123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <template>
- <a-card size="small" :bordered="false" class="chainSalesDetailsCountReportList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form-model
- id="chainSalesDetailsCountReportList-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="time">
- <rangeDate ref="rangeDate" @change="dateChange" />
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="连锁店" prop="tenantId">
- <a-select
- placeholder="请选择连锁店"
- id="chainSalesDetailsCountReportList-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="2" :sm="8" style="margin-top: 6px;">
- <a-checkbox @change="onChange" :default-checked="queryParam.oosFlag">
- 包含急件
- </a-checkbox>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainSalesDetailsCountReportList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainSalesDetailsCountReportList-reset">重置</a-button>
- <a-button
- style="margin-left: 5px"
- type="primary"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- v-if="$hasPermissions('B_chainSalesDetailsCountReport_export')"
- id="chainSalesDetailsCountReportList-export">导出</a-button>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.targetSn"
- rowKeyName="targetSn"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- :showPagination="false"
- bordered>
- </s-table>
- </a-spin>
- </a-card>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { downloadExcel } from '@/libs/JGPrint.js'
- import { reportSalesBillDetailTotalList, reportSalesBillDetailTotalExport, linkageGroupList } from '@/api/reportData'
- export default {
- mixins: [commonMixin],
- components: { STable, VSelect, rangeDate },
- data () {
- const _this = this
- return {
- spinning: false,
- labelCol: { span: 8 },
- wrapperCol: { span: 16 },
- tableHeight: 0,
- queryParam: { // 查询条件
- tenantId: undefined,
- time: [],
- beginDate: '',
- endDate: '',
- oosFlag: true
- },
- rules: {
- 'time': [{ required: true, message: '请选择审核日期', trigger: 'change' }]
- },
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false,
- columns: [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '门店', dataIndex: 'salesTargetName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- {
- title: '所有品牌',
- children: [
- { title: '滤清器', dataIndex: 'lqqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '雨刮片', dataIndex: 'ygpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '刹车制动系统', dataIndex: 'scpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '蓄电池', dataIndex: 'xdcAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: 'LED灯', dataIndex: 'ledAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- },
- {
- title: '稳升',
- children: [
- { title: '点火线圈', dataIndex: 'dhxqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- },
- {
- title: '德路斯、TBU',
- children: [
- { title: '润滑油', dataIndex: 'rhyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '变速箱油', dataIndex: 'bsxyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '刹车油', dataIndex: 'scyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- },
- {
- title: '火花塞',
- children: [
- { title: 'NGK', dataIndex: 'hhsNgkAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '中冠', dataIndex: 'hhsZgAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- },
- {
- title: '轮胎',
- children: [
- { title: '箭冠', dataIndex: 'ltAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- },
- {
- title: '防冻液',
- children: [
- { title: '酷兰德', dataIndex: 'fdyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- },
- { title: '皮带', dataIndex: 'pdAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '轮子', dataIndex: 'lzAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '其他', dataIndex: 'otherAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '合计', dataIndex: 'totalAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- const params = Object.assign(parameter, this.queryParam)
- this.spinning = true
- delete params.time
- return reportSalesBillDetailTotalList(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = 0
- for (var i = 0; i < data.length; i++) {
- data[i].no = no + i + 1
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- linkageGroupData: [],
- totalData: null
- }
- },
- methods: {
- onChange (e) {
- this.queryParam.oosFlag = e.target.checked
- },
- // 创建时间 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.totalData = null
- this.$refs.ruleForm.resetFields()
- this.$refs.table.clearTable()
- },
- // 导出
- handleExport () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- const params = _this.queryParam
- _this.exportLoading = true
- _this.spinning = true
- reportSalesBillDetailTotalExport(params).then(res => {
- downloadExcel(res, '连锁门店销售明细合计报表')
- _this.exportLoading = false
- _this.spinning = false
- })
- } else {
- return false
- }
- })
- },
- // 连锁店
- getLinkageGroup () {
- linkageGroupList({}).then(res => {
- if (res.status == 200) {
- const data = res.data || []
- if (data.length > 0) {
- this.linkageGroupData = data
- } else {
- this.linkageGroupData = []
- }
- } else {
- this.linkageGroupData = []
- }
- })
- },
- filterOption (input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- pageInit () {
- this.getLinkageGroup()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
|