wuHanReimbursementList.vue 19 KB

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