reimbursementList.vue 13 KB

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