index.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  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" />
  119. <el-option label="已装货" value="3" />
  120. <el-option label="已出库" value="4" />
  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:outStock: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:outStock: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:outStock: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:outStock: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:outStock: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:outStock: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:outStock: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. addWhgenleg,
  492. listWarehousebills,
  493. getWarehousebills,
  494. delWarehousebills,
  495. addWarehousebills,
  496. updateCredit,
  497. addJoblist,
  498. disChargelist,
  499. warehouseSubmission,
  500. updateWarehousebills,
  501. exportWarehousebills,
  502. revokeTwo,
  503. revoke,
  504. delOutStock_s,
  505. serialNumber,
  506. } from "@/api/warehouseBusiness/warehouseOutStock";
  507. import { listCorps } from "@/api/basicdata/corps";
  508. import { listWarehousesss } from "@/api/basicdata/warehouse";
  509. import { listGoods } from "@/api/basicdata/goods";
  510. import { listUser, queryUserVal } from "@/api/system/user";
  511. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  512. import Cookies from "js-cookie";
  513. import { addSet, select, resetModule } from "@/api/system/set";
  514. import draggable from "vuedraggable";
  515. export default {
  516. name: "plans",
  517. data() {
  518. return {
  519. timer: "",
  520. pageShow: true,
  521. pageShow2: false,
  522. queryParams: {
  523. pageNum: 1,
  524. pageSize: 10,
  525. fBillno: null,
  526. createBy: null,
  527. fTrademodeid: null,
  528. fCorpid: null,
  529. fMblno: null,
  530. fSbu: null,
  531. fGoodsid: null,
  532. fWarehouseid: null,
  533. fMarks: null,
  534. fBillstatus: null,
  535. fItemsStatus: null,
  536. timeInterval: null,
  537. },
  538. // 显示搜索条件
  539. showSearch: true,
  540. userOptions: [],
  541. fTrademodeidOptions: [],
  542. warehouseOptions: [],
  543. goodsOptions: [],
  544. fMblnoOptions: [],
  545. show: false,
  546. drag: false,
  547. tableDate: [
  548. {
  549. surface: "0",
  550. label: "fMblno",
  551. name: "提单号",
  552. checked: 0,
  553. width: 200,
  554. fixed: "left",
  555. },
  556. {
  557. surface: "1",
  558. label: "createBy",
  559. name: "制单人",
  560. checked: 0,
  561. width: 100,
  562. },
  563. {
  564. surface: "2",
  565. label: "fStorekeeper",
  566. name: "仓管员",
  567. checked: 0,
  568. width: 100,
  569. },
  570. {
  571. surface: "3",
  572. label: "fItemsStatus",
  573. name: "出库状态",
  574. checked: 0,
  575. width: 100,
  576. },
  577. {
  578. surface: "4",
  579. label: "fCorpid",
  580. name: "客户",
  581. checked: 0,
  582. width: 100,
  583. },
  584. {
  585. surface: "6",
  586. label: "fProductName",
  587. name: "品名",
  588. checked: 0,
  589. width: 100,
  590. },
  591. {
  592. surface: "7",
  593. label: "fMarks",
  594. name: "品牌",
  595. checked: 0,
  596. width: 100,
  597. },
  598. {
  599. surface: "8",
  600. label: "fBsdate",
  601. name: "出库日期",
  602. checked: 0,
  603. width: 100,
  604. },
  605. {
  606. surface: "9",
  607. label: "fWarehouseid",
  608. name: "仓库",
  609. checked: 0,
  610. width: 100,
  611. },
  612. {
  613. surface: "10",
  614. label: "fPlanqty",
  615. name: "计划件数",
  616. checked: 0,
  617. width: 100,
  618. },
  619. {
  620. surface: "11",
  621. label: "fQty",
  622. name: "出库件数",
  623. checked: 0,
  624. width: 100,
  625. },
  626. {
  627. surface: "12",
  628. label: "fGrossweight",
  629. name: "出库毛重",
  630. checked: 0,
  631. width: 100,
  632. },
  633. {
  634. surface: "13",
  635. label: "fNetweight",
  636. name: "出库净重",
  637. checked: 0,
  638. width: 100,
  639. },
  640. {
  641. surface: "14",
  642. label: "fTruckno",
  643. name: "车号",
  644. checked: 0,
  645. width: 100,
  646. },
  647. {
  648. surface: "15",
  649. label: "fDriverName",
  650. name: "司机名称",
  651. checked: 0,
  652. width: 100,
  653. },
  654. {
  655. surface: "16",
  656. label: "fDriverTel",
  657. name: "司机电话",
  658. checked: 0,
  659. width: 100,
  660. },
  661. {
  662. surface: "17",
  663. label: "fDriverIdCar",
  664. name: "司机身份证",
  665. checked: 0,
  666. width: 100,
  667. },
  668. {
  669. surface: "18",
  670. label: "fBusinessType",
  671. name: "业务类别",
  672. checked: 0,
  673. width: 100,
  674. },
  675. {
  676. surface: "19",
  677. label: "fBillstatus",
  678. name: "费用状态",
  679. checked: 0,
  680. width: 100,
  681. },
  682. {
  683. surface: "20",
  684. label: "fBillno",
  685. name: "系统编号",
  686. checked: 0,
  687. width: 100,
  688. },
  689. ],
  690. setRowList: [],
  691. getRowList: [],
  692. allCheck: false,
  693. showSetting: false,
  694. total: 0,
  695. warehousebillsList: [],
  696. loading: true,
  697. single: true,
  698. multiple: true,
  699. formId: null,
  700. ids: [],
  701. copyStatus: null,
  702. };
  703. },
  704. // 使用子组件
  705. components: { draggable, AddOrUpdate },
  706. created() {
  707. this.setRowList = this.tableDate;
  708. this.getRowList = this.tableDate;
  709. this.getDicts("data_trademodes").then((response) => {
  710. this.fTrademodeidOptions = response.data;
  711. });
  712. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  713. this.goodsOptions = response.rows;
  714. });
  715. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  716. this.warehouseOptions = response.rows;
  717. });
  718. listUser().then((response) => {
  719. this.userOptions = response.rows;
  720. });
  721. listCorps({ type: 1 }).then((response) => {
  722. this.fMblnoOptions = response.rows;
  723. });
  724. this.getRow();
  725. this.getList();
  726. },
  727. activated() {
  728. if (this.$route.query.id) {
  729. this.handleUpdate(this.$route.query.id);
  730. }
  731. },
  732. methods: {
  733. //列设置全选
  734. allChecked() {
  735. if (this.allCheck == true) {
  736. this.setRowList.map((e) => {
  737. return (e.checked = 0);
  738. });
  739. } else {
  740. this.setRowList.map((e) => {
  741. return (e.checked = 1);
  742. });
  743. }
  744. },
  745. //查询列数据
  746. getRow() {
  747. let that = this;
  748. this.data = {
  749. tableName: "出库",
  750. userId: Cookies.get("userName"),
  751. };
  752. select(this.data).then((res) => {
  753. if (res.data.length != 0) {
  754. this.getRowList = res.data.filter((e) => e.checked == 0);
  755. this.setRowList = res.data;
  756. this.setRowList = this.setRowList.reduce((res, item) => {
  757. res.push({
  758. surface: item.surface,
  759. label: item.label,
  760. name: item.name,
  761. checked: item.checked,
  762. width: item.width,
  763. fixed: item.fixed,
  764. });
  765. return res;
  766. }, []);
  767. }
  768. });
  769. },
  770. //重置列表
  771. delRow() {
  772. this.data = {
  773. tableName: "出库",
  774. userId: Cookies.get("userName"),
  775. };
  776. resetModule(this.data).then((res) => {
  777. if (res.code == 200) {
  778. this.showSetting = false;
  779. this.setRowList = this.$options.data().tableDate;
  780. this.getRowList = this.$options.data().tableDate;
  781. }
  782. });
  783. },
  784. //保存列设置
  785. save() {
  786. this.showSetting = false;
  787. this.data = {
  788. tableName: "出库",
  789. userId: Cookies.get("userName"),
  790. sysTableSetList: this.setRowList,
  791. };
  792. addSet(this.data).then((res) => {
  793. if (res.code == 200) {
  794. this.showSetting = false;
  795. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  796. console.log(this.tableDate);
  797. }
  798. });
  799. },
  800. //开始拖拽事件
  801. onStart() {
  802. this.drag = true;
  803. },
  804. //拖拽结束事件
  805. onEnd() {
  806. this.drag = false;
  807. },
  808. getList() {
  809. //获取仓库
  810. listWarehousebills(this.queryParams).then((response) => {
  811. this.warehousebillsList = response.rows;
  812. this.total = response.total;
  813. this.loading = false;
  814. });
  815. },
  816. //合计
  817. getSum(param) {
  818. const { columns, data } = param;
  819. const sums = [];
  820. var values = [];
  821. columns.forEach((column, index) => {
  822. if (index === 0) {
  823. sums[index] = "";
  824. return;
  825. }
  826. if (column.property === "fGrossweight") {
  827. values = data.map((item) => Number(item["fGrossweight"]));
  828. }
  829. if (column.property === "fNetweight") {
  830. values = data.map((item) => Number(item["fNetweight"]));
  831. }
  832. if (column.property === "fQty") {
  833. values = data.map((item) => Number(item["fQty"]));
  834. }
  835. if (column.property === "fPlanqty") {
  836. values = data.map((item) => Number(item.fPlanqty));
  837. }
  838. if (
  839. column.property === "fGrossweight" ||
  840. column.property === "fNetweight" ||
  841. column.property === "fQty" ||
  842. column.property === "fPlanqty"
  843. ) {
  844. sums[index] = values.reduce((prev, curr) => {
  845. const value = Number(curr);
  846. if (!isNaN(value)) {
  847. return prev + curr;
  848. } else {
  849. return prev;
  850. }
  851. }, 0);
  852. if (column.property === "fGrossweight") {
  853. sums[index] = sums[index].toFixed(2) + "吨";
  854. }
  855. if (column.property === "fNetweight") {
  856. sums[index] = sums[index].toFixed(2) + "吨";
  857. }
  858. if (column.property === "fQty") {
  859. sums[index] = sums[index].toFixed(2);
  860. }
  861. if (column.property === "fPlanqty") {
  862. if (sums[index]) {
  863. sums[index] = sums[index];
  864. }
  865. }
  866. }
  867. });
  868. return sums;
  869. },
  870. handleAdd() {
  871. this.timer = new Date().getTime();
  872. this.pageShow = false;
  873. this.pageShow2 = true;
  874. },
  875. // 多选框选中数据
  876. handleSelectionChange(selection) {
  877. this.ids = selection.map((item) => item.fId);
  878. this.single =
  879. selection.length !== 1 ||
  880. selection.map((item) => item.fBillstatus) == 6 ||
  881. selection.map((item) => item.fBillstatus) == 4;
  882. this.multiple = !selection.length;
  883. },
  884. /** 修改按钮操作 */
  885. handleUpdate(row) {
  886. const fId = row.fId || this.ids[0]|| row;
  887. this.copyStatus = null;
  888. this.formId = fId;
  889. this.$nextTick(() => {
  890. this.$refs.addOrUpdateRef.init();
  891. });
  892. setTimeout(() => {
  893. this.pageShow = false;
  894. this.pageShow2 = true;
  895. }, 200);
  896. },
  897. copyUpdate() {
  898. this.formId = this.ids[0];
  899. this.copyStatus = 2;
  900. this.$nextTick(() => {
  901. this.$refs.addOrUpdateRef.init();
  902. });
  903. setTimeout(() => {
  904. this.pageShow = false;
  905. this.pageShow2 = true;
  906. }, 200);
  907. },
  908. /** 删除按钮操作 */
  909. handleDelete(row) {
  910. const ids = row.fId || this.ids;
  911. delOutStock_s(ids).then((data) => {
  912. switch (data.msg) {
  913. case "0": {
  914. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  915. break;
  916. }
  917. case "1": {
  918. this.delete(ids, "当前主表有数据从表无数据是否删除");
  919. break;
  920. }
  921. case "2": {
  922. this.delete(ids, "当前主表有数据从表有数据是否删除");
  923. break;
  924. }
  925. default: {
  926. return this.$message.error("未知错误,无状态");
  927. }
  928. }
  929. });
  930. },
  931. delete(ids, tips) {
  932. this.$confirm(tips, "警告", {
  933. confirmButtonText: "确定",
  934. cancelButtonText: "取消",
  935. type: "warning",
  936. }).then(() => {
  937. delWarehousebills(ids);
  938. this.msgSuccess("删除成功");
  939. this.getList();
  940. });
  941. },
  942. /** 导出按钮操作 */
  943. handleExport() {
  944. // require.ensure([], () => {
  945. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  946. // const tHeader = ["客户名称", "制单日期"];
  947. // // 上面设置Excel的表格第一行的标题
  948. // const filterVal = ["corpId", "createTime"];
  949. // // 上面的index、nickName、name是tableData里对象的属性
  950. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  951. // const data = this.formatJson(filterVal, list);
  952. // export_json_to_excel(
  953. // tHeader,
  954. // data,
  955. // "列表excel",
  956. // true,
  957. // );
  958. // });
  959. },
  960. formatJson(filterVal, jsonData) {
  961. return jsonData.map((v) => filterVal.map((j) => v[j]));
  962. },
  963. /** 搜索按钮操作 */
  964. handleQuery() {
  965. this.queryParams.pageNum = 1;
  966. this.getList();
  967. },
  968. /** 重置按钮操作 */
  969. resetQuery() {
  970. this.queryParams = {
  971. pageNum: 1,
  972. pageSize: 10,
  973. fBillno: null,
  974. createBy: null,
  975. fTrademodeid: null,
  976. fCorpid: null,
  977. fMblno: null,
  978. fSbu: null,
  979. fGoodsid: null,
  980. fWarehouseid: null,
  981. fMarks: null,
  982. fBillstatus: null,
  983. fItemsStatus: null,
  984. timeInterval: null,
  985. };
  986. this.userOptions = [];
  987. this.fMblnoOptions = [];
  988. this.handleQuery();
  989. },
  990. showAddOrUpdate(data) {
  991. if (data) {
  992. this.getList();
  993. this.pageShow = true;
  994. this.pageShow2 = false;
  995. }
  996. },
  997. },
  998. };
  999. </script>