index.vue 32 KB

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