list.vue 10 KB

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