reimbursementIsNoTicketList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <div class="page">
  3. <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm"
  4. @keyup.enter.native="refreshList()" @submit.native.prevent>
  5. <el-form-item prop="userId" :rules=" [{trigger: 'blur'}]" label="人员">
  6. <SelectUserTree
  7. ref="companyTree"
  8. :props="{
  9. value: 'id', // ID字段名
  10. label: 'name', // 显示名称
  11. children: 'children' // 子级字段名
  12. }"
  13. :url="`/sys/user/treeUserDataByOfficeName?type=2&officeName=兴光项目`"
  14. :value="searchForm.userId"
  15. :clearable="true"
  16. :accordion="true"
  17. @getValue="(value) => {searchForm.userId=value}"/>
  18. </el-form-item>
  19. <el-form-item label="年份" prop="year" :rules="[{trigger:'blur'}]">
  20. <el-date-picker
  21. v-model="searchForm.year"
  22. type="year"
  23. value-format="yyyy"
  24. placeholder="选择年份">
  25. </el-date-picker>
  26. </el-form-item>
  27. <el-form-item>
  28. <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
  29. <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
  30. </el-form-item>
  31. </el-form>
  32. <div class="bg-white top">
  33. <vxe-toolbar :refresh="{query: refreshList}" export print resizable custom>
  34. <template #buttons>
  35. <el-row>
  36. <el-button v-if="hasPermission('accountant:reimbursementBusinessTwo:add')" type="primary" size="small" icon="el-icon-plus"
  37. @click="addBusinessInfo()">新增
  38. </el-button>
  39. <el-button v-if="hasPermission('accountant:reimbursementBusinessTwo:binding')" type="warning" size="small" icon="el-icon-edit"
  40. @click="openDialog($refs.reimbursementUserTable.getCheckboxRecords())"
  41. :disabled="$refs.reimbursementUserTable && $refs.reimbursementUserTable.getCheckboxRecords().length === 0"
  42. plain>批量绑定
  43. </el-button>
  44. <el-button v-if="hasPermission('accountant:reimbursementBusinessTwo:del')" type="danger" size="small" icon="el-icon-delete"
  45. @click="delInvoice()"
  46. :disabled="$refs.reimbursementUserTable && $refs.reimbursementUserTable.getCheckboxRecords().length === 0"
  47. plain>删除
  48. </el-button>
  49. </el-row>
  50. </template>
  51. </vxe-toolbar>
  52. <div style="height: calc(100% - 80px);">
  53. <vxe-table
  54. border="inner"
  55. auto-resize
  56. resizable
  57. height="auto"
  58. :loading="loading"
  59. size="small"
  60. ref="reimbursementUserTable"
  61. show-header-overflow
  62. show-overflow
  63. highlight-hover-row
  64. :menu-config="{}"
  65. :print-config="{}"
  66. :export-config="{}"
  67. :sort-config="{remote:true}"
  68. :data="dataList"
  69. :checkbox-config="{}">
  70. <vxe-column type="checkbox" width="40px"></vxe-column>
  71. <vxe-column width="172px" title="报销人" field="userName" align="center" visible></vxe-column>
  72. <vxe-column width="172px" title="报销年份" field="year" align="center"></vxe-column>
  73. <vxe-column width="172px" title="报销类型" field="reimbursementType" align="center">
  74. <template slot-scope="scope">
  75. <el-tag v-if="scope.row.reimbursementType === '1'"> 正常报销</el-tag>
  76. <el-tag v-if="scope.row.reimbursementType === '2'"> 补差</el-tag>
  77. </template>
  78. </vxe-column>
  79. <vxe-column width="172px" title="报销天数" field="reimbursementDay" align="center"></vxe-column>
  80. <vxe-column width="172px" title="报销额度" field="reimbursementAmount" align="center"></vxe-column>
  81. <vxe-column title="操作" width="300px" fixed="right" align="center">
  82. <template slot-scope="scope">
  83. <el-button v-if="hasPermission('accountant:reimbursementBusinessTwo:binding') && scope.row.parentId !== '0'" type="text"
  84. icon="el-icon-plus" size="small" @click="openDialog(scope.row)">绑定业务编号
  85. </el-button>
  86. <el-button v-if="hasPermission('accountant:reimbursementBusinessTwo:del') && scope.row.parentId !== '0'" type="text"
  87. icon="el-icon-delete" size="small" @click="delInvoice(scope.row.id)">删除
  88. </el-button>
  89. </template>
  90. </vxe-column>
  91. </vxe-table>
  92. <vxe-pager
  93. background
  94. size="small"
  95. :current-page="tablePage.currentPage"
  96. :page-size="tablePage.pageSize"
  97. :total="tablePage.total"
  98. :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
  99. :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
  100. @page-change="currentChangeHandle">
  101. </vxe-pager>
  102. </div>
  103. </div>
  104. <!-- 弹窗, 新增 / 修改 -->
  105. <reimbursementForm ref="reimbursementForm" @refreshDataList="refreshList"></reimbursementForm>
  106. <reimbursementGatheringTimeForm ref="reimbursementGatheringTimeForm"
  107. @refreshDataList="refreshList"></reimbursementGatheringTimeForm>
  108. <reimbursementRatioForm ref="reimbursementRatioForm" @refreshDataList="refreshList"></reimbursementRatioForm>
  109. <reimbursementBusinessForm ref="reimbursementBusinessForm"
  110. @refreshDataList="refreshList"></reimbursementBusinessForm>
  111. <reimbursementInvoiceForm ref="reimbursementInvoiceForm" @refreshDataList="refreshList"></reimbursementInvoiceForm>
  112. <el-dialog
  113. title="选择绑定业务编号"
  114. :visible.sync="dialogVisible"
  115. width="60%">
  116. <el-col :span="12">
  117. <label-wrap>请选择年份:</label-wrap>
  118. <el-select v-model="selectedYear" filterable placeholder="请选择年份" @change="findSelectCodeListByYear">
  119. <el-option
  120. v-for="item in selectYear"
  121. :key="item"
  122. :label="item"
  123. :value="item">
  124. </el-option>
  125. </el-select>
  126. </el-col>
  127. <el-col :span="12">
  128. <label-wrap>请选择业务编号:</label-wrap>
  129. <el-select v-model="selectedCode" filterable clearable placeholder="请选择业务编号" @change="determination($event)">
  130. <el-option
  131. v-for="item in selectCode"
  132. :key="item.id"
  133. :label="item.businessCode"
  134. :value="item.id">
  135. </el-option>
  136. </el-select>
  137. </el-col>
  138. <span slot="footer" class="dialog-footer">
  139. <el-button @click="closeDialog">取 消</el-button>
  140. <el-button type="primary" @click="bindBusinessCode">确 定</el-button>
  141. </span>
  142. </el-dialog>
  143. </div>
  144. </template>
  145. <script>
  146. import ReimbursementSys from '@/api/reimbursementSys/project/reimbursementIsNoTicketService'
  147. import SelectUserTree from '@/views/modules/reimbursementSys/utils/treeReimbursementBuinessUserSelect.vue'
  148. import reimbursementForm from './reimbursementForm'
  149. import reimbursementGatheringTimeForm from './reimbursementGatheringTimeForm'
  150. import reimbursementRatioForm from './reimbursementRatioForm'
  151. import reimbursementInvoiceForm from './reimbursementInvoiceForm'
  152. import reimbursementBusinessForm from './reimbursementIsNoTicketForm'
  153. import reimbursementSelect from './reimbursementSelectDialog'
  154. export default {
  155. data () {
  156. return {
  157. dataList: [],
  158. searchForm: {
  159. year: '',
  160. userId: ''
  161. },
  162. tablePage: {
  163. total: 0,
  164. currentPage: 1,
  165. pageSize: 10,
  166. orders: [{column: 'a.create_date', asc: false}]
  167. },
  168. loading: false,
  169. dialogVisible: false,
  170. bindObj: [],
  171. selectCode: [],
  172. selectedCode: '',
  173. selectYear: [],
  174. selectedYear: '',
  175. reimbursementAmount: 0,
  176. canReimbursementAmount: 0
  177. }
  178. },
  179. components: {
  180. reimbursementForm,
  181. reimbursementGatheringTimeForm,
  182. reimbursementRatioForm,
  183. reimbursementInvoiceForm,
  184. reimbursementBusinessForm,
  185. reimbursementSelect,
  186. SelectUserTree
  187. },
  188. ReimbursementSys: null,
  189. created () {
  190. this.reimbursementSys = new ReimbursementSys()
  191. },
  192. activated () {
  193. this.refreshList()
  194. },
  195. methods: {
  196. // 获取数据列表
  197. refreshList () {
  198. this.loading = true
  199. this.reimbursementSys.findList({
  200. 'current': this.tablePage.currentPage,
  201. 'size': this.tablePage.pageSize,
  202. 'orders': this.tablePage.orders,
  203. ...this.searchForm
  204. }).then(({data}) => {
  205. this.dataList = data.records
  206. this.tablePage.total = data.total
  207. this.loading = false
  208. })
  209. },
  210. // 当前页
  211. currentChangeHandle ({currentPage, pageSize}) {
  212. this.tablePage.currentPage = currentPage
  213. this.tablePage.pageSize = pageSize
  214. this.refreshList()
  215. },
  216. resetSearch () {
  217. this.$refs.searchForm.resetFields()
  218. this.$nextTick(() => {
  219. this.refreshList()
  220. })
  221. },
  222. // 修改发票信息
  223. modifyInvoice (id) {
  224. this.$refs.reimbursementInvoiceModify.init('modifyInvoice', {id: id, parent: {id: '', name: ''}})
  225. },
  226. // 删除
  227. delInvoice (id) {
  228. let ids = id || this.$refs.reimbursementUserTable.getCheckboxRecords().map(item => {
  229. return item.id
  230. }).join(',')
  231. this.$confirm(`确定删除该记录吗?`, '提示', {
  232. confirmButtonText: '确定',
  233. cancelButtonText: '取消',
  234. type: 'warning'
  235. }).then(() => {
  236. this.loading = true
  237. this.reimbursementSys.deleteInvoice(ids).then(({data}) => {
  238. this.loading = false
  239. this.$message({
  240. message: data,
  241. type: 'success',
  242. duration: 1500
  243. })
  244. this.refreshList()
  245. })
  246. })
  247. },
  248. addBusinessInfo (id, businessCode) {
  249. this.$refs.reimbursementBusinessForm.init('addBusinessInfo', {
  250. id: '',
  251. businessCodeId: '',
  252. businessCode: '',
  253. parent: {id: '', name: ''}
  254. })
  255. },
  256. bindBusinessCode () {
  257. if (this.selectedCode === '') {
  258. this.$message.error('请选择业务编号')
  259. return
  260. }
  261. this.reimbursementSys.modifyBindCode({
  262. 'ids': this.bindObj,
  263. 'businessCode': this.selectedCode,
  264. 'money': this.reimbursementAmount
  265. }).then(({data}) => {
  266. if (!data) {
  267. this.$message.error('可报销额度不足')
  268. } else {
  269. this.closeDialog()
  270. }
  271. })
  272. },
  273. openDialog (obj) {
  274. // eslint-disable-next-line eqeqeq
  275. this.bindObj = obj.id || obj.map(item => {
  276. return item.id
  277. }).join(',')
  278. this.dialogVisible = true
  279. if (obj.length > 1) {
  280. obj.map(item => {
  281. this.reimbursementAmount += parseInt(item.reimbursementAmount)
  282. })
  283. } else {
  284. this.reimbursementAmount = obj.reimbursementAmount
  285. }
  286. this.reimbursementSys.findSelectYearList().then(({data}) => {
  287. this.selectYear = data
  288. this.selectedYear = this.selectYear[0]
  289. this.findSelectCodeListByYear()
  290. })
  291. },
  292. closeDialog () {
  293. this.dialogVisible = false
  294. this.selectedCode = ''
  295. this.refreshList()
  296. this.bindObj = []
  297. this.reimbursementAmount = 0
  298. },
  299. findSelectCodeListByYear () {
  300. this.selectedCode = ''
  301. this.reimbursementSys.findSelectCodeListByYear(this.selectedYear).then(({data}) => {
  302. this.selectCode = data
  303. this.selectedCode = ''
  304. })
  305. },
  306. determination (e) {
  307. for (let i = 0; i < this.selectCode.length; i++) {
  308. if (this.selectCode[i].id === e) {
  309. if (parseInt(this.selectCode[i].canReimbursementAmount) < parseInt(this.reimbursementAmount)) {
  310. this.$message.error('可报销额度不足,可报销额度为' + this.selectCode[i].canReimbursementAmount)
  311. }
  312. }
  313. }
  314. }
  315. }
  316. }
  317. </script>