|
@@ -6,7 +6,7 @@
|
6
|
6
|
<div class="app-container ">
|
7
|
7
|
<div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
|
8
|
8
|
<div>
|
9
|
|
- <span>供应商:</span>
|
|
9
|
+ <span style="color:red">*</span><span>供应商:</span>
|
10
|
10
|
<el-select v-model="supplier_name" style="width:140px;margin-right:10px;" placeholder="请选择"
|
11
|
11
|
@change="changeTypeName">
|
12
|
12
|
<el-option
|
|
@@ -48,36 +48,45 @@
|
48
|
48
|
|
49
|
49
|
</div>
|
50
|
50
|
<div>
|
51
|
|
- <el-button size="small" type="primary" @click="savePurchaseOrder">保存</el-button>
|
|
51
|
+ <el-button size="small" type="primary" @click="savePurchaseOrder" v-show="showTwo">保存</el-button>
|
|
52
|
+ <el-button size="small" type="primary" @click="updatePurchaseOrder" v-show="showOne">修改</el-button>
|
52
|
53
|
</div>
|
53
|
54
|
</div>
|
54
|
55
|
|
55
|
|
-
|
|
56
|
+ <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
|
56
|
57
|
<el-table
|
57
|
58
|
:row-style="{ color: '#303133' }"
|
58
|
59
|
:header-cell-style="{
|
59
|
60
|
backgroundColor: 'rgb(245, 247, 250)',
|
60
|
61
|
color: '#606266'
|
61
|
62
|
}"
|
62
|
|
- :data="tableList"
|
|
63
|
+ :data="recordInfo.tableList"
|
63
|
64
|
:class="signAndWeighBoxPatients"
|
64
|
65
|
border
|
65
|
66
|
style="width: 100%"
|
66
|
67
|
max-height="450"
|
67
|
68
|
>
|
68
|
|
- <el-table-column label="商品" align="center" width="200px">
|
|
69
|
+ <el-table-column align="center" width="200px">
|
|
70
|
+ <template slot="header" slot-scope="scope">
|
|
71
|
+ <span>商品<span style="color: red">*</span></span>
|
|
72
|
+ </template>
|
69
|
73
|
<template slot-scope="scope">
|
|
74
|
+ <el-form-item required prop="name">
|
70
|
75
|
<el-select v-model="scope.row.name" style="width:160px;" filterable placeholder="请选择" @change="changeName" @input="changeGoodName(scope.$index)">
|
71
|
|
- <el-option
|
72
|
|
- v-for="(item,index) in tabList"
|
73
|
|
- :key="index"
|
74
|
|
- :label="item.supply_name"
|
75
|
|
- :value="item">
|
76
|
|
- </el-option>
|
77
|
|
- </el-select>
|
|
76
|
+ <el-option
|
|
77
|
+ v-for="(item,index) in tabList"
|
|
78
|
+ :key="index"
|
|
79
|
+ :label="item.supply_name"
|
|
80
|
+ :value="item">
|
|
81
|
+ </el-option>
|
|
82
|
+ </el-select>
|
|
83
|
+ </el-form-item>
|
78
|
84
|
</template>
|
79
|
85
|
</el-table-column>
|
80
|
|
- <el-table-column label="商品类别" align="center" width="150px">
|
|
86
|
+ <el-table-column align="center" width="150px">
|
|
87
|
+ <template slot="header" slot-scope="scope">
|
|
88
|
+ <span>商品类别</span>
|
|
89
|
+ </template>
|
81
|
90
|
<template slot-scope="scope">
|
82
|
91
|
<el-input v-model="scope.row.supply_type" style="width:120px" :disabled="true"></el-input>
|
83
|
92
|
</template>
|
|
@@ -93,8 +102,13 @@
|
93
|
102
|
</template>
|
94
|
103
|
</el-table-column>
|
95
|
104
|
<el-table-column label="数量" align="center" width="120px">
|
|
105
|
+ <template slot="header" slot-scope="scope">
|
|
106
|
+ <span>数量<span style="color: red">*</span></span>
|
|
107
|
+ </template>
|
96
|
108
|
<template slot-scope="scope">
|
97
|
|
- <el-input v-model="scope.row.supply_count" style="width:80px"></el-input>
|
|
109
|
+ <el-form-item :rules="tableRules.supply_count" required prop="supply_count">
|
|
110
|
+ <el-input v-model="scope.row.supply_count" style="width:80px"></el-input>
|
|
111
|
+ </el-form-item>
|
98
|
112
|
</template>
|
99
|
113
|
</el-table-column>
|
100
|
114
|
|
|
@@ -151,6 +165,7 @@
|
151
|
165
|
</template>
|
152
|
166
|
</el-table-column>
|
153
|
167
|
</el-table>
|
|
168
|
+</el-form>
|
154
|
169
|
<div style="margin-top:10px">
|
155
|
170
|
<span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
|
156
|
171
|
|
|
@@ -164,7 +179,7 @@
|
164
|
179
|
<script>
|
165
|
180
|
import BreadCrumb from "@/xt_pages/components/bread-crumb";
|
166
|
181
|
|
167
|
|
-import {getInitOrder} from "@/api/supply"
|
|
182
|
+import {getInitOrder,savePurchaseOrder} from "@/api/supply"
|
168
|
183
|
export default {
|
169
|
184
|
name: "addPurchaseOrder",
|
170
|
185
|
created() {
|
|
@@ -188,9 +203,14 @@ BreadCrumb
|
188
|
203
|
data() {
|
189
|
204
|
return {
|
190
|
205
|
crumbs: [
|
191
|
|
- { path: false, name: "购货订单" },
|
192
|
|
- { path: "/spply/query", name: "新增购货订单" }
|
|
206
|
+ { path: false, name: "购货订单" },
|
|
207
|
+ { path: "/spply/query", name: "新增购货订单" }
|
193
|
208
|
],
|
|
209
|
+ showTwo:true,
|
|
210
|
+ showOne:false,
|
|
211
|
+ recordInfo: {
|
|
212
|
+ tableList:[],
|
|
213
|
+ },
|
194
|
214
|
keywords: "",
|
195
|
215
|
total: 0,
|
196
|
216
|
multipleSelection: [],
|
|
@@ -203,7 +223,6 @@ return {
|
203
|
223
|
goodInfo: [],
|
204
|
224
|
org_id:0,
|
205
|
225
|
types:[],
|
206
|
|
- tableList:[],
|
207
|
226
|
tyep_name:"",
|
208
|
227
|
form:{
|
209
|
228
|
manufacturer_id:"",
|
|
@@ -217,9 +236,16 @@ return {
|
217
|
236
|
supplyList:[],
|
218
|
237
|
rate_of_concession:"",
|
219
|
238
|
discount_amount:"",
|
|
239
|
+ start_time:new Date(),
|
|
240
|
+ end_time:new Date(),
|
|
241
|
+ tableRules: {
|
|
242
|
+ name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
|
|
243
|
+ supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
|
|
244
|
+ },
|
220
|
245
|
};
|
221
|
246
|
},
|
222
|
247
|
methods:{
|
|
248
|
+
|
223
|
249
|
getInitOrder(){
|
224
|
250
|
getInitOrder().then(response=>{
|
225
|
251
|
if(response.data.state == 1){
|
|
@@ -293,21 +319,26 @@ changeGoodName(val){
|
293
|
319
|
},
|
294
|
320
|
changeName(val){
|
295
|
321
|
|
296
|
|
- for(let i=0;i<this.tableList.length;i++){
|
|
322
|
+ for(let i=0;i<this.recordInfo.tableList.length;i++){
|
297
|
323
|
if(this.currentIndex == i){
|
298
|
|
- this.tableList[i].id = val.id
|
299
|
|
- this.tableList[i].type = val.type
|
300
|
|
- this.tableList[i].name = val.name
|
301
|
|
- this.tableList[i].supply_name = val.supply_name
|
302
|
|
- this.tableList[i].supply_type = val.supply_type
|
303
|
|
- this.tableList[i].supply_specification_name = val.supply_specification_name
|
304
|
|
- this.tableList[i].supply_total = val.supply_total
|
305
|
|
- this.tableList[i].supply_count = val.supply_count
|
306
|
|
- this.tableList[i].supply_price = val.supply_price
|
307
|
|
- this.tableList[i].supply_total_price = val.supply_total_price
|
308
|
|
- this.tableList[i].supply_manufacturer = val.supply_manufacturer
|
309
|
|
- this.tableList[i].supply_license_number = val.supply_license_number
|
310
|
|
- this.tableList[i].supply_remake = val.supply_remake
|
|
324
|
+ this.recordInfo.tableList[i].id = val.id
|
|
325
|
+ this.recordInfo.tableList[i].type = val.type
|
|
326
|
+ this.recordInfo.tableList[i].name = val.name
|
|
327
|
+ this.recordInfo.tableList[i].supply_name = val.supply_name
|
|
328
|
+ this.recordInfo.tableList[i].supply_type = val.supply_type
|
|
329
|
+ this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name
|
|
330
|
+ this.recordInfo.tableList[i].supply_total = val.supply_total
|
|
331
|
+ if(val.supply_count == NaN){
|
|
332
|
+ this.recordInfo.tableList[i].supply_count = ""
|
|
333
|
+ }else{
|
|
334
|
+ this.recordInfo.tableList[i].supply_count = val.supply_count?val.supply_count:""
|
|
335
|
+ }
|
|
336
|
+
|
|
337
|
+ this.recordInfo.tableList[i].supply_price = val.supply_price?val.supply_price:""
|
|
338
|
+ this.recordInfo.tableList[i].supply_total_price = val.supply_total_price?val.supply_total_price:""
|
|
339
|
+ this.recordInfo.tableList[i].supply_manufacturer = val.supply_manufacturer
|
|
340
|
+ this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
|
|
341
|
+ this.recordInfo.tableList[i].supply_remake = val.supply_remake
|
311
|
342
|
}
|
312
|
343
|
}
|
313
|
344
|
|
|
@@ -319,38 +350,62 @@ handleEdit(){
|
319
|
350
|
tempObj['supply_name'] = ""
|
320
|
351
|
tempObj['supply_type'] = ""
|
321
|
352
|
tempObj['supply_specification_name'] = ''
|
322
|
|
- tempObj['supply_total'] = ''
|
323
|
|
- tempObj['supply_count'] = ''
|
324
|
|
- tempObj['supply_price'] = ''
|
325
|
|
- tempObj['supply_total_price'] = ''
|
|
353
|
+ tempObj['supply_total'] = ""
|
|
354
|
+ tempObj['supply_count'] = ""
|
|
355
|
+ tempObj['supply_price'] = ""
|
|
356
|
+ tempObj['supply_total_price'] = ""
|
326
|
357
|
tempObj['supply_manufacturer'] = ''
|
327
|
358
|
tempObj['supply_license_number'] = ''
|
328
|
359
|
tempObj['supply_remake'] = ''
|
329
|
360
|
tempObj['type'] = 0
|
330
|
|
- this.tableList.push(tempObj)
|
|
361
|
+ this.recordInfo.tableList.push(tempObj)
|
331
|
362
|
},
|
332
|
363
|
handleDelete: function(index, row) {
|
333
|
|
- if (this.tableList.length <= 1) {
|
|
364
|
+ if (this.recordInfo.tableList.length <= 1) {
|
334
|
365
|
this.$message.error('只有一条记录的时候无法删除')
|
335
|
366
|
return
|
336
|
367
|
} else {
|
337
|
|
- this.tableList.splice(index, 1)
|
|
368
|
+ this.recordInfo.tableList.splice(index, 1)
|
338
|
369
|
}
|
339
|
370
|
},
|
|
371
|
+
|
|
372
|
+
|
340
|
373
|
savePurchaseOrder(){
|
341
|
|
-
|
342
|
|
- var params = {
|
|
374
|
+ console.log("tablelsit323232",this.recordInfo.tableList)
|
|
375
|
+ console.log("hhh232323",this.$refs)
|
|
376
|
+ this.$refs["tableForm"].validate((valid)=>{
|
|
377
|
+ if(valid){
|
|
378
|
+ var params = {
|
343
|
379
|
supplier_name:this.supplier_name,
|
344
|
380
|
start_time:this.start_time,
|
345
|
381
|
end_time:this.end_time,
|
346
|
382
|
rate_of_concession:this.rate_of_concession,
|
347
|
383
|
discount_amount:this.discount_amount,
|
348
|
|
- }
|
349
|
|
- console.log("partam2332232332",params)
|
350
|
|
- console.log("tablelsit323232",this.tabList)
|
351
|
|
- savePurchaseOrder(this.tabList,this.supplier_name,this.start_time,this.end_time,this.rate_of_concession,this.discount_amount).then(response=>{
|
|
384
|
+ }
|
|
385
|
+ console.log("partam2332232332",params)
|
|
386
|
+ console.log("tablelsit323232",this.recordInfo.tableList)
|
|
387
|
+ for(let i=0;i<this.recordInfo.tableList.length;i++){
|
|
388
|
+ this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
|
|
389
|
+ for(let j=0;j<this.manufactuerList.length;j++){
|
|
390
|
+ if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
|
|
391
|
+ this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
|
|
392
|
+ }
|
352
|
393
|
|
353
|
|
- })
|
|
394
|
+ }
|
|
395
|
+ }
|
|
396
|
+ return
|
|
397
|
+ savePurchaseOrder(this.recordInfo.tableList,this.supplier_name,this.start_time,this.end_time,this.rate_of_concession,this.discount_amount).then(response=>{
|
|
398
|
+ if(response.data.state == 1){
|
|
399
|
+ var order = response.data.data.order
|
|
400
|
+ this.$message.success("保存成功!")
|
|
401
|
+ this.showTwo = false
|
|
402
|
+ this.showOne = true
|
|
403
|
+ }
|
|
404
|
+ })
|
|
405
|
+ }
|
|
406
|
+
|
|
407
|
+ })
|
|
408
|
+
|
354
|
409
|
},
|
355
|
410
|
|
356
|
411
|
changeTypeName(){
|
|
@@ -408,6 +463,9 @@ calculate: function(val) {
|
408
|
463
|
}
|
409
|
464
|
return Math.round(parseFloat(val) * 100) / 100;
|
410
|
465
|
},
|
|
466
|
+ updatePurchaseOrder(){
|
|
467
|
+
|
|
468
|
+ }
|
411
|
469
|
},
|
412
|
470
|
created(){
|
413
|
471
|
const tempObj = {}
|
|
@@ -416,15 +474,15 @@ created(){
|
416
|
474
|
tempObj['supply_name'] = ""
|
417
|
475
|
tempObj['supply_type'] = ""
|
418
|
476
|
tempObj['supply_specification_name'] = ''
|
419
|
|
- tempObj['supply_total'] = ''
|
420
|
|
- tempObj['supply_count'] = ''
|
421
|
|
- tempObj['supply_price'] = ''
|
422
|
|
- tempObj['supply_total_price'] = ''
|
|
477
|
+ tempObj['supply_total'] = ""
|
|
478
|
+ tempObj['supply_count'] = ""
|
|
479
|
+ tempObj['supply_price'] = ""
|
|
480
|
+ tempObj['supply_total_price'] = ""
|
423
|
481
|
tempObj['supply_manufacturer'] = ''
|
424
|
482
|
tempObj['supply_license_number'] = ''
|
425
|
483
|
tempObj['supply_remake'] = ''
|
426
|
484
|
tempObj['type'] = 0
|
427
|
|
- this.tableList.push(tempObj)
|
|
485
|
+ this.recordInfo.tableList.push(tempObj)
|
428
|
486
|
this.getInitOrder()
|
429
|
487
|
}
|
430
|
488
|
};
|