index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  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: 100,
  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: 100,
  643. },
  644. {
  645. surface: "14",
  646. label: "fNetweight",
  647. name: "调拨净重(kg)",
  648. checked: 0,
  649. width: 100,
  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. setRowList: [],
  674. getRowList: [],
  675. allCheck: false,
  676. showSetting: false,
  677. total: 0,
  678. warehousebillsList: [],
  679. loading: true,
  680. single: true,
  681. multiple: true,
  682. formId: null,
  683. ids: [],
  684. copyStatus: null,
  685. };
  686. },
  687. // 使用子组件
  688. components: { draggable, AddOrUpdate },
  689. created() {
  690. let date = new Date();
  691. let year = parseInt(date.getFullYear())
  692. let month = parseInt(date.getMonth() + 1)
  693. let currentMonth = date.getMonth()
  694. let nextMonth = ++currentMonth
  695. let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1) // 下个月的第一天
  696. let oneDay = 1000*60*60*24
  697. let lastTime = new Date(nextMonthFirstDay - oneDay) // 下个月的第一天减去一天,就是上个月的最后一天
  698. let day = lastTime.getDate()
  699. if (day < 10) {
  700. day = '0' + day
  701. }
  702. this.queryParams.timeInterval = [year + '-' + month + '-' + '01 00:00:00', year + '-' + month + '-' + day + ' 23:59:59']
  703. this.setRowList = this.tableDate;
  704. this.getRowList = this.tableDate;
  705. this.getDicts("data_trademodes").then((response) => {
  706. this.fTrademodeidOptions = response.data;
  707. });
  708. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  709. this.goodsOptions = response.rows;
  710. });
  711. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  712. this.warehouseOptions = response.rows;
  713. });
  714. listUser().then((response) => {
  715. this.userOptions = response.rows;
  716. });
  717. listCorps({ type: 1 }).then((response) => {
  718. this.fMblnoOptions = response.rows;
  719. });
  720. this.getRow();
  721. this.getList();
  722. },
  723. activated() {
  724. if (this.$route.query.id) {
  725. this.handleUpdate(this.$route.query.id);
  726. }
  727. },
  728. mounted() {
  729. this.$nextTick(() => {
  730. // 根据浏览器高度设置初始高度
  731. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160
  732. // 监听浏览器高度变化,改变表格高度
  733. window.onresize = () => {
  734. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  735. }
  736. })
  737. },
  738. methods: {
  739. // 获取当前月的第一天和最后一天
  740. getMonth() {
  741. let date = new Date();
  742. let year = parseInt(date.getFullYear())
  743. let month = parseInt(date.getMonth() + 1)
  744. let currentMonth = date.getMonth()
  745. let nextMonth = ++currentMonth
  746. let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1) // 下个月的第一天
  747. let oneDay = 1000*60*60*24
  748. let lastTime = new Date(nextMonthFirstDay - oneDay) // 下个月的第一天减去一天,就是上个月的最后一天
  749. let day = lastTime.getDate()
  750. if (day < 10) {
  751. day = '0' + day
  752. }
  753. this.queryParams.timeInterval = [year + '-' + month + '-' + '01 00:00:00', year + '-' + month + '-' + day + ' 23:59:59']
  754. },
  755. //列设置全选
  756. allChecked() {
  757. if (this.allCheck == true) {
  758. this.setRowList.map((e) => {
  759. return (e.checked = 0);
  760. });
  761. } else {
  762. this.setRowList.map((e) => {
  763. return (e.checked = 1);
  764. });
  765. }
  766. },
  767. //查询列数据
  768. getRow() {
  769. let that = this;
  770. this.data = {
  771. tableName: "调拨",
  772. userId: Cookies.get("userName"),
  773. };
  774. select(this.data).then((res) => {
  775. if (res.data.length != 0) {
  776. this.getRowList = res.data.filter((e) => e.checked == 0);
  777. this.setRowList = res.data;
  778. this.setRowList = this.setRowList.reduce((res, item) => {
  779. res.push({
  780. surface: item.surface,
  781. label: item.label,
  782. name: item.name,
  783. checked: item.checked,
  784. width: item.width,
  785. fixed: item.fixed,
  786. });
  787. return res;
  788. }, []);
  789. }
  790. });
  791. },
  792. //重置列表
  793. delRow() {
  794. this.data = {
  795. tableName: "调拨",
  796. userId: Cookies.get("userName"),
  797. };
  798. resetModule(this.data).then((res) => {
  799. if (res.code == 200) {
  800. this.showSetting = false;
  801. this.setRowList = this.$options.data().tableDate;
  802. this.getRowList = this.$options.data().tableDate;
  803. }
  804. });
  805. },
  806. //保存列设置
  807. save() {
  808. this.showSetting = false;
  809. this.data = {
  810. tableName: "调拨",
  811. userId: Cookies.get("userName"),
  812. sysTableSetList: this.setRowList,
  813. };
  814. addSet(this.data).then((res) => {
  815. if (res.code == 200) {
  816. this.showSetting = false;
  817. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  818. console.log(this.tableDate);
  819. }
  820. });
  821. },
  822. //开始拖拽事件
  823. onStart() {
  824. this.drag = true;
  825. },
  826. //拖拽结束事件
  827. onEnd() {
  828. this.drag = false;
  829. },
  830. getList() {
  831. //获取仓库
  832. getStockTransferList(this.queryParams).then((response) => {
  833. this.warehousebillsList = response.rows;
  834. this.total = response.total;
  835. this.loading = false;
  836. });
  837. },
  838. //合计
  839. getSum(param) {
  840. const { columns, data } = param;
  841. const sums = [];
  842. var values = [];
  843. columns.forEach((column, index) => {
  844. if (index === 0) {
  845. sums[index] = "合计";
  846. return;
  847. }
  848. if (column.property === "fGrossweight") {
  849. values = data.map((item) => Number(item["fGrossweight"]));
  850. }
  851. if (column.property === "fNetweight") {
  852. values = data.map((item) => Number(item["fNetweight"]));
  853. }
  854. if (column.property === "fQty") {
  855. values = data.map((item) => Number(item["fQty"]));
  856. }
  857. if (column.property === "fPlanqty") {
  858. values = data.map((item) => Number(item.fPlanqty));
  859. }
  860. if (
  861. column.property === "fGrossweight" ||
  862. column.property === "fNetweight" ||
  863. column.property === "fQty" ||
  864. column.property === "fPlanqty"
  865. ) {
  866. sums[index] = values.reduce((prev, curr) => {
  867. const value = Number(curr);
  868. if (!isNaN(value)) {
  869. return prev + curr;
  870. } else {
  871. return prev;
  872. }
  873. }, 0);
  874. if (column.property === "fGrossweight") {
  875. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  876. }
  877. if (column.property === "fNetweight") {
  878. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  879. }
  880. if (column.property === "fQty") {
  881. sums[index] = sums[index].toFixed(2);
  882. }
  883. if (column.property === "fPlanqty") {
  884. if (sums[index]) {
  885. sums[index] = sums[index];
  886. }
  887. }
  888. }
  889. });
  890. return sums;
  891. },
  892. handleAdd() {
  893. this.timer = new Date().getTime();
  894. this.pageShow = false;
  895. this.pageShow2 = true;
  896. },
  897. // 多选框选中数据
  898. handleSelectionChange(selection) {
  899. this.ids = selection.map((item) => item.fId);
  900. this.single =
  901. selection.length !== 1 ||
  902. selection.map((item) => item.fBillstatus) == 6 ||
  903. selection.map((item) => item.fBillstatus) == 4;
  904. this.multiple = !selection.length;
  905. },
  906. /** 修改按钮操作 */
  907. handleUpdate(row) {
  908. const fId = row.fId || this.ids[0] || row;
  909. this.copyStatus = null;
  910. this.formId = fId;
  911. this.$nextTick(() => {
  912. this.$refs.addOrUpdateRef.init();
  913. });
  914. setTimeout(() => {
  915. this.pageShow = false;
  916. this.pageShow2 = true;
  917. }, 200);
  918. },
  919. copyUpdate() {
  920. this.formId = this.ids[0];
  921. this.copyStatus = 2;
  922. this.$nextTick(() => {
  923. this.$refs.addOrUpdateRef.init();
  924. });
  925. setTimeout(() => {
  926. this.pageShow = false;
  927. this.pageShow2 = true;
  928. }, 200);
  929. },
  930. handleDelete(row) {
  931. const ids = row.fId || this.ids;
  932. delstockTransfer_s(ids).then((data) => {
  933. switch (data.msg) {
  934. case "0": {
  935. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  936. break;
  937. }
  938. case "1": {
  939. this.delete(ids, "当前主表有数据从表无数据是否删除");
  940. break;
  941. }
  942. case "2": {
  943. this.delete(ids, "当前主表有数据从表有数据是否删除");
  944. break;
  945. }
  946. default: {
  947. return this.$message.error("未知错误,无状态");
  948. }
  949. }
  950. });
  951. },
  952. delete(ids, tips) {
  953. this.$confirm(tips, "警告", {
  954. confirmButtonText: "确定",
  955. cancelButtonText: "取消",
  956. type: "warning",
  957. }).then(() => {
  958. delStockTransfer(ids);
  959. this.msgSuccess("删除成功");
  960. this.getList();
  961. });
  962. },
  963. /** 导出按钮操作 */
  964. handleExport() {
  965. // require.ensure([], () => {
  966. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  967. // const tHeader = ["客户名称", "制单日期"];
  968. // // 上面设置Excel的表格第一行的标题
  969. // const filterVal = ["corpId", "createTime"];
  970. // // 上面的index、nickName、name是tableData里对象的属性
  971. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  972. // const data = this.formatJson(filterVal, list);
  973. // export_json_to_excel(
  974. // tHeader,
  975. // data,
  976. // "列表excel",
  977. // true,
  978. // );
  979. // });
  980. },
  981. formatJson(filterVal, jsonData) {
  982. return jsonData.map((v) => filterVal.map((j) => v[j]));
  983. },
  984. /** 搜索按钮操作 */
  985. handleQuery() {
  986. this.queryParams.pageNum = 1;
  987. this.getList();
  988. },
  989. /** 重置按钮操作 */
  990. resetQuery() {
  991. this.queryParams = {
  992. pageNum: 1,
  993. pageSize: 10,
  994. fBillno: null,
  995. createBy: null,
  996. fTrademodeid: null,
  997. fCorpid: null,
  998. fMblno: null,
  999. fSbu: null,
  1000. fGoodsid: null,
  1001. fWarehouseid: null,
  1002. fMarks: null,
  1003. fBillstatus: null,
  1004. fItemsStatus: null,
  1005. timeInterval: null,
  1006. };
  1007. this.userOptions = [];
  1008. this.fMblnoOptions = [];
  1009. this.handleQuery();
  1010. },
  1011. showAddOrUpdate(data) {
  1012. if (data) {
  1013. this.getList();
  1014. this.pageShow = true;
  1015. this.pageShow2 = false;
  1016. }
  1017. },
  1018. },
  1019. };
  1020. </script>