index.vue 24 KB

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