Bladeren bron

11月14日 库存扣减更新

XMLWAN 3 jaren geleden
bovenliggende
commit
f0737f780f

+ 16 - 0
src/api/supply.js Bestand weergeven

@@ -39,3 +39,19 @@ export function updatePurchaseOrder(data, supplier_name, start_time, end_time, r
39 39
     data: data
40 40
   })
41 41
 }
42
+
43
+export function checkPurchaseOrder(id, params) {
44
+  return request({
45
+    url: '/api/supply/checkpurchaseorder?id=' + id,
46
+    method: 'Get',
47
+    params: params
48
+  })
49
+}
50
+
51
+export function getPurchaseOrderDetail(id, params) {
52
+  return request({
53
+    url: '/api/supply/getpurchaseorderdetail?id=' + id,
54
+    method: 'get',
55
+    params: params
56
+  })
57
+}

+ 19 - 0
src/router/modules/supply.js Bestand weergeven

@@ -41,6 +41,25 @@ export default {
41 41
       hidden: true,
42 42
       is_menu: false,
43 43
       isChild: true
44
+    },
45
+    {
46
+      path: '/purchase/order/edit',
47
+      component: () => import('@/xt_pages/supply/components/editPurchaseOrder'),
48
+      name: 'editPurchaseOrder',
49
+      meta: { title: 'editPurchaseOrder', noCache: true },
50
+      hidden: true,
51
+      is_menu: false,
52
+      isChild: true
53
+    },
54
+    {
55
+      path: '/purchase/order/edit',
56
+      component: () => import('@/xt_pages/supply/components/purchaseOrderPrint'),
57
+      name: 'purchaseOrderPrint',
58
+      meta: { title: 'purchaseOrderPrint', noCache: true },
59
+      hidden: true,
60
+      is_menu: false,
61
+      isChild: true
44 62
     }
63
+
45 64
   ]
46 65
 }

+ 47 - 17
src/xt_pages/supply/components/addPurchaseOrder.vue Bestand weergeven

@@ -50,7 +50,7 @@
50 50
     <div>
51 51
         <el-button size="small" type="primary" @click="savePurchaseOrder" v-show="showTwo">保存</el-button>
52 52
         <el-button size="small" type="primary" @click="updatePurchaseOrder" v-show="showOne">打印</el-button>
53
-        <el-button size="small" type="primary" @click="updatePurchaseOrder" v-show="showOne">审核</el-button>
53
+        <el-button size="small" type="primary" @click="checkPurchaseOrder" v-show="showOne">审核</el-button>
54 54
         <el-button size="small" type="primary" @click="updatePurchaseOrder" v-show="showOne">修改</el-button>
55 55
     </div>
56 56
     </div>
@@ -74,7 +74,7 @@
74 74
         </template>
75 75
         <template slot-scope="scope">
76 76
            <el-form-item :prop="'tableList.' + scope.$index + '.name'" :rules='tableRules.name'>
77
-            <el-select v-model="scope.row.name" style="width:160px;" filterable placeholder="请选择" @change="changeName"   @input="changeGoodName(scope.$index)">
77
+            <el-select v-model="scope.row.name" style="width:160px;" filterable placeholder="请选择" @change="changeName"   @input="changeGoodName(scope.$index)" :disabled="disabled">
78 78
                 <el-option
79 79
                     v-for="(item,index) in tabList"
80 80
                     :key="index"
@@ -109,14 +109,14 @@
109 109
         </template>
110 110
         <template slot-scope="scope">
111 111
           <el-form-item  :prop="'tableList.' + scope.$index + '.supply_count'" :rules='tableRules.supply_count'>
112
-             <el-input v-model="scope.row.supply_count" style="width:80px"></el-input>
112
+             <el-input v-model="scope.row.supply_count" style="width:80px" :disabled="disabled"></el-input>
113 113
           </el-form-item>
114 114
         </template>
115 115
     </el-table-column>
116 116
 
117 117
     <el-table-column label="购货单价" align="center" width="120px">
118 118
         <template slot-scope="scope">
119
-        <el-input v-model="scope.row.supply_price" style="width:80px"></el-input>
119
+        <el-input v-model="scope.row.supply_price" style="width:80px" :disabled="disabled"></el-input>
120 120
         </template>
121 121
     </el-table-column>
122 122
 
@@ -135,13 +135,13 @@
135 135
 
136 136
     <el-table-column label="批准文号" align="center" width="200px">
137 137
         <template slot-scope="scope">
138
-        <el-input v-model="scope.row.supply_license_number" style="width:160px"></el-input>
138
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
139 139
         </template>
140 140
     </el-table-column>
141 141
 
142 142
     <el-table-column label="备注" align="center" width="200px">
143 143
         <template slot-scope="scope">
144
-        <el-input v-model="scope.row.supply_remake" style="width:160px"></el-input>
144
+        <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
145 145
         </template>
146 146
     </el-table-column>
147 147
 
@@ -184,7 +184,7 @@
184 184
 <script>
185 185
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
186 186
 import {uParseTime } from '@/utils/tools'
