index.vue 32 KB

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