list.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <a-card size="small" :bordered="false" class="salesManagementList-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. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="审核时间">
  15. <rangeDate ref="auditRangeDate" :value="auditTime" @change="auditDateChange" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="出库时间">
  20. <rangeDate ref="outWareRangeDate" :value="outWareTime" @change="outWareDateChange" />
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  26. <custList ref="custList" @change="custChange"></custList>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="销售单号">
  31. <a-input id="salesManagementList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="单据来源">
  36. <v-select
  37. v-model="queryParam.sourceType"
  38. ref="sourceType"
  39. id="salesManagementList-sourceType"
  40. code="SALES_SOURCE"
  41. placeholder="请选择单据来源"
  42. allowClear></v-select>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="24">
  46. <a-form-item label="收款方式">
  47. <v-select
  48. code="SETTLE_STYLE"
  49. id="salesManagementList-settleStyleSn"
  50. v-model="queryParam.settleStyleSn"
  51. allowClear
  52. placeholder="请选择收款方式"
  53. ></v-select>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-item label="业务状态">
  58. <v-select
  59. v-model="queryParam.billStatus"
  60. ref="billStatus"
  61. id="salesManagementList-billStatus"
  62. code="SALES_BILL_STATUS"
  63. placeholder="请选择业务状态"
  64. allowClear></v-select>
  65. </a-form-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-item label="财务状态">
  69. <v-select
  70. v-model="queryParam.financialStatus"
  71. ref="financialStatus"
  72. id="salesManagementList-financialStatus"
  73. code="FINANCIAL_RECEIVE_STATUS"
  74. placeholder="请选择财务状态"
  75. allowClear></v-select>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-item label="采购单号">
  80. <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  81. </a-form-item>
  82. </a-col>
  83. <a-col :span="6">
  84. <a-form-model-item label="铺货出库">
  85. <v-select code="FLAG" id="salesManagementList-distributionFlag" v-model="queryParam.distributionFlag" allowClear placeholder="请选择是否铺货出库"></v-select>
  86. </a-form-model-item>
  87. </a-col>
  88. </template>
  89. <a-col :md="6" :sm="24">
  90. <span class="table-page-search-submitButtons">
  91. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  92. <a-button style="margin-left: 5px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  93. <a-button
  94. type="primary"
  95. v-if="$hasPermissions('B_salesExport')"
  96. class="button-warning"
  97. @click="handleExport"
  98. :disabled="disabled"
  99. :loading="exportLoading"
  100. id="salesManagementList-export">导出</a-button>
  101. <a @click="advanced=!advanced" style="margin-left: 5px">
  102. {{ advanced ? '收起' : '展开' }}
  103. <a-icon :type="advanced ? 'up' : 'down'"/>
  104. </a>
  105. </span>
  106. </a-col>
  107. </a-row>
  108. </a-form>
  109. </div>
  110. <!-- 操作按钮 -->
  111. <div class="table-operator">
  112. <a-button type="primary" class="button-error" v-if="$hasPermissions('B_salesNews')" @click="handleAdd(0)">新增(零售)</a-button>
  113. <a-button type="primary" class="button-warning" v-if="$hasPermissions('B_salesNews')" @click="handleAdd(1)">新增(铺货)</a-button>
  114. </div>
  115. <a-alert type="info" style="margin-bottom:10px">
  116. <div slot="message">
  117. 总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? totalData.totalAmount : '--' }}</strong>元;
  118. 总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
  119. 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
  120. 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  121. </div>
  122. </a-alert>
  123. <!-- 列表 -->
  124. <s-table
  125. class="sTable fixPagination"
  126. ref="table"
  127. :style="{ height: tableHeight+77+'px' }"
  128. size="small"
  129. :rowKey="(record) => record.id"
  130. :columns="columns"
  131. :data="loadData"
  132. :scroll="{ y:tableHeight }"
  133. :defaultLoadData="false"
  134. bordered>
  135. <!-- 销售单号 -->
  136. <template slot="salesBillNo" slot-scope="text, record">
  137. <span class="table-td-link" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  138. <span v-else>{{ record.salesBillNo }}</span>
  139. <a-badge count="改" :offset="[10,0]" v-if="record.billStatus=='SUPERIOR_CHANGE'"></a-badge>
  140. </template>
  141. <!-- 审核 -->
  142. <template slot="audit" slot-scope="text, record">
  143. <stateIcon :title="record.billStatusDictValue" v-if="record.billStatus!='AUDIT_REJECT'" :state="record.billStatus == 'WAIT_OUT_WAREHOUSE'||record.billStatus == 'FINISH'?'1':'2'"></stateIcon>
  144. <stateIcon :title="record.billStatusDictValue" v-else :state="0"></stateIcon>
  145. </template>
  146. <!-- 急件 -->
  147. <template slot="oosFlag" slot-scope="text, record">
  148. <stateIcon :state="record.oosFlag==1?'1':'2'"></stateIcon>
  149. </template>
  150. <!-- 出库 -->
  151. <template slot="waitOut" slot-scope="text, record">
  152. <stateIcon :state="record.billStatus == 'FINISH'?'1':'2'"></stateIcon>
  153. </template>
  154. <!-- 收款 -->
  155. <template slot="financial" slot-scope="text, record">
  156. <stateIcon :title="record.financialStatusDictValue" :state="record.financialStatus == 'FINISH'?'1':'2'"></stateIcon>
  157. </template>
  158. <!-- 操作 -->
  159. <template slot="action" slot-scope="text, record">
  160. <a-button
  161. size="small"
  162. type="link"
  163. class="button-primary"
  164. v-if="record.billStatus == 'WAIT_AUDIT' && $hasPermissions('B_salesAudit')"
  165. @click="handleEexamine(record)"
  166. >审核</a-button>
  167. <a-button
  168. size="small"
  169. type="link"
  170. v-if="record.billStatus == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_salesStockOut')"
  171. class="button-primary"
  172. @click="handleSend(record)"
  173. >出库</a-button>
  174. <a-button
  175. size="small"
  176. type="link"
  177. class="button-primary"
  178. v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')"
  179. @click="handleEdit(record)"
  180. >
  181. 编辑
  182. </a-button>
  183. <a-button
  184. size="small"
  185. type="link"
  186. class="button-error"
  187. v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel')"
  188. @click="handleDel(record)"
  189. >
  190. 删除
  191. </a-button>
  192. <a-button
  193. size="small"
  194. type="link"
  195. class="button-primary"
  196. v-if="(record.sourceType == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) && $hasPermissions('B_salesEdit')"
  197. @click="handleEdit(record)"
  198. >
  199. 改单
  200. </a-button>
  201. <a-button
  202. size="small"
  203. type="link"
  204. class="button-error"
  205. v-if="(record.sourceType == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) && $hasPermissions('B_salesDel')"
  206. @click="handleDel(record, 'cancel')"
  207. >
  208. 取消
  209. </a-button>
  210. <span v-if="!(record.billStatus == 'WAIT_AUDIT' && $hasPermissions('B_salesAudit')) && !(record.billStatus == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_salesStockOut')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel')) && !((record.sourceType == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) && $hasPermissions('B_salesEdit')) && !((record.sourceType == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) && $hasPermissions('B_salesDel'))">--</span>
  211. </template>
  212. </s-table>
  213. </a-spin>
  214. <!-- 选择客户弹框 -->
  215. <choose-custom-modal :show="openModal" :distributionFlag="distributionFlag" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
  216. <!-- 审核 -->
  217. <auditModal :openModal="visibleAudit" :spinning="spinningAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_OUT_WAREHOUSE')" @fail="auditOrder('AUDIT_REJECT')" />
  218. </a-card>
  219. </template>
  220. <script>
  221. import { commonMixin } from '@/utils/mixin'
  222. import getDate from '@/libs/getDate.js'
  223. import { STable, VSelect } from '@/components'
  224. import chooseCustomModal from './chooseCustomModal.vue'
  225. import auditModal from '@/views/common/auditModal.vue'
  226. import { salesList, salesDel, salesWriteAudit, salesWriteStockOut, salesCount, salesExport } from '@/api/sales'
  227. import rangeDate from '@/views/common/rangeDate.vue'
  228. import custList from '@/views/common/custList.vue'
  229. import { downloadExcel } from '@/libs/JGPrint.js'
  230. import stateIcon from '@/views/common/stateIcon'
  231. export default {
  232. name: 'SalesList',
  233. components: { STable, VSelect, chooseCustomModal, rangeDate, auditModal, custList, stateIcon },
  234. mixins: [commonMixin],
  235. data () {
  236. return {
  237. spinning: false,
  238. tableHeight: 0,
  239. advanced: true, // 高级搜索 展开/关闭
  240. disabled: false, // 查询、重置按钮是否可操作
  241. exportLoading: false, // 导出loading
  242. openModal: false, // 选择客户弹框是否显示
  243. time: [
  244. getDate.getCurrMonthDays().starttime,
  245. getDate.getCurrMonthDays().endtime
  246. ],
  247. auditTime: [],
  248. outWareTime: [],
  249. // 查询参数
  250. queryParam: {
  251. beginDate: getDate.getCurrMonthDays().starttime,
  252. endDate: getDate.getCurrMonthDays().endtime,
  253. auditBeginDate: '',
  254. auditEndDate: '',
  255. outWarehouseBeginDate: '',
  256. outWarehouseEndDate: '',
  257. buyerName: undefined, // 客户名称
  258. buyerSn: undefined,
  259. salesBillNo: '', // 销售单号
  260. purchaseBillNo: '', // 采购单号
  261. payType: undefined, // 支付方式
  262. settleStyleSn: undefined, // 收款方式
  263. billStatus: undefined, // 业务状态
  264. financialStatus: undefined, // 财务状态
  265. sourceType: undefined,
  266. distributionFlag: undefined
  267. },
  268. totalData: {
  269. totalAmount: 0,
  270. totalCategory: 0,
  271. totalQty: 0,
  272. totalRecord: 0
  273. },
  274. selType: '0', // 0零售 1铺货
  275. // 表头
  276. columns: [
  277. { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
  278. { title: '来源', dataIndex: 'sourceTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  279. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '9%', align: 'center' },
  280. { title: '客户名称', dataIndex: 'buyerName', align: 'center', width: '15%', customRender: function (text) { return text || '--' } },
  281. { title: '总款数', dataIndex: 'totalCategory', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  282. { title: '总数量', dataIndex: 'totalQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  283. { title: '总售价', dataIndex: 'totalAmount', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  284. { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  285. { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  286. { title: '审核时间', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  287. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  288. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '2%', align: 'center' },
  289. { title: '急件', scopedSlots: { customRender: 'oosFlag' }, width: '2%', align: 'center' },
  290. { title: '出库', scopedSlots: { customRender: 'waitOut' }, width: '2%', align: 'center' },
  291. { title: '收款', scopedSlots: { customRender: 'financial' }, width: '2%', align: 'center' },
  292. // { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  293. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  294. ],
  295. // 加载数据方法 必须为 Promise 对象
  296. loadData: parameter => {
  297. this.disabled = true
  298. this.spinning = true
  299. // 查询总计
  300. salesCount(Object.assign(parameter, this.queryParam)).then(res => {
  301. console.log(res, 'res')
  302. this.totalData = Object.assign(this.totalData, res.data || {})
  303. })
  304. return salesList(Object.assign(parameter, this.queryParam)).then(res => {
  305. let data
  306. if (res.status == 200) {
  307. data = res.data
  308. const no = (data.pageNo - 1) * data.pageSize
  309. for (var i = 0; i < data.list.length; i++) {
  310. data.list[i].no = no + i + 1
  311. }
  312. this.disabled = false
  313. }
  314. console.log(res, 'res')
  315. this.spinning = false
  316. return data
  317. })
  318. },
  319. visibleAudit: false,
  320. auditInfo: null,
  321. spinningAudit: false,
  322. distributionFlag: '0'
  323. }
  324. },
  325. methods: {
  326. // 时间 change
  327. dateChange (date) {
  328. this.queryParam.beginDate = date[0]
  329. this.queryParam.endDate = date[1]
  330. },
  331. auditDateChange (date) {
  332. this.queryParam.auditBeginDate = date[0]
  333. this.queryParam.auditEndDate = date[1]
  334. },
  335. outWareDateChange (date) {
  336. this.queryParam.outWarehouseBeginDate = date[0]
  337. this.queryParam.outWarehouseEndDate = date[1]
  338. },
  339. custChange (v, row) {
  340. console.log(v, row)
  341. if (row && row.customerSn) {
  342. this.queryParam.buyerSn = row.customerSn
  343. this.queryParam.buyerName = undefined
  344. } else {
  345. this.queryParam.buyerName = v
  346. this.queryParam.buyerSn = undefined
  347. }
  348. },
  349. // 新增
  350. handleAdd (flag) {
  351. this.openModal = true
  352. this.distributionFlag = flag
  353. },
  354. // 审核
  355. handleEexamine (row) {
  356. this.auditInfo = row
  357. this.visibleAudit = true
  358. },
  359. auditOrder (billStatus) {
  360. this.spinningAudit = true
  361. salesWriteAudit({
  362. id: this.auditInfo.id,
  363. billStatus: billStatus
  364. }).then(res => {
  365. if (res.status == 200) {
  366. this.visibleAudit = false
  367. this.$message.success(res.message)
  368. this.$refs.table.refresh()
  369. this.spinningAudit = false
  370. } else {
  371. this.visibleAudit = false
  372. this.spinningAudit = false
  373. }
  374. })
  375. },
  376. // 出库
  377. handleSend (row) {
  378. const _this = this
  379. this.$confirm({
  380. title: '提示',
  381. content: '确认要出库吗?',
  382. centered: true,
  383. closable: true,
  384. onOk () {
  385. _this.spinning = true
  386. salesWriteStockOut({
  387. salesBillSn: row.salesBillSn
  388. }).then(res => {
  389. if (res.status == 200) {
  390. _this.$message.success(res.message)
  391. _this.$refs.table.refresh()
  392. _this.spinning = false
  393. } else {
  394. _this.spinning = false
  395. }
  396. })
  397. }
  398. })
  399. },
  400. // 详情
  401. handleDetail (row) {
  402. this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
  403. },
  404. // 编辑
  405. handleEdit (row) {
  406. this.$router.push({ name: 'salesEdit', params: { id: row.id, sn: row.salesBillSn, priceType: row.priceType } })
  407. },
  408. // 选择客户成功
  409. chooseCustomOk (data) {
  410. this.resetData()
  411. this.$router.push({ name: 'salesAdd', params: { id: data.id, sn: data.salesBillSn, priceType: data.priceType } })
  412. },
  413. // 删除
  414. handleDel (row, type) {
  415. const _this = this
  416. let content = '确认要删除吗?'
  417. if (type == 'cancel') {
  418. content = '确认要取消吗?'
  419. }
  420. this.$confirm({
  421. title: '提示',
  422. content: <div><div style='font-size:16px;margin-bottom:10px;'>{content}</div><div>销售单号:{row.salesBillNo}</div><div>客户名称:{row.buyerName}</div></div>,
  423. centered: true,
  424. closable: true,
  425. onOk () {
  426. _this.spinning = true
  427. salesDel({ id: row.id }).then(res => {
  428. if (res.status == 200) {
  429. _this.$message.success(res.message)
  430. _this.$refs.table.refresh()
  431. _this.spinning = false
  432. } else {
  433. _this.spinning = false
  434. }
  435. })
  436. }
  437. })
  438. },
  439. // 重置
  440. resetSearchForm () {
  441. this.resetData()
  442. this.$refs.table.refresh(true)
  443. },
  444. // 重置数据
  445. resetData (flag) {
  446. this.$refs.rangeDate.resetDate(flag ? '' : this.time)
  447. this.queryParam.beginDate = flag ? '' : getDate.getCurrMonthDays().starttime
  448. this.queryParam.endDate = flag ? '' : getDate.getCurrMonthDays().endtime
  449. this.$refs.auditRangeDate.resetDate('')
  450. this.queryParam.auditBeginDate = ''
  451. this.queryParam.auditEndDate = ''
  452. this.$refs.outWareRangeDate.resetDate('')
  453. this.queryParam.outWarehouseBeginDate = ''
  454. this.queryParam.outWarehouseEndDate = ''
  455. this.queryParam.buyerName = undefined
  456. this.queryParam.buyerSn = undefined
  457. this.queryParam.salesBillNo = ''
  458. this.queryParam.purchaseBillNo = ''
  459. this.queryParam.payType = undefined
  460. this.queryParam.settleStyleSn = undefined
  461. this.queryParam.billStatus = undefined
  462. this.queryParam.financialStatus = undefined
  463. this.queryParam.sourceType = undefined
  464. this.queryParam.distributionFlag = undefined
  465. this.$refs.custList.resetForm()
  466. if (!flag) {
  467. this.setIsHomeNav(this.$route.name, null)
  468. }
  469. },
  470. // 导出
  471. handleExport () {
  472. const _this = this
  473. const params = this.queryParam
  474. this.exportLoading = true
  475. _this.spinning = true
  476. salesExport(params).then(res => {
  477. this.exportLoading = false
  478. _this.spinning = false
  479. if (res.type == 'application/json') {
  480. var reader = new FileReader()
  481. reader.addEventListener('loadend', function () {
  482. const obj = JSON.parse(reader.result)
  483. _this.$notification.error({
  484. message: '提示',
  485. description: obj.message
  486. })
  487. })
  488. reader.readAsText(res)
  489. } else {
  490. downloadExcel(res, '销售列表')
  491. }
  492. })
  493. },
  494. setTableH () {
  495. const tableSearchH = this.$refs.tableSearch.offsetHeight
  496. this.tableHeight = window.innerHeight - tableSearchH - 265
  497. },
  498. pageInit () {
  499. const _this = this
  500. this.$nextTick(() => { // 页面渲染完成后的回调
  501. _this.setTableH()
  502. })
  503. // 是否打开的页签
  504. const a = this.$store.state.app.isNewTab
  505. // 是否要刷新列表
  506. const b = this.$store.state.app.updateList
  507. // 是否从首页点击进入
  508. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  509. console.log(a, b)
  510. // 从首页进入,判断式新建还式待办查询
  511. if (isHomeNav) {
  512. // 新增
  513. if (isHomeNav.type == 'new') {
  514. this.resetSearchForm()
  515. this.openModal = true
  516. }
  517. // 待办
  518. if (isHomeNav.type == 'todo') {
  519. this.resetData(true)
  520. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  521. this.$refs.rangeDate.resetDate([this.queryParam.beginDate, this.queryParam.endDate])
  522. this.$refs.table.refresh(true)
  523. }
  524. } else {
  525. // 如果是新页签打开,则重置当前页面
  526. if (a && !b) {
  527. this.resetSearchForm()
  528. }
  529. }
  530. // 仅刷新列表,不重置页面
  531. if (b || a == b) {
  532. this.$refs.table.refresh()
  533. }
  534. }
  535. },
  536. watch: {
  537. advanced (newValue, oldValue) {
  538. const _this = this
  539. this.$nextTick(() => { // 页面渲染完成后的回调
  540. _this.setTableH()
  541. })
  542. },
  543. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  544. this.setTableH()
  545. }
  546. },
  547. activated () {
  548. this.pageInit()
  549. },
  550. beforeRouteEnter (to, from, next) {
  551. next(vm => {
  552. })
  553. }
  554. }
  555. </script>