reimbursementList.vue 15 KB

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