list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  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="manualEntryForm-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="manualEntryForm-dealerName" v-model.trim="queryParam.changeNo" allowClear placeholder="请输入调账单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="客户名称">
  20. <dealerSubareaScopeList id="accountStatement-dealerName" ref="dealer" @change="custChange"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="借贷类型">
  25. <v-select
  26. v-model="queryParam.changeType"
  27. ref="changeType"
  28. id="conFrontModal-changeType"
  29. code="VERIFY_ACCOUNT_CHANGE_TYPE"
  30. placeholder="请选择借贷类型"
  31. allowClear></v-select>
  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.status"
  38. ref="status"
  39. id="conFrontModal-status"
  40. code="VERIFY_ACCOUNT_CHANGE_STATUS"
  41. placeholder="请选择状态"
  42. allowClear></v-select>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  46. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="manualEntryForm-refresh">查询</a-button>
  47. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="manualEntryForm-reset">重置</a-button>
  48. <a-button
  49. style="margin-left: 10px"
  50. type="primary"
  51. class="button-warning"
  52. @click="handleExport"
  53. :disabled="disabled"
  54. :loading="exportLoading"
  55. v-if="$hasPermissions('B_promotionFeeExport')"
  56. id="manualEntryForm-export">导出</a-button>
  57. <a @click="advanced=!advanced" style="margin-left: 5px">
  58. </a></a-col>
  59. </a-row>
  60. </a-form>
  61. </div>
  62. </a-card>
  63. <a-card size="small" :bordered="false" class="manualEntryForm-wrap">
  64. <!-- 操作按钮 -->
  65. <div class="table-operator">
  66. <div class="flex-center">
  67. <a-button type="primary" @click="handleAdd" v-if="$hasPermissions('B_vac_creat')">调账</a-button>
  68. <div class="tongji-bar"></div>
  69. </div>
  70. <div></div>
  71. </div>
  72. <a-spin :spinning="spinning" tip="Loading...">
  73. <!-- 列表 -->
  74. <s-table
  75. class="sTable fixPagination"
  76. ref="table"
  77. :style="{ height: tableHeight+80+'px' }"
  78. size="small"
  79. :rowKey="(record) => record.id"
  80. :columns="columns"
  81. :data="loadData"
  82. :scroll="{ y: tableHeight }"
  83. :pageSize="30"
  84. :defaultLoadData="false"
  85. bordered>
  86. <template slot="actions" slot-scope="text, record">
  87. <a-button
  88. size="small"
  89. type="link"
  90. v-if="record.status=='WAIT_SUBMIT'&&$hasPermissions('B_vac_edit')"
  91. class="button-info"
  92. @click="handleEdit(record)"
  93. >
  94. 编辑
  95. </a-button>
  96. <a-button
  97. v-if="record.status=='WAIT_SUBMIT'&&$hasPermissions('B_vac_del')"
  98. size="small"
  99. type="link"
  100. class="button-error"
  101. @click="handleDel(record)"
  102. >
  103. 删除
  104. </a-button>
  105. <a-button
  106. v-if="record.status!='WAIT_SUBMIT'&&$hasPermissions('B_vac_auditStatus')"
  107. size="small"
  108. type="link"
  109. @click="auditStatus(record)"
  110. class="button-info"
  111. >
  112. 审核进度
  113. </a-button>
  114. </template>
  115. </s-table>
  116. </a-spin>
  117. </a-card>
  118. <!-- 审核进度 -->
  119. <verifyModal v-drag :openModal="openModal" :itemSn="itemSn" ref="verifyModal" @close="openModal=false"></verifyModal>
  120. <!-- 基础信息 -->
  121. <baseModal v-drag :show="baseModal" :itemSn="itemSn" @cancel="baseModal=false" @ok="hanldAudit"></baseModal>
  122. <!-- 提交 选择审批人员 -->
  123. <chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSave"></chooseDepartUserModal>
  124. </div>
  125. </template>
  126. <script>
  127. import { commonMixin } from '@/utils/mixin'
  128. import { STable, VSelect } from '@/components'
  129. import { hdExportExcel } from '@/libs/exportExcel'
  130. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  131. import rangeDate from '@/views/common/rangeDate.vue'
  132. import baseModal from './baseModal.vue'
  133. import verifyModal from './verifyModal.vue'
  134. import chooseDepartUserModal from './chooseDepartUserModal.vue'
  135. import { verifyAccountChangeList, verifyAcountBillSubmit, verifyAccountChangeDel, verifyAccountChangeExport } from '@/api/verifyAccountChange.js'
  136. export default {
  137. name: 'ManualEntryFormList',
  138. mixins: [commonMixin],
  139. components: { STable, VSelect, rangeDate, baseModal, chooseDepartUserModal, dealerSubareaScopeList, verifyModal },
  140. data () {
  141. return {
  142. spinning: false,
  143. baseModal: false,
  144. openModal: false,
  145. exportLoading: false, // 导出按钮加载状态
  146. tableHeight: 0,
  147. queryParam: { // 查询条件
  148. beginDate: '',
  149. endDate: '',
  150. changeNo: '',
  151. dealerName: '',
  152. changeType: undefined,
  153. status: undefined
  154. },
  155. creatDate: [], // 创建时间
  156. disabled: false, // 查询、重置按钮是否可操作
  157. advanced: true,
  158. openDepartUserModal: false,
  159. // 加载数据方法 必须为 Promise 对象
  160. loadData: parameter => {
  161. this.disabled = true
  162. this.spinning = true
  163. const params = Object.assign(parameter, this.queryParam)
  164. return verifyAccountChangeList(params).then(res => {
  165. let data
  166. if (res.status == 200) {
  167. data = res.data
  168. const no = (data.pageNo - 1) * data.pageSize
  169. for (var i = 0; i < data.list.length; i++) {
  170. data.list[i].no = no + i + 1
  171. // 借方
  172. if (data.list[i].changeType == 'DEBIT') {
  173. data.list[i].borrowAmount = this.toThousands(data.list[i].changeAmount, 2)
  174. }
  175. // 贷方
  176. if (data.list[i].changeType == 'LENDER') {
  177. data.list[i].loanAmount = this.toThousands(data.list[i].changeAmount * -1, 2)
  178. }
  179. }
  180. this.total = data.count || 0
  181. this.disabled = false
  182. }
  183. this.spinning = false
  184. return data
  185. })
  186. },
  187. total: 0, // 合计
  188. itemSn: null
  189. }
  190. },
  191. // 根据权限显示列表字段
  192. computed: {
  193. columns () {
  194. const arr = [
  195. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  196. { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  197. { title: '调账单号', dataIndex: 'changeNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  198. { title: '客户名称', dataIndex: 'dealerName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  199. { title: '借方', dataIndex: 'borrowAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  200. { title: '贷方', dataIndex: 'loanAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  201. { title: '备注', dataIndex: 'remarks', width: '30%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  202. { title: '审核时间', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  203. { title: '状态', dataIndex: 'statusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  204. { title: '操作', scopedSlots: { customRender: 'actions' }, width: '8%', align: 'center' }
  205. ]
  206. return arr
  207. }
  208. },
  209. methods: {
  210. // 创建时间 change
  211. dateChange (date) {
  212. this.queryParam.beginDate = date[0] ? date[0] : ''
  213. this.queryParam.endDate = date[1] ? date[1] : ''
  214. },
  215. // 导出
  216. handleExport () {
  217. const _this = this
  218. const params = _this.queryParam
  219. _this.exportLoading = true
  220. _this.spinning = true
  221. hdExportExcel(verifyAccountChangeExport, params, '人工录入单', function () {
  222. _this.exportLoading = false
  223. _this.spinning = false
  224. })
  225. },
  226. // 客户
  227. custChange (v) {
  228. if (v && v.key) {
  229. this.queryParam.dealerSn = v.key
  230. this.queryParam.dealerName = v.row ? v.row.dealerName : ''
  231. } else {
  232. this.queryParam.dealerSn = ''
  233. this.queryParam.dealerName = ''
  234. }
  235. },
  236. // 重置
  237. resetSearchForm () {
  238. this.creatDate = []
  239. this.$refs.rangeDate.resetDate(this.creatDate)
  240. this.queryParam.beginDate = ''
  241. this.queryParam.endDate = ''
  242. this.queryParam.changeNo = ''
  243. this.queryParam.dealerName = ''
  244. this.queryParam.dealerSn = ''
  245. if (this.$refs.dealer) {
  246. this.$refs.dealer.resetForm()
  247. }
  248. this.queryParam.changeType = undefined
  249. this.queryParam.status = undefined
  250. this.$refs.table.refresh(true)
  251. },
  252. // 审核进度
  253. auditStatus (row) {
  254. this.openModal = true
  255. this.itemSn = row.changeSn
  256. },
  257. // 删除
  258. handleDel (row) {
  259. const _this = this
  260. this.$confirm({
  261. title: '提示(' + row.dealerName + ')',
  262. content: <div style="font-size:14px;"><div>调账单号:{row.changeNo}</div><div>确定删除吗?</div></div>,
  263. centered: true,
  264. closable: true,
  265. onOk () {
  266. _this.spinning = true
  267. verifyAccountChangeDel({ sn: row.changeSn }).then(res => {
  268. if (res.status == 200) {
  269. _this.$message.success(res.message)
  270. _this.$refs.table.refresh()
  271. }
  272. _this.spinning = false
  273. })
  274. }
  275. })
  276. },
  277. // 调账
  278. handleAdd () {
  279. this.itemSn = null
  280. this.baseModal = true
  281. },
  282. // 编辑
  283. handleEdit (row) {
  284. this.itemSn = row.changeSn
  285. this.baseModal = true
  286. },
  287. // 审核提交弹框
  288. hanldAudit (data) {
  289. this.$refs.table.refresh()
  290. this.itemSn = data.changeSn
  291. this.openDepartUserModal = true
  292. },
  293. // 提交审核人员
  294. handleSave (data) {
  295. verifyAcountBillSubmit({ changeSn: this.itemSn, ...data }).then(res => {
  296. if (res.status == 200) {
  297. this.$message.success('提交成功')
  298. this.openDepartUserModal = false
  299. this.$refs.table.refresh()
  300. }
  301. })
  302. },
  303. pageInit () {
  304. const _this = this
  305. this.$nextTick(() => { // 页面渲染完成后的回调
  306. _this.setTableH()
  307. })
  308. },
  309. setTableH () {
  310. const tableSearchH = this.$refs.tableSearch.offsetHeight
  311. this.tableHeight = window.innerHeight - tableSearchH - 250
  312. }
  313. },
  314. watch: {
  315. advanced (newValue, oldValue) {
  316. const _this = this
  317. this.$nextTick(() => { // 页面渲染完成后的回调
  318. _this.setTableH()
  319. })
  320. },
  321. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  322. this.setTableH()
  323. }
  324. },
  325. mounted () {
  326. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  327. this.pageInit()
  328. this.resetSearchForm()
  329. }
  330. },
  331. activated () {
  332. // 如果是新页签打开,则重置当前页面
  333. if (this.$store.state.app.isNewTab) {
  334. this.pageInit()
  335. this.resetSearchForm()
  336. }
  337. // 仅刷新列表,不重置页面
  338. if (this.$store.state.app.updateList) {
  339. this.pageInit()
  340. this.$refs.table.refresh()
  341. }
  342. },
  343. beforeRouteEnter (to, from, next) {
  344. next(vm => {})
  345. }
  346. }
  347. </script>
  348. <style lang="less">
  349. .manualEntryForm-wrap{
  350. .active{
  351. color: #ed1c24;
  352. cursor: pointer;
  353. }
  354. .common{
  355. color: rgba(0, 0, 0);
  356. }
  357. }
  358. </style>