detailList.vue 27 KB

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