index.vue 17 KB

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