warehouseManagementList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <!--仓库管理-->
  2. <template>
  3. <div>
  4. <BaseHeaderLayout :leftSpan="20">
  5. <template slot="left">
  6. <ws-button
  7. type="primary"
  8. @click="handleLook()"
  9. v-hasPermission="
  10. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  11. "
  12. >查看</ws-button
  13. >
  14. <ws-button
  15. type="primary"
  16. @click="handleAdd()"
  17. v-hasPermission="
  18. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  19. "
  20. >添加</ws-button
  21. >
  22. <ws-button
  23. type="primary"
  24. @click="handleEdit()"
  25. v-hasPermission="
  26. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  27. "
  28. >编辑</ws-button
  29. >
  30. <ws-button
  31. type="primary"
  32. @click="handleDelete()"
  33. v-hasPermission="
  34. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  35. "
  36. >删除</ws-button
  37. >
  38. </template>
  39. <template slot="right">
  40. <ws-input
  41. v-model="searchKeyWord"
  42. placeholder="请输入仓库名"
  43. clearable
  44. maxlength="500"
  45. type="input"
  46. class="findValue"
  47. ></ws-input>
  48. <!-- v-hasPermission="'procurement.sparepart.directShip'" -->
  49. <ws-button
  50. class="find"
  51. type="primary"
  52. @click="find()"
  53. v-hasPermission="
  54. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  55. "
  56. ><img
  57. width="16"
  58. height="16"
  59. style="
  60. vertical-align: text-top;
  61. position: relative;
  62. top: 0px;
  63. left: -8px;
  64. "
  65. src="../../../public/img/sousuo.png"
  66. alt=""
  67. /></ws-button>
  68. </template>
  69. </BaseHeaderLayout>
  70. <div class="connert">
  71. <el-table
  72. class="wenzi"
  73. :data="warehouseList"
  74. style="width: 100%; margin-top: 20px"
  75. height="780"
  76. >
  77. <el-table-column prop="warehouseName" label="库房名" width="80">
  78. </el-table-column>
  79. <el-table-column prop="binNumber" label="仓位编号" width="80">
  80. </el-table-column>
  81. <el-table-column prop="capacity" label="容量(吨)">
  82. <template slot-scope="scope">
  83. <div
  84. v-if="scope.row.capacity != 'null' && scope.row.capacity != null"
  85. >
  86. {{ scope.row.capacity }}
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="品种">
  91. <template slot-scope="scope">
  92. <div v-for="(item, i) in scope.row.warehouseNumViewList">
  93. {{ item.goodsName }}
  94. </div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="入库量(吨)">
  98. <template slot-scope="scope">
  99. <div v-for="(item, i) in scope.row.warehouseNumViewList">
  100. {{ item.inNetWeight }}
  101. </div>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="出库量(吨)">
  105. <template slot-scope="scope">
  106. <div v-for="(item, i) in scope.row.warehouseNumViewList">
  107. {{ item.outNetWeight }}
  108. </div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="应余量(吨)">
  112. <template slot-scope="scope">
  113. <div v-for="(item, i) in scope.row.warehouseNumViewList">
  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
  121. type="primary"
  122. @click="nocomplete()"
  123. v-hasPermission="
  124. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  125. "
  126. >
  127. 待完成({{ scope.row.number }})
  128. </ws-button>
  129. <ws-button
  130. type="primary"
  131. @click="warehousing(scope.row)"
  132. v-hasPermission="
  133. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  134. "
  135. >
  136. 入库
  137. </ws-button>
  138. <ws-button
  139. type="primary"
  140. @click="delivery(scope.row)"
  141. v-hasPermission="
  142. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  143. "
  144. >
  145. 出库
  146. </ws-button>
  147. </template>
  148. </el-table-column>
  149. <el-table-column prop="address" label="操作" width="200">
  150. <!-- <template slot-scope="scope"> -->
  151. <ws-button
  152. type="primary"
  153. @click="record()"
  154. v-hasPermission="
  155. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  156. "
  157. >记录</ws-button
  158. >
  159. <ws-button
  160. type="primary"
  161. @click="loss()"
  162. v-hasPermission="
  163. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  164. "
  165. >盘损</ws-button
  166. >
  167. <!-- </template> -->
  168. </el-table-column>
  169. </el-table>
  170. </div>
  171. </div>
  172. </template>
  173. <script>
  174. import {
  175. getList,
  176. export1,
  177. editstatus,
  178. billoperatehis,
  179. } from '@/model/warehouse/index'
  180. import { downloadFile } from '@/utils/batchDown'
  181. import Pagination from '@/components/Pagination'
  182. import WsUpload from '@/components/WsUpload'
  183. import { dayjs, fmoney, EventBus } from 'base-core-lib'
  184. export default {
  185. name: 'viewSpareMoney',
  186. components: {
  187. WsUpload,
  188. Pagination,
  189. },
  190. watch: {
  191. vesselId(val) {
  192. this.getList()
  193. },
  194. isShow(val) {
  195. this.showType = val
  196. },
  197. },
  198. data() {
  199. return {
  200. //弹出框
  201. dialogViewSpareMoney: false,
  202. dialogApproveFormVisible: false,
  203. // 船舶类型
  204. monetaryKey: null,
  205. // 表格显示数据
  206. tableDate: [],
  207. // 是否显示
  208. showType: true,
  209. // 年
  210. year: '',
  211. currentPage: 1,
  212. pageSize: 10,
  213. searchType: 1,
  214. searchTypeText: '未完成',
  215. searchKeyWord: '',
  216. contractType: 2,
  217. startDate: null,
  218. endDate: null,
  219. // 提交类型
  220. submitType: true,
  221. size: 10,
  222. spanArr: [],
  223. compId: sessionStorage.getItem('ws-pf_compId'),
  224. deptCircularPage: {},
  225. date: {
  226. year: dayjs().format('YYYY'),
  227. month: dayjs().format('MM'),
  228. },
  229. warehouseList: [],
  230. deptBudgetList: {},
  231. historyList: [],
  232. pickerBeginDateBefore: {
  233. disabledDate: (time) => {
  234. return time.getTime() > Date.now()
  235. },
  236. },
  237. accessoryTFs: false,
  238. }
  239. },
  240. activated() {
  241. //cg.viewBudget
  242. //cg.viewSpareMoney
  243. // this.getVesselData();
  244. this.getList()
  245. this.showType = this.isShow
  246. },
  247. methods: {
  248. //出库
  249. delivery(item) {
  250. this.$router.push({
  251. path: 'warehouseManagementDelivery',
  252. query: {
  253. baseId: item.warehouseId,
  254. positionId: item.binNumberId,
  255. warehouseName: item.warehouseName,
  256. binNumber: item.binNumber,
  257. },
  258. })
  259. },
  260. //入库
  261. warehousing(item) {
  262. this.$router.push({
  263. path: 'warehouseManagementPut',
  264. query: {
  265. baseId: item.warehouseId,
  266. positionId: item.binNumberId,
  267. warehouseName: item.warehouseName,
  268. binNumber: item.binNumber,
  269. },
  270. })
  271. },
  272. getSpanArr(data) {
  273. let that = this
  274. //页面展示的数据,不一定是全部的数据,所以每次都清空之前存储的 保证遍历的数据是最新的数据。以免造成数据渲染混乱
  275. that.spanArr = []
  276. that.pos = 0
  277. //遍历数据
  278. data.forEach((item, index) => {
  279. //判断是否是第一项
  280. // if (index === 0) {
  281. // this.spanArr.push(1)
  282. // this.pos = 0
  283. // } else {
  284. //不是第一项时,就根据标识去存储
  285. console.log(data[index].warehouseNumViewList.length)
  286. if (data[index].warehouseNumViewList.length > 1) {
  287. // 查找到符合条件的数据时每次要把之前存储的数据+1
  288. this.spanArr[this.pos] = data[index].warehouseNumViewList.length
  289. this.spanArr.push(0)
  290. } else {
  291. // 没有符合的数据时,要记住当前的index
  292. this.spanArr.push(1)
  293. this.pos = index
  294. }
  295. // }
  296. })
  297. },
  298. //待完成
  299. nocomplete() {
  300. this.$router.push({ path: 'warehouseManagementNoComplete' })
  301. },
  302. //记录
  303. record() {
  304. this.$router.push({ path: 'warehouseManagementRecord' })
  305. },
  306. //盘损
  307. loss() {
  308. // console.log(row.positionId)
  309. // this.$router.push({
  310. // name: 'warehouseManagementIoss',
  311. // params: {positionId: row.positionId },
  312. // })
  313. this.$router.push({ path: 'warehouseManagementIoss' })
  314. },
  315. //查看
  316. handleLook() {
  317. this.$router.push({ path: 'warehouseManagementLook' })
  318. },
  319. //添加
  320. handleAdd() {
  321. this.$router.push({ path: 'warehouseManagementAdd' })
  322. },
  323. //编辑
  324. handleEdit() {
  325. this.$router.push({ path: 'warehouseManagementEdit' })
  326. },
  327. handleDelete() {
  328. this.$router.push({ path: 'warehouseManagementDelete' })
  329. },
  330. dateFormat(fmt, date) {
  331. let ret
  332. const opt = {
  333. 'Y+': date.getFullYear().toString(), // 年
  334. 'm+': (date.getMonth() + 1).toString(), // 月
  335. 'd+': date.getDate().toString(), // 日
  336. 'H+': date.getHours().toString(), // 时
  337. // "M+": date.getMinutes().toString(), // 分
  338. // "S+": date.getSeconds().toString() // 秒
  339. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  340. }
  341. for (let k in opt) {
  342. ret = new RegExp('(' + k + ')').exec(fmt)
  343. if (ret) {
  344. fmt = fmt.replace(
  345. ret[1],
  346. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  347. )
  348. }
  349. }
  350. return fmt
  351. },
  352. handleClose() {
  353. this.accessoryTFs = false
  354. },
  355. handleSizeChange(val) {
  356. console.log(`每页 ${val} 条`)
  357. this.pageSize = val
  358. this.getList()
  359. },
  360. handleCurrentChange(val) {
  361. this.currentPage = val
  362. console.log(`当前页: ${val}`)
  363. this.getList()
  364. },
  365. getList() {
  366. getList({
  367. compId: sessionStorage.getItem('ws-pf_compId'),
  368. })
  369. .toPromise()
  370. .then((response) => {
  371. this.getSpanArr(response)
  372. // for (var i = 0; i < response.records.length; i++) {
  373. // if (response.records[i].addressUrl != null) {
  374. // response.records[i].addressUrlArray = response.records[
  375. // i
  376. // ].addressUrl.split(',')
  377. // } else {
  378. // response.records[i].addressUrlArray = []
  379. // }
  380. // }
  381. // this.deptCircularPage.currentPage = response.current
  382. // this.deptCircularPage.pageSize = response.size
  383. // this.deptBudgetTotal = response.total
  384. this.warehouseList = response
  385. })
  386. },
  387. editClick(row) {
  388. var status = ''
  389. if (row.status == '待执行' || row.status == '已完成') {
  390. status = '执行中'
  391. } else if (row.status == '执行中') {
  392. status = '已完成'
  393. }
  394. //cancelButtonClass: "btn-custom-cancel"
  395. this.$confirm(`是否将状态改为${status}`, {
  396. confirmButtonText: '确定',
  397. cancelButtonText: '取消',
  398. type: 'warning',
  399. })
  400. .then(() => {
  401. editstatus({ id: row.id })
  402. .toPromise()
  403. .then((response) => {
  404. this.$notify.success({
  405. title: '成功',
  406. message: '状态修改成功',
  407. })
  408. this.getList()
  409. })
  410. .catch((response) => {
  411. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  412. })
  413. })
  414. .catch(() => {
  415. return false
  416. })
  417. },
  418. selecttaskType(e) {
  419. for (var i = 0; i < this.taskTypeList.length; i++) {
  420. if (this.taskTypeList[i].value == e) {
  421. this.searchType = this.taskTypeList[i].type
  422. }
  423. }
  424. },
  425. fujian(row) {
  426. if (
  427. row.receiveAttachmentPath === null ||
  428. row.receiveAttachmentPath === ''
  429. ) {
  430. EventBus.$emit(
  431. 'warning',
  432. this.$t('system.noticeCircular.NoInformation')
  433. )
  434. } else {
  435. this.accessoryTFs = true
  436. }
  437. this.appendixIdss = row.receiveAttachmentPath
  438. },
  439. handleExamine(row) {
  440. this.$router.push({
  441. name: 'salesContractExamine',
  442. query: { id: row.id },
  443. })
  444. },
  445. // 关闭 dialog时 处理文件url 初始化upload组件
  446. handleCloe() {
  447. this.dialogViewSpareMoney = false
  448. },
  449. history(row) {
  450. console.log(row)
  451. billoperatehis({ id: row.id })
  452. .toPromise()
  453. .then((response) => {
  454. this.historyList = response
  455. })
  456. },
  457. find() {
  458. this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
  459. this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
  460. this.currentPage = 1
  461. this.getList()
  462. },
  463. async exportlist() {
  464. const { data } = await export1(
  465. {
  466. compId: sessionStorage.getItem('ws-pf_compId'),
  467. contractType: this.contractType,
  468. currentPage: this.currentPage,
  469. pageSize: this.pageSize,
  470. searchType: this.searchType,
  471. searchKeyWord: this.searchKeyWord,
  472. startDate: this.startDate,
  473. endDate: this.endDate,
  474. },
  475. {},
  476. { responseType: 'blob' }
  477. ).toPromise()
  478. downloadFile({
  479. res: data,
  480. fileName: `${
  481. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  482. }_采购合同`,
  483. type: 'xls',
  484. })
  485. },
  486. },
  487. }
  488. </script>
  489. <style lang="scss" scoped>
  490. .connert {
  491. width: 90%;
  492. margin: 0 auto;
  493. }
  494. .vertical-text-left {
  495. width: 62px;
  496. text-align: right;
  497. }
  498. </style>