costDetailList.vue 15 KB

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