index.vue 18 KB

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