index.vue 31 KB

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