index.vue 30 KB

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