index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <div>
  3. <!-- 列表页 -->
  4. <el-form ref="form" :model="form" label-width="80px" v-show="showSearch">
  5. <el-row>
  6. <el-col :span="6">
  7. <el-form-item label="结算单位">
  8. <el-select
  9. v-model="form.fCorpid"
  10. size="small"
  11. placeholder="请选择"
  12. clearable
  13. style="width: 100%"
  14. filterable
  15. >
  16. <el-option
  17. v-for="item in corpList"
  18. :key="item.fId"
  19. :label="item.fName"
  20. :value="item.fId"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="6">
  26. <el-form-item label="船名">
  27. <el-select
  28. v-model="form.fVslid"
  29. size="small"
  30. placeholder="请选择"
  31. style="width: 100%"
  32. clearable
  33. >
  34. <el-option
  35. v-for="item in TVesselfs"
  36. :key="item.fId"
  37. :label="item.fName"
  38. :value="item.fId"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="6">
  44. <el-form-item label="航次">
  45. <el-select
  46. v-model="form.fVoyid"
  47. size="small"
  48. placeholder="请选择"
  49. style="width: 100%"
  50. clearable
  51. >
  52. <el-option
  53. v-for="item in TVoyagefs"
  54. :key="item.fId"
  55. :label="item.fNo"
  56. :value="item.fId"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="6">
  62. <el-form-item label="提单号">
  63. <el-input
  64. v-model="form.fMblno"
  65. size="small"
  66. placeholder="请输入"
  67. ></el-input>
  68. </el-form-item>
  69. </el-col>
  70. </el-row>
  71. <el-collapse-transition>
  72. <div v-if="show">
  73. <el-row>
  74. <el-col :span="6">
  75. <el-form-item label="起运港">
  76. <el-select
  77. v-model="form.fLoadportid"
  78. size="small"
  79. placeholder="请选择"
  80. style="width: 100%"
  81. clearable
  82. >
  83. <el-option
  84. v-for="item in portNames"
  85. :key="item.fId"
  86. :label="item.fName"
  87. :value="item.fId"
  88. />
  89. </el-select>
  90. </el-form-item>
  91. </el-col>
  92. <el-col :span="6">
  93. <el-form-item label="目的港">
  94. <el-select
  95. v-model="form.fDestportid"
  96. size="small"
  97. placeholder="请选择"
  98. style="width: 100%"
  99. clearable
  100. >
  101. <el-option
  102. v-for="item in portNames"
  103. :key="item.fId"
  104. :label="item.fName"
  105. :value="item.fId"
  106. />
  107. </el-select>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="6">
  111. <el-form-item label="开船日期">
  112. <el-date-picker
  113. v-model="form.timeInterval"
  114. type="daterange"
  115. size="small"
  116. placeholder="请选择日期"
  117. format="yyyy-MM-dd"
  118. value-format="yyyy-MM-dd"
  119. style="width: 100%"
  120. />
  121. </el-form-item>
  122. </el-col>
  123. <el-col :span="6">
  124. <el-form-item label="审核日期">
  125. <el-date-picker
  126. v-model="form.timeExamine"
  127. type="daterange"
  128. size="small"
  129. placeholder="请选择日期"
  130. format="yyyy-MM-dd"
  131. value-format="yyyy-MM-dd"
  132. style="width: 100%"
  133. />
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="6">
  139. <el-form-item label="费用状态">
  140. <el-select
  141. v-model="form.fBillstatus"
  142. size="small"
  143. placeholder="请选择"
  144. style="width: 100%"
  145. clearable
  146. >
  147. <el-option
  148. v-for="item in fBillstatusList"
  149. :key="item.fId"
  150. :label="item.fName"
  151. :value="item.fId"
  152. />
  153. </el-select>
  154. </el-form-item>
  155. </el-col>
  156. </el-row>
  157. </div>
  158. </el-collapse-transition>
  159. </el-form>
  160. <div class="head-but">
  161. <div>
  162. <el-button
  163. type="warning"
  164. icon="el-icon-download"
  165. size="mini"
  166. @click="handleExport"
  167. >
  168. 导出
  169. </el-button>
  170. </div>
  171. <div class="tabSetting">
  172. <el-button
  173. type="cyan"
  174. icon="el-icon-search"
  175. size="mini"
  176. @click="handleQuery"
  177. >
  178. 搜索
  179. </el-button>
  180. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
  181. 重置
  182. </el-button>
  183. <el-button
  184. v-show="show"
  185. @click="show = !show"
  186. icon="el-icon-arrow-up"
  187. size="mini"
  188. >
  189. 展开
  190. </el-button>
  191. <el-button
  192. v-show="!show"
  193. @click="show = !show"
  194. icon="el-icon-arrow-down"
  195. size="mini"
  196. >
  197. 展开
  198. </el-button>
  199. <right-toolbar
  200. style="margin-left: 12px"
  201. :showSearch.sync="showSearch"
  202. @queryTable="getList"
  203. ></right-toolbar>
  204. <div style="margin: 0 12px">
  205. <el-button
  206. icon="el-icon-setting"
  207. size="mini"
  208. circle
  209. @click="colSetting"
  210. ></el-button>
  211. </div>
  212. </div>
  213. </div>
  214. <el-table :data="tableData" show-summary :summary-method="getSummaries">
  215. <el-table-column label="序号" type="index" width="50" />
  216. <el-table-column
  217. v-for="(item, index) in tableOption"
  218. :key="index"
  219. :label="item.name"
  220. :width="item.width"
  221. :prop="item.label"
  222. align="center"
  223. :fixed="item.fixed"
  224. :show-overflow-tooltip="true"
  225. >
  226. <template slot-scope="scope">
  227. <span v-if="item.label == 'shipsName'">
  228. {{ scope.row.shipsName }}
  229. </span>
  230. <span v-if="item.label == 'voyage'">
  231. {{ scope.row.voyage }}
  232. </span>
  233. <span v-if="item.label == 'unitOfAccount'">
  234. {{ scope.row.unitOfAccount }}
  235. </span>
  236. <span v-if="item.label == 'blNo'">
  237. <el-link :underline="false" type="primary"
  238. ><div @click="handleUpdate(scope.row, 1)">
  239. {{ scope.row.blNo }}
  240. </div></el-link
  241. >
  242. </span>
  243. <span v-if="item.label == 'portOfLoading'">
  244. {{ scope.row.portOfLoading }}
  245. </span>
  246. <span v-if="item.label == 'destination'">
  247. {{ scope.row.destination }}
  248. </span>
  249. <span v-if="item.label == 'sailingDate'">
  250. {{ scope.row.sailingDate }}
  251. </span>
  252. <span v-if="item.label == 'auditDate'">
  253. {{ scope.row.auditDate }}
  254. </span>
  255. <span v-if="item.label == 'receivable'">
  256. {{ scope.row.receivable }}
  257. </span>
  258. <span v-if="item.label == 'handle'">
  259. {{ scope.row.handle }}
  260. </span>
  261. <span v-if="item.label == 'profit'">
  262. {{ scope.row.profit }}
  263. </span>
  264. </template>
  265. </el-table-column>
  266. </el-table>
  267. <pagination
  268. v-show="page.total > 0"
  269. :total="page.total"
  270. :page.sync="page.pageNum"
  271. :limit.sync="page.pageSize"
  272. @pagination="getList"
  273. />
  274. <column-setting
  275. ref="columnSetting"
  276. @reset="reset"
  277. @getRowdata="getRowdata"
  278. tableName="凯和应付总账"
  279. />
  280. </div>
  281. </template>
  282. <script>
  283. import { tableOption } from "./js/index";
  284. import {
  285. selectTVesself,
  286. selectTVoyagef,
  287. selectPortName,
  288. listCorps,
  289. } from "@/api/finance/kaihe/contrast";
  290. import {
  291. getList,
  292. getExcel,
  293. } from "@/api/kaihe-reportManagement/generalLedgerCr";
  294. import Cookies from "js-cookie";
  295. import columnSetting from "@/components/ColumnSetting/index";
  296. export default {
  297. data() {
  298. return {
  299. form: {},
  300. show: false,
  301. tableData: [],
  302. tableOption: tableOption,
  303. page: {
  304. pageNum: 1,
  305. pageSize: 10,
  306. total: 0,
  307. },
  308. TVesselfs: [],
  309. TVoyagefs: [],
  310. portNames: [],
  311. corpList: [],
  312. showSearch: true,
  313. fBillstatusList: [
  314. {
  315. fId: 0,
  316. fName: "全部",
  317. },
  318. {
  319. fId: 1,
  320. fName: "未审核",
  321. },
  322. {
  323. fId: 2,
  324. fName: "审核通过",
  325. },
  326. ],
  327. sysType: null,
  328. };
  329. },
  330. components: {
  331. columnSetting,
  332. },
  333. created() {
  334. this.getList();
  335. selectTVesself().then((res) => {
  336. this.TVesselfs = res.rows;
  337. });
  338. selectTVoyagef().then((res) => {
  339. this.TVoyagefs = res.rows;
  340. });
  341. selectPortName().then((res) => {
  342. this.portNames = res.rows;
  343. });
  344. listCorps().then((res) => {
  345. this.corpList = res;
  346. });
  347. this.sysType = Cookies.get("sysType");
  348. },
  349. activated() {
  350. this.$refs.columnSetting.getRow(this.tableOption);
  351. },
  352. methods: {
  353. handleUpdate(row, num) {
  354. let res = {};
  355. res = {
  356. fMblno: row.blNo,
  357. num: num,
  358. type: "C",
  359. };
  360. this.$router.push({
  361. path: "/domesticTrade/orderInformation",
  362. query: { DC: JSON.stringify(res) },
  363. });
  364. },
  365. /** 导出按钮操作 */
  366. handleExport() {
  367. let that = this;
  368. this.$confirm("是否确认导出所有应付总账主数据项?", "警告", {
  369. confirmButtonText: "确定",
  370. cancelButtonText: "取消",
  371. type: "warning",
  372. })
  373. .then(function () {
  374. return getExcel(that.form);
  375. })
  376. .then((response) => {
  377. this.download(response.msg);
  378. });
  379. },
  380. getRowdata(list) {
  381. this.tableOption = list;
  382. },
  383. reset() {
  384. this.tableOption = this.$options.data().tableOption;
  385. },
  386. colSetting() {
  387. this.$refs.columnSetting.init(this.tableOption);
  388. },
  389. getSummaries(param) {
  390. const { columns, data } = param;
  391. const sums = [];
  392. if (data.length > 0) {
  393. columns.forEach((column, index) => {
  394. if (index == 0) {
  395. sums[index] = "合计";
  396. }
  397. if (
  398. column.label == "应付金额" ||
  399. column.label == "实付金额" ||
  400. column.label == "未付金额"
  401. ) {
  402. const values = data.map((item) => Number(item[column.property]));
  403. if (!values.every((value) => isNaN(value))) {
  404. if (this.sysType == 3) {
  405. sums[index] =
  406. Number(
  407. values.reduce((prev, curr) => {
  408. const value = Number(curr);
  409. if (!isNaN(value)) {
  410. return prev + curr;
  411. } else {
  412. return prev;
  413. }
  414. }, 0)
  415. ).toFixed(2) + "元";
  416. } else {
  417. sums[index] =
  418. Number(
  419. values.reduce((prev, curr) => {
  420. const value = Number(curr);
  421. if (!isNaN(value)) {
  422. return prev + curr;
  423. } else {
  424. return prev;
  425. }
  426. }, 0) / 10000
  427. ).toFixed(2) + "万";
  428. }
  429. } else {
  430. sums[index] = "0";
  431. }
  432. }
  433. });
  434. }
  435. return sums;
  436. },
  437. handleQuery() {
  438. this.page.pageNum = 1;
  439. if (this.form.date) {
  440. this.form.fFromDate = this.form.date[0];
  441. this.form.fToDate = this.form.date[1];
  442. }
  443. this.getList();
  444. },
  445. resetQuery() {
  446. this.form = this.$options.data().form;
  447. },
  448. getList() {
  449. const data = {
  450. ...this.form,
  451. pageNum: this.page.pageNum,
  452. pageSize: this.page.pageSize,
  453. };
  454. getList(data).then((response) => {
  455. response.rows.forEach((e) => {
  456. e.sailingDate = e.sailingDate ? e.sailingDate.slice(0, 10) : "";
  457. });
  458. response.rows.forEach((e) => {
  459. e.auditDate = e.auditDate ? e.auditDate.slice(0, 10) : "";
  460. });
  461. this.tableData = response.rows;
  462. this.page.total = response.total;
  463. this.loading = false;
  464. });
  465. },
  466. },
  467. };
  468. </script>
  469. <style lang="scss" scoped>
  470. .head-but {
  471. display: flex;
  472. justify-content: space-between;
  473. margin-bottom: 8px;
  474. }
  475. .tabSetting {
  476. display: flex;
  477. justify-content: flex-end;
  478. }
  479. </style>