list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div class="receiptPrint-wrap">
  3. <div style="background-color: #fff;">
  4. <a-tabs v-model="currentTab" @change="changeTab">
  5. <a-tab-pane :key="1" tab="全部">
  6. </a-tab-pane>
  7. <a-tab-pane :key="2" tab="待打印">
  8. </a-tab-pane>
  9. </a-tabs>
  10. </div>
  11. <a-card style="margin-top: 5px;" size="small" :bordered="false">
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <!-- 搜索条件 -->
  14. <div ref="tableSearch" class="table-page-search-wrapper">
  15. <a-form layout="inline">
  16. <a-row :gutter="15">
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="允许打印时间">
  19. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="5" :sm="24">
  23. <a-form-item label="收款单号">
  24. <a-input id="salesCollectionList-bookNo" v-model.trim="queryParam.bookNo" allowClear placeholder="请输入备货单号"/>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :md="5" :sm="24">
  28. <a-form-item label="客户名称">
  29. <dealerSubareaScopeList ref="payerName" id="salesCollectionList-payerName" @change="custChange" />
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="4" :sm="24" v-if="currentTab == 1">
  33. <a-form-item label="收款打印状态">
  34. <v-select
  35. v-model="queryParam.printStatus"
  36. ref="printStatus"
  37. id="salesCollectionList-printStatus"
  38. code="PRINT_STATUS"
  39. placeholder="请选择打印状态"
  40. allowClear
  41. ></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="4" :sm="24">
  45. <a-form-item label="足额打款">
  46. <v-select
  47. v-model="queryParam.fullPaymentFlag"
  48. ref="fullPaymentFlag"
  49. id="salesCollectionList-fullPaymentFlag"
  50. code="FLAG"
  51. placeholder="请选择是否足额打款"
  52. allowClear></v-select>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="currentTab==2?4:24" :sm="24">
  56. <span style="float:right;" class="table-page-search-submitButtons">
  57. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  58. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  59. </span>
  60. </a-col>
  61. </a-row>
  62. </a-form>
  63. <!-- 操作按钮 -->
  64. <div class="table-operator" v-if="$hasPermissions('B_SkPrint')">
  65. <a-button type="primary" :loading="spinning" @click="handlePlPrint()" class="button-error">批量打印</a-button>
  66. <span style="margin-left: 8px">
  67. <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
  68. </span>
  69. </div>
  70. </div>
  71. <!-- 列表 -->
  72. <s-table
  73. class="sTable fixPagination"
  74. ref="table"
  75. :style="{ height: tableHeight+80.5+'px' }"
  76. :row-selection="$hasPermissions('B_SkPrint')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: (record.printStatus !== 'NO_PRINT'&&record.printStatus !== 'PRINT') } })}:null"
  77. @rowSelection="rowSelectionFun"
  78. size="small"
  79. :rowKey="(record) => record.id"
  80. :columns="columns"
  81. :data="loadData"
  82. :scroll="{ y:tableHeight }"
  83. :defaultLoadData="false"
  84. bordered>
  85. <!-- 打印状态 -->
  86. <template slot="printStatus" slot-scope="text, record">
  87. <span v-if="record.printStatus=='NO_PRINT'" class="link-bule" @click="handlePrintStatus(record)">{{ record.printStatusDictValue }}</span>
  88. <span v-else>{{ record.printStatusDictValue }}</span>
  89. </template>
  90. <!-- 操作 -->
  91. <template slot="action" slot-scope="text, record">
  92. <div>
  93. <a-button
  94. size="small"
  95. type="link"
  96. v-if="(record.printStatus == 'NO_PRINT'||record.printStatus == 'PRINT')&&$hasPermissions('B_SkPrint')"
  97. class="button-warning"
  98. @click="handlePrint(record,0,record)"
  99. >收款打印</a-button>
  100. <a-button
  101. size="small"
  102. type="link"
  103. class="button-success"
  104. v-if="record.printStatus == 'PRINT'&&$hasPermissions('B_SKPrintRecord')"
  105. @click="viewPrint(record)"
  106. >打印记录</a-button>
  107. </div>
  108. </template>
  109. </s-table>
  110. <!-- 收款打印 -->
  111. <printModel ref="printModel" @cancel="closeTipModal" @printOk="printOk"></printModel>
  112. <!-- 打印记录 -->
  113. <recordModal v-drag ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
  114. <!-- 操作提示 -->
  115. <commonModal modalTit="操作提示" okText="暂不打印" :openModal="showPrintModal" @cancel="canselModal" @ok="updatePrintStatus">
  116. <div style="display:flex;flex-direction: column;align-items: center;">
  117. <div style="margin-bottom: 15px;font-size: 14px;">如需将打印状态回退至<strong>【暂不打印】</strong>,请点击下方按钮</div>
  118. <div style="line-height: 24px;">
  119. <div>收款单号:{{ tipData&&tipData.bookNo }}</div>
  120. <div>客户名称:{{ tipData&&tipData.payerName }}</div>
  121. </div>
  122. </div>
  123. </commonModal>
  124. </a-spin>
  125. </a-card>
  126. </div>
  127. </template>
  128. <script>
  129. import { commonMixin } from '@/utils/mixin'
  130. import rangeDate from '@/views/common/rangeDate.vue'
  131. import { STable, VSelect } from '@/components'
  132. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  133. import commonModal from '@/views/common/commonModal.vue'
  134. import recordModal from './recordModal.vue'
  135. import printModel from './printModel.vue'
  136. import { financeBookDetailList, updateFinanceBookDetail, getBatchLastProcessInstance } from '@/api/financeBook'
  137. export default {
  138. name: 'ReceiptPrintList',
  139. mixins: [commonMixin],
  140. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, commonModal, recordModal, printModel },
  141. data () {
  142. return {
  143. spinning: false,
  144. advanced: true, // 高级搜索 展开/关闭
  145. disabled: false, // 查询、重置按钮是否可操作
  146. tableHeight: 0,
  147. time: [],
  148. currentTab: 2,
  149. // 查询参数
  150. queryParam: {
  151. beginDate: '',
  152. endDate: '',
  153. bookNo: '',
  154. payerName: '',
  155. subareaSn: undefined,
  156. billStatus: undefined,
  157. dealerProvinceSn: undefined,
  158. fullPaymentFlag:undefined,
  159. printStatus: 'NO_PRINT'
  160. },
  161. totalData: {
  162. totalAmount: 0,
  163. totalQty: 0,
  164. totalRecord: 0
  165. },
  166. showTipModal: false,
  167. showRecordModal: false,
  168. showPrintModal: false,
  169. tipData: null,
  170. // 加载数据方法 必须为 Promise 对象
  171. loadData: parameter => {
  172. this.disabled = true
  173. this.spinning = true
  174. if (this.currentTab == 1) {
  175. this.queryParam.isAll = '1'
  176. this.queryParam.status = 'AUDIT_PASS'
  177. }
  178. return financeBookDetailList(Object.assign(parameter, this.queryParam)).then(res => {
  179. let data
  180. if (res.status == 200) {
  181. data = res.data
  182. const no = (data.pageNo - 1) * data.pageSize
  183. for (var i = 0; i < data.list.length; i++) {
  184. data.list[i].no = no + i + 1
  185. }
  186. this.disabled = false
  187. }
  188. this.spinning = false
  189. return data
  190. })
  191. },
  192. rowSelectionInfo: null // 批量选择的数据
  193. }
  194. },
  195. computed: {
  196. columns () {
  197. const arr = [
  198. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  199. { title: '允许打印时间', dataIndex: 'allowPrintTime', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  200. { title: '收款单号', dataIndex: 'bookNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  201. { title: '收款日期', dataIndex: 'receiptDate', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  202. { title: '客户名称', dataIndex: 'payerName', align: 'left', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
  203. { title: '财务编码', dataIndex: 'dealerEntity.kdMidCustomerFnumber', align: 'left', width: '10%', customRender: function (text) { return text || '--' }, ellipsis: true },
  204. { title: '订单金额', dataIndex: 'orderAmount', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  205. { title: '收款金额', dataIndex: 'receiptAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  206. { title: '使用授信', dataIndex: 'useCreditAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  207. { title: '余款抵扣', dataIndex: 'balanceAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  208. { title: '户名', dataIndex: 'bankAccount', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  209. { title: '汇入银行', dataIndex: 'bankName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  210. { title: '足额打款', dataIndex: 'fullPaymentFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  211. { title: '说明', dataIndex: 'explainInfo', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  212. { title: '收款打印状态', dataIndex: 'printStatusDictValue', width: '6%', align: 'center', scopedSlots: { customRender: 'printStatus' } },
  213. { title: '打印次数', dataIndex: 'printNum', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  214. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  215. ]
  216. return arr
  217. }
  218. },
  219. methods: {
  220. changeTab (v) {
  221. this.currentTab = v
  222. this.pageInit()
  223. this.resetSearchForm()
  224. },
  225. // 表格选中项
  226. rowSelectionFun (obj) {
  227. this.rowSelectionInfo = obj || null
  228. },
  229. // 批量打印
  230. async handlePlPrint () {
  231. const _this = this
  232. const rows = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows || []
  233. const slen = rows.length
  234. if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && slen < 1)) {
  235. _this.$message.warning('请在列表勾选后再进行批量操作!')
  236. return false
  237. }
  238. this.spinning = true
  239. const bookSns = []
  240. rows.map(item => {
  241. if (bookSns.indexOf(item.bookSn) < 0) {
  242. bookSns.push(item.bookSn)
  243. }
  244. })
  245. const retArr = []
  246. const auditInfo = await getBatchLastProcessInstance({ 'businessType': 'FINANCE_BOOK', 'businessSnList': bookSns }).then(res => res.data)
  247. console.log(auditInfo)
  248. bookSns.map(item => {
  249. // 授信明细
  250. const rs = rows.filter(a => a.bookSn == item)
  251. let detailItemUseStr = ''
  252. rs.map(b => {
  253. if (b.detailItemUseList) {
  254. b.detailItemUseList.map((k, i) => {
  255. detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ')' + (i == b.detailItemUseList.length - 1 ? '。' : ';')
  256. })
  257. }
  258. })
  259. // 审核信息
  260. const auditStr = this.getAuditInfo(auditInfo[item])
  261. retArr.push({ audit: auditStr, detail: detailItemUseStr, subList: rs })
  262. })
  263. console.log(retArr, '------------')
  264. this.handlePrint(retArr, 1, rows, bookSns)
  265. },
  266. // 获取审核信息
  267. getAuditInfo (auditList) {
  268. let auditStr = ''
  269. if (auditList && auditList.taskVOList) {
  270. const auditLists = auditList.taskVOList.filter(item => item.userType == '审批人')
  271. auditLists.map((a, i) => {
  272. auditStr = auditStr + a.userName + '(' + a.state + ')' + (i == auditLists.length - 1 ? '。' : ';')
  273. })
  274. }
  275. return auditStr
  276. },
  277. // 收款打印
  278. async handlePrint (row, type, list, bookSns) {
  279. this.spinning = true
  280. this.showTipModal = true
  281. let detailItemUseStr = ''
  282. let auditInfo = null
  283. if (type == 0) {
  284. auditInfo = await getBatchLastProcessInstance({ 'businessType': 'FINANCE_BOOK', 'businessSnList': [list.bookSn] }).then(res => res.data)
  285. }
  286. console.log(auditInfo)
  287. this.$nextTick(() => {
  288. if (type == 0 && row.detailItemUseList) {
  289. row.detailItemUseList.map(k => {
  290. detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ');'
  291. })
  292. }
  293. // 审核信息
  294. const auditStr = auditInfo ? this.getAuditInfo(auditInfo[list.bookSn]) : ''
  295. this.$refs.printModel.getData(type ? row : [{ audit: auditStr, detail: detailItemUseStr, subList: [row] }], type ? list : [list])
  296. })
  297. },
  298. printOk () {
  299. this.spinning = false
  300. this.$refs.table.refresh()
  301. },
  302. // 时间 change
  303. dateChange (date) {
  304. this.queryParam.beginDate = date[0] ? date[0] : ''
  305. this.queryParam.endDate = date[1] ? date[1] : ''
  306. },
  307. custChange (val) {
  308. this.queryParam.payerName = val.name
  309. },
  310. handlePrintStatus (row) {
  311. this.tipData = row
  312. this.showPrintModal = true
  313. },
  314. canselModal () {
  315. this.tipData = null
  316. this.showPrintModal = false
  317. },
  318. updatePrintStatus () {
  319. updateFinanceBookDetail({ id: this.tipData.id, printStatus: 'UNABLE_PRINT' }).then(res => {
  320. if (res.status == 200) {
  321. this.canselModal()
  322. this.$message.info(res.message)
  323. this.$refs.table.refresh()
  324. }
  325. })
  326. },
  327. closeTipModal () {
  328. this.showTipModal = false
  329. this.spinning = false
  330. this.$refs.printModel.clearData()
  331. },
  332. // 打印记录
  333. viewPrint (row) {
  334. this.showRecordModal = true
  335. this.$refs.recordModal.setData(row, {
  336. billType: 'FINANCE_BOOK_DETAIL',
  337. billSn: row.bookDetailSn,
  338. billNo: row.bookNo
  339. })
  340. },
  341. // 重置
  342. resetSearchForm () {
  343. this.time = []
  344. this.$refs.rangeDate.resetDate(this.time)
  345. this.$refs.payerName.resetForm()
  346. this.queryParam = {
  347. beginDate: '',
  348. endDate: '',
  349. bookNo: '',
  350. payerName: '',
  351. subareaSn: undefined,
  352. billStatus: undefined,
  353. dealerProvinceSn: undefined,
  354. fullPaymentFlag:undefined,
  355. printStatus: this.currentTab == 2 ? 'NO_PRINT' : undefined
  356. }
  357. this.$refs.table.refresh(true)
  358. this.$refs.table.clearSelected()
  359. },
  360. pageInit () {
  361. const _this = this
  362. this.$nextTick(() => { // 页面渲染完成后的回调
  363. _this.setTableH()
  364. })
  365. },
  366. setTableH () {
  367. const tableSearchH = this.$refs.tableSearch.offsetHeight
  368. this.tableHeight = window.innerHeight - tableSearchH - 250
  369. }
  370. },
  371. watch: {
  372. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  373. this.setTableH()
  374. }
  375. },
  376. mounted () {
  377. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  378. this.pageInit()
  379. this.resetSearchForm()
  380. }
  381. },
  382. activated () {
  383. // 如果是新页签打开,则重置当前页面
  384. if (this.$store.state.app.isNewTab) {
  385. this.pageInit()
  386. this.resetSearchForm()
  387. }
  388. // 仅刷新列表,不重置页面
  389. if (this.$store.state.app.updateList) {
  390. this.pageInit()
  391. this.$refs.table.refresh()
  392. }
  393. },
  394. beforeRouteEnter (to, from, next) {
  395. next(vm => {})
  396. }
  397. }
  398. </script>
  399. <style lang="less">
  400. .receiptPrint-wrap{
  401. .sTable{
  402. margin-top: 10px;
  403. }
  404. .ant-tabs-bar{
  405. margin:0;
  406. }
  407. }
  408. </style>