index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="货权方" prop="fCorpid">
  5. <el-select
  6. v-model="queryParams.fCorpid"
  7. filterable
  8. remote
  9. clearable
  10. style="width: 200px"
  11. size="small"
  12. @keyup.enter.native="handleQuery"
  13. :remote-method="corpsRemoteMethod"
  14. placeholder="请选择货权方"
  15. >
  16. <el-option
  17. v-for="(dict, index) in fMblnoOptions"
  18. :key="index.fId"
  19. :label="dict.fName"
  20. :value="dict.fId"
  21. ></el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="提单号" prop="fMblno">
  25. <el-input
  26. v-model="queryParams.fMblno"
  27. placeholder="请输入提单号"
  28. clearable
  29. style="width: 200px"
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="结算单位" prop="fToCorpid">
  35. <el-select
  36. v-model="queryParams.fToCorpid"
  37. placeholder="请选择结算单位"
  38. filterable
  39. remote
  40. clearable
  41. style="width: 200px"
  42. size="small"
  43. @keyup.enter.native="handleQuery"
  44. :remote-method="corpsRemoteMethod"
  45. >
  46. <el-option
  47. v-for="(dict, index) in fMblnoOptions"
  48. :key="index.fId"
  49. :label="dict.fName"
  50. :value="dict.fId"
  51. ></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="货物名称" prop="fProductName">
  55. <el-select
  56. v-model="queryParams.fProductName"
  57. filterable
  58. remote
  59. clearable
  60. size="small"
  61. style="width: 200px"
  62. :remote-method="goodsRemoteMethod"
  63. @keyup.enter.native="handleQuery"
  64. placeholder="请选择货物名称"
  65. >
  66. <el-option
  67. v-for="(dict, index) in goodsOptions"
  68. :key="index.fId"
  69. :label="dict.fName"
  70. :value="dict.fName"
  71. ></el-option>
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item label="品牌" prop="fMarks">
  75. <el-input
  76. v-model="queryParams.fMarks"
  77. placeholder="请输入品牌"
  78. clearable
  79. style="width: 200px"
  80. size="small"
  81. @keyup.enter.native="handleQuery"
  82. />
  83. </el-form-item>
  84. <el-form-item label="结算状态" prop="fReconciliation">
  85. <el-select
  86. v-model="queryParams.fReconciliation"
  87. clearable
  88. style="width: 200px"
  89. size="small"
  90. @keyup.enter.native="handleQuery"
  91. >
  92. <el-option label="未收" value="0"/>
  93. <el-option label="全部" value="1"/>
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item label="费用状态" prop="fBillstatus">
  97. <el-select
  98. v-model="queryParams.fBillstatus"
  99. clearable
  100. style="width: 200px"
  101. size="small"
  102. @keyup.enter.native="handleQuery"
  103. >
  104. <el-option label="录入" value="0"/>
  105. <el-option label="审核通过" value="1"/>
  106. </el-select>
  107. </el-form-item>
  108. <el-form-item label="作业类型" prop="fBusinessType">
  109. <el-select
  110. style="width: 200px"
  111. multiple
  112. v-model="queryParams.fBusinessType"
  113. filterable
  114. >
  115. <el-option
  116. v-for="(dict, index) in businessTypeOption"
  117. :key="index.dictValue"
  118. :label="dict.dictLabel"
  119. :value="dict.dictValue"
  120. ></el-option>
  121. </el-select>
  122. </el-form-item>
  123. <el-form-item label="费用名称" prop="fFeeid">
  124. <el-select
  125. style="width: 200px"
  126. multiple
  127. :remote-method="fWRemoteMethod"
  128. v-model="queryParams.fFeeid"
  129. filterable
  130. >
  131. <el-option
  132. v-for="(dict, index) in fWbuOptions"
  133. :key="index.fId"
  134. :label="dict.fName"
  135. :value="dict.fId"
  136. ></el-option>
  137. </el-select>
  138. </el-form-item>
  139. <el-form-item label="审核日期" prop="timeExamine">
  140. <el-date-picker
  141. v-model="queryParams.timeExamine"
  142. type="daterange"
  143. value-format="yyyy-MM-dd"
  144. clearable
  145. style="width: 280px"
  146. range-separator="至"
  147. start-placeholder="开始日期"
  148. end-placeholder="结束日期"
  149. @keyup.enter.native="handleQuery"
  150. >
  151. </el-date-picker>
  152. </el-form-item>
  153. <el-form-item>
  154. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  155. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  156. </el-form-item>
  157. </el-form>
  158. <el-row :gutter="10" class="mb8">
  159. <div class="tabSetting">
  160. <el-col :span="1.5">
  161. <el-button
  162. type="warning"
  163. icon="el-icon-download"
  164. size="mini"
  165. @click="handleExport"
  166. v-hasPermi="['warehouseBusiness:profit:export']"
  167. >导出
  168. </el-button>
  169. </el-col>
  170. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  171. <div style="margin: 0 12px">
  172. <el-button
  173. icon="el-icon-setting"
  174. size="mini"
  175. circle
  176. @click="showSetting = !showSetting"
  177. ></el-button>
  178. </div>
  179. </div>
  180. </el-row>
  181. <el-dialog title="自定义列显示" :visible.sync="showSetting" width="700px">
  182. <div>配置排序列数据(拖动调整顺序)</div>
  183. <div style="margin-left: 17px">
  184. <el-checkbox
  185. v-model="allCheck"
  186. label="全选"
  187. @change="allChecked"
  188. ></el-checkbox>
  189. </div>
  190. <div style="padding: 4px; display: flex; justify-content: center">
  191. <draggable
  192. v-model="setRowList"
  193. group="site"
  194. animation="300"
  195. @start="onStart"
  196. @end="onEnd"
  197. handle=".indraggable"
  198. >
  199. <transition-group>
  200. <div
  201. v-for="item in setRowList"
  202. :key="item.surface"
  203. class="listStyle"
  204. >
  205. <div style="width: 500px" class="indraggable">
  206. <div class="progress" :style="{ width: item.width + 'px' }">
  207. <el-checkbox
  208. :label="item.name"
  209. v-model="item.checked"
  210. :true-label="0"
  211. :false-label="1"
  212. >{{ item.name }}
  213. </el-checkbox>
  214. </div>
  215. </div>
  216. <el-input-number
  217. v-model.number="item.width"
  218. controls-position="right"
  219. :min="1"
  220. :max="500"
  221. size="mini"
  222. ></el-input-number>
  223. </div>
  224. </transition-group>
  225. </draggable>
  226. </div>
  227. <span slot="footer" class="dialog-footer">
  228. <el-button @click="showSetting = false">取 消</el-button>
  229. <el-button @click="delRow" type="danger">重 置</el-button>
  230. <el-button type="primary" @click="save()">确 定</el-button>
  231. </span>
  232. </el-dialog>
  233. <el-table v-loading="loading" :data="receivableList" show-summary :summary-method="getSum">
  234. <!-- <el-table-column type="selection" width="55" align="center" /> -->
  235. <el-table-column type="index" label="行号" align="center" width="100"/>
  236. <el-table-column
  237. v-for="(item, index) in getRowList"
  238. :key="index"
  239. :label="item.name"
  240. :width="item.width"
  241. :prop="item.label"
  242. align="center"
  243. :show-overflow-tooltip="true"
  244. sortable
  245. :fixed="item.fixed"
  246. />
  247. <!-- <el-table-column label="货权方" sortable align="center" prop="fName" width="220"/>
  248. <el-table-column label="结算单位" sortable align="center" prop="fFeesName" width="220"/>
  249. <el-table-column label="提单号" sortable align="center" prop="fMblno" width="216" show-overflow-tooltip/>
  250. <el-table-column label="货物名称" align="center" prop="fProductName" show-overflow-tooltip/>
  251. <el-table-column label="品牌" align="center" prop="fMarks" width="120"/>
  252. <el-table-column label="审核日期" align="center" prop="fReviewDate">
  253. <template slot-scope="scope">
  254. <span>{{ parseTime(scope.row.fReviewDate, '{y}-{m}-{d}') }}</span>
  255. </template>
  256. </el-table-column>
  257. <el-table-column label="应收金额" align="center" prop="fAmount"/>
  258. <el-table-column label="应付金额" align="center" prop="fStlamount"/>
  259. <el-table-column label="利润" align="center" prop="nnfinished"/> -->
  260. </el-table>
  261. <pagination
  262. v-show="total>0"
  263. :total="total"
  264. :page.sync="queryParams.pageNum"
  265. :limit.sync="queryParams.pageSize"
  266. :page-sizes="[50,100, 200, 500, 1000]"
  267. @pagination="getList"
  268. />
  269. </div>
  270. </template>
  271. <script>
  272. import {
  273. listpayable,
  274. listWhgenleg,
  275. getWhgenleg,
  276. delWhgenleg,
  277. addWhgenleg,
  278. updateWhgenleg,
  279. exportWhgenleg
  280. } from '@/api/reportManagement/profit'
  281. import { listWarehouse } from '@/api/basicdata/warehouse'
  282. import { listArea } from '@/api/basicdata/area'
  283. import { listGoods } from '@/api/basicdata/goods'
  284. import { listCorps } from '@/api/basicdata/corps'
  285. import { listFees } from '@/api/basicdata/fees'
  286. import { addSet, select, resetModule } from "@/api/system/set";
  287. import Cookies from "js-cookie";
  288. import draggable from "vuedraggable";
  289. export default {
  290. name: 'profitGeneralLedger',
  291. components: {draggable},
  292. data() {
  293. return {
  294. //费用名称
  295. fWbuOptions:[],
  296. businessInTypeOption:[],
  297. businessOutTypeOption:[],
  298. businessTransTypeOption:[],
  299. businessTypeOption: [],
  300. // 货权方(客户数据)
  301. fMblnoOptions: [],
  302. // 贸易方式(数据字典),对应t_trademodels 字典
  303. fTrademodeidOptions: [],
  304. // 货物
  305. goodsOptions: [],
  306. // 仓库(仓库数据)
  307. warehouseOptions: [],
  308. kqhouseOptions: [],
  309. // 遮罩层
  310. loading: true,
  311. // 显示搜索条件
  312. showSearch: true,
  313. // 总条数
  314. total: 0,
  315. // 库存总账表格数据
  316. receivableList: [],
  317. // 弹出层标题
  318. title: '',
  319. // 是否显示弹出层
  320. open: false,
  321. // 查询参数
  322. queryParams: {
  323. pageNum: 1,
  324. pageSize: 50,
  325. fCorpid: null,
  326. fMblno: null,
  327. timeExamine: null,
  328. fToCorpid: null,
  329. fProductName: null,
  330. fMarks: null,
  331. fReconciliation: null,
  332. fBillstatus: null,
  333. fBusinessType:null,
  334. fFeeid:null
  335. },
  336. // 表单参数
  337. form: {},
  338. // 表单校验
  339. rules: {
  340. fMarks: [
  341. { required: true, message: '唛头不能为空', trigger: 'blur' }
  342. ]
  343. },
  344. showSetting: false,
  345. drag: false,
  346. setRowList: [],
  347. getRowList: [],
  348. tableDate: [
  349. {
  350. surface: "1",
  351. label: "fName",
  352. name: "货权方",
  353. checked: 0,
  354. width: 150,
  355. },
  356. {
  357. surface: "2",
  358. label: "fFeesName",
  359. name: "结算单位",
  360. checked: 0,
  361. width: 120,
  362. },
  363. {
  364. surface: "3",
  365. label: "fMblno",
  366. name: "提单号",
  367. checked: 0,
  368. width: 150,
  369. },
  370. {
  371. surface: "4",
  372. label: "fProductName",
  373. name: "货物名称",
  374. checked: 0,
  375. width: 150,
  376. },
  377. {
  378. surface: "5",
  379. label: "fMarks",
  380. name: "品牌",
  381. checked: 0,
  382. width: 150,
  383. },
  384. {
  385. surface: "6",
  386. label: "fReviewDate",
  387. name: "审核日期",
  388. checked: 0,
  389. width: 150,
  390. },
  391. {
  392. surface: "7",
  393. label: "fAmount",
  394. name: "应收金额",
  395. checked: 0,
  396. width: 120,
  397. },
  398. {
  399. surface: "8",
  400. label: "fStlamount",
  401. name: "应付金额",
  402. checked: 0,
  403. width: 120,
  404. },
  405. {
  406. surface: "9",
  407. label: "nnfinished",
  408. name: "利润",
  409. checked: 0,
  410. width: 120,
  411. }
  412. ],
  413. allCheck: false,
  414. }
  415. },
  416. created() {
  417. this.setRowList = this.tableDate;
  418. this.getRowList = this.tableDate;
  419. /* 远程模糊查询费用名称 */
  420. this.fWRemoteMethod()
  421. let this_ = this
  422. this_.getList()
  423. this_.getDicts('data_trademodes').then((response) => {
  424. this_.fTrademodeidOptions = response.data
  425. })
  426. this_.getDicts('st_in_type').then((response) => {
  427. this_.businessInTypeOption = response.data
  428. this_.getDicts('st_out_type').then((response) => {
  429. this_.businessOutTypeOption = response.data
  430. this_.getDicts('st_trans_type').then((response) => {
  431. this_.businessTransTypeOption = response.data
  432. this_.merge(this_.businessOutTypeOption,this_.businessInTypeOption,this_.businessTransTypeOption)
  433. })
  434. })
  435. })
  436. this.getRow();
  437. },
  438. methods: {
  439. //列设置全选
  440. allChecked() {
  441. if (this.allCheck == true) {
  442. this.setRowList.map((e) => {
  443. return (e.checked = 0);
  444. });
  445. } else {
  446. this.setRowList.map((e) => {
  447. return (e.checked = 1);
  448. });
  449. }
  450. },
  451. //查询列数据
  452. getRow() {
  453. let that = this;
  454. this.data = {
  455. tableName: "利润总账",
  456. userId: Cookies.get("userName"),
  457. };
  458. select(this.data).then((res) => {
  459. if (res.data.length != 0) {
  460. this.getRowList = res.data.filter((e) => e.checked == 0);
  461. this.setRowList = res.data;
  462. this.setRowList = this.setRowList.reduce((res, item) => {
  463. res.push({
  464. surface: item.surface,
  465. label: item.label,
  466. name: item.name,
  467. checked: item.checked,
  468. width: item.width,
  469. fixed: item.fixed,
  470. });
  471. return res;
  472. }, []);
  473. }
  474. });
  475. },
  476. delRow() {
  477. this.data = {
  478. tableName: "利润总账",
  479. userId: Cookies.get("userName"),
  480. };
  481. resetModule(this.data).then((res) => {
  482. if (res.code == 200) {
  483. this.showSetting = false;
  484. this.setRowList = this.tableDate;
  485. this.getRowList = this.tableDate;
  486. }
  487. });
  488. },
  489. //保存列设置
  490. save() {
  491. this.showSetting = false;
  492. this.data = {
  493. tableName: "利润总账",
  494. userId: Cookies.get("userName"),
  495. sysTableSetList: this.setRowList,
  496. };
  497. addSet(this.data).then((res) => {
  498. if (res.code == 200) {
  499. this.showSetting = false;
  500. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  501. }
  502. });
  503. },
  504. //开始拖拽事件
  505. onStart() {
  506. this.drag = true;
  507. },
  508. //拖拽结束事件
  509. onEnd() {
  510. this.drag = false;
  511. },
  512. getSum(param) {
  513. const { columns, data } = param
  514. const sums = []
  515. columns.forEach((column, index) => {
  516. if (index === 0) {
  517. sums[index] = '总计'
  518. } else if (index === 7 || index === 8 || index === 9) {
  519. const values = data.map(item => Number(item[column.property]))
  520. if (!values.every(value => isNaN(value))) {
  521. sums[index] = values.reduce((prev, curr) => {
  522. const value = Number(curr)
  523. if (!isNaN(value)) {
  524. return prev + curr
  525. } else {
  526. return prev
  527. }
  528. }, 0)
  529. }
  530. }
  531. })
  532. return sums
  533. },
  534. // 贸易方式(数据字典),对���t_trademodels 字典翻译
  535. fTrademodeidFormat(row, column) {
  536. return this.selectDictLabel(this.fTrademodeidOptions, row.fTrademodeid)
  537. },
  538. /* 远程模糊查询仓库 */
  539. warehouseRemoteMethod(name) {
  540. if (name == null || name === '') {
  541. return false
  542. }
  543. let queryParams = { pageNum: 1, pageSize: 10, fName: name }
  544. listWarehouse(queryParams).then((response) => {
  545. this.warehouseOptions = response.rows
  546. })
  547. },
  548. /* 远程模糊查询费用名称 */
  549. fWRemoteMethod(name) {
  550. // if (name == null || name === "") {
  551. // return false;
  552. // }
  553. let queryParams = { pageNum: 1, fName: name };
  554. console.log(queryParams)
  555. listFees(queryParams).then((response) => {
  556. this.fWbuOptions = response.rows
  557. console.log(response)
  558. });
  559. },
  560. /* 远程模糊查询库区 */
  561. kqhouseRemoteMethod(name) {
  562. if (name == null || name === '') {
  563. return false
  564. }
  565. if (!this.queryParams.fWarehouseid) {
  566. this.$message.error('请输入仓库!')
  567. return false
  568. }
  569. let queryParams = {
  570. pageNum: 1,
  571. pageSize: 10,
  572. fWarehouseid: this.queryParams.fWarehouseid,
  573. fName: name
  574. }
  575. listArea(queryParams).then((response) => {
  576. this.kqhouseOptions = response.rows
  577. })
  578. },
  579. /* 远程模糊查询商品 */
  580. goodsRemoteMethod(name) {
  581. if (name == null || name === '') {
  582. return false
  583. }
  584. let queryParams = { pageNum: 1, pageSize: 10, fName: name }
  585. listGoods(queryParams).then((response) => {
  586. this.goodsOptions = response.rows
  587. })
  588. },
  589. /* 远程模糊查询用户 */
  590. corpsRemoteMethod(name) {
  591. if (name == null || name === '') {
  592. return false
  593. }
  594. let queryParams = { pageNum: 1, pageSize: 10, fName: name }
  595. listCorps(queryParams).then((response) => {
  596. this.fMblnoOptions = response.rows
  597. this.KHblnoOptions = response.rows
  598. })
  599. },
  600. merge(index,list,err){
  601. this.businessTypeOption = this.businessTypeOption.concat(index,list,err)
  602. },
  603. /** 查询库存总账列表 */
  604. getList() {
  605. this.loading = true
  606. this.getDicts('approval_process').then((response) => {
  607. this.options = response.data
  608. })
  609. listpayable(this.queryParams).then(response => {
  610. this.receivableList = response.rows
  611. this.total = response.total
  612. this.loading = false
  613. })
  614. },
  615. // 取消按钮
  616. cancel() {
  617. this.open = false
  618. this.reset()
  619. },
  620. // 表单重置
  621. reset() {
  622. this.form = {
  623. fAccyear: null,
  624. fId: null,
  625. fAccmonth: null,
  626. fCorpid: null,
  627. fMblno: null,
  628. fOriginalbillno: null,
  629. fWarehouseLocationid: null,
  630. fGoodsid: null,
  631. fTrademodeid: null,
  632. fPreqty: null,
  633. fPregrossweight: null,
  634. fPrenetweight: null,
  635. fQtyd: null,
  636. fVolumnd: null,
  637. fGrossweightd: null,
  638. fNetweightd: null,
  639. fVolumnc: null,
  640. fQtyc: null,
  641. fQtyblc: null,
  642. fGrossweightc: null,
  643. fNetweightc: null,
  644. fGrossweightblc: null,
  645. fNetweightblc: null,
  646. fCntrno: null,
  647. fStatus: '0',
  648. delFlag: null,
  649. createBy: null,
  650. fMarks: null,
  651. createTime: null,
  652. updateBy: null,
  653. updateTime: null,
  654. remark: null
  655. }
  656. this.resetForm('form')
  657. },
  658. /** 搜索按钮操作 */
  659. handleQuery() {
  660. this.queryParams.pageNum = 1
  661. this.getList()
  662. },
  663. /** 重置按钮操作 */
  664. resetQuery() {
  665. this.resetForm('queryForm')
  666. this.handleQuery()
  667. },
  668. /** 新增按钮操作 */
  669. handleAdd() {
  670. this.reset()
  671. this.open = true
  672. this.title = '添加库存总账'
  673. },
  674. /** 提交按钮 */
  675. submitForm() {
  676. this.$refs['form'].validate(valid => {
  677. if (valid) {
  678. if (this.form.fAccyear != null) {
  679. updateWhgenleg(this.form).then(response => {
  680. this.msgSuccess('修改成功')
  681. this.open = false
  682. this.getList()
  683. })
  684. } else {
  685. addWhgenleg(this.form).then(response => {
  686. this.msgSuccess('新增成功')
  687. this.open = false
  688. this.getList()
  689. })
  690. }
  691. }
  692. })
  693. },
  694. /** 导出按钮操作 */
  695. handleExport() {
  696. const queryParams = this.queryParams
  697. this.$confirm('是否确认导出所有利润总账数据项?', '警告', {
  698. confirmButtonText: '确定',
  699. cancelButtonText: '取消',
  700. type: 'warning'
  701. }).then(function() {
  702. return exportWhgenleg(queryParams)
  703. }).then(response => {
  704. this.download(response.msg)
  705. })
  706. }
  707. }
  708. }
  709. </script>
  710. <style lang="scss">
  711. .tabSetting {
  712. display: flex;
  713. justify-content: flex-end;
  714. }
  715. .listStyle {
  716. display: flex;
  717. border-top: 1px solid #dcdfe6;
  718. border-left: 1px solid #dcdfe6;
  719. border-right: 1px solid #dcdfe6;
  720. }
  721. .listStyle:last-child {
  722. border-bottom: 1px solid #dcdfe6;
  723. }
  724. .progress {
  725. display: flex;
  726. align-items: center;
  727. padding: 2px;
  728. background-color: rgba(0, 0, 0, 0.05);
  729. height: 100%;
  730. }
  731. </style>