index.vue 31 KB

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