index.vue 19 KB

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