187
-import {getInitOrder,savePurchaseOrder,updatePurchaseOrder} from "@/api/supply"
187
+import {getInitOrder,savePurchaseOrder,updatePurchaseOrder,checkPurchaseOrder} from "@/api/supply"
188 188
 export default {
189 189
 name: "addPurchaseOrder",
190 190
 created() {
@@ -253,6 +253,7 @@ return {
253 253
    drugList:[],
254 254
    goodList:[],
255 255
    id:0,
256
+   disabled:false,
256 257
   };
257 258
 },
258 259
 methods:{
@@ -333,7 +334,7 @@ changeName(val){
333 334
     //var obj = {"id":0,"name":"合计","supply_name":"","supply_type":"","supply_specification_name":"","supply_total":"","supply_count":"","supply_price":"","supply_total_price":"","supply_manufacturer":"","supply_license_number":"","supply_remake":"","is_total":2}
334 335
    for(let i=0;i<this.recordInfo.tableList.length;i++){
335 336
     if(this.currentIndex == i){
336
-        this.recordInfo.tableList[i].id = val.id
337
+        this.recordInfo.tableList[i].project_id = val.id
337 338
         this.recordInfo.tableList[i].type = val.type
338 339
         this.recordInfo.tableList[i].name = val.name
339 340
         this.recordInfo.tableList[i].supply_name = val.supply_name
@@ -359,7 +360,7 @@ changeName(val){
359 360
 },
360 361
 handleEdit(){
361 362
     const tempObj = {}
362
-    tempObj["id"] = ""
363
+    tempObj["id"] = 0
363 364
     tempObj["name"] = ""
364 365
     tempObj['supply_name'] = ""
365 366
     tempObj['supply_type'] = ""
@@ -373,6 +374,7 @@ handleEdit(){
373 374
     tempObj['supply_remake'] = ''
374 375
     tempObj['type'] = 0
375 376
     tempObj['is_total'] = 1
377
+    tempObj["project_id"] = 0
376 378
     this.recordInfo.tableList.push(tempObj)
377 379
 },
378 380
 handleDelete: function(index, row) {
@@ -397,6 +399,8 @@ savePurchaseOrder(){
397 399
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
398 400
             this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
399 401
             this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count * this.recordInfo.tableList[i].supply_price).toString()
402
+            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
403
+            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
400 404
             for(let j=0;j<this.manufactuerList.length;j++){
401 405
                 if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
402 406
                 this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
@@ -424,6 +428,8 @@ savePurchaseOrder(){
424 428
                   orderInfo[i].supply_count = orderInfo[i].count
425 429
                   orderInfo[i].supply_price = orderInfo[i].price
426 430
                   orderInfo[i].supply_remake = orderInfo[i].remark
431
+                  orderInfo[i].type = orderInfo[i].is_source
432
+                  orderInfo[i].project_id = orderInfo[i].project_id
427 433
                 }
428 434
                 console.log("orderINFO23323232",orderInfo)
429 435
                 this.recordInfo.tableList = orderInfo
@@ -519,12 +525,15 @@ getTimes(time) {
519 525
     return uParseTime(time, '{y}-{m}-{d}')
520 526
 },
521 527
  updatePurchaseOrder(){
522
-   this.$refs.validate((valid)=>{
528
+   this.loading = true 
529
+   this.$refs["tableForm"].validate((valid)=>{
523 530
       if(valid){
524 531
         for(let i=0;i<this.recordInfo.tableList.length;i++){
525 532
            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
526 533
            this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
527 534
            this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count * this.recordInfo.tableList[i].supply_price).toString()
535
+           this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
536
+            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
528 537
            for(let j=0;j<this.manufactuerList.length;j++){
529 538
               if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
530 539
                 this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
@@ -533,11 +542,14 @@ getTimes(time) {
533 542
         }
534 543
         var start = this.getTimes(this.start_time)
535 544
         var end = this.getTimes(this.end_time)
536
-         const params = {
537
-            'stockIn': this.recordInfo.tableList
538
-         }
545
+        const params = {
546
+        'stockIn': this.recordInfo.tableList
547
+        }
548
+        console.log("params23232233223",params)
549
+        
539 550
         updatePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount,this.id,this.number).then(response=>{
540 551
            if(response.data.state == 1){
552
+            this.loading = false
541 553
              var warehousingInfo =  response.data.data.warehousingInfo
542 554
              this.$message.success("修改成功!")
543 555
            }
@@ -546,17 +558,34 @@ getTimes(time) {
546 558
    })
547 559
  },
548 560
  getAllPrice(){
549
-   console.log("表哥2332323223323223",this.recordInfo.tableList)  
550 561
    var total_price = 0
551 562
    for(let i=0;i<this.recordInfo.tableList.length;i++){
552 563
       total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
553 564
    }  
554 565
    return total_price.toFixed(2)
555
- }
566
+ },
567
+ checkPurchaseOrder(id,index){
568
+   this.$confirm('是否审核?', {
569
+    confirmButtonText: '确 定',
570
+    cancelButtonText: '取 消',
571
+    type: 'warning'
572
+    }).then(() => {
573
+    console.log("id232233232323223",this.id)    
574
+    checkPurchaseOrder(this.id).then(response => {
575
+        if (response.data.state == 1) {
576
+          var info = response.data.data.info
577
+          this.disabled = true
578
+          this.$message.success("审核成功!")
579
+        } 
580
+     })
581
+    })
582
+    .catch(() => {
583
+    }) 
584
+  }
556 585
 },
557 586
 created(){
558 587
     const tempObj = {}
559
-    tempObj["id"] = ""
588
+    tempObj["id"] = 0
560 589
     tempObj["name"] = ""
561 590
     tempObj['supply_name'] = ""
562 591
     tempObj['supply_type'] = ""
@@ -570,6 +599,7 @@ created(){
570 599
     tempObj['supply_remake'] = ''
571 600
     tempObj['type'] = 0
572 601
     tempObj['is_total'] = 1
602
+    tempObj["project_id"] = 0
573 603
     this.recordInfo.tableList.push(tempObj)
574 604
     this.getInitOrder()
575 605
 }
@@ -629,6 +659,6 @@ background-color: #d0d3da;
629 659
 .el-table__fixed-right{
630 660
   width:150px;
631 661
   bottom: 20px;
632
-  height: 200px;
662
+  height: 100%;
633 663
 }
634 664
 </style>

+ 622 - 0
src/xt_pages/supply/components/editPurchaseOrder.vue Bestand weergeven

@@ -0,0 +1,622 @@
1
+<template>
2
+<div class="main-contain">
3
+<div class="position">
4
+    <bread-crumb :crumbs="crumbs"></bread-crumb>
5
+</div>
6
+<div class="app-container"  v-loading="loading">
7
+    <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
8
+    <div>
9
+        <span style="color:red">*</span><span>供应商:</span>
10
+        <el-select v-model="supplier_name" style="width:140px;margin-right:10px;" placeholder="请选择"
11
+        @change="changeTypeName">
12
+        <el-option
13
+            v-for="item in supplyList"
14
+            :key="item.id"
15
+            :label="item.supplier_name"
16
+            :value="item.id">
17
+        </el-option>
18
+        </el-select>
19
+        <span>单据日期:</span>
20
+        <el-date-picker
21
+        size="small"
22
+        v-model="start_time"
23
+        prefix-icon="el-icon-date"
24
+        :editable="false"
25
+        style="width: 196px;"
26
+        type="date"
27
+        placeholder="选择日期时间"
28
+        align="right"
29
+        format="yyyy-MM-dd"
30
+        value-format="yyyy-MM-dd"
31
+        @change="startTimeChange"
32
+        ></el-date-picker>
33
+        <span>交货日期:</span>
34
+        <el-date-picker
35
+            size="small"
36
+            v-model="end_time"
37
+            prefix-icon="el-icon-date"
38
+            :editable="false"
39
+            style="width: 196px;"
40
+            type="date"
41
+            placeholder="选择日期时间"
42
+            align="right"
43
+            format="yyyy-MM-dd"
44
+            value-format="yyyy-MM-dd"
45
+            @change="endTimeChange"
46
+        ></el-date-picker>
47
+        <span>单据编码:{{number}}</span>
48
+
49
+    </div>
50
+    <div>
51
+        <el-button size="small" type="primary" @click="checkPurchaseOrder">生成购货单</el-button>
52
+        <el-button size="small" type="primary" @click="updatePurchaseOrder">修改</el-button>
53
+        <el-button size="small" type="primary" @click="toPrint">打印</el-button>
54
+        <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder">审核</el-button>
55
+        <el-button size="small" type="primary" v-if="is_check == 1" @click="checkPurchaseOrder">反审核</el-button>
56
+       
57
+    </div>
58
+    </div>
59
+
60
+   <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
61
+    <el-table
62
+    :row-style="{ color: '#303133' }"
63
+    :header-cell-style="{
64
+        backgroundColor: 'rgb(245, 247, 250)',
65
+        color: '#606266'
66
+    }"
67
+    :data="recordInfo.tableList"
68
+    :class="signAndWeighBoxPatients"
69
+    border
70
+    style="width: 100%"
71
+    max-height="450"
72
+    >
73
+    <el-table-column align="center" width="200px">
74
+        <template slot="header" slot-scope="scope">
75
+            <span>商品<span style="color: red">*</span></span>
76
+        </template>
77
+        <template slot-scope="scope">
78
+           <el-form-item :prop="'tableList.' + scope.$index + '.name'" :rules='tableRules.name'>
79
+            <el-select v-model="scope.row.name" style="width:160px;" filterable placeholder="请选择" @change="changeName"   @input="changeGoodName(scope.$index)" :disabled="disabled">
80
+                <el-option
81
+                    v-for="(item,index) in tabList"
82
+                    :key="index"
83
+                    :label="item.supply_name"
84
+                    :value="item">
85
+                </el-option>
86
+             </el-select>
87
+           </el-form-item>
88
+        </template>
89
+    </el-table-column>
90
+    <el-table-column  align="center" width="150px">
91
+        <template slot="header" slot-scope="scope">
92
+            <span>商品类别</span>
93
+        </template>
94
+        <template slot-scope="scope">
95
+            <el-input v-model="scope.row.supply_type" style="width:120px" :disabled="true"></el-input>
96
+        </template>
97
+    </el-table-column>
98
+    <el-table-column label="规格&单位" align="center" width="200px">
99
+        <template slot-scope="scope">
100
+            <el-input v-model="scope.row.supply_specification_name" style="width:150px" :disabled="true"></el-input>
101
+        </template>
102
+        </el-table-column>
103
+    <el-table-column label="可用库存" align="center" width="130px">
104
+        <template slot-scope="scope">
105
+            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
106
+        </template>
107
+    </el-table-column>
108
+    <el-table-column label="数量" align="center" width="120px">
109
+        <template slot="header" slot-scope="scope">
110
+            <span>数量<span style="color: red">*</span></span>
111
+        </template>
112
+        <template slot-scope="scope">
113
+          <el-form-item  :prop="'tableList.' + scope.$index + '.supply_count'" :rules='tableRules.supply_count'>
114
+             <el-input v-model="scope.row.supply_count" style="width:80px" :disabled="disabled"></el-input>
115
+          </el-form-item>
116
+        </template>
117
+    </el-table-column>
118
+
119
+    <el-table-column label="购货单价" align="center" width="120px">
120
+        <template slot-scope="scope">
121
+        <el-input v-model="scope.row.supply_price" style="width:80px" :disabled="disabled"></el-input>
122
+        </template>
123
+    </el-table-column>
124
+
125
+    <el-table-column label="购货金额" align="center" width="120px">
126
+        <template slot-scope="scope">
127
+          {{calculate(scope.row.supply_count * scope.row.supply_price)}}
128
+        </template>
129
+    </el-table-column>
130
+
131
+    <el-table-column label="生产厂商" align="center" width="200px">
132
+        <template slot-scope="scope">
133
+        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
134
+        </template>
135
+    </el-table-column>
136
+
137
+
138
+    <el-table-column label="批准文号" align="center" width="200px">
139
+        <template slot-scope="scope">
140
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
141
+        </template>
142
+    </el-table-column>
143
+
144
+    <el-table-column label="备注" align="center" width="200px">
145
+        <template slot-scope="scope">
146
+        <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
147
+        </template>
148
+    </el-table-column>
149
+
150
+    <el-table-column label="操作" align="center" width="150px" fixed="right" >
151
+        <template slot-scope="scope">
152
+        <el-tooltip class="item" effect="dark" content="新增" placement="top" >
153
+            <el-button
154
+                size="mini"
155
+                type="primary"
156
+                icon="el-icon-circle-plus-outline"
157
+                @click="handleEdit(scope.$index, scope.row)">
158
+            </el-button>
159
+       </el-tooltip>
160
+       <el-tooltip class="item" effect="dark" content="删除" placement="top">
161
+            <el-button
162
+                size="mini"
163
+                type="danger"
164
+                icon="el-icon-delete"
165
+                @click="handleDelete(scope.$index, scope.row)">
166
+            </el-button>
167
+        </el-tooltip>
168
+
169
+        </template>
170
+    </el-table-column>
171
+  </el-table>
172
+</el-form>
173
+   <div style="margin-top:10px">
174
+      合计:{{getAllPrice()}} 元
175
+   </div>
176
+   <div style="margin-top:10px">
177
+        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
178
+
179
+        <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
180
+
181
+    </div>
182
+</div>
183
+</div>
184
+</template>
185
+
186
+<script>
187
+import BreadCrumb from "@/xt_pages/components/bread-crumb";
188
+import {uParseTime } from '@/utils/tools'
189
+import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail} from "@/api/supply"
190
+export default {
191
+name: "addPurchaseOrder",
192
+created() {
193
+this.org_id =  this.$store.getters.xt_user.org_id
194
+
195
+var start_time =  window.sessionStorage.getItem('start_time')
196
+var end_time =  window.sessionStorage.getItem('end_time')
197
+
198
+if(start_time !=null){
199
+    this.start_time = start_time
200
+}
201
+if(end_time!=null){
202
+    this.end_time = end_time
203
+}
204
+window.sessionStorage.removeItem('start_time')
205
+window.sessionStorage.removeItem('end_time')
206
+},
207
+components: {
208
+BreadCrumb
209
+},
210
+data() {
211
+return {
212
+    crumbs: [
213
+       { path: false, name: "购货订单" },
214
+       { path: "/spply/query", name: "编辑购货订单" }
215
+    ],
216
+    showTwo:true,
217
+    showOne:false,
218
+    recordInfo: {
219
+      tableList:[],
220
+    },
221
+    keywords: "",
222
+    total: 0,
223
+    multipleSelection: [],
224
+    signAndWeighBoxPatients: "sign-and-weigh-box-patients",
225
+    start_time: "",
226
+    end_time: "",
227
+    page: 1,
228
+    limit: 10,
229
+    goodType: [],
230
+    goodInfo: [],
231
+    org_id:0,
232
+    types:[],
233
+    tyep_name:"",
234
+    form:{
235
+    manufacturer_id:"",
236
+    },
237
+    tabList:[],
238
+    manufactuerList:[],
239
+    currentIndex: 0,
240
+    goodTypeList:[],
241
+    drugTypeList:[],
242
+    supplier_name:"",
243
+    supplyList:[],
244
+    rate_of_concession:"",
245
+    discount_amount:"",
246
+    start_time:new Date(),
247
+    end_time:new Date(),
248
+    tableRules: {
249
+     name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
250
+     supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
251
+   },
252
+   warehousing_id:0,
253
+   number:"",
254
+   loading:false,
255
+   drugList:[],
256
+   goodList:[],
257
+   id:0,
258
+   disabled:false,
259
+   is_check:0,
260
+  };
261
+},
262
+methods:{
263
+
264
+getInitOrder(){
265
+    getInitOrder().then(response=>{
266
+    if(response.data.state == 1){
267
+        var drugList = response.data.data.drugList
268
+        this.manufactuerList = response.data.data.manufactuerList
269
+        this.goodTypeList = response.data.data.goodTypeList
270
+        this.drugTypeList = response.data.data.drugTypeList
271
+        this.supplyList = response.data.data.supplyList
272
+       for(let i=0;i<drugList.length;i++){
273
+          for(let z=0;z<drugList[i].drug_warehouse_info.length;z++){
274
+            drugList[i].drug_warehouse_info[z].stock_max_number = drugList[i].drug_warehouse_info[z].stock_max_number * drugList[i].min_number
275
+          }
276
+        for(let j=0;j<this.manufactuerList.length;j++){
277
+            if(drugList[i].manufacturer == this.manufactuerList[j].id){
278
+                drugList[i].manufacturer = this.manufactuerList[j].manufacturer_name
279
+            }
280
+        }
281
+        for(let y=0;y<this.drugTypeList.length;y++){
282
+            if(drugList[i].drug_type == this.drugTypeList[y].value){
283
+            drugList[i].drug_type = this.drugTypeList[y].name
284
+            }
285
+        }
286
+        drugList[i].supply_name =  drugList[i].drug_name + " " + drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit + " " + drugList[i].manufacturer
287
+        drugList[i].supply_type = drugList[i].drug_type
288
+        drugList[i].supply_specification_name = drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit
289
+        drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number)
290
+        drugList[i].supply_count = ""
291
+        drugList[i].supply_total_price = ""
292
+        drugList[i].supply_manufacturer=  drugList[i].manufacturer
293
+        drugList[i].supply_license_number= drugList[i].number
294
+        drugList[i].supply_remake = ""
295
+        drugList[i].type = 1
296
+        drugList[i].supply_price = ""
297
+        drugList[i].name = drugList[i].drug_name
298
+
299
+        this.tabList.push(drugList[i])
300
+        }
301
+        this.drugList = drugList
302
+        var goodList =  response.data.data.goodList
303
+        for(let i=0;i<goodList.length;i++){
304
+        for(let j=0;j<this.manufactuerList.length;j++){
305
+            if(goodList[i].manufacturer == this.manufactuerList[j].id){
306
+                goodList[i].manufacturer = this.manufactuerList[j].manufacturer_name
307
+            }
308
+        }
309
+        for(let y=0;y<this.goodTypeList.length;y++){
310
+            if(goodList[i].good_type_id == this.goodTypeList[y].id){
311
+                goodList[i].good_type_id = this.goodTypeList[y].type_name
312
+            }
313
+        }
314
+        goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
315
+        goodList[i].supply_type = goodList[i].good_type_id
316
+        goodList[i].supply_specification_name =goodList[i].specification_name
317
+        goodList[i].supply_price = ""
318
+        goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
319
+        goodList[i].supply_count = ""
320
+        goodList[i].supply_total_price = ""
321
+        goodList[i].supply_manufacturer = goodList[i].manufacturer
322
+        goodList[i].supply_license_number = ""
323
+        goodList[i].supply_remake = ""
324
+        goodList[i].type = 2
325
+        goodList[i].name = goodList[i].good_name
326
+
327
+        this.tabList.push(goodList[i])
328
+        }
329
+        this.goodList = goodList
330
+    } 
331
+    })
332
+},
333
+changeGoodName(val){
334
+  this.currentIndex = val
335
+},
336
+changeName(val){
337
+    //var obj = {"id":0,"name":"合计","supply_name":"","supply_type":"","supply_specification_name":"","supply_total":"","supply_count":"","supply_price":"","supply_total_price":"","supply_manufacturer":"","supply_license_number":"","supply_remake":"","is_total":2}
338
+   for(let i=0;i<this.recordInfo.tableList.length;i++){
339
+    if(this.currentIndex == i){
340
+        this.recordInfo.tableList[i].project_id = val.id
341
+        this.recordInfo.tableList[i].type = val.type
342
+        this.recordInfo.tableList[i].name = val.name
343
+        this.recordInfo.tableList[i].supply_name = val.supply_name
344
+        this.recordInfo.tableList[i].supply_type = val.supply_type
345
+        this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name
346
+        this.recordInfo.tableList[i].supply_total = val.supply_total
347
+        if(val.supply_count == NaN){
348
+           this.recordInfo.tableList[i].supply_count = ""
349
+        }else{
350
+          this.recordInfo.tableList[i].supply_count = val.supply_count?val.supply_count:""
351
+        }
352
+
353
+        this.recordInfo.tableList[i].supply_price = val.supply_price?val.supply_price:""
354
+        this.recordInfo.tableList[i].supply_total_price = val.supply_total_price?val.supply_total_price:""
355
+        this.recordInfo.tableList[i].supply_manufacturer = val.supply_manufacturer
356
+        this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
357
+        this.recordInfo.tableList[i].supply_remake = val.supply_remake
358
+        this.recordInfo.tableList[i].is_total = val.is_total
359
+     }
360
+    }
361
+   
362
+
363
+},
364
+handleEdit(){
365
+    const tempObj = {}
366
+    tempObj["id"] = 0
367
+    tempObj["name"] = ""
368
+    tempObj['supply_name'] = ""
369
+    tempObj['supply_type'] = ""
370
+    tempObj['supply_specification_name'] = ''
371
+    tempObj['supply_total'] = ""
372
+    tempObj['supply_count'] = ""
373
+    tempObj['supply_price'] = ""
374
+    tempObj['supply_total_price'] = ""
375
+    tempObj['supply_manufacturer'] = ''
376
+    tempObj['supply_license_number'] = ''
377
+    tempObj['supply_remake'] = ''
378
+    tempObj['type'] = 0
379
+    tempObj['is_total'] = 1
380
+    tempObj["project_id"] = 0
381
+    this.recordInfo.tableList.push(tempObj)
382
+},
383
+handleDelete: function(index, row) {
384
+  if (this.recordInfo.tableList.length <= 1) {
385
+        this.$message.error('只有一条记录的时候无法删除')
386
+        return
387
+   } else {
388
+        this.recordInfo.tableList.splice(index, 1)
389
+   }
390
+},
391
+
392
+changeTypeName(){
393
+
394
+},
395
+startTimeChange(){
396
+
397
+},
398
+endTimeChange(){
399
+
400
+},
401
+search(){
402
+
403
+},
404
+
405
+getWarehoseInfo(arr,max_unit,min_unit,min_number){
406
+    var total = 0
407
+    var max_str=  ""
408
+    var min_str = ""
409
+    if (arr.length > 0) {
410
+      for(let i=0;i<arr.length;i++){
411
+        total += parseInt(arr[i].stock_max_number)
412
+      }
413
+    }
414
+    if (total < min_number){
415
+        min_str = total + min_unit
416
+    }
417
+    if (total == 0) {
418
+        min_str = ""
419
+        max_str = ""
420
+    }
421
+   if (total >=min_number) {
422
+    if(parseInt(total/min_number)!=0){
423
+        max_str = parseInt(total/min_number) + max_unit
424
+    }
425
+    if(total%min_number!=0){
426
+       min_str = total%min_number + min_unit
427
+    }
428
+  }
429
+ return max_str + min_str
430
+ },
431
+getTotalStockCount(arr){
432
+  var total_count = 0
433
+  for(let i=0;i<arr.length;i++){
434
+    total_count += arr[i].stock_count
435
+  }
436
+  return total_count
437
+},
438
+calculate: function(val) {
439
+    if (isNaN(val)) {
440
+        return "";
441
+    }
442
+    if (val == 0) {
443
+        return "";
444
+    }
445
+    return Math.round(parseFloat(val) * 100) / 100;
446
+  },
447
+getTimes(time) {
448
+    if (time === '') {
449
+    return ''
450
+    }
451
+    return uParseTime(time, '{y}-{m}-{d}')
452
+},
453
+ updatePurchaseOrder(){
454
+   this.loading = true 
455
+   this.$refs["tableForm"].validate((valid)=>{
456
+      if(valid){
457
+        for(let i=0;i<this.recordInfo.tableList.length;i++){
458
+           this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
459
+           this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
460
+           this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count * this.recordInfo.tableList[i].supply_price).toString()
461
+           this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
462
+            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
463
+           for(let j=0;j<this.manufactuerList.length;j++){
464
+              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
465
+                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
466
+              }
467
+           }
468
+        }
469
+        var start = this.getTimes(this.start_time)
470
+        var end = this.getTimes(this.end_time)
471
+        const params = {
472
+        'stockIn': this.recordInfo.tableList
473
+        }
474
+           
475
+        updatePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount,this.id,this.number).then(response=>{
476
+           if(response.data.state == 1){
477
+            this.loading = false
478
+             var warehousingInfo =  response.data.data.warehousingInfo
479
+             this.$message.success("修改成功!")
480
+           }
481
+        })
482
+      } 
483
+   })
484
+ },
485
+ getAllPrice(){
486
+   var total_price = 0
487
+   for(let i=0;i<this.recordInfo.tableList.length;i++){
488
+      total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
489
+   }  
490
+   return total_price.toFixed(2)
491
+ },
492
+ checkPurchaseOrder(id,index){
493
+   this.$confirm('是否审核?', {
494
+    confirmButtonText: '确 定',
495
+    cancelButtonText: '取 消',
496
+    type: 'warning'
497
+    }).then(() => { 
498
+    checkPurchaseOrder(this.id).then(response => {
499
+        if (response.data.state == 1) {
500
+          var info = response.data.data.info
501
+          this.disabled = true
502
+          this.$message.success("审核成功!")
503
+        } 
504
+     })
505
+    })
506
+    .catch(() => {
507
+    }) 
508
+  },
509
+  getPurchaseOrderDetail(){
510
+      var id = this.$route.query.id
511
+    getPurchaseOrderDetail(id).then(response=>{
512
+      if(response.data.state == 1){
513
+        var info = response.data.data.info
514
+        this.is_check = info.is_check
515
+        this.number = info.number
516
+        this.id = info.id
517
+        this.supplier_name = info.supplier_id
518
+        this.rate_of_concession = info.rate_of_concession
519
+        this.discount_amount = info.discount_amount
520
+        var orderInfo = response.data.data.orderInfo
521
+        if(info.is_check == 2){
522
+           this.disabled = false
523
+        }
524
+        if(info.is_check == 1){
525
+           this.disabled = true
526
+        }
527
+        for(let i=0;i<orderInfo.length;i++){
528
+            orderInfo[i].supply_count = orderInfo[i].count
529
+            orderInfo[i].supply_price = orderInfo[i].price
530
+            orderInfo[i].supply_remake = orderInfo[i].remark
531
+            orderInfo[i].type = orderInfo[i].is_source
532
+            orderInfo[i].project_id = orderInfo[i].project_id
533
+        }
534
+        console.log("orderINFO23323232",orderInfo)
535
+        this.recordInfo.tableList = orderInfo
536
+      }
537
+    })  
538
+  },
539
+  toPrint(){
540
+      
541
+  }
542
+},
543
+created(){
544
+    const tempObj = {}
545
+    tempObj["id"] = 0
546
+    tempObj["name"] = ""
547
+    tempObj['supply_name'] = ""
548
+    tempObj['supply_type'] = ""
549
+    tempObj['supply_specification_name'] = ''
550
+    tempObj['supply_total'] = ""
551
+    tempObj['supply_count'] = ""
552
+    tempObj['supply_price'] = ""
553
+    tempObj['supply_total_price'] = ""
554
+    tempObj['supply_manufacturer'] = ''
555
+    tempObj['supply_license_number'] = ''
556
+    tempObj['supply_remake'] = ''
557
+    tempObj['type'] = 0
558
+    tempObj['is_total'] = 1
559
+    tempObj["project_id"] = 0
560
+    this.recordInfo.tableList.push(tempObj)
561
+    this.getInitOrder()
562
+    this.getPurchaseOrderDetail()
563
+}
564
+};
565
+</script>
566
+
567
+<style rel="stylesheet/css" lang="scss" scoped>
568
+.information {
569
+border: 1px #dcdfe6 solid;
570
+padding: 30px 20px 30px 20px;
571
+
572
+.border {
573
+border-bottom: 1px #dcdfe6 solid;
574
+margin: 0px 0 20px 0;
575
+}
576
+}
577
+
578
+.title {
579
+background: #409eff;
580
+height: 44px;
581
+line-height: 44px;
582
+padding: 0 0 0 10px;
583
+color: #fff;
584
+margin: 0 0 10px 0;
585
+}
586
+
587
+.edit_separater {
588
+border-top: 1px solid rgb(233, 233, 233);
589
+margin-top: 15px;
590
+margin-bottom: 15px;
591
+}
592
+</style>
593
+
594
+<style>
595
+.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
596
+font-size: 12px;
597
+}
598
+
599
+.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
600
+background: #6fb5fa;
601
+}
602
+
603
+.count {
604
+color: #bd2c00;
605
+}
606
+.el-table td,
607
+.el-table th.is-leaf,
608
+.el-table--border,
609
+.el-table--group {
610
+border-color: #d0d3da;
611
+}
612
+.el-table--border::after,
613
+.el-table--group::after,
614
+.el-table::before {
615
+background-color: #d0d3da;
616
+}
617
+.el-table__fixed-right{
618
+  width:150px;
619
+  bottom: 20px;
620
+  height: 100%;
621
+}
622
+</style>

+ 251 - 0
src/xt_pages/supply/components/purchaseOrderPrint.vue Bestand weergeven

@@ -0,0 +1,251 @@
1
+<template>
2
+    <div class="main-contain">
3
+        <div class="position">
4
+        <bread-crumb :crumbs="crumbs"></bread-crumb>
5
+        <el-row style="float:right;">
6
+            <el-col :span="24">
7
+            <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
8
+            </el-col>
9
+        </el-row>
10
+        </div>
11
+        <div class="app-container" style="background-color: white;">
12
+            <div id="print_content">
13
+                <div class="print_main_content">
14
+                    <div class="order_title_panl">
15
+                        <div style="font-size:22px;font-weight:bold;">{{ orgName }}</div>
16
+                        <span style="font-weight:500;font-size:18px;">购货单</span>
17
+                    </div>
18
+                    <div style="display:flex;justify-content: space-between;">
19
+                      <div style="text-align:left;margin-bottom:1px;font-size: 18px;">
20
+                        单据编号:
21
+                      </div>
22
+                      <div style="text-align:right;margin-bottom:1px;font-size: 18px;">
23
+                        打印时间:{{time_now}}
24
+                      </div>
25
+                    </div>
26
+                    
27
+                    <div class="table_panel">
28
+                        <table class="table">
29
+                            <thead>
30
+                                <tr>
31
+                                    <td style="line-height:18px;" width="80">序号</td>
32
+                                    <td style="line-height:18px;" width="80">商品</td>
33
+                                    <td style="line-height:18px;" width="80">单位</td>
34
+                                    <td style="line-height:18px;" width="80">数量</td>
35
+                                    <td style="line-height:18px;" width="80">购货单价</td>
36
+                                    <td style="line-height:18px;" width="80">折扣率</td>
37
+                                    <td style="line-height:18px;" width="80">折扣额</td> 
38
+                                    <td style="line-height:18px;" width="60">购物金额</td>
39
+                                    <td style="line-height:18px;" width="80">仓库</td>
40
+                                </tr>
41
+                            </thead>
42
+                            <tbody>
43
+                                <tr v-for='(item,index) in tableList' :key="index">
44
+                                    <td style="line-height:18px;"><span></span></td>
45
+                                    <td style="line-height:18px;"><span></span></td>
46
+                                    <td style="line-height:18px;"><span></span></td>
47
+                                    <td style="line-height:18px;"><span></span></td>
48
+                                    <td style="line-height:18px;"><span></span></td>
49
+                                    <td style="line-height:18px;"><span></span></td>
50
+                                </tr>
51
+                                <tr>
52
+                                  <td>合计</td>
53
+                                  <td colspan="12" style="text-align:right;">{{getAllPice(it.id).toFixed(2)}}</td>
54
+                               </tr>
55
+                            </tbody>
56
+                        </table>
57
+
58
+                        <div style="display:flex;margin-top:1px;float:right;">
59
+                            <div style="width:50px;">审批:</div><div style="width:100px;"></div>
60
+                            <div style="width:80px;" v-if='orgId != 10024'>药材主任:</div><div style="width:100px;"></div>
61
+                            <div style="width:50px;">会计:</div><div style="width:100px;"><span v-if='orgId == 10024'>徐立琼</span></div>
62
+                            <div style="width:50px;">审核:</div><div style="width:100px;"><span v-if='orgId == 10024'>徐立琼</span></div>
63
+                            <div style="width:70px;">制单人:</div><div style="width:100px;">{{ getXuserName(it.creater) }}</div>
64
+                       </div>
65
+                    </div>
66
+                </div>
67
+            </div>
68
+        </div>
69
+    </div>
70
+</template>
71
+
72
+<script>
73
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
74
+
75
+import { fetchAllAdminUsers } from "@/api/doctor";
76
+import print from 'print-js'
77
+const moment = require('moment')
78
+import { uParseTime } from '@/utils/tools'
79
+export default {
80
+    components:{
81
+        BreadCrumb
82
+    },
83
+    data(){
84
+        return{
85
+          crumbs: [
86
+            { path: false, name: '库存管理' },
87
+            { path: false, name: '耗材管理' },
88
+            { path: false, name: '入库单打印' },
89
+          ],
90
+            isEdit: 0,
91
+            checked: false,
92
+            signAndWeighBoxPatients: "sign-and-weigh-box-patients",
93
+            goodType: [],
94
+            goodInfo: [],
95
+            manufacturer: [],
96
+            dealer: [],
97
+            Warehouse: {
98
+                loading: false,
99
+                warehouseDate: [],
100
+                tableCurrentIndex: ""
101
+            },
102
+
103
+            WarehouseInfo: {
104
+                loading: false,
105
+                warehouseInfoDate: [],
106
+                warehouse: {}
107
+            },
108
+            time_now:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
109
+            allPrice:0,
110
+            page: 1,
111
+            limit: 10000,
112
+            keyword: "",
113
+            is_use:"",
114
+            good_kind:"",
115
+            is_charge:"",
116
+            list:[],
117
+            orgName:'',
118
+            orgId:'',
119
+            adminUserOptions:[],
120
+            warehousingInfo:[],
121
+            warehousList:[]
122
+        }
123
+    },
124
+    methods:{
125
+      printAction: function() {
126
+          const style = '@media print { .print_main_content { background-color: white; width:960px;  margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 14px; padding: 1px 5px; } tbody tr td { border: 1px solid; text-align: center; font-size: 12px; padding: 10px 5px; white-space: pre-line;} .proj { padding: 5px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }'
127
+          printJS({
128
+          printable: 'print_content',
129
+          type: 'html',
130
+          documentTitle: '  ',
131
+          style: style,
132
+          scanStyles: false
133
+          })
134
+      },
135
+
136
+      getTime(val) {
137
+         if(val < 0){
138
+           return ""
139
+         }
140
+         if(val == ""){
141
+          return ""
142
+         }else {
143
+          return uParseTime(val, '{y}-{m}-{d}')
144
+         }
145
+      },
146
+     
147
+      getXuserName(id) {
148
+        if (id <= 0) {
149
+          return "";
150
+        }
151
+        var name = "";
152
+        if (
153
+          this.adminUserOptions == null ||
154
+          typeof this.adminUserOptions.length === "undefined"
155
+        ) {
156
+          return name;
157
+        }
158
+        var leng = this.adminUserOptions.length;
159
+        if (leng == 0) {
160
+          return name;
161
+        }
162
+        for (let index = 0; index < leng; index++) {
163
+          if (this.adminUserOptions[index].id == id) {
164
+            name = this.adminUserOptions[index].name;
165
+            break;
166
+          }
167
+        }
168
+        return name;
169
+      },
170
+      
171
+    },
172
+    created(){
173
+      this.orgName = this.$store.getters.xt_user.org.org_name;
174
+      this.orgId = this.$store.getters.xt_user.org.id;
175
+      const order_id = this.$route.query.id;
176
+
177
+      this.fetchAllAdminUsers()
178
+    
179
+    }
180
+}
181
+</script>
182
+
183
+
184
+<style rel="stylesheet/scss" lang="scss" scoped>
185
+.print_main_content {
186
+  background-color: white;
187
+  max-width: 1500px;
188
+  margin: 0 auto;
189
+  padding: 0 0 20px 0;
190
+
191
+  .order_title_panl {
192
+    text-align: center;
193
+
194
+    .main_title {
195
+      font-size: 18px;
196
+      line-height: 40px;
197
+      font-weight: 500;
198
+    }
199
+  }
200
+  .table_panel {
201
+    .table {
202
+      width: 100%;
203
+      border: 1px solid;
204
+      border-collapse: collapse;
205
+      padding: 2px;
206
+      
207
+
208
+      thead {
209
+        tr {
210
+          td {
211
+            border: 1px solid;
212
+            text-align: center;
213
+            font-size: 18px;
214
+            padding: 1px 5px;
215
+          }
216
+        }
217
+      }
218
+      tbody {
219
+        tr {
220
+          td {
221
+            border: 1px solid;
222
+            text-align: center;
223
+            font-size: 18px;
224
+            padding: 10px 5px;
225
+            white-space: pre-line;
226
+            .proj {
227
+              padding: 5px 0;
228
+              text-align: left;
229
+
230
+              .proj_title {
231
+                font-size: 16px;
232
+                font-weight: 500;
233
+                line-height: 25px;
234
+              }
235
+
236
+              .proj_item {
237
+                font-size: 15px;
238
+                line-height: 20px;
239
+
240
+                .zone_name {
241
+                  font-weight: 500;
242
+                }
243
+              }
244
+            }
245
+          }
246
+        }
247
+      }
248
+    }
249
+  }
250
+}
251
+</style>

+ 11 - 5
src/xt_pages/supply/purchaseOrderQuery.vue Bestand weergeven

@@ -136,16 +136,18 @@
136 136
        <el-table-column label="操作" align="center" width="260px">
137 137
           <template slot-scope="scope">
138 138
               <el-button
139
+                icon="el-icon-edit-outline"
139 140
                 size="small"
140 141
                 type="primary"
141
-                @click="toClick(scope.row)"
142
-              >库存流水
142
+                @click="toClick(scope.row.id)"
143
+              >编辑
143 144
               </el-button>
144 145
               <el-button
146
+                icon="el-icon-delete"
145 147
                 size="small"
146
-                type="primary"
148
+                type="danger"
147 149
                 @click="toClickOne(scope.row)"
148
-              >批次
150
+              >删除
149 151
               </el-button>
150 152
           </template>
151 153
         </el-table-column>
@@ -308,7 +310,10 @@ export default {
308 310
           }
309 311
        }
310 312
        return count
311
-     } 
313
+     },
314
+     toClick(id){
315
+       this.$router.push({path:"/purchase/order/edit?id="+id})
316
+     }
312 317
   },
313 318
   created() {
314 319
     var now = new Date(); //当前日期 
@@ -375,4 +380,5 @@ export default {
375 380
 .el-table::before {
376 381
   background-color: #d0d3da;
377 382
 }
383
+
378 384
 </style>