warehouseReceiptEdit.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. // 修改仓单
  2. <template>
  3. <div class="center">
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left titleup">修改仓单</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button class="bg-bottom" type="primary" size="small" @click="cancel"><img width="6" height="10"
  10. style="vertical-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
  11. </el-button>
  12. </el-col>
  13. </el-row>
  14. <el-form ref="deptBudgetList" :rules="rules" :model="deptBudgetList" class="content2" :inline="true"
  15. label-position="right" label-width="120px">
  16. <!-- <ws-info-table class="el-table"> -->
  17. <div class="title1">申请信息</div>
  18. <el-form-item label="业务编号" span="1" prop="billNo" class="forlist">
  19. <el-input v-model="deptBudgetList.billNo" placeholder="请输入任务编号" maxlength="20" size="small" disabled></el-input>
  20. </el-form-item>
  21. <el-form-item label="名头" span="1" prop="taskNo" class="renown">
  22. <el-input v-model="deptBudgetList.renown" placeholder="请输入名头" maxlength="20" size="small" >
  23. </el-input>
  24. <!-- <el-select v-model="deptBudgetList.renown" placeholder="请选择名头" @change="changeCompOptionList" filterable
  25. clearable>
  26. <el-option :label="item.compName" :value="item.compId" v-for="(item,index) in compOptionList" :Key="index">
  27. </el-option>
  28. </el-select> -->
  29. </el-form-item>
  30. <el-form-item label="仓库名称" span="1" prop="warehouseName" class="forlist">
  31. <el-select v-model="deptBudgetList.warehouseName" placeholder="请选择仓库" @change="changeWarehouse" filterable
  32. clearable>
  33. <el-option :label="item.warehouseName" :value="item.id" v-for="(item,index) in warehouseList" :key="index">
  34. </el-option>
  35. </el-select>
  36. </el-form-item>
  37. <!-- <el-form-item label="仓位号" span="1" prop="warehouseNo" class="forlist">
  38. <el-select v-model="deptBudgetList.warehouseNo" placeholder="请选择仓位号" @change="changeWarehouseNo" filterable
  39. clearable>
  40. <el-option :label="item.binNumber" :value="item.id" v-for="(item,index) in cwNumberList" :key='index'>
  41. </el-option>
  42. </el-select>
  43. </el-form-item> -->
  44. <el-form-item label="仓库地址" span="1" prop="warehouseAddress" class="forlist">
  45. <el-input disabled v-model="deptBudgetList.warehouseAddress" placeholder="请输入仓库地址" size="small"></el-input>
  46. </el-form-item>
  47. <el-form-item prop="goodsName" label="货名" span="1">
  48. <el-select v-model="deptBudgetList.goodsName" disabled placeholder="请选择货名" @change="changeGoodsName" filterable
  49. clearable>
  50. <el-option v-for="(item,index) in goodsList" :key='index' :label="item.goodsName" :value="item.id">
  51. </el-option>
  52. </el-select>
  53. </el-form-item>
  54. <!-- <el-form-item prop="grade" label="品级" span="1">
  55. <el-select v-model="deptBudgetList.grade" placeholder="请选择品级" filterable clearable>
  56. <el-option label="一等" value="一等"></el-option>
  57. <el-option label="二等" value="二等"></el-option>
  58. <el-option label="三等" value="三等"></el-option>
  59. <el-option label="等外" value="等外"></el-option>
  60. </el-select>
  61. </el-form-item> -->
  62. <!-- <el-form-item label="现有储量" span="1" prop="nowWeight" class="forlist">
  63. <el-input disabled v-model="deptBudgetList.nowWeight" placeholder="请输入现有储量" size="small"></el-input>
  64. </el-form-item>
  65. <el-form-item label="可用储量(吨)" span="1" prop="useWeight" class="forlist">
  66. <el-input disabled v-model="deptBudgetList.useWeight" placeholder="请输入可用储量" size="small"></el-input>
  67. </el-form-item> -->
  68. <el-form-item label="货源" prop="weight" class="forlist supplyofgoods">
  69. <el-input disabled v-model="goodstext" placeholder="" size="small" >
  70. </el-input>
  71. <el-button @click='selectgoods' type="primary">选择货源</el-button>
  72. </el-form-item>
  73. <el-form-item label="本单重量(吨)" span="1" prop="weight" class="forlist">
  74. <el-input v-model="deptBudgetList.weight" placeholder="输入本次仓单申请所需的重量" size="small">
  75. </el-input>
  76. </el-form-item>
  77. <el-form-item label="折干重量(吨)" prop="weight" class="forlist">
  78. <el-input v-model="deptBudgetList.dryOutWeight" placeholder="输入折干重量" size="small" @input='inputChange'>
  79. </el-input>
  80. </el-form-item>
  81. <el-form-item label="单价(元/吨)" span="1" prop="unitPrice" class="forlist" @input='inputChange'>
  82. <el-input v-model="deptBudgetList.unitPrice" placeholder="输入粮食单价" size="small"></el-input>
  83. </el-form-item>
  84. <el-form-item label="货值(元)" span="1" prop="totalValue" class="forlist">
  85. <el-input type='number' v-model="deptBudgetList.totalValue" disabled placeholder="自动计算,不可编辑" size="small">
  86. </el-input>
  87. </el-form-item>
  88. <!-- <el-form-item label="申请比例(%)" span="1" prop="applicationProportion" class="forlist">
  89. <el-input v-model="deptBudgetList.applicationProportion" placeholder="输入申请比例" size="small"></el-input>
  90. </el-form-item> -->
  91. <el-form-item label="申请金额(元)" span="1" prop="interest" class="forlist">
  92. <el-input type='number' v-model="deptBudgetList.interest" placeholder="输入申请金额" size="small"></el-input>
  93. </el-form-item>
  94. <div>附件</div>
  95. <ws-upload ref="upload" :comp-id="compId" :appendix-ids="deptBudgetList.appendix" :size-limit="size"
  96. @onChange="onChange" accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar" />
  97. <div class="title1">外审部门</div>
  98. <el-form-item prop="bank" label="银行" span="1">
  99. <el-select v-model="deptBudgetList.bank" placeholder="请选择银行" @change="bankChange" filterable clearable>
  100. <el-option :label="item.constValue" :value="item.constValue" v-for="(item,index) in bankList" :key="index">
  101. </el-option>
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item label="第三方" span="1" prop="taskNo" class="forlist">
  105. <el-select v-model="deptBudgetList.three" placeholder="无" @change="threeChange" filterable clearable>
  106. <el-option :label="item1.constValue" :value="item1.constValue" v-for="(item1,index) in threeList"
  107. :key="index"></el-option>
  108. </el-select>
  109. </el-form-item>
  110. <div>
  111. <el-button @click="inoutput" type="primary" :disabled="!deptBudgetList.goodsName">出入库记录</el-button>
  112. <el-button @click="submit" type="primary">重新提交</el-button>
  113. </div>
  114. <div class="title1">审核记录</div>
  115. <el-table class="wenzi" :data="taskhistories" style="width: 100%">
  116. <el-table-column prop="operatorMajorRoleName" label="审核人">
  117. <template scope="scope">
  118. {{ scope.row.operatorMajorRoleName }}{{ scope.row.operatorName }}
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="inOutTaskNo" label="审核结果">
  122. <template scope="scope">
  123. <span v-if="scope.row.approved">通过</span>
  124. <span v-if="!scope.row.approved">驳回</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column prop="endTime" label="审核时间"></el-table-column>
  128. <el-table-column prop="auditMind" label="审核意见"></el-table-column>
  129. </el-table>
  130. <!-- </ws-info-table> -->
  131. </el-form>
  132. </div>
  133. </template>
  134. <script>
  135. import {
  136. getcompList,
  137. } from '@/model/signIn/index'
  138. import {
  139. getwarehousewarrantList,
  140. getWarehouseReceiptLook,
  141. editList,
  142. WarehouseReceiptUpdate,
  143. getWarehouseReceiptExamine, //审核记录
  144. WarehouseReceiptBankList,
  145. } from '@/model/tradeServicesManagement/index'
  146. import {
  147. xiala
  148. } from '@/model/warehouse/index'
  149. import * as global from '@/global'
  150. import {
  151. selectWarehouseSelf,
  152. } from '@/model/houseSelfCollect/index'
  153. import WsUpload from '@/components/WsUpload'
  154. import {
  155. lastEachIterate
  156. } from 'xe-utils/methods'
  157. export default {
  158. components: {
  159. WsUpload,
  160. },
  161. data() {
  162. return {
  163. deptBudgetList: {billNo:''},
  164. size: 10,
  165. compId: localStorage.getItem('ws-pf_compId'),
  166. rules: {
  167. // unitPrice: [
  168. // { required: true, message: '单价不能为空!', trigger: 'blur' },
  169. // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
  170. // ],
  171. },
  172. compOptionList: [],
  173. taskhistories: [],
  174. warehouseList: [],
  175. cwNumberList: [],
  176. goodsList: [],
  177. bankList: [],
  178. threeList: [],
  179. goodstext:'已选0辆车',
  180. db:{},
  181. }
  182. },
  183. async activated() {
  184. localStorage.removeItem("pageUp") //删除出入库跳返回时数据刷新的问题
  185. this.db=await global.default.openDB('warehouseReceipt')
  186. await this.getList()
  187. if(localStorage.getItem('warehouseReceipteditdata')){
  188. this.deptBudgetList=JSON.parse(localStorage.getItem('warehouseReceipteditdata'))
  189. var data=await global.default.getDataByKey(this.db,'signalChat',1)
  190. if(data){
  191. this.deptBudgetList.weight=''
  192. var weight = 0
  193. var pureWeight = 0
  194. if(data.modification&&data.modification.length>0){
  195. this.goodstext='已选'+data.modification.length+'辆车'
  196. for(let i=0;i<data.modification.length;i++){
  197. weight+=data.modification[i].netWeight
  198. pureWeight+=data.modification[i].pureWeight
  199. }
  200. this.deptBudgetList.goodsName = data.modification[0].goodsName
  201. this.changeGoodsName(this.deptBudgetList.goodsName)
  202. this.$set(this.deptBudgetList,'weight',weight.toFixed(2))
  203. if(this.deptBudgetList.goodsName.indexOf('潮粮')!=-1){
  204. this.$set(this.deptBudgetList,'dryOutWeight',pureWeight.toFixed(2))
  205. }else{
  206. this.$set(this.deptBudgetList,'dryOutWeight',weight.toFixed(2))
  207. }
  208. if( this.deptBudgetList.unitPrice){
  209. this.inputChange()
  210. }
  211. }
  212. }
  213. }
  214. },
  215. methods: {
  216. selectgoods(){
  217. localStorage.setItem('warehouseReceipteditdata',JSON.stringify(this.deptBudgetList))
  218. console.log(this.deptBudgetList)
  219. this.$router.push({
  220. name: 'warehouseReceipteditgoods',
  221. query: {
  222. baseId: this.deptBudgetList.baseId,
  223. positionId: this.deptBudgetList.warehouseNoId,
  224. warehouseName: this.deptBudgetList.warehouseName,
  225. warehouseType: this.deptBudgetList.warehouseType,
  226. warehouseNo:this.deptBudgetList.warehouseNo,
  227. }
  228. })
  229. },
  230. inputChange(e) {
  231. if (this.deptBudgetList.unitPrice && this.deptBudgetList.dryOutWeight) {
  232. this.deptBudgetList.totalValue = Number(this.deptBudgetList.unitPrice * this.deptBudgetList.dryOutWeight).toFixed(2)
  233. this.$set(this.deptBudgetList,'interest',this.deptBudgetList.totalValue)
  234. }
  235. },
  236. //银行改变
  237. bankChange(e) {
  238. this.deptBudgetList.bank = e
  239. },
  240. //第三方
  241. threeChange(e) {
  242. this.deptBudgetList.three = e
  243. },
  244. //返回
  245. cancel() {
  246. this.$router.push({
  247. path: 'warehouseReceiptRegulation'
  248. })
  249. },
  250. //出入库记录
  251. inoutput() {
  252. this.$router.push({
  253. name: 'inOutRecord',
  254. query: {
  255. baseId: this.deptBudgetList.baseId,
  256. positionId: this.deptBudgetList.warehouseNoId,
  257. warehouseName: this.deptBudgetList.warehouseName,
  258. warehouseNo: this.deptBudgetList.warehouseNo,
  259. nowWeight: this.deptBudgetList.nowWeight
  260. }
  261. })
  262. },
  263. //名头改变
  264. changeCompOptionList(val) {
  265. let _data = this.compOptionList
  266. for (let i = 0; i < _data.length; i++) {
  267. if (_data[i].compId == val) {
  268. this.deptBudgetList.renownId = _data[i].compId
  269. this.deptBudgetList.renown = _data[i].compName
  270. this.compId = val
  271. this.getWarehouse()
  272. }
  273. }
  274. },
  275. //货名切换
  276. changeGoodsName(val) {
  277. let _data = this.goodsList
  278. for (let i = 0; i < _data.length; i++) {
  279. if (_data[i].goodsName == val) {
  280. this.deptBudgetList.goodsNameKey = _data[i].goodsNameKey
  281. this.deptBudgetList.goodsName = _data[i].goodsName
  282. this.deptBudgetList.nowWeight = _data[i].storage
  283. this.deptBudgetList.useWeight = _data[i].useStorage
  284. return
  285. }
  286. }
  287. },
  288. //仓库切换
  289. async changeWarehouse(val) {
  290. let _data = this.warehouseList
  291. for (let i = 0; i < _data.length; i++) {
  292. if (_data[i].id == val) {
  293. var data=await global.default.getDataByKey(this.db,'signalChat',1)
  294. if(data){
  295. if(data.modification&&data.modification.length>0){
  296. global.default.deleteDB(this.db,'signalChat',1)
  297. this.deptBudgetList.weight = ''
  298. this.deptBudgetList.dryOutWeight = ''
  299. }
  300. }
  301. this.goodstext='已选0辆车'
  302. this.deptBudgetList.warehouseName = _data[i].warehouseName
  303. this.deptBudgetList.warehouseType =_data[i].warehouseType
  304. this.cwNumberList = _data[i].positionInfos.length != 0 ? _data[i].positionInfos : []
  305. this.deptBudgetList.warehouseNo = _data[i].positionInfos.length != 0 ? _data[i].positionInfos[0].binNumber :
  306. ''
  307. this.deptBudgetList.warehouseAddress = _data[i].warehousePrivate + _data[i].warehouseCity + _data[i]
  308. .warehouseArea + _data[i].detailedAddress
  309. // this.goodsList = _data[i].goodsNameInfos.length != 0 ? _data[i].goodsNameInfos : []
  310. this.deptBudgetList.nowWeight = _data[i].goodsNameInfos.length != 0 ? _data[i].goodsNameInfos[0].storage :
  311. ''
  312. this.deptBudgetList.useWeight = _data[i].goodsNameInfos[0].useStorage
  313. this.deptBudgetList.warehouseId = _data[i].id
  314. this.deptBudgetList.warehouseNoId = _data[i].positionInfos.length != 0 ? _data[i].positionInfos[0].id : ''
  315. this.deptBudgetList.baseId = _data[i].positionInfos.length != 0 ? _data[i].positionInfos[0].baseId : ''
  316. }
  317. }
  318. },
  319. //仓位号切换
  320. changeWarehouseNo(val) {
  321. let _data = this.cwNumberList
  322. for (let i = 0; i < _data.length; i++) {
  323. if (_data[i].id == val) {
  324. this.deptBudgetList.warehouseNoId = _data[i].id
  325. this.deptBudgetList.warehouseNo = _data[i].binNumber
  326. this.deptBudgetList.baseId = _data.baseId
  327. }
  328. }
  329. this.goodsList = []
  330. for (let j = 0; j < this.warehouseList.length; j++) {
  331. if (this.deptBudgetList.warehouseName == this.warehouseList[j].warehouseName) {
  332. for (let _num = 0; _num < this.warehouseList[j].goodsNameInfos.length; _num++) {
  333. if (this.deptBudgetList.warehouseNo == this.warehouseList[j].goodsNameInfos[_num].binNumber) {
  334. this.goodsList.push(this.warehouseList[j].goodsNameInfos[_num])
  335. }
  336. }
  337. }
  338. }
  339. if (this.goodsList.length == 0) {
  340. this.deptBudgetList.goodsName = ""
  341. this.deptBudgetList.nowWeight = ''
  342. this.deptBudgetList.useWeight = ""
  343. } else {
  344. this.deptBudgetList.goodsName = this.goodsList[0].goodsName
  345. this.deptBudgetList.nowWeight = this.goodsList[0].storage
  346. this.deptBudgetList.useWeight = this.goodsList[0].useStorage
  347. }
  348. },
  349. getcompList() {
  350. //公司名下拉
  351. getcompList()
  352. .toPromise()
  353. .then((res) => {
  354. this.compOptionList = res
  355. // this.deptBudgetList.renown = res[0].compName
  356. this.changeCompOptionList(res[0].compId)
  357. })
  358. .catch((err) => {})
  359. },
  360. async getWarehouse() {
  361. //获取仓库
  362. this.warehouseList = await xiala({
  363. compId: this.compId,
  364. warehouseType:1
  365. }).toPromise()
  366. var data=await global.default.getDataByKey(this.db,'signalChat',1)
  367. if(data){
  368. if(!data.modification||data.modification.length==0){
  369. this.changeWarehouse(this.deptBudgetList.warehouseId)
  370. }
  371. }else{
  372. this.changeWarehouse(this.deptBudgetList.warehouseId)
  373. }
  374. },
  375. async getList() {
  376. this.bankList = await WarehouseReceiptBankList({
  377. constId: "BANK1"
  378. }).toPromise()
  379. this.threeList = await WarehouseReceiptBankList({
  380. constId: "THREE1"
  381. }).toPromise()
  382. this.deptBudgetList = await getWarehouseReceiptLook({
  383. id: this.$route.query.id,
  384. workflowId: this.$route.query.workflowId
  385. })
  386. .toPromise()
  387. //审核记录
  388. this.taskhistories = await getWarehouseReceiptExamine({
  389. businessKey: this.$route.query.id,
  390. workflowId: this.$route.query.workflowId
  391. }).toPromise()
  392. this.getcompList()
  393. },
  394. async submit() {
  395. var data=await global.default.getDataByKey(this.db,'signalChat',1)
  396. if(data){
  397. if(data.modification){
  398. this.deptBudgetList.warehouseInOutInfoList=data.modification
  399. }
  400. }
  401. let isValidate = false
  402. isValidate = this.validate()
  403. if (isValidate) {
  404. WarehouseReceiptUpdate(this.deptBudgetList)
  405. .toPromise()
  406. .then((response) => {
  407. localStorage.removeItem('warehouseReceipteditdata')
  408. this.$message.success('提交成功')
  409. global.default.deleteDB(this.db,'signalChat',1)
  410. this.$router.push({
  411. path: 'warehouseReceiptRegulation'
  412. })
  413. // this.deptBudgetList = response
  414. })
  415. .catch((req) => {
  416. // this.tableData = response.records
  417. this.$message.error('提交失败')
  418. })
  419. }
  420. },
  421. // 附件改变事件
  422. onChange() {
  423. this.$refs.upload
  424. .handleSaveBill()
  425. .then(async (response) => {
  426. this.deptBudgetList.appendix = response
  427. })
  428. .catch((res) => {
  429. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  430. this.$refs.upload.clearFiles()
  431. })
  432. },
  433. validate() {
  434. function _Validate(min, max, saveNum, type, inputVal) {
  435. let _val1 = inputVal
  436. let _pointVal1 = _val1.toString().split('.')[1]
  437. if (_pointVal1 == undefined) _pointVal1 = 0
  438. if (typeof(_pointVal1) == 'string') _pointVal1 = _pointVal1.length
  439. if (Number(_val1) <= Number(max) && Number(_val1) >= Number(min) && _pointVal1 <= saveNum) {
  440. return false
  441. }
  442. return true
  443. }
  444. if (!this.deptBudgetList.weight ) {
  445. this.$message.error('本单重量不能为空!');
  446. return false
  447. }
  448. if (!this.deptBudgetList.unitPrice || _Validate(1, 20000, 3, '', this.deptBudgetList
  449. .unitPrice)) {
  450. if (!this.deptBudgetList.unitPrice) {
  451. this.$message.error('单价不能为空!');
  452. } else {
  453. this.$message.error('单价输入错误,1-20000之间,最多保留3位小数!');
  454. }
  455. return false
  456. }
  457. if (!this.deptBudgetList.totalValue) {
  458. this.$message.error('总价值不能为空!');
  459. return false
  460. }
  461. if (!this.deptBudgetList.interest || _Validate(1, 1000000000, 2, '', this.deptBudgetList
  462. .interest)) {
  463. if (!this.deptBudgetList.interest) {
  464. this.$message.error('申请金额不能为空!');
  465. } else {
  466. this.$message.error('申请金额输入错误,1-10亿之间,最多保留2位小数!');
  467. }
  468. return false
  469. }
  470. if (!this.deptBudgetList.appendix) {
  471. this.$message.error('附件不能为空!');
  472. return false
  473. } else if (this.deptBudgetList.appendix.split(',').length > 30) {
  474. this.$message.error('附件数量需小于30!');
  475. return false
  476. }
  477. if (!this.deptBudgetList.bank) {
  478. this.$message.error('银行不能为空!');
  479. return false
  480. }
  481. // if (!this.deptBudgetList.three) {
  482. // this.$message.error('第三方不能为空!')
  483. // return false
  484. // }
  485. return true
  486. },
  487. },
  488. }
  489. </script>
  490. <style lang="scss" scoped>
  491. /deep/.el-form-item__content {
  492. width: 400px;
  493. }
  494. /deep/.el-select {
  495. width: 100%;
  496. }
  497. .el-form {
  498. overflow: scroll;
  499. height: 94vh;
  500. }
  501. .bg-left {
  502. padding-left: 30px;
  503. }
  504. .bg-bottom {
  505. margin: 15px 0px;
  506. }
  507. .titleup {
  508. position: relative;
  509. }
  510. .titleup::before {
  511. content: '';
  512. display: inline-block;
  513. width: 5px;
  514. height: 30px;
  515. background: #5473e8;
  516. position: absolute;
  517. left: 0;
  518. }
  519. .bg-right {
  520. padding-right: 10px;
  521. text-align: right;
  522. }
  523. .center {
  524. background: #f6f7fc;
  525. }
  526. .content2 {
  527. background: white;
  528. // padding:0 200px;
  529. // text-align: center;
  530. padding-left: 40px;
  531. }
  532. .title1 {
  533. font-size: 20px;
  534. font-weight: 600;
  535. margin: 20px 0;
  536. }
  537. .supplyofgoods .el-input{
  538. width:75%;
  539. }
  540. </style>