warehouseManagementIoss.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <div class="container">
  3. <el-row>
  4. <el-col :span="20">
  5. <h2 class="bg-left title">&nbsp;&nbsp;盘损当期仓损</h2>
  6. </el-col>
  7. <el-col :span="4" class="bg-right">
  8. <el-button
  9. class="bg-bottom"
  10. type="primary"
  11. size="small"
  12. @click="returnWarehouse()"
  13. ><img
  14. width="6"
  15. height="10"
  16. style="vertical-align: bottom; margin-right: 3px"
  17. src="../../../public/img/lujing.png"
  18. alt=""
  19. />返回</el-button
  20. >
  21. </el-col>
  22. </el-row>
  23. <div class="center">
  24. <ws-form ref="deptBudgetList" :model="deptBudgetList" :rules="rules">
  25. <h2>
  26. {{ deptBudgetList1.warehouseName }}库
  27. <span class="position"> {{ deptBudgetList1.binNumber }}仓位 </span>
  28. </h2>
  29. <!-- 货名 -->
  30. <ws-form-item
  31. label="货名:"
  32. span="1"
  33. prop="goodsName"
  34. class="goodsname"
  35. >
  36. <ws-select
  37. v-model="deptBudgetList.goodsName"
  38. placeholder=""
  39. class="typeselect"
  40. @change="changeioss"
  41. >
  42. <ws-option
  43. v-for="item in goodnameList"
  44. :key="item.constKey"
  45. :label="item.goodsName"
  46. :value="item.goodsName"
  47. />
  48. </ws-select>
  49. </ws-form-item>
  50. <!--当期累计入库量-->
  51. <ws-form-item
  52. label="当期累计入库量(吨):"
  53. span="1"
  54. prop="cumulativeStockIn"
  55. class="readonly"
  56. >
  57. {{ deptBudgetList.cumulativeStockIn }}
  58. </ws-form-item>
  59. <!--实际库存(吨)-->
  60. <ws-form-item
  61. label="实际库存(吨):"
  62. span="1"
  63. prop="physicalInventory"
  64. class="readonly"
  65. >
  66. <ws-input
  67. v-model="deptBudgetList.physicalInventory"
  68. placeholder=""
  69. maxlength="100"
  70. size="small"
  71. />
  72. </ws-form-item>
  73. <!--当期累计出库量(吨)-->
  74. <ws-form-item
  75. label="当期累计出库量(吨):"
  76. span="1"
  77. prop="cumulativeStockOut"
  78. class="readonly"
  79. >
  80. {{ deptBudgetList.cumulativeStockOut }}
  81. </ws-form-item>
  82. <!--损耗量(吨)-->
  83. <ws-form-item
  84. label="损耗量(吨):"
  85. span="1"
  86. prop="ioss"
  87. class="readonly"
  88. >
  89. {{ ioss1 > 0 ? ioss1 : 0 }}
  90. </ws-form-item>
  91. <!--应余库存(吨)-->
  92. <ws-form-item
  93. label="应余库存(吨):"
  94. span="1"
  95. prop="surplusInventory"
  96. class="readonly"
  97. >
  98. {{ surplusInventory1 > 0 ? surplusInventory1 : 0 }}
  99. </ws-form-item>
  100. <!--库损比例-->
  101. <ws-form-item
  102. label="库损比例:"
  103. span="1"
  104. prop="inventoryRatio"
  105. class="readonly"
  106. >
  107. <!-- .占比=损耗量÷(累计入库-实际库存) -->
  108. <span class="proportion" v-show="inventoryRatio1 > 3"
  109. >{{ inventoryRatio1 > 0 ? inventoryRatio1 : 0 }} {{ '‰' }}</span
  110. >
  111. <span class="proportion1" v-show="inventoryRatio1 < 3"
  112. >{{ inventoryRatio1 > 0 ? inventoryRatio1 : 0 }} {{ '‰' }}</span
  113. >
  114. </ws-form-item>
  115. <p class="fontsize">
  116. 注:提交成功后,当期实际库存将作为下一期的初始库存。
  117. </p>
  118. </ws-form>
  119. <div style="text-align: right; padding: 10px">
  120. <el-button
  121. class="bg-bottom-up"
  122. type="primary"
  123. size="small"
  124. @click="submit()"
  125. >提交</el-button
  126. >
  127. </div>
  128. </div>
  129. </div>
  130. </template>
  131. <script>
  132. import { goodsname, ioss, submitioss } from '@/model/warehouse/index'
  133. import Pagination from '@/components/Pagination'
  134. import WsUpload from '@/components/WsUpload'
  135. import { mapActions, mapGetters, mapState } from 'vuex'
  136. // import { dayjs, fmoney, EventBus } from 'base-core-lib'
  137. import { dayjs } from 'base-core-lib'
  138. export default {
  139. name: 'viewSpareMoney',
  140. components: {
  141. WsUpload,
  142. Pagination,
  143. },
  144. watch: {
  145. vesselId(val) {
  146. this.loaddata()
  147. },
  148. isShow(val) {
  149. this.showType = val
  150. },
  151. },
  152. data() {
  153. return {
  154. //弹出框
  155. dialogViewSpareMoney: false,
  156. dialogApproveFormVisible: false,
  157. // 船舶类型
  158. monetaryKey: null,
  159. // 表格显示数据
  160. tableDate: [],
  161. // 是否显示
  162. showType: true,
  163. // 年
  164. year: '',
  165. deptBudgetTotal: 0,
  166. currentPage: 1,
  167. pageSize: 10,
  168. searchType: 1,
  169. searchKeyWord: '',
  170. contractType: 2,
  171. startDate: null,
  172. endDate: null,
  173. // 提交类型
  174. submitType: true,
  175. selectpackingMethod: {},
  176. goodnameList: [],
  177. size: 10,
  178. compId: sessionStorage.getItem('ws-pf_compId'),
  179. deptCircularPage: {},
  180. packtypeList: {},
  181. deptBudgetList1: [],
  182. date: {
  183. year: dayjs().format('YYYY'),
  184. month: dayjs().format('MM'),
  185. },
  186. contractList: [],
  187. deptBudgetList: {
  188. physicalInventory: 0,
  189. },
  190. historyList: [],
  191. rules: {
  192. netWeight: [
  193. {
  194. required: true,
  195. type: 'number',
  196. message: '请输入活动名称',
  197. trigger: 'blur',
  198. },
  199. ],
  200. },
  201. pickerBeginDateBefore: {
  202. disabledDate: (time) => {
  203. return time.getTime() > Date.now()
  204. },
  205. },
  206. accessoryTFs: false,
  207. }
  208. },
  209. computed: {
  210. ...mapGetters([
  211. 'userInfo',
  212. 'isFullScren',
  213. 'tagWel',
  214. 'tagList',
  215. 'isCollapse',
  216. 'tag',
  217. 'logsLen',
  218. 'logsFlag',
  219. 'language',
  220. ]),
  221. ioss1: function () {
  222. return (
  223. this.deptBudgetList.cumulativeStockIn -
  224. this.deptBudgetList.cumulativeStockOut -
  225. this.deptBudgetList.physicalInventory
  226. )
  227. },
  228. surplusInventory1: function () {
  229. return (
  230. this.deptBudgetList.cumulativeStockIn -
  231. this.deptBudgetList.cumulativeStockOut
  232. )
  233. },
  234. inventoryRatio1: function () {
  235. var loss =
  236. this.deptBudgetList.cumulativeStockIn -
  237. this.deptBudgetList.cumulativeStockOut -
  238. this.deptBudgetList.physicalInventory
  239. var defect =
  240. this.deptBudgetList.cumulativeStockIn -
  241. this.deptBudgetList.physicalInventory
  242. if (loss / defect == 1) {
  243. var num = 0
  244. } else {
  245. // .占比=损耗量÷(累计入库-实际库存)
  246. num = Math.floor((loss / defect) * 1000000) / 1000
  247. }
  248. return num
  249. },
  250. },
  251. activated() {
  252. //cg.viewBudget
  253. //cg.viewSpareMoney
  254. // this.getVesselData();
  255. this.loaddata()
  256. this.showType = this.isShow
  257. },
  258. mounted() {
  259. this.deptBudgetList.baseId = this.$route.query.baseId
  260. this.deptBudgetList.positionId = this.$route.query.positionId
  261. this.deptBudgetList.warehouseName = this.$route.query.warehouseName
  262. this.deptBudgetList.binNumber = this.$route.query.binNumber
  263. this.deptBudgetList1.warehouseName = this.$route.query.warehouseName
  264. this.deptBudgetList1.binNumber = this.deptBudgetList.binNumber
  265. this.deptBudgetList1.baseId = this.$route.query.baseId
  266. this.deptBudgetList1.positionId = this.deptBudgetList.positionId
  267. this.loaddata()
  268. // 货名
  269. // this.deptBudgetList.inventoryRatio=((deptBudgetList.cumulativeStockIn-deptBudgetList.cumulativeStockOut)-deptBudgetList.physicalInventory)/(deptBudgetList.cumulativeStockIn-deptBudgetList.physicalInventory)*100
  270. // this.deptBudgetList.ioss=(deptBudgetList.cumulativeStockIn-deptBudgetList.cumulativeStockOut)-deptBudgetList.physicalInventory
  271. // this.deptBudgetList1.goodsNameKey=this.deptBudgetList.goodsNameKey
  272. // this.getList()
  273. },
  274. methods: {
  275. //返回按钮
  276. returnWarehouse() {
  277. this.deptBudgetList.goodsName = ""
  278. this.$router.push({ path: 'warehouseManagementList' })
  279. },
  280. //提交按钮
  281. submit() {
  282. this.$refs.deptBudgetList.validate((valid) => {
  283. if (valid) {
  284. this.deptBudgetList.surplusInventory =
  285. this.deptBudgetList.cumulativeStockIn -
  286. this.deptBudgetList.cumulativeStockOut
  287. this.deptBudgetList.loss =
  288. this.deptBudgetList.cumulativeStockIn -
  289. this.deptBudgetList.cumulativeStockOut -
  290. this.deptBudgetList.physicalInventory
  291. this.deptBudgetList.inventoryRatio =
  292. (this.deptBudgetList.cumulativeStockIn -
  293. this.deptBudgetList.cumulativeStockOut -
  294. this.deptBudgetList.physicalInventory) /
  295. (this.deptBudgetList.cumulativeStockIn -
  296. this.deptBudgetList.physicalInventory)
  297. this.deptBudgetList.baseId = this.deptBudgetList1.baseId
  298. this.deptBudgetList.positionId = this.deptBudgetList1.positionId
  299. this.deptBudgetList.binNumber = this.deptBudgetList1.binNumber
  300. this.deptBudgetList.warehouseName = this.deptBudgetList1.warehouseName
  301. this.deptBudgetList.qualityInspector = this.userInfo.showRoleName
  302. for (var i = 0; i < this.goodnameList.length; i++) {
  303. if (
  304. this.goodnameList[i].goodsName == this.deptBudgetList.goodsName
  305. ) {
  306. this.deptBudgetList.goodsNameKey = this.goodnameList[
  307. i
  308. ].goodsNameKey
  309. }
  310. }
  311. this.deptBudgetList.compId = this.compId
  312. this.deptBudgetList.contractType = 1
  313. submitioss(this.deptBudgetList)
  314. .toPromise()
  315. .then((response) => {
  316. this.$message.success('提交成功')
  317. this.deptBudgetList.goodsName = ""
  318. this.$router.push({ path: 'warehouseManagementList' })
  319. })
  320. } else {
  321. //EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  322. return false
  323. }
  324. })
  325. },
  326. dateFormat(fmt, date) {
  327. let ret
  328. const opt = {
  329. 'Y+': date.getFullYear().toString(), // 年
  330. 'm+': (date.getMonth() + 1).toString(), // 月
  331. 'd+': date.getDate().toString(), // 日
  332. 'H+': date.getHours().toString(), // 时
  333. // "M+": date.getMinutes().toString(), // 分
  334. // "S+": date.getSeconds().toString() // 秒
  335. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  336. }
  337. for (let k in opt) {
  338. ret = new RegExp('(' + k + ')').exec(fmt)
  339. if (ret) {
  340. fmt = fmt.replace(
  341. ret[1],
  342. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  343. )
  344. }
  345. }
  346. return fmt
  347. },
  348. handleClose() {
  349. this.accessoryTFs = false
  350. },
  351. handleSizeChange(val) {
  352. console.log(`每页 ${val} 条`)
  353. this.pageSize = val
  354. this.getList()
  355. },
  356. handleCurrentChange(val) {
  357. this.currentPage = val
  358. console.log(`当前页: ${val}`)
  359. this.getList()
  360. },
  361. changeioss(e) {
  362. if(!this.deptBudgetList.baseId){
  363. this.deptBudgetList.baseId = this.$route.query.baseId
  364. this.deptBudgetList.positionId = this.deptBudgetList1.positionId
  365. this.deptBudgetList.binNumber = this.deptBudgetList1.binNumber
  366. }
  367. for (var i = 0; i < this.goodnameList.length; i++) {
  368. if (this.goodnameList[i].goodsName == e) {
  369. this.deptBudgetList.goodsNameKey = this.goodnameList[i].goodsNameKey
  370. }
  371. }
  372. this.ioss()
  373. },
  374. ioss() {
  375. ioss(this.deptBudgetList)
  376. .toPromise()
  377. .then((response) => {
  378. this.deptBudgetList = response
  379. })
  380. },
  381. loaddata() {
  382. // 货名
  383. goodsname({ positionId: this.$route.query.positionId })
  384. .toPromise()
  385. .then((response) => {
  386. this.goodnameList = response
  387. })
  388. },
  389. selecttaskType(e) {
  390. for (var i = 0; i < this.taskTypeList.length; i++) {
  391. if (this.taskTypeList[i].value == e) {
  392. this.searchType = this.taskTypeList[i].type
  393. }
  394. }
  395. },
  396. // // 关闭 dialog时 处理文件url 初始化upload组件
  397. // handleCloe() {
  398. // this.dialogViewSpareMoney = false
  399. // },
  400. // history(row) {
  401. // console.log(row)
  402. // billoperatehis({ id: row.id })
  403. // .toPromise()
  404. // .then((response) => {
  405. // this.historyList = response
  406. // })
  407. // },
  408. //删除
  409. // approve() {},
  410. // listQuery() {},
  411. // total() {},
  412. // clearfiltQuery() {},
  413. // selectCrtDuty() {},
  414. },
  415. }
  416. </script>
  417. <style lang="scss" scoped>
  418. .container {
  419. padding: 20px;
  420. }
  421. .center {
  422. top: 50px;
  423. width: 40%;
  424. height: 700px;
  425. margin: 0 auto;
  426. }
  427. /deep/.el-form-item__label {
  428. width: 160px;
  429. }
  430. /deep/.el-input--small {
  431. width: 70%;
  432. }
  433. /deep/.bg-right {
  434. padding-right: 10px;
  435. text-align: right;
  436. }
  437. .container .bg-bottom {
  438. margin: 15px 0px;
  439. }
  440. //仓位
  441. .position {
  442. background: #afb5cb;
  443. border-radius: 2px;
  444. font-size: 12px;
  445. color: #ffffff;
  446. line-height: 20px;
  447. display: inline-grid;
  448. padding: 2px 4px;
  449. }
  450. //表格
  451. .readonly {
  452. width: 49%;
  453. display: inline-flex;
  454. height: 40px;
  455. }
  456. /deep/.el-form-item__label {
  457. width: 170px;
  458. text-align: left;
  459. font-size: 14px;
  460. font-family: PingFangSC-Regular, PingFang SC;
  461. font-weight: 400;
  462. color: #8890b1;
  463. line-height: 16px;
  464. }
  465. //下拉框
  466. .goodsname {
  467. width: 40%;
  468. }
  469. .goodsname:first-child {
  470. width: 140px;
  471. }
  472. //注意字体
  473. .fontsize {
  474. width: 312px;
  475. height: 17px;
  476. font-size: 12px;
  477. font-family: PingFangSC-Regular, PingFang SC;
  478. font-weight: 400;
  479. color: #afb5cb;
  480. line-height: 17px;
  481. }
  482. //比例文字
  483. .proportion {
  484. color: #ff2c58;
  485. }
  486. .proportion1 {
  487. color: black;
  488. }
  489. .title {
  490. position: relative;
  491. }
  492. .title::before {
  493. content: '';
  494. display: inline-block;
  495. width: 5px;
  496. height: 30px;
  497. background: #5473e8;
  498. position: absolute;
  499. left: 0;
  500. }
  501. </style>