warehouseManagementIoss.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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 {
  133. goodsname,
  134. ioss,
  135. submitioss,
  136. } from '@/model/warehouse/index'
  137. import Pagination from '@/components/Pagination'
  138. import WsUpload from '@/components/WsUpload'
  139. import { mapActions, mapGetters, mapState } from 'vuex'
  140. // import { dayjs, fmoney, EventBus } from 'base-core-lib'
  141. import { dayjs} from 'base-core-lib'
  142. export default {
  143. name: 'viewSpareMoney',
  144. components: {
  145. WsUpload,
  146. Pagination,
  147. },
  148. watch: {
  149. vesselId(val) {
  150. this.getList()
  151. },
  152. isShow(val) {
  153. this.showType = val
  154. },
  155. },
  156. data() {
  157. return {
  158. //弹出框
  159. dialogViewSpareMoney: false,
  160. dialogApproveFormVisible: false,
  161. // 船舶类型
  162. monetaryKey: null,
  163. // 表格显示数据
  164. tableDate: [],
  165. // 是否显示
  166. showType: true,
  167. // 年
  168. year: '',
  169. deptBudgetTotal: 0,
  170. currentPage: 1,
  171. pageSize: 10,
  172. searchType: 1,
  173. searchKeyWord: '',
  174. contractType: 2,
  175. startDate: null,
  176. endDate: null,
  177. // 提交类型
  178. submitType: true,
  179. selectpackingMethod: {},
  180. goodnameList:[],
  181. size: 10,
  182. compId: sessionStorage.getItem('ws-pf_compId'),
  183. deptCircularPage: {},
  184. packtypeList: {},
  185. deptBudgetList1:[],
  186. date: {
  187. year: dayjs().format('YYYY'),
  188. month: dayjs().format('MM'),
  189. },
  190. contractList: [],
  191. deptBudgetList:{
  192. physicalInventory:0
  193. },
  194. historyList: [],
  195. rules: {
  196. netWeight: [
  197. {
  198. required: true,
  199. type: 'number',
  200. message: '请输入活动名称',
  201. trigger: 'blur',
  202. },
  203. ],
  204. },
  205. pickerBeginDateBefore: {
  206. disabledDate: (time) => {
  207. return time.getTime() > Date.now()
  208. },
  209. },
  210. accessoryTFs: false,
  211. }
  212. },
  213. computed:{
  214. ...mapGetters([
  215. 'userInfo',
  216.       'isFullScren',
  217.       'tagWel',
  218.       'tagList',
  219.       'isCollapse',
  220.       'tag',
  221.       'logsLen',
  222.       'logsFlag',
  223.       'language',
  224.     ]),
  225. ioss1 :function() {
  226. return (this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.cumulativeStockOut)-this.deptBudgetList.physicalInventory
  227. },
  228. surplusInventory1: function(){
  229. return this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.cumulativeStockOut
  230. },
  231. inventoryRatio1 : function(){
  232. var loss=(this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.cumulativeStockOut)-this.deptBudgetList.physicalInventory
  233. var defect=this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.physicalInventory
  234. if((loss/defect)==1){
  235. var num=0
  236. }else{
  237. // .占比=损耗量÷(累计入库-实际库存)
  238. num = Math.floor((loss/defect)*1000000)/1000
  239. }
  240. return num;
  241. },
  242. },
  243. activated() {
  244. //cg.viewBudget
  245. //cg.viewSpareMoney
  246. // this.getVesselData();
  247. this.loaddata()
  248. this.showType = this.isShow
  249. },
  250. mounted() {
  251. this.deptBudgetList.baseId = this.$route.query.baseId
  252. this.deptBudgetList.positionId = this.$route.query.positionId
  253. this.deptBudgetList.warehouseName = this.$route.query.warehouseName
  254. this.deptBudgetList.binNumber = this.$route.query.binNumber
  255. this.deptBudgetList1.warehouseName = this.$route.query.warehouseName
  256. this.deptBudgetList1.binNumber = this.$route.query.binNumber
  257. this.deptBudgetList1.baseId=this.$route.query.baseId
  258. this.deptBudgetList1.positionId=this.$route.query.positionId
  259. // this.deptBudgetList.inventoryRatio=((deptBudgetList.cumulativeStockIn-deptBudgetList.cumulativeStockOut)-deptBudgetList.physicalInventory)/(deptBudgetList.cumulativeStockIn-deptBudgetList.physicalInventory)*100
  260. // this.deptBudgetList.ioss=(deptBudgetList.cumulativeStockIn-deptBudgetList.cumulativeStockOut)-deptBudgetList.physicalInventory
  261. // this.deptBudgetList1.goodsNameKey=this.deptBudgetList.goodsNameKey
  262. // this.getList()
  263. },
  264. methods: {
  265. //返回按钮
  266. returnWarehouse() {
  267. this.$router.push({ path: 'warehouseManagementList' })
  268. },
  269. //提交按钮
  270. submit(){
  271. this.$refs.deptBudgetList.validate((valid) => {
  272. if (valid) {
  273. this.deptBudgetList.surplusInventory=this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.cumulativeStockOut
  274. this.deptBudgetList.loss=(this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.cumulativeStockOut)-this.deptBudgetList.physicalInventory
  275. this.deptBudgetList.inventoryRatio=((this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.cumulativeStockOut)-this.deptBudgetList.physicalInventory)/(this.deptBudgetList.cumulativeStockIn-this.deptBudgetList.physicalInventory)
  276. this.deptBudgetList.baseId=this.deptBudgetList1.baseId
  277. this.deptBudgetList.positionId=this.deptBudgetList1.positionId
  278. this.deptBudgetList.binNumber=this.deptBudgetList1.binNumber
  279. this.deptBudgetList.warehouseName=this.deptBudgetList1.warehouseName
  280. this.deptBudgetList.qualityInspector= this.userInfo.showRoleName
  281. for (var i = 0; i < this.goodnameList.length; i++) {
  282. if (this.goodnameList[i].goodsName == this.deptBudgetList.goodsName) {
  283. this.deptBudgetList.goodsNameKey = this.goodnameList[i].goodsNameKey
  284. }
  285. }
  286. this.deptBudgetList.compId = this.compId
  287. this.deptBudgetList.contractType = 1
  288. console.log(this.deptBudgetList)
  289. submitioss(this.deptBudgetList)
  290. .toPromise()
  291. .then((response) => {
  292. this.$message.success('提交成功')
  293. this.$router.push({ path: 'warehouseManagementList' })
  294. })
  295. } else {
  296. //EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  297. return false
  298. }
  299. })
  300. },
  301. dateFormat(fmt, date) {
  302. let ret
  303. const opt = {
  304. 'Y+': date.getFullYear().toString(), // 年
  305. 'm+': (date.getMonth() + 1).toString(), // 月
  306. 'd+': date.getDate().toString(), // 日
  307. 'H+': date.getHours().toString(), // 时
  308. // "M+": date.getMinutes().toString(), // 分
  309. // "S+": date.getSeconds().toString() // 秒
  310. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  311. }
  312. for (let k in opt) {
  313. ret = new RegExp('(' + k + ')').exec(fmt)
  314. if (ret) {
  315. fmt = fmt.replace(
  316. ret[1],
  317. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  318. )
  319. }
  320. }
  321. return fmt
  322. },
  323. handleClose() {
  324. this.accessoryTFs = false
  325. },
  326. handleSizeChange(val) {
  327. console.log(`每页 ${val} 条`)
  328. this.pageSize = val
  329. this.getList()
  330. },
  331. handleCurrentChange(val) {
  332. this.currentPage = val
  333. console.log(`当前页: ${val}`)
  334. this.getList()
  335. },
  336. changeioss(e){
  337. for (var i = 0; i < this.goodnameList.length; i++) {
  338. if (this.goodnameList[i].goodsName == e) {
  339. this.deptBudgetList.goodsNameKey = this.goodnameList[i].goodsNameKey
  340. }
  341. }
  342. this.ioss()
  343. },
  344. ioss(){
  345. ioss(
  346. this.deptBudgetList
  347. )
  348. .toPromise()
  349. .then((response) => {
  350. this.deptBudgetList=response
  351. })
  352. },
  353. loaddata() {
  354. // 货名
  355. goodsname({positionId : this.$route.query.positionId})
  356. .toPromise()
  357. .then((response) => {
  358. this.goodnameList = response
  359. })
  360. },
  361. selecttaskType(e) {
  362. for (var i = 0; i < this.taskTypeList.length; i++) {
  363. if (this.taskTypeList[i].value == e) {
  364. this.searchType = this.taskTypeList[i].type
  365. }
  366. }
  367. },
  368. // deletecontract(){},
  369. //删除
  370. approve() {},
  371. listQuery() {},
  372. total() {},
  373. clearfiltQuery() {},
  374. selectCrtDuty() {},
  375. },
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. .container {
  380. padding: 20px;
  381. }
  382. .center {
  383. top: 50px;
  384. width: 40%;
  385. height: 700px;
  386. margin: 0 auto;
  387. }
  388. /deep/.el-form-item__label {
  389. width: 160px;
  390. }
  391. /deep/.el-input--small {
  392. width: 70%;
  393. }
  394. /deep/.bg-right {
  395. padding-right: 10px;
  396. text-align: right;
  397. }
  398. .container .bg-bottom {
  399. margin: 15px 0px;
  400. }
  401. //仓位
  402. .position {
  403. background: #afb5cb;
  404. border-radius: 2px;
  405. font-size: 12px;
  406. color: #ffffff;
  407. line-height: 20px;
  408. display: inline-grid;
  409. padding: 2px 4px;
  410. }
  411. //表格
  412. .readonly {
  413. width: 49%;
  414. display: inline-flex;
  415. height: 40px;
  416. }
  417. /deep/.el-form-item__label {
  418. width: 170px;
  419. text-align: left;
  420. font-size: 14px;
  421. font-family: PingFangSC-Regular, PingFang SC;
  422. font-weight: 400;
  423. color: #8890b1;
  424. line-height: 16px;
  425. }
  426. //下拉框
  427. .goodsname {
  428. width: 40%;
  429. }
  430. .goodsname:first-child {
  431. width: 140px;
  432. }
  433. //注意字体
  434. .fontsize {
  435. width: 312px;
  436. height: 17px;
  437. font-size: 12px;
  438. font-family: PingFangSC-Regular, PingFang SC;
  439. font-weight: 400;
  440. color: #afb5cb;
  441. line-height: 17px;
  442. }
  443. //比例文字
  444. .proportion {
  445. color: #ff2c58;
  446. }
  447. .proportion1 {
  448. color: black;
  449. }
  450. .title {
  451. position: relative;
  452. }
  453. .title::before {
  454. content: '';
  455. display: inline-block;
  456. width: 5px;
  457. height: 30px;
  458. background: #5473e8;
  459. position: absolute;
  460. left: 0;
  461. }
  462. </style>