index.vue 34 KB

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