detailList.vue 24 KB

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