index.vue 35 KB

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