warehouseManagementIoss.vue 13 KB

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