index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  5. <el-tab-pane label="会计期间" name="first">
  6. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading"
  7. :data="dataList" ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange"
  8. @refresh-change="refreshChange" @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 366)"
  9. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 366)" :page.sync="page">
  10. <template slot-scope="{type,size,row,index}" slot="menu">
  11. <el-button size="small" :type="type" :disabled="row.lockingStatus != 0"
  12. @click="lock(row, 1)">锁定</el-button>
  13. <el-button size="small" :type="type" :disabled="row.lockingStatus != 1 || row.isClosed != 0"
  14. @click="lock(row, 2)">撤销锁定</el-button>
  15. <el-button size="small" :type="type" :disabled="row.lockingStatus != 1 || row.isClosed != 0"
  16. @click="inClose(row, 1)">结转</el-button>
  17. <el-button size="small" :type="type" :disabled="row.isClosed != 1"
  18. @click="inClose(row, 2)">反结转</el-button>
  19. </template>
  20. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  21. <el-button type="success" size="small" @click="openDialog = true; title = '开账'" v-if="showBut">开
  22. 账</el-button>
  23. <el-button type="success" size="small" @click="openDialog = true; title = '账套初始化'"
  24. v-if="!showBut">账套初始化</el-button>
  25. </template>
  26. </avue-crud>
  27. </el-tab-pane>
  28. <el-tab-pane label="月末结转" name="second">
  29. <avue-crud :option="option2" :search.sync="search2" v-model="form2" :table-loading="loading"
  30. :data="dataList2" ref="crud2" :key="key" @on-load="onLoad2" @search-change="searchChange2"
  31. @refresh-change="refreshChange2"
  32. @resetColumn="resetColumnTwo('crud2', 'option2', 'optionList2', 367)"
  33. @saveColumn="saveColumnTwo('crud2', 'option2', 'optionList2', 367)">
  34. <template slot-scope="{type,size,row,index}" slot="menu">
  35. <el-button size="small" :type="type" @click="editOpen(row)">模板修改</el-button>
  36. <el-button size="small" :type="type" @click="generate(row)">生成凭证</el-button>
  37. </template>
  38. <!-- <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  39. <el-button icon="el-icon-plus" type="primary" size="small"
  40. @click="detailsOpen = true">新建申请</el-button>
  41. </template> -->
  42. </avue-crud>
  43. </el-tab-pane>
  44. </el-tabs>
  45. </basic-container>
  46. <detailsPage v-if="detailsOpen" @goBack="goBack" :onLoad="form" :detailData="detailData">
  47. </detailsPage>
  48. <el-dialog v-dialogdrag append-to-body :title="title" :visible.sync="openDialog" width="30%"
  49. :before-close="handleClose">
  50. <span v-if="title == '汇兑损益汇率' || '期间损益汇率'" style="display: flex;align-items: center;">
  51. <avue-crud :data="itemData" :option="itemOption"></avue-crud>
  52. </span>
  53. <span v-else-if="title == '开账' || '账套初始化'" style="display: flex;align-items: center;">
  54. 开账日期:<avue-date size="small" type="datetime" v-model="openDate" format="yyyy-MM-dd HH:mm:ss"
  55. value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择开张日期"></avue-date>
  56. </span>
  57. <el-dialog v-dialogdrag append-to-body title="凭证明细" :visible.sync="itemOpenDialog" width="50%"
  58. :before-close="handleClose2">
  59. <span style="display: flex;align-items: center;">
  60. <avue-crud :data="itemForm2.finVouchersItemsList" :option="itemOption2"></avue-crud>
  61. </span>
  62. <span slot="footer" class="dialog-footer">
  63. <el-button size="mini" @click="itemOpenDialog = false">取 消</el-button>
  64. <el-button size="mini" type="primary" @click="onPeriod()">确 定</el-button>
  65. </span>
  66. </el-dialog>
  67. <span slot="footer" class="dialog-footer">
  68. <el-button size="mini" @click="openDialog = false">取 消</el-button>
  69. <el-button v-if="title == '开账'" size="mini" type="primary" @click="onBill">确 定</el-button>
  70. <el-button v-if="title == '账套初始化'" size="mini" type="primary" @click="resetBill">确 定</el-button>
  71. <el-button v-if="title == '汇兑损益汇率' || '期间损益汇率'" size="mini" type="primary" @click="inPeriod">确 定</el-button>
  72. </span>
  73. </el-dialog>
  74. <el-dialog v-dialogdrag append-to-body title="业务审核未通过明细" :visible.sync="openDialog2" width="50%"
  75. :before-close="handleClose3">
  76. <span style="display: flex;align-items: center;">
  77. <avue-crud :data="dialogData" :option="dialogOption"></avue-crud>
  78. </span>
  79. <span slot="footer" class="dialog-footer">
  80. <el-button size="mini" @click="openDialog2 = false">取 消</el-button>
  81. <el-button size="mini" type="primary" @click="exportBut()">导 出</el-button>
  82. </span>
  83. </el-dialog>
  84. <el-dialog v-dialogdrag append-to-body title="凭证未记账数据" :visible.sync="openDialog3" width="50%"
  85. :before-close="handleClose4">
  86. <span style="display: flex;align-items: center;">
  87. <avue-crud :data="dialogData2" :option="dialogOption2"></avue-crud>
  88. </span>
  89. <span slot="footer" class="dialog-footer">
  90. <el-button size="mini" @click="openDialog3 = false">取 消</el-button>
  91. <el-button size="mini" type="primary" @click="exportBut2()">导 出</el-button>
  92. </span>
  93. </el-dialog>
  94. </div>
  95. </template>
  96. <script>
  97. import { getList, currentPeriod, open, init, locking, revokeLocking, close, unclose, generateVouchers, submitPeriod, getPeriodExchangeRate } from "@/api/iosBasicData/periodManagement";
  98. import detailsPage from "./detailsPage"
  99. import { defaultDate4 } from "@/util/date";
  100. export default {
  101. name: "index",
  102. components: {
  103. detailsPage
  104. },
  105. data() {
  106. return {
  107. dialogOption: {
  108. viewBtn: false,
  109. editBtn: false,
  110. delBtn: false,
  111. addBtn: false,
  112. index: false,
  113. border: true,
  114. menu: false,
  115. header: false,
  116. align: "center",
  117. size: "small",
  118. column: [
  119. {
  120. label: '业务模块',
  121. prop: 'businessType',
  122. overHidden: true,
  123. },
  124. {
  125. label: '单据号',
  126. prop: 'billNo',
  127. overHidden: true,
  128. },
  129. {
  130. label: '业务日期',
  131. prop: 'businessDate',
  132. overHidden: true,
  133. },
  134. {
  135. label: '提单号',
  136. prop: 'mblno',
  137. overHidden: true,
  138. },
  139. {
  140. label: '操作员',
  141. prop: 'operator',
  142. overHidden: true,
  143. },
  144. {
  145. label: '业务员',
  146. prop: 'salesperson',
  147. overHidden: true,
  148. }
  149. ]
  150. },
  151. openDialog2: false,
  152. dialogData: [],
  153. dialogOption2: {
  154. viewBtn: false,
  155. editBtn: false,
  156. delBtn: false,
  157. addBtn: false,
  158. index: false,
  159. border: true,
  160. menu: false,
  161. header: false,
  162. align: "center",
  163. size: "small",
  164. column: [
  165. {
  166. label: '年',
  167. prop: 'year',
  168. overHidden: true,
  169. },
  170. {
  171. label: '月',
  172. prop: 'month',
  173. overHidden: true,
  174. },
  175. {
  176. label: '凭证号',
  177. prop: 'voucherNumber',
  178. overHidden: true,
  179. },
  180. {
  181. label: '凭证日期',
  182. prop: 'voucherDate',
  183. overHidden: true,
  184. },
  185. {
  186. label: '制单人',
  187. prop: 'operator',
  188. overHidden: true,
  189. }
  190. ]
  191. },
  192. openDialog3: false,
  193. dialogData2: [],
  194. itemForm: {},
  195. itemData: [],
  196. itemOption: {
  197. viewBtn: false,
  198. editBtn: false,
  199. delBtn: false,
  200. addBtn: false,
  201. index: false,
  202. border: true,
  203. menu: false,
  204. header: false,
  205. align: "center",
  206. size: "small",
  207. column: [
  208. {
  209. label: '币种代码',
  210. prop: 'curCode'
  211. }, {
  212. label: '币种名称',
  213. prop: 'curName'
  214. }, {
  215. label: '汇率日期',
  216. prop: 'curDate'
  217. }, {
  218. label: '汇率',
  219. prop: 'exrate',
  220. type: 'number',
  221. precision: 4,
  222. step: 4,
  223. cell: true
  224. }
  225. ]
  226. },
  227. itemForm2: {},
  228. itemOption2: {
  229. viewBtn: false,
  230. editBtn: false,
  231. delBtn: false,
  232. addBtn: false,
  233. index: false,
  234. border: true,
  235. menu: false,
  236. header: false,
  237. align: "center",
  238. size: "small",
  239. column: [
  240. {
  241. label: '摘要',
  242. prop: 'descr',
  243. overHidden: true,
  244. },
  245. {
  246. label: '代码名称',
  247. prop: 'accountCode',
  248. overHidden: true,
  249. },
  250. {
  251. label: '本币金额',
  252. overHidden: true,
  253. children: [{
  254. label: '借方',
  255. prop: 'amountDr',
  256. overHidden: true,
  257. }, {
  258. label: '货方',
  259. prop: 'amountCr',
  260. overHidden: true,
  261. }]
  262. },
  263. {
  264. label: '外币金额',
  265. overHidden: true,
  266. children: [{
  267. label: '币种',
  268. prop: 'curCode',
  269. overHidden: true,
  270. }, {
  271. label: '汇率',
  272. prop: 'exrate',
  273. overHidden: true,
  274. }, {
  275. label: '借方',
  276. prop: 'amountDrUsd',
  277. overHidden: true,
  278. }, {
  279. label: '货方',
  280. prop: 'amountCrUsd',
  281. overHidden: true,
  282. }]
  283. }
  284. ]
  285. },
  286. showBut: false,
  287. title: '开账',
  288. openDate: null,
  289. openDialog: false,
  290. itemOpenDialog: false,
  291. activeName: 'first',
  292. detailsOpen: false,
  293. loading: false,
  294. search: {
  295. periodYear: defaultDate4()
  296. },
  297. form: {},
  298. dataList: [],
  299. detailData: {},
  300. page: {
  301. pageSize: 20,
  302. currentPage: 1,
  303. total: 0,
  304. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  305. },
  306. key: 0,
  307. option: {},
  308. optionList: {
  309. viewBtn: false,
  310. editBtn: false,
  311. delBtn: false,
  312. addBtn: false,
  313. index: true,
  314. span: 8,
  315. border: true,
  316. height: "auto",
  317. searchMenuPosition: "right",
  318. align: "center",
  319. size: "small",
  320. menuWidth: 200,
  321. searchSpan: 8,
  322. searchIcon: true,
  323. searchIndex: 2,
  324. dialogWidth: "70%",
  325. column: [
  326. {
  327. label: '会计年度',
  328. prop: "periodYear",
  329. search: true,
  330. overHidden: true,
  331. hide: true,
  332. type: "year",
  333. valueFormat: "yyyy"
  334. },
  335. {
  336. label: '期间',
  337. prop: "periodDate",
  338. overHidden: true,
  339. },
  340. {
  341. label: '开始时间',
  342. prop: "beginDate",
  343. search: true,
  344. overHidden: true,
  345. type: "date",
  346. format: "yyyy-MM-dd",
  347. valueFormat: "yyyy-MM-dd 00:00:00"
  348. },
  349. {
  350. label: '结束时间',
  351. prop: "endDate",
  352. type: "date",
  353. overHidden: true,
  354. search: true,
  355. format: "yyyy-MM-dd",
  356. valueFormat: "yyyy-MM-dd 23:59:59"
  357. },
  358. {
  359. label: '结转状态',
  360. prop: "isClosed",
  361. type: 'select',
  362. overHidden: true,
  363. search: true,
  364. dicData: [
  365. {
  366. label: '未结转',
  367. value: 0,
  368. }, {
  369. label: '已结转',
  370. value: 1,
  371. }
  372. ]
  373. },
  374. {
  375. label: '结转时间',
  376. prop: "closeDate",
  377. searchProp: "closeDateList",
  378. overHidden: true,
  379. search: true,
  380. type: "date",
  381. searchRange: true,
  382. searchDefaultTime: ["00:00:00", "23:59:59"],
  383. format: "yyyy-MM-dd",
  384. valueFormat: "yyyy-MM-dd HH:mm:ss"
  385. }
  386. ]
  387. },
  388. search2: {},
  389. form2: {},
  390. dataList2: [],
  391. detailData2: {},
  392. option2: {},
  393. optionList2: {
  394. viewBtn: false,
  395. editBtn: false,
  396. delBtn: false,
  397. addBtn: false,
  398. index: true,
  399. span: 8,
  400. border: true,
  401. height: "auto",
  402. searchMenuPosition: "right",
  403. align: "center",
  404. size: "small",
  405. menuWidth: 200,
  406. dialogWidth: "70%",
  407. column: [
  408. {
  409. label: '结转凭证',
  410. prop: "descr",
  411. overHidden: true,
  412. },
  413. {
  414. label: '开始时间',
  415. prop: "date",
  416. overHidden: true,
  417. },
  418. {
  419. label: '状态',
  420. prop: "status",
  421. type: 'select',
  422. overHidden: true,
  423. dicData: [
  424. {
  425. label: '未结转',
  426. value: 0,
  427. }, {
  428. label: '已结转',
  429. value: 1,
  430. }
  431. ]
  432. }
  433. ]
  434. },
  435. }
  436. },
  437. async created() {
  438. this.option = await this.getColumnData(this.getColumnName(366), this.optionList);
  439. this.option2 = await this.getColumnData(this.getColumnName(367), this.optionList2);
  440. },
  441. methods: {
  442. lock(row, type) {
  443. if (type == '1') {
  444. this.$confirm('是否锁定?', '提示', {
  445. confirmButtonText: '确定',
  446. cancelButtonText: '取消',
  447. type: 'warning'
  448. }).then(() => {
  449. this.loading = true
  450. locking({ id: row.id }).then(res => {
  451. if (res.data.msg == '审核未通过') {
  452. this.loading = false
  453. this.openDialog2 = true
  454. this.dialogData=res.data.data
  455. }else if(res.data.msg=='凭证未记账'){
  456. this.loading = false
  457. this.openDialog3 = true
  458. this.dialogData2=res.data.data
  459. } else {
  460. this.loading = false
  461. this.$message.success("锁定成功");
  462. this.handleClick(this.activeName)
  463. }
  464. })
  465. })
  466. } else {
  467. this.$confirm('是否撤销锁定?', '提示', {
  468. confirmButtonText: '确定',
  469. cancelButtonText: '取消',
  470. type: 'warning'
  471. }).then(() => {
  472. this.loading = true
  473. revokeLocking({ id: row.id }).then(res => {
  474. this.loading = false
  475. this.$message.success("撤销锁定");
  476. this.handleClick(this.activeName)
  477. })
  478. })
  479. }
  480. },
  481. inClose(row, type) {
  482. if (type == '1') {
  483. this.$confirm('是否结转?', '提示', {
  484. confirmButtonText: '确定',
  485. cancelButtonText: '取消',
  486. type: 'warning'
  487. }).then(() => {
  488. this.loading = true
  489. close({ id: row.id }).then(res => {
  490. this.loading = false
  491. this.$message.success("结转成功");
  492. this.handleClick(this.activeName)
  493. })
  494. })
  495. } else {
  496. this.$confirm('是否反结转?', '提示', {
  497. confirmButtonText: '确定',
  498. cancelButtonText: '取消',
  499. type: 'warning'
  500. }).then(() => {
  501. this.loading = true
  502. unclose({ id: row.id }).then(res => {
  503. this.loading = false
  504. this.$message.success("反结转成功");
  505. this.handleClick(this.activeName)
  506. })
  507. })
  508. }
  509. },
  510. onBill() {
  511. this.$confirm('确认开账?', '提示', {
  512. confirmButtonText: '确定',
  513. cancelButtonText: '取消',
  514. type: 'warning'
  515. }).then(() => {
  516. this.loading = true
  517. open({ beginDate: this.openDate }).then(res => {
  518. this.loading = false
  519. this.$message.success("开账成功");
  520. this.handleClick(this.activeName)
  521. this.handleClose()
  522. })
  523. })
  524. },
  525. handleClose() {
  526. this.itemForm = {}
  527. this.openDate = null
  528. this.openDialog = false
  529. },
  530. handleClose2() {
  531. this.itemData2 = []
  532. this.itemOpenDialog = false
  533. },
  534. handleClose3() {
  535. this.dialogData = []
  536. this.openDialog2 = false
  537. },
  538. handleClose4() {
  539. this.dialogData2 = []
  540. this.openDialog3 = false
  541. },
  542. resetBill() {
  543. this.$confirm('确认账套初始化?', '提示', {
  544. confirmButtonText: '确定',
  545. cancelButtonText: '取消',
  546. type: 'warning'
  547. }).then(() => {
  548. this.loading = true
  549. init({ beginDate: this.openDate }).then(res => {
  550. this.loading = false
  551. this.$message.success("初始化成功");
  552. this.handleClick(this.activeName)
  553. this.handleClose()
  554. })
  555. })
  556. },
  557. handleClick(val) {
  558. if (val == 'first') {
  559. this.onLoad(this.page, this.search)
  560. } else {
  561. this.onLoad2(this.search2)
  562. }
  563. },
  564. goBack(type) {
  565. this.form = {}
  566. this.detailsOpen = false
  567. this.onLoad(this.page, this.search)
  568. },
  569. editOpen(row, status) {
  570. this.form = row
  571. this.detailData = {
  572. id: row.id,
  573. type: row.bsType,
  574. status: status
  575. };
  576. this.detailsOpen = true;
  577. },
  578. generate(row) {
  579. this.openDialog = true;
  580. this.itemForm = row;
  581. this.title = row.bsType == 'FM-CURRENCY-PL-TRANSFER' ? '汇兑损益汇率' : '期间损益汇率';
  582. getPeriodExchangeRate().then(res => {
  583. res.data.data.forEach(e => {
  584. e.$cellEdit = true
  585. })
  586. this.itemData = res.data.data
  587. })
  588. },
  589. inPeriod() {
  590. let obj = {}
  591. obj = { ...this.itemForm, exchangeRateList: this.itemData }
  592. generateVouchers(obj).then(res => {
  593. console.log(res)
  594. this.itemForm2 = res.data.data
  595. this.handleClose()
  596. this.itemOpenDialog = true
  597. })
  598. },
  599. onPeriod() {
  600. if (this.itemForm2.finVouchersItemsList.length == 0) {
  601. return this.$message.error("明细不能为空");
  602. }
  603. this.$confirm('确定保存凭证?', '提示', {
  604. confirmButtonText: '确定',
  605. cancelButtonText: '取消',
  606. type: 'warning'
  607. }).then(() => {
  608. this.loading = true
  609. submitPeriod(this.itemForm2).then(res => {
  610. this.$message.success("保存成功");
  611. this.handleClose2()
  612. }).finally(() => {
  613. this.loading = false
  614. })
  615. })
  616. },
  617. //刷新
  618. refreshChange() {
  619. this.onLoad(this.page, this.search)
  620. },
  621. searchChange(params, done) {
  622. this.page.currentPage = 1
  623. done();
  624. this.onLoad(this.page, params)
  625. },
  626. onLoad(page, params = {}) {
  627. console.log(params)
  628. params = {
  629. ...Object.assign(params, this.search),
  630. current: page.currentPage,
  631. size: page.pageSize,
  632. }
  633. this.loading = true
  634. getList(params).then(res => {
  635. this.dataList = res.data.data.records
  636. this.page.total = res.data.data.total;
  637. this.showBut = res.data.data.records.length == 0 ? true : false;
  638. this.loading = false
  639. }).finally(() => {
  640. this.loading = false
  641. })
  642. },
  643. //刷新
  644. refreshChange2() {
  645. this.onLoad2(this.search)
  646. },
  647. searchChange2(params, done) {
  648. this.page.currentPage = 1
  649. done();
  650. this.onLoad(params)
  651. },
  652. onLoad2(page, params = {}) {
  653. params = {
  654. ...params
  655. }
  656. this.loading = true
  657. currentPeriod(params).then(res => {
  658. this.dataList2 = res.data.data
  659. this.loading = false
  660. }).finally(() => {
  661. this.loading = false
  662. })
  663. },
  664. //自定义列保存
  665. async saveColumnTwo(ref, option, optionBack, code) {
  666. /**
  667. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  668. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  669. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  670. */
  671. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  672. if (inSave) {
  673. this.$message.success("保存成功");
  674. //关闭窗口
  675. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  676. }
  677. },
  678. //自定义列重置
  679. async resetColumnTwo(ref, option, optionBack, code) {
  680. this[option] = this[optionBack];
  681. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  682. if (inSave) {
  683. this.$message.success("重置成功");
  684. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  685. }
  686. }
  687. }
  688. }
  689. </script>
  690. <style scoped>
  691. .bottomBox {
  692. padding: 3px 6px;
  693. border-radius: 12px;
  694. color: #fff;
  695. font-size: 10px;
  696. }
  697. </style>