index.vue 33 KB

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