list.vue 14 KB

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