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