index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  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: 120,
  643. },
  644. {
  645. surface: "10",
  646. label: "fQty",
  647. name: "入库件数",
  648. checked: 0,
  649. width: 120,
  650. },
  651. {
  652. surface: "11",
  653. label: "fGrossweight",
  654. name: "入库毛重",
  655. checked: 0,
  656. width: 120,
  657. },
  658. {
  659. surface: "12",
  660. label: "fNetweight",
  661. name: "入库净重",
  662. checked: 0,
  663. width: 120,
  664. },
  665. {
  666. surface: "13",
  667. label: "fCntval",
  668. name: "箱型箱量",
  669. checked: 0,
  670. width: 120,
  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: 180,
  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. surface: "23",
  737. label: "",
  738. name: "应收合计",
  739. checked: 0,
  740. width: 100,
  741. },
  742. {
  743. surface: "24",
  744. label: "",
  745. name: "应付合计",
  746. checked: 0,
  747. width: 100,
  748. },
  749. {
  750. surface: "25",
  751. label: "",
  752. name: "利润",
  753. checked: 0,
  754. width: 100,
  755. },
  756. {
  757. surface: "26",
  758. label: "",
  759. name: "实收合计",
  760. checked: 0,
  761. width: 100,
  762. },
  763. {
  764. surface: "27",
  765. label: "",
  766. name: "实付合计",
  767. checked: 0,
  768. width: 100,
  769. },
  770. ],
  771. setRowList: [],
  772. getRowList: [],
  773. allCheck: false,
  774. showSetting: false,
  775. total: 0,
  776. warehousebillsList: [],
  777. loading: true,
  778. single: true,
  779. multiple: true,
  780. formId: null,
  781. ids: [],
  782. copyStatus: null,
  783. fTrucknoList:[],
  784. };
  785. },
  786. // 使用子组件
  787. components: { draggable, AddOrUpdate },
  788. created() {
  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. this.setRowList = this.tableDate;
  803. this.getRowList = this.tableDate;
  804. this.getDicts("data_trademodes").then((response) => {
  805. this.fTrademodeidOptions = response.data;
  806. });
  807. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  808. this.goodsOptions = response.rows;
  809. });
  810. queryVehicle().then(res=>{
  811. this.fTrucknoList = res.data
  812. })
  813. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  814. this.warehouseOptions = response.rows;
  815. });
  816. listUser().then((response) => {
  817. this.userOptions = response.rows;
  818. });
  819. listCorps({ type: 1 }).then((response) => {
  820. this.fMblnoOptions = response.rows;
  821. });
  822. this.getRow();
  823. this.getList();
  824. },
  825. activated() {
  826. if (this.$route.query.id) {
  827. this.handleUpdate(this.$route.query.id);
  828. }
  829. },
  830. mounted() {
  831. this.$nextTick(() => {
  832. // 监听浏览器高度变化,改变表格高度
  833. window.onresize = () => {
  834. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  835. }
  836. })
  837. },
  838. methods: {
  839. // 获取当前月的第一天和最后一天
  840. // getMonth() {
  841. // let date = new Date();
  842. // let year = parseInt(date.getFullYear())
  843. // let month = parseInt(date.getMonth() + 1)
  844. // let currentMonth = date.getMonth()
  845. // let nextMonth = ++currentMonth
  846. // let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1) // 下个月的第一天
  847. // let oneDay = 1000*60*60*24
  848. // let lastTime = new Date(nextMonthFirstDay - oneDay) // 下个月的第一天减去一天,就是上个月的最后一天
  849. // let day = lastTime.getDate()
  850. // if (day < 10) {
  851. // day = '0' + day
  852. // }
  853. // this.queryParams.timeInterval = [year + '-' + month + '-' + '01 00:00:00', year + '-' + month + '-' + day + ' 23:59:59']
  854. // },
  855. //列设置全选
  856. allChecked() {
  857. if (this.allCheck == true) {
  858. this.setRowList.map((e) => {
  859. return (e.checked = 0);
  860. });
  861. } else {
  862. this.setRowList.map((e) => {
  863. return (e.checked = 1);
  864. });
  865. }
  866. },
  867. //查询列数据
  868. getRow() {
  869. let that = this;
  870. this.data = {
  871. tableName: "入库",
  872. userId: Cookies.get("userName"),
  873. };
  874. select(this.data).then((res) => {
  875. if (res.data.length != 0) {
  876. this.getRowList = res.data.filter((e) => e.checked == 0);
  877. this.setRowList = res.data;
  878. this.setRowList = this.setRowList.reduce((res, item) => {
  879. res.push({
  880. surface: item.surface,
  881. label: item.label,
  882. name: item.name,
  883. checked: item.checked,
  884. width: item.width,
  885. fixed: item.fixed,
  886. });
  887. return res;
  888. }, []);
  889. }
  890. });
  891. },
  892. //重置列表
  893. delRow() {
  894. this.data = {
  895. tableName: "入库",
  896. userId: Cookies.get("userName"),
  897. };
  898. resetModule(this.data).then((res) => {
  899. if (res.code == 200) {
  900. this.showSetting = false;
  901. this.setRowList = this.$options.data().tableDate;
  902. this.getRowList = this.$options.data().tableDate;
  903. }
  904. });
  905. },
  906. //保存列设置
  907. save() {
  908. this.showSetting = false;
  909. this.data = {
  910. tableName: "入库",
  911. userId: Cookies.get("userName"),
  912. sysTableSetList: this.setRowList,
  913. };
  914. addSet(this.data).then((res) => {
  915. if (res.code == 200) {
  916. this.showSetting = false;
  917. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  918. console.log(this.tableDate);
  919. }
  920. });
  921. },
  922. //开始拖拽事件
  923. onStart() {
  924. this.drag = true;
  925. },
  926. //拖拽结束事件
  927. onEnd() {
  928. this.drag = false;
  929. },
  930. getList() {
  931. //获取仓库
  932. listWarehousebills(this.queryParams).then((response) => {
  933. response.rows.map((e) => {
  934. e.freeContainerDate = e.freeContainerDate
  935. ? e.freeContainerDate.substring(0, 10)
  936. : null;
  937. });
  938. this.warehousebillsList = response.rows;
  939. console.log(this.warehousebillsList)
  940. this.total = response.total;
  941. this.loading = false;
  942. // 根据浏览器高度设置初始高度
  943. setInterval(() => {
  944. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  945. }, 300)
  946. });
  947. },
  948. //合计
  949. getSum(param) {
  950. const { columns, data } = param;
  951. const sums = [];
  952. var values = [];
  953. columns.forEach((column, index) => {
  954. if (index === 0) {
  955. sums[index] = "合计";
  956. return;
  957. }
  958. if (column.property === "fGrossweight") {
  959. values = data.map((item) => Number(item["fGrossweight"]));
  960. }
  961. if (column.property === "fNetweight") {
  962. values = data.map((item) => Number(item["fNetweight"]));
  963. }
  964. if (column.property === "fQty") {
  965. values = data.map((item) => Number(item["fQty"]));
  966. }
  967. if (column.property === "fPlanqty") {
  968. values = data.map((item) => Number(item.fPlanqty));
  969. }
  970. if (
  971. column.property === "fGrossweight" ||
  972. column.property === "fNetweight" ||
  973. column.property === "fQty" ||
  974. column.property === "fPlanqty"
  975. ) {
  976. sums[index] = values.reduce((prev, curr) => {
  977. const value = Number(curr);
  978. if (!isNaN(value)) {
  979. return prev + curr;
  980. } else {
  981. return prev;
  982. }
  983. }, 0);
  984. if (column.property === "fGrossweight") {
  985. sums[index] = (sums[index] / 1000).toFixed(4) + "(吨)";
  986. }
  987. if (column.property === "fNetweight") {
  988. sums[index] = (sums[index] / 1000).toFixed(4) + "(吨)";
  989. }
  990. if (column.property === "fQty") {
  991. // sums[index] = sums[index].toFixed(2);
  992. sums[index] = sums[index];
  993. }
  994. if (column.property === "fPlanqty") {
  995. if (sums[index]) {
  996. sums[index] = sums[index];
  997. }
  998. }
  999. }
  1000. });
  1001. return sums;
  1002. },
  1003. handleAdd() {
  1004. this.timer = new Date().getTime();
  1005. this.pageShow = false;
  1006. this.pageShow2 = true;
  1007. },
  1008. // 多选框选中数据
  1009. handleSelectionChange(selection) {
  1010. this.ids = selection.map((item) => item.fId);
  1011. this.single =
  1012. selection.length !== 1 ||
  1013. selection.map((item) => item.fBillstatus) == 6 ||
  1014. selection.map((item) => item.fBillstatus) == 4;
  1015. this.multiple = !selection.length;
  1016. },
  1017. /** 修改按钮操作 */
  1018. handleUpdate(row) {
  1019. const fId = row.fId || this.ids[0] || row;
  1020. this.copyStatus = null;
  1021. this.formId = fId;
  1022. console.log(this.formId)
  1023. this.$nextTick(() => {
  1024. this.$refs.addOrUpdateRef.init();
  1025. });
  1026. setTimeout(() => {
  1027. this.pageShow = false;
  1028. this.pageShow2 = true;
  1029. }, 200);
  1030. },
  1031. copyUpdate() {
  1032. this.formId = this.ids[0];
  1033. this.copyStatus = 2;
  1034. this.$nextTick(() => {
  1035. this.$refs.addOrUpdateRef.init();
  1036. });
  1037. setTimeout(() => {
  1038. this.pageShow = false;
  1039. this.pageShow2 = true;
  1040. }, 200);
  1041. },
  1042. /** 删除按钮操作 */
  1043. handleDelete(row) {
  1044. const ids = row.fId || this.ids;
  1045. delinStock_s(ids).then((data) => {
  1046. switch (data.msg) {
  1047. case "0": {
  1048. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  1049. break;
  1050. }
  1051. case "1": {
  1052. this.delete(ids, "当前主表有数据从表无数据是否删除");
  1053. break;
  1054. }
  1055. case "2": {
  1056. this.delete(ids, "当前主表有数据从表有数据是否删除");
  1057. break;
  1058. }
  1059. default: {
  1060. return this.$message.error("未知错误,无状态");
  1061. }
  1062. }
  1063. });
  1064. },
  1065. delete(ids, tips) {
  1066. this.$confirm(tips, "警告", {
  1067. confirmButtonText: "确定",
  1068. cancelButtonText: "取消",
  1069. type: "warning",
  1070. }).then(() => {
  1071. delWarehousebills(ids);
  1072. this.msgSuccess("删除成功");
  1073. this.getList();
  1074. });
  1075. },
  1076. /** 导出按钮操作 */
  1077. handleExport() {
  1078. // require.ensure([], () => {
  1079. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  1080. // const tHeader = ["客户名称", "制单日期"];
  1081. // // 上面设置Excel的表格第一行的标题
  1082. // const filterVal = ["corpId", "createTime"];
  1083. // // 上面的index、nickName、name是tableData里对象的属性
  1084. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  1085. // const data = this.formatJson(filterVal, list);
  1086. // export_json_to_excel(
  1087. // tHeader,
  1088. // data,
  1089. // "列表excel",
  1090. // true,
  1091. // );
  1092. // });
  1093. },
  1094. formatJson(filterVal, jsonData) {
  1095. return jsonData.map((v) => filterVal.map((j) => v[j]));
  1096. },
  1097. /** 搜索按钮操作 */
  1098. handleQuery() {
  1099. this.queryParams.pageNum = 1;
  1100. this.getList();
  1101. },
  1102. /** 重置按钮操作 */
  1103. resetQuery() {
  1104. this.queryParams = {
  1105. pageNum: 1,
  1106. pageSize: 10,
  1107. fBillno: null,
  1108. createBy: null,
  1109. fTrademodeid: null,
  1110. fCorpid: null,
  1111. fMblno: null,
  1112. fSbu: null,
  1113. fGoodsid: null,
  1114. fWarehouseid: null,
  1115. fMarks: null,
  1116. fBillstatus: null,
  1117. fItemsStatus: null,
  1118. timeInterval: null,
  1119. };
  1120. this.userOptions = [];
  1121. this.fMblnoOptions = [];
  1122. this.handleQuery();
  1123. },
  1124. showAddOrUpdate(data) {
  1125. if (data) {
  1126. this.getList();
  1127. this.pageShow = true;
  1128. this.pageShow2 = false;
  1129. }
  1130. },
  1131. },
  1132. };
  1133. </script>
  1134. <style scoped>
  1135. </style>