index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924
  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="fBillno">
  14. <el-input
  15. v-model="queryParams.fBillno"
  16. placeholder="请输入业务编号"
  17. clearable
  18. @keyup.enter.native="handleQuery"
  19. style="width: 200px"
  20. />
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="6">
  24. <el-form-item label="制单人" prop="createBy">
  25. <el-select
  26. v-model="queryParams.createBy"
  27. filterable
  28. clearable
  29. placeholder="请输入关键词"
  30. style="width: 200px"
  31. >
  32. <el-option
  33. v-for="(item, index) in userOptions"
  34. :key="index.userName"
  35. :label="item.nickName"
  36. :value="item.userName"
  37. >
  38. </el-option>
  39. </el-select>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="6">
  43. <el-form-item label="贸易方式" prop="fTrademodeid">
  44. <el-select
  45. v-model="queryParams.fTrademodeid"
  46. placeholder="请选择贸易方式"
  47. clearable
  48. @keyup.enter.native="handleQuery"
  49. style="width: 200px"
  50. >
  51. <el-option
  52. v-for="(item, index) in fTrademodeidOptions"
  53. :key="index.dictValue"
  54. :label="item.dictLabel"
  55. :value="item.dictValue"
  56. />
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="6">
  61. <el-form-item label="货权方" prop="fCorpid">
  62. <el-select
  63. v-model="queryParams.fCorpid"
  64. clearable
  65. filterable
  66. placeholder="请输入关键词"
  67. style="width: 200px"
  68. >
  69. <el-option
  70. v-for="(item, index) in fMblnoOptions"
  71. :key="index.fId"
  72. :label="item.fName"
  73. :value="item.fId"
  74. ></el-option>
  75. </el-select>
  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="fMblno">
  84. <el-input
  85. v-model="queryParams.fMblno"
  86. placeholder="请输入提单号"
  87. clearable
  88. style="width: 200px"
  89. @keyup.enter.native="handleQuery"
  90. />
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="6">
  94. <el-form-item label="经营单位" prop="fSbu">
  95. <el-select
  96. v-model="queryParams.fSbu"
  97. clearable
  98. filterable
  99. placeholder="请输入关键词"
  100. style="width: 200px"
  101. >
  102. <el-option
  103. v-for="(item, index) in fMblnoOptions"
  104. :key="index.fId"
  105. :label="item.fName"
  106. :value="item.fId"
  107. ></el-option>
  108. </el-select>
  109. </el-form-item>
  110. </el-col>
  111. <el-col :span="6">
  112. <el-form-item label="货物名称" prop="fGoodsid">
  113. <el-select
  114. v-model="queryParams.fGoodsid"
  115. clearable
  116. filterable
  117. placeholder="请选择货物名称"
  118. style="width: 200px"
  119. @keyup.enter.native="handleQuery"
  120. >
  121. <el-option
  122. v-for="(item, index) in goodsOptions"
  123. :key="index.fId"
  124. :label="item.fName"
  125. :value="item.fId"
  126. ></el-option>
  127. </el-select>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="6">
  131. <el-form-item label="仓库" prop="fWarehouseid">
  132. <el-select
  133. v-model="queryParams.fWarehouseid"
  134. clearable
  135. filterable
  136. placeholder="请选择仓库"
  137. style="width: 200px"
  138. @keyup.enter.native="handleQuery"
  139. >
  140. <el-option
  141. v-for="(item, index) in warehouseOptions"
  142. :key="index.fId"
  143. :label="item.fName"
  144. :value="item.fId"
  145. ></el-option>
  146. </el-select>
  147. </el-form-item>
  148. </el-col>
  149. </el-row>
  150. <el-row>
  151. <el-col :span="6">
  152. <el-form-item label="品牌" prop="fMarks">
  153. <el-input
  154. v-model="queryParams.fMarks"
  155. placeholder="请输入品牌"
  156. clearable
  157. style="width: 200px"
  158. @keyup.enter.native="handleQuery"
  159. />
  160. </el-form-item>
  161. </el-col>
  162. <el-col :span="6">
  163. <el-form-item label="费用状态" prop="fBillstatus">
  164. <el-select
  165. style="width: 200px"
  166. v-model="queryParams.fBillstatus"
  167. placeholder="请选择费用状态"
  168. >
  169. <el-option label="录入" value="1"></el-option>
  170. <el-option label="暂存" value="2"></el-option>
  171. <el-option label="驳回" value="3"></el-option>
  172. <el-option label="请核" value="4"></el-option>
  173. <el-option label="审核中" value="5"></el-option>
  174. <el-option label="全部入账" value="6"></el-option>
  175. </el-select>
  176. </el-form-item>
  177. </el-col>
  178. <el-col :span="6">
  179. <el-form-item label="入库状态" prop="fItemsStatus">
  180. <el-select
  181. style="width: 200px"
  182. v-model="queryParams.fItemsStatus"
  183. placeholder="请选择入库状态"
  184. >
  185. <el-option label="计划" value="1"></el-option>
  186. <el-option label="待入库" value="2"></el-option>
  187. <el-option label="入库中" value="3"></el-option>
  188. <el-option label="已入库" value="4"></el-option>
  189. </el-select>
  190. </el-form-item>
  191. </el-col>
  192. <el-col :span="6">
  193. <el-form-item label="入库日期" prop="timeInterval">
  194. <el-date-picker
  195. v-model="queryParams.timeInterval"
  196. type="daterange"
  197. value-format="yyyy-MM-dd"
  198. clearable
  199. style="width: 230px"
  200. range-separator="至"
  201. start-placeholder="开始日期"
  202. end-placeholder="结束日期"
  203. @keyup.enter.native="handleQuery"
  204. >
  205. </el-date-picker>
  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:inStock: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:inStock: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:inStock: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:inStock: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. >
  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="60" fixed align="center" />
  388. <el-table-column type="index" label="行号" align="center" fixed />
  389. <el-table-column
  390. label="提单号"
  391. width="220"
  392. align="center"
  393. :show-overflow-tooltip="true"
  394. sortable
  395. fixed="left"
  396. prop="fMblno"
  397. >
  398. <template slot-scope="scope">
  399. <el-link :underline="false" type="primary"
  400. ><div @click="handleUpdate(scope.row)">
  401. {{ scope.row.fMblno }}
  402. </div></el-link
  403. >
  404. </template>
  405. </el-table-column>
  406. <el-table-column
  407. v-for="(item, index) in getRowList"
  408. :key="index"
  409. :label="item.name"
  410. :width="item.width"
  411. :prop="item.label"
  412. align="center"
  413. :fixed="item.fixed"
  414. :show-overflow-tooltip="true"
  415. sortable
  416. />
  417. <el-table-column
  418. label="操作"
  419. align="center"
  420. class-name="small-padding fixed-width"
  421. min-width="180"
  422. >
  423. <template slot-scope="scope">
  424. <el-button
  425. size="mini"
  426. type="text"
  427. icon="el-icon-edit"
  428. @click="handleUpdate(scope.row, true)"
  429. v-hasPermi="['warehouseBusiness:inStock:edit']"
  430. >查看
  431. </el-button>
  432. <el-button
  433. size="mini"
  434. type="text"
  435. icon="el-icon-edit"
  436. v-if="
  437. scope.row.fBillstatus == '录入' ||
  438. scope.row.fBillstatus == '暂存' ||
  439. scope.row.fBillstatus == '驳回'
  440. "
  441. @click="handleUpdate(scope.row, false)"
  442. v-hasPermi="['warehouseBusiness:inStock:edit']"
  443. >修改
  444. </el-button>
  445. <el-button
  446. size="mini"
  447. type="text"
  448. icon="el-icon-delete"
  449. v-if="scope.row.fItemsStatus == '计划'"
  450. @click="handleDelete(scope.row)"
  451. v-hasPermi="['warehouseBusiness:inStock:remove']"
  452. >删除
  453. </el-button>
  454. <el-button
  455. size="mini"
  456. type="text"
  457. icon="el-icon-delete"
  458. v-if="
  459. scope.row.fBillstatus == '请核' ||
  460. scope.row.fBillstatus == '审核中'
  461. "
  462. @click="handleUpdate(scope.row, true)"
  463. >审核进度
  464. </el-button>
  465. </template>
  466. </el-table-column>
  467. </el-table>
  468. <pagination
  469. v-show="total > 0"
  470. :total="total"
  471. :page.sync="queryParams.pageNum"
  472. :limit.sync="queryParams.pageSize"
  473. @pagination="getList"
  474. />
  475. </div>
  476. <add-or-update
  477. v-show="pageShow2"
  478. @changeShow="showAddOrUpdate"
  479. ref="addOrUpdateRef"
  480. :chiId="formId"
  481. :copyStatus="copyStatus"
  482. :key="timer"
  483. ></add-or-update>
  484. </div>
  485. </template>
  486. <script>
  487. import AddOrUpdate from "./AddOrUpdate.vue";
  488. import { listWarehousebills } from "@/api/warehouseBusiness/warehouseInStock";
  489. import { listCorps } from "@/api/basicdata/corps";
  490. import { listWarehousesss } from "@/api/basicdata/warehouse";
  491. import { listGoods } from "@/api/basicdata/goods";
  492. import { listUser, queryUserVal } from "@/api/system/user";
  493. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  494. import Cookies from "js-cookie";
  495. import { addSet, select, resetModule } from "@/api/system/set";
  496. import draggable from "vuedraggable";
  497. export default {
  498. name: "plans",
  499. data() {
  500. return {
  501. timer: "",
  502. pageShow: true,
  503. pageShow2: false,
  504. queryParams: {
  505. pageNum: 1,
  506. pageSize: 10,
  507. fBillno: null,
  508. createBy: null,
  509. fTrademodeid: null,
  510. fCorpid: null,
  511. fMblno: null,
  512. fSbu: null,
  513. fGoodsid: null,
  514. fWarehouseid: null,
  515. fMarks: null,
  516. fBillstatus: null,
  517. fItemsStatus: null,
  518. timeInterval: null,
  519. },
  520. // 显示搜索条件
  521. showSearch: true,
  522. userOptions: [],
  523. fTrademodeidOptions: [],
  524. warehouseOptions: [],
  525. goodsOptions: [],
  526. fMblnoOptions: [],
  527. show: false,
  528. drag: false,
  529. tableDate: [
  530. {
  531. surface: "1",
  532. label: "createBy",
  533. name: "制单人",
  534. checked: 0,
  535. fixed: "left",
  536. width: 100,
  537. },
  538. {
  539. surface: "2",
  540. label: "fItemsStatus",
  541. name: "入库状态",
  542. checked: 0,
  543. fixed: "left",
  544. width: 100,
  545. },
  546. {
  547. surface: "3",
  548. label: "fCorpid",
  549. name: "货权方",
  550. checked: 0,
  551. fixed: "left",
  552. width: 100,
  553. },
  554. {
  555. surface: "5",
  556. label: "fProductName",
  557. name: "品名",
  558. checked: 0,
  559. fixed: "left",
  560. width: 100,
  561. },
  562. {
  563. surface: "6",
  564. label: "fMarks",
  565. name: "品牌",
  566. checked: 0,
  567. fixed: "left",
  568. width: 100,
  569. },
  570. {
  571. surface: "7",
  572. label: "fBsdate",
  573. name: "入库日期",
  574. checked: 0,
  575. fixed: "left",
  576. width: 100,
  577. },
  578. {
  579. surface: "8",
  580. label: "fWarehouseid",
  581. name: "仓库",
  582. checked: 0,
  583. width: 100,
  584. },
  585. {
  586. surface: "9",
  587. label: "fPlanqty",
  588. name: "计划件数",
  589. checked: 0,
  590. width: 100,
  591. },
  592. {
  593. surface: "10",
  594. label: "fQty",
  595. name: "入库件数",
  596. checked: 0,
  597. width: 100,
  598. },
  599. {
  600. surface: "11",
  601. label: "fGrossweight",
  602. name: "入库毛重",
  603. checked: 0,
  604. width: 100,
  605. },
  606. {
  607. surface: "12",
  608. label: "fNetweight",
  609. name: "入库净重",
  610. checked: 0,
  611. width: 100,
  612. },
  613. {
  614. surface: "13",
  615. label: "fTruckno",
  616. name: "车号",
  617. checked: 0,
  618. width: 100,
  619. },
  620. {
  621. surface: "14",
  622. label: "fDriverName",
  623. name: "司机名称",
  624. checked: 0,
  625. width: 100,
  626. },
  627. {
  628. surface: "15",
  629. label: "fDriverTel",
  630. name: "司机电话",
  631. checked: 0,
  632. width: 100,
  633. },
  634. {
  635. surface: "16",
  636. label: "fDriverIdCar",
  637. name: "司机身份证",
  638. checked: 0,
  639. width: 100,
  640. },
  641. {
  642. surface: "17",
  643. label: "fBusinessType",
  644. name: "业务类别",
  645. checked: 0,
  646. width: 100,
  647. },
  648. {
  649. surface: "18",
  650. label: "fBillstatus",
  651. name: "费用状态",
  652. checked: 0,
  653. width: 100,
  654. },
  655. ],
  656. setRowList: [],
  657. getRowList: [],
  658. allCheck: false,
  659. showSetting: false,
  660. total: 0,
  661. warehousebillsList: [],
  662. loading: true,
  663. single: true,
  664. multiple: true,
  665. formId: null,
  666. ids: [],
  667. copyStatus:null,
  668. };
  669. },
  670. // 使用子组件
  671. components: { draggable, AddOrUpdate },
  672. created() {
  673. this.setRowList = this.tableDate;
  674. this.getRowList = this.tableDate;
  675. this.getDicts("data_trademodes").then((response) => {
  676. this.fTrademodeidOptions = response.data;
  677. });
  678. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  679. this.goodsOptions = response.rows;
  680. });
  681. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  682. this.warehouseOptions = response.rows;
  683. });
  684. listUser().then((response) => {
  685. this.userOptions = response.rows;
  686. });
  687. listCorps({ type: 1 }).then((response) => {
  688. this.fMblnoOptions = response.rows;
  689. });
  690. this.getRow();
  691. this.getList();
  692. },
  693. methods: {
  694. //列设置全选
  695. allChecked() {
  696. if (this.allCheck == true) {
  697. this.setRowList.map((e) => {
  698. return (e.checked = 0);
  699. });
  700. } else {
  701. this.setRowList.map((e) => {
  702. return (e.checked = 1);
  703. });
  704. }
  705. },
  706. //查询列数据
  707. getRow() {
  708. let that = this;
  709. this.data = {
  710. tableName: "入库",
  711. userId: Cookies.get("userName"),
  712. };
  713. select(this.data).then((res) => {
  714. if (res.data.length != 0) {
  715. this.getRowList = res.data.filter((e) => e.checked == 0);
  716. this.setRowList = res.data;
  717. this.setRowList = this.setRowList.reduce((res, item) => {
  718. res.push({
  719. surface: item.surface,
  720. label: item.label,
  721. name: item.name,
  722. checked: item.checked,
  723. width: item.width,
  724. fixed: item.fixed,
  725. });
  726. return res;
  727. }, []);
  728. }
  729. });
  730. },
  731. //重置列表
  732. delRow() {
  733. this.data = {
  734. tableName: "入库",
  735. userId: Cookies.get("userName"),
  736. };
  737. resetModule(this.data).then((res) => {
  738. if (res.code == 200) {
  739. this.showSetting = false;
  740. this.setRowList = this.$options.data().tableDate;
  741. this.getRowList = this.$options.data().tableDate;
  742. }
  743. });
  744. },
  745. //保存列设置
  746. save() {
  747. this.showSetting = false;
  748. this.data = {
  749. tableName: "入库",
  750. userId: Cookies.get("userName"),
  751. sysTableSetList: this.setRowList,
  752. };
  753. addSet(this.data).then((res) => {
  754. if (res.code == 200) {
  755. this.showSetting = false;
  756. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  757. console.log(this.tableDate);
  758. }
  759. });
  760. },
  761. //开始拖拽事件
  762. onStart() {
  763. this.drag = true;
  764. },
  765. //拖拽结束事件
  766. onEnd() {
  767. this.drag = false;
  768. },
  769. getList() {
  770. //获取仓库
  771. listWarehousebills(this.queryParams).then((response) => {
  772. this.warehousebillsList = response.rows;
  773. this.total = response.total;
  774. this.loading = false;
  775. });
  776. },
  777. //合计
  778. getSum(param) {
  779. const { columns, data } = param;
  780. const sums = [];
  781. columns.forEach((column, index) => {
  782. if (index === 0) {
  783. sums[index] = "总计";
  784. } else if (
  785. index === 13 ||
  786. index === 10 ||
  787. index === 11 ||
  788. index === 12
  789. ) {
  790. const values = data.map((item) => Number(item[column.property]));
  791. if (!values.every((value) => isNaN(value))) {
  792. sums[index] = values.reduce((prev, curr) => {
  793. const value = Number(curr);
  794. if (!isNaN(value)) {
  795. return prev + curr;
  796. } else {
  797. return prev;
  798. }
  799. }, 0);
  800. if (index === 13 || index === 12) {
  801. sums[index] = (sums[index] / 1000).toFixed(2) + "(吨)";
  802. }
  803. if (index === 11) {
  804. sums[index] = sums[index];
  805. }
  806. }
  807. }
  808. });
  809. return sums;
  810. },
  811. handleAdd() {
  812. this.timer = new Date().getTime();
  813. this.pageShow = false;
  814. this.pageShow2 = true;
  815. },
  816. // 多选框选中数据
  817. handleSelectionChange(selection) {
  818. this.ids = selection.map((item) => item.fId);
  819. this.single =
  820. selection.length !== 1 ||
  821. selection.map((item) => item.fBillstatus) == 6 ||
  822. selection.map((item) => item.fBillstatus) == 4;
  823. this.multiple = !selection.length;
  824. },
  825. /** 修改按钮操作 */
  826. handleUpdate(row) {
  827. const fId = row.fId || this.ids[0];
  828. this.copyStatus=null
  829. this.formId = fId;
  830. this.$nextTick(() => {
  831. this.$refs.addOrUpdateRef.init();
  832. });
  833. setTimeout(() => {
  834. this.pageShow = false;
  835. this.pageShow2 = true;
  836. }, 200);
  837. },
  838. copyUpdate() {
  839. this.formId = this.ids[0];
  840. this.copyStatus = 2;
  841. this.$nextTick(() => {
  842. this.$refs.addOrUpdateRef.init();
  843. });
  844. setTimeout(() => {
  845. this.pageShow = false;
  846. this.pageShow2 = true;
  847. }, 200);
  848. },
  849. /** 删除按钮操作 */
  850. handleDelete(row) {
  851. const ids = row.id || this.ids;
  852. this.$confirm('是否确认删除订单主编号为"' + ids + '"的数据项?', "警告", {
  853. confirmButtonText: "确定",
  854. cancelButtonText: "取消",
  855. type: "warning",
  856. })
  857. .then(function () {
  858. return delFtmsorderbills(ids);
  859. })
  860. .then(() => {
  861. this.getList();
  862. this.msgSuccess("删除成功");
  863. });
  864. },
  865. /** 导出按钮操作 */
  866. handleExport() {
  867. // require.ensure([], () => {
  868. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  869. // const tHeader = ["客户名称", "制单日期"];
  870. // // 上面设置Excel的表格第一行的标题
  871. // const filterVal = ["corpId", "createTime"];
  872. // // 上面的index、nickName、name是tableData里对象的属性
  873. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  874. // const data = this.formatJson(filterVal, list);
  875. // export_json_to_excel(
  876. // tHeader,
  877. // data,
  878. // "列表excel",
  879. // true,
  880. // );
  881. // });
  882. },
  883. formatJson(filterVal, jsonData) {
  884. return jsonData.map((v) => filterVal.map((j) => v[j]));
  885. },
  886. /** 搜索按钮操作 */
  887. handleQuery() {
  888. this.queryParams.pageNum = 1;
  889. this.getList();
  890. },
  891. /** 重置按钮操作 */
  892. resetQuery() {
  893. this.queryParams = {
  894. pageNum: 1,
  895. pageSize: 10,
  896. fBillno: null,
  897. createBy: null,
  898. fTrademodeid: null,
  899. fCorpid: null,
  900. fMblno: null,
  901. fSbu: null,
  902. fGoodsid: null,
  903. fWarehouseid: null,
  904. fMarks: null,
  905. fBillstatus: null,
  906. fItemsStatus: null,
  907. timeInterval: null,
  908. };
  909. this.userOptions = [];
  910. this.fMblnoOptions = [];
  911. this.handleQuery();
  912. },
  913. showAddOrUpdate(data) {
  914. if (data) {
  915. this.getList();
  916. this.pageShow = true;
  917. this.pageShow2 = false;
  918. }
  919. },
  920. },
  921. };
  922. </script>