index.vue 32 KB

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