detail.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="dealerAccountDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <div>
  5. <a-page-header :ghost="false" :backIcon="false" class="header-bar">
  6. <!-- 自定义的二级文字标题 -->
  7. <template slot="subTitle">
  8. <a id="dealerAccountDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  9. <span v-if="totalData" class="subTitle-word text-overflow" style="margin:0 15px;vertical-align: middle;"><span>轮胎补贴金额({{ totalData.dealerEntity?totalData.dealerEntity.dealerName?totalData.dealerEntity.dealerName:'--':'--' }}):¥</span><span style="font-size:20px;" >{{ (totalData.subsidyTire||totalData.subsidyTire==0)?toThousands(totalData.subsidyTire):'--' }}</span></span>
  10. <span v-else>--</span>
  11. <a-button
  12. type="danger"
  13. v-if="$hasPermissions('B_checkAccount')"
  14. style="margin-right:15px;"
  15. ghost
  16. id="dealerAccountDetail-checkAccount"
  17. @click="openCheckAccountModal = true">调账</a-button>
  18. <a-button
  19. type="primary"
  20. v-if="$hasPermissions('B_checkRecord')"
  21. class="button-info"
  22. ghost
  23. id="dealerAccountDetail-checkRecord"
  24. @click="openCheckRecordModal=true">调账记录</a-button>
  25. </template>
  26. </a-page-header>
  27. </div>
  28. <a-card size="small" :bordered="false">
  29. <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName" >
  30. <a-form-model
  31. layout="inline"
  32. :model="queryParam"
  33. id="dealerAccountDetail-form"
  34. @keyup.enter.native="$refs.table.refresh(true)">
  35. <a-row :gutter="15">
  36. <a-col :md="6" :sm="24">
  37. <a-form-model-item label="时间">
  38. <rangeDate ref="rangeDate" id="dealerAccountDetail-time" :value="time" @change="dateChange" />
  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.flowBizType"
  45. ref="flowBizType"
  46. id="dealerAccountDetail-flowBizType"
  47. code="FLOW_BIZ_TYPE"
  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.amountType"
  56. ref="amountType"
  57. id="dealerAccountDetail-amountType"
  58. code="DEALER_AMOUNT_TYPE"
  59. placeholder="请选择入账类型"
  60. allowClear></v-select>
  61. </a-form-model-item>
  62. </a-col>
  63. <a-col :md="6" :sm="24">
  64. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="dealerAccountDetail-refresh">查询</a-button>
  65. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="dealerAccountDetail-reset">重置</a-button>
  66. <a-button
  67. style="margin-left: 10px"
  68. type="primary"
  69. class="button-warning"
  70. @click="handleExport"
  71. :disabled="disabled"
  72. :loading="exportLoading"
  73. v-if="$hasPermissions('B_dealerAccountDetail_export')"
  74. id="dealerAccountDetail-export">导出</a-button>
  75. </a-col>
  76. </a-row>
  77. </a-form-model>
  78. </div>
  79. <!-- 列表 -->
  80. <s-table
  81. class="sTable fixPagination"
  82. ref="table"
  83. size="small"
  84. :rowKey="(record) => record.id"
  85. :columns="columns"
  86. :data="loadData"
  87. :defaultLoadData="false"
  88. :pageSize="30"
  89. :style="{ height: tableHeight+60+'px' }"
  90. :scroll="{ y: tableHeight-10 }"
  91. bordered>
  92. </s-table>
  93. </a-card>
  94. </a-spin>
  95. <!-- 调账 -->
  96. <check-account-modal
  97. v-drag
  98. ref="checkAccountModal"
  99. :dealerName="totalData&&totalData.dealerEntity&&totalData.dealerEntity.dealerName?totalData.dealerEntity.dealerName:''"
  100. :dealerNum="totalData&&totalData.subsidyTire?totalData.subsidyTire:''"
  101. :openModal="openCheckAccountModal"
  102. @ok="$refs.table.refresh(true)"
  103. @close="openCheckAccountModal = false" />
  104. <!-- 调账记录 -->
  105. <check-record-modal v-drag :openModal="openCheckRecordModal" @ok="$refs.table.refresh(true)" @close="openCheckRecordModal = false" />
  106. </div>
  107. </template>
  108. <script>
  109. import { commonMixin } from '@/utils/mixin'
  110. // 组件
  111. import { STable, VSelect } from '@/components'
  112. import rangeDate from '@/views/common/rangeDate.vue'
  113. import checkAccountModal from './checkAccountModal.vue'
  114. import checkRecordModal from './checkRecordModal.vue'
  115. import { hdExportExcel } from '@/libs/exportExcel'
  116. // 接口
  117. import { dealerAccountFlowList, dealerAccountFlowExport, queryDealerAccount } from '@/api/dealerAccount'
  118. export default {
  119. name: 'DealerAccountDetail',
  120. mixins: [commonMixin],
  121. components: { STable, VSelect, rangeDate, checkAccountModal, checkRecordModal },
  122. data () {
  123. const _this = this
  124. return {
  125. spinning: false,
  126. tableHeight: 0, // 表格高度
  127. disabled: false, // 查询、重置按钮是否可操作
  128. exportLoading: false, // 导出时加载状态
  129. openCheckAccountModal: false, // 打开调账弹窗
  130. openCheckRecordModal: false, // 打开调账记录弹窗
  131. // 查询参数
  132. time: [],
  133. queryParam: {
  134. beginDate: '', // 开始时间
  135. endDate: '', // 结束时间
  136. flowBizType: undefined, // 业务类型
  137. amountType: undefined // 入账类型
  138. },
  139. columns: [
  140. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  141. { title: '记账日期', dataIndex: 'accountDate', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  142. { title: '业务类型', dataIndex: 'flowBizTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  143. { title: '入账类型', dataIndex: 'amountTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  144. { title: '金额(¥)', dataIndex: 'flowAmount', width: '16%', align: 'center', customRender: text => { return (text || text == 0) ? _this.toThousands(text) : '--' } },
  145. { title: '备注', dataIndex: 'remark', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  146. ],
  147. totalData: null,
  148. loadData: parameter => {
  149. this.disabled = true
  150. this.spinning = true
  151. this.queryParam.dealerSn = this.$route.params.sn
  152. const params = Object.assign(parameter, this.queryParam)
  153. // 获取列表数据 有分页
  154. return dealerAccountFlowList(params).then(res => {
  155. let data
  156. if (res.status == 200) {
  157. data = res.data
  158. // 计算列表序号
  159. const no = (data.pageNo - 1) * data.pageSize
  160. for (var i = 0; i < data.list.length; i++) {
  161. data.list[i].no = no + i + 1
  162. }
  163. this.getCount()
  164. }
  165. this.disabled = false
  166. this.spinning = false
  167. return data
  168. })
  169. }
  170. }
  171. },
  172. methods: {
  173. // 时间 change
  174. dateChange (date) {
  175. if (date[0] && date[1]) {
  176. this.time = date
  177. } else {
  178. this.time = []
  179. }
  180. this.queryParam.beginDate = date[0] || ''
  181. this.queryParam.endDate = date[1] || ''
  182. },
  183. getCount () {
  184. queryDealerAccount({ accountSn: this.$route.params.aSn }).then(res => {
  185. if (res.status == 200 && res.data) {
  186. this.totalData = res.data
  187. } else {
  188. this.totalData = null
  189. }
  190. })
  191. },
  192. // 重置
  193. resetSearchForm () {
  194. this.queryParam = {
  195. beginDate: '', // 开始时间
  196. endDate: '', // 结束时间
  197. flowBizType: undefined, // 业务类型
  198. amountType: undefined // 入账类型
  199. }
  200. this.time = []
  201. this.$refs.rangeDate.resetDate()
  202. this.$refs.table.refresh(true)
  203. },
  204. // 导出
  205. handleExport () {
  206. const _this = this
  207. _this.exportLoading = true
  208. _this.spinning = true
  209. hdExportExcel(dealerAccountFlowExport, _this.queryParam, '轮胎补贴金额列表', function () {
  210. _this.exportLoading = false
  211. _this.spinning = false
  212. })
  213. },
  214. // 返回
  215. handleBack () {
  216. this.$router.push({ name: 'dealerAccountList' })
  217. },
  218. // 初始化
  219. pageInit () {
  220. const _this = this
  221. this.$nextTick(() => { // 页面渲染完成后的回调
  222. _this.setTableH()
  223. })
  224. _this.$refs.table.refresh(true)
  225. },
  226. // 计算列表高度
  227. setTableH () {
  228. const searchHeight = this.$refs.tableSearch.offsetHeight
  229. this.tableHeight = window.innerHeight - searchHeight - 240
  230. }
  231. },
  232. watch: {
  233. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  234. this.setTableH()
  235. }
  236. },
  237. mounted () {
  238. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  239. this.pageInit()
  240. }
  241. },
  242. activated () {
  243. // 如果是新页签打开,则重置当前页面
  244. if (this.$store.state.app.isNewTab) {
  245. this.pageInit()
  246. }
  247. // 仅刷新列表,不重置页面
  248. if (this.$store.state.app.updateList) {
  249. this.pageInit()
  250. }
  251. },
  252. beforeRouteEnter (to, from, next) {
  253. next(vm => {})
  254. }
  255. }
  256. </script>