index.vue 33 KB

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