index.vue 31 KB

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