list.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <template>
  2. <a-card size="small" :bordered="false" class="inventoryQueryList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="产品编码">
  10. <a-input id="inventoryQueryList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="原厂编码">
  15. <a-input id="inventoryQueryList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="产品名称">
  20. <a-input id="inventoryQueryList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-model-item label="产品品牌">
  25. <ProductBrand id="inventoryQueryList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productBrandSn"></ProductBrand>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-model-item label="产品分类">
  30. <ProductType id="inventoryQueryList-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeType" v-model="productTypeSn"></ProductType>
  31. </a-form-model-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-model-item label="仓库仓位">
  35. <Warehouse id="inventoryQueryList-warehouse" :showDefault="false" :changeOnSelect="true" ref="warehouse" v-model="queryParam.warehouse"></Warehouse>
  36. </a-form-model-item>
  37. </a-col>
  38. <template v-if="advanced">
  39. <a-col :md="6" :sm="24">
  40. <a-form-model-item label="滞销天数">
  41. <a-input-group>
  42. <a-row>
  43. <a-col :span="11">
  44. <a-input-number
  45. id="shelfMonitoringList-minUnsalableDays"
  46. v-model="queryParam.minUnsalableDays"
  47. :precision="0"
  48. :min="0"
  49. :max="999999"
  50. placeholder="起始天数"
  51. style="width: 100%;display: inline-block;" />
  52. </a-col>
  53. <a-col :span="2"><span style="display: block;text-align: center;line-height: 32px;">至</span></a-col>
  54. <a-col :span="11">
  55. <a-input-number
  56. id="shelfMonitoringList-maxUnsalableDays"
  57. v-model="queryParam.maxUnsalableDays"
  58. :precision="0"
  59. :min="0"
  60. :max="999999"
  61. placeholder="截止天数"
  62. style="width: 100%;display: inline-block;" />
  63. </a-col>
  64. </a-row>
  65. </a-input-group>
  66. </a-form-model-item>
  67. </a-col>
  68. <a-col :md="6" :sm="24">
  69. <a-form-item label="产品来源">
  70. <a-select
  71. allowClear
  72. placeholder="请选择产品来源"
  73. v-model="queryParam.productSysFlag"
  74. id="shelfMonitoringList-productSysFlag"
  75. >
  76. <a-select-option value="1" id="shelfMonitoringList-productSysFlag-1">
  77. 箭冠
  78. </a-select-option>
  79. <a-select-option value="0" id="shelfMonitoringList-productSysFlag-0">
  80. 自建
  81. </a-select-option>
  82. </a-select>
  83. </a-form-item>
  84. </a-col>
  85. </template>
  86. <a-col :md="6" :sm="24">
  87. <div style="margin-top: 6px;">
  88. <a-checkbox v-model="queryParam.zeroQtyFlag" id="inventoryQueryList-zeroQtyFlag">只查看有库存</a-checkbox>
  89. <a-checkbox v-model="queryParam.enableFlag" :checked="queryParam.enableFlag" id="inventoryQueryList-enableFlag">包括禁用产品</a-checkbox>
  90. <a-checkbox v-model="queryParam.freezeQtyFlag" :checked="queryParam.freezeQtyFlag" id="inventoryQueryList-freezeQtyFlag">只查冻结产品</a-checkbox>
  91. </div>
  92. </a-col>
  93. <a-col :md="6" :sm="24">
  94. <div style="margin-bottom: 10px;">
  95. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryQueryList-refresh">查询</a-button>
  96. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryQueryList-reset">重置</a-button>
  97. <a-button
  98. type="primary"
  99. v-if="$hasPermissions('B_inventoryInventoryQueryExport')"
  100. class="button-warning"
  101. @click="handleExport"
  102. :disabled="disabled"
  103. :loading="exportLoading"
  104. id="inventoryQueryList-export">导出</a-button>
  105. <a @click="advanced=!advanced" style="margin-left: 5px" id="shelfMonitoringList-advanced">
  106. {{ advanced ? '收起' : '展开' }}
  107. <a-icon :type="advanced ? 'up' : 'down'"/>
  108. </a>
  109. </div>
  110. </a-col>
  111. </a-row>
  112. </a-form>
  113. </div>
  114. <!-- 合计 -->
  115. <a-alert type="info" style="margin-bottom:10px">
  116. <div class="ftext" slot="message">
  117. 可用总库存:<strong>{{ currentStock&&(currentStock.totalCurrentStockQty || currentStock.totalCurrentStockQty==0) ? currentStock.totalCurrentStockQty : '--' }}个</strong>;
  118. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  119. 可用库存总成本:<strong>{{ currentStock&&(currentStock.totalCurrentStockCost || currentStock.totalCurrentStockCost==0) ? toThousands(currentStock.totalCurrentStockCost) : '--' }}</strong>;
  120. </div>
  121. 冻结总库存:<strong>{{ currentStock&&(currentStock.totalFreezeQty || currentStock.totalFreezeQty==0) ? currentStock.totalFreezeQty : '--' }}个</strong>;
  122. </div>
  123. </a-alert>
  124. <!-- 列表 -->
  125. <s-table
  126. class="sTable fixPagination"
  127. ref="table"
  128. :style="{ height: tableHeight+68.5+'px' }"
  129. size="small"
  130. :rowKey="(record) => record.id"
  131. :columns="columns"
  132. :data="loadData"
  133. :scroll="{ y: tableHeight }"
  134. :defaultLoadData="false"
  135. bordered>
  136. <!-- 产品分类 -->
  137. <template slot="productTypeName" slot-scope="text, record">
  138. <span v-if="record.productTypeName2">{{ record.productTypeName2 || '' }} ></span>
  139. <span v-if="record.productTypeName3">{{ record.productTypeName3 || '' }}</span>
  140. </template>
  141. <!-- 直销天数 -->
  142. <template slot="unsalableDays" slot-scope="text, record" >
  143. <span v-if="record.unsalableDays>=180&&record.unsalableDays<=360" style="color:#FF9900">{{ num(record.unsalableDays) }}</span>
  144. <span v-else-if="record.unsalableDays>360" style="color:#FF0000">{{ num(record.unsalableDays) }}</span>
  145. <span v-else >{{ num(record.unsalableDays) }}</span>
  146. </template>
  147. <!-- 操作 -->
  148. <template slot="action" slot-scope="text, record">
  149. <a-button
  150. size="small"
  151. type="link"
  152. v-if="$hasPermissions('B_inventoryInventoryQueryDetail')"
  153. class="button-success"
  154. @click="goDetail(record)"
  155. :id="'inventoryQueryList-detail-'+record.id">库存详情</a-button>
  156. <a-button
  157. size="small"
  158. type="link"
  159. v-if="$hasPermissions('B_inventoryInventoryQueryStock')"
  160. class="button-primary"
  161. @click="goWarehouseDetail(record)"
  162. :id="'inventoryQueryList-outdetail-'+record.id">出入库明细</a-button>
  163. <a-button
  164. v-if="record.dealerProduct.sysFlag==1&&record.dealerProduct.onlineFalg==1&&$hasPermissions('M_shoppingCart')"
  165. type="link"
  166. :id="'inventoryQueryList-shopCar-'+record.id"
  167. @click="addShopCar(record)">加入购物车</a-button>
  168. <span v-if="!$hasPermissions('B_inventoryInventoryQueryDetail') && !$hasPermissions('B_inventoryInventoryQueryStock')">--</span>
  169. </template>
  170. </s-table>
  171. </a-spin>
  172. <!-- 库存详情 -->
  173. <inventory-query-detail-modal v-drag :openModal="openModal" :nowData="nowData" @close="closeModal" />
  174. <!-- 设置采购数量 -->
  175. <set-purchase-qty ref="setPurchaseQty" :openModal="openPurchaseModal" @close="openPurchaseModal=false" v-drag></set-purchase-qty>
  176. </a-card>
  177. </template>
  178. <script>
  179. import { commonMixin } from '@/utils/mixin'
  180. import { STable, VSelect } from '@/components'
  181. import { downloadExcel } from '@/libs/JGPrint.js'
  182. import ProductType from '../../common/productType.js'
  183. import ProductBrand from '../../common/productBrand.js'
  184. import Warehouse from '@/views/common/warehouse.js'
  185. import inventoryQueryDetailModal from './detailModal.vue'
  186. import setPurchaseQty from './setPurchaseQty.vue'
  187. import { stockList, stockCount, stockExport } from '@/api/stock'
  188. import { purchaseCartExistProduct } from '@/api/purchaseCart'
  189. export default {
  190. name: 'InventoryQueryList',
  191. components: { STable, VSelect, inventoryQueryDetailModal, ProductType, ProductBrand, Warehouse, setPurchaseQty },
  192. mixins: [commonMixin],
  193. data () {
  194. return {
  195. spinning: false,
  196. advanced: true, // 高级搜索 展开/关闭
  197. tableHeight: 0,
  198. queryParam: { // 查询条件
  199. productCode: '', // 产品编码
  200. productName: '', // 产品名称
  201. productOrigCode: '', // 原厂编码
  202. productBrandSn: undefined, // 产品品牌
  203. productTypeSn1: '', // 产品分类1
  204. productTypeSn2: '', // 产品分类2
  205. productTypeSn3: '', // 产品分类3
  206. warehouse: [], // 仓库默认值
  207. warehouseSn: '', // 仓库sn
  208. warehouseLocationSn: '', // 仓位sn
  209. zeroQtyFlag: false, // 库存情况
  210. enableFlag: true, // 显示禁用产品
  211. freezeQtyFlag: false, // 冻结产品
  212. minUnsalableDays: undefined, // 滞销天数最小值
  213. maxUnsalableDays: undefined, // 滞销天数最大值
  214. productSysFlag: undefined // 产品来源,箭冠or自建
  215. },
  216. productTypeSn: [], // 产品类型sn
  217. exportLoading: false, // 导出loading
  218. disabled: false, // 查询、重置按钮是否可操作
  219. zeroQtyData: [ // 库存情况
  220. { name: '库存数量为0', id: '1' },
  221. { name: '库存数量不为0', id: '0' }
  222. ],
  223. openPurchaseModal: false, // 设置采购数量弹框
  224. // 加载数据方法 必须为 Promise 对象
  225. loadData: parameter => {
  226. // 查询条件有直销天数先校验滞销天数
  227. if (this.checkValueRange()) {
  228. this.disabled = true
  229. this.spinning = true
  230. console.log(parameter, '------------')
  231. // 排序
  232. if (parameter.sortField == 'currentStockQty') {
  233. parameter.sortField = 'currentStockQty'
  234. parameter.sortAlias = ''
  235. }
  236. if (parameter.sortField == 'currentStockCost') {
  237. parameter.sortField = 'currentStockCost'
  238. parameter.sortAlias = 'stock'
  239. }
  240. if (parameter.sortField == 'unsalableDays') {
  241. parameter.sortField = 'unsalableDays'
  242. parameter.sortAlias = ''
  243. }
  244. if (parameter.sortField == 'freezeQty') {
  245. parameter.sortField = 'stockFreezeQty'
  246. parameter.sortAlias = ''
  247. }
  248. const params = Object.assign(parameter, this.queryParam)
  249. // 格式化数据
  250. params.zeroQtyFlag = params.zeroQtyFlag ? '0' : ''
  251. params.enableFlag = params.enableFlag ? '' : '1'
  252. params.freezeQtyFlag = params.freezeQtyFlag ? '1' : ''
  253. params.product = {
  254. sysFlag: params.productSysFlag || undefined
  255. }
  256. // 仓库仓位
  257. params.warehouseSn = params.warehouse[0]
  258. params.warehouseLocationSn = params.warehouse[1]
  259. return stockList(params).then(res => {
  260. let data
  261. if (res.status == 200) {
  262. data = res.data
  263. const no = (data.pageNo - 1) * data.pageSize
  264. for (var i = 0; i < data.list.length; i++) {
  265. data.list[i].no = no + i + 1
  266. }
  267. this.disabled = false
  268. // 总计
  269. this.getTotal(params)
  270. }
  271. this.spinning = false
  272. return data
  273. })
  274. } else {
  275. const _this = this
  276. this.disabled = true
  277. this.spinning = true
  278. return new Promise(function (resolve, reject) {
  279. const data = { list: [], count: 0, pageNo: 1, pageSize: 10 }
  280. _this.disabled = false
  281. _this.spinning = false
  282. resolve(data)
  283. })
  284. }
  285. },
  286. openModal: false, // 查看库存详情 弹框
  287. nowData: null, // 当前操作数据
  288. currentStock: null // 可用库存合计
  289. }
  290. },
  291. computed: {
  292. columns () {
  293. const _this = this
  294. const arr = [
  295. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  296. { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  297. { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'left', ellipsis: true, customRender: function (text) { return text || '--' } },
  298. { title: '原厂编码', dataIndex: 'productOrigCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  299. { title: '产品品牌', dataIndex: 'brandName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  300. { title: '产品分类', scopedSlots: { customRender: 'productTypeName' }, width: '13%', align: 'center' },
  301. { title: '可用库存(个)', dataIndex: 'currentStockQty', width: '8%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  302. // { title: '可用库存成本(¥)', dataIndex: 'currentStockCost', width: '8%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  303. { title: '冻结库存(个)', dataIndex: 'freezeQty', width: '8%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  304. { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip>&nbsp;滞销天数</div>, width: '10%', align: 'center', dataIndex: 'unsalableDays', scopedSlots: { customRender: 'unsalableDays' }, sorter: true },
  305. { title: <div><a-tooltip placement='top' title='注意:购物车仅限添加箭冠已上线产品。'><a-icon type="question-circle" /></a-tooltip>&nbsp;操作</div>, scopedSlots: { customRender: 'action' }, width: '16%', align: 'center' }
  306. ]
  307. // 成本权限
  308. if (this.$hasPermissions('M_ShowAllCost')) {
  309. arr.splice(7, 0, { title: '可用库存成本(¥)', dataIndex: 'currentStockCost', width: '10%', align: 'right', sorter: true, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  310. }
  311. return arr
  312. }
  313. },
  314. methods: {
  315. // 加入购物车
  316. addShopCar (row) {
  317. this.spinning = true
  318. purchaseCartExistProduct({
  319. productSn: row.productSn
  320. }).then(res => {
  321. if (res.status == 200) {
  322. if (res.data) {
  323. this.$message.info('此产品已添加到购物车!')
  324. } else {
  325. this.$refs.setPurchaseQty.setData(row)
  326. this.openPurchaseModal = true
  327. }
  328. }
  329. this.spinning = false
  330. })
  331. },
  332. // 校验滞销天数数值范围
  333. checkValueRange () {
  334. const isONull = this.queryParam.minUnsalableDays === null || this.queryParam.minUnsalableDays === undefined
  335. const isOEmpty = this.queryParam.minUnsalableDays === ''
  336. const isOZero = this.queryParam.minUnsalableDays === 0
  337. const isTNull = this.queryParam.maxUnsalableDays === null || this.queryParam.maxUnsalableDays === undefined
  338. const isTEmpty = this.queryParam.maxUnsalableDays === ''
  339. const isTZero = this.queryParam.maxUnsalableDays === 0
  340. // 第一个为空(可为null可为空字符)第二个不为空
  341. // 第一个不为空第二个为空(可为null可为空字符)
  342. // 第一个大于第二个
  343. if ((isONull || isOEmpty) && (this.queryParam.maxUnsalableDays || isTZero)) {
  344. this.$message.info('请输入正确的滞销天数查询范围!')
  345. return false
  346. }
  347. if ((this.queryParam.minUnsalableDays || isOZero) && (isTNull || isTEmpty)) {
  348. this.$message.info('请输入正确的滞销天数查询范围!')
  349. return false
  350. }
  351. if (this.queryParam.minUnsalableDays > this.queryParam.maxUnsalableDays) {
  352. this.$message.info('请输入正确的滞销天数查询范围!')
  353. return false
  354. }
  355. this.queryParam.minUnsalableDays = this.queryParam.minUnsalableDays > 999999999 ? 999999999 : this.queryParam.minUnsalableDays
  356. this.queryParam.maxUnsalableDays = this.queryParam.maxUnsalableDays > 999999999 ? 999999999 : this.queryParam.maxUnsalableDays
  357. return true
  358. },
  359. // 格式化滞销天数为几个月零几天
  360. num (val) {
  361. let days
  362. if (val != null && val != undefined) {
  363. if (val >= 30) {
  364. const a = Math.floor(val / 30)
  365. const b = val - a * 30
  366. if (b > 0) {
  367. days = a + '个月' + b + '天'
  368. } else {
  369. days = a + '个月'
  370. }
  371. } else {
  372. days = val + '天'
  373. }
  374. } else {
  375. days = '--'
  376. }
  377. return days
  378. },
  379. // 重置
  380. resetSearchForm () {
  381. this.queryParam.productBrandSn = undefined
  382. this.queryParam.productTypeSn1 = ''
  383. this.queryParam.productTypeSn2 = ''
  384. this.queryParam.productTypeSn3 = ''
  385. this.queryParam.productCode = ''
  386. this.queryParam.productOrigCode = ''
  387. this.queryParam.productName = ''
  388. this.queryParam.brandName = undefined
  389. this.queryParam.productTypeName = undefined
  390. this.queryParam.zeroQtyFlag = false
  391. this.queryParam.freezeQtyFlag = false
  392. this.queryParam.warehouse = []
  393. this.queryParam.warehouseSn = ''
  394. this.queryParam.warehouseLocationSn = ''
  395. this.$refs.warehouse.setDefaultVal()
  396. this.productTypeSn = []
  397. this.queryParam.minUnsalableDays = undefined // 滞销天数最小值
  398. this.queryParam.maxUnsalableDays = undefined // 滞销天数最大值
  399. this.queryParam.productSysFlag = undefined
  400. this.$refs.table.refresh(true)
  401. },
  402. // 合计
  403. getTotal (param) {
  404. stockCount(param).then(res => {
  405. if (res.status == 200 && res.data) {
  406. this.currentStock = res.data
  407. } else {
  408. this.currentStock = null
  409. }
  410. })
  411. },
  412. // 库存详情
  413. goDetail (row) {
  414. this.nowData = row
  415. this.openModal = true
  416. },
  417. // 关闭弹框
  418. closeModal () {
  419. this.nowData = null
  420. this.openModal = false
  421. },
  422. // 出入库明细
  423. goWarehouseDetail (row) {
  424. this.$router.push({ name: 'inventoryQueryWarehouseDetail', params: { sn: row.productSn } })
  425. },
  426. // 导出
  427. handleExport () {
  428. const _this = this
  429. const params = JSON.parse(JSON.stringify(this.queryParam))
  430. params.zeroQtyFlag = params.zeroQtyFlag ? '0' : ''
  431. params.enableFlag = params.enableFlag ? '' : '1'
  432. params.freezeQtyFlag = params.freezeQtyFlag ? '1' : ''
  433. params.showCost = this.$hasPermissions('M_ShowAllCost') ? 1 : 0
  434. // 仓库仓位
  435. params.warehouseSn = params.warehouse[0]
  436. params.warehouseLocationSn = params.warehouse[1]
  437. this.exportLoading = true
  438. _this.spinning = true
  439. stockExport(params).then(res => {
  440. this.exportLoading = false
  441. _this.spinning = false
  442. if (res.type == 'application/json') {
  443. var reader = new FileReader()
  444. reader.addEventListener('loadend', function () {
  445. const obj = JSON.parse(reader.result)
  446. _this.$notification.error({
  447. message: '提示',
  448. description: obj.message
  449. })
  450. })
  451. reader.readAsText(res)
  452. } else {
  453. downloadExcel(res, '库存查询')
  454. }
  455. })
  456. },
  457. // 产品分类 changeType
  458. changeType (val, selectedOptions) {
  459. for (let i = 0; i < val.length; i++) {
  460. this.queryParam['productTypeSn' + (i + 1)] = val[i]
  461. }
  462. if (val.length == 0) {
  463. this.queryParam.productTypeSn1 = ''
  464. this.queryParam.productTypeSn2 = ''
  465. this.queryParam.productTypeSn3 = ''
  466. }
  467. },
  468. // 页面初始化
  469. pageInit () {
  470. const _this = this
  471. this.$nextTick(() => { // 页面渲染完成后的回调
  472. _this.setTableH()
  473. })
  474. // 是否默认包括禁用产品
  475. this.queryParam.enableFlag = localStorage.getItem('productEnabledFlag-' + this.$store.state.user.info.orgId) != 'false'
  476. },
  477. // 表格高度
  478. setTableH () {
  479. const tableSearchH = this.$refs.tableSearch.offsetHeight
  480. this.tableHeight = window.innerHeight - tableSearchH - 216
  481. }
  482. },
  483. watch: {
  484. advanced (newValue, oldValue) {
  485. const _this = this
  486. this.$nextTick(() => { // 页面渲染完成后的回调
  487. _this.setTableH()
  488. })
  489. },
  490. 'queryParam.enableFlag' (newValue, oldValue) {
  491. localStorage.setItem('productEnabledFlag-' + this.$store.state.user.info.orgId, newValue)
  492. },
  493. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  494. this.setTableH()
  495. }
  496. },
  497. mounted () {
  498. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  499. this.pageInit()
  500. this.resetSearchForm()
  501. }
  502. },
  503. activated () {
  504. // 如果是新页签打开,则重置当前页面
  505. if (this.$store.state.app.isNewTab) {
  506. this.pageInit()
  507. this.resetSearchForm()
  508. }
  509. // 仅刷新列表,不重置页面
  510. if (this.$store.state.app.updateList) {
  511. this.pageInit()
  512. this.$refs.table.refresh()
  513. }
  514. },
  515. beforeRouteEnter (to, from, next) {
  516. next(vm => {})
  517. }
  518. }
  519. </script>