index.vue 31 KB

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