warehouseManagementList.vue 20 KB

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