list.vue 16 KB

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