index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. v-show="showSearch"
  7. label-width="100px"
  8. size="mini"
  9. >
  10. <el-row>
  11. <el-col :xs="12" :sm="6">
  12. <el-form-item label="提单号" prop="fMblno">
  13. <el-input
  14. v-model="queryParams.fMblno"
  15. placeholder="请输入提单号"
  16. clearable
  17. />
  18. </el-form-item>
  19. </el-col>
  20. <el-col :xs="12" :sm="6">
  21. <el-form-item label="客户名称" prop="fCorpid">
  22. <el-select
  23. v-model="queryParams.fCorpid"
  24. clearable
  25. filterable
  26. placeholder="请输入关键词"
  27. style="width: 100%"
  28. >
  29. <el-option
  30. v-for="(item, index) in fMblnoOptions"
  31. :key="index.fId"
  32. :label="item.fName"
  33. :value="item.fId"
  34. ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :xs="12" :sm="6">
  39. <el-form-item label="业务日期" prop="fBsdateList">
  40. <el-date-picker
  41. type="daterange"
  42. value-format="yyyy-MM-dd HH:mm:ss"
  43. :default-time="['00:00:00', '23:59:59']"
  44. clearable
  45. unlink-panels
  46. style="width: 100%"
  47. range-separator="至"
  48. start-placeholder="开始日期"
  49. end-placeholder="结束日期"
  50. v-model="queryParams.fBsdateList"
  51. ></el-date-picker>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :xs="12" :sm="6">
  55. <el-form-item label="审核日期" prop="fReviewDateList">
  56. <el-date-picker
  57. type="daterange"
  58. value-format="yyyy-MM-dd HH:mm:ss"
  59. :default-time="['00:00:00', '23:59:59']"
  60. clearable
  61. unlink-panels
  62. style="width: 100%"
  63. range-separator="至"
  64. start-placeholder="开始日期"
  65. end-placeholder="结束日期"
  66. v-model="queryParams.fReviewDateList"
  67. ></el-date-picker>
  68. </el-form-item>
  69. </el-col>
  70. </el-row>
  71. <el-collapse-transition>
  72. <div v-show="show">
  73. <el-row>
  74. <el-col :xs="12" :sm="6">
  75. <el-form-item label="收/付" prop="fDc">
  76. <el-select
  77. v-model="queryParams.fDc"
  78. clearable
  79. filterable
  80. placeholder="请选择"
  81. style="width: 100%"
  82. >
  83. <el-option
  84. label="收"
  85. value="D"
  86. ></el-option>
  87. <el-option
  88. label="付"
  89. value="C"
  90. ></el-option>
  91. </el-select>
  92. </el-form-item>
  93. </el-col>
  94. <el-col :xs="12" :sm="6">
  95. <el-form-item label="费用状态" prop="fBillstatus">
  96. <el-select
  97. v-model="queryParams.fBillstatus"
  98. clearable
  99. filterable
  100. placeholder="请选择"
  101. style="width: 100%"
  102. >
  103. <el-option
  104. label="录入"
  105. value="1"
  106. ></el-option>
  107. <el-option
  108. label="暂存"
  109. value="2"
  110. ></el-option>
  111. <el-option
  112. label="审批驳回"
  113. value="3"
  114. ></el-option>
  115. <el-option
  116. label="提交审核"
  117. value="4"
  118. ></el-option>
  119. <el-option
  120. label="审核中"
  121. value="5"
  122. ></el-option>
  123. <el-option
  124. label="审核通过"
  125. value="6"
  126. ></el-option>
  127. </el-select>
  128. </el-form-item>
  129. </el-col>
  130. </el-row>
  131. </div>
  132. </el-collapse-transition>
  133. </el-form>
  134. <el-row :gutter="10" style="padding-bottom: 10px">
  135. <el-col :span="1.5">
  136. <el-button
  137. type="warning"
  138. icon="el-icon-download"
  139. size="mini"
  140. @click="handleExport"
  141. >导出</el-button>
  142. </el-col>
  143. <div class="tabSetting">
  144. <div style="margin-right: 20px">
  145. <el-button
  146. type="cyan"
  147. icon="el-icon-search"
  148. size="mini"
  149. @click="handleQuery"
  150. v-hasPermi="['warehouse:modify:list']"
  151. >搜索</el-button
  152. >
  153. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  154. >重置</el-button
  155. >
  156. <el-button
  157. v-show="show"
  158. @click="show = !show"
  159. icon="el-icon-arrow-up"
  160. size="mini"
  161. >展开</el-button
  162. >
  163. <el-button
  164. v-show="!show"
  165. @click="show = !show"
  166. icon="el-icon-arrow-down"
  167. size="mini"
  168. >展开</el-button
  169. >
  170. </div>
  171. <right-toolbar
  172. :showSearch.sync="showSearch"
  173. @queryTable="getList"
  174. ></right-toolbar>
  175. <div style="margin: 0 12px">
  176. <el-button
  177. icon="el-icon-setting"
  178. size="mini"
  179. circle
  180. @click="showSetting = !showSetting"
  181. ></el-button>
  182. </div>
  183. </div>
  184. </el-row>
  185. <el-dialog title="自定义列显示" :visible.sync="showSetting" width="700px">
  186. <div>配置排序列数据(拖动调整顺序)</div>
  187. <div style="margin-left: 17px">
  188. <el-checkbox
  189. v-model="allCheck"
  190. label="全选"
  191. @change="allChecked"
  192. ></el-checkbox>
  193. </div>
  194. <div style="padding: 4px; display: flex; justify-content: center">
  195. <draggable
  196. v-model="setRowList"
  197. group="site"
  198. animation="300"
  199. @start="onStart"
  200. @end="onEnd"
  201. handle=".indraggable"
  202. >
  203. <transition-group>
  204. <div
  205. v-for="item in setRowList"
  206. :key="item.surface"
  207. class="listStyle"
  208. >
  209. <div style="width: 500px" class="indraggable">
  210. <div class="progress" :style="{ width: item.width + 'px' }">
  211. <el-checkbox
  212. :label="item.name"
  213. v-model="item.checked"
  214. :true-label="0"
  215. :false-label="1"
  216. >{{ item.name }}
  217. </el-checkbox>
  218. </div>
  219. </div>
  220. <el-input-number
  221. v-model.number="item.width"
  222. controls-position="right"
  223. :min="1"
  224. :max="500"
  225. size="mini"
  226. ></el-input-number>
  227. </div>
  228. </transition-group>
  229. </draggable>
  230. </div>
  231. <span slot="footer" class="dialog-footer">
  232. <el-button @click="showSetting = false">取 消</el-button>
  233. <el-button @click="delRow" type="danger">重 置</el-button>
  234. <el-button type="primary" @click="save()">确 定</el-button>
  235. </span>
  236. </el-dialog>
  237. <el-table
  238. v-loading="loading"
  239. :data="dataList"
  240. style="width: 100%"
  241. ref="table"
  242. :height="tableHeight"
  243. stripe
  244. show-summary
  245. :summary-method="getSum"
  246. >
  247. <el-table-column
  248. type="index"
  249. width="50">
  250. </el-table-column>
  251. <el-table-column
  252. v-for="(item, index) in getRowList"
  253. :key="index"
  254. :label="item.name"
  255. :width="item.width"
  256. :prop="item.label"
  257. align="center"
  258. :show-overflow-tooltip="true"
  259. sortable
  260. :fixed="item.fixed"
  261. >
  262. <template slot-scope="scope">
  263. <span v-if="item.label == 'fDc'">
  264. {{ scope.row.fDc == 'D'? '收': '付' }}
  265. </span>
  266. <span v-else-if="item.label == 'fFeeUnitid'">
  267. {{ scope.row.fFeeUnitid | fFeeUnitFormat(fFeetUnitOptions) }}
  268. </span>
  269. <span v-else-if="item.label == 'fBilltype'">
  270. {{ scope.row.fBilltype | billTypeFormat(billTypeList) }}
  271. </span>
  272. <span v-else>{{ scope.row[item.label] }}</span>
  273. </template>
  274. </el-table-column>
  275. </el-table>
  276. <pagination
  277. v-show="total > 0"
  278. :total="total"
  279. :page.sync="queryParams.pageNum"
  280. :limit.sync="queryParams.pageSize"
  281. @pagination="getList"
  282. />
  283. </div>
  284. </template>
  285. <script>
  286. import Cookies from "js-cookie";
  287. import draggable from "vuedraggable";
  288. import { addSet, resetModule, select } from '@/api/system/set';
  289. import {listCorps} from "@/api/basicdata/corps";
  290. import {getList, exportList} from "@/api/finance/query";
  291. export default {
  292. name: "index",
  293. components: {
  294. draggable,
  295. },
  296. data() {
  297. return {
  298. // 表格高度
  299. tableHeight: 0,
  300. // 总条数
  301. total: 0,
  302. // 查询参数
  303. queryParams: {
  304. pageNum: 1,
  305. pageSize: 10,
  306. },
  307. showSearch: true,
  308. // 搜索展开/隐藏
  309. show: false,
  310. // 自定义列弹窗显示
  311. showSetting: false,
  312. //自定义列宽
  313. allCheck: false,
  314. setRowList: [],
  315. getRowList: [],
  316. drag: false,
  317. tableDate: [
  318. {
  319. surface: "1",
  320. label: "corpName",
  321. name: "客户名称",
  322. checked: 0,
  323. width: 140,
  324. },
  325. {
  326. surface: "2",
  327. label: "fMblno",
  328. name: "提单号",
  329. checked: 0,
  330. width: 180,
  331. }, {
  332. surface: "3",
  333. label: "fBsdate",
  334. name: "业务日期",
  335. checked: 0,
  336. width: 100,
  337. },{
  338. surface: "4",
  339. label: "fReviewDate",
  340. name: "审核日期",
  341. checked: 0,
  342. width: 100,
  343. },{
  344. surface: "5",
  345. label: "feeName",
  346. name: "费用名称",
  347. checked: 0,
  348. width: 100,
  349. },
  350. {
  351. surface: "6",
  352. label: "fBillstatusName",
  353. name: "费用状态",
  354. checked: 0,
  355. width: 100,
  356. },{
  357. surface: "6",
  358. label: "fDc",
  359. name: "收/付",
  360. checked: 0,
  361. width: 100,
  362. },
  363. {
  364. surface: "7",
  365. label: "fAmount",
  366. name: "金额",
  367. checked: 0,
  368. width: 100,
  369. },
  370. {
  371. surface: "8",
  372. label: "fStlamount",
  373. name: "结算金额",
  374. checked: 0,
  375. width: 100,
  376. },
  377. {
  378. surface: "9",
  379. label: "fStlamountDate",
  380. name: "结算日期",
  381. checked: 0,
  382. width: 100,
  383. },
  384. {
  385. surface: "10",
  386. label: "fInvamount",
  387. name: "开票金额",
  388. checked: 0,
  389. width: 100,
  390. },
  391. {
  392. surface: "11",
  393. label: "fInvnos",
  394. name: "发票号",
  395. checked: 0,
  396. width: 100,
  397. },
  398. {
  399. surface: "12",
  400. label: "fAccamount",
  401. name: "对账金额",
  402. checked: 0,
  403. width: 100,
  404. },
  405. {
  406. surface: "13",
  407. label: "fAccamountDate",
  408. name: "对账日期",
  409. checked: 0,
  410. width: 100,
  411. },
  412. {
  413. surface: "14",
  414. label: "fStatementNo",
  415. name: "对账单号",
  416. checked: 0,
  417. width: 100,
  418. },
  419. {
  420. surface: "15",
  421. label: "fFeeUnitid",
  422. name: "计价单位",
  423. checked: 0,
  424. width: 100,
  425. },
  426. {
  427. surface: "16",
  428. label: "fQty",
  429. name: "数量",
  430. checked: 0,
  431. width: 100,
  432. },
  433. {
  434. surface: "17",
  435. label: "fUnitprice",
  436. name: "单价",
  437. checked: 0,
  438. width: 100,
  439. },
  440. {
  441. surface: "18",
  442. label: "fBilltype",
  443. name: "业务类型",
  444. checked: 0,
  445. width: 100,
  446. },
  447. {
  448. surface: "19",
  449. label: "fProductName",
  450. name: "货物名称",
  451. checked: 0,
  452. width: 100,
  453. },
  454. {
  455. surface: "20",
  456. label: "remark",
  457. name: "备注",
  458. checked: 0,
  459. width: 100,
  460. },
  461. ],
  462. // 计价单位
  463. fFeetUnitOptions: [],
  464. fMblnoOptions: [],
  465. loading: false,
  466. dataList: [],
  467. billTypeList: [],
  468. }
  469. },
  470. created() {
  471. this.setRowList = this.tableDate;
  472. this.getRowList = this.tableDate;
  473. this.getRow()
  474. this.getList()
  475. listCorps({type: 1}).then((response) => {
  476. this.fMblnoOptions = response.rows;
  477. });
  478. this.getDicts("data_unitfees").then((response) => {
  479. this.fFeetUnitOptions = response.data;
  480. });
  481. this.getDicts("data_billtype_type").then((response) => {
  482. this.billTypeList = response.data;
  483. });
  484. },
  485. mounted() {
  486. this.$nextTick(() => {
  487. let windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
  488. this.tableHeight = windowHeight - 280;
  489. // 监听浏览器高度变化,改变表格高度
  490. window.onresize = () => {
  491. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  492. }
  493. })
  494. },
  495. updated() {
  496. this.$nextTick(() => {
  497. this.$refs.table.doLayout();
  498. })
  499. },
  500. filters: {
  501. fFeeUnitFormat(row, fFeetUnitOptions) {
  502. let name;
  503. fFeetUnitOptions.map((e) => {
  504. if (row == e.dictValue) {
  505. name = e.dictLabel;
  506. }
  507. });
  508. return name;
  509. },
  510. billTypeFormat(row, billTypeList) {
  511. let type;
  512. billTypeList.map((e) => {
  513. if (row == e.dictValue) {
  514. type = e.dictLabel;
  515. }
  516. });
  517. return type;
  518. },
  519. },
  520. methods: {
  521. getList() {
  522. this.loading = true
  523. getList(this.queryParams).then(res => {
  524. this.dataList = res.rows
  525. this.total = res.total
  526. this.loading = false;
  527. })
  528. },
  529. /** 搜索按钮操作 */
  530. handleQuery() {
  531. this.queryParams.pageNum = 1;
  532. this.queryParams.pageSize = 10;
  533. this.getList();
  534. },
  535. /** 重置按钮操作 */
  536. resetQuery() {
  537. this.queryParams = {
  538. pageNum: 1,
  539. pageSize: 10,
  540. }
  541. this.resetForm("queryForm");
  542. this.handleQuery();
  543. },
  544. // 导出
  545. handleExport() {
  546. this.$confirm("是否确认导出所有库存总账数据项?", "警告", {
  547. confirmButtonText: "确定",
  548. cancelButtonText: "取消",
  549. type: "warning",
  550. }).then(() => {
  551. return exportList(this.queryParams)
  552. }).then(res => {
  553. this.download(res.msg)
  554. })
  555. },
  556. // 表格合计
  557. getSum(param) {
  558. const { columns, data } = param;
  559. const sums = [];
  560. var values = [];
  561. columns.forEach((column, index) => {
  562. if (index === 0) {
  563. sums[index] = "合计";
  564. return;
  565. }
  566. if (column.property === "fAmount") {
  567. values = data.map((item) => Number(item["fAmount"]));
  568. }
  569. if (column.property === "fStlamount") {
  570. values = data.map((item) => Number(item["fStlamount"]));
  571. }
  572. if (column.property === "fInvamount") {
  573. values = data.map((item) => Number(item["fInvamount"]));
  574. }
  575. if (column.property === "fAccamount") {
  576. values = data.map((item) => Number(item.fAccamount));
  577. }
  578. if (column.property === "fQty") {
  579. values = data.map((item) => Number(item.fQty));
  580. }
  581. if (
  582. column.property === "fAmount" ||
  583. column.property === "fStlamount" ||
  584. column.property === "fInvamount" ||
  585. column.property === "fAccamount" ||
  586. column.property === "fQty"
  587. ) {
  588. sums[index] = values.reduce((prev, curr) => {
  589. const value = Number(curr);
  590. if (!isNaN(value)) {
  591. return prev + curr;
  592. } else {
  593. return prev;
  594. }
  595. }, 0);
  596. if (column.property === "fAmount") {
  597. sums[index] = (sums[index]).toFixed(2);
  598. }
  599. if (column.property === "fStlamount") {
  600. sums[index] = (sums[index]).toFixed(2);
  601. }
  602. if (column.property === "fInvamount") {
  603. sums[index] = (sums[index]).toFixed(2);
  604. }
  605. if (column.property === "fAccamount") {
  606. sums[index] = (sums[index]).toFixed(2);
  607. }
  608. if (column.property === "fQty") {
  609. sums[index] = sums[index];
  610. }
  611. }
  612. });
  613. return sums;
  614. },
  615. //列设置全选
  616. allChecked() {
  617. if (this.allCheck == true) {
  618. this.setRowList.map((e) => {
  619. return (e.checked = 0);
  620. });
  621. } else {
  622. this.setRowList.map((e) => {
  623. return (e.checked = 1);
  624. });
  625. }
  626. },
  627. //开始拖拽事件
  628. onStart() {
  629. this.drag = true;
  630. },
  631. //拖拽结束事件
  632. onEnd() {
  633. this.drag = false;
  634. },
  635. //重置列表
  636. delRow() {
  637. this.data = {
  638. tableName: "财务查询",
  639. userId: Cookies.get("userName"),
  640. };
  641. resetModule(this.data).then((res) => {
  642. if (res.code == 200) {
  643. this.showSetting = false;
  644. this.setRowList = this.tableDate;
  645. console.log(this.setRowList)
  646. this.getRowList = this.tableDate;
  647. }
  648. });
  649. },
  650. //保存列设置
  651. save() {
  652. this.showSetting = false;
  653. this.data = {
  654. tableName: "财务查询",
  655. userId: Cookies.get("userName"),
  656. sysTableSetList: this.setRowList,
  657. };
  658. addSet(this.data).then((res) => {
  659. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  660. });
  661. },
  662. //查询列数据
  663. getRow() {
  664. let that = this;
  665. this.data = {
  666. tableName: "财务查询",
  667. userId: Cookies.get("userName"),
  668. };
  669. select(this.data).then((res) => {
  670. if (res.data.length != 0) {
  671. this.getRowList = res.data.filter((e) => e.checked == 0);
  672. this.setRowList = res.data;
  673. this.setRowList = this.setRowList.reduce((res, item) => {
  674. res.push({
  675. surface: item.surface,
  676. label: item.label,
  677. name: item.name,
  678. checked: item.checked,
  679. width: item.width,
  680. fixed: item.fixed,
  681. });
  682. return res;
  683. }, []);
  684. }
  685. });
  686. },
  687. },
  688. }
  689. </script>
  690. <style scoped>
  691. </style>