warehouseManagementList.vue 18 KB

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