index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788
  1. <template>
  2. <div id="stockManagement_index">
  3. <el-card shadow="never">
  4. <el-form :model="formData" ref="formName" label-width="80px">
  5. <el-row :gutter="10">
  6. <el-col :span="6">
  7. <el-form-item label="入库时间" prop="time">
  8. <el-date-picker
  9. class="w100"
  10. size="small"
  11. v-model="formData.time"
  12. type="daterange"
  13. range-separator="至"
  14. start-placeholder="开始日期"
  15. end-placeholder="结束日期"
  16. value-format="yyyy-MM-dd"
  17. ></el-date-picker>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="6">
  21. <el-form-item label="入库单号" prop="sourceBizNo">
  22. <el-input
  23. size="small"
  24. class="w100"
  25. placeholder="请输入"
  26. v-model="formData.sourceBizNo"
  27. ></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6">
  31. <el-form-item label="入库类型" prop="bizType">
  32. <el-select
  33. style="width: 100%"
  34. filterable
  35. placeholder="请选择"
  36. v-model="formData.bizType"
  37. clearable
  38. >
  39. <el-option
  40. v-for="item in sceneState"
  41. :key="item.code"
  42. :value="item.code + ''"
  43. :label="item.label"
  44. ></el-option>
  45. </el-select>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="6">
  49. <el-form-item label="物品编码" prop="categoryCode">
  50. <el-input
  51. size="small"
  52. class="w100"
  53. placeholder="请输入"
  54. v-model="formData.categoryCode"
  55. ></el-input>
  56. </el-form-item>
  57. </el-col>
  58. <el-col :span="6">
  59. <el-form-item label="物品名称" prop="categoryName">
  60. <el-input
  61. size="small"
  62. class="w100"
  63. placeholder="请输入"
  64. v-model="formData.categoryName"
  65. ></el-input>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="6">
  69. <el-form-item label="状态" prop="status">
  70. <el-select
  71. filterable
  72. size="small"
  73. class="w100"
  74. v-model="formData.status"
  75. placeholder="请选择"
  76. clearable
  77. >
  78. <el-option
  79. v-for="item in auditStatus"
  80. :key="item.code"
  81. :value="item.code"
  82. :label="item.label"
  83. ></el-option>
  84. </el-select>
  85. </el-form-item>
  86. </el-col>
  87. <!-- <el-col :span="6">
  88. <el-form-item label="组织机构:" prop="deptIds">
  89. <auth-selection
  90. v-model="formData.deptIds"
  91. style="width: 100%"
  92. ></auth-selection>
  93. </el-form-item>
  94. </el-col> -->
  95. <el-col :span="6">
  96. <el-form-item label="所属工厂" prop="factoryId">
  97. <el-select
  98. filterable
  99. placeholder="请选择"
  100. v-model="formData.factoryId"
  101. clearable
  102. class="w100"
  103. @change="getTreeData"
  104. >
  105. <el-option
  106. v-for="item in factoryList"
  107. :key="item.id"
  108. :label="item.name"
  109. :value="item.id"
  110. ></el-option>
  111. </el-select>
  112. </el-form-item>
  113. </el-col>
  114. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  115. <el-form-item label="仓库名称" prop="warehouseId">
  116. <el-select
  117. filterable
  118. placeholder="请选择"
  119. v-model="formData.warehouseId"
  120. clearable
  121. class="w100"
  122. >
  123. <el-option
  124. v-for="item in warehouseList"
  125. :key="item.id"
  126. :label="item.name"
  127. :value="item.id"
  128. ></el-option>
  129. </el-select>
  130. </el-form-item>
  131. </el-col>
  132. <el-col
  133. style="
  134. display: flex;
  135. justify-content: flex-end;
  136. margin-bottom: 10px;
  137. "
  138. >
  139. <div>
  140. <el-button icon="el-icon-refresh-left" size="small" @click="reset"
  141. >重置</el-button
  142. >
  143. <el-button
  144. type="primary"
  145. icon="el-icon-search"
  146. size="small"
  147. @click="search"
  148. >搜索</el-button
  149. >
  150. </div>
  151. </el-col>
  152. </el-row>
  153. </el-form>
  154. <ele-pro-table
  155. ref="table"
  156. :columns="columns"
  157. height="calc(100vh-300px)"
  158. :pageSize="20"
  159. :datasource="datasource"
  160. @cell-click="cellClick"
  161. v-loading="loading"
  162. >
  163. <template v-slot:selection="{ row }">
  164. <el-radio class="radio" v-model="currentRow.id" :label="row.id"
  165. ><i></i
  166. ></el-radio>
  167. </template>
  168. <!-- 表头工具栏 -->
  169. <template v-slot:toolbar>
  170. <el-button icon="el-icon-plus" type="primary" @click="add"
  171. >新建</el-button
  172. >
  173. <el-button
  174. icon="el-icon-edit-outline"
  175. type="primary"
  176. @click="priceMaintenance"
  177. v-if="isPrice == 1"
  178. >单价维护</el-button
  179. >
  180. <!-- <el-button icon="el-icon-top" type="primary" @click="shelves"
  181. >上下架</el-button
  182. > -->
  183. <el-button icon="el-icon-receiving" type="primary" @click="outbound"
  184. >出库</el-button
  185. >
  186. <el-button icon="el-icon-printer" type="primary" @click="print"
  187. >打印</el-button
  188. >
  189. <!-- <el-button
  190. icon="el-icon-plus"
  191. v-if="clientEnvironmentId == 4"
  192. type="primary"
  193. @click="exportExcel"
  194. >导入</el-button
  195. > -->
  196. </template>
  197. <!-- 状态 -->
  198. <template v-slot:verifyStatus="{ row }">
  199. <span :class="status[row.verifyStatus]?.class">
  200. {{ status[row.verifyStatus]?.label }}
  201. </span>
  202. </template>
  203. <!-- 单号链接 -->
  204. <template v-slot:bizNo="{ row }">
  205. <el-link type="primary" @click="details(row)">
  206. {{ row.bizNo }}
  207. </el-link>
  208. </template>
  209. <!-- 操作列 -->
  210. <template v-slot:action="{ row }">
  211. <el-link
  212. type="success"
  213. :underline="false"
  214. icon="el-icon-position"
  215. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  216. @click="submit(row)"
  217. >
  218. 提交
  219. </el-link>
  220. <el-link
  221. type="primary"
  222. :underline="false"
  223. icon="el-icon-view"
  224. @click="edit(row)"
  225. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  226. >
  227. 修改
  228. </el-link>
  229. <!-- <el-link v-if="row.verifyStatus == 2 && clientEnvironmentId == 3" type="primary" :underline="false"
  230. icon="el-icon-view" @click="quality(row)">
  231. 质检
  232. </el-link> -->
  233. <el-link
  234. v-if="row.verifyStatus == 2"
  235. type="primary"
  236. :underline="false"
  237. icon="el-icon-sort-up"
  238. @click="details(row)"
  239. >
  240. 上架
  241. </el-link>
  242. <el-link
  243. v-if="row.verifyStatus == 2"
  244. type="primary"
  245. :underline="false"
  246. icon="el-icon-sort-down"
  247. @click="details(row)"
  248. >
  249. 下架
  250. </el-link>
  251. <el-link
  252. type="primary"
  253. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  254. :underline="false"
  255. icon="el-icon-delete"
  256. @click="deleted(row)"
  257. >
  258. 删除
  259. </el-link>
  260. </template>
  261. <template v-slot:bizType="{ row }">
  262. {{ handleBizType(row.bizType) }}
  263. </template>
  264. <template v-slot:assetType="{ row }">
  265. {{ handleAssetType(row.extInfo.assetType) }}
  266. </template>
  267. </ele-pro-table>
  268. </el-card>
  269. <printQRCode ref="printQRCodeRef"></printQRCode>
  270. <!-- <priceMaintenanceDialog ref="priceMaintenanceDialogRef" /> -->
  271. </div>
  272. </template>
  273. <script>
  274. import storageApi from '@/api/warehouseManagement';
  275. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  276. /* import priceMaintenanceDialog from './components/priceMaintenanceDialog.vue'; */
  277. import { allCategoryLevel } from '@/api/classifyManage';
  278. import { parameterGetByCode } from '@/api/sys/index.js';
  279. ('@/view/warehouseManagement/stockManagement/components/priceMaintenanceDialog.vue');
  280. import printQRCode from './components/printQRCode.vue';
  281. import {
  282. warehousingType,
  283. sceneState,
  284. auditStatus,
  285. useDict
  286. } from '@/utils/dict/index';
  287. export default {
  288. components: { printQRCode },
  289. data() {
  290. return {
  291. auditStatus,
  292. warehousingType,
  293. sceneState,
  294. codeList: [],
  295. factoryList: [],
  296. warehouseList: [],
  297. tableData: [],
  298. formData: {
  299. deptIds: '',
  300. categoryCode: '',
  301. categoryName: '',
  302. sourceBizNo: '',
  303. startTime: '',
  304. endTime: '',
  305. status: '',
  306. factoryId: '',
  307. time: [],
  308. warehouseId: ''
  309. // type: 1
  310. },
  311. loading: false,
  312. isPrice: 1,
  313. total: 0,
  314. status: [
  315. { label: '未审核', class: 'ele-text-info' },
  316. { label: '审核中', class: 'ele-text-primary' },
  317. { label: '审核通过', class: 'ele-text-success' },
  318. { label: '驳回', class: 'ele-text-danger' }
  319. ],
  320. currentRow: {},
  321. columns: [
  322. {
  323. slot: 'selection',
  324. label: '选择',
  325. width: 50,
  326. align: 'center'
  327. },
  328. {
  329. type: 'index',
  330. label: '序号',
  331. width: 50,
  332. align: 'center'
  333. },
  334. {
  335. prop: 'bizNo',
  336. label: '单号',
  337. align: 'center',
  338. slot: 'bizNo',
  339. showOverflowTooltip: true,
  340. width: 150
  341. },
  342. {
  343. prop: 'warehouseName',
  344. label: '仓库名称',
  345. align: 'center',
  346. showOverflowTooltip: true,
  347. minWidth: 100,
  348. },
  349. {
  350. prop: 'bizType',
  351. slot: 'bizType',
  352. label: '入库类型',
  353. align: 'center',
  354. showOverflowTooltip: true,
  355. width: 100
  356. },
  357. {
  358. prop: 'assetType',
  359. slot: 'assetType',
  360. label: '物品类型',
  361. align: 'center',
  362. showOverflowTooltip: true,
  363. width: 120
  364. },
  365. {
  366. prop: 'categoryNames',
  367. label: '物品名称',
  368. align: 'center',
  369. showOverflowTooltip: true,
  370. width: 150
  371. },
  372. {
  373. prop: 'categoryCodes',
  374. label: '物品编码',
  375. align: 'center',
  376. showOverflowTooltip: true,
  377. width: 150
  378. },
  379. {
  380. prop: 'sourceBizNo',
  381. label: '来源单据',
  382. align: 'center',
  383. showOverflowTooltip: true
  384. },
  385. {
  386. prop: 'createUserName',
  387. label: '入库人',
  388. align: 'center',
  389. showOverflowTooltip: true
  390. },
  391. {
  392. width: 160,
  393. prop: 'storageTime',
  394. label: '入库时间',
  395. align: 'center',
  396. showOverflowTooltip: true
  397. },
  398. {
  399. prop: 'verifyName',
  400. label: '审核人',
  401. align: 'center',
  402. showOverflowTooltip: true
  403. },
  404. // {
  405. // prop: 'startTime',
  406. // label: '开始时间',
  407. // align: 'center',
  408. // showOverflowTooltip: true
  409. // },
  410. {
  411. prop: 'outInStatus',
  412. label: '入库状态',
  413. align: 'center',
  414. showOverflowTooltip: true,
  415. width: 100,
  416. formatter: (row, column, cellValue) => {
  417. if (row.verifyStatus == 2) {
  418. return row.outInStatus == 1
  419. ? '预入库'
  420. : row.outInStatus == 2
  421. ? '部分入库'
  422. : row.outInStatus == 3
  423. ? '已入库'
  424. : '';
  425. }
  426. }
  427. },
  428. {
  429. prop: 'verifyStatus',
  430. label: '状态',
  431. align: 'center',
  432. slot: 'verifyStatus',
  433. showOverflowTooltip: true,
  434. width: 100
  435. },
  436. {
  437. columnKey: 'action',
  438. label: '操作',
  439. width: 250,
  440. align: 'center',
  441. slot: 'action',
  442. showOverflowTooltip: true
  443. }
  444. ]
  445. };
  446. },
  447. computed: {
  448. clientEnvironmentId() {
  449. return this.$store.state.user.info.clientEnvironmentId;
  450. }
  451. },
  452. created() {
  453. //仓库出入库是否显示金额(0:不显示 1:显示)
  454. parameterGetByCode({
  455. code: 'wms_price'
  456. }).then((res) => {
  457. this.isPrice = res.value;
  458. });
  459. },
  460. mounted() {
  461. this.getTypeList();
  462. this.getFactoryList();
  463. this.getTreeData();
  464. },
  465. methods: {
  466. async getTreeData() {
  467. this.formData.warehouseId = '';
  468. try {
  469. let res = await storageApi.getWarehouseTrees({
  470. factoryId: this.formData.factoryId
  471. });
  472. if (res?.code === '0') {
  473. this.warehouseList = res.data;
  474. }
  475. } catch (error) {
  476. console.log(error);
  477. }
  478. },
  479. //获取工厂列表
  480. async getFactoryList() {
  481. const res = await warehouseDefinition.getFactoryarea({
  482. pageNum: 1,
  483. size: 9999,
  484. type: 1
  485. });
  486. this.factoryList = res.list;
  487. },
  488. // 单击获取id
  489. cellClick(row) {
  490. this.currentRow = row;
  491. },
  492. shelves() {
  493. console.log('上架');
  494. },
  495. unShelves() {
  496. console.log('下架');
  497. },
  498. priceMaintenance() {
  499. if (Object.keys(this.currentRow).length == 0) {
  500. return this.$message.error('请选择单据');
  501. } else {
  502. if (this.currentRow.verifyStatus == 2) {
  503. this.$router.push({
  504. path: '/warehouseManagement/stockManagement/priceMaintenance',
  505. query: {
  506. ids: this.currentRow.id
  507. }
  508. });
  509. /* this.$refs.priceMaintenanceDialogRef.open(this.currentRow.id); */
  510. } else {
  511. this.$message.error('该单据未审核通过');
  512. }
  513. }
  514. },
  515. async outbound() {
  516. if (Object.keys(this.currentRow).length == 0) {
  517. return this.$message.error('请选择单据');
  518. } else {
  519. if (this.currentRow.verifyStatus == 2) {
  520. const res = await storageApi.getInboundDetailsById(
  521. this.currentRow.id
  522. );
  523. const arr = [];
  524. for (const key in res.outInDetailList) {
  525. for (const k in res.outInDetailList[key]
  526. .outInDetailRecordRequestList) {
  527. arr.push({
  528. ...res.outInDetailList[key].outInDetailRecordRequestList[k]
  529. });
  530. }
  531. }
  532. let ids = arr.map((item) => item.id).join(',');
  533. this.$router.push({
  534. path: '/warehouseManagement/outgoingManagement/add',
  535. query: {
  536. ids,
  537. bizType: this.currentRow.bizType,
  538. assetType: this.currentRow.extInfo.assetType
  539. }
  540. });
  541. } else {
  542. this.$message.error('该单据未审核通过');
  543. }
  544. }
  545. },
  546. handleAssetType(r) {
  547. let arr = r.split(',');
  548. const filteredData = this.codeList.filter((item) =>
  549. arr.includes(item.dictCode)
  550. );
  551. return filteredData.map((item) => item.dictValue).join(',');
  552. },
  553. async getTypeList() {
  554. const { data } = await allCategoryLevel();
  555. this.codeList = data.map((item) => {
  556. return { dictCode: item.id, dictValue: item.name };
  557. });
  558. },
  559. submit(row) {
  560. this.$confirm('此操作将提交流程, 是否继续?', '提示', {
  561. confirmButtonText: '确定',
  562. cancelButtonText: '取消',
  563. type: 'warning'
  564. })
  565. .then(async () => {
  566. this.loading = true;
  567. const data = await storageApi.submitTwo({ outInId: row.id });
  568. this.loading = false;
  569. if (data.code == 0) {
  570. this.$message.success(data.message);
  571. this.getList();
  572. }
  573. })
  574. .catch(() => {});
  575. },
  576. handleBizType(code) {
  577. for (const key in this.sceneState) {
  578. if (this.sceneState[key].code == code) {
  579. return this.sceneState[key].label;
  580. }
  581. }
  582. },
  583. async datasource({ page, limit, where }) {
  584. const params = Object.assign({}, this.formData);
  585. if (params.time?.length) {
  586. params.startTime = params.time[0];
  587. params.endTime = params.time[1];
  588. }
  589. delete params.time;
  590. // params.bizStatus = 1;
  591. const res = await storageApi.getInboundList({
  592. pageNum: page,
  593. size: limit,
  594. type: 1,
  595. ...params
  596. });
  597. return res;
  598. },
  599. getAuditStatus: useDict(auditStatus),
  600. getList() {
  601. this.$refs.table.reload();
  602. },
  603. add(row) {
  604. const query = {};
  605. if (row?.id) {
  606. query.id = row.id;
  607. }
  608. this.$router.push({
  609. path: '/warehouseManagement/stockManagement/add'
  610. // query
  611. });
  612. },
  613. quality(row) {
  614. this.$router.push({
  615. path: '/warehouseManagement/stockManagement/quality',
  616. query: {
  617. id: row.id
  618. }
  619. });
  620. },
  621. exportExcel() {
  622. this.$router.push({
  623. path: '/warehouseManagement/stockManagement/add_export'
  624. // query
  625. });
  626. },
  627. edit(row) {
  628. this.$router.push({
  629. path: '/warehouseManagement/stockManagement/add',
  630. query: {
  631. detailId: row.id
  632. }
  633. });
  634. },
  635. details(row) {
  636. this.$router.push({
  637. path: '/warehouseManagement/stockManagement/details',
  638. query: {
  639. id: row.id,
  640. verifyStatus: row.verifyStatus
  641. }
  642. });
  643. },
  644. async deleted(row) {
  645. this.$confirm('是否确定删除?', '提示', {
  646. confirmButtonText: '确定',
  647. cancelButtonText: '取消',
  648. type: 'warning'
  649. })
  650. .then(async () => {
  651. const data = await storageApi.delete([row.id]);
  652. if (data.code == '0') {
  653. this.$message.success('删除成功!');
  654. this.getList();
  655. }
  656. })
  657. .catch(() => {});
  658. },
  659. handleCurrentChange() {
  660. this.getList();
  661. },
  662. handleSizeChange() {
  663. this.formData.page = 1;
  664. this.getList();
  665. },
  666. search() {
  667. this.formData.page = 1;
  668. this.getList();
  669. },
  670. reset() {
  671. this.$refs.formName.resetFields();
  672. this.search();
  673. },
  674. print() {
  675. if (!this.currentRow.id) {
  676. return this.$message({
  677. message: '请先选择单据',
  678. type: 'warning',
  679. duration: 2000
  680. });
  681. }
  682. if (this.currentRow.verifyStatus !== 2) {
  683. return this.$message({
  684. message: '该单据未审核通过',
  685. type: 'warning',
  686. duration: 2000
  687. });
  688. }
  689. console.log(this.currentRow);
  690. this.$refs.printQRCodeRef.init(this.currentRow.id);
  691. console.log('print');
  692. }
  693. }
  694. };
  695. </script>
  696. <style lang="scss" scoped>
  697. #stockManagement_index {
  698. height: calc(100vh - 96px);
  699. width: 100%;
  700. padding: 10px;
  701. box-sizing: border-box;
  702. // element-ui样式穿透
  703. :deep(.el-card) {
  704. height: 100%;
  705. .el-card__body {
  706. height: 100%;
  707. box-sizing: border-box;
  708. display: flex;
  709. flex-direction: column;
  710. .ele-pro-table {
  711. flex: 1;
  712. display: flex;
  713. flex-direction: column;
  714. .el-table {
  715. flex: 1;
  716. // display: flex;
  717. // flex-direction: column;
  718. // .el-table__body-wrapper {
  719. // flex: 1;
  720. // }
  721. }
  722. }
  723. }
  724. .el-form-item {
  725. margin-bottom: 5px !important;
  726. }
  727. }
  728. .w100 {
  729. width: 100% !important;
  730. }
  731. .p20 {
  732. padding: 20px;
  733. }
  734. .mt20 {
  735. margin-top: 20px;
  736. }
  737. .mt10 {
  738. margin-top: 10px;
  739. }
  740. .el-form {
  741. overflow: hidden;
  742. }
  743. .float-right {
  744. float: right;
  745. text-align: right;
  746. margin-right: 20px;
  747. }
  748. .right {
  749. text-align: right;
  750. }
  751. .col {
  752. color: #aaa;
  753. }
  754. .pr10 {
  755. padding-right: 10px;
  756. }
  757. }
  758. </style>