details.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <el-form label-width="130px">
  5. <div class="page-title">
  6. <div class="page-title-div">
  7. <el-page-header
  8. @back="$router.push('/warehouseManagement/warehouseDefinition')"
  9. content="仓库定义详情"
  10. >
  11. <div class="title-content" slot="content">
  12. 仓库定义详情
  13. <!-- <el-button
  14. size="mini"
  15. icon="el-icon-upload2"
  16. type="primary"
  17. @click="goodsInfoView"
  18. >导出条码</el-button
  19. > -->
  20. </div>
  21. </el-page-header>
  22. </div>
  23. </div>
  24. <div class="content-detail">
  25. <div class="basic-details">
  26. <header-title title="基本信息:" size="16px"></header-title>
  27. <el-row>
  28. <el-col :span="8">
  29. <el-form-item label="仓库编码:">
  30. <span>{{ warehouseInfo.code }}</span>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="8">
  34. <el-form-item label="仓库名称:">
  35. <span>{{ warehouseInfo.name }}</span>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="8">
  39. <el-form-item label="仓库类型:">
  40. <span>{{
  41. warehouseInfo.inventoryType
  42. | useDictLabelFilter(warehouseDefinition_inventoryList)
  43. }}</span>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="8">
  47. <el-form-item label="状态:">
  48. <span>{{ warehouseInfo.enabled ? '生效' : '失效' }}</span>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="8">
  52. <el-form-item label="所属工厂:">
  53. <span>{{ filterFactoryId(warehouseInfo.factoryId) }}</span>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="8">
  57. <el-form-item label="权属部门">
  58. <span>{{ warehouseInfo.departmentName }}</span>
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="8">
  62. <el-form-item label="权属人">
  63. <span>{{ warehouseInfo.ownerName }}</span>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="8">
  67. <el-form-item label="联系方式">
  68. <span>{{ warehouseInfo.contact }}</span>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="8">
  72. <el-form-item label="仓库位置">
  73. <span
  74. >{{ warehouseInfo.province }} / {{ warehouseInfo.city }} /
  75. {{ warehouseInfo.area }}</span
  76. >
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="8">
  80. <el-form-item label="详细地址">
  81. <span>{{ warehouseInfo.address }}</span>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="8">
  85. <el-form-item label="创建人">
  86. <span>{{ warehouseInfo.createUserName }}</span>
  87. </el-form-item>
  88. </el-col>
  89. <!-- <el-col :span="8">
  90. <el-form-item label="创建部门">
  91. <span>人力资源部</span>
  92. </el-form-item>
  93. </el-col> -->
  94. <el-col :span="8">
  95. <el-form-item label="创建时间:">
  96. <span>{{ warehouseInfo.createTime }}</span>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :span="24">
  100. <el-form-item label="备注:">
  101. <span>{{ warehouseInfo.remarks }}</span>
  102. </el-form-item>
  103. </el-col>
  104. </el-row>
  105. </div>
  106. <div class="basic-details mt20 warehouse-area">
  107. <header-title title="货位信息" size="16px"></header-title>
  108. <div class="status-legend">
  109. <div
  110. v-for="(item, index) in warehouseDefinition_locationStatus"
  111. :key="index"
  112. >
  113. <span :style="{ 'background-color': item.color }"></span
  114. >{{ item.label }}
  115. </div>
  116. </div>
  117. <el-tabs v-model="warehouseAreaActive">
  118. <el-tab-pane
  119. :key="item.id"
  120. v-for="(item, index) in warehouseAreasSaveList"
  121. :label="item.name"
  122. :name="index + ''"
  123. >
  124. <div class="msg">
  125. <div>
  126. <span class="label">库区编号</span
  127. >{{ warehouseInfo.code + '-' + item.code }}
  128. </div>
  129. <div><span class="label">库区名称</span>{{ item.name }}</div>
  130. <div>
  131. <span class="label">库区类型</span
  132. >{{
  133. item.extInfo[0].areaType
  134. | useDictLabelFilter(warehouseDefinition_inventoryList)
  135. }}
  136. </div>
  137. <div>
  138. <span class="label">库区属性</span
  139. >{{
  140. item.extInfo[0].attribute
  141. | useDictLabelFilter(warehouseDefinition_areaAttribute)
  142. }}
  143. </div>
  144. <div>
  145. <span class="label">库区长宽高(cm)</span
  146. >{{ item.extInfo[0].areaLength }}*{{
  147. item.extInfo[0].areaWidth
  148. }}*{{ item.extInfo[0].areaHigh }}
  149. </div>
  150. <div
  151. ><span class="label">货架数</span>{{ item.subCount }}</div
  152. >
  153. <div>
  154. <span class="label">货位数</span>{{ childrenLength(item) }}
  155. </div>
  156. <div style="width: 10px"></div>
  157. </div>
  158. <div
  159. class="shelves-container"
  160. v-for="itm in item.children"
  161. :key="itm.id"
  162. >
  163. <h3>货架{{ itm.code }}</h3>
  164. <div class="content">
  165. <div class="content-box">
  166. <el-row :gutter="4">
  167. <el-col
  168. :span="4"
  169. v-for="p in itm.children"
  170. :key="p.id"
  171. class="box"
  172. :style="{
  173. 'background-color': getStatus(
  174. p.warehouseStatVO.type
  175. ).color,
  176. color:
  177. p.warehouseStatVO.type === 3 ? '#fff' : '#000'
  178. }"
  179. >{{ '货位' + p.code }}
  180. <div class="mask">
  181. {{ p.code }}
  182. <div>
  183. <i
  184. class="el-icon-tickets"
  185. @click="
  186. goodsInfoView(
  187. p,
  188. warehouseInfo.code +
  189. '-' +
  190. p.reservoirAreaCode +
  191. '-' +
  192. p.goodsShelvesCode +
  193. '-' +
  194. p.code
  195. )
  196. "
  197. ></i>
  198. <img
  199. src="~@/assets/img/transform.svg"
  200. alt=""
  201. @click="transformStatus(p)"
  202. />
  203. </div>
  204. </div>
  205. </el-col>
  206. </el-row>
  207. </div>
  208. <div class="detail">
  209. <div>
  210. <span class="label">货架号</span
  211. >{{ warehouseInfo.code }}-{{ item.code }}-{{ itm.code }}
  212. </div>
  213. <div>
  214. <span class="label">货架长宽高(cm)</span
  215. >{{ itm.extInfo[0].areaHigh }}*{{
  216. itm.extInfo[0].areaWidth
  217. }}*{{ itm.extInfo[0].areaWidth }}
  218. </div>
  219. <div>
  220. <span class="label">货架层数</span
  221. >{{ itm.extInfo[0].line }}
  222. </div>
  223. <div>
  224. <span class="label">货位数</span
  225. >{{ itm.children.length }}
  226. </div>
  227. <div>
  228. <span class="label">空置货位数</span>
  229. <!-- {{itm.children.filter((i) => i.allocationStatus === 1).length}} -->
  230. {{ itm.emptyAllocationNumber }}
  231. </div>
  232. <div>
  233. <span class="label">在用货位数</span>
  234. <!-- {{ itm.children.filter((i) => i.allocationStatus === 2).length }} -->
  235. {{ itm.useAllocationNumber }}
  236. </div>
  237. <div>
  238. <span class="label">已满货位数</span>
  239. <!-- {{itm.children.filter((i) => i.allocationStatus === 3) .length }} -->
  240. {{ itm.fullAllocationNumber }}
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. </el-tab-pane>
  246. </el-tabs>
  247. </div>
  248. </div>
  249. </el-form>
  250. <GoodsInfoDialog ref="goodsInfoRef" />
  251. <!-- <CodePrint ref="codePrintRef" /> -->
  252. </el-card>
  253. <el-dialog :visible.sync="statusVisible" title="变更货位状态" width="400px">
  254. <el-radio-group v-model="curLocation.type">
  255. <el-radio :label="1">正常</el-radio>
  256. <el-radio :label="3" :disabled="[1, 4].includes(warehouseStatVO.type)"
  257. >已满</el-radio
  258. >
  259. <el-radio :label="4" :disabled="[2, 3].includes(warehouseStatVO.type)"
  260. >失效</el-radio
  261. >
  262. </el-radio-group>
  263. <div slot="footer">
  264. <el-button
  265. type="primary"
  266. plain
  267. size="small"
  268. @click="statusVisible = false"
  269. >取消</el-button
  270. >
  271. <el-button
  272. type="primary"
  273. :loading="changeLoading"
  274. size="small"
  275. @click="confirmChange"
  276. >确定</el-button
  277. >
  278. </div>
  279. </el-dialog>
  280. </div>
  281. </template>
  282. <script>
  283. import {
  284. warehouseDefinition_locationStatus,
  285. warehouseDefinition_inventoryList,
  286. warehouseDefinition_areaAttribute,
  287. useDictLabelFilter,
  288. useDict
  289. } from '@/utils/dict/index';
  290. // import CodePrint from './components/CodePrint';
  291. // import {
  292. // warehouseDetails,
  293. // warehouseChangeStatus
  294. // } from '@/api/stockManagement/warehouseDefinition';
  295. import GoodsInfoDialog from './components/GoodsInfoDialog.vue';
  296. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  297. export default {
  298. components: { GoodsInfoDialog },
  299. data() {
  300. return {
  301. warehouseDefinition_areaAttribute,
  302. warehouseDefinition_inventoryList,
  303. warehouseDefinition_locationStatus,
  304. statusVisible: false,
  305. warehouseAreaActive: '0',
  306. num: 1,
  307. warehouseAreasSaveList: [], //库区
  308. warehouseAreaGoodsshelvesList: [],
  309. allocationList: [],
  310. shelfData: [],
  311. detailInfo: {},
  312. warehouseInfo: {}, //仓储基本信息
  313. reservoirAreaData: [],
  314. factoryList: [],
  315. warehouseStatVO: {},
  316. curLocation: {},
  317. changeLoading: false
  318. };
  319. },
  320. filters: {
  321. useDictLabelFilter: useDictLabelFilter
  322. },
  323. computed: {
  324. // // 货位状态修改
  325. statusSet: {
  326. set(val) {
  327. this.curLocation.preStatus = val;
  328. },
  329. get() {
  330. if (this.curLocation.preStatus) {
  331. if ([1, 2].includes(this.curLocation.preStatus)) {
  332. return 0;
  333. }
  334. return this.curLocation.preStatus;
  335. }
  336. if (
  337. this.curLocation.preStatus === 0 ||
  338. [1, 2].includes(this.curLocation.preStatus)
  339. ) {
  340. return 0;
  341. }
  342. return this.curLocation.preStatus;
  343. }
  344. }
  345. },
  346. created() {
  347. this.getInfo();
  348. },
  349. methods: {
  350. childrenLength(item) {
  351. let num = 0;
  352. item.children.forEach((it) => {
  353. num += it.children.length;
  354. });
  355. return num;
  356. },
  357. getStatus: useDict(warehouseDefinition_locationStatus),
  358. exportCode() {
  359. this.$refs.codePrintRef.open(this.warehouseAreasSaveList);
  360. },
  361. filterFactoryId(factoryId) {
  362. if (!factoryId) return;
  363. if (this.factoryList.length) {
  364. let obj = this.factoryList.find((f) => f.id === factoryId);
  365. return obj.name;
  366. } else {
  367. return '';
  368. }
  369. },
  370. async getInfo() {
  371. // 获取工厂车间列表
  372. const res1 = await warehouseDefinition.getFactoryarea({
  373. pageNum: 1,
  374. size: 9999,
  375. type: 1
  376. });
  377. this.factoryList = res1.list;
  378. const { warehouseVO } = await warehouseDefinition.warehouseDetail(
  379. this.$route.query.id
  380. );
  381. console.log(warehouseVO);
  382. this.warehouseInfo = warehouseVO || {};
  383. // warehouseAreasSaveList: res.reservoirAreaList || [], //库区
  384. // areaGoodsshelvesList: res.goodsShelvesList || [], //货架
  385. // allocationReqList: res.goodsAllocationList || [] //货位
  386. // const {
  387. // warehouseAreasSaveList = [],
  388. // areaGoodsshelvesList = [],
  389. // allocationReqList = []
  390. // } = res;
  391. const warehouseAreasSaveList = res.reservoirAreaList || [];
  392. const areaGoodsshelvesList = res.goodsShelvesList || [];
  393. const allocationReqList = res.goodsAllocationList || [];
  394. warehouseAreasSaveList.forEach((item) => {
  395. item.children = areaGoodsshelvesList
  396. .filter((i) => i.reservoirAreaCode === item.code)
  397. .map((itm) => {
  398. itm.children = allocationReqList.filter(
  399. (it) => it.goodsShelvesCode === itm.code
  400. );
  401. return itm;
  402. });
  403. });
  404. this.warehouseAreasSaveList = warehouseAreasSaveList;
  405. },
  406. //变更货位状态
  407. transformStatus(item) {
  408. this.warehouseStatVO = Object.assign({}, item.warehouseStatVO);
  409. this.curLocation = Object.assign({}, item.warehouseStatVO);
  410. this.statusVisible = true;
  411. },
  412. async confirmChange() {
  413. this.changeLoading = true;
  414. try {
  415. await warehouseDefinition.warehouseChangeStatus(this.curLocation);
  416. this.$message.success('操作成功!');
  417. this.getInfo();
  418. this.statusVisible = false;
  419. } catch (error) {}
  420. this.changeLoading = false;
  421. },
  422. goodsInfoView({ id }, title) {
  423. this.$refs.goodsInfoRef.open(id, title);
  424. }
  425. }
  426. };
  427. </script>
  428. <style lang="scss" scoped>
  429. ::v-deep .el-form-item {
  430. margin-bottom: 12px;
  431. }
  432. .page {
  433. padding: 10px;
  434. margin: 10px 0 10px 0;
  435. height: calc(100vh - 80px);
  436. padding: 10px;
  437. overflow-y: auto;
  438. }
  439. .title-content {
  440. .el-button {
  441. position: absolute;
  442. right: 20px;
  443. top: 50%;
  444. transform: translateY(-50%);
  445. }
  446. }
  447. .page-title {
  448. background: #fff;
  449. font-size: 18px;
  450. padding: 6px 20px;
  451. font-weight: 500;
  452. .page-title-div {
  453. position: relative;
  454. margin: 5px 0;
  455. height: 30px;
  456. line-height: 30px;
  457. border-bottom: 1px solid #eaeefb;
  458. }
  459. }
  460. .mt20 {
  461. margin-top: 20px;
  462. }
  463. .content-detail {
  464. background: #fff;
  465. padding: 20px;
  466. }
  467. .warehouse-area {
  468. .msg {
  469. line-height: 52px;
  470. background-color: rgba(242, 242, 242, 1);
  471. display: flex;
  472. align-items: center;
  473. justify-content: space-between;
  474. flex-wrap: wrap;
  475. padding: 0 20px;
  476. margin-bottom: 12px;
  477. .label {
  478. color: #333;
  479. margin-right: 12px;
  480. font-weight: bold;
  481. }
  482. }
  483. .shelves-container {
  484. .content {
  485. display: flex;
  486. align-items: stretch;
  487. padding: 20px;
  488. }
  489. .detail {
  490. width: 282px;
  491. background-color: rgba(242, 242, 242, 1);
  492. border-radius: 8px;
  493. margin-left: 12px;
  494. padding: 20px 0 0 2px;
  495. > div {
  496. margin-bottom: 12px;
  497. .label {
  498. display: inline-block;
  499. width: 8em;
  500. color: #333;
  501. font-weight: bold;
  502. text-align: right;
  503. margin-right: 6px;
  504. }
  505. }
  506. }
  507. h3 {
  508. // color: $mainColor;
  509. font-size: 16px;
  510. }
  511. .content-box {
  512. flex: 1;
  513. .box {
  514. background-clip: content-box;
  515. height: 64px;
  516. margin-bottom: 4px;
  517. cursor: pointer;
  518. position: relative;
  519. display: flex;
  520. align-items: center;
  521. justify-content: center;
  522. &:hover .mask {
  523. display: block;
  524. }
  525. .mask {
  526. display: none;
  527. position: absolute;
  528. top: 0;
  529. left: 3px;
  530. right: 3px;
  531. bottom: 0;
  532. background-color: rgba(0, 0, 0, 0.7);
  533. color: #fff;
  534. font-weight: bold;
  535. text-align: center;
  536. // line-height: 64px;
  537. padding: 23px 25%;
  538. img {
  539. width: 1em;
  540. height: 1em;
  541. }
  542. div {
  543. margin-top: 8px;
  544. display: flex;
  545. justify-content: space-between;
  546. }
  547. }
  548. }
  549. }
  550. }
  551. }
  552. .status-legend {
  553. display: flex;
  554. align-items: center;
  555. justify-content: center;
  556. div {
  557. margin: 0 12px;
  558. }
  559. span {
  560. display: inline-block;
  561. width: 13px;
  562. height: 13px;
  563. margin: 0 4px;
  564. }
  565. }
  566. .basic-details-title {
  567. margin-bottom: 12px;
  568. margin-top: 20px;
  569. // border-bottom: 1px solid #157a2c;
  570. padding-bottom: 8px;
  571. display: flex;
  572. justify-content: space-between;
  573. }
  574. .area {
  575. margin-top: 20px;
  576. .title {
  577. font-size: 14px;
  578. span {
  579. font-weight: bold;
  580. }
  581. }
  582. .mt10 {
  583. margin-top: 10px;
  584. }
  585. }
  586. .locationFlex {
  587. display: flex;
  588. justify-content: space-between;
  589. .locationRight {
  590. .flex {
  591. display: flex;
  592. .title {
  593. width: 50px;
  594. font-size: 13px;
  595. text-align: center;
  596. margin-right: 5px;
  597. margin-bottom: 5px;
  598. }
  599. .locationContent {
  600. width: 50px;
  601. padding: 10px 0;
  602. color: #fff;
  603. font-size: 13px;
  604. text-align: center;
  605. margin-right: 5px;
  606. margin-bottom: 5px;
  607. }
  608. }
  609. }
  610. .green {
  611. background-color: #157a2c;
  612. }
  613. .red {
  614. background-color: #a60014;
  615. }
  616. .blue {
  617. background-color: #027db4;
  618. }
  619. }
  620. .no_data {
  621. padding: 50px 0;
  622. text-align: center;
  623. }
  624. .shelfBox {
  625. display: flex;
  626. justify-content: space-between;
  627. .shelfCode {
  628. // width: 60px;
  629. padding: 74px 6px;
  630. color: #fff;
  631. text-align: center;
  632. background-color: #157a2c;
  633. font-size: 12px;
  634. }
  635. }
  636. .shelfDataBox {
  637. display: flex;
  638. .shelfLeft {
  639. width: 50%;
  640. margin-right: 20px;
  641. .shlefCode {
  642. font-size: 12px;
  643. display: block;
  644. margin-bottom: 10px;
  645. }
  646. .shelfChildren {
  647. display: flex;
  648. .shelfShow {
  649. background-color: #027db4;
  650. color: #fff;
  651. font-size: 12px;
  652. padding: 12px;
  653. }
  654. }
  655. }
  656. .shelfRight {
  657. flex: 1;
  658. }
  659. }
  660. :deep(.el-form-item__label) {
  661. color: #3e3e3e;
  662. font-size: 14px;
  663. }
  664. .mb10 {
  665. margin-bottom: 10px;
  666. }
  667. .mb5 {
  668. margin-bottom: 2px;
  669. }
  670. .mr10 {
  671. margin-right: 10px;
  672. }
  673. </style>