FinancialListMixin.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. import {
  2. findFinancialDetailByNumber,
  3. findBySelectSup,
  4. findBySelectCus,
  5. findBySelectOrgan,
  6. findBySelectRetail,
  7. getUserList,
  8. getPersonByType,
  9. getAccount,
  10. getCurrentSystemConfig,
  11. getPlatformConfigByKey,
  12. findInOutItemByParam,
  13. } from '@/api/api'
  14. import { getCheckFlag, getFormatDate, getPrevMonthFormatDate } from '@/utils/util'
  15. import Vue from 'vue'
  16. import moment from 'moment'
  17. export const FinancialListMixin = {
  18. data() {
  19. return {
  20. /* 原始审核是否开启 */
  21. checkFlag: true,
  22. /* 单据Excel是否开启 */
  23. isShowExcel: false,
  24. billExcelUrl: '',
  25. prefixNo: '',
  26. supList: [],
  27. cusList: [],
  28. organList: [],
  29. retailList: [],
  30. userList: [],
  31. personList: [],
  32. accountList: [],
  33. inOutItemList: [],
  34. queryParam: {
  35. beginTime: getPrevMonthFormatDate(3),
  36. endTime: getFormatDate(),
  37. createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())],
  38. },
  39. }
  40. },
  41. computed: {
  42. importExcelUrl: function () {
  43. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  44. },
  45. isBatchDelEnabled: function () {
  46. for (let i = 0; i < this.selectedRowKeys.length; i++) {
  47. if (!this.selectionRows[i].actionsEnabled.delete) {
  48. return false
  49. }
  50. }
  51. return true
  52. },
  53. },
  54. created() {
  55. this.isShowExcel = Vue.ls.get('isShowExcel')
  56. },
  57. methods: {
  58. myHandleAdd() {
  59. this.$refs.modalForm.action = 'add'
  60. if (this.btnEnableList.indexOf(2) === -1) {
  61. this.$refs.modalForm.isCanCheck = false
  62. }
  63. this.handleAdd()
  64. },
  65. myHandleEdit(record) {
  66. if (record.status === '0') {
  67. this.$refs.modalForm.action = 'edit'
  68. if (this.btnEnableList.indexOf(2) === -1) {
  69. this.$refs.modalForm.isCanCheck = false
  70. }
  71. //查询单条财务信息
  72. findFinancialDetailByNumber({ billNo: record.billNo }).then((res) => {
  73. if (res && res.code === 200) {
  74. let item = res.data
  75. this.handleEdit(item)
  76. }
  77. })
  78. } else {
  79. this.$message.warning('抱歉,只有未审核的单据才能编辑!')
  80. }
  81. },
  82. myHandleDelete(record) {
  83. if (record.status === '0') {
  84. this.handleDelete(record.id)
  85. } else {
  86. this.$message.warning('抱歉,只有未审核的单据才能删除!')
  87. }
  88. },
  89. myHandleDetail(record, type, prefixNo) {
  90. if (this.btnEnableList.indexOf(7) === -1) {
  91. this.$refs.modalDetail.isCanBackCheck = false
  92. }
  93. this.handleDetail(record, type, prefixNo)
  94. },
  95. handleApprove(record) {
  96. this.$refs.modalForm.action = 'approve'
  97. this.$refs.modalForm.edit(record)
  98. this.$refs.modalForm.title = '审核'
  99. },
  100. searchReset() {
  101. this.queryParam = {
  102. type: this.queryParam.type,
  103. beginTime: getPrevMonthFormatDate(3),
  104. endTime: getFormatDate(),
  105. createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())],
  106. }
  107. this.loadData(1)
  108. },
  109. initSystemConfig() {
  110. getCurrentSystemConfig().then((res) => {
  111. if (res.code === 200 && res.data) {
  112. let multiBillType = res.data.multiBillType
  113. let multiLevelApprovalFlag = res.data.multiLevelApprovalFlag
  114. this.checkFlag = getCheckFlag(multiBillType, multiLevelApprovalFlag, this.prefixNo)
  115. }
  116. })
  117. getPlatformConfigByKey({ platformKey: 'bill_excel_url' }).then((res) => {
  118. if (res && res.code === 200) {
  119. if (res.data.platformValue) {
  120. this.billExcelUrl = res.data.platformValue
  121. }
  122. }
  123. })
  124. },
  125. initSupplier() {
  126. let that = this
  127. findBySelectSup({}).then((res) => {
  128. if (res) {
  129. that.supList = res
  130. }
  131. })
  132. },
  133. initCustomer() {
  134. let that = this
  135. findBySelectCus({}).then((res) => {
  136. if (res) {
  137. that.cusList = res
  138. }
  139. })
  140. },
  141. initOrgan() {
  142. let that = this
  143. findBySelectOrgan({}).then((res) => {
  144. if (res) {
  145. that.organList = res
  146. }
  147. })
  148. },
  149. initRetail() {
  150. let that = this
  151. findBySelectRetail({}).then((res) => {
  152. if (res) {
  153. that.retailList = res
  154. }
  155. })
  156. },
  157. initUser() {
  158. getUserList({}).then((res) => {
  159. if (res) {
  160. this.userList = res
  161. }
  162. })
  163. },
  164. initPerson() {
  165. let that = this
  166. getPersonByType({ type: '财务员' }).then((res) => {
  167. if (res && res.code === 200) {
  168. that.personList = res.data.personList
  169. }
  170. })
  171. },
  172. initAccount() {
  173. getAccount({}).then((res) => {
  174. if (res && res.code === 200) {
  175. this.accountList = res.data.accountList
  176. }
  177. })
  178. },
  179. initInOutItem(type) {
  180. findInOutItemByParam({ type: type }).then((res) => {
  181. if (res) {
  182. this.inOutItemList = res
  183. }
  184. })
  185. },
  186. onDateChange: function (value, dateString) {
  187. this.queryParam.beginTime = dateString[0]
  188. this.queryParam.endTime = dateString[1]
  189. if (dateString[0] && dateString[1]) {
  190. this.queryParam.createTimeRange = [moment(dateString[0]), moment(dateString[1])]
  191. }
  192. },
  193. onDateOk(value) {
  194. console.log(value)
  195. },
  196. //导出单据
  197. handleExport() {
  198. let search = this.getQueryParams().search
  199. this.$refs.billExcelIframe.show(this.model, this.billExcelUrl + '?search=' + search + '&type=2', 150)
  200. this.$refs.billExcelIframe.title = '确认导出'
  201. },
  202. },
  203. }