index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item label="客户" prop="fCorpid">
  11. <el-select
  12. v-model="queryParams.fCorpid"
  13. filterable
  14. remote
  15. style="width: 200px"
  16. clearable
  17. size="small"
  18. @keyup.enter.native="handleQuery"
  19. :remote-method="corpsRemoteMethod"
  20. placeholder="请选择客户"
  21. >
  22. <el-option
  23. v-for="(dict, index) in fMblnoOptions"
  24. :key="index.fId"
  25. :label="dict.fName"
  26. :value="dict.fId"
  27. ></el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="提单号" prop="fMblno">
  31. <el-input
  32. v-model="queryParams.fMblno"
  33. placeholder="请输入提单号"
  34. clearable
  35. style="width: 200px"
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="箱号" prop="fCntrno">
  41. <el-input
  42. v-model="queryParams.fCntrno"
  43. placeholder="请输入箱号"
  44. clearable
  45. style="width: 200px"
  46. size="small"
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item label="入库日期" prop="createTime">
  51. <el-date-picker
  52. v-model="queryParams.orgStorageDate"
  53. type="daterange"
  54. value-format="yyyy-MM-dd"
  55. clearable
  56. size="small"
  57. style="width: 240px"
  58. range-separator="至"
  59. start-placeholder="开始日期"
  60. end-placeholder="结束日期"
  61. @keyup.enter.native="handleQuery"
  62. >
  63. </el-date-picker>
  64. </el-form-item>
  65. <el-form-item label="仓库" prop="fwarehouseid">
  66. <treeselect
  67. style="width: 200px"
  68. v-model="queryParams.fWarehouseLocationid"
  69. :options="fWarehouseidOption"
  70. @select="treeseLect"
  71. :show-count="true"
  72. size="small"
  73. placeholder="请选择归属库区"
  74. />
  75. </el-form-item>
  76. <el-form-item label="货物名称" prop="fgoodsid">
  77. <el-select
  78. v-model="queryParams.fGoodsid"
  79. filterable
  80. remote
  81. style="width: 200px"
  82. clearable
  83. size="small"
  84. :remote-method="goodsRemoteMethod"
  85. @keyup.enter.native="handleQuery"
  86. placeholder="请选择货物名称"
  87. >
  88. <el-option
  89. v-for="(dict, index) in goodsOptions"
  90. :key="index.fId"
  91. :label="dict.fName"
  92. :value="dict.fId"
  93. ></el-option>
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item label="贸易方式" prop="fTrademodeid">
  97. <el-select
  98. v-model="queryParams.fTrademodeid"
  99. placeholder="请选择贸易方式"
  100. clearable
  101. style="width: 200px"
  102. size="small"
  103. @keyup.enter.native="handleQuery"
  104. >
  105. <el-option
  106. v-for="(dict, index) in fTrademodeidOptions"
  107. :key="index.dictValue"
  108. :label="dict.dictLabel"
  109. :value="dict.dictValue"
  110. />
  111. </el-select>
  112. </el-form-item>
  113. <el-form-item label="按照箱号">
  114. <el-select
  115. v-model="queryParams.isCntrno"
  116. filterable
  117. remote
  118. style="width: 200px"
  119. clearable
  120. size="small"
  121. >
  122. <el-option
  123. v-for="(dict, index) in isCntrnoOptions"
  124. :key="index.id"
  125. :label="dict.name"
  126. :value="dict.id"
  127. ></el-option>
  128. </el-select>
  129. </el-form-item>
  130. <el-form-item label="库存箱号" prop="fLocalcntrno">
  131. <el-input
  132. v-model="queryParams.fLocalcntrno"
  133. placeholder="库存箱号"
  134. clearable
  135. style="width: 200px"
  136. size="small"
  137. @keyup.enter.native="handleQuery"
  138. />
  139. </el-form-item>
  140. <el-form-item>
  141. <el-button
  142. type="cyan"
  143. icon="el-icon-search"
  144. size="mini"
  145. @click="handleQuery"
  146. >搜索</el-button
  147. >
  148. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  149. >重置</el-button
  150. >
  151. </el-form-item>
  152. </el-form>
  153. <el-row :gutter="10" class="mb8">
  154. <div class="tabSetting">
  155. <el-col :span="1.5">
  156. <el-button
  157. type="warning"
  158. icon="el-icon-download"
  159. size="mini"
  160. @click="handleExport"
  161. v-hasPermi="['warehouseBusiness:whgenleg:export']"
  162. >导出</el-button
  163. >
  164. </el-col>
  165. <right-toolbar
  166. :showSearch.sync="showSearch"
  167. @queryTable="getList"
  168. ></right-toolbar>
  169. <div style="margin: 0 12px">
  170. <el-button
  171. icon="el-icon-setting"
  172. size="mini"
  173. circle
  174. @click="showSetting = !showSetting"
  175. ></el-button>
  176. </div>
  177. </div>
  178. </el-row>
  179. <el-dialog title="自定义列显示" :visible.sync="showSetting" width="700px">
  180. <div>配置排序列数据(拖动调整顺序)</div>
  181. <div style="margin-left: 17px">
  182. <el-checkbox
  183. v-model="allCheck"
  184. label="全选"
  185. @change="allChecked"
  186. ></el-checkbox>
  187. </div>
  188. <div style="padding: 4px; display: flex; justify-content: center">
  189. <draggable
  190. v-model="setRowList"
  191. group="site"
  192. animation="300"
  193. @start="onStart"
  194. @end="onEnd"
  195. handle=".indraggable"
  196. >
  197. <transition-group>
  198. <div
  199. v-for="item in setRowList"
  200. :key="item.surface"
  201. class="listStyle"
  202. >
  203. <div style="width: 500px" class="indraggable">
  204. <div class="progress" :style="{ width: item.width + 'px' }">
  205. <el-checkbox
  206. :label="item.name"
  207. v-model="item.checked"
  208. :true-label="0"
  209. :false-label="1"
  210. >{{ item.name }}
  211. </el-checkbox>
  212. </div>
  213. </div>
  214. <el-input-number
  215. v-model.number="item.width"
  216. controls-position="right"
  217. :min="1"
  218. :max="500"
  219. size="mini"
  220. ></el-input-number>
  221. </div>
  222. </transition-group>
  223. </draggable>
  224. </div>
  225. <span slot="footer" class="dialog-footer">
  226. <el-button @click="showSetting = false">取 消</el-button>
  227. <el-button @click="delRow" type="danger">重 置</el-button>
  228. <el-button type="primary" @click="save()">确 定</el-button>
  229. </span>
  230. </el-dialog>
  231. <el-table
  232. v-loading="loading"
  233. :data="whgenlegList"
  234. show-summary
  235. :summary-method="getSum"
  236. >
  237. <el-table-column
  238. type="index"
  239. label="行号"
  240. align="center"
  241. width="100"
  242. fixed
  243. />
  244. <el-table-column
  245. v-for="(item, index) in getRowList"
  246. :key="index"
  247. :label="item.name"
  248. :width="item.width"
  249. :prop="item.label"
  250. align="center"
  251. :show-overflow-tooltip="true"
  252. sortable
  253. :fixed="item.fixed"
  254. >
  255. <template slot-scope="scope">
  256. <span v-if="item.label == 'fMblno'">
  257. <el-link :underline="false" type="primary"
  258. ><div @click="goDetail(scope.row)">
  259. {{ scope.row.fMblno }}
  260. </div></el-link
  261. >
  262. </span>
  263. <span v-else>{{ scope.row[item.label] }}</span>
  264. </template>
  265. </el-table-column>
  266. </el-table>
  267. <pagination
  268. v-show="total > 0"
  269. :total="total"
  270. :page.sync="queryParams.pageNum"
  271. :limit.sync="queryParams.pageSize"
  272. :page-sizes="[50, 100, 200, 500, 1000]"
  273. @pagination="getList"
  274. />
  275. <!-- 添加或修改库存总账对话框 -->
  276. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  277. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  278. <el-form-item label="原始入库业务编号" prop="fOriginalbillno">
  279. <el-input
  280. v-model="form.fOriginalbillno"
  281. placeholder="请输入原始入库业务编号"
  282. />
  283. </el-form-item>
  284. <el-form-item label="上期件数" prop="fPreqty">
  285. <el-input v-model="form.fPreqty" placeholder="请输入上期件数" />
  286. </el-form-item>
  287. <el-form-item
  288. label="上期毛重,单位为吨,保留6位小数"
  289. prop="fPregrossweight"
  290. >
  291. <el-input
  292. v-model="form.fPregrossweight"
  293. placeholder="请输入上期毛重,单位为吨,保留6位小数"
  294. />
  295. </el-form-item>
  296. <el-form-item label="上期净重," prop="fPrenetweight">
  297. <el-input
  298. v-model="form.fPrenetweight"
  299. placeholder="请输入上期净重,"
  300. />
  301. </el-form-item>
  302. <el-form-item label="入库件数" prop="fQtyd">
  303. <el-input v-model="form.fQtyd" placeholder="请输入入库件数" />
  304. </el-form-item>
  305. <el-form-item label="入库尺码" prop="fVolumnd">
  306. <el-input v-model="form.fVolumnd" placeholder="请输入入库尺码" />
  307. </el-form-item>
  308. <el-form-item label="入库毛重" prop="fGrossweightd">
  309. <el-input v-model="form.fGrossweightd" placeholder="请输入入库毛重" />
  310. </el-form-item>
  311. <el-form-item label="入库净重" prop="fNetweightd">
  312. <el-input v-model="form.fNetweightd" placeholder="请输入入库净重" />
  313. </el-form-item>
  314. <el-form-item label="出口尺码" prop="fVolumnc">
  315. <el-input v-model="form.fVolumnc" placeholder="请输入出口尺码" />
  316. </el-form-item>
  317. <el-form-item label="出库件数" prop="fQtyc">
  318. <el-input v-model="form.fQtyc" placeholder="请输入出库件数" />
  319. </el-form-item>
  320. <el-form-item label="结余件数" prop="fQtyblc">
  321. <el-input v-model="form.fQtyblc" placeholder="请输入结余件数" />
  322. </el-form-item>
  323. <el-form-item label="出库毛重,单位为吨" prop="fGrossweightc">
  324. <el-input
  325. v-model="form.fGrossweightc"
  326. placeholder="请输入出库毛重,单位为吨"
  327. />
  328. </el-form-item>
  329. <el-form-item label="出库净重" prop="fNetweightc">
  330. <el-input v-model="form.fNetweightc" placeholder="请输入出库净重" />
  331. </el-form-item>
  332. <el-form-item label="结余毛重" prop="fGrossweightblc">
  333. <el-input
  334. v-model="form.fGrossweightblc"
  335. placeholder="请输入结余毛重"
  336. />
  337. </el-form-item>
  338. <el-form-item label="结余净重" prop="fNetweightblc">
  339. <el-input v-model="form.fNetweightblc" placeholder="请输入结余净重" />
  340. </el-form-item>
  341. <el-form-item label="箱号" prop="fCntrno">
  342. <el-input v-model="form.fCntrno" placeholder="请输入箱号" />
  343. </el-form-item>
  344. <el-form-item label="状态,默认 T ,正常T 停用F 下拉选择">
  345. <el-radio-group v-model="form.fStatus">
  346. <el-radio label="1">请选择字典生成</el-radio>
  347. </el-radio-group>
  348. </el-form-item>
  349. <el-form-item label="删除状态" prop="delFlag">
  350. <el-input v-model="form.delFlag" placeholder="请输入删除状态" />
  351. </el-form-item>
  352. <el-form-item label="唛头" prop="fMarks">
  353. <el-input v-model="form.fMarks" placeholder="请输入唛头" />
  354. </el-form-item>
  355. <el-form-item label="备注" prop="remark">
  356. <el-input
  357. v-model="form.remark"
  358. type="textarea"
  359. placeholder="请输入内容"
  360. />
  361. </el-form-item>
  362. </el-form>
  363. <div slot="footer" class="dialog-footer">
  364. <el-button type="primary" @click="submitForm">确 定</el-button>
  365. <el-button @click="cancel">取 消</el-button>
  366. </div>
  367. </el-dialog>
  368. </div>
  369. </template>
  370. <script>
  371. import {
  372. mapListWhgenleg,
  373. getWhgenleg,
  374. delWhgenleg,
  375. addWhgenleg,
  376. updateWhgenleg,
  377. exportWhgenleg,
  378. } from "@/api/reportManagement/whgenleg";
  379. import { listWarehouse, treeselect } from "@/api/basicdata/warehouse";
  380. import { listArea } from "@/api/basicdata/area";
  381. import { listGoods } from "@/api/basicdata/goods";
  382. import { listCorps } from "@/api/basicdata/corps";
  383. import Treeselect from "@riophae/vue-treeselect";
  384. import { addSet, select, resetModule } from "@/api/system/set";
  385. import Cookies from "js-cookie";
  386. import draggable from "vuedraggable";
  387. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  388. export default {
  389. name: "Whgenleg",
  390. components: {
  391. Treeselect,
  392. draggable,
  393. },
  394. data() {
  395. return {
  396. //仓库树状下拉
  397. fWarehouseidOption: [],
  398. // 客户(客户数据)
  399. fMblnoOptions: [],
  400. // 贸易方式(数据字典),对应t_trademodels 字典
  401. fTrademodeidOptions: [],
  402. // 货物
  403. goodsOptions: [],
  404. // 仓库(仓库数据)
  405. warehouseOptions: [],
  406. kqhouseOptions: [],
  407. // 遮罩层
  408. loading: true,
  409. // 显示搜索条件
  410. showSearch: true,
  411. // 总条数
  412. total: 0,
  413. // 库存总账表格数据
  414. whgenlegList: [],
  415. // 弹出层标题
  416. title: "",
  417. // 是否显示弹出层
  418. open: false,
  419. // 查询参数
  420. queryParams: {
  421. pageNum: 1,
  422. pageSize: 50,
  423. fOriginalbillno: null,
  424. isCntrno: null,
  425. fPreqty: null,
  426. fLocalcntrno: null,
  427. fPregrossweight: null,
  428. fPrenetweight: null,
  429. fQtyd: null,
  430. fVolumnd: null,
  431. fGrossweightd: null,
  432. fNetweightd: null,
  433. fVolumnc: null,
  434. fQtyc: null,
  435. fQtyblc: null,
  436. fGrossweightc: null,
  437. fNetweightc: null,
  438. fGrossweightblc: null,
  439. fNetweightblc: null,
  440. fCntrno: null,
  441. fStatus: null,
  442. fMarks: null,
  443. orgStorageDate: null,
  444. fBusinessType: null,
  445. fBusinessTypes: null,
  446. },
  447. // 表单参数
  448. form: {},
  449. // 表单校验
  450. rules: {
  451. fMarks: [{ required: true, message: "唛头不能为空", trigger: "blur" }],
  452. },
  453. showSetting: false,
  454. drag: false,
  455. setRowList: [],
  456. getRowList: [],
  457. tableDate: [
  458. {
  459. surface: "0",
  460. label: "fMblno",
  461. name: "提单号",
  462. checked: 0,
  463. width: 100,
  464. fixed: "left",
  465. },
  466. {
  467. surface: "1",
  468. label: "fCorpid",
  469. name: "客户",
  470. checked: 0,
  471. width: 100,
  472. fixed: "left",
  473. },
  474. {
  475. surface: "2",
  476. label: "fOriginalbilldate",
  477. name: "入库日期",
  478. checked: 0,
  479. width: 100,
  480. fixed: "left",
  481. },
  482. {
  483. surface: "3",
  484. label: "fChargedate",
  485. name: "仓储费计算日期",
  486. checked: 0,
  487. width: 100,
  488. fixed: "left",
  489. },
  490. {
  491. surface: "4",
  492. label: "fBusinessTypes",
  493. name: "货物属性",
  494. checked: 0,
  495. width: 100,
  496. },
  497. {
  498. surface: "5",
  499. label: "fMarks",
  500. name: "属性详情",
  501. checked: 0,
  502. width: 100,
  503. },
  504. {
  505. surface: "6",
  506. label: "fGoodsids",
  507. name: "品名",
  508. checked: 0,
  509. width: 100,
  510. },
  511. {
  512. surface: "8",
  513. label: "fWarehouseids",
  514. name: "仓库",
  515. checked: 0,
  516. width: 100,
  517. },
  518. {
  519. surface: "9",
  520. label: "fTrademodeid",
  521. name: "贸易方式",
  522. checked: 0,
  523. width: 100,
  524. },
  525. {
  526. surface: "10",
  527. label: "fQtyD",
  528. name: "入库件数",
  529. checked: 0,
  530. width: 100,
  531. },
  532. {
  533. surface: "11",
  534. label: "fGrossweightD",
  535. name: "入库毛重(kg)",
  536. checked: 0,
  537. width: 100,
  538. },
  539. {
  540. surface: "12",
  541. label: "fNetweightD",
  542. name: "入库净重(kg)",
  543. checked: 0,
  544. width: 100,
  545. },
  546. {
  547. surface: "13",
  548. label: "fQtyC",
  549. name: "出库件数",
  550. checked: 0,
  551. width: 100,
  552. },
  553. {
  554. surface: "14",
  555. label: "fGrossweightC",
  556. name: "出库毛重(kg)",
  557. checked: 0,
  558. width: 100,
  559. },
  560. {
  561. surface: "15",
  562. label: "fNetweightC",
  563. name: "出库净重(kg)",
  564. checked: 0,
  565. width: 100,
  566. },
  567. {
  568. surface: "16",
  569. label: "fQtyblc",
  570. name: "结余件数",
  571. checked: 0,
  572. width: 100,
  573. },
  574. {
  575. surface: "17",
  576. label: "fGrossweightblc",
  577. name: "结余毛重(kg)",
  578. checked: 0,
  579. width: 100,
  580. },
  581. {
  582. surface: "18",
  583. label: "fNetweightblc",
  584. name: "结余净重(kg)",
  585. checked: 0,
  586. width: 100,
  587. },
  588. {
  589. surface: "19",
  590. label: "fCntrno",
  591. name: "箱号",
  592. checked: 0,
  593. width: 100,
  594. },
  595. {
  596. surface: "20",
  597. label: "remark",
  598. name: "备注",
  599. checked: 0,
  600. width: 100,
  601. },
  602. ],
  603. allCheck: false,
  604. isCntrnoOptions: [
  605. {
  606. id: 0,
  607. name: "否",
  608. },
  609. {
  610. id: 1,
  611. name: "是",
  612. },
  613. ],
  614. };
  615. },
  616. created() {
  617. this.setRowList = this.tableDate;
  618. this.getRowList = this.tableDate;
  619. this.getList();
  620. this.getDicts("data_trademodes").then((response) => {
  621. this.fTrademodeidOptions = response.data;
  622. });
  623. treeselect().then((response) => {
  624. this.fWarehouseidOption = response.data;
  625. });
  626. this.getRow();
  627. },
  628. methods: {
  629. //列设置全选
  630. allChecked() {
  631. if (this.allCheck == true) {
  632. this.setRowList.map((e) => {
  633. return (e.checked = 0);
  634. });
  635. } else {
  636. this.setRowList.map((e) => {
  637. return (e.checked = 1);
  638. });
  639. }
  640. },
  641. //查询列数据
  642. getRow() {
  643. let that = this;
  644. this.data = {
  645. tableName: "库存总账",
  646. userId: Cookies.get("userName"),
  647. };
  648. select(this.data).then((res) => {
  649. if (res.data.length != 0) {
  650. this.getRowList = res.data.filter((e) => e.checked == 0);
  651. this.setRowList = res.data;
  652. this.setRowList = this.setRowList.reduce((res, item) => {
  653. res.push({
  654. surface: item.surface,
  655. label: item.label,
  656. name: item.name,
  657. checked: item.checked,
  658. width: item.width,
  659. fixed: item.fixed,
  660. });
  661. return res;
  662. }, []);
  663. }
  664. console.log(this.getRowList);
  665. });
  666. },
  667. delRow() {
  668. this.data = {
  669. tableName: "库存总账",
  670. userId: Cookies.get("userName"),
  671. };
  672. resetModule(this.data).then((res) => {
  673. if (res.code == 200) {
  674. this.showSetting = false;
  675. this.setRowList = this.tableDate;
  676. this.getRowList = this.tableDate;
  677. console.log(this.getRowList);
  678. }
  679. });
  680. },
  681. //保存列设置
  682. save() {
  683. this.showSetting = false;
  684. this.data = {
  685. tableName: "库存总账",
  686. userId: Cookies.get("userName"),
  687. sysTableSetList: this.setRowList,
  688. };
  689. addSet(this.data).then((res) => {
  690. if (res.code == 200) {
  691. this.showSetting = false;
  692. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  693. }
  694. });
  695. },
  696. //开始拖拽事件
  697. onStart() {
  698. this.drag = true;
  699. },
  700. //拖拽结束事件
  701. onEnd() {
  702. this.drag = false;
  703. },
  704. //合计
  705. getSum(param) {
  706. const { columns, data } = param;
  707. const sums = [];
  708. var values = [];
  709. columns.forEach((column, index) => {
  710. if (index === 0) {
  711. sums[index] = "总计";
  712. }
  713. if (column.property === "fGrossweightD") {
  714. values = data.map((item) => Number(item["fGrossweightD"]));
  715. }
  716. if (column.property === "fNetweightD") {
  717. values = data.map((item) => Number(item["fNetweightD"]));
  718. }
  719. if (column.property === "fQtyD") {
  720. values = data.map((item) => Number(item["fQtyD"]));
  721. }
  722. if (column.property === "fGrossweightC") {
  723. values = data.map((item) => Number(item["fGrossweightC"]));
  724. }
  725. if (column.property === "fNetweightC") {
  726. values = data.map((item) => Number(item["fNetweightC"]));
  727. }
  728. if (column.property === "fQtyC") {
  729. values = data.map((item) => Number(item["fQtyC"]));
  730. }
  731. if (column.property === "fQtyblc") {
  732. values = data.map((item) => Number(item["fQtyblc"]));
  733. }
  734. if (column.property === "fGrossweightblc") {
  735. values = data.map((item) => Number(item["fGrossweightblc"]));
  736. }
  737. if (column.property === "fNetweightblc") {
  738. values = data.map((item) => Number(item["fNetweightblc"]));
  739. }
  740. if (
  741. column.property === "fGrossweightD" ||
  742. column.property === "fNetweightD" ||
  743. column.property === "fQtyD" ||
  744. column.property === "fGrossweightC" ||
  745. column.property === "fNetweightC" ||
  746. column.property === "fQtyC" ||
  747. column.property === "fQtyblc" ||
  748. column.property === "fGrossweightblc" ||
  749. column.property === "fNetweightblc"
  750. ) {
  751. const values = data.map((item) => Number(item[column.property]));
  752. if (!values.every((value) => isNaN(value))) {
  753. sums[index] = values.reduce((prev, curr) => {
  754. const value = Number(curr);
  755. if (!isNaN(value)) {
  756. return prev + curr;
  757. } else {
  758. return prev;
  759. }
  760. }, 0);
  761. if (column.property === "fGrossweightD") {
  762. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  763. }
  764. if (column.property === "fNetweightD") {
  765. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  766. }
  767. if (column.property === "fQtyD") {
  768. sums[index] = sums[index].toFixed(2);
  769. }
  770. if (column.property === "fGrossweightC") {
  771. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  772. }
  773. if (column.property === "fNetweightC") {
  774. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  775. }
  776. if (column.property === "fQtyC") {
  777. sums[index] = sums[index].toFixed(2);
  778. }
  779. if (column.property === "fGrossweightblc") {
  780. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  781. }
  782. if (column.property === "fNetweightblc") {
  783. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  784. }
  785. if (column.property === "fQtyblc") {
  786. sums[index] = sums[index].toFixed(2);
  787. }
  788. }
  789. }
  790. });
  791. return sums;
  792. },
  793. treeseLect(tree) {
  794. this.queryParams.fWarehouseLocationid = tree.id;
  795. },
  796. getTreeselect() {
  797. treeselect().then((response) => {
  798. this.warehousesOptions = response.data;
  799. });
  800. },
  801. // 贸易方式(数据字典),对���t_trademodels 字典翻译
  802. fTrademodeidFormat(row, column) {
  803. return this.selectDictLabel(this.fTrademodeidOptions, row.fTrademodeid);
  804. },
  805. /* 远程模糊查询仓库 */
  806. warehouseRemoteMethod(name) {
  807. if (name == null || name === "") {
  808. return false;
  809. }
  810. let queryParams = { pageNum: 1, pageSize: 10, fName: name };
  811. listWarehouse(queryParams).then((response) => {
  812. this.warehouseOptions = response.rows;
  813. });
  814. },
  815. /* 远程模糊查询库区 */
  816. kqhouseRemoteMethod(name) {
  817. if (name == null || name === "") {
  818. return false;
  819. }
  820. if (!this.queryParams.fWarehouseid) {
  821. this.$message.error("请输入仓库!");
  822. return false;
  823. }
  824. let queryParams = {
  825. pageNum: 1,
  826. pageSize: 10,
  827. fWarehouseid: this.queryParams.fWarehouseid,
  828. fName: name,
  829. };
  830. listArea(queryParams).then((response) => {
  831. this.kqhouseOptions = response.rows;
  832. });
  833. },
  834. /* 远程模糊查询商品 */
  835. goodsRemoteMethod(name) {
  836. if (name == null || name === "") {
  837. return false;
  838. }
  839. let queryParams = { pageNum: 1, pageSize: 10, fName: name };
  840. listGoods(queryParams).then((response) => {
  841. this.goodsOptions = response.rows;
  842. });
  843. },
  844. /* 远程模糊查询用户 */
  845. corpsRemoteMethod(name) {
  846. if (name == null || name === "") {
  847. return false;
  848. }
  849. let queryParams = { pageNum: 1, pageSize: 10, fName: name };
  850. listCorps(queryParams).then((response) => {
  851. this.fMblnoOptions = response.rows;
  852. this.KHblnoOptions = response.rows;
  853. });
  854. },
  855. /** 查询库存总账列表 */
  856. getList() {
  857. this.loading = true;
  858. mapListWhgenleg(this.queryParams).then((response) => {
  859. console.log(response);
  860. this.whgenlegList = response.rows;
  861. this.total = response.total;
  862. this.loading = false;
  863. });
  864. },
  865. // 取消按钮
  866. cancel() {
  867. this.open = false;
  868. this.reset();
  869. },
  870. // 表单重置
  871. reset() {
  872. this.form = {
  873. fAccyear: null,
  874. fId: null,
  875. fAccmonth: null,
  876. fCorpid: null,
  877. fMblno: null,
  878. fOriginalbillno: null,
  879. fWarehouseLocationid: null,
  880. fGoodsid: null,
  881. fTrademodeid: null,
  882. fPreqty: null,
  883. fPregrossweight: null,
  884. fPrenetweight: null,
  885. fQtyd: null,
  886. fVolumnd: null,
  887. fGrossweightd: null,
  888. fNetweightd: null,
  889. fVolumnc: null,
  890. fQtyc: null,
  891. fQtyblc: null,
  892. fGrossweightc: null,
  893. fNetweightc: null,
  894. fGrossweightblc: null,
  895. fNetweightblc: null,
  896. fCntrno: null,
  897. fStatus: "0",
  898. delFlag: null,
  899. createBy: null,
  900. fMarks: null,
  901. createTime: null,
  902. updateBy: null,
  903. updateTime: null,
  904. remark: null,
  905. };
  906. this.resetForm("form");
  907. },
  908. /** 搜索按钮操作 */
  909. handleQuery() {
  910. this.queryParams.pageNum = 1;
  911. this.getList();
  912. },
  913. /** 重置按钮操作 */
  914. resetQuery() {
  915. this.queryParams = {
  916. pageNum: 1,
  917. pageSize: 10,
  918. fOriginalbillno: null,
  919. fPreqty: null,
  920. fPregrossweight: null,
  921. fPrenetweight: null,
  922. fQtyd: null,
  923. fVolumnd: null,
  924. fGrossweightd: null,
  925. fNetweightd: null,
  926. fVolumnc: null,
  927. fQtyc: null,
  928. fQtyblc: null,
  929. fGrossweightc: null,
  930. fNetweightc: null,
  931. fGrossweightblc: null,
  932. fNetweightblc: null,
  933. fCntrno: null,
  934. fStatus: null,
  935. fMarks: null,
  936. fBusinessType: null,
  937. fBusinessTypes: null,
  938. fBilltype: null,
  939. fwarehouseid: null,
  940. };
  941. // this.resetForm("queryForm");
  942. this.handleQuery();
  943. },
  944. /** 新增按钮操作 */
  945. handleAdd() {
  946. this.reset();
  947. this.open = true;
  948. this.title = "添加库存总账";
  949. },
  950. /** 提交按钮 */
  951. submitForm() {
  952. this.$refs["form"].validate((valid) => {
  953. if (valid) {
  954. if (this.form.fAccyear != null) {
  955. updateWhgenleg(this.form).then((response) => {
  956. this.msgSuccess("修改成功");
  957. this.open = false;
  958. this.getList();
  959. });
  960. } else {
  961. addWhgenleg(this.form).then((response) => {
  962. this.msgSuccess("新增成功");
  963. this.open = false;
  964. this.getList();
  965. });
  966. }
  967. }
  968. });
  969. },
  970. /** 导出按钮操作 */
  971. handleExport() {
  972. const queryParams = this.queryParams;
  973. this.$confirm("是否确认导出所有库存总账数据项?", "警告", {
  974. confirmButtonText: "确定",
  975. cancelButtonText: "取消",
  976. type: "warning",
  977. })
  978. .then(function () {
  979. return exportWhgenleg(queryParams);
  980. })
  981. .then((response) => {
  982. this.download(response.msg);
  983. });
  984. },
  985. goDetail(row) {
  986. this.$router.push({
  987. path: "/analysis/stockDetail",
  988. query: {
  989. fWarehouseLocationid: row.fWarehouseLocationid,
  990. fTrademodeids: row.fTrademodeids,
  991. fBusinessType: row.fBusinessType,
  992. fGoodsid: row.fGoodsid,
  993. fCorpIds: row.fCorpIds,
  994. fMarks: row.fMarks,
  995. fMblno: row.fMblno,
  996. },
  997. });
  998. },
  999. },
  1000. };
  1001. </script>
  1002. <style lang="scss">
  1003. .el-table {
  1004. .el-table__body-wrapper {
  1005. z-index: 2;
  1006. }
  1007. }
  1008. .tabSetting {
  1009. display: flex;
  1010. justify-content: flex-end;
  1011. }
  1012. .listStyle {
  1013. display: flex;
  1014. border-top: 1px solid #dcdfe6;
  1015. border-left: 1px solid #dcdfe6;
  1016. border-right: 1px solid #dcdfe6;
  1017. }
  1018. .listStyle:last-child {
  1019. border-bottom: 1px solid #dcdfe6;
  1020. }
  1021. .progress {
  1022. display: flex;
  1023. align-items: center;
  1024. padding: 2px;
  1025. background-color: rgba(0, 0, 0, 0.05);
  1026. height: 100%;
  1027. }
  1028. </style>