You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

937 lines
29 KiB

2 years ago
1 year ago
3 years ago
1 year ago
3 years ago
1 year ago
1 year ago
3 years ago
3 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
3 years ago
1 year ago
3 years ago
3 years ago
12 months ago
3 years ago
3 years ago
1 year ago
  1. <template>
  2. <div class="mod-config">
  3. <el-row>
  4. <el-col :span="24">
  5. <!-- <div>-->
  6. <!-- <span @click="favoriteFunction()">-->
  7. <!-- <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>-->
  8. <!-- </span>-->
  9. <!-- </div>-->
  10. <el-form :inline="true" label-position="top" >
  11. <el-form-item label="备品备件编码">
  12. <el-input v-model="queryForm.partNo" clearable></el-input>
  13. </el-form-item>
  14. <el-form-item label="备品备件名称">
  15. <el-input v-model="queryForm.partDescription" clearable></el-input>
  16. </el-form-item>
  17. <el-form-item label="规格型号">
  18. <el-input v-model="queryForm.spec" clearable></el-input>
  19. </el-form-item>
  20. <el-form-item label="序列号">
  21. <el-input v-model="queryForm.batchNo" clearable></el-input>
  22. </el-form-item>
  23. <el-form-item label="仓库">
  24. <el-select v-model="queryForm.warehouseId">
  25. <el-option value="" label="全部"></el-option>
  26. <el-option v-for="(item,index) in wareHouseList "
  27. :key="item.warehouseId" :value="item.warehouseId" :label="item.warehouseName"></el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="汇总方式">
  31. <el-select v-model="queryForm.groupType">
  32. <el-option value="0" label="料号+序号"></el-option>
  33. <el-option value="1" label="料号"></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label=" ">
  37. <el-button type="primary" @click="getDataList()">查询</el-button>
  38. <el-button type="primary" :disabled="this.dataListSelections.length==0" @click="printList()">打印</el-button>
  39. <download-excel
  40. :fields="fields()"
  41. :data="exportData"
  42. type="xls"
  43. :name="exportName"
  44. :header="exportHeader"
  45. :footer="exportFooter"
  46. :fetch="createExportData"
  47. :before-generate="startDownload"
  48. :before-finish="finishDownload"
  49. worksheet="导出信息"
  50. class="el-button el-button--primary el-button--medium">
  51. {{ "导出" }}
  52. </download-excel>
  53. </el-form-item>
  54. </el-form>
  55. <el-form :inline="true" label-position="top" >
  56. <el-form-item label="录入日期">
  57. <el-date-picker
  58. style="width: 145px"
  59. v-model="queryForm.startFirstInDate"
  60. type="date"
  61. format="yyyy-MM-dd"
  62. value-format="yyyy-MM-dd"
  63. placeholder="选择日期">
  64. </el-date-picker>
  65. -
  66. <el-date-picker
  67. style="width: 145px"
  68. v-model="queryForm.endFirstInDate"
  69. type="date"
  70. format="yyyy-MM-dd"
  71. value-format="yyyy-MM-dd 23:59:59"
  72. placeholder="选择日期">
  73. </el-date-picker>
  74. </el-form-item>
  75. <el-form-item label="在库数量范围">
  76. <el-input style="width: 145px" v-model="queryForm.startQtyOnHand" clearable></el-input>
  77. -
  78. <el-input style="width: 145px" v-model="queryForm.endQtyOnHand" clearable></el-input>
  79. </el-form-item>
  80. <el-form-item label="货位编码">
  81. <el-input v-model="queryForm.locationId" clearable></el-input>
  82. </el-form-item>
  83. <el-form-item label="安全库存汇总">
  84. <el-select v-model="queryForm.safetyStock" clearable style="width: 100px">
  85. <el-option label="安全" value="安全"></el-option>
  86. <el-option label="不安全" value="不安全"></el-option>
  87. </el-select>
  88. </el-form-item>
  89. <el-form-item label="BU">
  90. <el-select v-model="queryForm.buNo" placeholder="请选择" style="width: 120px">
  91. <el-option label="全部" value=""> </el-option>
  92. <el-option
  93. v-for = "i in buList"
  94. :key = "i.buNo"
  95. :label = "i.buDesc"
  96. :value = "i.buNo">
  97. </el-option>
  98. </el-select>
  99. </el-form-item>
  100. </el-form>
  101. </el-col>
  102. </el-row>
  103. <el-table
  104. :data="dataList"
  105. border
  106. :height="height"
  107. v-loading="dataListLoading"
  108. @selection-change="handleSelectionChange"
  109. :row-style="controlRowStyle"
  110. style="width: 100%;">
  111. <el-table-column
  112. v-if="queryForm.groupType==0"
  113. type="selection"
  114. header-align="center"
  115. align="center"
  116. width="50">
  117. </el-table-column>
  118. <el-table-column
  119. v-for="(item,index) in columnList" :key="index"
  120. :sortable="item.columnSortable"
  121. :prop="item.columnProp"
  122. :header-align="item.headerAlign"
  123. :show-overflow-tooltip="item.showOverflowTooltip"
  124. :align="item.align"
  125. :fixed="item.fixed==''?false:item.fixed"
  126. :min-width="item.columnWidth"
  127. :label="item.columnLabel">
  128. <template slot-scope="scope">
  129. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  130. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  131. style="width: 100px; height: 80px"/></span>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <el-pagination
  136. @size-change="sizeChangeHandle"
  137. @current-change="currentChangeHandle"
  138. :current-page="pageIndex"
  139. :page-sizes="[20, 100, 500, 1000]"
  140. :page-size="pageSize"
  141. :total="totalPage"
  142. layout="total, sizes, prev, pager, next, jumper">
  143. </el-pagination>
  144. </div>
  145. </template>
  146. <script>
  147. import {
  148. getInventoryStockList,partSpareTemp
  149. } from '@/api/partspare/inventorystock.js'
  150. import {
  151. getWareHouseList,
  152. } from '@/api/partspare/wareHouseEntity.js'
  153. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  154. import {getAllBuList}from '@/api/factory/site.js'
  155. import {getTableDefaultListLanguage, getTableUserListLanguage} from "../../../api/table";
  156. export default {
  157. data() {
  158. return {
  159. buList: [],
  160. // 是否收藏
  161. favorite: false,
  162. // 导出 start
  163. exportData: [],
  164. exportName: "库存信息" + this.dayjs().format('YYYYMMDDHHmmss'),
  165. exportHeader: ["库存信息"],
  166. exportFooter: [],
  167. exportList:[],
  168. // 导出 end
  169. queryForm: {
  170. site: this.$store.state.user.site,
  171. limit: 1,
  172. page: '',
  173. partNo: '',
  174. partDescription: '',
  175. spec: '',
  176. batchNo: '',
  177. warehouseId: '',
  178. locationId: '',
  179. startFirstInDate: '',
  180. endFirstInDate: '',
  181. startQtyOnHand: '',
  182. endQtyOnHand: '',
  183. groupType: '0',
  184. active: 'Y',
  185. safetyStock: '',
  186. buNo: '',
  187. },
  188. dataList: [],
  189. wareHouseList: [],
  190. pageIndex: 1,
  191. pageSize: 20,
  192. totalPage: 0,
  193. height: 200,
  194. dataListLoading: false,
  195. dataListSelections: [],
  196. addOrUpdateVisible: false,
  197. // 展示列集
  198. columnList: [],
  199. // 料号汇总
  200. arrayPart: [
  201. {
  202. userId: this.$store.state.user.name,
  203. functionId: 200101103,
  204. serialNumber: '200101103Table1BuDesc',
  205. tableId: '200101103Table1',
  206. tableName: '库存信息汇总表',
  207. columnProp: 'buDesc',
  208. headerAlign: "center",
  209. align: "left",
  210. columnLabel: 'BU',
  211. columnHidden: false,
  212. columnImage: false,
  213. columnSortable: true,
  214. sortLv: 0,
  215. status: true,
  216. fixed: '',
  217. columnWidth: 80,
  218. },
  219. {
  220. userId: this.$store.state.user.name,
  221. functionId: 200101103,
  222. serialNumber: '200101103Table1PartNo',
  223. tableId: '200101103Table1',
  224. tableName: '库存信息汇总表',
  225. columnProp: 'partNo',
  226. headerAlign: "center",
  227. align: "left",
  228. columnLabel: '备品备件编码',
  229. columnHidden: false,
  230. columnImage: false,
  231. columnSortable: true,
  232. sortLv: 0,
  233. status: true,
  234. fixed: '',
  235. columnWidth: 140,
  236. },
  237. {
  238. userId: this.$store.state.user.name,
  239. functionId: 200101103,
  240. serialNumber: '200101103Table1PartDescription',
  241. tableId: '200101103Table1',
  242. tableName: '库存信息汇总表',
  243. columnProp: 'partDescription',
  244. headerAlign: "center",
  245. align: "left",
  246. columnLabel: '备品备件名称',
  247. columnHidden: false,
  248. columnImage: false,
  249. columnSortable: false,
  250. sortLv: 0,
  251. status: true,
  252. fixed: '',
  253. columnWidth: 140,
  254. },
  255. {
  256. userId: this.$store.state.user.name,
  257. functionId: 200101103,
  258. serialNumber: '200101103Table1WarehouseId',
  259. tableId: '200101103Table1',
  260. tableName: '库存信息汇总表',
  261. columnProp: 'warehouseId',
  262. headerAlign: "center",
  263. align: "left",
  264. columnLabel: '仓库编码',
  265. columnHidden: false,
  266. columnImage: false,
  267. columnSortable: false,
  268. sortLv: 0,
  269. status: true,
  270. fixed: '',
  271. columnWidth: 140,
  272. }, {
  273. userId: this.$store.state.user.name,
  274. functionId: 200101103,
  275. serialNumber: '200101103Table1LocationId',
  276. tableId: '200101103Table1',
  277. tableName: '库存信息汇总表',
  278. columnProp: 'locationId',
  279. headerAlign: "center",
  280. align: "left",
  281. columnLabel: '货位编码',
  282. columnHidden: false,
  283. columnImage: false,
  284. columnSortable: false,
  285. sortLv: 0,
  286. status: true,
  287. fixed: '',
  288. columnWidth: 140,
  289. }, {
  290. userId: this.$store.state.user.name,
  291. functionId: 200101103,
  292. serialNumber: '200101103Table1InQty',
  293. tableId: '200101103Table1',
  294. tableName: '库存信息汇总表',
  295. columnProp: 'inQty',
  296. headerAlign: "center",
  297. align: "right",
  298. columnLabel: '入库数量',
  299. columnHidden: false,
  300. columnImage: false,
  301. columnSortable: false,
  302. sortLv: 0,
  303. status: true,
  304. fixed: '',
  305. columnWidth: 140,
  306. }, {
  307. userId: this.$store.state.user.name,
  308. functionId: 200101103,
  309. serialNumber: '200101103Table1OutQty',
  310. tableId: '200101103Table1',
  311. tableName: '库存信息汇总表',
  312. columnProp: 'outQty',
  313. headerAlign: "center",
  314. align: "right",
  315. columnLabel: '出库数量',
  316. columnHidden: false,
  317. columnImage: false,
  318. columnSortable: false,
  319. sortLv: 0,
  320. status: true,
  321. fixed: '',
  322. columnWidth: 140,
  323. }, {
  324. userId: this.$store.state.user.name,
  325. functionId: 200101103,
  326. serialNumber: '200101103Table1QtyOnHand',
  327. tableId: '200101103Table1',
  328. tableName: '库存信息汇总表',
  329. columnProp: 'qtyOnHand',
  330. headerAlign: "center",
  331. align: "right",
  332. columnLabel: '在库数量',
  333. columnHidden: false,
  334. columnImage: false,
  335. columnSortable: false,
  336. sortLv: 0,
  337. status: true,
  338. fixed: '',
  339. columnWidth: 140,
  340. }, {
  341. userId: this.$store.state.user.name,
  342. functionId: 200101103,
  343. serialNumber: '200101103Table1MaxStock',
  344. tableId: '200101103Table1',
  345. tableName: '库存信息汇总表',
  346. columnProp: 'maxStock',
  347. headerAlign: "center",
  348. align: "right",
  349. columnLabel: '最高库存数量',
  350. columnHidden: false,
  351. columnImage: false,
  352. columnSortable: false,
  353. sortLv: 0,
  354. status: true,
  355. fixed: '',
  356. columnWidth: 140,
  357. }, {
  358. userId: this.$store.state.user.name,
  359. functionId: 200101103,
  360. serialNumber: '200101103Table1MinStock',
  361. tableId: '200101103Table1',
  362. tableName: '库存信息汇总表',
  363. columnProp: 'minStock',
  364. headerAlign: "center",
  365. align: "right",
  366. columnLabel: '最低库存数量',
  367. columnHidden: false,
  368. columnImage: false,
  369. columnSortable: false,
  370. sortLv: 0,
  371. status: true,
  372. fixed: '',
  373. columnWidth: 140,
  374. },{
  375. userId: this.$store.state.user.name,
  376. functionId: 200101103,
  377. serialNumber: '200101103Table1Spec',
  378. tableId: '200101103Table1',
  379. tableName: '库存信息汇总表',
  380. columnProp: 'spec',
  381. headerAlign: "center",
  382. align: "right",
  383. columnLabel: '规格型号',
  384. columnHidden: false,
  385. columnImage: false,
  386. columnSortable: false,
  387. sortLv: 0,
  388. status: true,
  389. fixed: '',
  390. columnWidth: 140,
  391. }],
  392. // 料号_序号
  393. arrayColumns: [
  394. {
  395. userId: this.$store.state.user.name,
  396. functionId: 200101103,
  397. serialNumber: '200101103Table2BuDesc',
  398. tableId: '200101103Table2',
  399. tableName: '库存信息序号表',
  400. columnProp: 'buDesc',
  401. headerAlign: "center",
  402. align: "left",
  403. columnLabel: 'BU',
  404. columnHidden: false,
  405. columnImage: false,
  406. columnSortable: true,
  407. sortLv: 0,
  408. status: true,
  409. fixed: '',
  410. columnWidth: 80,
  411. },
  412. {
  413. userId: this.$store.state.user.name,
  414. functionId: 200101103,
  415. serialNumber: '200101103Table2PartNo',
  416. tableId: '200101103Table2',
  417. tableName: '库存信息序号表',
  418. columnProp: 'partNo',
  419. headerAlign: "center",
  420. align: "left",
  421. columnLabel: '备品备件编码',
  422. columnHidden: false,
  423. columnImage: false,
  424. columnSortable: true,
  425. sortLv: 0,
  426. status: true,
  427. fixed: '',
  428. columnWidth: 140,
  429. },
  430. {
  431. userId: this.$store.state.user.name,
  432. functionId: 200101103,
  433. serialNumber: '200101103Table2PartDescription',
  434. tableId: '200101103Table2',
  435. tableName: '库存信息序号表',
  436. columnProp: 'partDescription',
  437. headerAlign: "center",
  438. align: "left",
  439. columnLabel: '备品备件名称',
  440. columnHidden: false,
  441. columnImage: false,
  442. columnSortable: false,
  443. sortLv: 0,
  444. status: true,
  445. fixed: '',
  446. columnWidth: 140,
  447. },
  448. {
  449. userId: this.$store.state.user.name,
  450. functionId: 200101103,
  451. serialNumber: '200101103Table2BatchNo',
  452. tableId: '200101103Table2',
  453. tableName: '库存信息序号表',
  454. columnProp: 'batchNo',
  455. headerAlign: "center",
  456. align: "left",
  457. columnLabel: '序列号',
  458. columnHidden: false,
  459. columnImage: false,
  460. columnSortable: false,
  461. sortLv: 0,
  462. status: true,
  463. fixed: '',
  464. columnWidth: 140,
  465. }, {
  466. userId: this.$store.state.user.name,
  467. functionId: 200101103,
  468. serialNumber: '200101103Table2WarehouseId',
  469. tableId: '200101103Table2',
  470. tableName: '库存信息序号表',
  471. columnProp: 'warehouseId',
  472. headerAlign: "center",
  473. align: "left",
  474. columnLabel: '仓库编码',
  475. columnHidden: false,
  476. columnImage: false,
  477. columnSortable: false,
  478. sortLv: 0,
  479. status: true,
  480. fixed: '',
  481. columnWidth: 140,
  482. }, {
  483. userId: this.$store.state.user.name,
  484. functionId: 200101103,
  485. serialNumber: '200101103Table2LocationId',
  486. tableId: '200101103Table2',
  487. tableName: '库存信息序号表',
  488. columnProp: 'locationId',
  489. headerAlign: "center",
  490. align: "left",
  491. columnLabel: '货位编码',
  492. columnHidden: false,
  493. columnImage: false,
  494. columnSortable: false,
  495. sortLv: 0,
  496. status: true,
  497. fixed: '',
  498. columnWidth: 140,
  499. },
  500. {
  501. userId: this.$store.state.user.name,
  502. functionId: 200101103,
  503. serialNumber: '200101103Table2Umid',
  504. tableId: '200101103Table2',
  505. tableName: '库存信息序号表',
  506. columnProp: 'umid',
  507. headerAlign: "center",
  508. align: "left",
  509. columnLabel: '单位',
  510. columnHidden: false,
  511. columnImage: false,
  512. columnSortable: false,
  513. sortLv: 0,
  514. status: true,
  515. fixed: '',
  516. columnWidth: 100,
  517. },
  518. {
  519. userId: this.$store.state.user.name,
  520. functionId: 200101103,
  521. serialNumber: '200101103Table2AveragePrice',
  522. tableId: '200101103Table2',
  523. tableName: '库存信息序号表',
  524. columnProp: 'averagePrice',
  525. headerAlign: "center",
  526. align: "right",
  527. columnLabel: '单价',
  528. columnHidden: false,
  529. columnImage: false,
  530. columnSortable: false,
  531. sortLv: 0,
  532. status: true,
  533. fixed: '',
  534. columnWidth: 140,
  535. },
  536. {
  537. userId: this.$store.state.user.name,
  538. functionId: 200101103,
  539. serialNumber: '200101103Table2InQty',
  540. tableId: '200101103Table2',
  541. tableName: '库存信息序号表',
  542. columnProp: 'inQty',
  543. headerAlign: "center",
  544. align: "right",
  545. columnLabel: '入库数量',
  546. columnHidden: false,
  547. columnImage: false,
  548. columnSortable: false,
  549. sortLv: 0,
  550. status: true,
  551. fixed: '',
  552. columnWidth: 140,
  553. }, {
  554. userId: this.$store.state.user.name,
  555. functionId: 200101103,
  556. serialNumber: '200101103Table2OutQty',
  557. tableId: '200101103Table2',
  558. tableName: '库存信息序号表',
  559. columnProp: 'outQty',
  560. headerAlign: "center",
  561. align: "right",
  562. columnLabel: '出库数量',
  563. columnHidden: false,
  564. columnImage: false,
  565. columnSortable: false,
  566. sortLv: 0,
  567. status: true,
  568. fixed: '',
  569. columnWidth: 140,
  570. }, {
  571. userId: this.$store.state.user.name,
  572. functionId: 200101103,
  573. serialNumber: '200101103Table2QtyOnHand',
  574. tableId: '200101103Table2',
  575. tableName: '库存信息序号表',
  576. columnProp: 'qtyOnHand',
  577. headerAlign: "center",
  578. align: "right",
  579. columnLabel: '在库数量',
  580. columnHidden: false,
  581. columnImage: false,
  582. columnSortable: false,
  583. sortLv: 0,
  584. status: true,
  585. fixed: '',
  586. columnWidth: 140,
  587. }, {
  588. userId: this.$store.state.user.name,
  589. functionId: 200101103,
  590. serialNumber: '200101103Table2MaxStock',
  591. tableId: '200101103Table2',
  592. tableName: '库存信息序号表',
  593. columnProp: 'maxStock',
  594. headerAlign: "center",
  595. align: "right",
  596. columnLabel: '最高库存数量',
  597. columnHidden: false,
  598. columnImage: false,
  599. columnSortable: false,
  600. sortLv: 0,
  601. status: true,
  602. fixed: '',
  603. columnWidth: 140,
  604. }, {
  605. userId: this.$store.state.user.name,
  606. functionId: 200101103,
  607. serialNumber: '200101103Table2MinStock',
  608. tableId: '200101103Table2',
  609. tableName: '库存信息序号表',
  610. columnProp: 'minStock',
  611. headerAlign: "center",
  612. align: "right",
  613. columnLabel: '最低库存数量',
  614. columnHidden: false,
  615. columnImage: false,
  616. columnSortable: false,
  617. sortLv: 0,
  618. status: true,
  619. fixed: '',
  620. columnWidth: 140,
  621. },
  622. {
  623. userId: this.$store.state.user.name,
  624. functionId: 200101103,
  625. serialNumber: '200101103Table2TotalCost',
  626. tableId: '200101103Table2',
  627. tableName: '库存信息序号表',
  628. columnProp: 'totalCost',
  629. headerAlign: "center",
  630. align: "right",
  631. columnLabel: '总成本',
  632. columnHidden: false,
  633. columnImage: false,
  634. columnSortable: false,
  635. sortLv: 0,
  636. status: true,
  637. fixed: '',
  638. columnWidth: 140,
  639. },
  640. {
  641. userId: this.$store.state.user.name,
  642. functionId: 200101103,
  643. serialNumber: '200101103Table2Spec',
  644. tableId: '200101103Table2',
  645. tableName: '库存信息序号表',
  646. columnProp: 'spec',
  647. headerAlign: "center",
  648. align: "left",
  649. columnLabel: '规格型号',
  650. columnHidden: false,
  651. columnImage: false,
  652. columnSortable: false,
  653. sortLv: 0,
  654. status: true,
  655. fixed: '',
  656. columnWidth: 140,
  657. }, {
  658. userId: this.$store.state.user.name,
  659. functionId: 200101103,
  660. serialNumber: '200101103Table2PartnerId',
  661. tableId: '200101103Table2',
  662. tableName: '库存信息序号表',
  663. columnProp: 'partnerId',
  664. headerAlign: "center",
  665. align: "left",
  666. columnLabel: '操作员',
  667. columnHidden: false,
  668. columnImage: false,
  669. columnSortable: false,
  670. sortLv: 0,
  671. status: true,
  672. fixed: '',
  673. columnWidth: 140,
  674. }, {
  675. userId: this.$store.state.user.name,
  676. functionId: 200101103,
  677. serialNumber: '200101103Table2FirstInDate',
  678. tableId: '200101103Table2',
  679. tableName: '库存信息序号表',
  680. columnProp: 'firstInDate',
  681. headerAlign: "center",
  682. align: "left",
  683. columnLabel: '录入日期',
  684. columnHidden: false,
  685. columnImage: false,
  686. columnSortable: false,
  687. sortLv: 0,
  688. status: true,
  689. fixed: '',
  690. columnWidth: 140,
  691. }]
  692. }
  693. },
  694. watch: {
  695. 'queryForm.groupType': {
  696. handler(newVal, oldVal) {
  697. if (this.queryForm.groupType==0){
  698. this.columnList = this.arrayColumns
  699. }else {
  700. this.columnList = this.arrayPart
  701. }
  702. },
  703. deep: true,
  704. immediate: true
  705. }
  706. },
  707. activated() {
  708. // this.getDataList()
  709. // this.getWareHouseList()
  710. },
  711. created() {
  712. // 动态列
  713. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  714. this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
  715. this.getDataList()
  716. this.getWareHouseList()
  717. },
  718. mounted() {
  719. this.favoriteIsOk()
  720. this. getBu ()
  721. this.$nextTick(() => {
  722. this.height = window.innerHeight - 210
  723. this.columnList = this.arrayColumns
  724. })
  725. },
  726. methods: {
  727. // 校验用户是否收藏
  728. favoriteIsOk() {
  729. let userFavorite = {
  730. userId: this.$store.state.user.id,
  731. languageCode: this.$i18n.locale
  732. }
  733. userFavoriteList(userFavorite).then(({data}) => {
  734. for (let i = 0; i < data.list.length; i++) {
  735. if(this.$route.meta.menuId === data.list[i].menuId){
  736. this.favorite = true
  737. }
  738. }
  739. })
  740. },
  741. // 收藏 OR 取消收藏
  742. favoriteFunction() {
  743. let userFavorite = {
  744. userId: this.$store.state.user.id,
  745. functionId: this.$route.meta.menuId,
  746. }
  747. if (this.favorite) {
  748. // 取消收藏
  749. this.$confirm(`确定取消收藏`, '提示', {
  750. confirmButtonText: '确定',
  751. cancelButtonText: '取消',
  752. type: 'warning'
  753. }).then(() => {
  754. removeUserFavorite(userFavorite).then(({data}) => {
  755. this.$message.success(data.msg)
  756. this.favorite = false
  757. })
  758. })
  759. } else {
  760. // 收藏
  761. saveUserFavorite(userFavorite).then(({data}) => {
  762. this.$message.success(data.msg)
  763. this.favorite = true
  764. })
  765. }
  766. },
  767. // 获取仓库列表
  768. getWareHouseList(){
  769. let wareHouse = {
  770. site: this.$store.state.user.site,
  771. active: 'Y',
  772. warehousetype: "备品备件仓",
  773. }
  774. getWareHouseList(wareHouse).then(({data}) =>{
  775. if (data.code == 0 && data.data){
  776. this.wareHouseList = data.data
  777. }
  778. })
  779. },
  780. handleSelectionChange(val) {
  781. this.dataListSelections = val;
  782. },
  783. // 批量打印
  784. printList(){
  785. partSpareTemp(this.dataListSelections)
  786. },
  787. // 控制单行的背景颜色
  788. controlRowStyle({row, rowIndex}) {
  789. // 当前行在库数量
  790. let qtyOnHand = row.qtyOnHand
  791. // 当前行最低库存数量
  792. let minStock = row.minStock
  793. // 区分不同的样式对应不同的颜色
  794. if (qtyOnHand <= minStock) {
  795. return { 'background-color': '#D8ECF1', cursor: 'pointer' }
  796. }
  797. },
  798. // 获取数据列表
  799. getDataList() {
  800. this.dataListLoading = true
  801. this.queryForm.page = this.pageIndex
  802. this.queryForm.limit = this.pageSize
  803. getInventoryStockList(this.queryForm).then(({data}) => {
  804. if (data && data.code === 0) {
  805. this.dataList = data.page.list
  806. this.totalPage = data.page.totalCount
  807. } else {
  808. this.dataList = []
  809. this.totalPage = 0
  810. }
  811. this.dataListLoading = false
  812. })
  813. },
  814. // 每页数
  815. sizeChangeHandle(val) {
  816. this.pageSize = val
  817. this.pageIndex = 1
  818. this.getDataList()
  819. },
  820. // 当前页
  821. currentChangeHandle(val) {
  822. this.pageIndex = val
  823. this.getDataList()
  824. },
  825. //导出excel
  826. async createExportData() {
  827. this.queryForm.limit = -1
  828. this.queryForm.page = 1
  829. await getInventoryStockList(this.queryForm).then(({data}) => {
  830. this.exportList= data.page.list;
  831. })
  832. return this.exportList;
  833. },
  834. startDownload() {
  835. // this.exportData = this.dataList
  836. },
  837. finishDownload() {
  838. },
  839. fields() {
  840. let json = "{"
  841. this.columnList.forEach((item, index) => {
  842. if (index == this.columnList.length - 1) {
  843. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  844. } else {
  845. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  846. }
  847. })
  848. json += "}"
  849. let s = eval("(" + json + ")")
  850. return s
  851. },
  852. // 导出 end
  853. getBu () {
  854. let tempData = {
  855. username: this.$store.state.user.name,
  856. }
  857. getAllBuList(tempData).then(({data}) => {
  858. if (data.code === 0) {
  859. this.buList = data.rows
  860. }
  861. })
  862. },
  863. // 动态列开始 获取 用户保存的 格式列
  864. async getTableUserColumn(tableId, columnId) {
  865. let queryTableUser = {
  866. userId: this.$store.state.user.name,
  867. functionId: this.$route.meta.menuId,
  868. tableId: tableId,
  869. status: true,
  870. languageCode: this.$i18n.locale
  871. }
  872. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  873. if (data.rows.length > 0) {
  874. //this.columnList1 = []
  875. switch (columnId) {
  876. case 1:
  877. this.arrayColumns = data.rows
  878. break;
  879. case 2:
  880. this.arrayPart = data.rows
  881. break;
  882. // case 3:
  883. // this.columnList2 = data.rows
  884. // break;
  885. // case 4:
  886. // this.columnList3 = data.rows
  887. // break;
  888. }
  889. } else {
  890. this.getColumnList(tableId, columnId)
  891. }
  892. })
  893. },
  894. // 获取 tableDefault 列
  895. async getColumnList (tableId, columnId) {
  896. let queryTable= {
  897. functionId: this.$route.meta.menuId,
  898. tableId: tableId,
  899. languageCode: this.$i18n.locale
  900. }
  901. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  902. if (!data.rows.length == 0) {
  903. switch (columnId) {
  904. case 1:
  905. this.arrayColumns = data.rows
  906. break;
  907. case 2:
  908. this.arrayPart = data.rows
  909. break;
  910. // case 3:
  911. // this.columnList2 = data.rows
  912. // break;
  913. // case 4:
  914. // this.columnList3 = data.rows
  915. // break;
  916. }
  917. } else {
  918. // this.showDefault = true.
  919. }
  920. })
  921. },
  922. }
  923. }
  924. </script>