reimbursementList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="page">
  3. <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
  4. <el-form-item prop="businessCode">
  5. <el-input size="small" v-model="searchForm.businessCode" placeholder="业务编号" clearable></el-input>
  6. </el-form-item>
  7. <el-form-item prop="invoiceNumber">
  8. <el-input size="small" v-model="searchForm.invoiceNumber" placeholder="发票号码" clearable></el-input>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
  12. <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
  13. </el-form-item>
  14. </el-form>
  15. <div class="bg-white top">
  16. <vxe-toolbar :refresh="{query: refreshList}" export print custom>
  17. <template #buttons>
  18. <el-row>
  19. <el-upload style="float: left"
  20. class="upload-demo"
  21. :on-success="uploadSuccess"
  22. :show-file-list="false"
  23. :before-upload="beforeUpload"
  24. :action="`${$http.BASE_URL}/reimbursement/uploadFile`"
  25. multiple
  26. list-type="picture">
  27. <el-button size="small"
  28. icon="el-icon-upload"
  29. type="primary">点击上传</el-button>
  30. </el-upload>
  31. <el-button style="margin-left: 10px" v-if="hasPermission('reimbursement:del')" :disabled="$refs.xTree && $refs.xTree.getCheckboxRecords().length === 0" type="danger" size="small" icon="el-icon-delete" @click="del()" plain>删除</el-button>
  32. <el-button style="margin-left: 10px" v-if="hasPermission('reimbursement:edit')" :disabled="$refs.xTree && $refs.xTree.getCheckboxRecords().length === 0" type="primary" size="small" icon="el-icon-edit" @click="editInvoiceGatheringTime()" plain>批量收款</el-button>
  33. </el-row>
  34. </template>
  35. </vxe-toolbar>
  36. <div style="height: calc(100% - 80px);">
  37. <vxe-table
  38. ref="xTree"
  39. border="inner"
  40. auto-resize
  41. resizable
  42. height="auto"
  43. row-id="id"
  44. size="small"
  45. show-header-overflow
  46. show-overflow
  47. highlight-hover-row
  48. :print-config="{}"
  49. :export-config="{}"
  50. :tree-config="{expandAll: true}"
  51. :loading="loading"
  52. :checkbox-config="{labelField: ''}"
  53. :data="dataList">
  54. <vxe-column type="checkbox" width="40px"> </vxe-column>
  55. <vxe-column width="140px" title="业务编号" field="businessCode" align="left" tree-node >
  56. <template slot-scope="scope">
  57. <el-link type="primary" :underline="false" v-if="scope.row.parentId == '0'" @click="view(scope.row.id)">{{scope.row.businessCode}}</el-link>
  58. <span v-else></span>
  59. </template>
  60. </vxe-column>
  61. <vxe-column width="100px" title="发票代码" field="invoiceCode" align="center" ></vxe-column>
  62. <vxe-column width="100px" title="发票号码" field="invoiceNumber" align="center">
  63. <template slot-scope="scope">
  64. <el-link type="primary" :underline="false" v-if="hasPermission('reimbursement:view') && scope.row.parentId !== '0'" @click="viewInvoice(scope.row.id)">{{scope.row.invoiceNumber}}</el-link>
  65. <span v-else></span>
  66. </template>
  67. </vxe-column>
  68. <vxe-column width="100px" title="金额" field="money" align="center"></vxe-column>
  69. <vxe-column width="100px" title="税额" field="tax" align="center"></vxe-column>
  70. <vxe-column width="100px" title="收入" field="income" align="center"></vxe-column>
  71. <vxe-column width="100px" title="报销比例%" field="reimbursementRatio" align="center"></vxe-column>
  72. <vxe-column width="200px" title="购方企业名称" field="firmName" align="center"></vxe-column>
  73. <vxe-column width="100px" title="开票日期" field="makeTime" align="center"></vxe-column>
  74. <vxe-column width="150px" title="商品名称" field="name" align="center"></vxe-column>
  75. <vxe-column width="100px" title="项目经理" field="proposer" align="center"></vxe-column>
  76. <vxe-column width="100px" title="部门" field="partner" align="center"></vxe-column>
  77. <vxe-column width="100px" title="业务类型" field="businessType" align="center"></vxe-column>
  78. <vxe-column width="100px" title="收款日期" field="gatheringTime" align="center"></vxe-column>
  79. <vxe-column title="操作" width="300px" fixed="right" align="center">
  80. <template slot-scope="scope">
  81. <el-button v-if="hasPermission('reimbursement:edit') && scope.row.businessCode==='' && scope.row.parentId === '0'" type="text" icon="el-icon-edit" size="small" @click="editBusiness(scope.row.id)">新增业务编码</el-button>
  82. <el-button v-if="hasPermission('reimbursement:edit') && scope.row.businessCode !== '' && !scope.row.reimbursementRatio && scope.row.parentId === '0'" type="text" icon="el-icon-edit" size="small" @click="editBusinessRatio(scope.row.id)">报销比例</el-button>
  83. <el-button v-if="hasPermission('reimbursementBusiness:add') && scope.row.businessCode !== '' && scope.row.reimbursementRatio && scope.row.parentId === '0'" type="text" icon="el-icon-plus" size="small" @click="addBusinessInfo(scope.row.id, scope.row.businessCode)">业务报销</el-button>
  84. <el-button v-if="hasPermission('reimbursementBusiness:view') && scope.row.businessCode !== '' && scope.row.reimbursementRatio && scope.row.parentId === '0'" type="text" icon="el-icon-view" size="small" @click="viewBusinessInfo(scope.row.id)">业务报销详情</el-button>
  85. <el-button v-if="hasPermission('reimbursement:edit') && scope.row.parentId !== '0' && !scope.row.gatheringTime" type="text" icon="el-icon-edit" size="small" @click="editInvoice(scope.row.id)">收款</el-button>
  86. <el-button v-if="hasPermission('reimbursement:del') && scope.row.parentId === '0'" type="text" icon="el-icon-delete" size="small" @click="delBusiness(scope.row.id)">删除</el-button>
  87. <el-button v-if="hasPermission('reimbursement:del') && scope.row.parentId !== '0'" type="text" icon="el-icon-delete" size="small" @click="delInvoice(scope.row.id)">删除</el-button>
  88. </template>
  89. </vxe-column>
  90. </vxe-table>
  91. <vxe-pager
  92. background
  93. size="small"
  94. :current-page="tablePage.currentPage"
  95. :page-size="tablePage.pageSize"
  96. :total="tablePage.total"
  97. :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
  98. :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
  99. @page-change="currentChangeHandle">
  100. </vxe-pager>
  101. </div>
  102. </div>
  103. <!-- 弹窗, 新增 / 修改 -->
  104. <reimbursementForm ref="reimbursementForm" @refreshDataList="refreshList"></reimbursementForm>
  105. <reimbursementGatheringTimeForm ref="reimbursementGatheringTimeForm" @refreshDataList="refreshList"></reimbursementGatheringTimeForm>
  106. <reimbursementRatioForm ref="reimbursementRatioForm" @refreshDataList="refreshList"></reimbursementRatioForm>
  107. <reimbursementBusinessForm ref="reimbursementBusinessForm" @refreshDataList="refreshList"></reimbursementBusinessForm>
  108. <reimbursementBusinessList ref="reimbursementBusinessList" @refreshDataList="refreshList"></reimbursementBusinessList>
  109. <reimbursementInvoiceForm ref="reimbursementInvoiceForm" @refreshDataList="refreshList"></reimbursementInvoiceForm>
  110. </div>
  111. </template>
  112. <script>
  113. import ReimbursementSys from '@/api/reimbursementSys/reimbursementSysService'
  114. import XEUtils from 'xe-utils'
  115. import reimbursementForm from './reimbursementForm'
  116. import reimbursementGatheringTimeForm from './reimbursementGatheringTimeForm'
  117. import reimbursementRatioForm from './reimbursementRatioForm'
  118. import reimbursementInvoiceForm from './reimbursementInvoiceForm'
  119. import reimbursementBusinessForm from './reimbursementBusinessForm'
  120. export default {
  121. data () {
  122. return {
  123. dataList: [],
  124. searchForm: {
  125. businessCode: '',
  126. invoiceNumber: '',
  127. reimbursementRatio: ''
  128. },
  129. tablePage: {
  130. total: 0,
  131. currentPage: 1,
  132. pageSize: 10,
  133. orders: [{column: 'a.create_date', asc: false}]
  134. },
  135. loading: false
  136. }
  137. },
  138. components: {
  139. reimbursementForm,
  140. reimbursementGatheringTimeForm,
  141. reimbursementRatioForm,
  142. reimbursementInvoiceForm,
  143. reimbursementBusinessForm
  144. },
  145. ReimbursementSys: null,
  146. created () {
  147. this.reimbursementSys = new ReimbursementSys()
  148. },
  149. activated () {
  150. this.refreshList()
  151. },
  152. methods: {
  153. // 获取数据列表
  154. refreshList () {
  155. this.loading = true
  156. this.reimbursementSys.treeData({
  157. 'current': this.tablePage.currentPage,
  158. 'size': this.tablePage.pageSize,
  159. 'orders': this.tablePage.orders,
  160. ...this.searchForm
  161. }).then(({data}) => {
  162. this.dataList = data
  163. this.tablePage.total = data.total
  164. this.handleSearch()
  165. this.loading = false
  166. })
  167. },
  168. beforeUpload (file) {
  169. const isExcel = file.name.indexOf('.xls') >= 0 || file.name.indexOf('.xlsx') >= 0
  170. const isLt2M = file.size / 1024 / 1024 < 1
  171. if (!isExcel) {
  172. this.$message.error('只能上传xls、xlsx文件!')
  173. return false
  174. }
  175. if (!isLt2M) {
  176. this.$message.error('上传文件大小不能超过 10MB!')
  177. return false
  178. }
  179. this.loading = true
  180. return true
  181. },
  182. handleSearch () {
  183. let name = XEUtils.toValueString(this.searchForm.businessCode).trim()
  184. let options = { children: 'children' }
  185. let searchProps = ['name']
  186. this.dataList = XEUtils.searchTree(
  187. this.dataList.records, item => searchProps.some(key => XEUtils.toValueString(item[key]).indexOf(name) >= -1), options)
  188. this.$nextTick(() => {
  189. this.$refs.xTree.setAllTreeExpand(true)
  190. })
  191. },
  192. resetSearch () {
  193. this.$refs.searchForm.resetFields()
  194. this.refreshList()
  195. },
  196. uploadSuccess (res, file) {
  197. if (res.success) {
  198. this.$message.success({dangerouslyUseHTMLString: true,
  199. message: res.message})
  200. this.refreshList()
  201. } else {
  202. this.$message.error(res.message)
  203. this.refreshList()
  204. }
  205. },
  206. // 当前页
  207. currentChangeHandle ({ currentPage, pageSize }) {
  208. this.tablePage.currentPage = currentPage
  209. this.tablePage.pageSize = pageSize
  210. this.refreshList()
  211. },
  212. // 修改
  213. editBusiness (id) {
  214. this.$refs.reimbursementForm.init('editBusiness', {id: id, parent: {id: '', name: ''}})
  215. },
  216. // 修改
  217. editBusinessRatio (id) {
  218. this.$refs.reimbursementRatioForm.init('editBusinessRatio', {id: id, parent: {id: '', name: ''}})
  219. },
  220. // 修改
  221. addBusinessInfo (id, businessCode) {
  222. this.$refs.reimbursementBusinessForm.init('addBusinessInfo', {id: '', businessCodeId: id, businessCode: businessCode, parent: {id: '', name: ''}})
  223. },
  224. // 查看业务报销详情
  225. viewBusinessInfo (id) {
  226. this.$router.push({path: `/reimbursementSys/reimbursementBusinessList`, query: {id: id, title: '业务报销详情'}})
  227. },
  228. // 修改发票收款日期
  229. editInvoiceGatheringTime (id) {
  230. let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
  231. return item.id
  232. }).join(',')
  233. this.$refs.reimbursementGatheringTimeForm.init('edit', {id: ids, parent: {id: '', name: ''}})
  234. },
  235. // 修改发票信息
  236. editInvoice (id) {
  237. this.$refs.reimbursementInvoiceForm.init('editInvoice', {id: id, parent: {id: '', name: ''}})
  238. },
  239. // 查看
  240. view (id) {
  241. this.$refs.reimbursementForm.init('view', {id: id, parent: {id: '', name: ''}})
  242. },
  243. // 查看发票信息
  244. viewInvoice (id) {
  245. this.$refs.reimbursementInvoiceForm.init('viewInvoice', {id: id, parent: {id: '', name: ''}})
  246. },
  247. // 删除
  248. delBusiness (id) {
  249. let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
  250. return item.id
  251. }).join(',')
  252. this.$confirm(`确定删除该记录吗?`, '提示', {
  253. confirmButtonText: '确定',
  254. cancelButtonText: '取消',
  255. type: 'warning'
  256. }).then(() => {
  257. this.loading = true
  258. this.reimbursementSys.deleteBusiness(ids).then(({data}) => {
  259. this.loading = false
  260. this.$message({
  261. message: data,
  262. type: 'success',
  263. duration: 1500
  264. })
  265. this.refreshList()
  266. })
  267. })
  268. },
  269. // 删除
  270. delInvoice (id) {
  271. let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
  272. return item.id
  273. }).join(',')
  274. this.$confirm(`确定删除该记录吗?`, '提示', {
  275. confirmButtonText: '确定',
  276. cancelButtonText: '取消',
  277. type: 'warning'
  278. }).then(() => {
  279. this.loading = true
  280. this.reimbursementSys.deleteInvoice(ids).then(({data}) => {
  281. this.loading = false
  282. this.$message({
  283. message: data,
  284. type: 'success',
  285. duration: 1500
  286. })
  287. this.refreshList()
  288. })
  289. })
  290. },
  291. // 删除
  292. del (id) {
  293. let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
  294. return item.id
  295. }).join(',')
  296. this.$confirm(`确定删除该记录吗?`, '提示', {
  297. confirmButtonText: '确定',
  298. cancelButtonText: '取消',
  299. type: 'warning'
  300. }).then(() => {
  301. this.loading = true
  302. this.reimbursementSys.delete(ids).then(({data}) => {
  303. this.loading = false
  304. this.$message({
  305. message: data,
  306. type: 'success',
  307. duration: 1500
  308. })
  309. this.refreshList()
  310. })
  311. })
  312. }
  313. }
  314. }
  315. </script>