detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div class="accountStateBillDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="accountStateBillDetail-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="accountStateBillDetail-btn" href="javascript:;" @click="handleBack">
  7. <a-icon type="left" />
  8. 返回列表
  9. </a>
  10. <span style="margin: 0 10px;color: #666;">客户名称:{{ detailsData && detailsData.supplier && detailsData.supplier.supplierName }}</span>
  11. </template>
  12. </a-page-header>
  13. <a-card size="small" :bordered="false" class="searchBoxNormal">
  14. <!-- 搜索条件 -->
  15. <div ref="tableSearch" class="table-page-search-wrapper">
  16. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  17. <a-row :gutter="15">
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="时间">
  20. <rangeDate id="accountStateBillDetail-rangeDate" ref="rangeDate" :value="creatDate" @change="dateChange" />
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="业务单号">
  25. <a-input id="accountStateBillDetail-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入业务单号"/>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="对账单号">
  30. <a-input id="accountStateBillDetail-bookNo" v-model.trim="queryParam.bookNo" allowClear placeholder="请输入对账单号"/>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="借贷类型">
  35. <v-select
  36. v-model="queryParam.status"
  37. ref="status"
  38. id="accountStateBillDetail-status"
  39. code="FINANCE_BOOK_STATE"
  40. placeholder="请选择借贷类型"
  41. allowClear></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="业务类型">
  46. <v-select
  47. v-model="queryParam.status"
  48. ref="status"
  49. id="accountStateBillDetail-status"
  50. code="FINANCE_BOOK_STATE"
  51. placeholder="请选择业务类型"
  52. allowClear></v-select>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="6" :sm="24">
  56. <a-form-item label="对单状态">
  57. <v-select
  58. v-model="queryParam.status"
  59. ref="status"
  60. id="accountStatement-status"
  61. code="FINANCE_BOOK_STATE"
  62. placeholder="请选择对单状态"
  63. allowClear></v-select>
  64. </a-form-item>
  65. </a-col>
  66. <a-col :md="6" :sm="24">
  67. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="accountStateBillDetail-refresh">查询</a-button>
  68. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="accountStateBillDetail-reset">重置</a-button>
  69. <a-button
  70. style="margin-left: 10px"
  71. type="primary"
  72. id="accountStateBillDetail-export"
  73. class="button-warning"
  74. @click="handleExport"
  75. :disabled="disabled"
  76. :loading="exportLoading"
  77. >导出</a-button>
  78. </a-col>
  79. </a-row>
  80. </a-form>
  81. </div>
  82. </a-card>
  83. <a-card size="small" :bordered="false">
  84. <a-alert type="info" style="margin-bottom:10px" v-if="totalData">
  85. <div slot="message">
  86. 余额:<strong>{{ totalData&&(totalData.totalCancelAmount || totalData.totalCancelAmount==0) ? toThousands(totalData.totalCancelAmount) : '--' }}</strong>;
  87. 借方:<strong>{{ totalData&&(totalData.totalUnpushedAmount || totalData.totalUnpushedAmount==0) ? toThousands(totalData.totalUnpushedAmount) : '--' }}</strong>;
  88. 贷方:<strong>{{ totalData&&(totalData.totalDispatchAmount || totalData.totalDispatchAmount==0) ? toThousands(totalData.totalDispatchAmount) : '--' }}</strong>;
  89. </div>
  90. </a-alert>
  91. <a-spin :spinning="spinning" tip="Loading...">
  92. <!-- 列表 -->
  93. <s-table
  94. class="sTable"
  95. ref="table"
  96. size="small"
  97. :rowKey="(record) => record.id"
  98. :columns="columns"
  99. :data="loadData"
  100. :pageSize="20"
  101. :defaultLoadData="false"
  102. bordered>
  103. </s-table>
  104. </a-spin>
  105. </a-card>
  106. </div>
  107. </template>
  108. <script>
  109. import { commonMixin } from '@/utils/mixin'
  110. import { STable, VSelect } from '@/components'
  111. import rangeDate from '@/views/common/rangeDate.vue'
  112. import { financeBookQueryPage, financeBookDeleteBySn } from '@/api/financeBook.js'
  113. export default {
  114. name: 'AccountStatementBillDetail',
  115. mixins: [commonMixin],
  116. components: { STable, VSelect, rangeDate },
  117. data () {
  118. return {
  119. spinning: false,
  120. exportLoading: false,
  121. tableHeight: 0,
  122. queryParam: { // 查询条件
  123. beginDate: '',
  124. endDate: '',
  125. bookNo: '',
  126. dealerName: '',
  127. status: undefined
  128. },
  129. disabled: false, // 查询、重置按钮是否可操作
  130. creatDate: [], // 创建时间
  131. advanced: true,
  132. // 加载数据方法 必须为 Promise 对象
  133. loadData: parameter => {
  134. this.disabled = true
  135. this.spinning = true
  136. const params = Object.assign(parameter, this.queryParam)
  137. return financeBookQueryPage(params).then(res => {
  138. let data
  139. if (res.status == 200) {
  140. data = res.data
  141. const no = (data.pageNo - 1) * data.pageSize
  142. for (var i = 0; i < data.list.length; i++) {
  143. data.list[i].no = no + i + 1
  144. }
  145. this.total = data.count || 0
  146. this.disabled = false
  147. }
  148. this.spinning = false
  149. return data
  150. })
  151. },
  152. total: 0, // 合计
  153. totalData: null
  154. }
  155. },
  156. // 根据权限显示列表字段
  157. computed: {
  158. columns () {
  159. const arr = [
  160. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  161. { title: '年', dataIndex: 'sparePartsNo', width: '3%', align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '月', dataIndex: 'sparePartsNo', width: '3%', align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '日', dataIndex: 'sparePartsNo', width: '3%', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '业务单号', dataIndex: 'sparePartsNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  165. { title: '对账单号', dataIndex: 'sparePartsNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '业务类型', dataIndex: 'product.code', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  167. { title: '业务状态', dataIndex: 'product.code', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  168. { title: '费用/调拨类型', dataIndex: 'product.unit', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  169. { title: '摘要', dataIndex: 'sparePartsBatchNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '客诉索赔编码', dataIndex: 'currentStockQty', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
  171. { title: '借方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } },
  172. { title: '贷方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } },
  173. { title: '备注', dataIndex: 'remarks', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  174. { title: '对单状态', dataIndex: 'remarks', width: '6%', align: 'center', customRender: function (text) { return text || '--' } }
  175. ]
  176. return arr
  177. }
  178. },
  179. methods: {
  180. // 返回列表
  181. handleBack () {
  182. this.$router.push({ name: `accountStatementBillList` })
  183. },
  184. // 创建时间 change
  185. dateChange (date) {
  186. this.queryParam.beginDate = date[0] ? date[0] : ''
  187. this.queryParam.endDate = date[1] ? date[1] : ''
  188. },
  189. // 导出
  190. handleExport () {
  191. },
  192. // 重置
  193. resetSearchForm () {
  194. this.creatDate = []
  195. this.$refs.rangeDate.resetDate(this.creatDate)
  196. this.queryParam.beginDate = ''
  197. this.queryParam.endDate = ''
  198. this.queryParam.dealerName = ''
  199. this.queryParam.bookNo = ''
  200. this.queryParam.status = undefined
  201. this.$refs.table.refresh(true)
  202. },
  203. pageInit () {
  204. const _this = this
  205. this.$nextTick(() => { // 页面渲染完成后的回调
  206. _this.setTableH()
  207. })
  208. },
  209. setTableH () {
  210. const tableSearchH = this.$refs.tableSearch.offsetHeight
  211. this.tableHeight = window.innerHeight - tableSearchH - 110
  212. }
  213. },
  214. watch: {
  215. advanced (newValue, oldValue) {
  216. const _this = this
  217. this.$nextTick(() => { // 页面渲染完成后的回调
  218. _this.setTableH()
  219. })
  220. },
  221. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  222. this.setTableH()
  223. }
  224. },
  225. mounted () {
  226. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  227. this.pageInit()
  228. this.resetSearchForm()
  229. }
  230. },
  231. activated () {
  232. // 如果是新页签打开,则重置当前页面
  233. if (this.$store.state.app.isNewTab) {
  234. this.pageInit()
  235. this.resetSearchForm()
  236. }
  237. // 仅刷新列表,不重置页面
  238. if (this.$store.state.app.updateList) {
  239. this.pageInit()
  240. this.$refs.table.refresh()
  241. }
  242. },
  243. beforeRouteEnter (to, from, next) {
  244. next(vm => {})
  245. }
  246. }
  247. </script>
  248. <style lang="less">
  249. .accountStateBillDetail-wrap{
  250. .accountStateBillDetail-back{
  251. padding-top: 10px;
  252. margin-bottom: 6px;
  253. }
  254. }
  255. </style>