costDetailList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. <template>
  2. <div class="custom-tree-container">
  3. <el-row class="handle-box" :gutter="10" style="margin-bottom: 10px">
  4. <el-form
  5. ref="elForm"
  6. :model="search"
  7. :rules="rules"
  8. size="medium"
  9. >
  10. <el-col :span="3">
  11. <el-form-item label="" prop="name" style="margin-bottom: 0">
  12. <el-input
  13. size="small"
  14. v-model="search.name"
  15. :style="{ width: '100%' }"
  16. clearable
  17. placeholder="请输入项目名称"
  18. />
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="3">
  22. <el-form-item label="" prop="payeeName" style="margin-bottom: 0">
  23. <el-input
  24. size="small"
  25. v-model="search.payeeName"
  26. :style="{ width: '100%' }"
  27. clearable
  28. placeholder="请输入收款人"
  29. />
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="3">
  33. <el-form-item label="" prop="feeType" style="margin-bottom: 0">
  34. <el-input
  35. size="small"
  36. v-model="search.feeType"
  37. :style="{ width: '100%' }"
  38. clearable
  39. placeholder="请输入费用类型"
  40. />
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="3">
  44. <el-form-item label="" prop="flowStatus" style="margin-bottom: 0">
  45. <el-select v-model="search.flowStatus" clearable placeholder="审核结果" size="small" @change="pickerChange">
  46. <el-option
  47. v-for="item in flowStatus"
  48. :key="item.value"
  49. :label="item.label"
  50. :value="item.value"
  51. />
  52. </el-select>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="3">
  56. <el-form-item label="" prop="name" style="margin-bottom: 0">
  57. <el-date-picker
  58. id="datePicker"
  59. v-model="timeValue"
  60. size="small"
  61. type="daterange"
  62. align="right"
  63. unlink-panels
  64. range-separator="-"
  65. start-placeholder="流程开始日期"
  66. end-placeholder="流程结束日期"
  67. value-format="yyyy-MM-dd"
  68. :picker-options="pickerOptions"
  69. @change="pickerChange"
  70. />
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="24">
  74. <div style="width: auto;float: right">
  75. <el-button class="ch-button-warning" plain size="small" @click="handleReset()"><i
  76. class="el-icon-aim"
  77. />&nbsp;重置
  78. </el-button>
  79. <el-button class="ch-button" size="small" @click="handleSearch()"><i class="el-icon-search"/>&nbsp;搜索
  80. </el-button>
  81. <el-button size="small" type="success" @click="confirmOutput()"><i class="el-icon-download"/>&nbsp;导出
  82. </el-button>
  83. </div>
  84. </el-col>
  85. </el-form>
  86. </el-row>
  87. <el-row class="handle-box">
  88. <el-col :span="24">
  89. <el-table
  90. v-loading="loading"
  91. :cell-style="styleBack"
  92. :data="tableData"
  93. row-class-name="g_table_row"
  94. stripe
  95. fit
  96. style="width: 100%"
  97. >
  98. <el-table-column label="序号" type="index" width="60" fixed/>
  99. <!-- <el-table-column label="费用报支申请单" prop="form_id" width="170"/>-->
  100. <el-table-column label="申请人" prop="truename"/>
  101. <el-table-column label="所在部门" prop="dept_name" width="120"/>
  102. <el-table-column label="发起时间" prop="created_at" width="170"/>
  103. <el-table-column label="流程结束时间" prop="last_update_time" width="170"/>
  104. <el-table-column label="关联项目名称" prop="proName" width="170"/>
  105. <el-table-column label="费用类型" prop="fee_type" width="170"/>
  106. <el-table-column label="用途" prop="use_reasons" width="170">
  107. <template scope="scope">
  108. <el-tooltip class="item" effect="dark" :content="scope.row.use_reasons" placement="top">
  109. <div class="chaochuyingcang">{{ scope.row.use_reasons }}</div>
  110. </el-tooltip>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="发票号" prop="fee_money" width="170">
  114. <template scope="scope">
  115. <el-tooltip class="item" effect="dark" :content="scope.row.file_number" placement="top">
  116. <div class="chaochuyingcang">{{ scope.row.file_number }}</div>
  117. </el-tooltip>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="金额(元)" prop="fee_money" width="170"/>
  121. <el-table-column label="收款人" prop="payee_name" width="170"/>
  122. <el-table-column label="银行" prop="bank_name" width="170"/>
  123. <el-table-column label="制单日期" prop="make_date" width="170"/>
  124. <el-table-column label="实际支付日期" prop="pay_time" width="170"/>
  125. <el-table-column label="当前流程状态" prop="flow_status" width="170"/>
  126. <el-table-column label="单据" prop="fileType" width="170">
  127. <template scope="scope">
  128. <span v-if="scope.row.file_type==1">发票</span>
  129. <span v-if="scope.row.file_type==2">发票后补</span>
  130. <span v-if="scope.row.file_type==3">无发票</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="附件" prop="status" width="170">
  134. <template scope="scope">
  135. <el-button
  136. style="padding: 0;margin: 0"
  137. v-for="file in scope.row.file_data_ids"
  138. type="text"
  139. @click="downLoadFile(file.id)"
  140. >
  141. {{ file.fileName }}
  142. </el-button>
  143. </template>
  144. </el-table-column>
  145. </el-table>
  146. <div class="table-page">
  147. <el-pagination
  148. :current-page.sync="currentPage"
  149. :page-size="pageSize"
  150. :total="allpage"
  151. background
  152. layout="total, prev, pager, next"
  153. @current-change="handleCurrentChange"
  154. />
  155. </div>
  156. </el-col>
  157. </el-row>
  158. </div>
  159. </template>
  160. <script>
  161. import common from '@/static/utils/common'
  162. import Base from '../base/base'
  163. import BaseData from '../base/baseData'
  164. import BaseDept from '../base/baseDept'
  165. export default {
  166. mixins: [Base, BaseData, BaseDept],
  167. data() {
  168. return {
  169. pickerOptions: {
  170. shortcuts: [{
  171. text: '最近一周',
  172. onClick: function(picker) {
  173. var end = new Date()
  174. var start = new Date()
  175. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  176. picker.$emit('pick', [start, end])
  177. }
  178. }, {
  179. text: '最近一个月',
  180. onClick: function(picker) {
  181. var end = new Date()
  182. var start = new Date()
  183. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  184. picker.$emit('pick', [start, end])
  185. }
  186. }, {
  187. text: '最近三个月',
  188. onClick: function(picker) {
  189. var end = new Date()
  190. var start = new Date()
  191. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
  192. picker.$emit('pick', [start, end])
  193. }
  194. }]
  195. },
  196. // 查询数据的内容
  197. search: {
  198. flowStatus:'1'
  199. },
  200. timeValue: '',
  201. departmentIds: '',
  202. deptAttr: '',
  203. // 通用字典项
  204. AUDIT_TYPE: [],
  205. dc_map: {},
  206. // 列表相关
  207. cusName: '',
  208. auditStatus: '',
  209. auditType: '',
  210. proName: '',
  211. applyBy: '',
  212. tableData: [],
  213. loading: false,
  214. UserMap: {},
  215. // 分页
  216. currentPage: 1,
  217. allpage: 0,
  218. pageSize: 12,
  219. // 弹框相关
  220. currAuditId: '',
  221. dialogVisible: false,
  222. dialogTitle: '新增',
  223. isAdd: true,
  224. detailList: [],
  225. rules: {},
  226. OutData: [],
  227. flowStatus:[
  228. {value: '1', label: '审批中'},
  229. {value: '2', label: '退回发起人'},
  230. {value: '3', label: '已结束'},
  231. {value: '4', label: '已撤回'}
  232. ],
  233. cbFyTypes:[]
  234. }
  235. },
  236. mounted() {
  237. const _this = this
  238. _this.getData()
  239. this.initDeptAttr().then(() => {
  240. if (this.DeptAttrData.length > 0) {
  241. this.deptAttr = this.DeptAttrData[0].value
  242. this.initDepartment({ deptAttr: this.deptAttr })
  243. }
  244. })
  245. },
  246. methods: {
  247. initData(){
  248. this.getData()
  249. this.initDeptAttr().then(() => {
  250. if (this.DeptAttrData.length > 0) {
  251. this.deptAttr = this.DeptAttrData[0].value
  252. this.initDepartment({ deptAttr: this.deptAttr })
  253. }
  254. })
  255. },
  256. pickerChange: function(val) {
  257. if(val){
  258. this.search.startTime = val[0]
  259. this.search.endTime = val[1]
  260. }else{
  261. this.search.startTime = ''
  262. this.search.endTime = ''
  263. }
  264. },
  265. downLoadFile(id) {
  266. window.open(this.$constant.BASE_URI + '/FileController/download/' + id)
  267. },
  268. styleBack({ row, column, rowIndex, columnIndex }) {
  269. if (row.isFirst == 1) return { backgroundColor: '#FDBABB' }
  270. },
  271. addAttrDept: function() {
  272. if (!this.form.selectDepts) this.form.selectDepts = []
  273. this.form.selectDepts.push({
  274. userId: this.form.id,
  275. attrId: '',
  276. deptAttrs: this.DeptAttrData,
  277. deptId: '',
  278. depts: [],
  279. postIds: []
  280. })
  281. },
  282. dlgOpen: function() {
  283. const _this = this
  284. if (this.form.id) {
  285. this.baseRequest('getById', {
  286. id: this.form.id
  287. }).then((res) => {
  288. if (res.data) {
  289. _this.form.groupId = res.data.groupId
  290. _this.form.username = res.data.username
  291. _this.form.truename = res.data.truename
  292. _this.form.staffCode = res.data.staffCode
  293. _this.form.gender = res.data.gender
  294. _this.form.leader = res.data.leader
  295. _this.form.position = res.data.position
  296. _this.form.posts = res.data.posts ? res.data.posts.split(',') : []
  297. if (_this.form.posts.length) {
  298. _this.initPosition2(_this.form.posts)
  299. }
  300. _this.form.sequenceNo = res.data.sequenceNo
  301. _this.form.phone = res.data.phone
  302. _this.form.secretKey = res.data.secretKey
  303. _this.form.comment = res.data.comment
  304. _this.form.selectDepartment = res.data.department
  305. _this.form.selectDepts = []
  306. _this.userDeptRequest('listByUserId', {
  307. userId: _this.form.id
  308. }).then(resDept => {
  309. if (resDept.data) {
  310. resDept.data.forEach(dept => {
  311. dept.postIds = dept.posts ? dept.posts.split(',') : []
  312. dept.deptAttrs = _this.DeptAttrData
  313. if (dept.attrId) {
  314. dept.depts = _this.TempDepts.filter(tempDept => {
  315. return tempDept.deptAttr === dept.attrId
  316. })
  317. }
  318. _this.form.selectDepts.push(dept)
  319. })
  320. }
  321. // console.log('listByUserId', _this.form.selectDepts)
  322. })
  323. }
  324. }).catch(() => {
  325. })
  326. }
  327. },
  328. handleDeptAttrChange: function(val) {
  329. this.selectDeptNode = this.getDeptDefaultTopNode()
  330. this.deptAttr = val
  331. this.initDepartment({ deptAttr: val })
  332. this.handleSearch()
  333. },
  334. handleDeptNodeClick(data, node, ocx) {
  335. this.departmentIds = data.id
  336. this.getData()
  337. },
  338. handleCloseDept: function() {
  339. this.selectDeptNode = this.getDeptDefaultTopNode()
  340. this.handleSearch()
  341. },
  342. confirmOutput() {
  343. const OutSize = [
  344. { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 },
  345. { wch: 15 }, { wch: 15 }, { wch: 25 }, { wch: 25 }, { wch: 15 }, { wch: 15 }, { wch: 15 }]
  346. const fileName = '费用报支明细' + new Date().Format('yyyy-MM-dd')
  347. this.$outputXlsxFile(this.OutData, OutSize, fileName)
  348. },
  349. async projectChange(){
  350. this.cbFyTypes=[]
  351. let submitData = {proId:this.form.proId }
  352. const { data } = await this.baseRequest3('ProMainDashboardController', 'getRightBudgetList', submitData)
  353. if (data) {
  354. const fyList = data.fyList || []
  355. const cbList = data.cbList || []
  356. fyList.forEach(item=>{
  357. const i = {
  358. value : item.budgetChildType,
  359. label:item.budgetType+'-'+item.budgetChildType
  360. }
  361. this.cbFyTypes.push(i)
  362. })
  363. cbList.forEach(item=>{
  364. const i = {
  365. value : item.budgetChildType,
  366. label:item.budgetType+'-'+item.budgetChildType
  367. }
  368. this.cbFyTypes.push(i)
  369. })
  370. }
  371. },
  372. baseRequest3(prefix, opUrl, postData) {
  373. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  374. },
  375. getPostData: function() {
  376. const postData = {
  377. departmentIds: this.departmentIds,
  378. name: this.search.name,
  379. payeeName: this.search.payeeName,
  380. feeType: this.search.feeType,
  381. startTime: this.search.startTime,
  382. flowStatus: this.search.flowStatus,
  383. endTime: this.search.endTime,
  384. pageNum: this.currentPage,
  385. pageSize: this.pageSize
  386. }
  387. const currUser = this.$common.currUser()
  388. if (currUser && currUser.groupId) {
  389. postData.groupId = common.currUser().groupId
  390. }
  391. if (!this.$common.isAdmin()) {
  392. postData.chargedby = this.$common.currUser().id
  393. }
  394. return postData
  395. },
  396. initOutData: function() {
  397. const _this = this
  398. this.OutData = []
  399. this.OutData = [[
  400. '费用报支申请单', '申请人', '所在部门', '发起时间', '流程结束时间', '关联项目名称',
  401. '费用类型', '用途','发票号', '金额(元)', '收款人', '银行', '制单日期', '实际支付日期', '当前流程状态', '单据']]
  402. const postData = this.getPostData()
  403. this.baseRequest1('findAllApplyUseMoneyListByInfo', postData).then((res) => {
  404. try {
  405. if (res.data) {
  406. res.data.forEach(function(item) {
  407. const jsonMap = _this.getItemJson(item)
  408. const jsonArray = [
  409. jsonMap.form_id,
  410. jsonMap.truename,
  411. jsonMap.dept_name,
  412. jsonMap.created_at,
  413. jsonMap.last_update_time,
  414. jsonMap.proName,
  415. jsonMap.fee_type,
  416. jsonMap.use_reasons,
  417. jsonMap.file_number,
  418. jsonMap.fee_money,
  419. jsonMap.payee_name,
  420. jsonMap.bank_name,
  421. jsonMap.make_date,
  422. jsonMap.pay_time,
  423. jsonMap.flow_status,
  424. jsonMap.file_type == 1 ? '发票' : jsonMap.file_type == 2 ? '发票后补' : jsonMap.file_type == 3 ? '无发票' : ''
  425. ]
  426. console.log(jsonArray)
  427. _this.OutData.push(jsonArray)
  428. })
  429. }
  430. } catch (e) {
  431. }
  432. }).catch(() => {
  433. })
  434. },
  435. async changeStatus(row) {
  436. let status = row.status == 0 ? 2 : row.status == 2 ? 0 : null
  437. this.loading = true
  438. let { data } = await this.baseRequest1('noOrUse', { id: row.id, status })
  439. if (data.code == 200) {
  440. this.loading = false
  441. this.getData()
  442. this.$message.success('状态修改成功')
  443. }
  444. },
  445. async openHolidayDialog(status, row) {
  446. this.$refs.addOrEditHoliiday.setVisible(status, row)
  447. },
  448. handleCurrentChange: function(val) {
  449. this.currentPage = val
  450. this.getData()
  451. },
  452. recallApply: function(row, type) {
  453. const _this = this
  454. _this.$confirm('该流程已经在审核中,撤回后原审核内容将作废确认撤回吗?', '提示', {
  455. confirmButtonText: '确定',
  456. cancelButtonText: '取消',
  457. type: 'warning'
  458. }).then(function() {
  459. const deleting = _this.$notify({
  460. title: '正在撤回,请稍等',
  461. type: 'warning'
  462. })
  463. const postData = {
  464. flowMainid: row.id
  465. }
  466. _this.baseRequest2(
  467. 'FlowMainController',
  468. 'recallApply',
  469. postData).then(res => {
  470. if (res.data.code === 200) {
  471. _this.getData()
  472. deleting.close()
  473. _this.$notify({
  474. title: '撤回成功',
  475. type: 'info'
  476. })
  477. } else {
  478. deleting.close()
  479. _this.dialogVisible = false
  480. _this.$notify({
  481. title: '撤回失败',
  482. type: 'info'
  483. })
  484. }
  485. }).catch((err) => {
  486. deleting.close()
  487. _this.$alert(err)
  488. })
  489. }).catch(function(error) {
  490. console.error(error)
  491. })
  492. },
  493. // 初始化获取数据
  494. getData() {
  495. const _this = this
  496. const postData = {
  497. name: _this.search.name,
  498. payeeName: _this.search.payeeName,
  499. feeType: _this.search.feeType,
  500. startTime: _this.search.startTime,
  501. endTime: _this.search.endTime,
  502. flowStatus: _this.search.flowStatus,
  503. pageNum: _this.currentPage,
  504. pageSize: _this.pageSize
  505. }
  506. this.loading = true
  507. _this.baseRequest1('findApplyUseMoneyListByInfo', postData).then(res => {
  508. if (res.data) {
  509. this.loading = false
  510. _this.tableData = []
  511. res.data.rows.forEach(item => {
  512. item.noUseDate = item.noUseDate ? this.$common.transDate(item.noUseDate) : null
  513. item.restHolidayDate = item.restHolidayDate ? this.$common.transDate(item.restHolidayDate) : null
  514. item.joinDay = item.joinDay ? this.$common.transDate(item.joinDay) : null
  515. item.socialPayDay = item.socialPayDay ? this.$common.transDate(item.socialPayDay) : null
  516. _this.tableData.push(_this.getItemJson(item))
  517. })
  518. _this.allpage = res.data.total
  519. } else {
  520. _this.tableData = []
  521. }
  522. })
  523. this.initOutData()
  524. },
  525. getItemJson(item) {
  526. item.created_at = this.$common.transDate(item.created_at)
  527. item.last_update_time = this.$common.transDate(item.last_update_time)
  528. item.pay_time = this.$common.transDate(item.pay_time)
  529. item.createCardTime = this.$common.transDate(item.createCardTime)
  530. item.flow_status = item.flow_status == 1 ? '审批中' : '结束'
  531. item.make_date = this.$common.transDate(item.make_date)
  532. return item
  533. },
  534. handleSearch: function() {
  535. this.getData()
  536. },
  537. handleReset: function() {
  538. for (const i in this.search) {
  539. if (i !== 'pageNum' && i !== 'pageSize') {
  540. this.search[i] = ''
  541. }
  542. }
  543. this.handleSearch()
  544. },
  545. // 打开流程发起菜单
  546. handleClick(tab, event) {
  547. this.getData()
  548. },
  549. // 请求封装,继承类中调用,必须存在
  550. baseRequest1(opUrl, postData) {
  551. return this.$channel.globleRequest(
  552. 'ApplyUseMoneyController',
  553. opUrl,
  554. postData,
  555. 'project task'
  556. )
  557. },
  558. baseRequest2(controller, opUrl, postData) {
  559. return this.$channel.globleRequest(
  560. controller,
  561. opUrl,
  562. postData,
  563. 'project task'
  564. )
  565. }
  566. }
  567. }
  568. </script>
  569. <style lang="scss">
  570. .chaochuyingcang {
  571. width: 100%;
  572. white-space: nowrap;
  573. overflow: hidden;
  574. text-overflow: ellipsis;
  575. }
  576. .custom-tree-container .block-l {
  577. /*flex-grow: 2 ;*/
  578. float: left;
  579. width: 20%;
  580. padding: 0 8px 0 0;
  581. }
  582. .custom-tree-container .block-r {
  583. /*flex-grow: 10;*/
  584. float: left;
  585. width: 80%;
  586. /*padding: 0 0 0 8px;*/
  587. }
  588. .holidayRow {
  589. .el-select {
  590. width: 100%;
  591. }
  592. }
  593. .el-dropdown-link {
  594. cursor: pointer;
  595. color: rgba(39, 78, 219, 1);
  596. }
  597. .demonstration {
  598. display: block;
  599. color: #8492a6;
  600. font-size: 14px;
  601. margin-bottom: 20px;
  602. }
  603. .labeldom {
  604. .el-tabs__nav-wrap::after {
  605. background: none;
  606. }
  607. }
  608. .w200px {
  609. width: 200px;
  610. }
  611. </style>
  612. <style scoped>
  613. .ch-input .el-input__inner {
  614. border-radius: 0px;
  615. border-color: #32323a;
  616. }
  617. .ch-input-size {
  618. width: 150px;
  619. }
  620. .ch-button {
  621. borderund-color: #32323a;
  622. color: #fff;
  623. }
  624. .ch-button-warning {
  625. margin-left: 10px;
  626. border-radius: 0px;
  627. border-color: #E75B5B;
  628. background-color: #E75B5B;
  629. color: #fff;
  630. }
  631. </style>