detailList.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="tireSalesReportList-wrap searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper" ref="tableSearch">
  6. <a-form-model
  7. id="tireSalesReportList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :rules="rules"
  12. :model="queryParam">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-model-item label="日期" prop="time">
  16. <rangeDate
  17. ref="rangeDate"
  18. id="tireSalesReportList-time"
  19. :showTime="false"
  20. :today="false"
  21. :value="queryParam.time"
  22. @change="dateChange" />
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-model-item label="地区">
  27. <AreaList id="tireSalesReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="区域/分区">
  32. <subarea id="tireSalesReportList-subarea" ref="subarea" @change="subareaChange"></subarea>
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="advanced">
  36. <a-col :md="6" :sm="24">
  37. <a-form-model-item label="客户名称">
  38. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="tireSalesReportList-dealerName" @change="custChange" />
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-model-item label="客户级别">
  43. <v-select
  44. v-model="queryParam.dealerLevel"
  45. ref="dealerLevel"
  46. id="tireSalesReportList-dealerLevel"
  47. code="DEALER_LEVEL"
  48. placeholder="请选择客户级别"
  49. allowClear></v-select>
  50. </a-form-model-item>
  51. </a-col>
  52. <a-col :md="6" :sm="24">
  53. <a-form-model-item label="轮胎省仓">
  54. <v-select
  55. v-model="queryParam.provinceFlag"
  56. id="tireSalesDealerList-provinceFlag"
  57. code="Flag"
  58. placeholder="请选择是否是轮胎省仓"
  59. allowClear></v-select>
  60. </a-form-model-item>
  61. </a-col>
  62. <a-col :md="6" :sm="24">
  63. <a-form-model-item label="轮胎省仓名称">
  64. <dealerSubareaScopeList ref="provinceDealerList" placeholder="请输入轮胎省仓名称" id="tireSalesDealerList-custProvinceName" @change="custProvinceChange" />
  65. </a-form-model-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-model-item label="区域负责人">
  69. <BizUser id="tireSalesReportList-bizUserSn" v-model="queryParam.subareaArea.bizUserSn"></BizUser>
  70. </a-form-model-item>
  71. </a-col>
  72. <a-col :md="6" :sm="24">
  73. <a-form-model-item label="产品编码/原厂编码">
  74. <a-input id="tireSalesReportList-productWord" v-model.trim="queryParam.productWord" allowClear placeholder="请输入产品编码/原厂编码"/>
  75. </a-form-model-item>
  76. </a-col>
  77. <a-col :md="6" :sm="24">
  78. <a-form-model-item label="产品名称">
  79. <a-input id="tireSalesReportList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
  80. </a-form-model-item>
  81. </a-col>
  82. </template>
  83. <a-col :md="6" :sm="24">
  84. <a-button
  85. style="margin-left: 5px"
  86. type="primary"
  87. @click="handleSearch"
  88. :disabled="disabled"
  89. id="tireSalesReportList-refresh">查询</a-button>
  90. <a-button
  91. style="margin-left: 8px"
  92. @click="resetSearchForm"
  93. :disabled="disabled"
  94. id="tireSalesReportList-reset">重置</a-button>
  95. <a-button
  96. style="margin-left: 10px"
  97. type="primary"
  98. class="button-warning"
  99. @click="handleExport(0)"
  100. :disabled="disabled"
  101. :loading="exportLoading"
  102. v-if="$hasPermissions('B_tireReportExport')"
  103. id="tireSalesReportList-export">导出</a-button>
  104. <a-button
  105. style="margin-left: 10px"
  106. type="primary"
  107. class="button-warning"
  108. @click="handleExport(1)"
  109. :disabled="disabled"
  110. :loading="exportLoading"
  111. v-if="$hasPermissions('B_tireDetailExport')"
  112. id="tireSalesReportList-exportDetail">导出出库明细</a-button>
  113. <a @click="advanced=!advanced" style="margin-left: 5px">
  114. {{ advanced ? '收起' : '展开' }}
  115. <a-icon :type="advanced ? 'up' : 'down'" />
  116. </a>
  117. </a-col>
  118. </a-row>
  119. </a-form-model>
  120. </div>
  121. </a-card>
  122. <a-card size="small" :bordered="false">
  123. <a-spin :spinning="spinning" tip="Loading...">
  124. <!-- 列表 -->
  125. <s-table
  126. class="sTable fixPagination"
  127. ref="table"
  128. size="small"
  129. :rowKey="(record) => record.no"
  130. rowKeyName="no"
  131. :style="{ height: tableHeight+70+'px' }"
  132. :columns="columns"
  133. :data="loadData"
  134. :scroll="{ x:2500,y: tableHeight-120}"
  135. :defaultLoadData="false"
  136. bordered>
  137. <template slot="addressInfo" slot-scope="text, record">
  138. {{ record.dealerEntity.provinceName }}{{ '/'+record.dealerEntity.cityName }}{{ '/'+record.dealerEntity.districtName }}
  139. </template>
  140. <!-- 操作 -->
  141. <template slot="action" slot-scope="text, record">
  142. <a-button
  143. v-if="$hasPermissions('B_outDetailShow')"
  144. size="small"
  145. type="link"
  146. class="button-warning"
  147. @click="handleOutDetail(record)"
  148. id="tireSalesReportList-outDetail">出库明细</a-button>
  149. <span v-else>--</span>
  150. </template>
  151. <template slot="footer">
  152. <a-row :gutter="15">
  153. <a-col :md="4" :sm="24">总部订货数量:{{ (totalData && (totalData.sysOrderQty || totalData.sysOrderQty==0)) ? totalData.sysOrderQty : '--' }}</a-col>
  154. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">总部订货金额:{{ (totalData && (totalData.sysOrderAmount || totalData.sysOrderAmount==0)) ? toThousands(totalData.sysOrderAmount): '--' }}</a-col>
  155. <a-col :md="4" :sm="24">上级订货数量:{{ (totalData && (totalData.upOrderQty || totalData.upOrderQty==0)) ?totalData.upOrderQty: '--' }}</a-col>
  156. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">上级订货金额:{{ (totalData && (totalData.upOrderAmount || totalData.upOrderAmount==0)) ? toThousands(totalData.upOrderAmount): '--' }}</a-col>
  157. <a-col :md="4" :sm="24">跨地区订货数量:{{ (totalData && (totalData.crossRegionQty || totalData.crossRegionQty==0)) ?totalData.crossRegionQty: '--' }}</a-col>
  158. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">跨地区订货金额:{{ (totalData && (totalData.crossRegionAmount || totalData.crossRegionAmount==0)) ? toThousands(totalData.crossRegionAmount): '--' }}</a-col>
  159. <a-col :md="4" :sm="24">累计入库数量:{{ (totalData && (totalData.putQty || totalData.putQty==0)) ?totalData.putQty: '--' }}</a-col>
  160. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">累计入库金额:{{ (totalData && (totalData.putAmount || totalData.putAmount==0)) ? toThousands(totalData.putAmount): '--' }}</a-col>
  161. <a-col :md="4" :sm="24">退货数量:{{ (totalData && (totalData.returnQty || totalData.returnQty==0)) ?totalData.returnQty: '--' }}</a-col>
  162. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">退货金额:{{ (totalData && (totalData.returnAmount || totalData.returnAmount==0)) ? toThousands(totalData.returnAmount): '--' }}</a-col>
  163. <a-col :md="4" :sm="24">客户现有库存数量:{{ (totalData &&totalData.rptDealerStockVO && (totalData.rptDealerStockVO.totalStockQty || totalData.rptDealerStockVO.totalStockQty==0)) ?totalData.rptDealerStockVO.totalStockQty: '--' }}</a-col>
  164. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">客户现有库存金额:{{ (totalData&&totalData.rptDealerStockVO && (totalData.rptDealerStockVO.totalStockAmount || totalData.rptDealerStockVO.totalStockAmount==0)) ? toThousands(totalData.rptDealerStockVO.totalStockAmount): '--' }}</a-col>
  165. <a-col :md="4" :sm="24">出库加盟商数量:{{ (totalData && (totalData.outQtyDealer || totalData.outQtyDealer==0)) ?totalData.outQtyDealer: '--' }}</a-col>
  166. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">出库加盟商金额:{{ (totalData && (totalData.outAmountDealer || totalData.outAmountDealer==0)) ? toThousands(totalData.outAmountDealer): '--' }}</a-col>
  167. <a-col :md="4" :sm="24">出库终端数量:{{ (totalData && (totalData.outQtyTerminal || totalData.outQtyTerminal==0)) ?totalData.outQtyTerminal: '--' }}</a-col>
  168. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">出库终端金额:{{ (totalData && (totalData.outAmountTerminal || totalData.outAmountTerminal==0)) ? toThousands(totalData.outAmountTerminal): '--' }}</a-col>
  169. <a-col :md="4" :sm="24">累计出库数量:{{ (totalData && (totalData.outQty || totalData.outQty==0)) ?totalData.outQty: '--' }}</a-col>
  170. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">累计出库金额:{{ (totalData && (totalData.outAmount || totalData.outAmount==0)) ? toThousands(totalData.outAmount): '--' }}</a-col>
  171. <a-col :md="4" :sm="24">已绑质保单数量:{{ (totalData&&totalData.rptDealerStockVO && (totalData.rptDealerStockVO.totalWarrantyQty || totalData.rptDealerStockVO.totalWarrantyQty==0)) ?totalData.rptDealerStockVO.totalWarrantyQty: '--' }}</a-col>
  172. </a-row>
  173. </template>
  174. </s-table>
  175. </a-spin>
  176. </a-card>
  177. <!-- 导出提示框 -->
  178. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  179. <!-- 出库明细弹窗 -->
  180. <outDetailModal ref="outDetail" :openModal="showOutDetail" @close="showOutDetail=false"></outDetailModal>
  181. </div>
  182. </template>
  183. <script>
  184. import { commonMixin } from '@/utils/mixin'
  185. import { hdExportExcel } from '@/libs/exportExcel'
  186. // 组件
  187. import { STable, VSelect } from '@/components'
  188. import rangeDate from '@/views/common/rangeDate.vue'
  189. import subarea from '@/views/common/subarea.js'
  190. import AreaList from '@/views/common/areaList.js'
  191. import BizUser from '@/views/common/bizUser.js'
  192. import reportModal from '@/views/common/reportModal.vue'
  193. import outDetailModal from './outDetailModal'
  194. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  195. // 接口
  196. import { queryTireDetailCount, tireListExport, tireReportDetailList, tireOutDetailListExport } from '@/api/reportData'
  197. export default {
  198. name: 'TireSalesReportList',
  199. mixins: [commonMixin],
  200. components: { STable, VSelect, outDetailModal, rangeDate, subarea, AreaList, BizUser, dealerSubareaScopeList, reportModal },
  201. data () {
  202. return {
  203. spinning: false,
  204. disabled: false, // 查询、重置按钮是否可操作
  205. advanced: true, // 高级搜索 展开/关闭
  206. tableHeight: 0, // 表格高度
  207. exportLoading: false, // 导出按钮加载状态
  208. showExport: false, // 导出弹窗
  209. // 查询条件
  210. queryParam: {
  211. time: [], // 日期
  212. bizBeginDate: '', // 开始时间
  213. bizEndDate: '', // 结束时间
  214. provinceSn: undefined, // 省
  215. citySn: undefined, // 市
  216. districtSn: undefined, // 区
  217. dealerLevel: undefined, // 客户等级
  218. dealerName: undefined, // 客户名称
  219. dealerSn: undefined, // 客户sn
  220. subareaArea: {
  221. subareaSn: undefined, // 区域
  222. subareaAreaSn: undefined, // 分区
  223. bizUserSn: undefined // 区域负责人
  224. },
  225. productWord: '', // 产品编码/原厂编码
  226. productName: '', // 产品名称
  227. parentDealerSn: undefined, // 轮胎省仓sn
  228. parentDealerEntity: {
  229. dealerName: undefined // 轮胎省仓名称
  230. },
  231. provinceFlag: undefined// 是否是轮胎省仓 1是 0否
  232. },
  233. totalData: null, // 合计
  234. showOutDetail: false, // 出库明细弹窗
  235. rules: {
  236. 'time': [{ required: true, message: '请选择日期', trigger: 'change' }]
  237. },
  238. // 加载数据方法 必须为 Promise 对象
  239. loadData: parameter => {
  240. this.disabled = true
  241. this.spinning = true
  242. const oldParams = Object.assign(parameter, this.queryParam)
  243. const params = JSON.parse(JSON.stringify(oldParams))
  244. delete params.time
  245. // 获取列表数据 有分页
  246. return tireReportDetailList(params).then(res => {
  247. let data
  248. if (res.status == 200) {
  249. data = res.data
  250. // 计算表格序号
  251. const no = (data.pageNo - 1) * data.pageSize
  252. for (var i = 0; i < data.list.length; i++) {
  253. data.list[i].no = no + i + 1
  254. }
  255. this.disabled = false
  256. // 获取统计数据
  257. this.getCount(params)
  258. }
  259. this.spinning = false
  260. return data
  261. })
  262. }
  263. }
  264. },
  265. watch: {
  266. advanced (newValue, oldValue) {
  267. const _this = this
  268. this.$nextTick(() => { // 页面渲染完成后的回调
  269. _this.setTableH()
  270. })
  271. },
  272. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  273. this.setTableH()
  274. }
  275. },
  276. computed: {
  277. columns () {
  278. const _this = this
  279. const arr = [
  280. { title: '序号', dataIndex: 'no', width: '60px', align: 'center' },
  281. { title: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '80px', align: 'center' },
  282. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
  283. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
  284. { title: '区域负责人', dataIndex: 'bizUserName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
  285. { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '150px', align: 'center', customRender: function (text) { return text || '--' } },
  286. { title: '客户级别', dataIndex: 'dealerEntity.dealerLevelDictValue', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
  287. { title: '轮胎省仓', dataIndex: 'provinceFlag', width: '80px', align: 'center', customRender: function (text) { return text == '1' ? '是' : '否' } },
  288. { title: '轮胎省仓名称', dataIndex: 'parentDealerEntity.dealerName', width: '150px', align: 'center', customRender: function (text) { return text || '--' } },
  289. { title: '产品编码', dataIndex: 'productEntity.code', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  290. { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  291. { title: '产品尺寸', dataIndex: 'productEntity.size', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
  292. { title: '产品名称', dataIndex: 'productEntity.name', width: '200px', align: 'center', customRender: function (text) { return text || '--' } },
  293. { title: <div>总部订货<div>数量</div></div>, dataIndex: 'sysOrderQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  294. { title: <div>上级订货<div>数量</div></div>, dataIndex: 'upOrderQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  295. { title: <div>跨地区订货<div>数量</div></div>, dataIndex: 'crossRegionQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  296. { title: <div>累计入库<div>数量</div></div>, dataIndex: 'putQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  297. { title: '退货数量', dataIndex: 'returnQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  298. { title: <div>客户现有<div>库存数量</div></div>, dataIndex: 'rptDealerStockVO.totalStockQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  299. { title: <div>出库加盟商<div>数量</div></div>, dataIndex: 'outQtyDealer', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  300. { title: <div>出库终端<div>数量</div></div>, dataIndex: 'outQtyTerminal', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  301. { title: <div>累计出库<div>数量</div></div>, dataIndex: 'outQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  302. { title: <div>已绑质保单<div>数量</div></div>, dataIndex: 'rptDealerStockVO.totalWarrantyQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  303. { title: '操作', scopedSlots: { customRender: 'action' }, width: '80px', align: 'center', fixed: 'right' }
  304. ]
  305. if (this.$hasPermissions('M_tireSalesReportList_salesPrice')) {
  306. arr.splice(12, 0, { title: '总部订货金额', dataIndex: 'sysOrderAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  307. arr.splice(14, 0, { title: '上级订货金额', dataIndex: 'upOrderAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  308. arr.splice(16, 0, { title: '跨地区订货金额', dataIndex: 'crossRegionAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  309. arr.splice(18, 0, { title: '累计入库金额', dataIndex: 'putAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  310. arr.splice(20, 0, { title: '退货金额', dataIndex: 'returnAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  311. arr.splice(22, 0, { title: '客户现有库存金额', dataIndex: 'rptDealerStockVO.totalStockAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  312. arr.splice(24, 0, { title: '出库加盟商金额', dataIndex: 'outAmountDealer', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  313. arr.splice(26, 0, { title: '出库终端金额', dataIndex: 'outAmountTerminal', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  314. arr.splice(28, 0, { title: '累计出库金额', dataIndex: 'outAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  315. }
  316. return arr
  317. }
  318. },
  319. methods: {
  320. // 查询
  321. handleSearch () {
  322. const _this = this
  323. this.$refs.ruleForm.validate(valid => {
  324. if (valid) {
  325. _this.$refs.table.refresh(true)
  326. } else {
  327. _this.$message.error('请选择日期')
  328. return false
  329. }
  330. })
  331. },
  332. // 客户名称 change
  333. custChange (val) {
  334. this.queryParam.dealerName = val.name
  335. this.queryParam.dealerSn = val.key
  336. },
  337. // 轮胎省仓客户名称 change
  338. custProvinceChange (val) {
  339. this.queryParam.parentDealerEntity.dealerName = val.name
  340. this.queryParam.parentDealerSn = val.key
  341. },
  342. // 统计
  343. getCount (params) {
  344. queryTireDetailCount(params).then(res => {
  345. if (res.status == 200 && res.data) {
  346. this.totalData = res.data
  347. } else {
  348. this.totalData = null
  349. }
  350. })
  351. },
  352. // 出库明细
  353. handleOutDetail (row) {
  354. const params = {
  355. bizBeginDate: this.queryParam.bizBeginDate,
  356. bizEndDate: this.queryParam.bizEndDate,
  357. dealerSn: row.dealerSn,
  358. productSn: row.productSn
  359. }
  360. this.showOutDetail = true
  361. const titObj = {
  362. tit: row.dealerEntity.dealerName,
  363. code: row.productEntity.code
  364. }
  365. this.$nextTick(() => {
  366. this.$refs.outDetail.getAjaxData(params, titObj)
  367. })
  368. },
  369. // 地区
  370. areaChange (val) {
  371. this.queryParam.provinceSn = val[0] ? val[0] : undefined
  372. this.queryParam.citySn = val[1] ? val[1] : undefined
  373. this.queryParam.districtSn = val[2] ? val[2] : undefined
  374. },
  375. // 日期选择 change
  376. dateChange (date) {
  377. if (date[0] && date[1]) {
  378. this.queryParam.time = date
  379. } else {
  380. this.queryParam.time = []
  381. }
  382. this.queryParam.bizBeginDate = date[0] ? date[0].replace(/-/g, '') : ''
  383. this.queryParam.bizEndDate = date[1] ? date[1].replace(/-/g, '') : ''
  384. },
  385. // 区域分区 change
  386. subareaChange (val) {
  387. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  388. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  389. },
  390. // 重置
  391. resetSearchForm () {
  392. this.queryParam.time = []
  393. this.$refs.rangeDate.resetDate()
  394. this.queryParam.bizBeginDate = ''
  395. this.queryParam.bizEndDate = ''
  396. this.queryParam.provinceSn = undefined
  397. this.queryParam.citySn = undefined
  398. this.queryParam.districtSn = undefined
  399. this.queryParam.dealerName = undefined
  400. this.queryParam.dealerSn = undefined
  401. this.queryParam.subareaArea.subareaSn = undefined
  402. this.queryParam.subareaArea.subareaAreaSn = undefined
  403. this.queryParam.dealerLevel = undefined
  404. this.queryParam.subareaArea.bizUserSn = undefined
  405. this.queryParam.productWord = undefined
  406. this.queryParam.productName = undefined
  407. this.queryParam.parentDealerSn = undefined
  408. this.queryParam.parentDealerEntity.dealerName = undefined
  409. this.queryParam.provinceFlag = undefined
  410. this.$refs.subarea.clearData()
  411. if (this.advanced) {
  412. this.$refs.dealerSubareaScopeList.resetForm()
  413. this.$refs.provinceDealerList.resetForm()
  414. }
  415. this.totalData = null
  416. this.$refs.areaList.clearData()
  417. this.$refs.table.clearTable()
  418. this.$refs.ruleForm.resetFields()
  419. },
  420. // 导出 必填判断
  421. handleExport (pos) {
  422. const _this = this
  423. this.$refs.ruleForm.validate(valid => {
  424. if (valid) {
  425. if (pos == 0) {
  426. _this.exportList()
  427. } else {
  428. _this.exportOutDetailList()
  429. }
  430. } else {
  431. _this.$message.error('请选择日期')
  432. return false
  433. }
  434. })
  435. },
  436. // 轮胎明细报表导出
  437. exportList () {
  438. const _this = this
  439. const params = JSON.parse(JSON.stringify(_this.queryParam))
  440. _this.exportLoading = true
  441. _this.spinning = true
  442. _this.showExport = true
  443. _this.$store.state.app.curActionPermission = 'B_tireReportExport'
  444. params.exportFlag = 1
  445. delete params.time
  446. hdExportExcel(tireListExport, params, '轮胎明细报表', function () {
  447. _this.exportLoading = false
  448. _this.spinning = false
  449. _this.$store.state.app.curActionPermission = ''
  450. })
  451. },
  452. // 轮胎出库明细报表 导出
  453. exportOutDetailList () {
  454. const _this = this
  455. const params = JSON.parse(JSON.stringify(_this.queryParam))
  456. _this.exportLoading = true
  457. _this.spinning = true
  458. _this.showExport = true
  459. _this.$store.state.app.curActionPermission = 'B_tireDetailExport'
  460. delete params.time
  461. hdExportExcel(tireOutDetailListExport, params, '轮胎出库明细报表', function () {
  462. _this.exportLoading = false
  463. _this.spinning = false
  464. _this.$store.state.app.curActionPermission = ''
  465. })
  466. },
  467. // 初始化
  468. pageInit () {
  469. this.$nextTick(() => { // 页面渲染完成后的回调
  470. this.setTableH()
  471. })
  472. },
  473. // 计算表格高度
  474. setTableH () {
  475. const tableSearchH = this.$refs.tableSearch.offsetHeight
  476. this.tableHeight = window.innerHeight - tableSearchH - 280
  477. }
  478. },
  479. mounted () {
  480. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  481. this.pageInit()
  482. }
  483. },
  484. activated () {
  485. // 如果是新页签打开,则重置当前页面
  486. if (this.$store.state.app.isNewTab) {
  487. this.pageInit()
  488. }
  489. },
  490. beforeRouteEnter (to, from, next) {
  491. next(vm => {})
  492. }
  493. }
  494. </script>