list.vue 10 KB

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