index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <template>
  2. <div class="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. :datasource="datasource"
  132. @cell-click="cellClick"
  133. cache-key="systemRoleTable"
  134. >
  135. <!-- 表头工具栏 -->
  136. <template v-slot:toolbar>
  137. <el-button icon="el-icon-plus" type="primary" @click="add"
  138. >新建</el-button
  139. >
  140. <el-button
  141. icon="el-icon-receiving"
  142. type="primary"
  143. @click="putIntoStorage"
  144. >退货入库</el-button
  145. >
  146. <!-- <el-button
  147. icon="el-icon-printer"
  148. type="primary"
  149. @click="openPrint('print')"
  150. >打印出库单(嘉实)</el-button
  151. > -->
  152. <!-- <el-button
  153. icon="el-icon-printer"
  154. type="primary"
  155. @click="openPrint('print1')"
  156. >打印出库单(宝悦)</el-button
  157. > -->
  158. <!-- <el-button
  159. icon="el-icon-printer"
  160. type="primary"
  161. @click="openPrint('print2')"
  162. >打印产品出库通知单</el-button
  163. >
  164. <el-button
  165. icon="el-icon-printer"
  166. type="primary"
  167. @click="openPrint('print3')"
  168. >打印产品入库及发运台账</el-button
  169. >
  170. <el-button
  171. icon="el-icon-printer"
  172. type="primary"
  173. @click="openPrint('print4')"
  174. >打印产品总账</el-button
  175. > -->
  176. </template>
  177. <template v-slot:selection="{ row }">
  178. <el-radio class="radio" v-model="currentId" :label="row.id"
  179. ><i></i
  180. ></el-radio>
  181. </template>
  182. <!-- 单号链接 -->
  183. <template v-slot:bizNo="{ row }">
  184. <el-link type="primary" @click="details(row)">
  185. {{ row.bizNo }}
  186. </el-link>
  187. </template>
  188. <!-- 状态 -->
  189. <template v-slot:verifyStatus="{ row }">
  190. <span :class="status[row.verifyStatus].class">
  191. {{ status[row.verifyStatus].label }}
  192. </span>
  193. </template>
  194. <!-- 工作流审批状态 -->
  195. <template v-slot:flowableStatus="{ row }">
  196. <span :class="status[row.flowableStatus].class">
  197. {{ status[row.flowableStatus].label }}
  198. </span>
  199. </template>
  200. <!-- 领料人 -->
  201. <template v-slot:fromUser="{ row }">
  202. <div class="deviceName">
  203. <p class="n-p">{{ row.fromUser }}</p>
  204. <!-- <p class="col">出库:{{ row.createTime }}</p> -->
  205. </div>
  206. </template>
  207. <template v-slot:bizType="{ row }">
  208. {{ handleBizType(row.bizType) }}
  209. </template>
  210. <template v-slot:assetType="{ row }">
  211. {{ handleAssetType(row.extInfo.assetType) }}
  212. </template>
  213. <!-- 操作列 -->
  214. <template v-slot:action="{ row }">
  215. <el-link
  216. type="success"
  217. :underline="false"
  218. icon="el-icon-position"
  219. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  220. @click="submit(row)"
  221. >
  222. 提交
  223. </el-link>
  224. <el-link
  225. type="warning"
  226. :underline="false"
  227. icon="el-icon-edit"
  228. v-if="row.verifyStatus == 3"
  229. @click="edit(row)"
  230. >
  231. 修改
  232. </el-link>
  233. <!-- <el-link
  234. type="primary"
  235. :underline="false"
  236. icon="el-icon-view"
  237. @click="details(row)"
  238. >
  239. 详情
  240. </el-link> -->
  241. <el-link
  242. type="primary"
  243. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  244. :underline="false"
  245. icon="el-icon-delete"
  246. @click="deleted(row)"
  247. >
  248. 删除
  249. </el-link>
  250. <!-- <el-link
  251. type="primary"
  252. :underline="false"
  253. icon="el-icon-delete"
  254. @click="print(row)"
  255. >
  256. 打印出库单
  257. </el-link> -->
  258. </template>
  259. </ele-pro-table>
  260. </el-card>
  261. <outboundOrderPrint ref="outboundOrderPrintRef" />
  262. <print ref="printRef"></print>
  263. <print1 ref="print1Ref"></print1>
  264. <print2 ref="print2Ref"></print2>
  265. <print3 ref="print3Ref"></print3>
  266. <print4 ref="print4Ref"></print4>
  267. </div>
  268. </template>
  269. <script>
  270. import storageApi from '@/api/warehouseManagement';
  271. import print from './components/print.vue';
  272. import print1 from './components/print1.vue';
  273. import print2 from './components/print2.vue';
  274. import print3 from './components/print3.vue';
  275. import print4 from './components/print4.vue';
  276. import { allCategoryLevel } from '@/api/classifyManage';
  277. import outin from '@/api/warehouseManagement/outin';
  278. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  279. import outboundOrderPrint from '../components/outboundOrderPrint.vue';
  280. import { auditStatus, useDict, outputSceneState } from '@/utils/dict/index';
  281. // import { getPage } from '@/api/stockManagement'
  282. // import { deepClone } from '@/utils'
  283. export default {
  284. components: { outboundOrderPrint, print, print1, print2, print3, print4 },
  285. data() {
  286. return {
  287. currentId: '',
  288. currentRow: {},
  289. auditStatus,
  290. outputSceneState,
  291. codeList: [],
  292. factoryList: [],
  293. tableData: [],
  294. fromUserList: [],
  295. formData: {
  296. deptIds: '',
  297. categoryCode: '',
  298. categoryName: '',
  299. sourceBizNo: '',
  300. startTime: '',
  301. endTime: '',
  302. status: '',
  303. factoryId: '',
  304. time: []
  305. },
  306. total: 0,
  307. status: [
  308. { label: '未审核', class: 'ele-text-info' },
  309. { label: '审核中', class: 'ele-text-primary' },
  310. { label: '审核通过', class: 'ele-text-success' },
  311. { label: '驳回', class: 'ele-text-danger' }
  312. ],
  313. columns: [
  314. {
  315. slot: 'selection',
  316. label: '选择',
  317. width: 50,
  318. align: 'center'
  319. },
  320. {
  321. type: 'index',
  322. label: '序号',
  323. width: 50,
  324. align: 'center'
  325. },
  326. {
  327. prop: 'bizNo',
  328. label: '单号',
  329. align: 'center',
  330. slot: 'bizNo',
  331. showOverflowTooltip: true,
  332. width: 160
  333. },
  334. {
  335. prop: 'bizType',
  336. slot: 'bizType',
  337. label: '出库场景',
  338. align: 'center',
  339. showOverflowTooltip: true,
  340. width: 150
  341. },
  342. {
  343. prop: 'assetType',
  344. slot: 'assetType',
  345. label: '物品类型',
  346. align: 'center',
  347. showOverflowTooltip: true,
  348. width: 150
  349. },
  350. {
  351. prop: 'categoryNames',
  352. label: '物品名称',
  353. align: 'center',
  354. showOverflowTooltip: true,
  355. width: 150
  356. },
  357. {
  358. prop: 'categoryCodes',
  359. label: '物品编码',
  360. align: 'center',
  361. showOverflowTooltip: true,
  362. width: 150
  363. },
  364. // {
  365. // prop: 'verifyStatus',
  366. // label: '状态',
  367. // align: 'center',
  368. // slot: 'verifyStatus',
  369. // showOverflowTooltip: true,
  370. // width: 120
  371. // },
  372. {
  373. prop: 'sourceBizNo',
  374. label: '来源单据',
  375. align: 'center',
  376. showOverflowTooltip: true,
  377. width: 150
  378. },
  379. {
  380. prop: 'fromUser',
  381. label: '领料人',
  382. align: 'center',
  383. slot: 'fromUser',
  384. showOverflowTooltip: true,
  385. width: 200
  386. },
  387. {
  388. prop: 'createTime',
  389. label: '出库时间',
  390. align: 'center',
  391. showOverflowTooltip: true,
  392. width: 200
  393. },
  394. {
  395. prop: 'verifyStatus',
  396. slot: 'verifyStatus',
  397. label: '状态',
  398. align: 'center',
  399. showOverflowTooltip: true,
  400. width: 120
  401. },
  402. {
  403. prop: 'verifyName',
  404. slot: 'verifyName',
  405. label: '审核人',
  406. align: 'center',
  407. showOverflowTooltip: true,
  408. width: 120
  409. },
  410. {
  411. columnKey: 'action',
  412. label: '操作',
  413. width: 300,
  414. align: 'center',
  415. slot: 'action',
  416. showOverflowTooltip: true
  417. }
  418. ]
  419. };
  420. },
  421. created() {
  422. this.getUser();
  423. this.getTypeList();
  424. this.getFactoryList();
  425. },
  426. methods: {
  427. //获取工厂列表
  428. async getFactoryList() {
  429. const res = await warehouseDefinition.getFactoryarea({
  430. pageNum: 1,
  431. size: 9999,
  432. type: 1
  433. });
  434. this.factoryList = res.list;
  435. this.handleList();
  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">
  587. .outgoingManagement_index {
  588. height: 100%;
  589. width: 100%;
  590. padding: 10px;
  591. box-sizing: border-box;
  592. .el-card {
  593. height: 100%;
  594. .el-card__body {
  595. height: 100%;
  596. box-sizing: border-box;
  597. display: flex;
  598. flex-direction: column;
  599. .ele-pro-table {
  600. flex: 1;
  601. display: flex;
  602. flex-direction: column;
  603. .el-table {
  604. display: flex;
  605. flex-direction: column;
  606. .el-table__body-wrapper {
  607. flex: 1;
  608. }
  609. }
  610. }
  611. }
  612. }
  613. .w100 {
  614. width: 100% !important;
  615. }
  616. .p20 {
  617. padding: 20px;
  618. }
  619. .mt20 {
  620. margin-top: 20px;
  621. }
  622. .mt10 {
  623. margin-top: 10px;
  624. }
  625. .el-form {
  626. overflow: hidden;
  627. }
  628. .float-right {
  629. float: right;
  630. text-align: right;
  631. margin-right: 20px;
  632. }
  633. .right {
  634. text-align: right;
  635. }
  636. .col {
  637. color: #aaa;
  638. }
  639. .pr10 {
  640. padding-right: 10px;
  641. }
  642. }
  643. </style>