list.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <a-card size="small">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <div class="table-page-search-wrapper newTableSearchName">
  5. <a-form-model
  6. id="billingBackReportList-form"
  7. ref="ruleForm"
  8. class="form-model-con"
  9. layout="inline"
  10. :rules="rules"
  11. :model="queryParam"
  12. @keyup.enter.native="handleSearch">
  13. <a-row :gutter="15">
  14. <a-col :md="5" :sm="24">
  15. <a-form-model-item label="退货完成时间" prop="time">
  16. <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange"/>
  17. </a-form-model-item>
  18. </a-col>
  19. <a-col :md="5" :sm="24">
  20. <a-form-model-item label="供应商名称" prop="salesStatusType">
  21. <a-input id="billingBackReport-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :md="5" :sm="24">
  25. <a-form-model-item label="采购退货单号" prop="salesStatusType">
  26. <a-input id="billingBackReport-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :md="5" :sm="24">
  30. <a-form-model-item label="地区">
  31. <div style="display:flex;algin-item:center;">
  32. <a-select v-model="queryParam.dealer.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
  33. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  34. </a-select>
  35. <a-select v-model="queryParam.dealer.citySn" allowClear @change="getAreaList" placeholder="请选择市">
  36. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  37. </a-select>
  38. <a-select v-model="queryParam.dealer.districtSn" allowClear placeholder="请选择区/县">
  39. <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
  40. </a-select>
  41. </div>
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :md="4" :sm="24">
  45. <a-form-model-item label="所在区域/分区">
  46. <subarea id="billingBackReportList-subareaSn" v-model="queryParam.subareaSn"></subarea>
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :md="24" :sm="24" style="margin-bottom: 10px;display:flex;algin-item:center;justify-content: center;">
  50. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="billingBackReportList-refresh">查询</a-button>
  51. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="billingBackReportList-reset">重置</a-button>
  52. <a-button
  53. style="margin-left: 5px"
  54. type="primary"
  55. class="button-warning"
  56. @click="handleExport"
  57. :disabled="disabled"
  58. :loading="exportLoading"
  59. v-if="$hasPermissions('B_regionTypeSalesReportExport')"
  60. id="billingBackReportList-export">导出</a-button>
  61. </a-col>
  62. </a-row>
  63. </a-form-model>
  64. </div>
  65. <!-- 列表 -->
  66. <s-table
  67. class="sTable"
  68. ref="table"
  69. size="small"
  70. :defaultLoadData="false"
  71. :rowKey="(record) => record.id"
  72. :columns="columns"
  73. :data="loadData"
  74. :showPagination="false"
  75. :scroll="{ x: 1550 }"
  76. bordered>
  77. <template slot="footer">
  78. <a-row>
  79. <a-col span="2">合计:</a-col>
  80. <a-col span="22">
  81. <a-row>
  82. <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
  83. <a-col span="4">箭牌变速箱滤清器:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
  84. <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
  85. <a-col span="4">滤清器合计:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
  86. <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
  87. <a-col span="4">箭牌雨燕雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
  88. <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
  89. <a-col span="4">雨刮片合计:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
  90. <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
  91. <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
  92. <a-col span="4">TBU+箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? toThousands(totalData.jpGyxAmount) : '--' }}</a-col>
  93. <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
  94. <a-col span="4">TBU刹车片:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
  95. <a-col span="4">TBU刹车油:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
  96. <a-col span="4">刹车片合计:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
  97. <a-col span="4">TBU-P刹车盘:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? toThousands(totalData.tbupAmount) : '--' }}</a-col>
  98. <a-col span="4">汇箭蓄电池:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? toThousands(totalData.hjAmount) : '--' }}</a-col>
  99. <a-col span="4">布瑞斯蓄电池:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? toThousands(totalData.brsAmount) : '--' }}</a-col>
  100. <a-col span="4">德路斯机油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
  101. <a-col span="4">德路斯变速箱油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
  102. <a-col span="4">德路斯刹车油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
  103. <a-col span="4">德路斯合计:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
  104. <a-col span="4">稳升点火线圈:{{ (totalData && (totalData.wsDhxqAmount || totalData.wsDhxqAmount==0)) ? toThousands(totalData.wsDhxqAmount) : '--' }}</a-col>
  105. <a-col span="4">稳升LED灯:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
  106. <a-col span="4">稳升合计:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
  107. <a-col span="4">NGK火花塞:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? toThousands(totalData.ngkAmount) : '--' }}</a-col>
  108. <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? toThousands(totalData.flpAmount) : '--' }}</a-col>
  109. <a-col span="4">车仆防冻液:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? toThousands(totalData.cpAmount) : '--' }}</a-col>
  110. <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? toThousands(totalData.wetAmount) : '--' }}</a-col>
  111. <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? toThousands(totalData.lbstAmount) : '--' }}</a-col>
  112. <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? toThousands(totalData.defAmount) : '--' }}</a-col>
  113. <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
  114. <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
  115. <a-col span="12">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
  116. <a-col span="4" style="margin-top:20px;">品牌合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
  117. <a-col span="4" style="margin-top:20px;">代理品牌合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
  118. <a-col span="4" style="margin-top:20px;">开单采退金额合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
  119. </a-row>
  120. </a-col>
  121. </a-row>
  122. </template>
  123. </s-table>
  124. </a-spin>
  125. <!-- 导出提示框 -->
  126. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  127. </a-card>
  128. </template>
  129. <script>
  130. import { commonMixin } from '@/utils/mixin'
  131. import { STable, VSelect } from '@/components'
  132. import rangeDate from '@/views/common/rangeDate.vue'
  133. import { getArea } from '@/api/data'
  134. import subarea from '@/views/common/subarea.js'
  135. import { hdExportExcel } from '@/libs/exportExcel'
  136. import reportModal from '@/views/common/reportModal.vue'
  137. import { realReportSalesByProvince, realReportSalesByProvinceExport, realReportSalesBySubArea, realReportSalesBySubAreaExport } from '@/api/reportData.js'
  138. export default {
  139. name: 'RegionTypeSalesReportList',
  140. mixins: [commonMixin],
  141. components: { STable, VSelect, rangeDate, subarea, reportModal },
  142. data () {
  143. return {
  144. spinning: false,
  145. tabsList: [{ id: 0, name: '各省品类实售明细' }, { id: 1, name: '各区品类实售明细' }],
  146. salesStatusTypeList: [{ code: 'SALES', name: '实售销售' }, { code: 'SALES_RETURN', name: '实售退货' }, { code: 'REAL_SALES', name: '实际销售' }],
  147. activeKey: 0,
  148. showExport: false,
  149. queryParam: {
  150. time: [],
  151. beginDate: '',
  152. endDate: '',
  153. dealer: {
  154. 'dealerSn': undefined,
  155. 'provinceSn': undefined,
  156. 'citySn': undefined,
  157. 'districtSn': undefined,
  158. 'subareaSn': undefined,
  159. 'dealerLevel': undefined
  160. },
  161. subareaSn: undefined,
  162. salesStatusType: 'REAL_SALES'
  163. },
  164. addrProvinceList: [], // 省下拉
  165. disabled: false, // 查询、重置按钮是否可操作
  166. exportLoading: false,
  167. rules: {
  168. 'time': [{ required: true, message: '请选择审核时间', trigger: 'change' }],
  169. 'salesStatusType': [{ required: true, message: '请选择销售状态', trigger: 'change' }]
  170. },
  171. // 加载数据方法 必须为 Promise 对象
  172. loadData: parameter => {
  173. this.disabled = true
  174. this.spinning = true
  175. const paramsPage = Object.assign(this.queryParam) // 无分页
  176. const jkUrl = this.activeKey == 0 ? realReportSalesByProvince : realReportSalesBySubArea
  177. return jkUrl(paramsPage).then(res => {
  178. let data
  179. if (res.status == 200) {
  180. data = res.data
  181. }
  182. this.disabled = false
  183. this.spinning = false
  184. return data
  185. })
  186. }
  187. }
  188. },
  189. computed: {
  190. columns () {
  191. const _this = this
  192. const arr = [
  193. { title: '区域', dataIndex: 'subareaNames', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
  194. { title: '分区', dataIndex: 'subareaNames', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
  195. { title: '供应商名称', dataIndex: 'subareaNames', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
  196. { title: '箭牌滤清器', dataIndex: 'jpLqqAmount', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  197. { title: '箭牌变速箱滤清器', dataIndex: 'jpLqqAmount', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  198. { title: '冠牌滤清器', dataIndex: 'gpLqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  199. { title: '滤清器合计', dataIndex: 'lqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  200. { title: '箭牌雨刮片', dataIndex: 'jpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  201. { title: '箭牌雨燕雨刮片', dataIndex: 'jpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  202. { title: '冠牌雨刮片', dataIndex: 'gpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  203. { title: '雨刮片合计', dataIndex: 'ygpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  204. { title: '箭牌喇叭', dataIndex: 'jpLbAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  205. { title: '箭牌刹车片', dataIndex: 'jpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  206. { title: 'TBU+箭牌感应线', dataIndex: 'jpGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  207. { title: '冠牌刹车片', dataIndex: 'gpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  208. { title: 'TBU刹车片', dataIndex: 'tbuScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  209. { title: 'TBU刹车油', dataIndex: 'tbuScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  210. { title: '刹车片合计', dataIndex: 'scpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  211. { title: 'TBU-P刹车盘', dataIndex: 'tbupAmount', align: 'right', width: 50, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  212. { title: '汇箭蓄电池', dataIndex: 'hjAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  213. { title: '布瑞斯蓄电池', dataIndex: 'brsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  214. { title: '德路斯机油', dataIndex: 'dlsJyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  215. { title: '德路斯变速箱油', dataIndex: 'dlsBsxyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  216. { title: '德路斯刹车油', dataIndex: 'dlsScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  217. // { title: '德路斯汽车养护产品', dataIndex: 'dlsQcyhAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  218. { title: '德路斯合计', dataIndex: 'dlsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  219. { title: '稳升点火线圈', dataIndex: 'wsDhxqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  220. { title: '稳升LED灯', dataIndex: 'wsDpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  221. { title: '稳升合计', dataIndex: 'wsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  222. // { title: 'TBU感应线', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  223. { title: '品牌合计', dataIndex: 'ppAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  224. { title: 'NGK火花塞', dataIndex: 'ngkAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  225. { title: '飞利浦', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  226. { title: '车仆防冻液', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  227. { title: '瓦尔塔', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  228. { title: '雷贝斯托', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  229. { title: '德尔福', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  230. { title: '巴诺德', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  231. { title: '代理品牌合计', dataIndex: 'ppAndNgkAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  232. { title: '开单采退金额合计', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  233. ]
  234. // if (this.activeKey == 0) {
  235. // arr.splice(1, 0, { title: '省份', dataIndex: 'dealerProvinceName', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  236. // }
  237. return arr
  238. }
  239. },
  240. methods: {
  241. callback (key) {
  242. this.activeKey = key
  243. this.resetSearchForm()
  244. // this.queryParam.time = []
  245. // this.$refs.rangeDate.resetDate(this.queryParam.time)
  246. // this.$refs.ruleForm.resetFields()
  247. // this.$refs.table.clearTable()
  248. console.log(key, this.activeKey)
  249. },
  250. // 获取城市列表
  251. getCityList (val) {
  252. this.addrCityList = []
  253. this.addrDistrictList = []
  254. this.queryParam.dealerCitySn = undefined
  255. this.queryParam.dealerCountySn = undefined
  256. if (val) {
  257. this.getArea('city', val)
  258. }
  259. },
  260. // 获取区县列表
  261. getAreaList (val) {
  262. this.addrDistrictList = []
  263. this.queryParam.dealerCountySn = undefined
  264. if (val) {
  265. this.getArea('district', val)
  266. }
  267. },
  268. // 省/市/区
  269. getArea (leve, sn) {
  270. let params
  271. if (leve == 'province') {
  272. params = { type: '2' }
  273. } else {
  274. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  275. }
  276. getArea(params).then(res => {
  277. if (res.status == 200) {
  278. if (leve == 'province') {
  279. this.addrProvinceList = res.data || []
  280. } else if (leve == 'city') {
  281. this.addrCityList = res.data || []
  282. } else if (leve == 'district') {
  283. this.addrDistrictList = res.data || []
  284. }
  285. } else {
  286. if (leve == 'province') {
  287. this.addrProvinceList = []
  288. } else if (leve == 'city') {
  289. this.addrCityList = []
  290. } else if (leve == 'district') {
  291. this.addrDistrictList = []
  292. }
  293. }
  294. })
  295. },
  296. // 创建时间 change
  297. dateChange (date) {
  298. if (date[0] && date[1]) {
  299. this.queryParam.time = date
  300. } else {
  301. this.queryParam.time = []
  302. }
  303. this.queryParam.beginDate = date[0] || ''
  304. this.queryParam.endDate = date[1] || ''
  305. },
  306. // 查询
  307. handleSearch () {
  308. const _this = this
  309. this.$refs.ruleForm.validate(valid => {
  310. if (valid) {
  311. _this.$refs.table.refresh(true)
  312. } else {
  313. return false
  314. }
  315. })
  316. },
  317. // 重置
  318. resetSearchForm () {
  319. this.$refs.ruleForm.resetFields()
  320. this.queryParam.time = []
  321. this.$refs.rangeDate.resetDate(this.queryParam.time)
  322. this.queryParam.beginDate = ''
  323. this.queryParam.endDate = ''
  324. this.queryParam.dealerProvinceSn = undefined
  325. this.queryParam.subareaSn = undefined
  326. this.queryParam.salesStatusType = 'REAL_SALES'
  327. this.$refs.table.clearTable()
  328. },
  329. // 导出
  330. handleExport () {
  331. const _this = this
  332. const jkUrl = _this.activeKey == 0 ? realReportSalesByProvinceExport : realReportSalesBySubAreaExport
  333. const excelTitle = _this.activeKey == 0 ? '各省品类实售明细报表' : '各区品类实售明细报表'
  334. this.$refs.ruleForm.validate(valid => {
  335. if (valid) {
  336. const params = _this.queryParam
  337. _this.showExport = true
  338. _this.exportLoading = true
  339. _this.spinning = true
  340. hdExportExcel(jkUrl, params, excelTitle, function () {
  341. _this.exportLoading = false
  342. _this.spinning = false
  343. })
  344. } else {
  345. return false
  346. }
  347. })
  348. },
  349. pageInit () {
  350. this.activeKey = 0
  351. this.getArea('province')
  352. this.resetSearchForm()
  353. }
  354. },
  355. mounted () {
  356. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  357. this.pageInit()
  358. // this.resetSearchForm()
  359. }
  360. },
  361. activated () {
  362. // 如果是新页签打开,则重置当前页面
  363. if (this.$store.state.app.isNewTab) {
  364. this.pageInit()
  365. // this.resetSearchForm()
  366. }
  367. },
  368. beforeRouteEnter (to, from, next) {
  369. next(vm => {})
  370. }
  371. }
  372. </script>
  373. <style style="less">
  374. .regionTypeSalesReportList-wrap{
  375. }
  376. </style>