index.vue 28 KB

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