warehouseManagementList.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <!--仓库管理-->
  2. <template>
  3. <div>
  4. <BaseHeaderLayout :leftSpan="20">
  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 style="margin-top: 2px">
  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. currentPage: 1,
  291. pageSize: 10,
  292. searchType: 1,
  293. searchTypeText: '未完成',
  294. searchKeyWord: '',
  295. contractType: 2,
  296. warehouseType: '1',
  297. // 提交类型
  298. submitType: true,
  299. size: 10,
  300. spanArr: [],
  301. warehouseName: '',
  302. compId: sessionStorage.getItem('ws-pf_compId'),
  303. deptCircularPage: {},
  304. warehouseList: [],
  305. deptBudgetList: {},
  306. historyList: [],
  307. deptBudgetTotal: 0,
  308. pickerBeginDateBefore: {
  309. disabledDate: (time) => {
  310. return time.getTime() > Date.now()
  311. },
  312. },
  313. accessoryTFs: false,
  314. }
  315. },
  316. activated() {
  317. this.getList()
  318. this.showType = this.isShow
  319. },
  320. methods: {
  321. //清仓
  322. clearance(row) {
  323. console.log(row.outNumber)
  324. if (row.outNumber > 0) {
  325. this.$confirm(`你还有未完善的出库记录,请完善提交后再进行操作`, {
  326. cancelButtonText: '关闭',
  327. })
  328. .then(() => {})
  329. .catch(() => {
  330. return false
  331. })
  332. } else {
  333. this.$confirm(
  334. `清仓操作代表库存已清零,清仓后不可进行出库操作,是否确定清仓`,
  335. {
  336. confirmButtonText: '确定',
  337. cancelButtonText: '取消',
  338. type: 'warning',
  339. }
  340. )
  341. .then(() => {
  342. clearancee({ id: row.warehouseId })
  343. .toPromise()
  344. .then((response) => {
  345. this.$notify.success({
  346. title: '成功',
  347. message: '状态清仓成功',
  348. })
  349. this.getList()
  350. })
  351. .catch((response) => {})
  352. })
  353. .catch(() => {
  354. return false
  355. })
  356. }
  357. },
  358. //出库
  359. delivery(item) {
  360. this.$router.push({
  361. path: 'warehouseManagementDelivery',
  362. query: {
  363. baseId: item.warehouseId,
  364. positionId: item.binNumberId,
  365. warehouseName: item.warehouseName,
  366. binNumber: item.binNumber,
  367. capacity: item.capacity,
  368. warehouseType: this.warehouseType,
  369. warehouseId: item.warehouseId,
  370. },
  371. })
  372. },
  373. //入库
  374. warehousing(item) {
  375. var free = 0
  376. for (var i = 0; i < item.warehouseNumViewList.length; i++) {
  377. free += Number(item.warehouseNumViewList[i].storage)
  378. }
  379. this.$router.push({
  380. path: 'warehouseManagementPut',
  381. query: {
  382. baseId: item.warehouseId,
  383. positionId: item.binNumberId,
  384. warehouseName: item.warehouseName,
  385. binNumber: item.binNumber,
  386. capacity: item.capacity - free,
  387. id: item.id,
  388. warehouseType: this.warehouseType,
  389. createType: item.createType,
  390. },
  391. })
  392. },
  393. getSpanArr(data) {
  394. let that = this
  395. //页面展示的数据,不一定是全部的数据,所以每次都清空之前存储的 保证遍历的数据是最新的数据。以免造成数据渲染混乱
  396. that.spanArr = []
  397. that.pos = 0
  398. //遍历数据
  399. data.forEach((item, index) => {
  400. //判断是否是第一项
  401. // if (index === 0) {
  402. // this.spanArr.push(1)
  403. // this.pos = 0
  404. // } else {
  405. //不是第一项时,就根据标识去存储
  406. if (data[index].warehouseNumViewList.length > 1) {
  407. // 查找到符合条件的数据时每次要把之前存储的数据+1
  408. this.spanArr[this.pos] = data[index].warehouseNumViewList.length
  409. this.spanArr.push(0)
  410. } else {
  411. // 没有符合的数据时,要记住当前的index
  412. this.spanArr.push(1)
  413. this.pos = index
  414. }
  415. // }
  416. })
  417. },
  418. //待完成//传参
  419. nocomplete(row) {
  420. if (row.number > 0) {
  421. this.$router.push({
  422. path: 'warehouseManagementNoComplete',
  423. query: {
  424. baseId: row.warehouseId,
  425. positionId: row.binNumberId,
  426. warehouseName: row.warehouseName,
  427. binNumber: row.binNumber,
  428. warehouseType: this.warehouseType,
  429. createType: row.createType,
  430. },
  431. })
  432. }
  433. },
  434. //记录
  435. record(item) {
  436. this.$router.push({
  437. name: 'warehouseManagementRecord',
  438. query: {
  439. baseId: item.warehouseId,
  440. positionId: item.binNumberId,
  441. warehouseName: item.warehouseName,
  442. remark: item.remark,
  443. binNumber: item.binNumber,
  444. capacity: item.capacity,
  445. warehouseType: this.warehouseType,
  446. },
  447. })
  448. },
  449. //盘损
  450. loss(item) {
  451. this.$router.push({
  452. path: 'warehouseManagementIoss',
  453. query: {
  454. baseId: item.warehouseId,
  455. positionId: item.binNumberId,
  456. warehouseName: item.warehouseName,
  457. binNumber: item.binNumber,
  458. },
  459. })
  460. },
  461. changeradio(e) {
  462. this.getList()
  463. },
  464. //查看
  465. handleLook() {
  466. this.$router.push({ path: 'warehouseManagementLook' })
  467. },
  468. //添加
  469. handleAdd() {
  470. this.$router.push({ path: 'warehouseManagementAdd' })
  471. },
  472. //编辑
  473. handleEdit() {
  474. this.$router.push({ path: 'warehouseManagementEdit' })
  475. },
  476. handleDelete() {
  477. this.$router.push({ path: 'warehouseManagementDelete' })
  478. },
  479. //任务
  480. handlTask(){
  481. this.$router.push({ path: 'warehouseManagementPutOut' })
  482. },
  483. dateFormat(fmt, date) {
  484. let ret
  485. const opt = {
  486. 'Y+': date.getFullYear().toString(), // 年
  487. 'm+': (date.getMonth() + 1).toString(), // 月
  488. 'd+': date.getDate().toString(), // 日
  489. 'H+': date.getHours().toString(), // 时
  490. // "M+": date.getMinutes().toString(), // 分
  491. // "S+": date.getSeconds().toString() // 秒
  492. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  493. }
  494. for (let k in opt) {
  495. ret = new RegExp('(' + k + ')').exec(fmt)
  496. if (ret) {
  497. fmt = fmt.replace(
  498. ret[1],
  499. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  500. )
  501. }
  502. }
  503. return fmt
  504. },
  505. handleClose() {
  506. this.accessoryTFs = false
  507. },
  508. handleSizeChange(val) {
  509. console.log(`每页 ${val} 条`)
  510. this.pageSize = val
  511. this.getList()
  512. },
  513. handleCurrentChange(val) {
  514. this.currentPage = val
  515. console.log(`当前页: ${val}`)
  516. this.getList()
  517. },
  518. getList() {
  519. getList({
  520. compId: sessionStorage.getItem('ws-pf_compId'),
  521. warehouseName: this.warehouseName,
  522. warehouseType: this.warehouseType,
  523. })
  524. .toPromise()
  525. .then((response) => {
  526. this.warehouseList = response
  527. })
  528. },
  529. editClick(row) {
  530. var status = ''
  531. if (row.status == '待执行' || row.status == '已完成') {
  532. status = '执行中'
  533. } else if (row.status == '执行中') {
  534. status = '已完成'
  535. }
  536. //cancelButtonClass: "btn-custom-cancel"
  537. this.$confirm(`是否将状态改为${status}`, {
  538. confirmButtonText: '确定',
  539. cancelButtonText: '取消',
  540. type: 'warning',
  541. })
  542. .then(() => {
  543. editstatus({ id: row.id })
  544. .toPromise()
  545. .then((response) => {
  546. this.$notify.success({
  547. title: '成功',
  548. message: '状态修改成功',
  549. })
  550. this.getList()
  551. })
  552. .catch((response) => {
  553. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  554. })
  555. })
  556. .catch(() => {
  557. return false
  558. })
  559. },
  560. selecttaskType(e) {
  561. for (var i = 0; i < this.taskTypeList.length; i++) {
  562. if (this.taskTypeList[i].value == e) {
  563. this.searchType = this.taskTypeList[i].type
  564. }
  565. }
  566. },
  567. fujian(row) {
  568. if (
  569. row.receiveAttachmentPath === null ||
  570. row.receiveAttachmentPath === ''
  571. ) {
  572. EventBus.$emit(
  573. 'warning',
  574. this.$t('system.noticeCircular.NoInformation')
  575. )
  576. } else {
  577. this.accessoryTFs = true
  578. }
  579. this.appendixIdss = row.receiveAttachmentPath
  580. },
  581. handleExamine(row) {
  582. this.$router.push({
  583. name: 'salesContractExamine',
  584. query: { id: row.id },
  585. })
  586. },
  587. // 关闭 dialog时 处理文件url 初始化upload组件
  588. handleCloe() {
  589. this.dialogViewSpareMoney = false
  590. },
  591. history(row) {
  592. billoperatehis({ id: row.id })
  593. .toPromise()
  594. .then((response) => {
  595. this.historyList = response
  596. })
  597. },
  598. find() {
  599. this.currentPage = 1
  600. this.getList()
  601. },
  602. async exportlist() {
  603. const { data } = await export1(
  604. {
  605. compId: sessionStorage.getItem('ws-pf_compId'),
  606. contractType: this.contractType,
  607. currentPage: this.currentPage,
  608. pageSize: this.pageSize,
  609. searchType: this.searchType,
  610. searchKeyWord: this.searchKeyWord,
  611. startDate: this.startDate,
  612. endDate: this.endDate,
  613. },
  614. {},
  615. { responseType: 'blob' }
  616. ).toPromise()
  617. downloadFile({
  618. res: data,
  619. fileName: `${
  620. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  621. }_采购合同`,
  622. type: 'xls',
  623. })
  624. },
  625. },
  626. }
  627. </script>
  628. <style lang="scss" scoped>
  629. .connert {
  630. width: 90%;
  631. margin: 0 auto;
  632. }
  633. .vertical-text-left {
  634. width: 62px;
  635. text-align: right;
  636. }
  637. .el-button--primary {
  638. background-color: #5878e8;
  639. border-color: #5878e8;
  640. }
  641. .el-button--default {
  642. color: #8890b1;
  643. border-color: #e8eaf1;
  644. }
  645. /deep/.base_header_layout .grid-content.right .find.el-button--primary {
  646. width: 30px;
  647. margin-left: 0;
  648. border-top-left-radius: 0px;
  649. border-bottom-left-radius: 0px;
  650. }
  651. /deep/.findValue .el-input__inner {
  652. border-top-right-radius: 0px;
  653. border-bottom-right-radius: 0px;
  654. }
  655. .completed.el-button--default {
  656. border-color: #5878e8;
  657. background-color: #f6f7fc;
  658. color: #5878e8;
  659. }
  660. .putstorage.el-button--default,
  661. .deliverystorage.el-button--default {
  662. border-color: #8890b1;
  663. background-color: #fff;
  664. color: #8890b1;
  665. }
  666. /deep/.el-table td,
  667. /deep/.el-table th.is-leaf {
  668. border-right: 1px solid #e9ecf7;
  669. text-align: center;
  670. }
  671. /deep/.el-table tr td:first-child,
  672. /deep/.el-table tr th.is-leaf:first-child {
  673. border-left: 1px solid #e9ecf7;
  674. }
  675. /deep/.el-table .el-table__header .cell,
  676. /deep/.el-table .el-table__body .cell {
  677. -webkit-line-clamp: 10;
  678. max-height: 400px;
  679. }
  680. .record,
  681. .adjustment {
  682. display: inline-block;
  683. color: #5878e8;
  684. padding: 0 4px !important;
  685. position: relative;
  686. }
  687. .record:after {
  688. position: absolute;
  689. content: '';
  690. display: block;
  691. top: 5px;
  692. right: -2px;
  693. width: 1px;
  694. height: 12px;
  695. background: #e9ecf7;
  696. }
  697. /deep/.el-radio-button:first-child .el-radio-button__inner {
  698. margin-left: 10px;
  699. }
  700. </style>