warehouseManagementList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. <!--仓库管理-->
  2. <template>
  3. <div>
  4. <BaseHeaderLayout :leftSpan="20">
  5. <template slot="left">
  6. <ws-button type="primary" @click="handleAdd()"
  7. ><img
  8. width="11"
  9. height="11"
  10. style="position: relative; top: 1px"
  11. src="../../../public/img/header-add.png"
  12. alt=""
  13. />
  14. 添加</ws-button
  15. >
  16. <ws-button @click="handleLook()">查看</ws-button>
  17. <ws-button @click="handleEdit()">编辑</ws-button>
  18. <ws-button @click="handleDelete()">删除</ws-button>
  19. </template>
  20. <template slot="left">
  21. <div style="margin-top: 2px">
  22. <el-radio-group
  23. v-model="warehouseType"
  24. @change="changeradio"
  25. size="small"
  26. >
  27. <el-radio-button label="1">常用仓库</el-radio-button>
  28. <el-radio-button label="2">临时仓库</el-radio-button>
  29. </el-radio-group>
  30. </div>
  31. </template>
  32. <template slot="right">
  33. <ws-input
  34. v-model="warehouseName"
  35. placeholder="请输入仓库名"
  36. clearable
  37. maxlength="500"
  38. type="input"
  39. class="findValue"
  40. ></ws-input>
  41. <!-- v-hasPermission="'procurement.sparepart.directShip'" -->
  42. <ws-button class="find" type="primary" @click="find()"
  43. ><img
  44. width="16"
  45. height="16"
  46. style="
  47. vertical-align: text-top;
  48. position: relative;
  49. top: 0px;
  50. left: -8px;
  51. "
  52. src="../../../public/img/sousuo.png"
  53. alt=""
  54. /></ws-button>
  55. </template>
  56. </BaseHeaderLayout>
  57. <div v-show="this.warehouseType == '1'">
  58. <el-table
  59. class="wenzi"
  60. :data="warehouseList"
  61. style="width: 100%; margin-top: 20px"
  62. height="780"
  63. >
  64. <el-table-column prop="warehouseName" label="仓库名" width="80">
  65. </el-table-column>
  66. <el-table-column prop="binNumber" label="仓位编号" width="80">
  67. </el-table-column>
  68. <el-table-column prop="capacity" label="容量(吨)">
  69. <template slot-scope="scope">
  70. <div
  71. v-if="scope.row.capacity != 'null' && scope.row.capacity != null"
  72. >
  73. {{ scope.row.capacity }}
  74. </div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="品种">
  78. <template slot-scope="scope">
  79. <div
  80. style="height: 24px"
  81. v-for="(item, i) in scope.row.warehouseNumViewList"
  82. >
  83. {{ item.goodsName }}
  84. </div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="入库量(吨)">
  88. <template slot-scope="scope">
  89. <div
  90. style="height: 24px"
  91. v-for="(item, i) in scope.row.warehouseNumViewList"
  92. >
  93. {{item.inNetWeight}}
  94. </div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="出库量(吨)">
  98. <template slot-scope="scope">
  99. <div
  100. style="height: 24px"
  101. v-for="(item, i) in scope.row.warehouseNumViewList"
  102. >
  103. {{ item.outNetWeight }}
  104. </div>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="应余量(吨)">
  108. <template slot-scope="scope">
  109. <div
  110. style="height: 24px"
  111. v-for="(item, i) in scope.row.warehouseNumViewList"
  112. >
  113. {{ item.storage }}
  114. </div>
  115. </template>
  116. </el-table-column>
  117. <el-table-column prop="seller" label="出入库" width="300">
  118. <template slot-scope="scope">
  119. <ws-button class="completed" @click="nocomplete(scope.row)">
  120. 待完成({{ scope.row.number }})
  121. </ws-button>
  122. <ws-button class="putstorage" @click="warehousing(scope.row)">
  123. 入库
  124. </ws-button>
  125. <ws-button class="deliverystorage" @click="delivery(scope.row)">
  126. 出库
  127. </ws-button>
  128. </template>
  129. </el-table-column>
  130. <el-table-column prop="address" label="操作" width="200">
  131. <template slot-scope="scope">
  132. <div class="record" @click="record(scope.row)">记录</div>
  133. <div class="adjustment" @click="loss(scope.row)">盘损</div>
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. </div>
  138. <div v-show="this.warehouseType == '2'">
  139. <el-table
  140. class="wenzi"
  141. :data="warehouseList"
  142. style="width: 100%; margin-top: 20px"
  143. height="780"
  144. >
  145. <el-table-column type="index" label="序号" width="80">
  146. <template scope="scope">
  147. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  148. <span v-else>{{ scope.$index + 1 }}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column prop="warehouseName" label="仓库名" width="80">
  152. </el-table-column>
  153. <el-table-column prop="address" label="临时仓库地址">
  154. <template slot-scope="scope">
  155. <div
  156. v-if="scope.row.address != 'null' && scope.row.address != null"
  157. >
  158. {{ scope.row.address }}
  159. </div>
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="入库量(吨)">
  163. <template slot-scope="scope">
  164. <div
  165. style="height: 24px"
  166. v-for="(item, i) in scope.row.warehouseNumViewList"
  167. >
  168. {{ item.goodsName}}({{item.inNetWeight}})
  169. </div>
  170. </template>
  171. </el-table-column>
  172. <el-table-column label="出库量(吨)">
  173. <template slot-scope="scope">
  174. <div
  175. style="height: 24px"
  176. v-for="(item, i) in scope.row.warehouseNumViewList"
  177. >
  178. {{ item.goodsName}}({{item.outNetWeight}})
  179. </div>
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="应余量(吨)">
  183. <template slot-scope="scope">
  184. <div
  185. style="height: 24px"
  186. v-for="(item, i) in scope.row.warehouseNumViewList"
  187. >
  188. {{ item.inNetWeight - item.outNetWeight }}
  189. {{item.storage }}
  190. </div>
  191. </template>
  192. </el-table-column>
  193. <el-table-column prop="seller" label="出入库" width="300">
  194. <template slot-scope="scope">
  195. <ws-button class="completed" @click="nocomplete(scope.row)">
  196. 待完成({{ scope.row.number }})
  197. </ws-button>
  198. <ws-button class="putstorage" @click="warehousing(scope.row)">
  199. 入库
  200. </ws-button>
  201. <ws-button
  202. class="deliverystorage"
  203. v-if="scope.row.clearStatusFlag != 3"
  204. @click="delivery(scope.row)"
  205. >
  206. 出库
  207. </ws-button>
  208. </template>
  209. </el-table-column>
  210. <el-table-column prop="address" label="操作" width="200">
  211. <template slot-scope="scope">
  212. <div class="record" @click="record(scope.row)">记录</div>
  213. <div
  214. class="adjustment"
  215. v-if="scope.row.clearStatusFlag == 1"
  216. @click="clearance(scope.row)"
  217. >
  218. 清仓
  219. </div>
  220. <div class="adjustment" v-if="scope.row.clearStatusFlag == 3">
  221. 已清仓
  222. </div>
  223. </template>
  224. </el-table-column>
  225. </el-table>
  226. </div>
  227. </div>
  228. </template>
  229. <script>
  230. import {
  231. getList,
  232. export1,
  233. editstatus,
  234. billoperatehis,
  235. clearancee,
  236. } from '@/model/warehouse/index'
  237. import { downloadFile } from '@/utils/batchDown'
  238. import Pagination from '@/components/Pagination'
  239. import WsUpload from '@/components/WsUpload'
  240. import { EventBus } from 'base-core-lib'
  241. export default {
  242. name: 'viewSpareMoney',
  243. components: {
  244. WsUpload,
  245. Pagination,
  246. },
  247. watch: {
  248. vesselId(val) {
  249. this.getList()
  250. },
  251. isShow(val) {
  252. this.showType = val
  253. },
  254. },
  255. data() {
  256. return {
  257. //弹出框
  258. dialogViewSpareMoney: false,
  259. dialogApproveFormVisible: false,
  260. // 船舶类型
  261. monetaryKey: null,
  262. // 表格显示数据
  263. tableDate: [],
  264. // 是否显示
  265. showType: true,
  266. // 年
  267. year: '',
  268. currentPage: 1,
  269. pageSize: 10,
  270. searchType: 1,
  271. searchTypeText: '未完成',
  272. searchKeyWord: '',
  273. contractType: 2,
  274. warehouseType: '1',
  275. // 提交类型
  276. submitType: true,
  277. size: 10,
  278. spanArr: [],
  279. warehouseName: '',
  280. compId: sessionStorage.getItem('ws-pf_compId'),
  281. deptCircularPage: {},
  282. warehouseList: [],
  283. deptBudgetList: {},
  284. historyList: [],
  285. deptBudgetTotal: 0,
  286. pickerBeginDateBefore: {
  287. disabledDate: (time) => {
  288. return time.getTime() > Date.now()
  289. },
  290. },
  291. accessoryTFs: false,
  292. }
  293. },
  294. activated() {
  295. this.getList()
  296. this.showType = this.isShow
  297. },
  298. methods: {
  299. //清仓
  300. clearance(row) {
  301. console.log(row.outNumber)
  302. if (row.outNumber > 0) {
  303. this.$confirm(`你还有未完善的出库记录,请完善提交后再进行操作`, {
  304. cancelButtonText: '关闭',
  305. })
  306. .then(() => {})
  307. .catch(() => {
  308. return false
  309. })
  310. } else {
  311. this.$confirm(
  312. `清仓操作代表库存已清零,清仓后不可进行出库操作,是否确定清仓`,
  313. {
  314. confirmButtonText: '确定',
  315. cancelButtonText: '取消',
  316. type: 'warning',
  317. }
  318. )
  319. .then(() => {
  320. clearancee({ id: row.warehouseId })
  321. .toPromise()
  322. .then((response) => {
  323. this.$notify.success({
  324. title: '成功',
  325. message: '状态清仓成功',
  326. })
  327. this.getList()
  328. })
  329. .catch((response) => {})
  330. })
  331. .catch(() => {
  332. return false
  333. })
  334. }
  335. },
  336. //出库
  337. delivery(item) {
  338. this.$router.push({
  339. path: 'warehouseManagementDelivery',
  340. query: {
  341. baseId: item.warehouseId,
  342. positionId: item.binNumberId,
  343. warehouseName: item.warehouseName,
  344. binNumber: item.binNumber,
  345. capacity: item.capacity,
  346. warehouseType: this.warehouseType,
  347. warehouseId: item.warehouseId,
  348. },
  349. })
  350. },
  351. //入库
  352. warehousing(item) {
  353. var free = 0
  354. for (var i = 0; i < item.warehouseNumViewList.length; i++) {
  355. free += Number(item.warehouseNumViewList[i].storage)
  356. }
  357. this.$router.push({
  358. path: 'warehouseManagementPut',
  359. query: {
  360. baseId: item.warehouseId,
  361. positionId: item.binNumberId,
  362. warehouseName: item.warehouseName,
  363. binNumber: item.binNumber,
  364. capacity: item.capacity - free,
  365. id: item.id,
  366. warehouseType: this.warehouseType,
  367. createType: item.createType,
  368. },
  369. })
  370. },
  371. getSpanArr(data) {
  372. let that = this
  373. //页面展示的数据,不一定是全部的数据,所以每次都清空之前存储的 保证遍历的数据是最新的数据。以免造成数据渲染混乱
  374. that.spanArr = []
  375. that.pos = 0
  376. //遍历数据
  377. data.forEach((item, index) => {
  378. //判断是否是第一项
  379. // if (index === 0) {
  380. // this.spanArr.push(1)
  381. // this.pos = 0
  382. // } else {
  383. //不是第一项时,就根据标识去存储
  384. if (data[index].warehouseNumViewList.length > 1) {
  385. // 查找到符合条件的数据时每次要把之前存储的数据+1
  386. this.spanArr[this.pos] = data[index].warehouseNumViewList.length
  387. this.spanArr.push(0)
  388. } else {
  389. // 没有符合的数据时,要记住当前的index
  390. this.spanArr.push(1)
  391. this.pos = index
  392. }
  393. // }
  394. })
  395. },
  396. //待完成//传参
  397. nocomplete(row) {
  398. if (row.number > 0) {
  399. this.$router.push({
  400. path: 'warehouseManagementNoComplete',
  401. query: {
  402. baseId: row.warehouseId,
  403. positionId: row.binNumberId,
  404. warehouseName: row.warehouseName,
  405. binNumber: row.binNumber,
  406. warehouseType: this.warehouseType,
  407. createType: row.createType,
  408. },
  409. })
  410. }
  411. },
  412. //记录
  413. record(item) {
  414. this.$router.push({
  415. name: 'warehouseManagementRecord',
  416. query: {
  417. baseId: item.warehouseId,
  418. positionId: item.binNumberId,
  419. warehouseName: item.warehouseName,
  420. remark: item.remark,
  421. binNumber: item.binNumber,
  422. capacity: item.capacity,
  423. warehouseType: this.warehouseType,
  424. },
  425. })
  426. },
  427. //盘损
  428. loss(item) {
  429. this.$router.push({
  430. path: 'warehouseManagementIoss',
  431. query: {
  432. baseId: item.warehouseId,
  433. positionId: item.binNumberId,
  434. warehouseName: item.warehouseName,
  435. binNumber: item.binNumber,
  436. },
  437. })
  438. },
  439. changeradio(e) {
  440. this.getList()
  441. },
  442. //查看
  443. handleLook() {
  444. this.$router.push({ path: 'warehouseManagementLook' })
  445. },
  446. //添加
  447. handleAdd() {
  448. this.$router.push({ path: 'warehouseManagementAdd' })
  449. },
  450. //编辑
  451. handleEdit() {
  452. this.$router.push({ path: 'warehouseManagementEdit' })
  453. },
  454. handleDelete() {
  455. this.$router.push({ path: 'warehouseManagementDelete' })
  456. },
  457. dateFormat(fmt, date) {
  458. let ret
  459. const opt = {
  460. 'Y+': date.getFullYear().toString(), // 年
  461. 'm+': (date.getMonth() + 1).toString(), // 月
  462. 'd+': date.getDate().toString(), // 日
  463. 'H+': date.getHours().toString(), // 时
  464. // "M+": date.getMinutes().toString(), // 分
  465. // "S+": date.getSeconds().toString() // 秒
  466. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  467. }
  468. for (let k in opt) {
  469. ret = new RegExp('(' + k + ')').exec(fmt)
  470. if (ret) {
  471. fmt = fmt.replace(
  472. ret[1],
  473. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  474. )
  475. }
  476. }
  477. return fmt
  478. },
  479. handleClose() {
  480. this.accessoryTFs = false
  481. },
  482. handleSizeChange(val) {
  483. console.log(`每页 ${val} 条`)
  484. this.pageSize = val
  485. this.getList()
  486. },
  487. handleCurrentChange(val) {
  488. this.currentPage = val
  489. console.log(`当前页: ${val}`)
  490. this.getList()
  491. },
  492. getList() {
  493. getList({
  494. compId: sessionStorage.getItem('ws-pf_compId'),
  495. warehouseName: this.warehouseName,
  496. warehouseType: this.warehouseType,
  497. })
  498. .toPromise()
  499. .then((response) => {
  500. this.warehouseList = response
  501. })
  502. },
  503. editClick(row) {
  504. var status = ''
  505. if (row.status == '待执行' || row.status == '已完成') {
  506. status = '执行中'
  507. } else if (row.status == '执行中') {
  508. status = '已完成'
  509. }
  510. //cancelButtonClass: "btn-custom-cancel"
  511. this.$confirm(`是否将状态改为${status}`, {
  512. confirmButtonText: '确定',
  513. cancelButtonText: '取消',
  514. type: 'warning',
  515. })
  516. .then(() => {
  517. editstatus({ id: row.id })
  518. .toPromise()
  519. .then((response) => {
  520. this.$notify.success({
  521. title: '成功',
  522. message: '状态修改成功',
  523. })
  524. this.getList()
  525. })
  526. .catch((response) => {
  527. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  528. })
  529. })
  530. .catch(() => {
  531. return false
  532. })
  533. },
  534. selecttaskType(e) {
  535. for (var i = 0; i < this.taskTypeList.length; i++) {
  536. if (this.taskTypeList[i].value == e) {
  537. this.searchType = this.taskTypeList[i].type
  538. }
  539. }
  540. },
  541. fujian(row) {
  542. if (
  543. row.receiveAttachmentPath === null ||
  544. row.receiveAttachmentPath === ''
  545. ) {
  546. EventBus.$emit(
  547. 'warning',
  548. this.$t('system.noticeCircular.NoInformation')
  549. )
  550. } else {
  551. this.accessoryTFs = true
  552. }
  553. this.appendixIdss = row.receiveAttachmentPath
  554. },
  555. handleExamine(row) {
  556. this.$router.push({
  557. name: 'salesContractExamine',
  558. query: { id: row.id },
  559. })
  560. },
  561. // 关闭 dialog时 处理文件url 初始化upload组件
  562. handleCloe() {
  563. this.dialogViewSpareMoney = false
  564. },
  565. history(row) {
  566. billoperatehis({ id: row.id })
  567. .toPromise()
  568. .then((response) => {
  569. this.historyList = response
  570. })
  571. },
  572. find() {
  573. this.currentPage = 1
  574. this.getList()
  575. },
  576. async exportlist() {
  577. const { data } = await export1(
  578. {
  579. compId: sessionStorage.getItem('ws-pf_compId'),
  580. contractType: this.contractType,
  581. currentPage: this.currentPage,
  582. pageSize: this.pageSize,
  583. searchType: this.searchType,
  584. searchKeyWord: this.searchKeyWord,
  585. startDate: this.startDate,
  586. endDate: this.endDate,
  587. },
  588. {},
  589. { responseType: 'blob' }
  590. ).toPromise()
  591. downloadFile({
  592. res: data,
  593. fileName: `${
  594. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  595. }_采购合同`,
  596. type: 'xls',
  597. })
  598. },
  599. },
  600. }
  601. </script>
  602. <style lang="scss" scoped>
  603. .connert {
  604. width: 90%;
  605. margin: 0 auto;
  606. }
  607. .vertical-text-left {
  608. width: 62px;
  609. text-align: right;
  610. }
  611. .el-button--primary {
  612. background-color: #5878e8;
  613. border-color: #5878e8;
  614. }
  615. .el-button--default {
  616. color: #8890b1;
  617. border-color: #e8eaf1;
  618. }
  619. /deep/.base_header_layout .grid-content.right .find.el-button--primary {
  620. width: 30px;
  621. margin-left: 0;
  622. border-top-left-radius: 0px;
  623. border-bottom-left-radius: 0px;
  624. }
  625. /deep/.findValue .el-input__inner {
  626. border-top-right-radius: 0px;
  627. border-bottom-right-radius: 0px;
  628. }
  629. .completed.el-button--default {
  630. border-color: #5878e8;
  631. background-color: #f6f7fc;
  632. color: #5878e8;
  633. }
  634. .putstorage.el-button--default,
  635. .deliverystorage.el-button--default {
  636. border-color: #8890b1;
  637. background-color: #fff;
  638. color: #8890b1;
  639. }
  640. /deep/.el-table td,
  641. /deep/.el-table th.is-leaf {
  642. border-right: 1px solid #e9ecf7;
  643. text-align: center;
  644. }
  645. /deep/.el-table tr td:first-child,
  646. /deep/.el-table tr th.is-leaf:first-child {
  647. border-left: 1px solid #e9ecf7;
  648. }
  649. /deep/.el-table .el-table__header .cell,
  650. /deep/.el-table .el-table__body .cell {
  651. -webkit-line-clamp: 10;
  652. max-height: 400px;
  653. }
  654. .record,
  655. .adjustment {
  656. display: inline-block;
  657. color: #5878e8;
  658. padding: 0 4px !important;
  659. position: relative;
  660. }
  661. .record:after {
  662. position: absolute;
  663. content: '';
  664. display: block;
  665. top: 5px;
  666. right: -2px;
  667. width: 1px;
  668. height: 12px;
  669. background: #e9ecf7;
  670. }
  671. /deep/.el-radio-button:first-child .el-radio-button__inner {
  672. margin-left: 10px;
  673. }
  674. </style>