list.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="allocationDetailsList-wrap searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper" ref="tableSearch">
  6. <a-form-model
  7. id="allocationDetailsList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :model="queryParam"
  12. :rules="rules"
  13. :labelCol="labelCol"
  14. :wrapperCol="wrapperCol"
  15. @keyup.enter.native="handleSearch" >
  16. <a-row :gutter="15">
  17. <a-col :md="6" :sm="24">
  18. <a-form-model-item label="调拨开单日期" prop="time">
  19. <rangeDate ref="rangeDate" id="allocationDetailsList-time" :value="queryParam.time" @change="dateChange" />
  20. </a-form-model-item>
  21. </a-col>
  22. <a-col :md="6" :sm="24">
  23. <a-form-model-item label="产品名称">
  24. <a-input id="allocationDetailsList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :md="6" :sm="24">
  28. <a-form-model-item label="调拨单号">
  29. <a-input id="allocationDetailsList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
  30. </a-form-model-item>
  31. </a-col>
  32. <a-col :md="6" :sm="24">
  33. <a-form-model-item label="所在区域">
  34. <subarea id="allocationDetailsList-subarea" ref="subarea" @change="subareaChange"></subarea>
  35. </a-form-model-item>
  36. </a-col>
  37. <a-col :md="6" :sm="24">
  38. <a-form-model-item label="地区">
  39. <Area id="allocationDetailsList-dealerProvinceSn" v-model="queryParam.dealerProvinceSn" placeholder="请选择省"></Area>
  40. </a-form-model-item>
  41. </a-col>
  42. <a-col :md="6" :sm="24">
  43. <a-form-model-item label="客户名称">
  44. <a-input id="allocationDetailsList-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客户名称"/>
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :md="6" :sm="24">
  48. <a-form-model-item label="客户级别">
  49. <v-select code="DEALER_LEVEL" id="allocationDetailsList-dealerLevel" v-model="queryParam.dealerLevel" allowClear placeholder="请选择客户级别"></v-select>
  50. </a-form-model-item>
  51. </a-col>
  52. <template v-if="advanced">
  53. <a-col :md="6" :sm="24">
  54. <a-form-model-item label="品牌分类">
  55. <v-select code="BRAND_TYPE" id="allocationDetailsList-productBrandTypeSn" v-model="queryParam.productBrandTypeSn" allowClear placeholder="请选择品牌分类"></v-select>
  56. </a-form-model-item>
  57. </a-col>
  58. <a-col :md="6" :sm="24">
  59. <a-form-model-item label="产品品牌">
  60. <ProductBrand id="allocationDetailsList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
  61. </a-form-model-item>
  62. </a-col>
  63. <a-col :md="6" :sm="24">
  64. <a-form-model-item label="产品编码">
  65. <a-input id="allocationDetailsList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
  66. </a-form-model-item>
  67. </a-col>
  68. <a-col :md="6" :sm="24">
  69. <a-form-model-item label="产品分类">
  70. <ProductType id="allocationDetailsList-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col :md="6" :sm="24">
  74. <a-form-model-item label="费用/调拨类型">
  75. <AllocateType id="allocationDetailsList-allocateTypeSn" v-model="allocateTypeVal" :changeOnSelect="true" placeholder="请选择费用/调拨类型" @change="changeAllocatype"></AllocateType>
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-model-item label="操作员">
  80. <a-select id="allocationDetailsList-creatorId" v-model="queryParam.creatorId" placeholder="请选择操作员" allowClear >
  81. <a-select-option v-for="item in operatorList" :key="item.sn" :value="item.sn">{{ item.name }}</a-select-option>
  82. </a-select>
  83. </a-form-model-item>
  84. </a-col>
  85. <a-col :md="6" :sm="24">
  86. <a-form-model-item label="出库仓库">
  87. <chooseWarehouse ref="warehouse" id="allocationDetailsList-warehouse" isPermission v-model="queryParam.warehouseSn"></chooseWarehouse>
  88. </a-form-model-item>
  89. </a-col>
  90. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  91. <a-form-model-item label="客服">
  92. <customerService ref="customerName" id="allocationDetailsList-customerName" v-model="queryParam.bizUserSn"></customerService>
  93. </a-form-model-item>
  94. </a-col>
  95. </template>
  96. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  97. <!-- <a-button
  98. style="margin-left: 0px"
  99. type="primary"
  100. class="button-info"
  101. size="small"
  102. @click="handleStock"
  103. id="allocationDetailsList-stockDate">盘点区间日期</a-button> -->
  104. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="allocationDetailsList-refresh">查询</a-button>
  105. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocationDetailsList-reset">重置</a-button>
  106. <a-button
  107. style="margin-left: 5px"
  108. type="primary"
  109. class="button-warning"
  110. @click="handleExport"
  111. :disabled="disabled"
  112. :loading="exportLoading"
  113. v-if="$hasPermissions('B_allocationDetails_Export')"
  114. id="allocationDetailsList-export">导出</a-button>
  115. <a @click="advanced=!advanced">
  116. {{ advanced ? '收起' : '展开' }}
  117. <a-icon :type="advanced ? 'up' : 'down'"/>
  118. </a>
  119. </a-col>
  120. </a-row>
  121. </a-form-model>
  122. </div>
  123. </a-card>
  124. <!-- 列表 -->
  125. <a-card size="small" :bordered="false" class="allocationDetailsList-wrap">
  126. <a-spin :spinning="spinning" tip="Loading...">
  127. <s-table
  128. class="sTable fixPagination"
  129. ref="table"
  130. size="small"
  131. :rowKey="(record) => record.id"
  132. :columns="columns"
  133. :data="loadData"
  134. :defaultLoadData="false"
  135. :pageSize="30"
  136. :style="{ height: tableHeight+70+'px' }"
  137. :scroll="{ x: 2610 ,y: tableHeight-45 }"
  138. bordered>
  139. <template slot="footer">
  140. <a-row :gutter="15">
  141. <a-col :md="4" :sm="24">总数量:{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}</a-col>
  142. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_allocationDetailsList_costPrice')">总成本价:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? toThousands(totalData.totalCost) : '--' }}</a-col>
  143. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_allocationDetailsList_salesPrice')&&$hasPermissions('M_allocationDetailsList_costPrice')">总毛利:{{ (totalData && (totalData.totalGrossProfit || totalData.totalGrossProfit==0)) ? toThousands(totalData.totalGrossProfit) : '--' }}</a-col>
  144. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_allocationDetailsList_salesPrice')">总售价:{{ (totalData && (totalData.totalPrice || totalData.totalPrice==0)) ? toThousands(totalData.totalPrice) : '--' }}</a-col>
  145. </a-row>
  146. </template>
  147. </s-table>
  148. </a-spin>
  149. <!-- 导出提示框 -->
  150. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  151. </a-card>
  152. </div>
  153. </template>
  154. <script>
  155. import { commonMixin } from '@/utils/mixin'
  156. import getDate from '@/libs/getDate.js'
  157. import { hdExportExcel } from '@/libs/exportExcel'
  158. // 组件
  159. import { STable, VSelect } from '@/components'
  160. import rangeDate from '@/views/common/rangeDate.vue'
  161. import reportModal from '@/views/common/reportModal.vue'
  162. import subarea from '@/views/common/subarea.js'
  163. import Area from '@/views/common/area.js'
  164. import ProductBrand from '@/views/common/productBrand.js'
  165. import ProductType from '@/views/common/productType.js'
  166. import chooseWarehouse from '@/views/common/chooseWarehouse'
  167. import customerService from '@/views/common/customerService'
  168. import AllocateType from '@/views/common/allocateType.js'
  169. // 接口
  170. import { userQueryList } from '@/api/power-user'
  171. import { allocateTypeAllList } from '@/api/allocateType'
  172. import { allocateReportDetailList, allocateReportDetailCount, allocateReportDetailExport } from '@/api/allocateReport'
  173. export default {
  174. name: 'AllocationDetailsList',
  175. mixins: [commonMixin],
  176. components: { STable, VSelect, rangeDate, subarea, Area, ProductBrand, reportModal, AllocateType, ProductType, chooseWarehouse, customerService },
  177. data () {
  178. return {
  179. spinning: false,
  180. labelCol: { span: 8 },
  181. wrapperCol: { span: 16 },
  182. advanced: false, // 高级搜索 展开/关闭
  183. disabled: false, // 查询、重置按钮是否可操作
  184. exportLoading: false, // 导出按钮加载状态
  185. tableHeight: 0, // 表格高度
  186. showExport: false, // 导出弹窗
  187. // 查询条件
  188. queryParam: {
  189. // 调拨开单日期 默认时间
  190. time: [
  191. getDate.getCurrMonthDays().starttime,
  192. getDate.getCurrMonthDays().endtime
  193. ],
  194. beginDate: getDate.getCurrMonthDays().starttime, // 开始日期
  195. endDate: getDate.getCurrMonthDays().endtime, // 结束日期
  196. productName: '', // 产品名称
  197. productBrandTypeSn: undefined, // 产品分类sn
  198. productBrandSn: undefined, // 产品品牌sn
  199. productCode: '', // 产品编码
  200. costTypeSn: undefined, // 费用类型
  201. allocateSortSn: undefined, // 调拨类型1
  202. allocateTypeSn: undefined, // 调拨类型2
  203. creatorId: undefined, // 操作员 id
  204. allocateNo: '', // 调拨单号
  205. productTypeSn1: '', // 产品一级分类
  206. productTypeSn2: '', // 产品二级分类
  207. productTypeSn3: '', // 产品三级分类
  208. dealerName: '', // 客户名称
  209. dealerLevel: undefined, // 客户等级
  210. subareaArea: {
  211. subareaSn: undefined, // 区域
  212. subareaAreaSn: undefined// 分区
  213. },
  214. dealerProvinceSn: undefined, // 地区 省份
  215. warehouseSn: undefined, // 出库仓库
  216. bizUserSn: undefined// 客服
  217. },
  218. productType: [], // 产品分类
  219. allocateTypeVal: [], // 已选费用/调拨类型 值
  220. rules: {
  221. 'time': [{ required: true, message: '请选择调拨开单日期', trigger: 'change' }]
  222. },
  223. // 加载数据方法 必须为 Promise 对象
  224. loadData: parameter => {
  225. this.disabled = true
  226. const params = Object.assign(parameter, this.queryParam)
  227. delete params.time
  228. this.spinning = true
  229. if (params.beginDate) {
  230. // 获取列表数据 有分页
  231. return allocateReportDetailList(params).then(res => {
  232. let data
  233. if (res.status == 200) {
  234. data = res.data
  235. // 总计
  236. this.getCount(params)
  237. // 计算列表序号
  238. const no = (data.pageNo - 1) * data.pageSize
  239. for (var i = 0; i < data.list.length; i++) {
  240. data.list[i].no = no + i + 1
  241. }
  242. this.disabled = false
  243. }
  244. this.spinning = false
  245. return data
  246. })
  247. } else {
  248. const _this = this
  249. return new Promise(function (resolve, reject) {
  250. const data = {
  251. pageNo: 1,
  252. pageSize: 10,
  253. list: [],
  254. count: 0
  255. }
  256. _this.disabled = false
  257. _this.spinning = false
  258. _this.$message.info('请选择调拨开单日期')
  259. resolve(data)
  260. })
  261. }
  262. },
  263. allocateTypeList: [], // 调拨类型
  264. operatorList: [], // 操作员下拉数据
  265. totalData: null // 合计
  266. }
  267. },
  268. computed: {
  269. columns () {
  270. const _this = this
  271. let arr = [
  272. { title: '区域', dataIndex: 'subareaArea.subareaName', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
  273. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
  274. { title: '调拨单号', dataIndex: 'allocateNo', width: 160, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
  275. { title: '出库仓库', dataIndex: 'warehouseName', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  276. { title: '调拨开单日期', dataIndex: 'allocateDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  277. { title: '省份', dataIndex: 'dealerProvinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  278. { title: '客户名称', dataIndex: 'targetName', width: 120, align: 'center', sorter: true, customRender: function (text) { return text || '--' }, ellipsis: true },
  279. { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  280. { title: '品牌', dataIndex: 'productBrandName', width: 130, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  281. { title: '二级分类', dataIndex: 'productTypeName2', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  282. { title: '产品名称', dataIndex: 'productName', width: 260, align: 'left', sorter: true, customRender: function (text) { return text || '--' }, ellipsis: true },
  283. { title: '产品编码', dataIndex: 'productCode', width: 150, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
  284. { title: '调拨数量', dataIndex: 'qty', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  285. { title: '单位', dataIndex: 'productUnit', width: 50, align: 'center', customRender: function (text) { return text || '--' } }
  286. // { title: '成本价', dataIndex: 'cost', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  287. // { title: '售价', dataIndex: 'price', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  288. // { title: '总成本价', dataIndex: 'totalCost', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  289. // { title: '毛利', dataIndex: 'grossProfit', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  290. ]
  291. if (this.$hasPermissions('M_allocationDetailsList_costPrice')) { // 成本价权限
  292. arr.push({ title: '成本价', dataIndex: 'cost', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  293. }
  294. if (this.$hasPermissions('M_allocationDetailsList_salesPrice')) { // 售价权限
  295. arr.push({ title: '售价', dataIndex: 'price', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  296. }
  297. if (this.$hasPermissions('M_allocationDetailsList_costPrice')) { // 成本价权限
  298. arr.push({ title: '总成本价', dataIndex: 'totalCost', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  299. if (this.$hasPermissions('M_allocationDetailsList_salesPrice')) {
  300. arr.push({ title: '毛利', dataIndex: 'grossProfit', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  301. }
  302. }
  303. arr = arr.concat([
  304. { title: '操作员', dataIndex: 'creatorName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  305. { title: '费用类型', dataIndex: 'costTypeName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  306. { title: '调拨类型(一级)', dataIndex: 'allocateSortName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  307. { title: '调拨类型(二级)', dataIndex: 'allocateTypeName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  308. { title: '费用归属品牌', dataIndex: 'costProductBrandName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  309. { title: '费用归属品类(二级)', dataIndex: 'costProductTypeName2', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  310. { title: '费用归属品类(三级)', dataIndex: 'costProductTypeName3', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  311. { title: '费用归属部门', dataIndex: 'departmentName', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
  312. ])
  313. return arr
  314. }
  315. },
  316. watch: {
  317. // 展开关闭
  318. advanced (newValue, oldValue) {
  319. const _this = this
  320. this.$nextTick(() => { // 页面渲染完成后的回调
  321. _this.setTableH()
  322. })
  323. },
  324. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  325. this.setTableH()
  326. }
  327. },
  328. methods: {
  329. // 盘点库存日期
  330. handleStock () {
  331. this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
  332. },
  333. // 调拨开单日期 change
  334. dateChange (date) {
  335. if (date[0] && date[1]) {
  336. this.queryParam.time = date
  337. } else {
  338. this.queryParam.time = []
  339. }
  340. this.queryParam.beginDate = date[0] || ''
  341. this.queryParam.endDate = date[1] || ''
  342. },
  343. // 费用/调拨类型 change
  344. changeAllocatype (val, opts) {
  345. this.allocateTypeVal = val || []
  346. this.queryParam.costTypeSn = val && val[0] ? val[0] : ''
  347. this.queryParam.allocateSortSn = val && val[1] ? val[1] : ''
  348. this.queryParam.allocateTypeSn = val && val[2] ? val[2] : ''
  349. },
  350. // 合计
  351. getCount (params) {
  352. allocateReportDetailCount(params).then(res => {
  353. if (res.status == 200) {
  354. this.totalData = res.data
  355. } else {
  356. this.totalData = null
  357. }
  358. })
  359. },
  360. // 查询
  361. handleSearch () {
  362. const _this = this
  363. this.$refs.ruleForm.validate(valid => {
  364. if (valid) {
  365. _this.$refs.table.refresh(true)
  366. } else {
  367. _this.$message.error('请选择调拨开单日期')
  368. return false
  369. }
  370. })
  371. },
  372. // 区域分区 change
  373. subareaChange (val) {
  374. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  375. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  376. },
  377. // 重置
  378. resetSearchForm () {
  379. this.queryParam.time = [
  380. getDate.getCurrMonthDays().starttime,
  381. getDate.getCurrMonthDays().endtime
  382. ]
  383. this.$refs.rangeDate.resetDate(this.queryParam.time)
  384. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  385. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  386. this.queryParam.productName = ''
  387. this.queryParam.productBrandTypeSn = undefined
  388. this.queryParam.productBrandSn = undefined
  389. this.queryParam.productCode = ''
  390. this.queryParam.costTypeSn = undefined
  391. this.queryParam.allocateSortSn = undefined
  392. this.queryParam.allocateTypeSn = undefined
  393. this.queryParam.creatorId = undefined
  394. this.queryParam.allocateNo = ''
  395. this.queryParam.productTypeSn1 = ''
  396. this.queryParam.productTypeSn2 = ''
  397. this.queryParam.productTypeSn3 = ''
  398. this.queryParam.dealerName = ''
  399. this.queryParam.dealerLevel = undefined
  400. this.queryParam.subareaArea.subareaSn = undefined
  401. this.queryParam.subareaArea.subareaAreaSn = undefined
  402. this.queryParam.dealerProvinceSn = undefined
  403. this.queryParam.warehouseSn = undefined
  404. this.queryParam.bizUserSn = undefined
  405. this.productType = []
  406. this.allocateTypeVal = []
  407. if (this.advanced) {
  408. this.$refs.subarea.clearData()
  409. }
  410. this.$refs.ruleForm.resetFields()
  411. this.totalData = null
  412. this.$refs.table.clearTable()
  413. },
  414. // 导出
  415. handleExport () {
  416. const _this = this
  417. this.$refs.ruleForm.validate(valid => {
  418. if (valid) {
  419. const params = _this.queryParam
  420. _this.$store.state.app.curActionPermission = 'B_allocationDetails_Export'
  421. _this.showExport = true
  422. _this.exportLoading = true
  423. _this.spinning = true
  424. hdExportExcel(allocateReportDetailExport, params, '调拨明细报表', function () {
  425. _this.exportLoading = false
  426. _this.spinning = false
  427. _this.$store.state.app.curActionPermission = ''
  428. })
  429. } else {
  430. console.log('error submit!!')
  431. return false
  432. }
  433. })
  434. },
  435. // 产品分类 change
  436. changeProductType (val, opt) {
  437. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  438. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  439. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  440. },
  441. // 调拨类型
  442. getAllocateTypeAllList () {
  443. allocateTypeAllList().then(res => {
  444. if (res.status == 200) {
  445. this.allocateTypeList = res.data
  446. } else {
  447. this.allocateTypeList = []
  448. }
  449. })
  450. },
  451. // 操作员
  452. getUserList () {
  453. userQueryList({}).then(res => {
  454. if (res.status == 200) {
  455. this.operatorList = res.data
  456. } else {
  457. this.operatorList = []
  458. }
  459. })
  460. },
  461. // 初始化
  462. pageInit () {
  463. this.getAllocateTypeAllList()
  464. this.getUserList()
  465. this.resetSearchForm()
  466. this.setTableH()
  467. },
  468. // 计算表格高度
  469. setTableH () {
  470. const tableSearchH = this.$refs.tableSearch.offsetHeight
  471. this.tableHeight = window.innerHeight - tableSearchH - 200
  472. }
  473. },
  474. mounted () {
  475. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  476. this.pageInit()
  477. }
  478. },
  479. activated () {
  480. // 如果是新页签打开,则重置当前页面
  481. if (this.$store.state.app.isNewTab) {
  482. this.pageInit()
  483. }
  484. },
  485. beforeRouteEnter (to, from, next) {
  486. next(vm => {})
  487. }
  488. }
  489. </script>