list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <a-card size="small" :bordered="false" class="financialCollectionList-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 ref="rangeDate" :value="creatDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="收款单号">
  15. <a-input id="financialCollectionList-bookNo" v-model.trim="queryParam.bookNo" allowClear placeholder="请输入收款单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="关联单据单号">
  20. <a-input id="financialCollectionList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入关联单据单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="申请人">
  26. <employee style="width: 100%;" id="financialCollectionList-Employee" placeholder="请选择申请人" v-model="queryParam.applyPersonSn"></employee>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="收款事由">
  31. <a-input id="financialCollectionList-bookReason" v-model.trim="queryParam.bookReason" allowClear placeholder="请输入收款事由"/>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="付款方类型">
  36. <v-select
  37. v-model="queryParam.payerType"
  38. ref="payType"
  39. code="PAYER_TYPE"
  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. <a-input id="financialCollectionList-payerNames" v-model.trim="queryParam.payerName" allowClear placeholder="请输入付款方"/>
  47. </a-form-item>
  48. </a-col>
  49. <a-col :md="6" :sm="24">
  50. <a-form-item label="审核时间">
  51. <rangeDate ref="rangeAuditDate" :value="auditDate" @change="dateAuditChange" />
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="6" :sm="24">
  55. <a-form-item label="状态">
  56. <v-select
  57. v-model="queryParam.status"
  58. ref="status"
  59. id="financialCollectionList-status"
  60. code="FINANCE_BOOK_STATE"
  61. placeholder="请选择状态"
  62. allowClear></v-select>
  63. </a-form-item>
  64. </a-col>
  65. </template>
  66. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  67. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="financialCollectionList-refresh">查询</a-button>
  68. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
  69. <a @click="advanced=!advanced" style="margin-left: 5px">
  70. {{ advanced ? '收起' : '展开' }}
  71. <a-icon :type="advanced ? 'up' : 'down'"/>
  72. </a>
  73. </a-col>
  74. </a-row>
  75. </a-form>
  76. <!-- 操作按钮 -->
  77. <div class="table-operator" v-if="$hasPermissions('B_fc_new')">
  78. <a-button type="primary" class="button-error" @click="handleAdd">新增</a-button>
  79. </div>
  80. <a-alert type="info" style="margin-bottom:10px">
  81. <div slot="message">
  82. 订单总金额:{{ toThousands(countData&&countData.orderTotalAmount||0) }}
  83. 收款总金额:{{ toThousands(countData&&countData.receiptTotalAmount||0) }}
  84. 使用授信总金额:{{ toThousands(countData&&countData.useTotalAmount||0) }}
  85. 授信还款总金额:{{ toThousands(countData&&countData.payTotalAmount||0) }}
  86. 余款抵扣总金额:{{ toThousands(countData&&countData.balanceTotalAmount||0) }}
  87. </div>
  88. </a-alert>
  89. </div>
  90. <!-- 列表 -->
  91. <s-table
  92. class="sTable fixPagination"
  93. ref="table"
  94. :style="{ height: tableHeight+84.5+'px' }"
  95. size="small"
  96. :rowKey="(record) => record.id"
  97. :columns="columns"
  98. :data="loadData"
  99. :scroll="{ y: tableHeight }"
  100. :defaultLoadData="false"
  101. bordered>
  102. <!-- 单号 -->
  103. <template slot="bookNo" slot-scope="text, record">
  104. <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="handleDetail(record)">{{ record.bookNo }}</span>
  105. <span v-else>{{ record.bookNo }}</span>
  106. </template>
  107. <!-- 关联备货单 -->
  108. <template slot="dispatchNum" slot-scope="text, record">
  109. <span v-if="$hasPermissions('B_glDispatch')&&record.dispatchNum" class="link-bule" @click="handleBhDetail(record)">{{ record.dispatchNum }}</span>
  110. <span v-else>--</span>
  111. </template>
  112. <!-- 操作 -->
  113. <template slot="action" slot-scope="text, record">
  114. <a-button
  115. v-if="record.status=='WAIT_SUBMIT'&&$hasPermissions('B_fc_edit')"
  116. size="small"
  117. type="link"
  118. class="button-info"
  119. @click="handleEdit(record)"
  120. >
  121. 编辑
  122. </a-button>
  123. <a-button
  124. v-if="record.status=='WAIT_SUBMIT'&&$hasPermissions('B_fc_del')"
  125. size="small"
  126. type="link"
  127. class="button-error"
  128. @click="handleDel(record)"
  129. >
  130. 删除
  131. </a-button>
  132. <a-button
  133. v-if="record.status!='WAIT_SUBMIT'&&$hasPermissions('B_fc_Audit')"
  134. size="small"
  135. type="link"
  136. class="button-info"
  137. @click="handleSH(record)"
  138. >
  139. 审核进度
  140. </a-button>
  141. <a-button
  142. v-if="record.status=='AUDIT_REJECT'&&$hasPermissions('B_againEdit')"
  143. size="small"
  144. type="link"
  145. class="button-info"
  146. @click="againEdit(record)"
  147. >
  148. 再次编辑
  149. </a-button>
  150. </template>
  151. </s-table>
  152. </a-spin>
  153. <!-- 审核进度 -->
  154. <verifyModal v-drag :openModal="openModal" :itemSn="itemSn" @close="openModal=false"></verifyModal>
  155. <!-- 基础信息 -->
  156. <baseModal v-drag :show="baseModal" @cancel="baseModal=false"></baseModal>
  157. <!-- 关联备货单 -->
  158. <dispatchModal v-drag ref="openDisModal" :openModal="openDisModal" :itemSn="itemSn" @close="openDisModal=false"></dispatchModal>
  159. </a-card>
  160. </template>
  161. <script>
  162. import { commonMixin } from '@/utils/mixin'
  163. import { STable, VSelect } from '@/components'
  164. import rangeDate from '@/views/common/rangeDate.vue'
  165. import baseModal from './baseModal.vue'
  166. import employee from '../../expenseManagement/expenseReimbursement/employee.js'
  167. import verifyModal from './verifyModal.vue'
  168. import dispatchModal from './dispatchModal.vue'
  169. import { financeBookQueryPage, financeBookDeleteBySn, financeBookDgainEditBySn, financeBookQueryCount } from '@/api/financeBook.js'
  170. export default {
  171. name: 'FinancialCollectionList',
  172. mixins: [commonMixin],
  173. components: { STable, VSelect, rangeDate, baseModal, employee, verifyModal, dispatchModal },
  174. data () {
  175. return {
  176. spinning: false,
  177. openModal: false,
  178. openDisModal: false,
  179. baseModal: false,
  180. tableHeight: 0,
  181. queryParam: { // 查询条件
  182. payerType: '',
  183. beginDate: '',
  184. endDate: '',
  185. bookNo: '',
  186. dispatchBillNo: '',
  187. auditBeginDate: '',
  188. auditEndDate: '',
  189. applyPersonSn: undefined,
  190. bookReason: '',
  191. status: undefined,
  192. payerName: ''
  193. },
  194. disabled: false, // 查询、重置按钮是否可操作
  195. creatDate: [], // 创建时间
  196. auditDate: [], // 审核时间
  197. advanced: false,
  198. itemSn: null,
  199. // 加载数据方法 必须为 Promise 对象
  200. loadData: parameter => {
  201. this.disabled = true
  202. this.spinning = true
  203. const params = Object.assign(parameter, this.queryParam)
  204. return financeBookQueryPage(params).then(res => {
  205. let data
  206. if (res.status == 200) {
  207. data = res.data
  208. const no = (data.pageNo - 1) * data.pageSize
  209. for (var i = 0; i < data.list.length; i++) {
  210. data.list[i].no = no + i + 1
  211. }
  212. this.total = data.count || 0
  213. this.disabled = false
  214. }
  215. this.spinning = false
  216. this.getCount(params)
  217. return data
  218. })
  219. },
  220. total: 0, // 合计
  221. countData: null
  222. }
  223. },
  224. // 根据权限显示列表字段
  225. computed: {
  226. columns () {
  227. const arr = [
  228. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  229. { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  230. { title: '收款单号', scopedSlots: { customRender: 'bookNo' }, width: '8%', align: 'center' },
  231. { title: '关联单据', scopedSlots: { customRender: 'dispatchNum' }, width: '6%', align: 'center' },
  232. { title: '申请人', dataIndex: 'applyPersonName', align: 'center', width: '5%', customRender: function (text) { return text || '--' } },
  233. { title: '收款事由', dataIndex: 'bookReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  234. { title: '付款方', dataIndex: 'payerName', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  235. { title: '订单总金额', dataIndex: 'orderTotalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  236. { title: '收款总金额', dataIndex: 'receiptTotalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  237. { title: '使用授信总金额', dataIndex: 'useTotalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  238. { title: '授信还款总金额', dataIndex: 'payTotalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  239. { title: '余款抵扣总金额', dataIndex: 'balanceTotalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  240. { title: '审核时间', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  241. { title: '状态', dataIndex: 'statusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  242. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  243. ]
  244. return arr
  245. }
  246. },
  247. methods: {
  248. getCount (params) {
  249. financeBookQueryCount(params).then(res => {
  250. this.countData = res.data
  251. })
  252. },
  253. // 创建时间 change
  254. dateChange (date) {
  255. this.queryParam.beginDate = date[0] ? date[0] : ''
  256. this.queryParam.endDate = date[1] ? date[1] : ''
  257. },
  258. // 审核时间 change
  259. dateAuditChange (date) {
  260. this.queryParam.auditBeginDate = date[0] ? date[0] : ''
  261. this.queryParam.auditEndDate = date[1] ? date[1] : ''
  262. },
  263. // 重置
  264. resetSearchForm () {
  265. this.creatDate = []
  266. this.$refs.rangeDate.resetDate(this.creatDate)
  267. this.queryParam.beginDate = ''
  268. this.queryParam.endDate = ''
  269. this.auditDate = []
  270. if (this.advanced) {
  271. this.$refs.rangeAuditDate.resetDate(this.auditDate)
  272. }
  273. this.queryParam.payerName = ''
  274. this.queryParam.auditBeginDate = ''
  275. this.queryParam.auditEndDate = ''
  276. this.queryParam.bookNo = ''
  277. this.queryParam.dispatchBillNo = ''
  278. this.queryParam.applyPersonSn = undefined
  279. this.queryParam.bookReason = ''
  280. this.queryParam.status = undefined
  281. this.queryParam.payerType = undefined
  282. this.$refs.table.refresh(true)
  283. },
  284. // 新增
  285. handleAdd () {
  286. this.baseModal = true
  287. },
  288. // 查看关联备货单
  289. handleBhDetail (row) {
  290. this.openDisModal = true
  291. this.itemSn = row.bookSn
  292. this.$nextTick(() => {
  293. this.$refs.openDisModal.setDetail(row)
  294. })
  295. },
  296. // 详情
  297. handleDetail (row) {
  298. this.$router.push({ name: 'financialCollectionDetail', params: { sn: row.bookSn } })
  299. },
  300. // 编辑
  301. handleEdit (row) {
  302. this.$router.push({ name: 'financialCollectionEdit', params: { sn: row.bookSn } })
  303. },
  304. // 删除
  305. handleDel (row) {
  306. const _this = this
  307. this.$confirm({
  308. title: '提示',
  309. content: '确认要删除吗?',
  310. centered: true,
  311. closable: true,
  312. onOk () {
  313. _this.spinning = true
  314. financeBookDeleteBySn({ bookSn: row.bookSn }).then(res => {
  315. if (res.status == 200) {
  316. _this.$message.success(res.message)
  317. _this.$refs.table.refresh()
  318. _this.spinning = false
  319. } else {
  320. _this.spinning = false
  321. }
  322. })
  323. }
  324. })
  325. },
  326. // 审核进度
  327. handleSH (row) {
  328. this.openModal = true
  329. this.itemSn = row.bookSn
  330. },
  331. // 再次编辑
  332. againEdit (row) {
  333. const _this = this
  334. this.$confirm({
  335. title: '操作提示',
  336. content: '系统将自动生成一个新的财务收款单,与原审核不通过的单据内容相同。您可以对新单据进行编辑、提交等操作,原单据保持不变,确认操作吗?',
  337. centered: true,
  338. closable: true,
  339. onOk () {
  340. _this.spinning = true
  341. financeBookDgainEditBySn({ bookSn: row.bookSn }).then(res => {
  342. if (res.status == 200) {
  343. _this.$message.success(res.message)
  344. _this.resetSearchForm()
  345. }
  346. _this.spinning = false
  347. })
  348. }
  349. })
  350. },
  351. pageInit () {
  352. const _this = this
  353. this.$nextTick(() => { // 页面渲染完成后的回调
  354. _this.setTableH()
  355. })
  356. },
  357. setTableH () {
  358. const tableSearchH = this.$refs.tableSearch.offsetHeight
  359. this.tableHeight = window.innerHeight - tableSearchH - 210
  360. }
  361. },
  362. watch: {
  363. advanced (newValue, oldValue) {
  364. const _this = this
  365. this.$nextTick(() => { // 页面渲染完成后的回调
  366. _this.setTableH()
  367. })
  368. },
  369. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  370. this.setTableH()
  371. }
  372. },
  373. mounted () {
  374. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  375. this.pageInit()
  376. this.resetSearchForm()
  377. }
  378. },
  379. activated () {
  380. // 如果是新页签打开,则重置当前页面
  381. if (this.$store.state.app.isNewTab) {
  382. this.pageInit()
  383. this.resetSearchForm()
  384. }
  385. // 仅刷新列表,不重置页面
  386. if (this.$store.state.app.updateList) {
  387. this.pageInit()
  388. this.$refs.table.refresh()
  389. }
  390. },
  391. beforeRouteEnter (to, from, next) {
  392. next(vm => {})
  393. }
  394. }
  395. </script>
  396. <style lang="less">
  397. .financialCollectionList-wrap{
  398. .active{
  399. color: #ed1c24;
  400. cursor: pointer;
  401. }
  402. .common{
  403. color: rgba(0, 0, 0);
  404. }
  405. }
  406. </style>