index.vue 28 KB

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