index.vue 21 KB

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