list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <a-card size="small" :bordered="false" class="companyCollectionPaymentList-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 id="companyCollectionPaymentList-rangeDate" ref="rangeDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="单位类型">
  15. <v-select
  16. v-model="queryParam.settleClientType"
  17. ref="settleClientType"
  18. id="companyCollectionPaymentList-settleClientType"
  19. code="SETTLE_CLIENT_TYPE"
  20. placeholder="请选择单位类型"
  21. allowClear></v-select>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="客户名称">
  26. <a-input id="companyCollectionPaymentList-settleClientName" v-model.trim="queryParam.settleClientNameCurrent" allowClear placeholder="请输入客户名称"/>
  27. </a-form-item>
  28. </a-col>
  29. <template v-if="advanced">
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="结算类型">
  32. <v-select
  33. v-model="queryParam.settleType"
  34. ref="settleType"
  35. id="companyCollectionPaymentList-settleType"
  36. code="SETTLE_TYPE"
  37. placeholder="请选择结算类型"
  38. allowClear></v-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-item label="结算单号">
  43. <a-input id="companyCollectionPaymentList-unitSettleNo" v-model.trim="queryParam.unitSettleNo" allowClear placeholder="请输入结算单号"/>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="6" :sm="24">
  47. <a-form-item label="结算方式">
  48. <v-select
  49. code="SETTLE_STYLE"
  50. id="companyCollectionPaymentList-settleStyleSn"
  51. v-model="queryParam.settleStyleSn"
  52. allowClear
  53. placeholder="请选择结算方式"
  54. ></v-select>
  55. </a-form-item>
  56. </a-col>
  57. </template>
  58. <a-col :md="6" :sm="24">
  59. <span class="table-page-search-submitButtons">
  60. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="companyCollectionPaymentList-refresh">查询</a-button>
  61. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="companyCollectionPaymentList-reset">重置</a-button>
  62. <a-button
  63. type="primary"
  64. v-if="$hasPermissions('B_cpayUnitExport')"
  65. class="button-warning"
  66. @click="handleExport"
  67. :disabled="disabled"
  68. :loading="exportLoading"
  69. id="companyCollectionPaymentList-export">导出</a-button>
  70. <a @click="advanced=!advanced" style="margin-left: 8px" id="companyCollectionPaymentList-advanced">
  71. {{ advanced ? '收起' : '展开' }}
  72. <a-icon :type="advanced ? 'up' : 'down'"/>
  73. </a>
  74. </span>
  75. </a-col>
  76. </a-row>
  77. </a-form>
  78. </div>
  79. <!-- alert -->
  80. <a-alert type="info" style="margin-bottom:10px">
  81. <div slot="message">
  82. 共 <strong>{{ total }}</strong> 条记录,
  83. 其中收款单 <strong>{{ (productTotal&&(productTotal.receiptCount || productTotal.receiptCount==0)) ? productTotal.receiptCount : '--' }}</strong> 条,
  84. 收款金额合计 <strong>{{ (productTotal&&(productTotal.receiptAmount || productTotal.receiptAmount==0)) ? toThousands(productTotal.receiptAmount) : '--' }}</strong> ,
  85. 付款单 <strong>{{ (productTotal&&(productTotal.payCount || productTotal.payCount==0)) ? productTotal.payCount : '--' }}</strong> 条,
  86. 付款金额合计 <strong>{{ (productTotal&&(productTotal.payAmount || productTotal.payAmount==0)) ? toThousands(productTotal.payAmount) : '--' }}</strong>
  87. </div>
  88. </a-alert>
  89. <!-- 列表 -->
  90. <s-table
  91. class="sTable fixPagination"
  92. ref="table"
  93. :style="{ height: tableHeight+84.5+'px' }"
  94. size="small"
  95. :rowKey="(record) => record.id"
  96. :columns="columns"
  97. :data="loadData"
  98. :scroll="{ y: tableHeight }"
  99. :defaultLoadData="false"
  100. bordered>
  101. <!-- 客户名称 -->
  102. <template slot="customerName" slot-scope="text, record">
  103. <span v-if="record.settleClientType&&record.settleClientType=='CUSTOMER'">{{ record.settleClientNameCurrent||'--' }}</span>
  104. <span v-else>{{ record.settleClientName||'--' }}</span>
  105. </template>
  106. <!-- 结算单号 -->
  107. <template slot="unitSettleNo" slot-scope="text, record">
  108. <span :id="'companyCollectionPaymentList-detail-'+record.id" :class="$hasPermissions('M_companyCollectionPayment_detail')?'table-td-link':'common'" @click="handleDetail(record)">{{ record.unitSettleNo }}</span>
  109. </template>
  110. </s-table>
  111. </a-spin>
  112. </a-card>
  113. </template>
  114. <script>
  115. import { commonMixin } from '@/utils/mixin'
  116. import { STable, VSelect } from '@/components'
  117. import rangeDate from '@/views/common/rangeDate.vue'
  118. import { downloadExcel } from '@/libs/JGPrint.js'
  119. import { settleUnitList, settleUnitQuerySum, settleUnitListExport } from '@/api/settle'
  120. export default {
  121. name: 'CompanyCollectionPaymentList',
  122. components: { STable, VSelect, rangeDate },
  123. mixins: [commonMixin],
  124. data () {
  125. const _this = this
  126. return {
  127. spinning: false,
  128. advanced: true, // 高级搜索 展开/关闭
  129. disabled: false, // 查询、重置按钮是否可操作
  130. exportLoading: false,
  131. tableHeight: 0,
  132. // 查询参数
  133. queryParam: {
  134. beginDate: '', // 开始时间
  135. endDate: '', // 结束时间
  136. settleClientNameCurrent: '', // 客户名称
  137. settleClientType: undefined, // 单位类型
  138. settleType: undefined, // 结算类型
  139. unitSettleNo: '', // 结算单号
  140. settleStyleSn: undefined // 结算方式
  141. },
  142. // 表头
  143. columns: [
  144. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  145. { title: '客户名称', width: '16%', align: 'center', scopedSlots: { customRender: 'customerName' }, ellipsis: true },
  146. { title: '单位类型', dataIndex: 'settleClientTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  147. { title: '结算类型', dataIndex: 'settleTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  148. { title: '结算方式', dataIndex: 'settleStyleSnDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '结算单号', scopedSlots: { customRender: 'unitSettleNo' }, width: '11%', align: 'center' },
  150. { title: '应收金额', dataIndex: 'settleReceiptAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  151. { title: '应付金额', dataIndex: 'settlePayAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  152. { title: '折让金额', dataIndex: 'discountAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  153. { title: '实结算金额', dataIndex: 'realSettleAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  154. { title: '结算时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  155. { title: '操作人', dataIndex: 'operateName', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  156. ],
  157. // 加载数据方法 必须为 Promise 对象
  158. loadData: parameter => {
  159. this.disabled = true
  160. this.spinning = true
  161. return settleUnitList(Object.assign(parameter, this.queryParam)).then(res => {
  162. let data
  163. if (res.status == 200) {
  164. data = res.data
  165. this.getTotal(Object.assign(parameter, this.queryParam))
  166. const no = (data.pageNo - 1) * data.pageSize
  167. for (var i = 0; i < data.list.length; i++) {
  168. data.list[i].no = no + i + 1
  169. }
  170. this.disabled = false
  171. this.total = data.count || 0
  172. }
  173. this.spinning = false
  174. return data
  175. })
  176. },
  177. total: 0, // 总条数
  178. productTotal: null // 合计
  179. }
  180. },
  181. methods: {
  182. // 时间 change
  183. dateChange (date) {
  184. this.queryParam.beginDate = date[0]
  185. this.queryParam.endDate = date[1]
  186. },
  187. // 详情
  188. handleDetail (row) {
  189. if (this.$hasPermissions('M_companyCollectionPayment_detail')) {
  190. this.$router.push({ path: `/financialManagement/companyCollectionPayment/detail/${row.id}/${row.unitSettleSn}` })
  191. }
  192. },
  193. // 导出
  194. handleExport () {
  195. const _this = this
  196. const params = this.queryParam
  197. this.exportLoading = true
  198. _this.spinning = true
  199. settleUnitListExport(params).then(res => {
  200. this.exportLoading = false
  201. _this.spinning = false
  202. downloadExcel(res, '单位收付款记录')
  203. })
  204. },
  205. // 合计
  206. getTotal (param) {
  207. settleUnitQuerySum(param).then(res => {
  208. if (res.status == 200 && res.data) {
  209. this.productTotal = res.data
  210. } else {
  211. this.productTotal = null
  212. }
  213. })
  214. },
  215. // 重置
  216. resetSearchForm () {
  217. if (this.advanced) {
  218. this.$refs.rangeDate.resetDate()
  219. }
  220. this.queryParam.beginDate = ''
  221. this.queryParam.endDate = ''
  222. this.queryParam.settleClientNameCurrent = ''
  223. this.queryParam.settleClientType = undefined
  224. this.queryParam.settleType = undefined
  225. this.queryParam.unitSettleNo = ''
  226. this.queryParam.settleStyleSn = undefined
  227. this.$refs.table.refresh(true)
  228. },
  229. // 页面初始化
  230. pageInit () {
  231. const _this = this
  232. this.$nextTick(() => { // 页面渲染完成后的回调
  233. _this.setTableH()
  234. })
  235. },
  236. // 表格高度计算
  237. setTableH () {
  238. const tableSearchH = this.$refs.tableSearch.offsetHeight
  239. this.tableHeight = window.innerHeight - tableSearchH - 230
  240. }
  241. },
  242. watch: {
  243. advanced (newValue, oldValue) {
  244. const _this = this
  245. this.$nextTick(() => { // 页面渲染完成后的回调
  246. _this.setTableH()
  247. })
  248. },
  249. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  250. this.setTableH()
  251. }
  252. },
  253. mounted () {
  254. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  255. this.pageInit()
  256. this.resetSearchForm()
  257. }
  258. },
  259. activated () {
  260. // 如果是新页签打开,则重置当前页面
  261. if (this.$store.state.app.isNewTab) {
  262. this.pageInit()
  263. this.resetSearchForm()
  264. }
  265. },
  266. beforeRouteEnter (to, from, next) {
  267. next(vm => {})
  268. }
  269. }
  270. </script>
  271. <style lang="less">
  272. .companyCollectionPaymentList-wrap{
  273. .active{
  274. color: #ed1c24;
  275. cursor: pointer;
  276. }
  277. .common{
  278. color: rgba(0, 0, 0);
  279. }
  280. }
  281. </style>