123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <template>
- <div>
- <a-card size="small" :bordered="false" class="searchBoxNormal">
-
- <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="4" :sm="24">
- <a-form-model-item label="地区">
- <Area id="dealerZoneSearch-dealerProvinceSn" v-model="queryParam.dealer.provinceSn" placeholder="请选择省"></Area>
- </a-form-model-item>
- </a-col>
- <a-col :md="5" :sm="24">
- <a-form-item label="所属区域/分区">
- <subarea id="dealerZoneSearch-subareaSn" ref="subarea" @change="subareaChange"></subarea>
- </a-form-item>
- </a-col>
- <a-col :md="5" :sm="24">
- <a-form-item label="经销商">
- <custList id="dealerZoneSearch-dealerName" placeholder="请输入经销商名称搜索" ref="indirectDealer" @change="dealerChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="客服/品类经理/区域负责人/销售总监">
- <a-input id="dealerZoneSearch-bizUserName" v-model.trim="queryParam.bizUserName" allowClear placeholder="请输入客服/品类经理/区域负责人/销售总监"/>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="dealerZoneSearch-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="dealerZoneSearch-reset">重置</a-button>
- <a-button
- style="margin-left: 5px"
- type="primary"
- class="button-warning"
- @click="handleExport"
- :loading="exportLoading"
- id="dealerZoneSearch-export">导出</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- </a-card>
- <a-card size="small" :bordered="false" class="dealerZoneSearch-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
-
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+70+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :pageSize="30"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <template slot="kf" slot-scope="text, record">
- <a-tooltip placement="top" :id="'dealerZoneSearch-userNameKfs'+record.id" v-if="record.userNameKfs">
- <template slot="title">
- {{ record.userNameKfs }}
- </template>
- <div class="line-2">{{ record.userNameKfs }}</div>
- </a-tooltip>
- <span v-else>--</span>
- </template>
- <template slot="qyfzr" slot-scope="text, record">
- <a-tooltip placement="top" :id="'dealerZoneSearch-userNameQyfzrs'+record.id" v-if="record.userNameQyfzrs">
- <template slot="title">
- {{ record.userNameQyfzrs }}
- </template>
- <div class="line-2">{{ record.userNameQyfzrs }}</div>
- </a-tooltip>
- <span v-else>--</span>
- </template>
- <template slot="xszj" slot-scope="text, record">
- <a-tooltip placement="top" :id="'dealerZoneSearch-userNameXszjs'+record.id" v-if="record.userNameXszjs">
- <template slot="title">
- {{ record.userNameXszjs }}
- </template>
- <div class="line-2">{{ record.userNameXszjs }}</div>
- </a-tooltip>
- <span v-else>--</span>
- </template>
- </s-table>
- </a-spin>
- </a-card>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { exportExcel } from '@/libs/JGPrint.js'
- import { STable } from '@/components'
- import subarea from '@/views/common/subarea.js'
- import custList from '@/views/common/custList.vue'
- import Area from '@/views/common/area.js'
- import { queryDealerWithBizuser, exportDealerWithBizuser } from '@/api/dealerRelation'
- export default {
- name: 'DealerZoneSearch',
- mixins: [commonMixin],
- components: { STable, subarea, custList, Area },
- data () {
- return {
- spinning: false,
- disabled: false,
- tableHeight: 0,
- exportLoading: false,
-
- queryParam: {
- subareaSn: undefined,
- subareaAreaSn: undefined,
- dealer: {
- dealerSn: '',
- dealerName: '',
- provinceSn: undefined
- },
- bizUserName: ''
- },
- columns: [
- { title: '经销商名称', dataIndex: 'dealer.dealerName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '省份', dataIndex: 'dealer.provinceName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '所属区域', dataIndex: 'subareaName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '所属分区', dataIndex: 'subareaAreaName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '客服', scopedSlots: { customRender: 'kf' }, dataIndex: 'userNameKfs', width: '30%', align: 'center' },
- { title: '品类经理', dataIndex: 'userNamePljls', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '区域负责人', scopedSlots: { customRender: 'qyfzr' }, dataIndex: 'userNameQyfzrs', width: '11%', align: 'center' },
- { title: '销售总监', scopedSlots: { customRender: 'xszj' }, dataIndex: 'userNameXszjs', width: '7%', align: 'center' }
- ],
-
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
-
- return queryDealerWithBizuser(Object.assign(parameter, this.queryParam)).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- }
- }
- },
- methods: {
-
- handleExport () {
- const _this = this
- const params = this.queryParam
- this.spinning = true
- this.exportLoading = true
- exportExcel(exportDealerWithBizuser, params, '经销商所属分区导出', function () {
- _this.spinning = false
- _this.exportLoading = false
- })
- },
-
- subareaChange (val) {
- this.queryParam.subareaSn = val[0] ? val[0] : undefined
- this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
- },
-
- resetSearchForm () {
- this.queryParam.subareaSn = undefined
- this.queryParam.subareaAreaSn = undefined
- this.queryParam.dealer.dealerSn = ''
- this.queryParam.dealer.dealerName = ''
- this.queryParam.dealer.provinceSn = undefined
- this.queryParam.bizUserName = ''
- this.$refs.indirectDealer.resetForm()
- this.$refs.subarea.clearData()
- this.$refs.table.refresh(true)
- },
-
- dealerChange (val) {
- this.queryParam.dealer.dealerSn = val.key
- this.queryParam.dealer.dealerName = val.key ? (val.label.replace('\n', '')).trim() : ''
- },
-
- pageInit () {
- const _this = this
- this.$nextTick(() => {
- _this.setTableH()
- })
- this.$refs.table.refresh()
- },
-
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 197
- }
- },
- watch: {
- '$store.state.app.winHeight' (newValue, oldValue) {
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) {
- this.pageInit()
- }
- },
- activated () {
-
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less" scoped>
- .dealerZoneSearch-wrap{
- height: 100%;
- margin-top:6px;
- }
- /deep/.ant-select-combobox .ant-select-arrow{
- display:inline-block !important;
- }
- .line-2{
- width: 100%;
- overflow:hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- }
- </style>
|