index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  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. this.setRowList = this.tableDate;
  755. this.getRowList = this.tableDate;
  756. this.getDicts("data_trademodes").then((response) => {
  757. this.fTrademodeidOptions = response.data;
  758. });
  759. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  760. this.goodsOptions = response.rows;
  761. });
  762. queryVehicle().then(res=>{
  763. this.fTrucknoList = res.data
  764. })
  765. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  766. this.warehouseOptions = response.rows;
  767. });
  768. listUser().then((response) => {
  769. this.userOptions = response.rows;
  770. });
  771. listCorps({ type: 1 }).then((response) => {
  772. this.fMblnoOptions = response.rows;
  773. });
  774. this.getRow();
  775. this.getList();
  776. this.getMonth();
  777. },
  778. activated() {
  779. if (this.$route.query.id) {
  780. this.handleUpdate(this.$route.query.id);
  781. }
  782. },
  783. mounted() {
  784. // this.setHeight();
  785. },
  786. methods: {
  787. // 获取当前月的第一天和最后一天
  788. getMonth() {
  789. let date = new Date();
  790. let year = parseInt(date.getFullYear())
  791. let month = parseInt(date.getMonth() + 1)
  792. let currentMonth = date.getMonth()
  793. let nextMonth = ++currentMonth
  794. let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1) // 下个月的第一天
  795. let oneDay = 1000*60*60*24
  796. let lastTime = new Date(nextMonthFirstDay - oneDay) // 下个月的第一天减去一天,就是上个月的最后一天
  797. let day = lastTime.getDate()
  798. if (day < 10) {
  799. day = '0' + day
  800. }
  801. this.queryParams.timeInterval = [year + '-' + month + '-' + '01 00:00:00', year + '-' + month + '-' + day + ' 23:59:59']
  802. },
  803. setHeight() {
  804. console.log(this.$refs.table.$el);
  805. const offsetTop = window.innerHeight - this.$refs.table.$el.offsetTop - 210
  806. const offsetBodyHeight = document.querySelector('.el-table__body').offsetHeight
  807. console.log(offsetTop, offsetBodyHeight)
  808. if (this.warehousebillsList.length && offsetBodyHeight < offsetTop) {
  809. this.tableHeight = offsetBodyHeight + 75
  810. } else if (!this.warehousebillsList.length) {
  811. this.tableHeight = null
  812. } else {
  813. this.tableHeight = offsetTop
  814. }
  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. listWarehousebills(this.queryParams).then((response) => {
  894. response.rows.map((e) => {
  895. e.freeContainerDate = e.freeContainerDate
  896. ? e.freeContainerDate.substring(0, 10)
  897. : null;
  898. });
  899. this.warehousebillsList = response.rows;
  900. this.total = response.total;
  901. this.loading = false;
  902. });
  903. },
  904. //合计
  905. getSum(param) {
  906. const { columns, data } = param;
  907. const sums = [];
  908. var values = [];
  909. columns.forEach((column, index) => {
  910. if (index === 0) {
  911. sums[index] = "合计";
  912. return;
  913. }
  914. if (column.property === "fGrossweight") {
  915. values = data.map((item) => Number(item["fGrossweight"]));
  916. }
  917. if (column.property === "fNetweight") {
  918. values = data.map((item) => Number(item["fNetweight"]));
  919. }
  920. if (column.property === "fQty") {
  921. values = data.map((item) => Number(item["fQty"]));
  922. }
  923. if (column.property === "fPlanqty") {
  924. values = data.map((item) => Number(item.fPlanqty));
  925. }
  926. if (
  927. column.property === "fGrossweight" ||
  928. column.property === "fNetweight" ||
  929. column.property === "fQty" ||
  930. column.property === "fPlanqty"
  931. ) {
  932. sums[index] = values.reduce((prev, curr) => {
  933. const value = Number(curr);
  934. if (!isNaN(value)) {
  935. return prev + curr;
  936. } else {
  937. return prev;
  938. }
  939. }, 0);
  940. if (column.property === "fGrossweight") {
  941. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  942. }
  943. if (column.property === "fNetweight") {
  944. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  945. }
  946. if (column.property === "fQty") {
  947. sums[index] = sums[index].toFixed(2);
  948. }
  949. if (column.property === "fPlanqty") {
  950. if (sums[index]) {
  951. sums[index] = sums[index];
  952. }
  953. }
  954. }
  955. });
  956. return sums;
  957. },
  958. handleAdd() {
  959. this.timer = new Date().getTime();
  960. this.pageShow = false;
  961. this.pageShow2 = true;
  962. },
  963. // 多选框选中数据
  964. handleSelectionChange(selection) {
  965. this.ids = selection.map((item) => item.fId);
  966. this.single =
  967. selection.length !== 1 ||
  968. selection.map((item) => item.fBillstatus) == 6 ||
  969. selection.map((item) => item.fBillstatus) == 4;
  970. this.multiple = !selection.length;
  971. },
  972. /** 修改按钮操作 */
  973. handleUpdate(row) {
  974. const fId = row.fId || this.ids[0] || row;
  975. this.copyStatus = null;
  976. this.formId = fId;
  977. console.log(this.formId)
  978. this.$nextTick(() => {
  979. this.$refs.addOrUpdateRef.init();
  980. });
  981. setTimeout(() => {
  982. this.pageShow = false;
  983. this.pageShow2 = true;
  984. }, 200);
  985. },
  986. copyUpdate() {
  987. this.formId = this.ids[0];
  988. this.copyStatus = 2;
  989. this.$nextTick(() => {
  990. this.$refs.addOrUpdateRef.init();
  991. });
  992. setTimeout(() => {
  993. this.pageShow = false;
  994. this.pageShow2 = true;
  995. }, 200);
  996. },
  997. /** 删除按钮操作 */
  998. handleDelete(row) {
  999. const ids = row.fId || this.ids;
  1000. delinStock_s(ids).then((data) => {
  1001. switch (data.msg) {
  1002. case "0": {
  1003. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  1004. break;
  1005. }
  1006. case "1": {
  1007. this.delete(ids, "当前主表有数据从表无数据是否删除");
  1008. break;
  1009. }
  1010. case "2": {
  1011. this.delete(ids, "当前主表有数据从表有数据是否删除");
  1012. break;
  1013. }
  1014. default: {
  1015. return this.$message.error("未知错误,无状态");
  1016. }
  1017. }
  1018. });
  1019. },
  1020. delete(ids, tips) {
  1021. this.$confirm(tips, "警告", {
  1022. confirmButtonText: "确定",
  1023. cancelButtonText: "取消",
  1024. type: "warning",
  1025. }).then(() => {
  1026. delWarehousebills(ids);
  1027. this.msgSuccess("删除成功");
  1028. this.getList();
  1029. });
  1030. },
  1031. /** 导出按钮操作 */
  1032. handleExport() {
  1033. // require.ensure([], () => {
  1034. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  1035. // const tHeader = ["客户名称", "制单日期"];
  1036. // // 上面设置Excel的表格第一行的标题
  1037. // const filterVal = ["corpId", "createTime"];
  1038. // // 上面的index、nickName、name是tableData里对象的属性
  1039. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  1040. // const data = this.formatJson(filterVal, list);
  1041. // export_json_to_excel(
  1042. // tHeader,
  1043. // data,
  1044. // "列表excel",
  1045. // true,
  1046. // );
  1047. // });
  1048. },
  1049. formatJson(filterVal, jsonData) {
  1050. return jsonData.map((v) => filterVal.map((j) => v[j]));
  1051. },
  1052. /** 搜索按钮操作 */
  1053. handleQuery() {
  1054. this.queryParams.pageNum = 1;
  1055. this.getList();
  1056. },
  1057. /** 重置按钮操作 */
  1058. resetQuery() {
  1059. this.queryParams = {
  1060. pageNum: 1,
  1061. pageSize: 10,
  1062. fBillno: null,
  1063. createBy: null,
  1064. fTrademodeid: null,
  1065. fCorpid: null,
  1066. fMblno: null,
  1067. fSbu: null,
  1068. fGoodsid: null,
  1069. fWarehouseid: null,
  1070. fMarks: null,
  1071. fBillstatus: null,
  1072. fItemsStatus: null,
  1073. timeInterval: null,
  1074. };
  1075. this.userOptions = [];
  1076. this.fMblnoOptions = [];
  1077. this.handleQuery();
  1078. },
  1079. showAddOrUpdate(data) {
  1080. if (data) {
  1081. this.getList();
  1082. this.pageShow = true;
  1083. this.pageShow2 = false;
  1084. }
  1085. },
  1086. },
  1087. };
  1088. </script>