index.vue 32 KB

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