warehouseManagementList.vue 19 KB

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