index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="仓库" prop="fwarehouseid">
  5. <treeselect style="width:200px"
  6. v-model="queryParams.fWarehouseLocationid"
  7. :options="fWarehouseidOption"
  8. @select="treeseLect"
  9. :show-count="true"
  10. size="small"
  11. placeholder="请选择归属库区" />
  12. </el-form-item>
  13. <el-form-item label="货物名称" prop="fgoodsid">
  14. <el-select
  15. v-model="queryParams.fGoodsid"
  16. filterable
  17. remote
  18. style="width:200px"
  19. clearable
  20. size="small"
  21. :remote-method="goodsRemoteMethod"
  22. @keyup.enter.native="handleQuery"
  23. placeholder="请选择货物名称"
  24. >
  25. <el-option
  26. v-for="(dict, index) in goodsOptions"
  27. :key="index.fId"
  28. :label="dict.fName"
  29. :value="dict.fId"
  30. ></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="贸易方式" prop="fTrademodeid">
  34. <el-select
  35. v-model="queryParams.fTrademodeid"
  36. placeholder="请选择贸易方式"
  37. clearable
  38. style="width:200px"
  39. size="small"
  40. @keyup.enter.native="handleQuery"
  41. >
  42. <el-option
  43. v-for="(dict, index) in fTrademodeidOptions"
  44. :key="index.dictValue"
  45. :label="dict.dictLabel"
  46. :value="dict.dictValue"
  47. />
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="货权方" prop="fCorpid">
  51. <el-select
  52. v-model="queryParams.fCorpid"
  53. filterable
  54. remote
  55. style="width:200px"
  56. clearable
  57. size="small"
  58. @keyup.enter.native="handleQuery"
  59. :remote-method="corpsRemoteMethod"
  60. placeholder="请选择货权方"
  61. >
  62. <el-option
  63. v-for="(dict, index) in fMblnoOptions"
  64. :key="index.fId"
  65. :label="dict.fName"
  66. :value="dict.fId"
  67. ></el-option>
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="提单号" prop="fMblno">
  71. <el-input
  72. v-model="queryParams.fMblno"
  73. placeholder="请输入提单号"
  74. clearable
  75. style="width:200px"
  76. size="small"
  77. @keyup.enter.native="handleQuery"
  78. />
  79. </el-form-item>
  80. <el-form-item label="箱号" prop="fCntrno">
  81. <el-input
  82. v-model="queryParams.fCntrno"
  83. placeholder="请输入箱号"
  84. clearable
  85. style="width:200px"
  86. size="small"
  87. @keyup.enter.native="handleQuery"
  88. />
  89. </el-form-item>
  90. <el-form-item label="入库日期" prop="createTime">
  91. <el-date-picker
  92. v-model="queryParams.timeInterval"
  93. type="daterange"
  94. value-format="yyyy-MM-dd"
  95. clearable
  96. size="small"
  97. style="width: 240px"
  98. range-separator="至"
  99. start-placeholder="开始日期"
  100. end-placeholder="结束日期"
  101. @keyup.enter.native="handleQuery">
  102. </el-date-picker>
  103. </el-form-item>
  104. <el-form-item>
  105. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  106. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  107. </el-form-item>
  108. </el-form>
  109. <el-row :gutter="10" class="mb8">
  110. <el-col :span="1.5">
  111. <el-button
  112. type="warning"
  113. icon="el-icon-download"
  114. size="mini"
  115. @click="handleExport"
  116. v-hasPermi="['warehouseBusiness:whgenleg:export']"
  117. >导出</el-button>
  118. </el-col>
  119. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  120. </el-row>
  121. <el-table v-loading="loading" :data="whgenlegList" show-summary :summary-method="getSum">
  122. <!-- <el-table-column type="selection" width="55" align="center" /> -->
  123. <el-table-column type="index" label="行号" align="center" width="120" fixed/>
  124. <el-table-column label="客户" sortable align="center" prop="fCorpid" fixed width="220"/>
  125. <el-table-column label="入库日期" sortable align="center" prop="fReviewDate" fixed width="120">
  126. <template slot-scope="scope">
  127. <span>{{ parseTime(scope.row.fOriginalbilldate , "{y}-{m}-{d}") }}</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="仓储费计算日期" sortable align="center" prop="fChargedate" fixed width="140">
  131. <template slot-scope="scope">
  132. <span>{{ parseTime(scope.row.fChargedate , "{y}-{m}-{d}") }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="提单号" sortable align="center" fixed prop="fMblno" show-overflow-tooltip width="216"/>
  136. <el-table-column label="货物属性" align="center" prop="fBusinessTypes" width="120"/>
  137. <el-table-column label="属性详情" align="center" prop="fMarks" width="120"/>
  138. <el-table-column label="品名" align="center" prop="fGoodsids" width="120"/>
  139. <el-table-column label="仓库" sortable align="center" prop="fWarehouseids" width="120"/>
  140. <el-table-column
  141. label="贸易方式"
  142. align="center"
  143. prop="fTrademodeid"
  144. :formatter="fTrademodeidFormat"
  145. width="120"
  146. />
  147. <el-table-column label="入库件数" align="center" prop="fQtyD" width="120"/>
  148. <!-- <el-table-column label="入库尺码" align="center" prop="fVolumnD" />-->
  149. <el-table-column label="入库毛重(kg)" align="center" prop="fGrossweightD" width="120"/>
  150. <el-table-column label="入库净重(kg)" align="center" prop="fNetweightD" width="120"/>
  151. <!-- <el-table-column label="出库尺码" align="center" prop="fVolumnC" />-->
  152. <el-table-column label="出库件数" align="center" prop="fQtyC" width="120"/>
  153. <el-table-column label="出库毛重(kg)" align="center" prop="fGrossweightC" width="120"/>
  154. <el-table-column label="出库净重(kg)" align="center" prop="fNetweightC" width="120"/>
  155. <el-table-column label="结余件数" align="center" prop="fQtyblc" width="120"/>
  156. <el-table-column label="结余毛重(kg)" align="center" prop="fGrossweightblc" width="120"/>
  157. <el-table-column label="结余净重(kg)" align="center" prop="fNetweightblc" width="120"/>
  158. <el-table-column label="箱号" align="center" prop="fCntrno" width="120"/>
  159. <el-table-column label="备注" align="center" prop="remark" width="120"/>
  160. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  161. <template slot-scope="scope">
  162. <el-button
  163. size="mini"
  164. type="text"
  165. icon="el-icon-edit"
  166. @click="handleUpdate(scope.row)"
  167. v-hasPermi="['warehouseBusiness:whgenleg:edit']"
  168. >修改</el-button>
  169. <el-button
  170. size="mini"
  171. type="text"
  172. icon="el-icon-delete"
  173. @click="handleDelete(scope.row)"
  174. v-hasPermi="['warehouseBusiness:whgenleg:remove']"
  175. >删除</el-button>
  176. </template>
  177. </el-table-column> -->
  178. </el-table>
  179. <pagination
  180. v-show="total>0"
  181. :total="total"
  182. :page.sync="queryParams.pageNum"
  183. :limit.sync="queryParams.pageSize"
  184. :page-sizes="[50,100, 200, 500, 1000]"
  185. @pagination="getList"
  186. />
  187. <!-- 添加或修改库存总账对话框 -->
  188. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  189. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  190. <el-form-item label="原始入库业务编号" prop="fOriginalbillno">
  191. <el-input v-model="form.fOriginalbillno" placeholder="请输入原始入库业务编号" />
  192. </el-form-item>
  193. <el-form-item label="上期件数" prop="fPreqty">
  194. <el-input v-model="form.fPreqty" placeholder="请输入上期件数" />
  195. </el-form-item>
  196. <el-form-item label="上期毛重,单位为吨,保留6位小数" prop="fPregrossweight">
  197. <el-input v-model="form.fPregrossweight" placeholder="请输入上期毛重,单位为吨,保留6位小数" />
  198. </el-form-item>
  199. <el-form-item label="上期净重," prop="fPrenetweight">
  200. <el-input v-model="form.fPrenetweight" placeholder="请输入上期净重," />
  201. </el-form-item>
  202. <el-form-item label="入库件数" prop="fQtyd">
  203. <el-input v-model="form.fQtyd" placeholder="请输入入库件数" />
  204. </el-form-item>
  205. <el-form-item label="入库尺码" prop="fVolumnd">
  206. <el-input v-model="form.fVolumnd" placeholder="请输入入库尺码" />
  207. </el-form-item>
  208. <el-form-item label="入库毛重" prop="fGrossweightd">
  209. <el-input v-model="form.fGrossweightd" placeholder="请输入入库毛重" />
  210. </el-form-item>
  211. <el-form-item label="入库净重" prop="fNetweightd">
  212. <el-input v-model="form.fNetweightd" placeholder="请输入入库净重" />
  213. </el-form-item>
  214. <el-form-item label="出口尺码" prop="fVolumnc">
  215. <el-input v-model="form.fVolumnc" placeholder="请输入出口尺码" />
  216. </el-form-item>
  217. <el-form-item label="出库件数" prop="fQtyc">
  218. <el-input v-model="form.fQtyc" placeholder="请输入出库件数" />
  219. </el-form-item>
  220. <el-form-item label="结余件数" prop="fQtyblc">
  221. <el-input v-model="form.fQtyblc" placeholder="请输入结余件数" />
  222. </el-form-item>
  223. <el-form-item label="出库毛重,单位为吨" prop="fGrossweightc">
  224. <el-input v-model="form.fGrossweightc" placeholder="请输入出库毛重,单位为吨" />
  225. </el-form-item>
  226. <el-form-item label="出库净重" prop="fNetweightc">
  227. <el-input v-model="form.fNetweightc" placeholder="请输入出库净重" />
  228. </el-form-item>
  229. <el-form-item label="结余毛重" prop="fGrossweightblc">
  230. <el-input v-model="form.fGrossweightblc" placeholder="请输入结余毛重" />
  231. </el-form-item>
  232. <el-form-item label="结余净重" prop="fNetweightblc">
  233. <el-input v-model="form.fNetweightblc" placeholder="请输入结余净重" />
  234. </el-form-item>
  235. <el-form-item label="箱号" prop="fCntrno">
  236. <el-input v-model="form.fCntrno" placeholder="请输入箱号" />
  237. </el-form-item>
  238. <el-form-item label="状态,默认 T ,正常T 停用F 下拉选择">
  239. <el-radio-group v-model="form.fStatus">
  240. <el-radio label="1">请选择字典生成</el-radio>
  241. </el-radio-group>
  242. </el-form-item>
  243. <el-form-item label="删除状态" prop="delFlag">
  244. <el-input v-model="form.delFlag" placeholder="请输入删除状态" />
  245. </el-form-item>
  246. <el-form-item label="唛头" prop="fMarks">
  247. <el-input v-model="form.fMarks" placeholder="请输入唛头" />
  248. </el-form-item>
  249. <el-form-item label="备注" prop="remark">
  250. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  251. </el-form-item>
  252. </el-form>
  253. <div slot="footer" class="dialog-footer">
  254. <el-button type="primary" @click="submitForm">确 定</el-button>
  255. <el-button @click="cancel">取 消</el-button>
  256. </div>
  257. </el-dialog>
  258. </div>
  259. </template>
  260. <script>
  261. import { listWhgenleg, getWhgenleg, delWhgenleg, addWhgenleg, updateWhgenleg, exportWhgenleg } from "@/api/reportManagement/whgenleg";
  262. import { listWarehouse, treeselect } from '@/api/basicdata/warehouse'
  263. import {listArea} from "@/api/basicdata/area";
  264. import {listGoods} from "@/api/basicdata/goods";
  265. import {listCorps} from "@/api/basicdata/corps";
  266. import Treeselect from '@riophae/vue-treeselect'
  267. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  268. export default {
  269. name: "Whgenleg",
  270. components: {
  271. Treeselect
  272. },
  273. data() {
  274. return {
  275. //仓库树状下拉
  276. fWarehouseidOption:[],
  277. // 货权方(客户数据)
  278. fMblnoOptions: [],
  279. // 贸易方式(数据字典),对应t_trademodels 字典
  280. fTrademodeidOptions: [],
  281. // 货物
  282. goodsOptions: [],
  283. // 仓库(仓库数据)
  284. warehouseOptions: [],
  285. kqhouseOptions: [],
  286. // 遮罩层
  287. loading: true,
  288. // 显示搜索条件
  289. showSearch: true,
  290. // 总条数
  291. total: 0,
  292. // 库存总账表格数据
  293. whgenlegList: [],
  294. // 弹出层标题
  295. title: "",
  296. // 是否显示弹出层
  297. open: false,
  298. // 查询参数
  299. queryParams: {
  300. pageNum: 1,
  301. pageSize: 50,
  302. fOriginalbillno: null,
  303. fPreqty: null,
  304. fPregrossweight: null,
  305. fPrenetweight: null,
  306. fQtyd: null,
  307. fVolumnd: null,
  308. fGrossweightd: null,
  309. fNetweightd: null,
  310. fVolumnc: null,
  311. fQtyc: null,
  312. fQtyblc: null,
  313. fGrossweightc: null,
  314. fNetweightc: null,
  315. fGrossweightblc: null,
  316. fNetweightblc: null,
  317. fCntrno: null,
  318. fStatus: null,
  319. fMarks: null,
  320. fBusinessType:null,
  321. fBusinessTypes:null
  322. },
  323. // 表单参数
  324. form: {},
  325. // 表单校验
  326. rules: {
  327. fMarks: [
  328. { required: true, message: "唛头不能为空", trigger: "blur" }
  329. ],
  330. }
  331. };
  332. },
  333. created() {
  334. this.getList();
  335. this.getDicts("data_trademodes").then((response) => {
  336. this.fTrademodeidOptions = response.data;
  337. });
  338. treeselect().then(response => {
  339. this.fWarehouseidOption = response.data
  340. })
  341. },
  342. methods: {
  343. //合计
  344. getSum(param){
  345. const { columns, data } = param
  346. const sums = []
  347. columns.forEach((column, index) => {
  348. if (index === 0) {
  349. sums[index] = '总计'
  350. } else if (index ===13 || index ===10 || index ===11 || index ===12 || index ===14 || index ===15 || index ===16 || index ===17 || index ===18) {
  351. const values = data.map(item => Number(item[column.property]))
  352. if (!values.every(value => isNaN(value))) {
  353. sums[index] = values.reduce((prev, curr) => {
  354. const value = Number(curr)
  355. if (!isNaN(value)) {
  356. return prev + curr
  357. } else {
  358. return prev
  359. }
  360. }, 0)
  361. if( index ===11 || index ===12 || index ===14 || index ===15 || index ===17 || index ===18){
  362. sums[index] = (sums[index]/1000).toFixed(2) + '(吨)'
  363. }
  364. }
  365. }
  366. })
  367. return sums
  368. },
  369. treeseLect(tree){
  370. this.queryParams.fWarehouseLocationid = tree.id
  371. },
  372. getTreeselect() {
  373. treeselect().then(response => {
  374. this.warehousesOptions = response.data;
  375. });
  376. },
  377. // 贸易方式(数据字典),对���t_trademodels 字典翻译
  378. fTrademodeidFormat(row, column) {
  379. return this.selectDictLabel(this.fTrademodeidOptions, row.fTrademodeid);
  380. },
  381. /* 远程模糊查询仓库 */
  382. warehouseRemoteMethod(name) {
  383. if (name == null || name === "") {
  384. return false;
  385. }
  386. let queryParams = { pageNum: 1, pageSize: 10, fName: name };
  387. listWarehouse(queryParams).then((response) => {
  388. this.warehouseOptions = response.rows;
  389. });
  390. },
  391. /* 远程模糊查询库区 */
  392. kqhouseRemoteMethod(name) {
  393. if (name == null || name === "") {
  394. return false;
  395. }
  396. if (!this.queryParams.fWarehouseid) {
  397. this.$message.error("请输入仓库!");
  398. return false;
  399. }
  400. let queryParams = {
  401. pageNum: 1,
  402. pageSize: 10,
  403. fWarehouseid: this.queryParams.fWarehouseid,
  404. fName: name,
  405. };
  406. listArea(queryParams).then((response) => {
  407. this.kqhouseOptions = response.rows;
  408. });
  409. },
  410. /* 远程模糊查询商品 */
  411. goodsRemoteMethod(name) {
  412. if (name == null || name === "") {
  413. return false;
  414. }
  415. let queryParams = { pageNum: 1, pageSize: 10, fName: name };
  416. listGoods(queryParams).then((response) => {
  417. this.goodsOptions = response.rows;
  418. });
  419. },
  420. /* 远程模糊查询用户 */
  421. corpsRemoteMethod(name) {
  422. if (name == null || name === "") {
  423. return false;
  424. }
  425. let queryParams = { pageNum: 1, pageSize: 10, fName: name };
  426. listCorps(queryParams).then((response) => {
  427. this.fMblnoOptions = response.rows;
  428. this.KHblnoOptions = response.rows;
  429. });
  430. },
  431. /** 查询库存总账列表 */
  432. getList() {
  433. this.loading = true;
  434. listWhgenleg(this.queryParams).then(response => {
  435. console.log(response)
  436. this.whgenlegList = response.rows;
  437. this.total = response.total;
  438. this.loading = false;
  439. });
  440. },
  441. // 取消按钮
  442. cancel() {
  443. this.open = false;
  444. this.reset();
  445. },
  446. // 表单重置
  447. reset() {
  448. this.form = {
  449. fAccyear: null,
  450. fId: null,
  451. fAccmonth: null,
  452. fCorpid: null,
  453. fMblno: null,
  454. fOriginalbillno: null,
  455. fWarehouseLocationid: null,
  456. fGoodsid: null,
  457. fTrademodeid: null,
  458. fPreqty: null,
  459. fPregrossweight: null,
  460. fPrenetweight: null,
  461. fQtyd: null,
  462. fVolumnd: null,
  463. fGrossweightd: null,
  464. fNetweightd: null,
  465. fVolumnc: null,
  466. fQtyc: null,
  467. fQtyblc: null,
  468. fGrossweightc: null,
  469. fNetweightc: null,
  470. fGrossweightblc: null,
  471. fNetweightblc: null,
  472. fCntrno: null,
  473. fStatus: "0",
  474. delFlag: null,
  475. createBy: null,
  476. fMarks: null,
  477. createTime: null,
  478. updateBy: null,
  479. updateTime: null,
  480. remark: null
  481. };
  482. this.resetForm("form");
  483. },
  484. /** 搜索按钮操作 */
  485. handleQuery() {
  486. this.queryParams.pageNum = 1;
  487. this.getList();
  488. },
  489. /** 重置按钮操作 */
  490. resetQuery() {
  491. this.queryParams = {
  492. pageNum: 1,
  493. pageSize: 10,
  494. fOriginalbillno: null,
  495. fPreqty: null,
  496. fPregrossweight: null,
  497. fPrenetweight: null,
  498. fQtyd: null,
  499. fVolumnd: null,
  500. fGrossweightd: null,
  501. fNetweightd: null,
  502. fVolumnc: null,
  503. fQtyc: null,
  504. fQtyblc: null,
  505. fGrossweightc: null,
  506. fNetweightc: null,
  507. fGrossweightblc: null,
  508. fNetweightblc: null,
  509. fCntrno: null,
  510. fStatus: null,
  511. fMarks: null,
  512. fBusinessType:null,
  513. fBusinessTypes:null,
  514. fBilltype:null,
  515. fwarehouseid:null
  516. }
  517. // this.resetForm("queryForm");
  518. this.handleQuery();
  519. },
  520. /** 新增按钮操作 */
  521. handleAdd() {
  522. this.reset();
  523. this.open = true;
  524. this.title = "添加库存总账";
  525. },
  526. /** 提交按钮 */
  527. submitForm() {
  528. this.$refs["form"].validate(valid => {
  529. if (valid) {
  530. if (this.form.fAccyear != null) {
  531. updateWhgenleg(this.form).then(response => {
  532. this.msgSuccess("修改成功");
  533. this.open = false;
  534. this.getList();
  535. });
  536. } else {
  537. addWhgenleg(this.form).then(response => {
  538. this.msgSuccess("新增成功");
  539. this.open = false;
  540. this.getList();
  541. });
  542. }
  543. }
  544. });
  545. },
  546. /** 导出按钮操作 */
  547. handleExport() {
  548. const queryParams = this.queryParams;
  549. this.$confirm('是否确认导出所有库存总账数据项?', "警告", {
  550. confirmButtonText: "确定",
  551. cancelButtonText: "取消",
  552. type: "warning"
  553. }).then(function() {
  554. return exportWhgenleg(queryParams);
  555. }).then(response => {
  556. this.download(response.msg);
  557. })
  558. }
  559. }
  560. }
  561. </script>
  562. <style lang="scss">
  563. .el-table {
  564. .el-table__body-wrapper {
  565. z-index: 2;
  566. }
  567. }
  568. </style>