index.vue 32 KB

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