index.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. <template>
  2. <div class="app-container">
  3. <div v-show="pageShow">
  4. <el-form
  5. :model="queryParams"
  6. ref="queryForm"
  7. v-show="showSearch"
  8. label-width="70px"
  9. size="small"
  10. >
  11. <el-row>
  12. <el-col :span="6">
  13. <el-form-item label="客户" prop="fCorpid">
  14. <el-select
  15. v-model="queryParams.fCorpid"
  16. clearable
  17. filterable
  18. placeholder="请输入关键词"
  19. style="width: 200px"
  20. >
  21. <el-option
  22. v-for="(item, index) in fMblnoOptions"
  23. :key="index.fId"
  24. :label="item.fName"
  25. :value="item.fId"
  26. ></el-option>
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6">
  31. <el-form-item label="提单号" prop="fMblno">
  32. <el-input
  33. v-model="queryParams.fMblno"
  34. placeholder="请输入提单号"
  35. clearable
  36. style="width: 200px"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="6">
  42. <el-form-item label="仓库" prop="fWarehouseid">
  43. <el-select
  44. v-model="queryParams.fWarehouseid"
  45. clearable
  46. filterable
  47. placeholder="请选择仓库"
  48. style="width: 200px"
  49. @keyup.enter.native="handleQuery"
  50. >
  51. <el-option
  52. v-for="(item, index) in warehouseOptions"
  53. :key="index.fId"
  54. :label="item.fName"
  55. :value="item.fId"
  56. ></el-option>
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="6">
  61. <el-form-item label="货转日期" prop="timeInterval">
  62. <el-date-picker
  63. v-model="queryParams.timeInterval"
  64. type="daterange"
  65. value-format="yyyy-MM-dd"
  66. clearable
  67. style="width: 230px"
  68. range-separator="至"
  69. start-placeholder="开始日期"
  70. end-placeholder="结束日期"
  71. @keyup.enter.native="handleQuery"
  72. :picker-options="pickerOptions"
  73. unlink-panels
  74. >
  75. </el-date-picker>
  76. </el-form-item>
  77. </el-col>
  78. </el-row>
  79. <el-collapse-transition>
  80. <div v-show="show">
  81. <el-row>
  82. <el-col :span="6">
  83. <el-form-item label="货物名称" prop="fGoodsid">
  84. <el-select
  85. v-model="queryParams.fGoodsid"
  86. clearable
  87. filterable
  88. placeholder="请选择货物名称"
  89. style="width: 200px"
  90. @keyup.enter.native="handleQuery"
  91. >
  92. <el-option
  93. v-for="(item, index) in goodsOptions"
  94. :key="index.fId"
  95. :label="item.fName"
  96. :value="item.fId"
  97. ></el-option>
  98. </el-select>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :span="6">
  102. <el-form-item label="品牌" prop="fMarks">
  103. <el-input
  104. v-model="queryParams.fMarks"
  105. placeholder="请输入品牌"
  106. clearable
  107. style="width: 200px"
  108. @keyup.enter.native="handleQuery"
  109. />
  110. </el-form-item>
  111. </el-col>
  112. <el-col :span="6">
  113. <el-form-item label="货转状态" prop="fItemsStatus">
  114. <el-select
  115. style="width: 200px"
  116. v-model="queryParams.fItemsStatus"
  117. placeholder="请选择货转状态"
  118. >
  119. <el-option label="计划" value="1" />
  120. <el-option label="待货转" value="2" />
  121. <el-option label="已货转" value="6" />
  122. </el-select>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="6">
  126. <el-form-item label="费用状态" prop="fFeeStatus">
  127. <el-select
  128. style="width: 200px"
  129. v-model="queryParams.fFeeStatus"
  130. placeholder="请选择费用状态"
  131. >
  132. <el-option label="暂存" :value="1"></el-option>
  133. <el-option label="部分" :value="2"></el-option>
  134. <el-option label="全部入账" :value="3"></el-option>
  135. </el-select>
  136. </el-form-item>
  137. </el-col>
  138. </el-row>
  139. <el-row>
  140. <el-col :span="6">
  141. <el-form-item label="业务编号" prop="fBillno">
  142. <el-input
  143. v-model="queryParams.fBillno"
  144. placeholder="请输入业务编号"
  145. clearable
  146. @keyup.enter.native="handleQuery"
  147. style="width: 200px"
  148. />
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="6">
  152. <el-form-item label="制单人" prop="createBy">
  153. <el-select
  154. v-model="queryParams.createBy"
  155. filterable
  156. clearable
  157. placeholder="请输入关键词"
  158. style="width: 200px"
  159. >
  160. <el-option
  161. v-for="(item, index) in userOptions"
  162. :key="index.userName"
  163. :label="item.nickName"
  164. :value="item.userName"
  165. >
  166. </el-option>
  167. </el-select>
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="6">
  171. <el-form-item label="经营单位" prop="fSbu">
  172. <el-select
  173. v-model="queryParams.fSbu"
  174. clearable
  175. filterable
  176. placeholder="请输入关键词"
  177. style="width: 200px"
  178. >
  179. <el-option
  180. v-for="(item, index) in fMblnoOptions"
  181. :key="index.fId"
  182. :label="item.fName"
  183. :value="item.fId"
  184. ></el-option>
  185. </el-select>
  186. </el-form-item>
  187. </el-col>
  188. <el-col :span="6">
  189. <el-form-item label="贸易方式" prop="fTrademodeid">
  190. <el-select
  191. v-model="queryParams.fTrademodeid"
  192. placeholder="请选择贸易方式"
  193. clearable
  194. @keyup.enter.native="handleQuery"
  195. style="width: 200px"
  196. >
  197. <el-option
  198. v-for="(item, index) in fTrademodeidOptions"
  199. :key="index.dictValue"
  200. :label="item.dictLabel"
  201. :value="item.dictValue"
  202. />
  203. </el-select>
  204. </el-form-item>
  205. </el-col>
  206. </el-row>
  207. </div>
  208. </el-collapse-transition>
  209. </el-form>
  210. <el-row :gutter="10" class="mb8">
  211. <el-col :span="1.5">
  212. <el-button
  213. type="primary"
  214. icon="el-icon-plus"
  215. size="mini"
  216. @click="handleAdd"
  217. v-hasPermi="['warehouseBusiness:stockTransfer:add']"
  218. >新增
  219. </el-button>
  220. </el-col>
  221. <el-col :span="1.5">
  222. <el-button
  223. type="success"
  224. icon="el-icon-edit"
  225. size="mini"
  226. :disabled="single"
  227. @click="handleUpdate"
  228. v-hasPermi="['warehouseBusiness:stockTransfer:edit']"
  229. >修改
  230. </el-button>
  231. </el-col>
  232. <el-col :span="1.5">
  233. <el-button
  234. type="warning"
  235. icon="el-icon-download"
  236. size="mini"
  237. @click="handleExport"
  238. v-hasPermi="['warehouseBusiness:stockTransfer:export']"
  239. >导出
  240. </el-button>
  241. </el-col>
  242. <el-col :span="1.5">
  243. <el-button
  244. type="warning"
  245. icon="el-icon-download"
  246. size="mini"
  247. @click="handleExport"
  248. :disabled="multiple"
  249. v-hasPermi="['warehouseBusiness:stockTransfer:export']"
  250. >导入
  251. </el-button>
  252. </el-col>
  253. <el-col :span="1.5">
  254. <el-button
  255. type="info"
  256. icon="el-icon-download"
  257. size="mini"
  258. :disabled="single"
  259. @click="copyUpdate"
  260. v-hasPermi="['agreement:agreementStorage:export']"
  261. >复制新增
  262. </el-button>
  263. </el-col>
  264. <div class="tabSetting">
  265. <div style="margin-right: 20px">
  266. <el-button
  267. type="cyan"
  268. icon="el-icon-search"
  269. size="mini"
  270. @click="handleQuery"
  271. >搜索</el-button
  272. >
  273. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  274. >重置</el-button
  275. >
  276. <el-button
  277. v-show="show"
  278. @click="show = !show"
  279. icon="el-icon-arrow-up"
  280. size="mini"
  281. >展开</el-button
  282. >
  283. <el-button
  284. v-show="!show"
  285. @click="show = !show"
  286. icon="el-icon-arrow-down"
  287. size="mini"
  288. >展开</el-button
  289. >
  290. </div>
  291. <right-toolbar
  292. :showSearch.sync="showSearch"
  293. @queryTable="getList"
  294. ></right-toolbar>
  295. <div style="margin: 0 12px">
  296. <el-button
  297. icon="el-icon-setting"
  298. size="mini"
  299. circle
  300. @click="showSetting = !showSetting"
  301. ></el-button>
  302. </div>
  303. </div>
  304. </el-row>
  305. <el-dialog
  306. title="自定义列显示"
  307. :visible.sync="showSetting"
  308. width="700px"
  309. v-dialogDrag
  310. :close-on-click-modal="false"
  311. >
  312. <template slot="title">
  313. <div class="avue-crud__dialog__header">
  314. <span class="el-dialog__title">
  315. <span
  316. style="
  317. display: inline-block;
  318. width: 3px;
  319. height: 20px;
  320. margin-right: 5px;
  321. float: left;
  322. margin-top: 2px;
  323. "
  324. ></span>
  325. </span>
  326. </div>
  327. </template>
  328. <div>配置排序列数据(拖动调整顺序)</div>
  329. <div style="margin-left: 17px">
  330. <el-checkbox
  331. v-model="allCheck"
  332. label="全选"
  333. @change="allChecked"
  334. ></el-checkbox>
  335. </div>
  336. <div style="padding: 4px; display: flex; justify-content: center">
  337. <draggable
  338. v-model="setRowList"
  339. group="site"
  340. animation="300"
  341. @start="onStart"
  342. @end="onEnd"
  343. handle=".indraggable"
  344. >
  345. <transition-group>
  346. <div
  347. v-for="item in setRowList"
  348. :key="item.surface"
  349. class="listStyle"
  350. >
  351. <div style="width: 500px" class="indraggable">
  352. <div class="progress" :style="{ width: item.width + 'px' }">
  353. <el-checkbox
  354. :label="item.name"
  355. v-model="item.checked"
  356. :true-label="0"
  357. :false-label="1"
  358. >{{ item.name }}
  359. </el-checkbox>
  360. </div>
  361. </div>
  362. <el-input-number
  363. v-model.number="item.width"
  364. controls-position="right"
  365. :min="1"
  366. :max="500"
  367. size="mini"
  368. ></el-input-number>
  369. </div>
  370. </transition-group>
  371. </draggable>
  372. </div>
  373. <span slot="footer" class="dialog-footer">
  374. <el-button @click="showSetting = false">取 消</el-button>
  375. <el-button @click="delRow" type="danger">重 置</el-button>
  376. <el-button type="primary" @click="save()">确 定</el-button>
  377. </span>
  378. </el-dialog>
  379. <el-table
  380. v-loading="loading"
  381. :data="warehousebillsList"
  382. @selection-change="handleSelectionChange"
  383. show-summary
  384. :summary-method="getSum"
  385. ref="table"
  386. :height="tableHeight"
  387. >
  388. <el-table-column type="selection" width="60" fixed align="center" />
  389. <el-table-column
  390. type="index"
  391. label="行号"
  392. width="50"
  393. align="center"
  394. fixed
  395. />
  396. <el-table-column
  397. v-for="(item, index) in getRowList"
  398. :key="index"
  399. :label="item.name"
  400. :width="item.width"
  401. :prop="item.label"
  402. align="center"
  403. :fixed="item.fixed"
  404. :show-overflow-tooltip="true"
  405. sortable
  406. >
  407. <template slot-scope="scope">
  408. <span v-if="item.label == 'fMblno'">
  409. <el-link :underline="false" type="primary"
  410. ><div @click="handleUpdate(scope.row)">
  411. {{ scope.row.fMblno }}
  412. </div></el-link
  413. >
  414. </span>
  415. <span v-else>{{ scope.row[item.label] }}</span>
  416. </template>
  417. </el-table-column>
  418. <el-table-column
  419. label="操作"
  420. align="center"
  421. class-name="small-padding fixed-width"
  422. min-width="200"
  423. fixed="right"
  424. >
  425. <template slot-scope="scope">
  426. <el-button
  427. size="mini"
  428. type="text"
  429. icon="el-icon-edit"
  430. @click="handleUpdate(scope.row, true)"
  431. v-hasPermi="['warehouseBusiness:stockTransfer:edit']"
  432. >查看
  433. </el-button>
  434. <el-button
  435. size="mini"
  436. type="text"
  437. icon="el-icon-edit"
  438. v-if="
  439. scope.row.fBillstatus == '录入' ||
  440. scope.row.fBillstatus == '暂存' ||
  441. scope.row.fBillstatus == '驳回'
  442. "
  443. @click="handleUpdate(scope.row, false)"
  444. v-hasPermi="['warehouseBusiness:stockTransfer:edit']"
  445. >修改
  446. </el-button>
  447. <el-button
  448. size="mini"
  449. type="text"
  450. icon="el-icon-delete"
  451. v-if="scope.row.fItemsStatus == '计划'"
  452. @click="handleDelete(scope.row)"
  453. v-hasPermi="['warehouseBusiness:stockTransfer:remove']"
  454. >删除
  455. </el-button>
  456. <el-button
  457. size="mini"
  458. type="text"
  459. icon="el-icon-delete"
  460. v-if="
  461. scope.row.fBillstatus == '请核' ||
  462. scope.row.fBillstatus == '审核中'
  463. "
  464. @click="handleUpdate(scope.row, true)"
  465. >审核进度
  466. </el-button>
  467. </template>
  468. </el-table-column>
  469. </el-table>
  470. <pagination
  471. v-show="total > 0"
  472. :total="total"
  473. :page.sync="queryParams.pageNum"
  474. :limit.sync="queryParams.pageSize"
  475. @pagination="getList"
  476. />
  477. </div>
  478. <add-or-update
  479. v-show="pageShow2"
  480. @changeShow="showAddOrUpdate"
  481. ref="addOrUpdateRef"
  482. :chiId="formId"
  483. :copyStatus="copyStatus"
  484. :key="timer"
  485. ></add-or-update>
  486. </div>
  487. </template>
  488. <script>
  489. import AddOrUpdate from "./AddOrUpdate.vue";
  490. import {
  491. backFee,
  492. RevocationApproval,
  493. addWhgenleg,
  494. listGoodsTransfer,
  495. getGoodsTransfer,
  496. addGoodsTransfer,
  497. warehouseSubmission,
  498. delGoodsTransfer,
  499. delgoodsTransfer_s,
  500. exportgoodsTransfer,
  501. } from "@/api/warehouseBusiness/goodsTransfer";
  502. import { listCorps } from "@/api/basicdata/corps";
  503. import { listWarehousesss } from "@/api/basicdata/warehouse";
  504. import { listGoods } from "@/api/basicdata/goods";
  505. import { listUser, queryUserVal } from "@/api/system/user";
  506. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  507. import Cookies from "js-cookie";
  508. import { addSet, select, resetModule } from "@/api/system/set";
  509. import draggable from "vuedraggable";
  510. export default {
  511. name: "plans",
  512. data() {
  513. return {
  514. tableHeight: '600',
  515. timer: "",
  516. pageShow: true,
  517. pageShow2: false,
  518. queryParams: {
  519. pageNum: 1,
  520. pageSize: 10,
  521. type: 1,
  522. fBillno: null,
  523. createBy: null,
  524. fTrademodeid: null,
  525. fCorpid: null,
  526. fMblno: null,
  527. fSbu: null,
  528. fGoodsid: null,
  529. fWarehouseid: null,
  530. fMarks: null,
  531. fBillstatus: null,
  532. fItemsStatus: null,
  533. timeInterval: null,
  534. fFeeStatus: null,
  535. },
  536. // 显示搜索条件
  537. showSearch: true,
  538. userOptions: [],
  539. fTrademodeidOptions: [],
  540. warehouseOptions: [],
  541. goodsOptions: [],
  542. fMblnoOptions: [],
  543. show: false,
  544. drag: false,
  545. tableDate: [
  546. {
  547. surface: "0",
  548. label: "fMblno",
  549. name: "提单号",
  550. checked: 0,
  551. width: 100,
  552. },
  553. {
  554. surface: "1",
  555. label: "createBy",
  556. name: "制单人",
  557. checked: 0,
  558. width: 100,
  559. },
  560. {
  561. surface: "13",
  562. label: "fItemsStatus",
  563. name: "货转状态",
  564. checked: 0,
  565. width: 100,
  566. },
  567. {
  568. surface: "14",
  569. label: "fFeeStatus",
  570. name: "费用状态",
  571. checked: 0,
  572. width: 100,
  573. },
  574. {
  575. surface: "2",
  576. label: "fCorpid",
  577. name: "客户",
  578. checked: 0,
  579. width: 100,
  580. },
  581. {
  582. surface: "3",
  583. label: "fTocorpid",
  584. name: "转客户",
  585. checked: 0,
  586. width: 100,
  587. },
  588. {
  589. surface: "4",
  590. label: "fProductName",
  591. name: "品名",
  592. checked: 0,
  593. width: 100,
  594. },
  595. {
  596. surface: "5",
  597. label: "fMarks",
  598. name: "品牌",
  599. checked: 0,
  600. width: 100,
  601. },
  602. {
  603. surface: "6",
  604. label: "fBillno",
  605. name: "业务编号",
  606. checked: 0,
  607. width: 100,
  608. },
  609. {
  610. surface: "7",
  611. label: "fBsdate",
  612. name: "货转日期",
  613. checked: 0,
  614. width: 100,
  615. },
  616. {
  617. surface: "8",
  618. label: "fTrademodeid",
  619. name: "贸易方式",
  620. checked: 0,
  621. width: 100,
  622. },
  623. {
  624. surface: "9",
  625. label: "fWarehouseid",
  626. name: "仓库",
  627. checked: 0,
  628. width: 100,
  629. },
  630. {
  631. surface: "10",
  632. label: "fQty",
  633. name: "件数",
  634. checked: 0,
  635. width: 100,
  636. },
  637. {
  638. surface: "11",
  639. label: "fGrossweight",
  640. name: "毛重(kg)",
  641. checked: 0,
  642. width: 100,
  643. },
  644. {
  645. surface: "12",
  646. label: "fNetweight",
  647. name: "净重(kg)",
  648. checked: 0,
  649. width: 100,
  650. },
  651. {
  652. surface: "13",
  653. label: "fBillno",
  654. name: "系统编号",
  655. checked: 0,
  656. width: 100,
  657. },
  658. {
  659. surface: "14",
  660. label: "",
  661. name: "应收合计",
  662. checked: 0,
  663. width: 100,
  664. },
  665. {
  666. surface: "15",
  667. label: "",
  668. name: "应付合计",
  669. checked: 0,
  670. width: 100,
  671. },
  672. {
  673. surface: "16",
  674. label: "",
  675. name: "利润",
  676. checked: 0,
  677. width: 100,
  678. },
  679. {
  680. surface: "17",
  681. label: "",
  682. name: "实收合计",
  683. checked: 0,
  684. width: 100,
  685. },
  686. {
  687. surface: "18",
  688. label: "",
  689. name: "实付合计",
  690. checked: 0,
  691. width: 100,
  692. },
  693. ],
  694. setRowList: [],
  695. getRowList: [],
  696. allCheck: false,
  697. showSetting: false,
  698. total: 0,
  699. warehousebillsList: [],
  700. loading: true,
  701. single: true,
  702. multiple: true,
  703. formId: null,
  704. ids: [],
  705. copyStatus: null,
  706. pickerOptions: {
  707. shortcuts: [{
  708. text: '最近一周',
  709. onClick(picker) {
  710. const end = new Date();
  711. const start = new Date();
  712. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  713. picker.$emit('pick', [start, end]);
  714. }
  715. }, {
  716. text: '最近一个月',
  717. onClick(picker) {
  718. const end = new Date();
  719. const start = new Date();
  720. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  721. picker.$emit('pick', [start, end]);
  722. }
  723. }, {
  724. text: '最近三个月',
  725. onClick(picker) {
  726. const end = new Date();
  727. const start = new Date();
  728. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  729. picker.$emit('pick', [start, end]);
  730. }
  731. }]
  732. },
  733. };
  734. },
  735. // 使用子组件
  736. components: { draggable, AddOrUpdate },
  737. created() {
  738. let date = new Date();
  739. let lYear = parseInt(date.getFullYear())
  740. let lMonth = parseInt(date.getMonth())
  741. if (lMonth == 0) {
  742. lMonth = 12
  743. lYear = lYear - 1
  744. }
  745. let nYear = parseInt(date.getFullYear())
  746. let nMonth = parseInt(date.getMonth() + 2)
  747. if (nMonth > 12) {
  748. nMonth = nMonth - 12
  749. nYear = nYear + 1
  750. }
  751. let day30 = [4, 6, 9, 11]
  752. let day31 = [1, 3, 5, 7, 8, 10, 12]
  753. let nDay = null
  754. if (day31.indexOf(nMonth) > -1) {
  755. nDay = 31
  756. } else if (day30.indexOf(nMonth) > -1) {
  757. nDay = 30
  758. } else if ((nYear % 4 == 0) && (nYear % 100 != 0 || nYear % 400 == 0)) {
  759. nDay = 29
  760. } else {
  761. nDay = 28
  762. }
  763. this.queryParams.timeInterval = [lYear + '-' + lMonth + '-' + '01 00:00:00', nYear + '-' + nMonth + '-' + nDay + '23:59:59']
  764. this.setRowList = this.tableDate;
  765. this.getRowList = this.tableDate;
  766. this.getDicts("data_trademodes").then((response) => {
  767. this.fTrademodeidOptions = response.data;
  768. });
  769. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  770. this.goodsOptions = response.rows;
  771. });
  772. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  773. this.warehouseOptions = response.rows;
  774. });
  775. listUser().then((response) => {
  776. this.userOptions = response.rows;
  777. });
  778. listCorps({ type: 1 }).then((response) => {
  779. this.fMblnoOptions = response.rows;
  780. });
  781. this.getRow();
  782. this.getList();
  783. },
  784. activated() {
  785. if (this.$route.query.id) {
  786. this.handleUpdate(this.$route.query.id);
  787. }
  788. },
  789. mounted() {
  790. this.$nextTick(() => {
  791. // 监听浏览器高度变化,改变表格高度
  792. window.onresize = () => {
  793. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  794. }
  795. })
  796. },
  797. methods: {
  798. // 获取当前月的第一天和最后一天
  799. getMonth() {
  800. let date = new Date();
  801. let year = parseInt(date.getFullYear())
  802. let month = parseInt(date.getMonth() + 1)
  803. let currentMonth = date.getMonth()
  804. let nextMonth = ++currentMonth
  805. let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1) // 下个月的第一天
  806. let oneDay = 1000*60*60*24
  807. let lastTime = new Date(nextMonthFirstDay - oneDay) // 下个月的第一天减去一天,就是上个月的最后一天
  808. let day = lastTime.getDate()
  809. if (day < 10) {
  810. day = '0' + day
  811. }
  812. this.queryParams.timeInterval = [year + '-' + month + '-' + '01 00:00:00', year + '-' + month + '-' + day + ' 23:59:59']
  813. },
  814. //列设置全选
  815. allChecked() {
  816. if (this.allCheck == true) {
  817. this.setRowList.map((e) => {
  818. return (e.checked = 0);
  819. });
  820. } else {
  821. this.setRowList.map((e) => {
  822. return (e.checked = 1);
  823. });
  824. }
  825. },
  826. //查询列数据
  827. getRow() {
  828. let that = this;
  829. this.data = {
  830. tableName: "货转",
  831. userId: Cookies.get("userName"),
  832. };
  833. select(this.data).then((res) => {
  834. if (res.data.length != 0) {
  835. this.getRowList = res.data.filter((e) => e.checked == 0);
  836. this.setRowList = res.data;
  837. this.setRowList = this.setRowList.reduce((res, item) => {
  838. res.push({
  839. surface: item.surface,
  840. label: item.label,
  841. name: item.name,
  842. checked: item.checked,
  843. width: item.width,
  844. fixed: item.fixed,
  845. });
  846. return res;
  847. }, []);
  848. }
  849. });
  850. },
  851. //重置列表
  852. delRow() {
  853. this.data = {
  854. tableName: "货转",
  855. userId: Cookies.get("userName"),
  856. };
  857. resetModule(this.data).then((res) => {
  858. if (res.code == 200) {
  859. this.showSetting = false;
  860. this.setRowList = this.$options.data().tableDate;
  861. this.getRowList = this.$options.data().tableDate;
  862. }
  863. });
  864. },
  865. //保存列设置
  866. save() {
  867. this.showSetting = false;
  868. this.data = {
  869. tableName: "货转",
  870. userId: Cookies.get("userName"),
  871. sysTableSetList: this.setRowList,
  872. };
  873. addSet(this.data).then((res) => {
  874. if (res.code == 200) {
  875. this.showSetting = false;
  876. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  877. console.log(this.tableDate);
  878. }
  879. });
  880. },
  881. //开始拖拽事件
  882. onStart() {
  883. this.drag = true;
  884. },
  885. //拖拽结束事件
  886. onEnd() {
  887. this.drag = false;
  888. },
  889. getList() {
  890. //获取仓库
  891. listGoodsTransfer(this.queryParams).then((response) => {
  892. this.warehousebillsList = response.rows;
  893. this.total = response.total;
  894. this.loading = false;
  895. // 根据浏览器高度设置初始高度
  896. setTimeout(() => {
  897. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  898. }, 1500)
  899. });
  900. },
  901. //合计
  902. getSum(param) {
  903. const { columns, data } = param;
  904. const sums = [];
  905. var values = [];
  906. columns.forEach((column, index) => {
  907. if (index === 0) {
  908. sums[index] = "合计";
  909. return;
  910. }
  911. if (column.property === "fGrossweight") {
  912. values = data.map((item) => Number(item["fGrossweight"]));
  913. }
  914. if (column.property === "fNetweight") {
  915. values = data.map((item) => Number(item["fNetweight"]));
  916. }
  917. if (column.property === "fQty") {
  918. values = data.map((item) => Number(item["fQty"]));
  919. }
  920. if (column.property === "fPlanqty") {
  921. values = data.map((item) => Number(item.fPlanqty));
  922. }
  923. if (
  924. column.property === "fGrossweight" ||
  925. column.property === "fNetweight" ||
  926. column.property === "fQty" ||
  927. column.property === "fPlanqty"
  928. ) {
  929. sums[index] = values.reduce((prev, curr) => {
  930. const value = Number(curr);
  931. if (!isNaN(value)) {
  932. return prev + curr;
  933. } else {
  934. return prev;
  935. }
  936. }, 0);
  937. if (column.property === "fGrossweight") {
  938. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  939. }
  940. if (column.property === "fNetweight") {
  941. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  942. }
  943. if (column.property === "fQty") {
  944. sums[index] = sums[index];
  945. }
  946. if (column.property === "fPlanqty") {
  947. if (sums[index]) {
  948. sums[index] = sums[index];
  949. }
  950. }
  951. }
  952. });
  953. return sums;
  954. },
  955. handleAdd() {
  956. this.timer = new Date().getTime();
  957. this.pageShow = false;
  958. this.pageShow2 = true;
  959. },
  960. // 多选框选中数据
  961. handleSelectionChange(selection) {
  962. this.ids = selection.map((item) => item.fId);
  963. this.single =
  964. selection.length !== 1 ||
  965. selection.map((item) => item.fBillstatus) == 6 ||
  966. selection.map((item) => item.fBillstatus) == 4;
  967. this.multiple = !selection.length;
  968. },
  969. /** 修改按钮操作 */
  970. handleUpdate(row) {
  971. const fId = row.fId || this.ids[0] || row;
  972. this.copyStatus = null;
  973. this.formId = fId;
  974. this.$nextTick(() => {
  975. this.$refs.addOrUpdateRef.init();
  976. });
  977. setTimeout(() => {
  978. this.pageShow = false;
  979. this.pageShow2 = true;
  980. }, 200);
  981. },
  982. copyUpdate() {
  983. this.formId = this.ids[0];
  984. this.copyStatus = 2;
  985. this.$nextTick(() => {
  986. this.$refs.addOrUpdateRef.init();
  987. });
  988. setTimeout(() => {
  989. this.pageShow = false;
  990. this.pageShow2 = true;
  991. }, 200);
  992. },
  993. handleDelete(row) {
  994. const ids = row.fId || this.ids;
  995. delgoodsTransfer_s(ids).then((data) => {
  996. switch (data.msg) {
  997. case "0": {
  998. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  999. break;
  1000. }
  1001. case "1": {
  1002. this.delete(ids, "当前主表有数据从表无数据是否删除");
  1003. break;
  1004. }
  1005. case "2": {
  1006. this.delete(ids, "当前主表有数据从表有数据是否删除");
  1007. break;
  1008. }
  1009. default: {
  1010. return this.$message.error("未知错误,无状态");
  1011. }
  1012. }
  1013. });
  1014. },
  1015. delete(ids, tips) {
  1016. this.$confirm(tips, "警告", {
  1017. confirmButtonText: "确定",
  1018. cancelButtonText: "取消",
  1019. type: "warning",
  1020. }).then(() => {
  1021. delGoodsTransfer(ids);
  1022. this.msgSuccess("删除成功");
  1023. this.getList();
  1024. });
  1025. },
  1026. /** 导出按钮操作 */
  1027. handleExport() {
  1028. // require.ensure([], () => {
  1029. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  1030. // const tHeader = ["客户名称", "制单日期"];
  1031. // // 上面设置Excel的表格第一行的标题
  1032. // const filterVal = ["corpId", "createTime"];
  1033. // // 上面的index、nickName、name是tableData里对象的属性
  1034. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  1035. // const data = this.formatJson(filterVal, list);
  1036. // export_json_to_excel(
  1037. // tHeader,
  1038. // data,
  1039. // "列表excel",
  1040. // true,
  1041. // );
  1042. // });
  1043. },
  1044. formatJson(filterVal, jsonData) {
  1045. return jsonData.map((v) => filterVal.map((j) => v[j]));
  1046. },
  1047. /** 搜索按钮操作 */
  1048. handleQuery() {
  1049. this.queryParams.pageNum = 1;
  1050. this.getList();
  1051. },
  1052. /** 重置按钮操作 */
  1053. resetQuery() {
  1054. this.queryParams = {
  1055. pageNum: 1,
  1056. pageSize: 10,
  1057. fBillno: null,
  1058. createBy: null,
  1059. fTrademodeid: null,
  1060. fCorpid: null,
  1061. fMblno: null,
  1062. fSbu: null,
  1063. fGoodsid: null,
  1064. fWarehouseid: null,
  1065. fMarks: null,
  1066. fBillstatus: null,
  1067. fItemsStatus: null,
  1068. timeInterval: null,
  1069. fFeeStatus: null,
  1070. };
  1071. this.userOptions = [];
  1072. this.fMblnoOptions = [];
  1073. this.handleQuery();
  1074. },
  1075. showAddOrUpdate(data) {
  1076. if (data) {
  1077. this.getList();
  1078. this.pageShow = true;
  1079. this.pageShow2 = false;
  1080. }
  1081. },
  1082. },
  1083. };
  1084. </script>