index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  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="timeInterval">
  43. <el-date-picker
  44. v-model="queryParams.timeInterval"
  45. type="daterange"
  46. value-format="yyyy-MM-dd"
  47. clearable
  48. style="width: 230px"
  49. range-separator="至"
  50. start-placeholder="开始日期"
  51. end-placeholder="结束日期"
  52. @keyup.enter.native="handleQuery"
  53. >
  54. </el-date-picker>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="6">
  58. <el-form-item label="仓库" prop="fWarehouseid">
  59. <el-select
  60. v-model="queryParams.fWarehouseid"
  61. clearable
  62. filterable
  63. placeholder="请选择仓库"
  64. style="width: 200px"
  65. @keyup.enter.native="handleQuery"
  66. >
  67. <el-option
  68. v-for="(item, index) in warehouseOptions"
  69. :key="index.fId"
  70. :label="item.fName"
  71. :value="item.fId"
  72. ></el-option>
  73. </el-select>
  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"></el-option>
  118. <el-option label="待入库" value="2"></el-option>
  119. <el-option label="入库中" value="3"></el-option>
  120. <el-option label="已入库" value="4"></el-option>
  121. </el-select>
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="6">
  125. <el-form-item label="费用状态" prop="fBillstatus">
  126. <el-select
  127. style="width: 200px"
  128. v-model="queryParams.fBillstatus"
  129. placeholder="请选择费用状态"
  130. >
  131. <el-option label="录入" value="1"></el-option>
  132. <el-option label="暂存" value="2"></el-option>
  133. <el-option label="驳回" value="3"></el-option>
  134. <el-option label="请核" value="4"></el-option>
  135. <el-option label="审核中" value="5"></el-option>
  136. <el-option label="全部入账" value="6"></el-option>
  137. </el-select>
  138. </el-form-item>
  139. </el-col>
  140. </el-row>
  141. <el-row>
  142. <el-col :span="6">
  143. <el-form-item label="业务编号" prop="fBillno">
  144. <el-input
  145. v-model="queryParams.fBillno"
  146. placeholder="请输入业务编号"
  147. clearable
  148. @keyup.enter.native="handleQuery"
  149. style="width: 200px"
  150. />
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="6">
  154. <el-form-item label="制单人" prop="createBy">
  155. <el-select
  156. v-model="queryParams.createBy"
  157. filterable
  158. clearable
  159. placeholder="请输入关键词"
  160. style="width: 200px"
  161. >
  162. <el-option
  163. v-for="(item, index) in userOptions"
  164. :key="index.userName"
  165. :label="item.nickName"
  166. :value="item.userName"
  167. >
  168. </el-option>
  169. </el-select>
  170. </el-form-item>
  171. </el-col>
  172. <el-col :span="6">
  173. <el-form-item label="经营单位" prop="fSbu">
  174. <el-select
  175. v-model="queryParams.fSbu"
  176. clearable
  177. filterable
  178. placeholder="请输入关键词"
  179. style="width: 200px"
  180. >
  181. <el-option
  182. v-for="(item, index) in fMblnoOptions"
  183. :key="index.fId"
  184. :label="item.fName"
  185. :value="item.fId"
  186. ></el-option>
  187. </el-select>
  188. </el-form-item>
  189. </el-col>
  190. <el-col :span="6">
  191. <el-form-item label="贸易方式" prop="fTrademodeid">
  192. <el-select
  193. v-model="queryParams.fTrademodeid"
  194. placeholder="请选择贸易方式"
  195. clearable
  196. @keyup.enter.native="handleQuery"
  197. style="width: 200px"
  198. >
  199. <el-option
  200. v-for="(item, index) in fTrademodeidOptions"
  201. :key="index.dictValue"
  202. :label="item.dictLabel"
  203. :value="item.dictValue"
  204. />
  205. </el-select>
  206. </el-form-item>
  207. </el-col>
  208. </el-row>
  209. </div>
  210. </el-collapse-transition>
  211. </el-form>
  212. <el-row :gutter="10" class="mb8">
  213. <el-col :span="1.5">
  214. <el-button
  215. type="primary"
  216. icon="el-icon-plus"
  217. size="mini"
  218. @click="handleAdd"
  219. v-hasPermi="['warehouseBusiness: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. :close-on-click-modal="false"
  313. >
  314. <template slot="title">
  315. <div class="avue-crud__dialog__header">
  316. <span class="el-dialog__title">
  317. <span
  318. style="
  319. display: inline-block;
  320. width: 3px;
  321. height: 20px;
  322. margin-right: 5px;
  323. float: left;
  324. margin-top: 2px;
  325. "
  326. ></span>
  327. </span>
  328. </div>
  329. </template>
  330. <div>配置排序列数据(拖动调整顺序)</div>
  331. <div style="margin-left: 17px">
  332. <el-checkbox
  333. v-model="allCheck"
  334. label="全选"
  335. @change="allChecked"
  336. ></el-checkbox>
  337. </div>
  338. <div style="padding: 4px; display: flex; justify-content: center">
  339. <draggable
  340. v-model="setRowList"
  341. group="site"
  342. animation="300"
  343. @start="onStart"
  344. @end="onEnd"
  345. handle=".indraggable"
  346. >
  347. <transition-group>
  348. <div
  349. v-for="item in setRowList"
  350. :key="item.surface"
  351. class="listStyle"
  352. >
  353. <div style="width: 500px" class="indraggable">
  354. <div class="progress" :style="{ width: item.width + 'px' }">
  355. <el-checkbox
  356. :label="item.name"
  357. v-model="item.checked"
  358. :true-label="0"
  359. :false-label="1"
  360. >{{ item.name }}
  361. </el-checkbox>
  362. </div>
  363. </div>
  364. <el-input-number
  365. v-model.number="item.width"
  366. controls-position="right"
  367. :min="1"
  368. :max="500"
  369. size="mini"
  370. ></el-input-number>
  371. </div>
  372. </transition-group>
  373. </draggable>
  374. </div>
  375. <span slot="footer" class="dialog-footer">
  376. <el-button @click="showSetting = false">取 消</el-button>
  377. <el-button @click="delRow" type="danger">重 置</el-button>
  378. <el-button type="primary" @click="save()">确 定</el-button>
  379. </span>
  380. </el-dialog>
  381. <el-table
  382. v-loading="loading"
  383. :data="warehousebillsList"
  384. @selection-change="handleSelectionChange"
  385. show-summary
  386. :summary-method="getSum"
  387. >
  388. <el-table-column type="selection" width="50" fixed align="center" />
  389. <el-table-column
  390. type="index"
  391. label="行号"
  392. width="50"
  393. align="center"
  394. fixed
  395. />
  396. <el-table-column
  397. v-for="(item, index) in getRowList"
  398. :key="index"
  399. :label="item.name"
  400. :width="item.width"
  401. :prop="item.label"
  402. align="center"
  403. :fixed="item.fixed"
  404. :show-overflow-tooltip="true"
  405. sortable
  406. >
  407. <template slot-scope="scope">
  408. <span v-if="item.label == 'fMblno'">
  409. <el-link :underline="false" type="primary"
  410. ><div @click="handleUpdate(scope.row)">
  411. {{ scope.row.fMblno }}
  412. </div></el-link
  413. >
  414. </span>
  415. <span v-else>{{ scope.row[item.label] }}</span>
  416. </template>
  417. </el-table-column>
  418. <el-table-column
  419. label="操作"
  420. align="center"
  421. class-name="small-padding fixed-width"
  422. min-width="180"
  423. fixed="right"
  424. >
  425. <template slot-scope="scope">
  426. <el-button
  427. size="mini"
  428. type="text"
  429. icon="el-icon-edit"
  430. @click="handleUpdate(scope.row, true)"
  431. v-hasPermi="['warehouseBusiness:inStock:edit']"
  432. >查看
  433. </el-button>
  434. <el-button
  435. size="mini"
  436. type="text"
  437. icon="el-icon-edit"
  438. v-if="
  439. scope.row.fBillstatus == '录入' ||
  440. scope.row.fBillstatus == '暂存' ||
  441. scope.row.fBillstatus == '驳回'
  442. "
  443. @click="handleUpdate(scope.row, false)"
  444. v-hasPermi="['warehouseBusiness:inStock:edit']"
  445. >修改
  446. </el-button>
  447. <el-button
  448. size="mini"
  449. type="text"
  450. icon="el-icon-delete"
  451. v-if="scope.row.fItemsStatus == '计划'"
  452. @click="handleDelete(scope.row)"
  453. v-hasPermi="['warehouseBusiness:inStock:remove']"
  454. >删除
  455. </el-button>
  456. <el-button
  457. size="mini"
  458. type="text"
  459. icon="el-icon-delete"
  460. v-if="
  461. scope.row.fBillstatus == '请核' ||
  462. scope.row.fBillstatus == '审核中'
  463. "
  464. @click="handleUpdate(scope.row, true)"
  465. >审核进度
  466. </el-button>
  467. </template>
  468. </el-table-column>
  469. </el-table>
  470. <pagination
  471. v-show="total > 0"
  472. :total="total"
  473. :page.sync="queryParams.pageNum"
  474. :limit.sync="queryParams.pageSize"
  475. @pagination="getList"
  476. />
  477. </div>
  478. <add-or-update
  479. v-show="pageShow2"
  480. @changeShow="showAddOrUpdate"
  481. ref="addOrUpdateRef"
  482. :chiId="formId"
  483. :copyStatus="copyStatus"
  484. :key="timer"
  485. ></add-or-update>
  486. </div>
  487. </template>
  488. <script>
  489. import AddOrUpdate from "./AddOrUpdate.vue";
  490. import {
  491. listWarehousebills,
  492. delinStock_s,
  493. delWarehousebills,
  494. } from "@/api/warehouseBusiness/warehouseInStock";
  495. import { listCorps } from "@/api/basicdata/corps";
  496. import { listWarehousesss } from "@/api/basicdata/warehouse";
  497. import { listGoods } from "@/api/basicdata/goods";
  498. import { listUser, queryUserVal } from "@/api/system/user";
  499. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  500. import Cookies from "js-cookie";
  501. import { addSet, select, resetModule } from "@/api/system/set";
  502. import draggable from "vuedraggable";
  503. export default {
  504. name: "plans",
  505. data() {
  506. return {
  507. timer: "",
  508. pageShow: true,
  509. pageShow2: false,
  510. queryParams: {
  511. pageNum: 1,
  512. pageSize: 10,
  513. fBillno: null,
  514. createBy: null,
  515. fTrademodeid: null,
  516. fCorpid: null,
  517. fMblno: null,
  518. fSbu: null,
  519. fGoodsid: null,
  520. fWarehouseid: null,
  521. fMarks: null,
  522. fBillstatus: null,
  523. fItemsStatus: null,
  524. timeInterval: null,
  525. },
  526. // 显示搜索条件
  527. showSearch: true,
  528. userOptions: [],
  529. fTrademodeidOptions: [],
  530. warehouseOptions: [],
  531. goodsOptions: [],
  532. fMblnoOptions: [],
  533. show: false,
  534. drag: false,
  535. tableDate: [
  536. {
  537. surface: "1",
  538. label: "fMblno",
  539. name: "提单号",
  540. checked: 0,
  541. width: 200,
  542. fixed: "left",
  543. },
  544. {
  545. surface: "2",
  546. label: "createBy",
  547. name: "制单人",
  548. checked: 0,
  549. width: 100,
  550. },
  551. {
  552. surface: "3",
  553. label: "fItemsStatus",
  554. name: "入库状态",
  555. checked: 0,
  556. fixed: "left",
  557. width: 100,
  558. },
  559. {
  560. surface: "4",
  561. label: "fCorpid",
  562. name: "客户",
  563. checked: 0,
  564. fixed: "left",
  565. width: 100,
  566. },
  567. {
  568. surface: "5",
  569. label: "fGoodsid",
  570. name: "品名",
  571. checked: 0,
  572. fixed: "left",
  573. width: 100,
  574. },
  575. {
  576. surface: "6",
  577. label: "fMarks",
  578. name: "品牌",
  579. checked: 0,
  580. width: 100,
  581. },
  582. {
  583. surface: "7",
  584. label: "fBsdate",
  585. name: "入库日期",
  586. checked: 0,
  587. fixed: "left",
  588. width: 100,
  589. },
  590. {
  591. surface: "8",
  592. label: "fWarehouseid",
  593. name: "仓库",
  594. checked: 0,
  595. width: 100,
  596. },
  597. {
  598. surface: "9",
  599. label: "fPlanqty",
  600. name: "计划件数",
  601. checked: 0,
  602. width: 100,
  603. },
  604. {
  605. surface: "10",
  606. label: "fQty",
  607. name: "入库件数",
  608. checked: 0,
  609. width: 100,
  610. },
  611. {
  612. surface: "11",
  613. label: "fGrossweight",
  614. name: "入库毛重",
  615. checked: 0,
  616. width: 100,
  617. },
  618. {
  619. surface: "12",
  620. label: "fNetweight",
  621. name: "入库净重",
  622. checked: 0,
  623. width: 100,
  624. },
  625. {
  626. surface: "13",
  627. label: "fCntval",
  628. name: "箱型箱量",
  629. checked: 0,
  630. width: 100,
  631. },
  632. {
  633. surface: "14",
  634. label: "fTruckno",
  635. name: "车号",
  636. checked: 0,
  637. width: 100,
  638. },
  639. {
  640. surface: "15",
  641. label: "fDriverName",
  642. name: "司机名称",
  643. checked: 0,
  644. width: 100,
  645. },
  646. {
  647. surface: "16",
  648. label: "fDriverTel",
  649. name: "司机电话",
  650. checked: 0,
  651. width: 100,
  652. },
  653. {
  654. surface: "17",
  655. label: "fDriverIdCar",
  656. name: "司机身份证",
  657. checked: 0,
  658. width: 100,
  659. },
  660. {
  661. surface: "18",
  662. label: "fBusinessType",
  663. name: "业务类别",
  664. checked: 0,
  665. width: 100,
  666. },
  667. {
  668. surface: "19",
  669. label: "fBillstatus",
  670. name: "费用状态",
  671. checked: 0,
  672. width: 100,
  673. },
  674. {
  675. surface: "20",
  676. label: "fStorekeeper",
  677. name: "仓管员",
  678. checked: 0,
  679. width: 100,
  680. },
  681. ],
  682. setRowList: [],
  683. getRowList: [],
  684. allCheck: false,
  685. showSetting: false,
  686. total: 0,
  687. warehousebillsList: [],
  688. loading: true,
  689. single: true,
  690. multiple: true,
  691. formId: null,
  692. ids: [],
  693. copyStatus: null,
  694. };
  695. },
  696. // 使用子组件
  697. components: { draggable, AddOrUpdate },
  698. created() {
  699. this.setRowList = this.tableDate;
  700. this.getRowList = this.tableDate;
  701. this.getDicts("data_trademodes").then((response) => {
  702. this.fTrademodeidOptions = response.data;
  703. });
  704. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  705. this.goodsOptions = response.rows;
  706. });
  707. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  708. this.warehouseOptions = response.rows;
  709. });
  710. listUser().then((response) => {
  711. this.userOptions = response.rows;
  712. });
  713. listCorps({ type: 1 }).then((response) => {
  714. this.fMblnoOptions = response.rows;
  715. });
  716. this.getRow();
  717. this.getList();
  718. },
  719. activated() {
  720. if (this.$route.query.id) {
  721. this.handleUpdate(this.$route.query.id);
  722. }
  723. },
  724. methods: {
  725. //列设置全选
  726. allChecked() {
  727. if (this.allCheck == true) {
  728. this.setRowList.map((e) => {
  729. return (e.checked = 0);
  730. });
  731. } else {
  732. this.setRowList.map((e) => {
  733. return (e.checked = 1);
  734. });
  735. }
  736. },
  737. //查询列数据
  738. getRow() {
  739. let that = this;
  740. this.data = {
  741. tableName: "入库",
  742. userId: Cookies.get("userName"),
  743. };
  744. select(this.data).then((res) => {
  745. if (res.data.length != 0) {
  746. this.getRowList = res.data.filter((e) => e.checked == 0);
  747. this.setRowList = res.data;
  748. this.setRowList = this.setRowList.reduce((res, item) => {
  749. res.push({
  750. surface: item.surface,
  751. label: item.label,
  752. name: item.name,
  753. checked: item.checked,
  754. width: item.width,
  755. fixed: item.fixed,
  756. });
  757. return res;
  758. }, []);
  759. }
  760. });
  761. },
  762. //重置列表
  763. delRow() {
  764. this.data = {
  765. tableName: "入库",
  766. userId: Cookies.get("userName"),
  767. };
  768. resetModule(this.data).then((res) => {
  769. if (res.code == 200) {
  770. this.showSetting = false;
  771. this.setRowList = this.$options.data().tableDate;
  772. this.getRowList = this.$options.data().tableDate;
  773. }
  774. });
  775. },
  776. //保存列设置
  777. save() {
  778. this.showSetting = false;
  779. this.data = {
  780. tableName: "入库",
  781. userId: Cookies.get("userName"),
  782. sysTableSetList: this.setRowList,
  783. };
  784. addSet(this.data).then((res) => {
  785. if (res.code == 200) {
  786. this.showSetting = false;
  787. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  788. console.log(this.tableDate);
  789. }
  790. });
  791. },
  792. //开始拖拽事件
  793. onStart() {
  794. this.drag = true;
  795. },
  796. //拖拽结束事件
  797. onEnd() {
  798. this.drag = false;
  799. },
  800. getList() {
  801. //获取仓库
  802. listWarehousebills(this.queryParams).then((response) => {
  803. this.warehousebillsList = response.rows;
  804. this.total = response.total;
  805. this.loading = false;
  806. });
  807. },
  808. //合计
  809. getSum(param) {
  810. const { columns, data } = param;
  811. const sums = [];
  812. var values = [];
  813. columns.forEach((column, index) => {
  814. if (index === 0) {
  815. sums[index] = "";
  816. return;
  817. }
  818. if (column.property === "fGrossweight") {
  819. values = data.map((item) => Number(item["fGrossweight"]));
  820. }
  821. if (column.property === "fNetweight") {
  822. values = data.map((item) => Number(item["fNetweight"]));
  823. }
  824. if (column.property === "fQty") {
  825. values = data.map((item) => Number(item["fQty"]));
  826. }
  827. if (column.property === "fPlanqty") {
  828. values = data.map((item) => Number(item.fPlanqty));
  829. }
  830. if (
  831. column.property === "fGrossweight" ||
  832. column.property === "fNetweight" ||
  833. column.property === "fQty" ||
  834. column.property === "fPlanqty"
  835. ) {
  836. sums[index] = values.reduce((prev, curr) => {
  837. const value = Number(curr);
  838. if (!isNaN(value)) {
  839. return prev + curr;
  840. } else {
  841. return prev;
  842. }
  843. }, 0);
  844. if (column.property === "fGrossweight") {
  845. sums[index] = sums[index].toFixed(2) + "吨";
  846. }
  847. if (column.property === "fNetweight") {
  848. sums[index] = sums[index].toFixed(2) + "吨";
  849. }
  850. if (column.property === "fQty") {
  851. sums[index] = sums[index].toFixed(2);
  852. }
  853. if (column.property === "fPlanqty") {
  854. if (sums[index]) {
  855. sums[index] = sums[index];
  856. }
  857. }
  858. }
  859. });
  860. return sums;
  861. },
  862. handleAdd() {
  863. this.timer = new Date().getTime();
  864. this.pageShow = false;
  865. this.pageShow2 = true;
  866. },
  867. // 多选框选中数据
  868. handleSelectionChange(selection) {
  869. this.ids = selection.map((item) => item.fId);
  870. this.single =
  871. selection.length !== 1 ||
  872. selection.map((item) => item.fBillstatus) == 6 ||
  873. selection.map((item) => item.fBillstatus) == 4;
  874. this.multiple = !selection.length;
  875. },
  876. /** 修改按钮操作 */
  877. handleUpdate(row) {
  878. const fId = row.fId || this.ids[0] || row;
  879. this.copyStatus = null;
  880. this.formId = fId;
  881. this.$nextTick(() => {
  882. this.$refs.addOrUpdateRef.init();
  883. });
  884. setTimeout(() => {
  885. this.pageShow = false;
  886. this.pageShow2 = true;
  887. }, 200);
  888. },
  889. copyUpdate() {
  890. this.formId = this.ids[0];
  891. this.copyStatus = 2;
  892. this.$nextTick(() => {
  893. this.$refs.addOrUpdateRef.init();
  894. });
  895. setTimeout(() => {
  896. this.pageShow = false;
  897. this.pageShow2 = true;
  898. }, 200);
  899. },
  900. /** 删除按钮操作 */
  901. handleDelete(row) {
  902. const ids = row.fId || this.ids;
  903. delinStock_s(ids).then((data) => {
  904. switch (data.msg) {
  905. case "0": {
  906. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  907. break;
  908. }
  909. case "1": {
  910. this.delete(ids, "当前主表有数据从表无数据是否删除");
  911. break;
  912. }
  913. case "2": {
  914. this.delete(ids, "当前主表有数据从表有数据是否删除");
  915. break;
  916. }
  917. default: {
  918. return this.$message.error("未知错误,无状态");
  919. }
  920. }
  921. });
  922. },
  923. delete(ids, tips) {
  924. this.$confirm(tips, "警告", {
  925. confirmButtonText: "确定",
  926. cancelButtonText: "取消",
  927. type: "warning",
  928. }).then(() => {
  929. delWarehousebills(ids);
  930. this.msgSuccess("删除成功");
  931. this.getList();
  932. });
  933. },
  934. /** 导出按钮操作 */
  935. handleExport() {
  936. // require.ensure([], () => {
  937. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  938. // const tHeader = ["客户名称", "制单日期"];
  939. // // 上面设置Excel的表格第一行的标题
  940. // const filterVal = ["corpId", "createTime"];
  941. // // 上面的index、nickName、name是tableData里对象的属性
  942. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  943. // const data = this.formatJson(filterVal, list);
  944. // export_json_to_excel(
  945. // tHeader,
  946. // data,
  947. // "列表excel",
  948. // true,
  949. // );
  950. // });
  951. },
  952. formatJson(filterVal, jsonData) {
  953. return jsonData.map((v) => filterVal.map((j) => v[j]));
  954. },
  955. /** 搜索按钮操作 */
  956. handleQuery() {
  957. this.queryParams.pageNum = 1;
  958. this.getList();
  959. },
  960. /** 重置按钮操作 */
  961. resetQuery() {
  962. this.queryParams = {
  963. pageNum: 1,
  964. pageSize: 10,
  965. fBillno: null,
  966. createBy: null,
  967. fTrademodeid: null,
  968. fCorpid: null,
  969. fMblno: null,
  970. fSbu: null,
  971. fGoodsid: null,
  972. fWarehouseid: null,
  973. fMarks: null,
  974. fBillstatus: null,
  975. fItemsStatus: null,
  976. timeInterval: null,
  977. };
  978. this.userOptions = [];
  979. this.fMblnoOptions = [];
  980. this.handleQuery();
  981. },
  982. showAddOrUpdate(data) {
  983. if (data) {
  984. this.getList();
  985. this.pageShow = true;
  986. this.pageShow2 = false;
  987. }
  988. },
  989. },
  990. };
  991. </script>