index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. <template>
  2. <div id="outgoingManagement_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 outputSceneState"
  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
  107. style="
  108. display: flex;
  109. justify-content: flex-end;
  110. margin-bottom: 10px;
  111. "
  112. >
  113. <div>
  114. <el-button icon="el-icon-refresh-left" size="small" @click="reset"
  115. >重置</el-button
  116. >
  117. <el-button
  118. type="primary"
  119. icon="el-icon-search"
  120. size="small"
  121. @click="search"
  122. >搜索</el-button
  123. >
  124. </div></el-col
  125. >
  126. </el-row>
  127. </el-form>
  128. <ele-pro-table
  129. ref="table"
  130. :columns="columns"
  131. height="calc(100vh-300px)"
  132. :datasource="datasource"
  133. @cell-click="cellClick"
  134. :pageSize="20"
  135. cache-key="systemRoleTable"
  136. v-loading="loading"
  137. >
  138. <!-- 表头工具栏 -->
  139. <template v-slot:toolbar>
  140. <el-button icon="el-icon-plus" type="primary" @click="add"
  141. >新建</el-button
  142. >
  143. <el-button
  144. icon="el-icon-receiving"
  145. type="primary"
  146. @click="putIntoStorage"
  147. >退货入库</el-button
  148. >
  149. <!-- <el-button
  150. icon="el-icon-printer"
  151. type="primary"
  152. @click="openPrint('print')"
  153. >打印出库单(嘉实)</el-button
  154. > -->
  155. <!-- <el-button
  156. icon="el-icon-printer"
  157. type="primary"
  158. @click="openPrint('print1')"
  159. >打印出库单(宝悦)</el-button
  160. > -->
  161. <!-- <el-button
  162. icon="el-icon-printer"
  163. type="primary"
  164. @click="openPrint('print2')"
  165. >打印产品出库通知单</el-button
  166. >
  167. <el-button
  168. icon="el-icon-printer"
  169. type="primary"
  170. @click="openPrint('print3')"
  171. >打印产品入库及发运台账</el-button
  172. >
  173. <el-button
  174. icon="el-icon-printer"
  175. type="primary"
  176. @click="openPrint('print4')"
  177. >打印产品总账</el-button
  178. > -->
  179. </template>
  180. <template v-slot:selection="{ row }">
  181. <el-radio class="radio" v-model="currentId" :label="row.id"
  182. ><i></i
  183. ></el-radio>
  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:verifyStatus="{ row }">
  193. <span :class="status[row.verifyStatus].class">
  194. {{ status[row.verifyStatus].label }}
  195. </span>
  196. </template>
  197. <!-- 工作流审批状态 -->
  198. <template v-slot:flowableStatus="{ row }">
  199. <span :class="status[row.flowableStatus].class">
  200. {{ status[row.flowableStatus].label }}
  201. </span>
  202. </template>
  203. <!-- 领料人 -->
  204. <template v-slot:fromUser="{ row }">
  205. <div class="deviceName">
  206. <p class="n-p">{{ row.fromUser }}</p>
  207. <!-- <p class="col">出库:{{ row.createTime }}</p> -->
  208. </div>
  209. </template>
  210. <template v-slot:bizType="{ row }">
  211. {{ handleBizType(row.bizType) }}
  212. </template>
  213. <template v-slot:assetType="{ row }">
  214. {{ handleAssetType(row.extInfo.assetType) }}
  215. </template>
  216. <!-- 操作列 -->
  217. <template v-slot:action="{ row }">
  218. <el-link
  219. type="success"
  220. :underline="false"
  221. icon="el-icon-position"
  222. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  223. @click="submit(row)"
  224. >
  225. 提交
  226. </el-link>
  227. <el-link
  228. type="warning"
  229. :underline="false"
  230. icon="el-icon-edit"
  231. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  232. @click="edit(row)"
  233. >
  234. 修改
  235. </el-link>
  236. <!-- <el-link
  237. type="primary"
  238. :underline="false"
  239. icon="el-icon-view"
  240. @click="details(row)"
  241. >
  242. 详情
  243. </el-link> -->
  244. <el-link
  245. type="primary"
  246. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  247. :underline="false"
  248. icon="el-icon-delete"
  249. @click="deleted(row)"
  250. >
  251. 删除
  252. </el-link>
  253. <!-- <el-link
  254. type="primary"
  255. :underline="false"
  256. icon="el-icon-delete"
  257. @click="print(row)"
  258. >
  259. 打印出库单
  260. </el-link> -->
  261. </template>
  262. </ele-pro-table>
  263. </el-card>
  264. <outboundOrderPrint ref="outboundOrderPrintRef" />
  265. <print ref="printRef"></print>
  266. <print1 ref="print1Ref"></print1>
  267. <print2 ref="print2Ref"></print2>
  268. <print3 ref="print3Ref"></print3>
  269. <print4 ref="print4Ref"></print4>
  270. </div>
  271. </template>
  272. <script>
  273. import storageApi from '@/api/warehouseManagement';
  274. import print from './components/print.vue';
  275. import print1 from './components/print1.vue';
  276. import print2 from './components/print2.vue';
  277. import print3 from './components/print3.vue';
  278. import print4 from './components/print4.vue';
  279. import { allCategoryLevel } from '@/api/classifyManage';
  280. import outin from '@/api/warehouseManagement/outin';
  281. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  282. import outboundOrderPrint from '../components/outboundOrderPrint.vue';
  283. import { auditStatus, useDict, outputSceneState } from '@/utils/dict/index';
  284. // import { getPage } from '@/api/stockManagement'
  285. // import { deepClone } from '@/utils'
  286. export default {
  287. components: { outboundOrderPrint, print, print1, print2, print3, print4 },
  288. data() {
  289. return {
  290. currentId: '',
  291. currentRow: {},
  292. auditStatus,
  293. outputSceneState,
  294. codeList: [],
  295. factoryList: [],
  296. tableData: [],
  297. fromUserList: [],
  298. loading:false,
  299. formData: {
  300. deptIds: '',
  301. categoryCode: '',
  302. categoryName: '',
  303. sourceBizNo: '',
  304. startTime: '',
  305. endTime: '',
  306. status: '',
  307. factoryId: '',
  308. time: []
  309. },
  310. total: 0,
  311. status: [
  312. { label: '未审核', class: 'ele-text-info' },
  313. { label: '审核中', class: 'ele-text-primary' },
  314. { label: '审核通过', class: 'ele-text-success' },
  315. { label: '驳回', class: 'ele-text-danger' }
  316. ],
  317. columns: [
  318. {
  319. slot: 'selection',
  320. label: '选择',
  321. width: 50,
  322. align: 'center'
  323. },
  324. {
  325. type: 'index',
  326. label: '序号',
  327. width: 50,
  328. align: 'center'
  329. },
  330. {
  331. prop: 'bizNo',
  332. label: '单号',
  333. align: 'center',
  334. slot: 'bizNo',
  335. showOverflowTooltip: true,
  336. width: 160
  337. },
  338. {
  339. prop: 'bizType',
  340. slot: 'bizType',
  341. label: '出库场景',
  342. align: 'center',
  343. showOverflowTooltip: true,
  344. width: 90
  345. },
  346. {
  347. prop: 'assetType',
  348. slot: 'assetType',
  349. label: '物品类型',
  350. align: 'center',
  351. showOverflowTooltip: true,
  352. width: 100
  353. },
  354. {
  355. prop: 'categoryNames',
  356. label: '物品名称',
  357. align: 'center',
  358. showOverflowTooltip: true,
  359. width: 150
  360. },
  361. {
  362. prop: 'categoryCodes',
  363. label: '物品编码',
  364. align: 'center',
  365. showOverflowTooltip: true
  366. },
  367. // {
  368. // prop: 'verifyStatus',
  369. // label: '状态',
  370. // align: 'center',
  371. // slot: 'verifyStatus',
  372. // showOverflowTooltip: true,
  373. // width: 120
  374. // },
  375. {
  376. prop: 'sourceBizNo',
  377. label: '来源单据',
  378. align: 'center',
  379. showOverflowTooltip: true,
  380. width: 150
  381. },
  382. {
  383. prop: 'fromUser',
  384. label: '领料人',
  385. align: 'center',
  386. slot: 'fromUser',
  387. showOverflowTooltip: true,
  388. width: 100
  389. },
  390. {
  391. prop: 'createTime',
  392. label: '创建时间',
  393. align: 'center',
  394. showOverflowTooltip: true,
  395. width: 200
  396. },
  397. {
  398. prop: 'storageTime',
  399. label: '出库时间',
  400. align: 'center',
  401. showOverflowTooltip: true,
  402. width: 200
  403. },
  404. {
  405. prop: 'verifyStatus',
  406. slot: 'verifyStatus',
  407. label: '状态',
  408. align: 'center',
  409. showOverflowTooltip: true,
  410. width: 120
  411. },
  412. {
  413. prop: 'verifyName',
  414. slot: 'verifyName',
  415. label: '审核人',
  416. align: 'center',
  417. showOverflowTooltip: true,
  418. width: 120
  419. },
  420. {
  421. columnKey: 'action',
  422. label: '操作',
  423. width: 200,
  424. align: 'center',
  425. slot: 'action',
  426. showOverflowTooltip: true
  427. }
  428. ]
  429. };
  430. },
  431. created() {
  432. this.getUser();
  433. this.getTypeList();
  434. this.getFactoryList();
  435. },
  436. methods: {
  437. //获取工厂列表
  438. async getFactoryList() {
  439. const res = await warehouseDefinition.getFactoryarea({
  440. pageNum: 1,
  441. size: 9999,
  442. type: 1
  443. });
  444. this.factoryList = res.list;
  445. },
  446. openPrint(ref) {
  447. if (this.currentId) {
  448. this.$refs[ref + 'Ref'].open(this.currentId);
  449. } else {
  450. this.$message.warning('请选择一条单据!');
  451. }
  452. },
  453. putIntoStorage() {
  454. if (this.currentId) {
  455. if (this.currentRow.verifyStatus == 2) {
  456. this.$router.push({
  457. path: '/warehouseManagement/stockManagement/add',
  458. query: {
  459. detailId: this.currentId
  460. }
  461. });
  462. } else {
  463. this.$message.warning('该单据未审核通过!');
  464. }
  465. } else {
  466. this.$message.warning('请选择一条单据!');
  467. }
  468. },
  469. // 单击获取id
  470. cellClick(row) {
  471. this.currentRow = row;
  472. this.currentId = row.id;
  473. },
  474. print(row) {
  475. this.$refs.outboundOrderPrintRef.open(row.id);
  476. },
  477. handleAssetType(r) {
  478. const code = this.codeList.find((item) => item.dictCode == r);
  479. return code?.dictValue;
  480. },
  481. async getTypeList() {
  482. const { data } = await allCategoryLevel();
  483. this.codeList = data.map((item) => {
  484. return { dictCode: item.id, dictValue: item.name };
  485. });
  486. },
  487. edit(row) {
  488. this.$router.push({
  489. path: '/warehouseManagement/outgoingManagement/add',
  490. query: {
  491. detailId: row.id
  492. }
  493. });
  494. },
  495. submit(row) {
  496. this.$confirm('此操作将提交流程, 是否继续?', '提示', {
  497. confirmButtonText: '确定',
  498. cancelButtonText: '取消',
  499. type: 'warning'
  500. })
  501. .then(async () => {
  502. this.loading = true;
  503. const data = await outin.outApprove({ outInId: row.id });
  504. this.loading = false;
  505. if (data.code == 0) {
  506. this.$message.success(data.message);
  507. this.getList();
  508. }
  509. })
  510. .catch(() => {});
  511. },
  512. handleBizType(code) {
  513. for (const key in this.outputSceneState) {
  514. if (this.outputSceneState[key].code == code) {
  515. return this.outputSceneState[key].label;
  516. }
  517. }
  518. },
  519. getUserName(id) {
  520. let obj = this.fromUserList.find((x) => x.id == id);
  521. return obj && obj.name;
  522. },
  523. async getUser() {
  524. let res22 = await warehouseDefinition.getUserPage({
  525. groupId: 1,
  526. size: 9999,
  527. page: 1
  528. });
  529. this.fromUserList = res22.list;
  530. },
  531. async datasource({ page, limit, where }) {
  532. const params = Object.assign({}, this.formData);
  533. if (params.time?.length) {
  534. params.startTime = params.time[0];
  535. params.endTime = params.time[1];
  536. }
  537. delete params.time;
  538. // params.bizStatus = 1;
  539. const res = await storageApi.getInboundList({
  540. pageNum: page,
  541. size: limit,
  542. ...params,
  543. type: 2
  544. });
  545. return res;
  546. },
  547. getAuditStatus: useDict(auditStatus),
  548. getList() {
  549. this.$refs.table.reload();
  550. },
  551. async deleted(row) {
  552. this.$confirm('是否确定删除?', '提示', {
  553. confirmButtonText: '确定',
  554. cancelButtonText: '取消',
  555. type: 'warning'
  556. })
  557. .then(async () => {
  558. const data = await outin.delete([row.id]);
  559. if (data.code == '0') {
  560. this.$message.success('删除成功!');
  561. this.getList();
  562. }
  563. })
  564. .catch(() => {});
  565. },
  566. add() {
  567. this.$router.push({
  568. path: '/warehouseManagement/outgoingManagement/add'
  569. });
  570. },
  571. details(row) {
  572. this.$router.push({
  573. path: '/warehouseManagement/outgoingManagement/details',
  574. query: {
  575. id: row.id
  576. }
  577. });
  578. },
  579. handleCurrentChange() {
  580. this.getList();
  581. },
  582. handleSizeChange() {
  583. this.formData.page = 1;
  584. this.getList();
  585. },
  586. search() {
  587. this.formData.page = 1;
  588. this.getList();
  589. },
  590. reset() {
  591. this.$refs.formName.resetFields();
  592. this.search();
  593. }
  594. }
  595. };
  596. </script>
  597. <style lang="scss" scoped>
  598. #outgoingManagement_index {
  599. height: calc(100vh - 96px);
  600. width: 100%;
  601. padding: 10px;
  602. box-sizing: border-box;
  603. // element-ui样式穿透
  604. :deep(.el-card) {
  605. height: 100%;
  606. .el-card__body {
  607. height: 100%;
  608. box-sizing: border-box;
  609. display: flex;
  610. flex-direction: column;
  611. .ele-pro-table {
  612. flex: 1;
  613. display: flex;
  614. flex-direction: column;
  615. .el-table {
  616. flex: 1;
  617. // display: flex;
  618. // flex-direction: column;
  619. // .el-table__body-wrapper {
  620. // flex: 1;
  621. // }
  622. }
  623. }
  624. }
  625. .el-form-item {
  626. margin-bottom: 5px !important;
  627. }
  628. }
  629. .w100 {
  630. width: 100% !important;
  631. }
  632. .p20 {
  633. padding: 20px;
  634. }
  635. .mt20 {
  636. margin-top: 20px;
  637. }
  638. .mt10 {
  639. margin-top: 10px;
  640. }
  641. .el-form {
  642. overflow: hidden;
  643. }
  644. .float-right {
  645. float: right;
  646. text-align: right;
  647. margin-right: 20px;
  648. }
  649. .right {
  650. text-align: right;
  651. }
  652. .col {
  653. color: #aaa;
  654. }
  655. .pr10 {
  656. padding-right: 10px;
  657. }
  658. }
  659. </style>