Parcourir la source

Merge branch '20201109_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20201109_pc_vue_new_branch

csx il y a 3 ans
Parent
révision
45f9b595e1
30 fichiers modifiés avec 3753 ajouts et 448 suppressions
  1. 2 2
      config/index.js
  2. 1 0
      package.json
  3. 88 0
      src/api/supply.js
  4. 4 3
      src/lang/zh.js
  5. 25 0
      src/router/modules/supply.js
  6. 4 0
      src/xt_pages/dialysis/details/assessmentAfter.vue
  7. 6 0
      src/xt_pages/dialysis/details/assessmentBefore.vue
  8. 10 97
      src/xt_pages/dialysis/details/dialog/AssessmentAfterDislysis.vue
  9. 9 0
      src/xt_pages/dialysis/details/dialog/assessmentBeforeDislysisDialog.vue
  10. 5 2
      src/xt_pages/outpatientCharges/invoicePrint.vue
  11. 222 0
      src/xt_pages/outpatientCharges/invoiceTemplate/printFive.vue
  12. 9 9
      src/xt_pages/sign/signIn.vue
  13. 14 6
      src/xt_pages/stock/detail/stockOutDetail.vue
  14. 5 2
      src/xt_pages/stock/drugs/drugStockInOrderAdd.vue
  15. 5 1
      src/xt_pages/stock/drugs/drugStockInOrderEdit.vue
  16. 5 2
      src/xt_pages/stock/stockFlow.vue
  17. 5 2
      src/xt_pages/stock/stockInOrderAdd.vue
  18. 6 2
      src/xt_pages/stock/stockInOrderEdit.vue
  19. 11 4
      src/xt_pages/stock/stockOutOrder.vue
  20. 2 2
      src/xt_pages/stock/stockOutOrderDetail.vue
  21. 296 96
      src/xt_pages/supply/components/addGoodOrder.vue
  22. 896 0
      src/xt_pages/supply/components/addGoodReturn.vue
  23. 85 85
      src/xt_pages/supply/components/addPurchaseOrder.vue
  24. 382 18
      src/xt_pages/supply/components/addSupply.vue
  25. 911 0
      src/xt_pages/supply/components/editGoodOrder.vue
  26. 230 60
      src/xt_pages/supply/components/editPurchaseOrder.vue
  27. 20 17
      src/xt_pages/supply/goodOrderQuery.vue
  28. 392 0
      src/xt_pages/supply/goodreturn.vue
  29. 86 27
      src/xt_pages/supply/purchaseOrderQuery.vue
  30. 17 11
      src/xt_pages/supply/supplyQuery.vue

+ 2 - 2
config/index.js Voir le fichier

@@ -29,8 +29,8 @@ module.exports = {
29 29
 
30 30
     // host: 'xt.test.sgjyun.com',
31 31
     //  host: 'xt.kuyicloud.com',
32
-   host: 'xt.test.sgjyun.com',
33
-    //host: 'localhost',
32
+  //  host: 'xt.test.sgjyun.com',
33
+    host: 'localhost',
34 34
     port: 9528, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
35 35
     autoOpenBrowser: true,
36 36
     errorOverlay: true,

+ 1 - 0
package.json Voir le fichier

@@ -56,6 +56,7 @@
56 56
     "jszip": "3.1.5",
57 57
     "mockjs": "1.0.1-beta3",
58 58
     "moment": "^2.24.0",
59
+    "node-sass": "^7.0.1",
59 60
     "normalize.css": "7.0.0",
60 61
     "nprogress": "0.2.0",
61 62
     "print-js": "^1.0.50",

+ 88 - 0
src/api/supply.js Voir le fichier

@@ -55,3 +55,91 @@ export function getPurchaseOrderDetail(id, params) {
55 55
     params: params
56 56
   })
57 57
 }
58
+
59
+export function addGoodOrder(data, supplier_name, start, arrearage, payment, warehousing_id, number, rate_of_concession, discount_amount) {
60
+  return request({
61
+    url: '/api/supply/addgoodorder?supplier_id=' + supplier_name + '&start=' + start + '&arrerage=' + arrearage + '&payment=' + payment + '&warehousing_id=' + warehousing_id + '&number=' + number + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount,
62
+    method: 'post',
63
+    data: data
64
+  })
65
+}
66
+
67
+export function getAllGoodOrderList(params) {
68
+  return request({
69
+    url: '/api/supply/getallgoodorderlist',
70
+    method: 'get',
71
+    params: params
72
+  })
73
+}
74
+
75
+export function getGoodOrderDetail(id, params) {
76
+  return request({
77
+    url: '/api/supply/getgoodorderdetail?id=' + id,
78
+    method: 'get',
79
+    params: params
80
+  })
81
+}
82
+
83
+export function updateGoodOrder(data, supplier_name, start, arrearage, payment, warehose_out_id, number, rate_of_concession, discount_amount, good_number) {
84
+  return request({
85
+    url: '/api/supply/updategoodorder?supplier_id=' + supplier_name + '&start=' + start + '&arrerage=' + arrearage + '&payment=' + payment + '&warehose_out_id=' + warehose_out_id + '&number=' + number + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&good_number=' + good_number,
86
+    method: 'post',
87
+    data: data
88
+  })
89
+}
90
+
91
+export function deletePurchaseOrder(id, params) {
92
+  return request({
93
+    url: '/api/supply/deletepurchorder?id=' + id,
94
+    method: 'Get',
95
+    params: params
96
+  })
97
+}
98
+
99
+export function getAllOrderCountList(id, params) {
100
+  return request({
101
+    url: '/api/supply/getallordercountlist?id=' + id,
102
+    method: 'get',
103
+    params: params
104
+  })
105
+}
106
+
107
+export function getPurchaseOrderInfo(id, ids, params) {
108
+  return request({
109
+    url: '/api/supply/getpurchaseorderinfo?id=' + id + '&ids=' + ids,
110
+    method: 'get',
111
+    params: params
112
+  })
113
+}
114
+
115
+export function getGoodOrderList(id, params) {
116
+  return request({
117
+    url: '/api/supply/getgoodorderlist?id=' + id,
118
+    method: 'get',
119
+    params: params
120
+  })
121
+}
122
+
123
+export function getReturnOrder(id, params) {
124
+  return request({
125
+    url: '/api/supply/getreturnorder?id=' + id,
126
+    method: 'get',
127
+    params: params
128
+  })
129
+}
130
+
131
+export function getGoodOrderCountList(id, warehousing_id, params) {
132
+  return request({
133
+    url: '/api/supply/getgoodordercountlist?id=' + id + '&warehousing_id=' + warehousing_id,
134
+    method: 'get',
135
+    params: params
136
+  })
137
+}
138
+
139
+export function ModefySupplyWarehousing(params) {
140
+  return request({
141
+    url: '/api/supply/modefysupplywarehousing',
142
+    method: 'get',
143
+    params: params
144
+  })
145
+}

+ 4 - 3
src/lang/zh.js Voir le fichier

@@ -137,9 +137,10 @@ export default {
137 137
     addStockIn: '入库',
138 138
     stockQuery: '库存查询',
139 139
     supplyQuery: '供应商管理',
140
-    purchaseOrderQuery: '购货订单',
141
-    goodOrderQuery: '购货单',
142
-    addPurchaseOrder: '新增购货订单',
140
+    purchaseOrderQuery: '采购订单',
141
+    goodOrderQuery: '采购单',
142
+    goodReturnQuery: '退货单',
143
+    addPurchaseOrder: '新增采购订单',
143 144
     workforce_template: '排班模板设置',
144 145
     statistics: '统计分析',
145 146
     statisticalConfig: '统计配置',

+ 25 - 0
src/router/modules/supply.js Voir le fichier

@@ -75,6 +75,31 @@ export default {
75 75
       hidden: true,
76 76
       is_menu: false,
77 77
       isChild: true
78
+    },
79
+    {
80
+      path: '/good/order/edit',
81
+      component: () => import('@/xt_pages/supply/components/editGoodOrder'),
82
+      name: 'editGoodOrder',
83
+      meta: { title: 'editGoodOrder', noCache: true },
84
+      hidden: true,
85
+      is_menu: false,
86
+      isChild: true
87
+    },
88
+    // 退货单模块
89
+    {
90
+      path: '/good/return/query',
91
+      component: () => import('@/xt_pages/supply/goodreturn'),
92
+      name: 'goodReturnQuery',
93
+      meta: { title: 'goodReturnQuery', noCache: true }
94
+    },
95
+    {
96
+      path: '/good/return/add',
97
+      component: () => import('@/xt_pages/supply/components/addGoodReturn'),
98
+      name: 'addGoodReturn',
99
+      meta: { title: 'addGoodReturn', noCache: true },
100
+      hidden: true,
101
+      is_menu: false,
102
+      isChild: true
78 103
     }
79 104
 
80 105
   ]

+ 4 - 0
src/xt_pages/dialysis/details/assessmentAfter.vue Voir le fichier

@@ -316,6 +316,10 @@
316 316
           <label>机器运行: </label>
317 317
           <span class="content" >{{ this.record.machine_run}}</span>
318 318
         </li>
319
+        <li v-if="isShow('透后尿素')">
320
+          <label>透后尿素(mmol/L): </label>
321
+          <span class="content" >{{ this.record.after_urea}}</span>
322
+        </li>
319 323
       </ul>
320 324
     </div>
321 325
     <!-- <div class="note">

+ 6 - 0
src/xt_pages/dialysis/details/assessmentBefore.vue Voir le fichier

@@ -370,6 +370,12 @@
370 370
           <span class="content">{{this.record.blood_pressure_during_dialysis}}</span>
371 371
           <span class="unit"></span>
372 372
         </li>
373
+
374
+        <li v-if="isShow('透前尿素')">
375
+          <label>透前尿素(mmol/L): </label>
376
+          <span class="content">{{this.record.urea_befor}}</span>
377
+          <span class="unit"></span>
378
+        </li>
373 379
        
374 380
       </ul>
375 381
     </div>

+ 10 - 97
src/xt_pages/dialysis/details/dialog/AssessmentAfterDislysis.vue Voir le fichier

@@ -440,73 +440,7 @@
440 440
           </el-form-item>
441 441
         </el-col>
442 442
 
443
-        <!-- </el-row>
444
-
445
-        <el-row :gutter="20"> -->
446
-
447
-        <!-- </el-row>
448
-
449
-        <el-row :gutter="20"> -->
450
-
451
-        <!--          <el-col :span="8" v-if="isShow('血管通路部位')">-->
452
-        <!--            <el-form-item label="血管通路部位: ">-->
453
-        <!--              <el-select v-model="form.blood_access_part_id">-->
454
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
455
-
456
-        <!--                <el-option-->
457
-        <!--                  v-for="item in vascularAccessOptions"-->
458
-        <!--                  :label="item.name"-->
459
-        <!--                  :value="item.id"-->
460
-        <!--                  :key="item.id"-->
461
-        <!--                ></el-option>-->
462
-        <!--              </el-select>-->
463
-        <!--            </el-form-item>-->
464
-        <!--          </el-col>-->
465
-        <!--          <el-col :span="8" v-if="isShow('血管通路')">-->
466
-        <!--            <el-form-item label="血管通路: ">-->
467
-        <!--              <el-select v-model="form.blood_access_part_opera_id">-->
468
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
469
-
470
-        <!--                <el-option-->
471
-        <!--                  v-for="item in vascularAccessDescOptions"-->
472
-        <!--                  :label="item.name"-->
473
-        <!--                  :value="item.id"-->
474
-        <!--                  :key="item.id"-->
475
-        <!--                ></el-option>-->
476
-        <!--              </el-select>-->
477
-        <!--            </el-form-item>-->
478
-        <!--          </el-col>-->
479
-        <!-- </el-row>
480
-
481
-        <el-row :gutter="20"> -->
482
-
483
-        <!-- </el-row>
484
-
485
-
486
-
487
-          <el-row :gutter="20" > -->
488
-
489
-        <!--
490
-                  </el-row>
491
-
492
-
493
-
494
-
495
-                  <el-row :gutter="20"> -->
496
-        <!--          <el-col :span="8" v-if="isShow('内瘘震颤和血管杂音')">-->
497
-        <!--            <el-form-item label="内瘘震颤和血管杂音: ">-->
498
-        <!--              <el-select v-model="form.tremor_noise">-->
499
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
500
-
501
-        <!--                <el-option-->
502
-        <!--                  v-for="item in this.$store.getters.tremor_noise"-->
503
-        <!--                  :label="item.name"-->
504
-        <!--                  :value="item.id"-->
505
-        <!--                  :key="item.id"-->
506
-        <!--                ></el-option>-->
507
-        <!--              </el-select>-->
508
-        <!--            </el-form-item>-->
509
-        <!--          </el-col>-->
443
+      
510 444
         <el-col :span="8" v-if="isShow('失衡综合症')">
511 445
           <el-form-item label="失衡综合症: ">
512 446
             <el-select v-model="form.disequilibrium_syndrome">
@@ -521,36 +455,7 @@
521 455
             </el-select>
522 456
           </el-form-item>
523 457
         </el-col>
524
-        <!--          <el-col :span="8" v-if="isShow('失衡综合症症状')">-->
525
-        <!--            <el-form-item label="失衡综合症症状: ">-->
526
-        <!--              <el-input-->
527
-        <!--                v-model="form.disequilibrium_syndrome_option"-->
528
-        <!--                readonly-->
529
-        <!--                @focus="showDialog('8')"-->
530
-        <!--              ></el-input>-->
531
-        <!--            </el-form-item>-->
532
-        <!--          </el-col>-->
533
-
534
-        <!-- </el-row>
535
-
536
-
537
-
538
-          <el-row :gutter="20"  > -->
539
-
540
-        <!--          <el-col :span="8" v-if="isShow('透析器')">-->
541
-        <!--            <el-form-item label="透析器凝血: ">-->
542
-        <!--              <el-select v-model="form.dialyzer">-->
543
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
544
-
545
-        <!--                <el-option-->
546
-        <!--                  v-for="item in this.$store.getters.dialyzer"-->
547
-        <!--                  :label="item.name"-->
548
-        <!--                  :value="item.id"-->
549
-        <!--                  :key="item.id"-->
550
-        <!--                ></el-option>-->
551
-        <!--              </el-select>-->
552
-        <!--            </el-form-item>-->
553
-        <!--          </el-col>-->
458
+      
554 459
         <el-col :span="8" v-if="isShow('透析期间进食')">
555 460
           <el-form-item label="透析期间进食: ">
556 461
             <el-radio-group v-model="form.is_eat">
@@ -693,6 +598,12 @@
693 598
               </el-select>
694 599
             </el-form-item>
695 600
        </el-col>
601
+
602
+       <el-col :span="8" v-if="isShow('透后尿素')">
603
+            <el-form-item label="透后尿素(mmol/L):" label-width="150px">
604
+              <el-input v-model="form.after_urea"></el-input>
605
+            </el-form-item>
606
+       </el-col>
696 607
         <el-col :span="24" v-if="isShow('KT/V')">
697 608
             <el-form-item label="KT/V:">
698 609
               <el-input type="textarea" :rows="4" v-model="form.ktv"></el-input>
@@ -869,6 +780,7 @@ export default {
869 780
         consciousness:"",
870 781
         fallrisk:"",
871 782
         machine_run:"",
783
+        after_urea:"",
872 784
       },
873 785
       lapseList:[],
874 786
       leaveOfficeMethod:[],
@@ -1086,6 +998,7 @@ export default {
1086 998
       data["consciousness"] = this.form.consciousness
1087 999
       data["fallrisk"] = this.form.fallrisk
1088 1000
       data["machine_run"] = this.form.machine_run
1001
+      data["after_urea"] = this.form.after_urea
1089 1002
       console.log("Paramsquery",data)
1090 1003
      
1091 1004
       postAssessmentAfterDislysis(ParamsQuery, data)

+ 9 - 0
src/xt_pages/dialysis/details/dialog/assessmentBeforeDislysisDialog.vue Voir le fichier

@@ -538,6 +538,14 @@
538 538
              <el-input v-model="assessmentBeforeDislysis.blood_pressure_during_dialysis"></el-input>
539 539
             </el-form-item>
540 540
           </el-col>
541
+
542
+     
543
+
544
+           <el-col :span="8" v-if="isShow('透前尿素')">
545
+            <el-form-item label="透前尿素(mmol/L):" label-width="150px">
546
+              <el-input v-model="assessmentBeforeDislysis.urea_befor"></el-input>
547
+            </el-form-item>
548
+          </el-col>
541 549
          
542 550
           <el-col :span="24">
543 551
             <el-form-item label="备注: ">
@@ -707,6 +715,7 @@
707 715
           period:"",
708 716
           estimated_food_intake:"",
709 717
           blood_pressure_during_dialysis:"",
718
+          urea_befor:"",
710 719
         },
711 720
 
712 721
         InnerDialogProps: {

+ 5 - 2
src/xt_pages/outpatientCharges/invoicePrint.vue Voir le fichier

@@ -13,12 +13,13 @@
13 13
     </template>
14 14
     <div class="app-container" style="padding-top:40px;">
15 15
         <div class='dialysisPage'>
16
-          <div v-if="org_id != 10106 && org_id != 10215 && org_id != 4" >
16
+          <div v-if="org_id != 10106 && org_id != 10215 && org_id != 4 && org_id != 10188" >
17 17
             <printOne v-if="org_id != 10088" :paramsObj="invoiceParams"></printOne>
18 18
             <printThree v-if="org_id == 10088" :paramsObj="invoiceParams"></printThree>
19 19
           </div>
20 20
           <printTwo v-if="org_id == 10106" :paramsObj="invoiceParams"></printTwo>
21 21
           <printFour v-if="org_id == 10215 || org_id == 4" :paramsObj="invoiceParams"></printFour>
22
+          <printFive v-if="org_id == 10188" :paramsObj="invoiceParams"></printFive>
22 23
         </div>
23 24
     </div>
24 25
   </div>
@@ -29,13 +30,15 @@ import printOne from './invoiceTemplate/printOne'
29 30
 import printTwo from './invoiceTemplate/printTwo'
30 31
 import printThree from './invoiceTemplate/printThree'
31 32
 import printFour from './invoiceTemplate/printFour'
33
+import printFive from './invoiceTemplate/printFive'
32 34
 export default {
33 35
    name: "invoicePrint",
34 36
   components: {
35 37
     printOne,
36 38
     printTwo,
37 39
     printThree,
38
-    printFour
40
+    printFour,
41
+    printFive
39 42
   },
40 43
   props:{
41 44
     invoiceParams:Object

+ 222 - 0
src/xt_pages/outpatientCharges/invoiceTemplate/printFive.vue Voir le fichier

@@ -0,0 +1,222 @@
1
+<template>
2
+    <div id='invoice-print'>
3
+        <div v-for='(i,index) in pageArr.length' :key="index">
4
+            <div :style="{position: 'absolute',top:(10 + (index * 500))  + 'px',left:70+ 'px',}">{{ list.order_number }}</div>
5
+            <div style="display:flex;justify-content: space-between;">
6
+                <div :style="{position: 'absolute',top:(40 + (index * 500))  + 'px',left:80+ 'px',}"> {{ paramsObj.name }}</div>
7
+            </div>
8
+            <div :style="{position: 'absolute',top:(100 + (index * 500))  + 'px',left:80+ 'px',}">
9
+                <div v-if="list.westernMedicineCostTotal">西药 {{ list.westernMedicineCostTotal }}</div>
10
+                <div v-if="list.treatCostTotal">治疗费 {{ list.treatCostTotal }}</div>
11
+                <div v-if="list.bedCostTotal">床位费 {{ list.bedCostTotal }}</div>
12
+                <div v-if="list.chineseTraditionalMedicineCostTotal">中成药 {{ list.chineseTraditionalMedicineCostTotal }}</div>
13
+                <div v-if="list.laboratoryCostTotal">化验费 {{ list.laboratoryCostTotal }}</div>
14
+                <div v-if="list.operationCostTotal">手术费 {{ list.operationCostTotal }}</div>
15
+                <div v-if="list.otherCostTotal">其他费 {{ list.otherCostTotal }}</div>
16
+                <div v-if="list.materialCostTotal">材料费 {{ list.materialCostTotal }}</div>
17
+            </div>
18
+            <div :style="{position: 'absolute',top:(100 + (index * 500))  + 'px',left:260+ 'px'}">
19
+                <div v-for="item in list.order_info.slice(index * 10,(index * 10) + pageArr[index])">
20
+                    <span style="display:inline-block;width:200px;">
21
+                        <span v-if="item.advice.id == 0">
22
+                            <span v-if="item.project.type == 2">{{ item.project.project.project_name }}</span>
23
+                            <span v-if="item.project.type == 3">{{ item.project.good_info.good_name }}</span>
24
+                        </span>
25
+                        <span v-else>{{ item.advice.advice_name }}</span>
26
+                    </span>
27
+                    <span style="display:inline-block;width:50px;">
28
+                        <span v-if="item.advice.id == 0">
29
+                            <span v-if="item.project.type == 2">{{ item.project.count }}{{ item.project.unit }}</span>
30
+                            <span v-if="item.project.type == 3">{{ item.project.count }}{{ item.project.unit }}</span>
31
+                        </span>
32
+                        <span v-else>{{ item.advice.prescribing_number }}{{ item.advice.prescribing_number_unit }}</span>
33
+                    </span>
34
+                    <span>
35
+                        <span v-if="item.advice.id == 0">
36
+                            <span v-if="item.project.type == 2">{{ (item.project.count * item.pric).toFixed(2) }}</span>
37
+                            <span v-if="item.project.type == 3">{{ (item.project.count * item.pric).toFixed(2) }}</span>
38
+                        </span>
39
+                        <span v-else>{{ (item.advice.prescribing_number * item.pric).toFixed(2) }}</span>
40
+                    </span>
41
+                </div>
42
+            </div>
43
+            <div :style="{position: 'absolute',top:(315 + (index * 500))  + 'px',left:110+ 'px'}">{{ zhongwen }}</div>
44
+            <div :style="{position: 'absolute',top:(315 + (index * 500))  + 'px',left:460+ 'px'}">{{ list.medfee_sumamt }}</div>
45
+            <div v-if="index == pageArr.length - 1" :style="{position: 'absolute',top:(330 + (index * 500))  + 'px',left:110+ 'px',width:100 + '%'}">
46
+                <div style="display:flex;">
47
+                    <div style="width:140px">医疗总费用:{{ list.medfee_sumamt }}</div>
48
+                    <div style="width:140px">现金支出:{{ list.psn_cash_money }}</div>
49
+                    <div style="width:140px">上次账户:0</div>
50
+                    <div style="width:140px">本次账户:0</div>
51
+                </div>
52
+                <div style="display:flex;">
53
+                    <div style="width:140px">账户余额:{{ list.order.balc }}</div>
54
+                    <div style="width:140px">统筹支出:{{ list.order.hifp_pay }}</div>
55
+                    <div style="width:140px">大病支出:0</div>
56
+                    <div style="width:140px">民政支出:0</div>
57
+                </div>
58
+                <div style="display:flex;">
59
+                    <div style="width:140px">大病补充保险支出:0</div>
60
+                    <div style="width:280px">企业补充医疗保险基金支出:{{ list.order.hifes_pay }}</div>
61
+                    <div style="width:140px">其他支出:{{ list.order.oth_pay }}</div>
62
+                </div>
63
+            </div>
64
+            <div>
65
+                <div :style="{position: 'absolute',top:(390 + (index * 500))  + 'px',left:100+ 'px'}">{{ org_name }}</div>
66
+                <div :style="{position: 'absolute',top:(390 + (index * 500))  + 'px',left:360+ 'px'}">{{ paramsObj.chargeName }}</div>
67
+                <div :style="{position: 'absolute',top:(390 + (index * 500))  + 'px',left:520+ 'px'}">
68
+                    <span>{{  paramsObj.setl_time ? paramsObj.setl_time.split(' ')[0].slice(0,4) : getTime(list.date, '{y}-{m}-{d}').slice(0,4) }}</span>
69
+                </div>
70
+                <div :style="{position: 'absolute',top:(390 + (index * 500))  + 'px',left:560+ 'px'}">
71
+                    <span>{{ paramsObj.setl_time ? parseInt(paramsObj.setl_time.split(' ')[0].slice(5,7)) : getTime(list.date, '{y}-{m}-{d}').slice(5,7) }}</span>
72
+                </div>
73
+                <div :style="{position: 'absolute',top:(390 + (index * 500))  + 'px',left:600+ 'px'}">
74
+                    <span>{{ paramsObj.setl_time ? parseInt(paramsObj.setl_time.split(' ')[0].slice(8,11)) : getTime(list.date, '{y}-{m}-{d}').slice(8,11) }}</span>
75
+                </div>
76
+            </div>
77
+        </div>
78
+    </div>
79
+</template>
80
+
81
+
82
+<script>
83
+import { getInvoice } from '@/api/project/project'
84
+import { uParseTime } from '@/utils/tools'
85
+export default {
86
+    props:{
87
+        paramsObj:Object
88
+    },
89
+    data(){
90
+        return{
91
+            list:{},
92
+            printDate:'',
93
+            zhongwen:'',
94
+            totalPrice:0.0,
95
+            org_id:'',
96
+            org_name:'',
97
+            page:1,
98
+            pageArr:[],
99
+        }
100
+    },
101
+    created(){
102
+        console.log('paramsObj',this.paramsObj)
103
+        let params = {
104
+            order_id: this.paramsObj.order_id,
105
+            patient_id: this.paramsObj.patient_id,
106
+        }
107
+        this.getInvoice(params)
108
+        // var data = new Date();
109
+        // var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
110
+        // var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
111
+        // this.printDate = data.getFullYear() + "-" + month + "-" + date;
112
+        // this.smalltoBIG(982732.21)
113
+        this.org_id = this.$store.getters.xt_user.org_id
114
+        this.org_name = this.$store.getters.xt_user.org.org_name
115
+    },
116
+    methods:{
117
+        getInvoice(params){
118
+            getInvoice(params).then((res) => {
119
+                console.log('res',res)
120
+                this.list = res.data.data
121
+                this.totalPrice = this.list.westernMedicineCostTotal + this.list.checkCostTotal + this.list.treatCostTotal + this.list.bedCostTotal + this.list.chineseTraditionalMedicineCostTotal +
122
+                                    this.list.laboratoryCostTotal + this.list.operationCostTotal + this.list.otherCostTotal + this.list.materialCostTotal
123
+                this.smalltoBIG(this.list.medfee_sumamt)
124
+                var data = new Date(res.data.data.date * 1000);
125
+                var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
126
+                var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
127
+                this.printDate = data.getFullYear() + "-" + month + "-" + date;
128
+                this.pageArr = []
129
+                this.getPage()
130
+                console.log('pageArr',this.pageArr)
131
+            })
132
+        },
133
+        smalltoBIG(n) {
134
+            // let fraction = ['角', '分'];
135
+            // let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
136
+            // let unit = [['元.', '万,', '亿,'], ["元",'拾', '佰', '仟']];
137
+            // let head = price < 0 ? '欠' : '';
138
+            // price = Math.abs(price);
139
+            // let upper = '';
140
+            // for (let i = 0; i < fraction.length; i++) {
141
+            // upper += (digit[Math.floor(price * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
142
+            // }
143
+            // upper = upper || '整';
144
+            // price = Math.floor(price);
145
+            // for (let i = 0; i < unit[0].length && price > 0; i++) {
146
+            // let p = '';
147
+            // for (let j = 0; j < unit[1].length && price > 0; j++) {
148
+            //     p = digit[price % 10] + unit[1][j] + p;
149
+            //     price = Math.floor(price / 10);
150
+            // }
151
+            // upper = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + upper;
152
+            // }
153
+            // this.zhongwen = head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整')
154
+            // console.log('6666',head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整'))
155
+            if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)){
156
+                return "数据非法";  //判断数据是否大于0
157
+            }
158
+
159
+            var unit = "仟佰拾亿仟佰拾万仟佰拾元角分", str = "";
160
+            n += "00";  
161
+
162
+            var indexpoint = n.indexOf('.');  // 如果是小数,截取小数点前面的位数
163
+
164
+            if (indexpoint >= 0){
165
+
166
+                n = n.substring(0, indexpoint) + n.substr(indexpoint+1, 2);   // 若为小数,截取需要使用的unit单位
167
+            }
168
+
169
+            unit = unit.substr(unit.length - n.length);  // 若为整数,截取需要使用的unit单位
170
+            for (var i=0; i < n.length; i++){
171
+                str += "零壹贰叁肆伍陆柒捌玖".charAt(n.charAt(i)) + unit.charAt(i);  //遍历转化为大写的数字
172
+            }
173
+            console.log("str",str)
174
+            if(str == '零元零角零分'){
175
+                this.zhongwen = '零'
176
+            }else{
177
+                this.zhongwen =  str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
178
+            }
179
+
180
+            console.log(this.zhongwen)
181
+        },
182
+        getTime(value, temp) {
183
+            if (value == 0) {
184
+                return ''
185
+            }
186
+            if (value != undefined) {
187
+                return uParseTime(value, temp)
188
+            }
189
+            return ''
190
+        },
191
+        getPage(){
192
+        if(this.list.order_info.length <= 10){
193
+            this.page = 1
194
+            this.pageArr.push(this.list.order_info.length)
195
+        }else if(this.list.order_info.length > 10){
196
+            this.page = parseInt(this.list.order_info.length / 10)
197
+            let num = this.list.order_info.length % 10
198
+            for (var i=0;i<this.page;i++){
199
+                this.pageArr.push(10)
200
+            }
201
+            if(num != 0){
202
+                this.pageArr.push(num)
203
+            }
204
+        }
205
+      }
206
+
207
+    },
208
+    watch:{
209
+        paramsObj:{//深度监听,可监听到对象、数组的变化
210
+            handler(val, oldVal){
211
+                let params = {
212
+                    order_id: val.order_id,
213
+                    patient_id: val.patient_id,
214
+                }
215
+                this.getInvoice(params)
216
+
217
+            },
218
+            deep:true
219
+        }
220
+    }
221
+}
222
+</script>

+ 9 - 9
src/xt_pages/sign/signIn.vue Voir le fichier

@@ -71,7 +71,7 @@
71 71
                                     <span v-if="queueInfo.schedule_type == 1">上午</span>
72 72
                                     <span v-if="queueInfo.schedule_type == 2">下午</span>
73 73
                                     <span v-if="queueInfo.schedule_type == 3">晚上</span>
74
-                                    <span style="font-size:180px;">{{ queueInfo.queue_no }}号</span>
74
+                                    <span style="font-size:10vh;">{{ queueInfo.queue_no }}号</span>
75 75
                                 </p>
76 76
                             </div>
77 77
                             <div class="signInMianRightBottom"><span style="margin:0 auto;" v-if='Object.keys(queueInfo).length>0'>签到成功</span></div>
@@ -102,7 +102,7 @@
102 102
                                     <p>
103 103
                                         上午2号
104 104
                                     </p>
105
-                                    <p>张三</p>
105
+                                    <p>张三</p>
106 106
                                     <p>400001</p>
107 107
                                     <p>07:00</p>
108 108
                                 </div>
@@ -114,7 +114,7 @@
114 114
                                 <p style="margin: 0 auto;display:flex;align-items: center;"><span>排队号</span></p>
115 115
                                 <p style="margin: 0 auto;display:flex;align-items: center;">
116 116
                                     <span>上午</span>
117
-                                    <span style="font-size:7vw">69号</span>
117
+                                    <span style="font-size:10vh">69号</span>
118 118
                                 </p>
119 119
                             </div>
120 120
                             <div class="signInMianRightBottom"><span style="margin:0 auto;">签到成功</span></div>
@@ -164,7 +164,7 @@
164 164
                                     <span v-if="queueInfo.schedule_type == 1">上午</span>
165 165
                                     <span v-if="queueInfo.schedule_type == 2">下午</span>
166 166
                                     <span v-if="queueInfo.schedule_type == 3">晚上</span>
167
-                                    <span style="font-size:7vw;">{{ queueInfo.queue_no }}号</span>
167
+                                    <span style="font-size:10vh;">{{ queueInfo.queue_no }}号</span>
168 168
                                 </p>
169 169
                             </div>
170 170
                             <div class="signInMianRightBottom"><span style="margin:0 auto;" v-if='Object.keys(queueInfo).length>0'>签到成功</span></div>
@@ -195,19 +195,19 @@
195 195
                                     <p>
196 196
                                         上午2号
197 197
                                     </p>
198
-                                    <p>张三</p>
198
+                                    <p>张三</p>
199 199
                                     <p>400001</p>
200 200
                                     <p>07:00</p>
201 201
                                 </div>
202 202
                             </div>
203 203
                         </div>
204 204
                         <div class="signInMainRight">
205
-                            <div class="signInMainRightTitle"><span style="margin:0 auto;">张三</span></div>
205
+                            <div class="signInMainRightTitle"><span style="margin:0 auto;">张三</span></div>
206 206
                             <div class="signInMainRightContent">
207 207
                                 <p style="margin: 0 auto;display:flex;align-items: center;"><span>排队号</span></p>
208 208
                                 <p style="margin: 0 auto;display:flex;align-items: center;">
209 209
                                     <span>上午</span>
210
-                                    <span style="font-size:7vw">69号</span>
210
+                                    <span style="font-size:10vh">69号</span>
211 211
                                 </p>
212 212
                             </div>
213 213
                             <div class="signInMianRightBottom"><span style="margin:0 auto;">签到成功</span></div>
@@ -525,7 +525,7 @@ export default {
525 525
         height: 27.5%;
526 526
         border-radius: 15px 15px 0 0;
527 527
         background: #1A82BF;
528
-        font-size: 14vh;
528
+        font-size: 10vh;
529 529
         font-weight: 600;
530 530
         color:#fff;
531 531
         display: flex;
@@ -539,7 +539,7 @@ export default {
539 539
         font-weight: 600;
540 540
         color:#1C6895;
541 541
         box-sizing: border-box;
542
-        font-size:8vh;
542
+        font-size:6vh;
543 543
         display:flex;
544 544
         align-items:center;
545 545
         flex-direction: column;

+ 14 - 6
src/xt_pages/stock/detail/stockOutDetail.vue Voir le fichier

@@ -126,8 +126,11 @@
126 126
         </el-table-column>
127 127
         <el-table-column label="出货价" align="center">
128 128
           <template slot-scope="scope">
129
-            <span v-if="scope.row.is_total == 0 && (orgId == 9919 || orgId == 9671)">{{scope.row.GoodInfo.buy_price}}</span>
130
-            <span v-else> {{ scope.row.price }} </span>
129
+            <span v-if="scope.row.is_total == 0 && (orgId == 9919)">{{scope.row.GoodInfo.buy_price}}</span>
130
+            <span v-else> 
131
+              <span v-if="scope.row.price > 0"> {{ scope.row.price }} </span> 
132
+               <span v-if="scope.row.price == 0"> {{ scope.row.GoodInfo.packing_price }} </span> 
133
+            </span>
131 134
           </template>
132 135
         </el-table-column>
133 136
         <el-table-column label="数量" align="center">
@@ -138,9 +141,8 @@
138 141
         </el-table-column>
139 142
         <el-table-column label="总价" align="center">
140 143
           <template slot-scope="scope">
141
-            <span v-if="scope.row.is_total == 0">{{
142
-              getTotal(scope.row.price, scope.row.count)
143
-            }}</span>
144
+            <span v-if="scope.row.is_total == 0 && scope.row.price > 0">{{getTotal(scope.row.price, scope.row.count)}}</span>
145
+             <span v-if="scope.row.is_total == 0 && scope.row.price == 0">{{getTotal(scope.row.GoodInfo.packing_price, scope.row.count)}}</span>
144 146
             <span v-else>{{ scope.row.total }}</span>
145 147
           </template>
146 148
         </el-table-column>
@@ -371,7 +373,13 @@ export default {
371 373
           for (let i = 0; i < response.data.data.list.length; i++) {
372 374
             this.tableData.push(response.data.data.list[i])
373 375
             var obj = response.data.data.list[i];
374
-            total += response.data.data.list[i].price * response.data.data.list[i].count
376
+            if(response.data.data.list[i].price > 0){
377
+               total += response.data.data.list[i].price * response.data.data.list[i].count
378
+            }
379
+            if(response.data.data.list[i].price == 0){
380
+               total += response.data.data.list[i].GoodInfo.packing_price * response.data.data.list[i].count
381
+            }
382
+           
375 383
             obj["is_total"] = 0;
376 384
             this.cancelStockDate.push(obj);
377 385
           }

+ 5 - 2
src/xt_pages/stock/drugs/drugStockInOrderAdd.vue Voir le fichier

@@ -10,7 +10,7 @@
10 10
         <el-button size="small" type="primary" @click="submit()" class="filter-item">保 存</el-button>
11 11
       </div>
12 12
     </div>
13
-    <div class="app-container">
13
+    <div class="app-container" v-loading="loading">
14 14
 
15 15
     
16 16
       <drugs-stock-dialog
@@ -451,6 +451,7 @@
451 451
         drugTypeList:[],
452 452
         totalPrice:0,
453 453
         unitList:[],
454
+        loading:false,
454 455
       }
455 456
     },
456 457
     methods: {
@@ -705,7 +706,7 @@
705 706
       submit() {
706 707
         this.$refs['tableForm'].validate((valid) => {
707 708
           if (valid) {
708
-            
709
+            this.loading = true
709 710
             const array = this.recordInfo.recordData
710 711
           
711 712
             for (let i = 0; i < array.length; i++) {
@@ -748,9 +749,11 @@
748 749
            
749 750
             postDrugWarehouse(params, this.warehousing_time, this.form.manufacturer, this.form.dealer, this.type).then(response => {
750 751
               if (response.data.state == 0) {
752
+                this.loading = false
751 753
                 this.$message.error(response.data.msg)
752 754
                 return false
753 755
               } else {
756
+                this.loading = false
754 757
                 this.$message.success('入库成功')
755 758
                 this.listLoading = false
756 759
                 this.$router.back(-1)

+ 5 - 1
src/xt_pages/stock/drugs/drugStockInOrderEdit.vue Voir le fichier

@@ -24,7 +24,7 @@
24 24
       </div>
25 25
     </div>
26 26
 
27
-    <div class="app-container">
27
+    <div class="app-container" v-loading="loading">
28 28
     
29 29
       <drugs-stock-dialog
30 30
         ref="dialog"
@@ -438,6 +438,7 @@ export default {
438 438
       listLoading:false,
439 439
       unitList:[],
440 440
       drug_show:false,
441
+      loading:false,
441 442
     };
442 443
   },
443 444
   methods: {
@@ -648,6 +649,7 @@ export default {
648 649
     submit() {
649 650
       this.$refs["tableForm"].validate(valid => {
650 651
         if (valid) {
652
+          this.loading = true
651 653
           const array = this.recordInfo.recordData;
652 654
         
653 655
           for (let i = 0; i < array.length; i++) {
@@ -699,8 +701,10 @@ export default {
699 701
             if (response.data.state == 0) {
700 702
               this.$message.error(response.data.msg);
701 703
               this.listLoading = false
704
+              this.loading = false
702 705
               return false;
703 706
             } else {
707
+              this.loading = false
704 708
               this.$message.success("入库成功");
705 709
               this.listLoading = false
706 710
               this.$router.back(-1);

+ 5 - 2
src/xt_pages/stock/stockFlow.vue Voir le fichier

@@ -107,7 +107,8 @@
107 107
     
108 108
         <el-table-column prop="drug_name" label="单价"  align="center">
109 109
            <template slot-scope="scope">
110
-             <span>{{scope.row.price}}</span>
110
+             <span v-if="scope.row.price >0">{{scope.row.price}}</span>
111
+             <span v-if="scope.row.price == 0">{{good.packing_price}}</span>
111 112
            </template>
112 113
         </el-table-column>
113 114
          <el-table-column prop="drug_name" label="有效期" align="center">
@@ -226,7 +227,8 @@
226 227
         keywords:"",
227 228
         obj:{},
228 229
         packing_unit:"",
229
-        cancelCountList:[]
230
+        cancelCountList:[],
231
+        good:{}
230 232
       }
231 233
     },
232 234
     methods:{
@@ -432,6 +434,7 @@
432 434
             console.log("total",total)
433 435
             this.tableList = list
434 436
             this.total = total
437
+            this.good = response.data.data.good
435 438
            var manufacturerList = response.data.data.manufacturerList
436 439
            this.manufacturerList = manufacturerList
437 440
           }

+ 5 - 2
src/xt_pages/stock/stockInOrderAdd.vue Voir le fichier

@@ -10,7 +10,7 @@
10 10
         <el-button size="small" type="primary" @click="submit()" class="filter-item">保 存</el-button>
11 11
       </div>
12 12
     </div>
13
-    <div class="app-container">
13
+    <div class="app-container" v-loading="loading">
14 14
 
15 15
       <stock-in-dialog ref="dialog" :propForm="propForm"
16 16
                        :visibility="isVisibility"
@@ -377,7 +377,7 @@
377 377
         goodType: [],
378 378
         manufacturerList:[],
379 379
         goodList:[],
380
-       
380
+        loading:false,
381 381
       }
382 382
     },
383 383
     methods: {
@@ -663,6 +663,7 @@
663 663
         console.log("res23322332",this.$refs)
664 664
         this.$refs['tableForm'].validate((valid) => {
665 665
           if (valid) {
666
+            this.loading = true
666 667
             const array = this.recordInfo.recordData
667 668
             console.log("array9999999",array)
668 669
             for (let i = 0; i < array.length; i++) {
@@ -710,11 +711,13 @@
710 711
             
711 712
             postWarehouse(params, this.warehousing_time, this.form.manufacturer, this.form.dealer, this.type).then(response => {
712 713
               if (response.data.state == 0) {
714
+                this.loading = false
713 715
                 this.$message.error(response.data.msg)
714 716
                 loading.close()
715 717
                 return false
716 718
               } else {
717 719
                 loading.close()
720
+                this.loading = false
718 721
                 this.$message.success('入库成功')
719 722
                 this.$router.back(-1)
720 723
               }

+ 6 - 2
src/xt_pages/stock/stockInOrderEdit.vue Voir le fichier

@@ -24,7 +24,7 @@
24 24
       </div>
25 25
     </div>
26 26
 
27
-    <div class="app-container">
27
+    <div class="app-container" v-loading="loading">
28 28
       <stock-in-dialog
29 29
         ref="dialog"
30 30
         :propForm="propForm"
@@ -393,7 +393,8 @@ export default {
393 393
       dealerList: [],
394 394
       goodType: [],
395 395
       manufacturerList:[],
396
-      numberList:[]
396
+      numberList:[],
397
+      loading:false,
397 398
     };
398 399
   },
399 400
   methods: {
@@ -611,6 +612,7 @@ export default {
611 612
      
612 613
       this.$refs["tableForm"].validate(valid => {
613 614
         if (valid) {
615
+          this.loading = true
614 616
           const array = this.recordInfo.recordData;
615 617
           for (let i = 0; i < array.length; i++) {
616 618
             if (array[i].good_type_id == 0) {
@@ -660,11 +662,13 @@ export default {
660 662
             this.form.dealer
661 663
           ).then(response => {
662 664
             if (response.data.state == 0) {
665
+              this.loading =false
663 666
               this.$message.error(response.data.msg);
664 667
               loading.close()
665 668
               return false;
666 669
             } else {
667 670
               loading.close()
671
+              this.loading = false
668 672
               this.$message.success("入库成功");
669 673
               this.$router.back(-1);
670 674
             }

+ 11 - 4
src/xt_pages/stock/stockOutOrder.vue Voir le fichier

@@ -206,13 +206,20 @@
206 206
           </el-table-column>
207 207
           <el-table-column label="出货价" align="center">
208 208
             <template slot-scope="scope">
209
-              {{ scope.row.price}}
209
+              <span v-if="scope.row.price >0">{{ scope.row.price}}</span> 
210
+              <span v-if="scope.row.price == 0">{{ scope.row.packing_price}}</span> 
210 211
             </template>
211 212
           </el-table-column>
212 213
           <el-table-column label="总价" align="center">
213 214
             <template slot-scope="scope">
214
-             <span v-if="scope.row.is_sys == 0">{{ (scope.row.count * scope.row.price).toFixed(2)}}</span> 
215
-             <span v-if="scope.row.is_sys == 1">{{(getOutStockCount(scope.row.good_id)*scope.row.price).toFixed(2)}}</span>
215
+             <span v-if="scope.row.is_sys == 0">
216
+               <span v-if="scope.row.price>0"> {{ (scope.row.count * scope.row.price).toFixed(2)}}</span>
217
+               <span v-if="scope.row.price == 0"> {{ (scope.row.count * scope.row.packing_price).toFixed(2)}}</span>
218
+              </span> 
219
+             <span v-if="scope.row.is_sys == 1">
220
+                <span v-if="scope.row.price >0 "> {{(getOutStockCount(scope.row.good_id)*scope.row.price).toFixed(2)}}</span>
221
+                <span v-if="scope.row.price ==0"> {{(getOutStockCount(scope.row.good_id)*scope.row.packing_price).toFixed(2)}}</span>
222
+             </span>
216 223
             </template>
217 224
           </el-table-column>
218 225
           <el-table-column label="生产厂家" align="center">
@@ -1486,7 +1493,7 @@ export default {
1486 1493
       }, 
1487 1494
      
1488 1495
       GetOrderDetailById(val){
1489
-        console.log("val",val)
1496
+       
1490 1497
          this.userList =[]
1491 1498
          var params = {
1492 1499
            id:val.warehouse_out_id,

+ 2 - 2
src/xt_pages/stock/stockOutOrderDetail.vue Voir le fichier

@@ -224,11 +224,11 @@
224 224
         }
225 225
         getWarehouseOutInfo(params).then(response => {
226 226
           if (response.data.state == 0) {
227
-
227
+ 
228 228
             this.$message.error(response.data.msg)
229 229
             return false
230 230
           } else {
231
-           
231
+            console.log("list2332323232323223",response.data.data.list)
232 232
             for (let i = 0; i < response.data.data.list.length; i++) {
233 233
               this.warehousingOutInfo.warehousingOutData.push(response.data.data.list[i])
234 234
             }

+ 296 - 96
src/xt_pages/supply/components/addGoodOrder.vue Voir le fichier

@@ -30,8 +30,8 @@
30 30
         value-format="yyyy-MM-dd"
31 31
         @change="startTimeChange"
32 32
         ></el-date-picker>
33
-        <span>交货日期:</span>
34
-        <el-date-picker
33
+        <!-- <span>交货日期:</span> -->
34
+        <!-- <el-date-picker
35 35
             size="small"
36 36
             v-model="end_time"
37 37
             prefix-icon="el-icon-date"
@@ -43,16 +43,15 @@
43 43
             format="yyyy-MM-dd"
44 44
             value-format="yyyy-MM-dd"
45 45
             @change="endTimeChange"
46
-        ></el-date-picker>
47
-        <span>单据编码:{{number}}</span>
46
+        ></el-date-picker> -->
47
+        <span>单据编码:{{good_number}}</span>
48 48
 
49 49
     </div>
50 50
     <div>
51
-        <el-button size="small" type="primary" @click="toAdd">生成购货单</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>
51
+        <el-button size="small" type="primary" @click="saveGoodOrder" v-show="showOne">保存</el-button>
52
+         <el-button size="small" type="primary" @click="updateGoodOrder" v-show="showTwo">修改</el-button>
53
+        <el-button size="small" type="primary"  @click="checkPurchaseOrder">审核</el-button>
54
+
56 55
        
57 56
     </div>
58 57
     </div>
@@ -95,9 +94,9 @@
95 94
             <el-input v-model="scope.row.supply_type" style="width:120px" :disabled="true"></el-input>
96 95
         </template>
97 96
     </el-table-column>
98
-    <el-table-column label="规格&单位" align="center" width="200px">
97
+    <el-table-column label="规格&单位" align="center" width="120px">
99 98
         <template slot-scope="scope">
100
-            <el-input v-model="scope.row.supply_specification_name" style="width:150px" :disabled="true"></el-input>
99
+            <el-input v-model="scope.row.supply_specification_name" style="width:100px" :disabled="true"></el-input>
101 100
         </template>
102 101
     </el-table-column>
103 102
      <el-table-column label="单位" align="center" width="120px">
@@ -117,9 +116,33 @@
117 116
           </el-form-item>  
118 117
         </template>
119 118
     </el-table-column>
120
-    <el-table-column label="可用库存" align="center" width="130px">
119
+    <el-table-column label="批号" align="center" width="130px">
120
+         <template slot="header" slot-scope="scope">
121
+            <span>批号<span style="color: red">*</span></span>
122
+        </template>
121 123
         <template slot-scope="scope">
122
-            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
124
+           <el-form-item  :prop="'tableList.' + scope.$index + '.supply_batch_number'" :rules='tableRules.supply_batch_number'>
125
+             <el-input v-model="scope.row.supply_batch_number" style="width:80px" :disabled="disabled"></el-input>
126
+          </el-form-item>
127
+        </template>
128
+    </el-table-column>
129
+     <el-table-column label="有效日期" align="center" width="200px">
130
+        <template slot="header" slot-scope="scope">
131
+              <span>有效日期<span style="color: red">*</span></span>
132
+            </template>
133
+            <template slot-scope="scope">
134
+              <el-form-item  :prop="'tableList.' + scope.$index + '.supply_expiry_date'"
135
+                :rules="tableRules.supply_expiry_date">
136
+                <el-date-picker prefix-icon="el-icon-date" style="width:180px" v-model="scope.row.supply_expiry_date"
137
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
138
+                                value-format="yyyy-MM-dd">
139
+                </el-date-picker>
140
+             </el-form-item>
141
+       </template>
142
+    </el-table-column>
143
+    <el-table-column label="可用库存" align="center" width="100px">
144
+        <template slot-scope="scope">
145
+            <el-input v-model="scope.row.supply_total" style="width:80px" :disabled="true"></el-input>
123 146
         </template>
124 147
     </el-table-column>
125 148
     <el-table-column label="数量" align="center" width="120px">
@@ -133,28 +156,54 @@
133 156
         </template>
134 157
     </el-table-column>
135 158
 
136
-    <el-table-column label="购单价" align="center" width="120px">
159
+    <el-table-column label="购单价" align="center" width="120px">
137 160
         <template slot-scope="scope">
138 161
         <el-input v-model="scope.row.supply_price" style="width:80px" :disabled="disabled"></el-input>
139 162
         </template>
140 163
     </el-table-column>
141 164
 
142
-    <el-table-column label="购金额" align="center" width="120px">
165
+    <el-table-column label="购金额" align="center" width="120px">
143 166
         <template slot-scope="scope">
144 167
           {{calculate(scope.row.supply_count * scope.row.supply_price)}}
145 168
         </template>
146 169
     </el-table-column>
147
-
148
-    <el-table-column label="生产厂商" align="center" width="200px">
170
+    <el-table-column label="生产日期" align="center" width="200px">
171
+         <template slot="header" slot-scope="scope">
172
+            <span>生产日期<span style="color: red">*</span></span>
173
+        </template>
174
+        <template slot-scope="scope">
175
+          <el-form-item  :prop="'tableList.' + scope.$index + '.supply_product_date'"
176
+                :rules="tableRules.supply_product_date">
177
+                <el-date-picker prefix-icon="el-icon-date" style="width: 180px" v-model="scope.row.supply_product_date"
178
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
179
+                                value-format="yyyy-MM-dd">
180
+                </el-date-picker>
181
+          </el-form-item>
182
+        </template>
183
+    </el-table-column>
184
+    <el-table-column label="生产厂家" align="center" width="200px">
149 185
         <template slot-scope="scope">
150
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
186
+         <el-select size="small" v-model="scope.row.supply_manufacturer" filterable placeholder="请选择厂家" :disabled="true">
187
+                <el-option
188
+                  v-for="(option, index) in manufactuerList"
189
+                  :key="index"
190
+                  :label="option.manufacturer_name"
191
+                  :value="option.id">
192
+                </el-option>
193
+          </el-select>
151 194
         </template>
152 195
     </el-table-column>
153 196
 
154 197
 
155 198
     <el-table-column label="批准文号" align="center" width="200px">
156 199
         <template slot-scope="scope">
157
-        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
200
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="true"></el-input>
201
+        </template>
202
+    </el-table-column>
203
+
204
+     <el-table-column label="关联采购订单号" align="center" width="200px">
205
+        <template slot-scope="scope">
206
+        <el-input v-model="scope.row.order_number" style="width:160px" :disabled="true"></el-input>
158 207
         </template>
159 208
     </el-table-column>
160 209
 
@@ -194,7 +243,10 @@
194 243
         <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
195 244
 
196 245
         <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
246
+      
247
+        <span>本次付款:<el-input style="width:100px" v-model="payment"></el-input></span>
197 248
 
249
+        <span>本次欠款:<el-input style="width:100px" v-model="arrearage"></el-input></span>
198 250
     </div>
199 251
 </div>
200 252
 
@@ -215,7 +267,7 @@
215 267
 <script>
216 268
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
217 269
 import {uParseTime } from '@/utils/tools'
218
-import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail} from "@/api/supply"
270
+import {getInitOrder,checkPurchaseOrder,getPurchaseOrderInfo,addGoodOrder,updateGoodOrder} from "@/api/supply"
219 271
 export default {
220 272
 name: "addPurchaseOrder",
221 273
 components: {
@@ -224,8 +276,8 @@ BreadCrumb
224 276
 data() {
225 277
 return {
226 278
     crumbs: [
227
-       { path: false, name: "购单" },
228
-       { path: "/spply/query", name: "新增购单" }
279
+       { path: false, name: "购单" },
280
+       { path: "/supply/good/order/query", name: "新增购单" }
229 281
     ],
230 282
     showTwo:true,
231 283
     showOne:false,
@@ -257,11 +309,14 @@ return {
257 309
     supplyList:[],
258 310
     rate_of_concession:"",
259 311
     discount_amount:"",
260
-    start_time:new Date(),
261
-    end_time:new Date(),
312
+    start_time:"",
313
+    end_time:"",
262 314
     tableRules: {
263 315
      name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
264 316
      supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
317
+     supply_batch_number:[{required:true,message:"批号不能为空", trigger: 'blur'}],
318
+     supply_product_date:[{required:true,message:"生产日期不能为空", trigger: 'blur'}],
319
+     supply_expiry_date:[{required:true,message:"有效日期不能为空",trigger: 'blur'}]
265 320
    },
266 321
    warehousing_id:0,
267 322
    number:"",
@@ -272,6 +327,13 @@ return {
272 327
    disabled:false,
273 328
    is_check:0,
274 329
    dialogVisible:false,
330
+   arrearage:"",
331
+   payment:"",
332
+   good_number:"",
333
+   orderInfo:[],
334
+   showOne:true,
335
+   showTwo:false,
336
+   warese_out_id:0,
275 337
   };
276 338
 },
277 339
 methods:{
@@ -310,11 +372,22 @@ getInitOrder(){
310 372
         drugList[i].type = 1
311 373
         drugList[i].supply_price = drugList[i].last_price
312 374
         drugList[i].name = drugList[i].drug_name
313
-        drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
375
+        if(drugList[i].max_unit != drugList[i].min_unit){
376
+          drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
377
+        }
378
+        if(drugList[i].max_unit == drugList[i].min_unit){
379
+          drugList[i].unitList = [{id:1,name:""}]
380
+        }
381
+       
314 382
         drugList[i].supply_unit = drugList[i].max_unit 
315 383
         for(let j=0;j<drugList[i].unitList.length;j++){
316
-           drugList[i].unitList[0].name = drugList[i].max_unit
317
-           drugList[i].unitList[1].name = drugList[i].min_unit
384
+          if(drugList[i].max_unit != drugList[i].min_unit){
385
+            drugList[i].unitList[0].name = drugList[i].max_unit
386
+            drugList[i].unitList[1].name = drugList[i].min_unit
387
+          }
388
+           if(drugList[i].max_unit == drugList[i].min_unit){
389
+             drugList[i].unitList[0].name = drugList[i].max_unit
390
+           }
318 391
         }
319 392
         this.tabList.push(drugList[i])
320 393
         }
@@ -343,7 +416,7 @@ getInitOrder(){
343 416
         goodList[i].supply_remake = ""
344 417
         goodList[i].type = 2
345 418
         goodList[i].name = goodList[i].good_name
346
-        goodList[i].unitList =  [{id:1,name:""},{id:2,name:""}]
419
+        goodList[i].unitList =  [{id:1,name:""}]
347 420
         goodList[i].supply_unit = goodList[i].packing_unit
348 421
         for(let j=0;j<goodList[i].unitList.length;j++){
349 422
            goodList[i].unitList[0].name = goodList[i].packing_unit 
@@ -358,7 +431,7 @@ changeGoodName(val){
358 431
   this.currentIndex = val
359 432
 },
360 433
 changeName(val){
361
-    //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}
434
+  
362 435
    for(let i=0;i<this.recordInfo.tableList.length;i++){
363 436
     if(this.currentIndex == i){
364 437
         this.recordInfo.tableList[i].project_id = val.id
@@ -375,7 +448,7 @@ changeName(val){
375 448
         }
376 449
 
377 450
         this.recordInfo.tableList[i].supply_price = val.supply_price?val.supply_price:""
378
-        this.recordInfo.tableList[i].supply_total_price = val.supply_total_price?val.supply_total_price:""
451
+        this.recordInfo.tableList[i].supply_total_price = (val.supply_count * val.supply_price).toFixed(2)
379 452
         this.recordInfo.tableList[i].supply_manufacturer = val.supply_manufacturer
380 453
         this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
381 454
         this.recordInfo.tableList[i].supply_remake = val.supply_remake
@@ -405,6 +478,11 @@ handleEdit(){
405 478
     tempObj['is_total'] = 1
406 479
     tempObj["project_id"] = 0
407 480
     tempObj["supply_unit"] = ""
481
+    tempObj["supply_batch_number"] = ""
482
+    tempObj["supply_product_date"] = ""
483
+    tempObj["order_number"] = ""
484
+    tempObj["supply_expiry_date"] = ""
485
+    tempObj["manufacturer_id"] = ""
408 486
     this.recordInfo.tableList.push(tempObj)
409 487
 },
410 488
 handleDelete: function(index, row) {
@@ -477,44 +555,7 @@ getTimes(time) {
477 555
     }
478 556
     return uParseTime(time, '{y}-{m}-{d}')
479 557
 },
480
- updatePurchaseOrder(){
481
-   this.loading = true 
482
-    if(this.supplier_name == 0 || this.supplier_name == ""){
483
-        this.$message.error("供应商不能为空!")
484
-        this.loading = false
485
-        return false
486
-    }
487
-   this.$refs["tableForm"].validate((valid)=>{
488
-      if(valid){
489
-        for(let i=0;i<this.recordInfo.tableList.length;i++){
490
-           this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
491
-           this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
492
-           this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count * this.recordInfo.tableList[i].supply_price).toString()
493
-           this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
494
-            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
495
-           for(let j=0;j<this.manufactuerList.length;j++){
496
-              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
497
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
498
-              }
499
-           }
500
-        }
501
-        var start = this.getTimes(this.start_time)
502
-        var end = this.getTimes(this.end_time)
503
-        const params = {
504
-        'stockIn': this.recordInfo.tableList
505
-        }
506
-        console.log("param23232332",params)  
507
-       
508
-        updatePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount,this.id,this.number).then(response=>{
509
-           if(response.data.state == 1){
510
-            this.loading = false
511
-             var warehousingInfo =  response.data.data.warehousingInfo
512
-             this.$message.success("修改成功!")
513
-           }
514
-        })
515
-      } 
516
-   })
517
- },
558
+
518 559
  getAllPrice(){
519 560
    var total_price = 0
520 561
    for(let i=0;i<this.recordInfo.tableList.length;i++){
@@ -541,40 +582,49 @@ getTimes(time) {
541 582
     }) 
542 583
   },
543 584
   getPurchaseOrderDetail(){
544
-      console.log("处方233223232323322323232323")
585
+     
545 586
       var id = this.$route.query.id
546
-    getPurchaseOrderDetail(id).then(response=>{
587
+      var ids = this.$route.query.ids
588
+    getPurchaseOrderInfo(id,ids).then(response=>{
547 589
       if(response.data.state == 1){
548 590
         var info = response.data.data.info
549 591
         this.is_check = info.is_check
550
-        this.number = info.number
551 592
         this.id = info.id
552 593
         this.supplier_name = info.supplier_id
553 594
         this.rate_of_concession = info.rate_of_concession
554 595
         this.discount_amount = info.discount_amount
596
+        this.number = info.number
555 597
         var orderInfo = response.data.data.orderInfo
556
-        if(info.is_check == 2){
557
-           this.disabled = false
558
-        }
559
-        if(info.is_check == 1){
560
-           this.disabled = true
598
+       
599
+        for(let i=0;i<orderInfo.length;i++){
600
+          orderInfo[i].supply_batch_number = ""
601
+          orderInfo[i].supply_product_date = ""
602
+          orderInfo[i].supply_expiry_date = ""
561 603
         }
562
-        console.log("drugli323322332",this.drugList)
604
+        console.log("drugli323322332", orderInfo)
563 605
         var drugList = response.data.data.baseList
564 606
         var goodList = response.data.data.goodList
565
-        for(let i=0;i<orderInfo.length;i++){
566
-            orderInfo[i].supply_count = orderInfo[i].count
567
-            orderInfo[i].supply_price = orderInfo[i].price
568
-            orderInfo[i].supply_remake = orderInfo[i].remark
569
-            orderInfo[i].type = orderInfo[i].is_source
570
-            orderInfo[i].project_id = orderInfo[i].project_id
571
-            orderInfo[i].supply_unit = orderInfo[i].supply_unit
607
+        for(let i=0;i< orderInfo.length;i++){
608
+             orderInfo[i].supply_count =  orderInfo[i].count
609
+             orderInfo[i].supply_price =  orderInfo[i].price
610
+             orderInfo[i].supply_remake =  orderInfo[i].remark
611
+             orderInfo[i].type =  orderInfo[i].is_source
612
+             orderInfo[i].project_id =  orderInfo[i].project_id
613
+             orderInfo[i].supply_unit =  orderInfo[i].supply_unit
614
+             orderInfo[i].order_number =  orderInfo[i].order_number
615
+             orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
572 616
            if(orderInfo[i].is_source == 1){
573 617
             for(let j=0;j<drugList.length;j++){
574
-                if(orderInfo[i].project_id == drugList[j].id){
575
-                  orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
576
-                  orderInfo[i].unitList[0].name = drugList[j].max_unit
577
-                  orderInfo[i].unitList[1].name = drugList[j].min_unit
618
+                if( orderInfo[i].project_id == drugList[j].id){
619
+                  if(drugList[j].max_unit!=drugList[j].min_unit){
620
+                    orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
621
+                    orderInfo[i].unitList[0].name = drugList[j].max_unit
622
+                    orderInfo[i].unitList[1].name = drugList[j].min_unit
623
+                  }
624
+                  if(drugList[j].max_unit == drugList[j].min_unit){
625
+                    orderInfo[i].unitList = [{id:1,name:""}]
626
+                    orderInfo[i].unitList[0].name = drugList[j].max_unit
627
+                  }
578 628
                 }
579 629
              }  
580 630
             } 
@@ -587,8 +637,11 @@ getTimes(time) {
587 637
             }  
588 638
           } 
589 639
         }
590
-        console.log("orderINFO23323232",orderInfo)
640
+      
641
+        this.recordInfo.tableList= []
591 642
         this.recordInfo.tableList = orderInfo
643
+       
644
+          console.log("orderINFO23323232",this.recordInfo.tableList)
592 645
       }
593 646
     })  
594 647
   },
@@ -596,13 +649,151 @@ getTimes(time) {
596 649
      var id = this.$route.query.id
597 650
      this.$router.push({path:"/purchase/order/print?&id="+id})  
598 651
   },
599
-  toAdd(){
600
-    var id = this.$route.query.id
601
-    if(this.is_check == 2){
602
-      this.$message.error("该采购订单未审核,不能生成采购数据!")
603
-      return false
652
+  saveGoodOrder(){ 
653
+   
654
+    if(this.supplier_name == 0 || this.supplier_name == ""){
655
+       this.$message.error("供应商不能为空!")
656
+       this.loading = false
657
+       return false
658
+    } 
659
+
660
+    for(let i=0;i<this.recordInfo.tableList.length;i++){
661
+
662
+        this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
663
+        this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
664
+        this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
665
+        this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
666
+        if(this.recordInfo.tableList[i].id > 0){
667
+          this.recordInfo.tableList[i].type = 1
668
+        }
669
+        if(this.recordInfo.tableList[i].id == 0){
670
+          this.recordInfo.tableList[i].type = 2
671
+        }
672
+        for(let j=0;j<this.manufactuerList.length;j++){
673
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
674
+              this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
675
+            }
676
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
677
+              this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
678
+            }
679
+
680
+        }
604 681
     }
605
-    this.$router.push({path:"/purchase/order/add?id="+id})
682
+    var start = this.getTimes(this.start_time)
683
+    this.$refs["tableForm"].validate((valid)=>{
684
+        if(valid){
685
+           this.loading = true
686
+           var warehousing_id = this.$route.query.id
687
+           var params = {
688
+             "stockIn":this.recordInfo.tableList,
689
+           } 
690
+        addGoodOrder(params,this.supplier_name,start,this.arrearage,this.payment,warehousing_id,this.number,this.rate_of_concession,this.discount_amount).then(response=>{
691
+          if(response.data.state == 1){
692
+             this.loading = false
693
+             this.$message.success("保存成功!")
694
+             this.showOne = false
695
+             this.showTwo = true
696
+             var orderInfo =  response.data.data.list
697
+             var warehouseOut = response.data.data.warehouseOut
698
+             this.warese_out_id = warehouseOut.id
699
+             this.good_number = warehouseOut.good_number
700
+             this.rate_of_concession = warehouseOut.rate_of_concession
701
+             this.discount_amount= warehouseOut.discount_amount
702
+             this.payment =warehouseOut.payment
703
+             this.arrearage =warehouseOut.arrearage
704
+             this.supplier_name = warehouseOut.supplier_id
705
+             this.start_time = this.getTimes(warehouseOut.document_date)
706
+            for(let i=0;i< orderInfo.length;i++){
707
+              orderInfo[i].supply_count =  orderInfo[i].count
708
+              orderInfo[i].supply_price =  orderInfo[i].price
709
+              orderInfo[i].supply_remake =  orderInfo[i].remark
710
+              orderInfo[i].type =  orderInfo[i].is_source
711
+              orderInfo[i].project_id =  orderInfo[i].project_id
712
+              orderInfo[i].supply_unit =  orderInfo[i].supply_unit
713
+              orderInfo[i].order_number =  orderInfo[i].order_number
714
+              orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
715
+              orderInfo[i].supply_expiry_date = this.getTimes(orderInfo[i].supply_expiry_date)
716
+              orderInfo[i].supply_product_date = this.getTimes(orderInfo[i].supply_product_date)
717
+            if(orderInfo[i].is_source == 1){
718
+              for(let j=0;j<this.drugList.length;j++){
719
+                  if( orderInfo[i].project_id == this.drugList[j].id){
720
+                    if(this.drugList[j].max_unit !=this.drugList[j].min_unit){
721
+                      orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
722
+                      orderInfo[i].unitList[0].name = this.drugList[j].max_unit
723
+                      orderInfo[i].unitList[1].name = this.drugList[j].min_unit
724
+                    }
725
+                    if(this.drugList[j].max_unit ==this.drugList[j].min_unit){
726
+                      orderInfo[i].unitList[0].name = this.drugList[j].max_unit
727
+                    }
728
+                  }
729
+              }  
730
+              } 
731
+            if(orderInfo[i].is_source == 2){
732
+              for(let j=0;j<this.goodList.length;j++){
733
+                  if(orderInfo[i].project_id == this.goodList[j].id){
734
+                      orderInfo[i].unitList = [{id:1,name:""}]
735
+                      orderInfo[i].unitList[0].name = this.goodList[j].packing_unit
736
+                  }
737
+              }  
738
+            } 
739
+          }
740
+          this.recordInfo.tableList= []
741
+          this.recordInfo.tableList = orderInfo
742
+            
743
+           }
744
+         })
745
+        }
746
+    })
747
+  },
748
+  updateGoodOrder(){ 
749
+   
750
+    if(this.supplier_name == 0 || this.supplier_name == ""){
751
+       this.$message.error("供应商不能为空!")
752
+       this.loading = false
753
+       return false
754
+    } 
755
+    console.log("表哥2323233232",this.recordInfo.tableList)
756
+    for(let i=0;i<this.recordInfo.tableList.length;i++){
757
+
758
+        this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
759
+        this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
760
+        this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
761
+        this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
762
+        if(this.recordInfo.tableList[i].id > 0){
763
+          this.recordInfo.tableList[i].type = 1
764
+        }
765
+        if(this.recordInfo.tableList[i].id == 0){
766
+          this.recordInfo.tableList[i].type = 2
767
+        }
768
+        for(let j=0;j<this.manufactuerList.length;j++){
769
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
770
+              this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
771
+            }
772
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
773
+              this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
774
+            }
775
+
776
+        }
777
+    }
778
+    var start = this.start_time
779
+    this.$refs["tableForm"].validate((valid)=>{
780
+        if(valid){
781
+           this.loading = true
782
+           var warehose_out_id = this.$route.query.id
783
+           var params = {
784
+             "stockIn":this.recordInfo.tableList,
785
+           } 
786
+           console.log("sotckind23232232323232323232",params)
787
+           
788
+           updateGoodOrder(params,this.supplier_name,start,this.arrearage,this.payment,warehose_out_id,this.number,this.rate_of_concession,this.discount_amount,this.good_number).then(response=>{
789
+           if(response.data.state == 1){
790
+             this.loading = false
791
+             this.$message.success("修改成功!")
792
+             
793
+           }
794
+         })
795
+        }
796
+    })
606 797
   }
607 798
 },
608 799
 created(){
@@ -623,9 +814,18 @@ created(){
623 814
     tempObj['is_total'] = 1
624 815
     tempObj["project_id"] = 0
625 816
     tempObj["supply_unit"] = ""
817
+    tempObj["supply_batch_number"] = ""
818
+    tempObj["supply_product_date"] = ""
819
+    tempObj["order_number"] = ""
820
+    tempObj["supply_expiry_date"] = ""
821
+    tempObj["manufacturer_id"] = ""
626 822
     this.recordInfo.tableList.push(tempObj)
627 823
     this.getInitOrder()
628
-    this.getPurchaseOrderDetail()
824
+    if(parseInt(this.$route.query.id) > 0){
825
+      this.getPurchaseOrderDetail()
826
+    }
827
+    this.start_time = this.getTimes(new Date())
828
+    this.end_time = this.getTimes(new Date())
629 829
 }
630 830
 };
631 831
 </script>

+ 896 - 0
src/xt_pages/supply/components/addGoodReturn.vue Voir le fichier

@@ -0,0 +1,896 @@
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
8
+        style="
9
+          justify-content: space-between;
10
+          margin: 0px 0 12px 0;
11
+          display: flex;
12
+          align-items: center;
13
+        "
14
+      >
15
+        <div>
16
+          <span style="color: red">*</span><span>供应商:</span>
17
+          <el-select
18
+            v-model="supplier_name"
19
+            style="width: 140px; margin-right: 10px"
20
+            placeholder="请选择"
21
+            @change="changeTypeName"
22
+          >
23
+            <el-option
24
+              v-for="item in supplyList"
25
+              :key="item.id"
26
+              :label="item.supplier_name"
27
+              :value="item.id"
28
+            >
29
+            </el-option>
30
+          </el-select>
31
+          <span>单据日期:</span>
32
+          <el-date-picker
33
+            size="small"
34
+            v-model="start_time"
35
+            prefix-icon="el-icon-date"
36
+            :editable="false"
37
+            style="width: 196px"
38
+            type="date"
39
+            placeholder="选择日期时间"
40
+            align="right"
41
+            format="yyyy-MM-dd"
42
+            value-format="yyyy-MM-dd"
43
+            @change="startTimeChange"
44
+          ></el-date-picker>
45
+          <!-- <span>交货日期:</span>
46
+        <el-date-picker
47
+            size="small"
48
+            v-model="end_time"
49
+            prefix-icon="el-icon-date"
50
+            :editable="false"
51
+            style="width: 196px;"
52
+            type="date"
53
+            placeholder="选择日期时间"
54
+            align="right"
55
+            format="yyyy-MM-dd"
56
+            value-format="yyyy-MM-dd"
57
+            @change="endTimeChange"
58
+        ></el-date-picker> -->
59
+          <span>单据编码:{{ number }}</span>
60
+        </div>
61
+        <div>
62
+          <el-button size="small" type="primary" @click="toAdd">保存</el-button>
63
+          <el-button size="small" type="primary" @click="updatePurchaseOrder"
64
+            >审核</el-button
65
+          >
66
+          <!-- <el-button size="small" type="primary" @click="toPrint">打印</el-button>
67
+        <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder">审核</el-button>
68
+        <el-button size="small" type="primary" v-if="is_check == 1" @click="checkPurchaseOrder">反审核</el-button> -->
69
+        </div>
70
+      </div>
71
+
72
+      <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
73
+        <el-table
74
+          :row-style="{ color: '#303133' }"
75
+          :header-cell-style="{
76
+            backgroundColor: 'rgb(245, 247, 250)',
77
+            color: '#606266',
78
+          }"
79
+          :data="recordInfo.tableList"
80
+          :class="signAndWeighBoxPatients"
81
+          border
82
+          style="width: 100%"
83
+          max-height="450"
84
+        >
85
+          <el-table-column align="center" width="200px">
86
+            <template slot="header" slot-scope="scope">
87
+              <span>商品<span style="color: red">*</span></span>
88
+            </template>
89
+            <template slot-scope="scope">
90
+              <el-form-item
91
+                :prop="'tableList.' + scope.$index + '.name'"
92
+                :rules="tableRules.name"
93
+              >
94
+                <el-select
95
+                  v-model="scope.row.name"
96
+                  style="width: 160px"
97
+                  filterable
98
+                  placeholder="请选择"
99
+                  @change="changeName"
100
+                  @input="changeGoodName(scope.$index)"
101
+                  :disabled="disabled"
102
+                >
103
+                  <el-option
104
+                    v-for="(item, index) in tabList"
105
+                    :key="index"
106
+                    :label="item.supply_name"
107
+                    :value="item"
108
+                  >
109
+                  </el-option>
110
+                </el-select>
111
+              </el-form-item>
112
+            </template>
113
+          </el-table-column>
114
+          <el-table-column align="center" width="150px">
115
+            <template slot="header" slot-scope="scope">
116
+              <span>商品类别</span>
117
+            </template>
118
+            <template slot-scope="scope">
119
+              <el-input
120
+                v-model="scope.row.supply_type"
121
+                style="width: 120px"
122
+                :disabled="true"
123
+              ></el-input>
124
+            </template>
125
+          </el-table-column>
126
+          <el-table-column label="规格&单位" align="center" width="200px">
127
+            <template slot-scope="scope">
128
+              <el-input
129
+                v-model="scope.row.supply_specification_name"
130
+                style="width: 150px"
131
+                :disabled="true"
132
+              ></el-input>
133
+            </template>
134
+          </el-table-column>
135
+
136
+          <!-- <el-table-column label="单位" align="center" width="120px">
137
+        <template slot="header" slot-scope="scope">
138
+            <span>单位<span style="color: red">*</span></span>
139
+        </template>
140
+        <template slot-scope="scope">
141
+          <el-form-item :prop="'tableList.' + scope.$index + '.supply_unit'" :rules='tableRules.supply_unit'>
142
+            <el-select v-model="scope.row.supply_unit" style="width:100px;" filterable placeholder="请选择"  :disabled="disabled">
143
+                    <el-option
144
+                        v-for="(item,index) in scope.row.unitList"
145
+                        :key="index"
146
+                        :label="item.name"
147
+                        :value="item.name">
148
+                    </el-option>
149
+             </el-select>
150
+          </el-form-item>  
151
+        </template>
152
+    </el-table-column> -->
153
+          <el-table-column label="可用库存" align="center" width="130px">
154
+            <template slot-scope="scope">
155
+              <el-input
156
+                v-model="scope.row.supply_total"
157
+                style="width: 100px"
158
+                :disabled="true"
159
+              ></el-input>
160
+            </template>
161
+          </el-table-column>
162
+          <el-table-column label="可退数量" align="center" width="200px">
163
+            <template slot-scope="scope">
164
+              <el-input
165
+                v-model="scope.row.supply_specification_name"
166
+                style="width: 150px"
167
+                :disabled="true"
168
+              ></el-input>
169
+            </template>
170
+          </el-table-column>
171
+          <el-table-column label="数量" align="center" width="120px">
172
+            <template slot="header" slot-scope="scope">
173
+              <span>数量<span style="color: red">*</span></span>
174
+            </template>
175
+            <template slot-scope="scope">
176
+              <el-form-item
177
+                :prop="'tableList.' + scope.$index + '.supply_count'"
178
+                :rules="tableRules.supply_count"
179
+              >
180
+                <el-input
181
+                  v-model="scope.row.supply_count"
182
+                  style="width: 80px"
183
+                  :disabled="disabled"
184
+                ></el-input>
185
+              </el-form-item>
186
+            </template>
187
+          </el-table-column>
188
+
189
+          <el-table-column label="购货单价" align="center" width="120px">
190
+            <template slot-scope="scope">
191
+              <el-input
192
+                v-model="scope.row.supply_price"
193
+                style="width: 80px"
194
+                :disabled="disabled"
195
+              ></el-input>
196
+            </template>
197
+          </el-table-column>
198
+
199
+          <el-table-column label="购货金额" align="center" width="120px">
200
+            <template slot-scope="scope">
201
+              {{ calculate(scope.row.supply_count * scope.row.supply_price) }}
202
+            </template>
203
+          </el-table-column>
204
+          <el-table-column label="折扣率" align="center" width="120px">
205
+            <template slot-scope="scope">
206
+              {{ calculate(scope.row.supply_count * scope.row.supply_price) }}
207
+            </template>
208
+          </el-table-column>
209
+
210
+          <el-table-column label="折扣金额" align="center" width="120px">
211
+            <template slot-scope="scope">
212
+              {{ calculate(scope.row.supply_count * scope.row.supply_price) }}
213
+            </template>
214
+          </el-table-column>
215
+
216
+          <el-table-column label="生产厂家" align="center" width="200px">
217
+            <template slot-scope="scope">
218
+              <el-input
219
+                v-model="scope.row.supply_manufacturer"
220
+                style="width: 160px"
221
+                :disabled="true"
222
+              ></el-input>
223
+            </template>
224
+          </el-table-column>
225
+
226
+          <el-table-column label="关联采购订单号" align="center" width="200px">
227
+            <template slot-scope="scope">
228
+              <el-input
229
+                v-model="scope.row.supply_license_number"
230
+                style="width: 160px"
231
+                :disabled="disabled"
232
+              ></el-input>
233
+            </template>
234
+          </el-table-column>
235
+
236
+          <el-table-column label="源购货订单号" align="center" width="200px">
237
+            <template slot-scope="scope">
238
+              <el-input
239
+                v-model="scope.row.supply_license_number"
240
+                style="width: 160px"
241
+                :disabled="disabled"
242
+              ></el-input>
243
+            </template>
244
+          </el-table-column>
245
+
246
+          <el-table-column label="备注" align="center" width="200px">
247
+            <template slot-scope="scope">
248
+              <el-input
249
+                v-model="scope.row.supply_remake"
250
+                style="width: 160px"
251
+                :disabled="disabled"
252
+              ></el-input>
253
+            </template>
254
+          </el-table-column>
255
+
256
+          <el-table-column
257
+            label="操作"
258
+            align="center"
259
+            width="150px"
260
+            fixed="right"
261
+          >
262
+            <template slot-scope="scope">
263
+              <el-tooltip
264
+                class="item"
265
+                effect="dark"
266
+                content="新增"
267
+                placement="top"
268
+              >
269
+                <el-button
270
+                  size="mini"
271
+                  type="primary"
272
+                  icon="el-icon-circle-plus-outline"
273
+                  @click="handleEdit(scope.$index, scope.row)"
274
+                >
275
+                </el-button>
276
+              </el-tooltip>
277
+              <el-tooltip
278
+                class="item"
279
+                effect="dark"
280
+                content="删除"
281
+                placement="top"
282
+              >
283
+                <el-button
284
+                  size="mini"
285
+                  type="danger"
286
+                  icon="el-icon-delete"
287
+                  @click="handleDelete(scope.$index, scope.row)"
288
+                >
289
+                </el-button>
290
+              </el-tooltip>
291
+            </template>
292
+          </el-table-column>
293
+        </el-table>
294
+      </el-form>
295
+      <div style="margin-top: 10px">
296
+        <!-- 合计:{{getAllPrice()}} 元 -->
297
+        <el-input
298
+          type="textarea"
299
+          :rows="2"
300
+          placeholder="无备注信息"
301
+          v-model="tipsInfo"
302
+        >
303
+        </el-input>
304
+      </div>
305
+      <div style="margin-top: 10px">
306
+        <span
307
+          >优惠率:<el-input
308
+            style="width: 100px"
309
+            v-model="rate_of_concession"
310
+          ></el-input
311
+          >%</span
312
+        >
313
+
314
+        <span
315
+          >优惠金额:<el-input
316
+            style="width: 100px"
317
+            v-model="discount_amount"
318
+          ></el-input
319
+        ></span>
320
+
321
+        <span
322
+          >本次付款:<el-input
323
+            style="width: 100px"
324
+            v-model="discount_amount"
325
+          ></el-input
326
+        ></span>
327
+
328
+        <span
329
+          >本次欠款:<el-input
330
+            style="width: 100px"
331
+            v-model="discount_amount"
332
+          ></el-input
333
+        ></span>
334
+      </div>
335
+    </div>
336
+
337
+    <!-- <el-dialog
338
+  title="提示"
339
+  :visible.sync="dialogVisible"
340
+  width="30%"
341
+  :before-close="handleClose">
342
+  <span>这是一段信息</span>
343
+  <span slot="footer" class="dialog-footer">
344
+    <el-button @click="dialogVisible = false">取 消</el-button>
345
+    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
346
+  </span>
347
+  </el-dialog> -->
348
+  </div>
349
+</template>
350
+
351
+<script>
352
+import BreadCrumb from "@/xt_pages/components/bread-crumb";
353
+import { uParseTime } from "@/utils/tools";
354
+import {
355
+  getInitOrder,
356
+  updatePurchaseOrder,
357
+  checkPurchaseOrder,
358
+  getPurchaseOrderDetail,
359
+} from "@/api/supply";
360
+export default {
361
+  name: "addPurchaseOrder",
362
+  components: {
363
+    BreadCrumb,
364
+  },
365
+  data() {
366
+    return {
367
+      tipsInfo:"",
368
+      crumbs: [
369
+        { path: false, name: "购货单" },
370
+        { path: "/good/return/add", name: "新增退货单" },
371
+      ],
372
+      showTwo: true,
373
+      showOne: false,
374
+      recordInfo: {
375
+        tableList: [1],
376
+      },
377
+      keywords: "",
378
+      total: 0,
379
+      multipleSelection: [],
380
+      signAndWeighBoxPatients: "sign-and-weigh-box-patients",
381
+      start_time: "",
382
+      end_time: "",
383
+      page: 1,
384
+      limit: 10,
385
+      goodType: [],
386
+      goodInfo: [],
387
+      org_id: 0,
388
+      types: [],
389
+      tyep_name: "",
390
+      form: {
391
+        manufacturer_id: "",
392
+      },
393
+      tabList: [],
394
+      manufactuerList: [],
395
+      currentIndex: 0,
396
+      goodTypeList: [],
397
+      drugTypeList: [],
398
+      supplier_name: "",
399
+      supplyList: [],
400
+      rate_of_concession: "",
401
+      discount_amount: "",
402
+      start_time: new Date(),
403
+      end_time: new Date(),
404
+      tableRules: {
405
+        name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
406
+        supply_count: [
407
+          { required: true, message: "数量不能为空", trigger: "blur" },
408
+        ],
409
+      },
410
+      warehousing_id: 0,
411
+      number: "",
412
+      loading: false,
413
+      drugList: [],
414
+      goodList: [],
415
+      id: 0,
416
+      disabled: false,
417
+      is_check: 0,
418
+      dialogVisible: false,
419
+    };
420
+  },
421
+  methods: {
422
+    getInitOrder() {
423
+      getInitOrder().then((response) => {
424
+        if (response.data.state == 1) {
425
+          var drugList = response.data.data.drugList;
426
+          this.manufactuerList = response.data.data.manufactuerList;
427
+          this.goodTypeList = response.data.data.goodTypeList;
428
+          this.drugTypeList = response.data.data.drugTypeList;
429
+          this.supplyList = response.data.data.supplyList;
430
+          for (let i = 0; i < drugList.length; i++) {
431
+            for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
432
+              drugList[i].drug_warehouse_info[z].stock_max_number =
433
+                drugList[i].drug_warehouse_info[z].stock_max_number *
434
+                drugList[i].min_number;
435
+            }
436
+            for (let j = 0; j < this.manufactuerList.length; j++) {
437
+              if (drugList[i].manufacturer == this.manufactuerList[j].id) {
438
+                drugList[i].manufacturer =
439
+                  this.manufactuerList[j].manufacturer_name;
440
+              }
441
+            }
442
+            for (let y = 0; y < this.drugTypeList.length; y++) {
443
+              if (drugList[i].drug_type == this.drugTypeList[y].value) {
444
+                drugList[i].drug_type = this.drugTypeList[y].name;
445
+              }
446
+            }
447
+            drugList[i].supply_name =
448
+              drugList[i].drug_name +
449
+              " " +
450
+              drugList[i].dose +
451
+              drugList[i].dose_unit +
452
+              "*" +
453
+              drugList[i].min_number +
454
+              drugList[i].min_unit +
455
+              "/" +
456
+              drugList[i].max_unit +
457
+              " " +
458
+              drugList[i].manufacturer;
459
+            drugList[i].supply_type = drugList[i].drug_type;
460
+            drugList[i].supply_specification_name =
461
+              drugList[i].dose +
462
+              drugList[i].dose_unit +
463
+              "*" +
464
+              drugList[i].min_number +
465
+              drugList[i].min_unit +
466
+              "/" +
467
+              drugList[i].max_unit;
468
+            drugList[i].supply_total = this.getWarehoseInfo(
469
+              drugList[i].drug_warehouse_info,
470
+              drugList[i].max_unit,
471
+              drugList[i].min_unit,
472
+              drugList[i].min_number
473
+            );
474
+            drugList[i].supply_count = "";
475
+            drugList[i].supply_total_price = "";
476
+            drugList[i].supply_manufacturer = drugList[i].manufacturer;
477
+            drugList[i].supply_license_number = drugList[i].number;
478
+            drugList[i].supply_remake = "";
479
+            drugList[i].type = 1;
480
+            drugList[i].supply_price = drugList[i].last_price;
481
+            drugList[i].name = drugList[i].drug_name;
482
+            drugList[i].unitList = [
483
+              { id: 1, name: "" },
484
+              { id: 2, name: "" },
485
+            ];
486
+            drugList[i].supply_unit = drugList[i].max_unit;
487
+            for (let j = 0; j < drugList[i].unitList.length; j++) {
488
+              drugList[i].unitList[0].name = drugList[i].max_unit;
489
+              drugList[i].unitList[1].name = drugList[i].min_unit;
490
+            }
491
+            this.tabList.push(drugList[i]);
492
+          }
493
+          this.drugList = drugList;
494
+          var goodList = response.data.data.goodList;
495
+          for (let i = 0; i < goodList.length; i++) {
496
+            for (let j = 0; j < this.manufactuerList.length; j++) {
497
+              if (goodList[i].manufacturer == this.manufactuerList[j].id) {
498
+                goodList[i].manufacturer =
499
+                  this.manufactuerList[j].manufacturer_name;
500
+              }
501
+            }
502
+            for (let y = 0; y < this.goodTypeList.length; y++) {
503
+              if (goodList[i].good_type_id == this.goodTypeList[y].id) {
504
+                goodList[i].good_type_id = this.goodTypeList[y].type_name;
505
+              }
506
+            }
507
+            goodList[i].supply_name =
508
+              goodList[i].good_name +
509
+              " " +
510
+              goodList[i].specification_name +
511
+              " " +
512
+              goodList[i].manufacturer;
513
+            goodList[i].supply_type = goodList[i].good_type_id;
514
+            goodList[i].supply_specification_name =
515
+              goodList[i].specification_name;
516
+            goodList[i].supply_price = goodList[i].buy_price;
517
+            goodList[i].supply_total = this.getTotalStockCount(
518
+              goodList[i].good_warehouse_info
519
+            );
520
+            goodList[i].supply_count = "";
521
+            goodList[i].supply_total_price = "";
522
+            goodList[i].supply_manufacturer = goodList[i].manufacturer;
523
+            goodList[i].supply_license_number = "";
524
+            goodList[i].supply_remake = "";
525
+            goodList[i].type = 2;
526
+            goodList[i].name = goodList[i].good_name;
527
+            goodList[i].unitList = [
528
+              { id: 1, name: "" },
529
+              { id: 2, name: "" },
530
+            ];
531
+            goodList[i].supply_unit = goodList[i].packing_unit;
532
+            for (let j = 0; j < goodList[i].unitList.length; j++) {
533
+              goodList[i].unitList[0].name = goodList[i].packing_unit;
534
+            }
535
+            this.tabList.push(goodList[i]);
536
+          }
537
+          this.goodList = goodList;
538
+        }
539
+      });
540
+    },
541
+    changeGoodName(val) {
542
+      this.currentIndex = val;
543
+    },
544
+    changeName(val) {
545
+      //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}
546
+      for (let i = 0; i < this.recordInfo.tableList.length; i++) {
547
+        if (this.currentIndex == i) {
548
+          this.recordInfo.tableList[i].project_id = val.id;
549
+          this.recordInfo.tableList[i].type = val.type;
550
+          this.recordInfo.tableList[i].name = val.name;
551
+          this.recordInfo.tableList[i].supply_name = val.supply_name;
552
+          this.recordInfo.tableList[i].supply_type = val.supply_type;
553
+          this.recordInfo.tableList[i].supply_specification_name =
554
+            val.supply_specification_name;
555
+          this.recordInfo.tableList[i].supply_total = val.supply_total;
556
+          if (val.supply_count == NaN) {
557
+            this.recordInfo.tableList[i].supply_count = "";
558
+          } else {
559
+            this.recordInfo.tableList[i].supply_count = val.supply_count
560
+              ? val.supply_count
561
+              : "";
562
+          }
563
+
564
+          this.recordInfo.tableList[i].supply_price = val.supply_price
565
+            ? val.supply_price
566
+            : "";
567
+          this.recordInfo.tableList[i].supply_total_price =
568
+            val.supply_total_price ? val.supply_total_price : "";
569
+          this.recordInfo.tableList[i].supply_manufacturer =
570
+            val.supply_manufacturer;
571
+          this.recordInfo.tableList[i].supply_license_number =
572
+            val.supply_license_number;
573
+          this.recordInfo.tableList[i].supply_remake = val.supply_remake;
574
+          this.recordInfo.tableList[i].is_total = val.is_total;
575
+          this.recordInfo.tableList[i].supply_unit = val.supply_unit;
576
+          this.recordInfo.tableList[i].unitList = val.unitList;
577
+        }
578
+      }
579
+    },
580
+    handleEdit() {
581
+      const tempObj = {};
582
+      tempObj["id"] = 0;
583
+      tempObj["name"] = "";
584
+      tempObj["supply_name"] = "";
585
+      tempObj["supply_type"] = "";
586
+      tempObj["supply_specification_name"] = "";
587
+      tempObj["supply_total"] = "";
588
+      tempObj["supply_count"] = "";
589
+      tempObj["supply_price"] = "";
590
+      tempObj["supply_total_price"] = "";
591
+      tempObj["supply_manufacturer"] = "";
592
+      tempObj["supply_license_number"] = "";
593
+      tempObj["supply_remake"] = "";
594
+      tempObj["type"] = 0;
595
+      tempObj["is_total"] = 1;
596
+      tempObj["project_id"] = 0;
597
+      tempObj["supply_unit"] = "";
598
+      this.recordInfo.tableList.push(tempObj);
599
+    },
600
+    handleDelete: function (index, row) {
601
+      if (this.recordInfo.tableList.length <= 1) {
602
+        this.$message.error("只有一条记录的时候无法删除");
603
+        return;
604
+      } else {
605
+        this.recordInfo.tableList.splice(index, 1);
606
+      }
607
+    },
608
+
609
+    changeTypeName() {},
610
+    startTimeChange() {},
611
+    endTimeChange() {},
612
+    search() {},
613
+
614
+    getWarehoseInfo(arr, max_unit, min_unit, min_number) {
615
+      var total = 0;
616
+      var max_str = "";
617
+      var min_str = "";
618
+      if (arr.length > 0) {
619
+        for (let i = 0; i < arr.length; i++) {
620
+          total += parseInt(arr[i].stock_max_number);
621
+        }
622
+      }
623
+      if (total < min_number) {
624
+        min_str = total + min_unit;
625
+      }
626
+      if (total == 0) {
627
+        min_str = "";
628
+        max_str = "";
629
+      }
630
+      if (total >= min_number) {
631
+        if (parseInt(total / min_number) != 0) {
632
+          max_str = parseInt(total / min_number) + max_unit;
633
+        }
634
+        if (total % min_number != 0) {
635
+          min_str = (total % min_number) + min_unit;
636
+        }
637
+      }
638
+      return max_str + min_str;
639
+    },
640
+    getTotalStockCount(arr) {
641
+      var total_count = 0;
642
+      for (let i = 0; i < arr.length; i++) {
643
+        total_count += arr[i].stock_count;
644
+      }
645
+      return total_count;
646
+    },
647
+    calculate: function (val) {
648
+      if (isNaN(val)) {
649
+        return "";
650
+      }
651
+      if (val == 0) {
652
+        return "";
653
+      }
654
+      return Math.round(parseFloat(val) * 100) / 100;
655
+    },
656
+    getTimes(time) {
657
+      if (time === "") {
658
+        return "";
659
+      }
660
+      return uParseTime(time, "{y}-{m}-{d}");
661
+    },
662
+    updatePurchaseOrder() {
663
+      this.loading = true;
664
+      if (this.supplier_name == 0 || this.supplier_name == "") {
665
+        this.$message.error("供应商不能为空!");
666
+        this.loading = false;
667
+        return false;
668
+      }
669
+      this.$refs["tableForm"].validate((valid) => {
670
+        if (valid) {
671
+          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
672
+            this.recordInfo.tableList[i].supply_count = parseInt(
673
+              this.recordInfo.tableList[i].supply_count
674
+            );
675
+            this.recordInfo.tableList[i].supply_license_number =
676
+              this.recordInfo.tableList[i].supply_license_number.toString();
677
+            this.recordInfo.tableList[i].supply_total_price = (
678
+              this.recordInfo.tableList[i].supply_count *
679
+              this.recordInfo.tableList[i].supply_price
680
+            ).toString();
681
+            this.recordInfo.tableList[i].supply_total =
682
+              this.recordInfo.tableList[i].supply_total.toString();
683
+            this.recordInfo.tableList[i].supply_price =
684
+              this.recordInfo.tableList[i].supply_price.toString();
685
+            for (let j = 0; j < this.manufactuerList.length; j++) {
686
+              if (
687
+                this.recordInfo.tableList[i].supply_manufacturer ==
688
+                this.manufactuerList[j].manufacturer_name
689
+              ) {
690
+                this.recordInfo.tableList[i].manufacturer_id =
691
+                  this.manufactuerList[j].id;
692
+              }
693
+            }
694
+          }
695
+          var start = this.getTimes(this.start_time);
696
+          var end = this.getTimes(this.end_time);
697
+          const params = {
698
+            stockIn: this.recordInfo.tableList,
699
+          };
700
+          console.log("param23232332", params);
701
+
702
+          updatePurchaseOrder(
703
+            params,
704
+            this.supplier_name,
705
+            start,
706
+            end,
707
+            this.rate_of_concession,
708
+            this.discount_amount,
709
+            this.id,
710
+            this.number
711
+          ).then((response) => {
712
+            if (response.data.state == 1) {
713
+              this.loading = false;
714
+              var warehousingInfo = response.data.data.warehousingInfo;
715
+              this.$message.success("修改成功!");
716
+            }
717
+          });
718
+        }
719
+      });
720
+    },
721
+    getAllPrice() {
722
+      var total_price = 0;
723
+      for (let i = 0; i < this.recordInfo.tableList.length; i++) {
724
+        total_price +=
725
+          this.recordInfo.tableList[i].supply_price *
726
+          this.recordInfo.tableList[i].supply_count;
727
+      }
728
+      return total_price.toFixed(2);
729
+    },
730
+    checkPurchaseOrder(id, index) {
731
+      this.$confirm("是否审核?", {
732
+        confirmButtonText: "确 定",
733
+        cancelButtonText: "取 消",
734
+        type: "warning",
735
+      })
736
+        .then(() => {
737
+          checkPurchaseOrder(this.id).then((response) => {
738
+            if (response.data.state == 1) {
739
+              var info = response.data.data.info;
740
+              this.disabled = true;
741
+              this.$message.success("审核成功!");
742
+              this.getPurchaseOrderDetail();
743
+            }
744
+          });
745
+        })
746
+        .catch(() => {});
747
+    },
748
+    getPurchaseOrderDetail() {
749
+      console.log("处方233223232323322323232323");
750
+      var id = this.$route.query.id;
751
+      getPurchaseOrderDetail(id).then((response) => {
752
+        if (response.data.state == 1) {
753
+          var info = response.data.data.info;
754
+          this.is_check = info.is_check;
755
+          this.number = info.number;
756
+          this.id = info.id;
757
+          this.supplier_name = info.supplier_id;
758
+          this.rate_of_concession = info.rate_of_concession;
759
+          this.discount_amount = info.discount_amount;
760
+          var orderInfo = response.data.data.orderInfo;
761
+          if (info.is_check == 2) {
762
+            this.disabled = false;
763
+          }
764
+          if (info.is_check == 1) {
765
+            this.disabled = true;
766
+          }
767
+          console.log("drugli323322332", this.drugList);
768
+          var drugList = response.data.data.baseList;
769
+          var goodList = response.data.data.goodList;
770
+          for (let i = 0; i < orderInfo.length; i++) {
771
+            orderInfo[i].supply_count = orderInfo[i].count;
772
+            orderInfo[i].supply_price = orderInfo[i].price;
773
+            orderInfo[i].supply_remake = orderInfo[i].remark;
774
+            orderInfo[i].type = orderInfo[i].is_source;
775
+            orderInfo[i].project_id = orderInfo[i].project_id;
776
+            orderInfo[i].supply_unit = orderInfo[i].supply_unit;
777
+            if (orderInfo[i].is_source == 1) {
778
+              for (let j = 0; j < drugList.length; j++) {
779
+                if (orderInfo[i].project_id == drugList[j].id) {
780
+                  orderInfo[i].unitList = [
781
+                    { id: 1, name: "" },
782
+                    { id: 2, name: "" },
783
+                  ];
784
+                  orderInfo[i].unitList[0].name = drugList[j].max_unit;
785
+                  orderInfo[i].unitList[1].name = drugList[j].min_unit;
786
+                }
787
+              }
788
+            }
789
+            if (orderInfo[i].is_source == 2) {
790
+              for (let j = 0; j < goodList.length; j++) {
791
+                if (orderInfo[i].project_id == goodList[j].id) {
792
+                  orderInfo[i].unitList = [{ id: 1, name: "" }];
793
+                  orderInfo[i].unitList[0].name = goodList[j].packing_unit;
794
+                }
795
+              }
796
+            }
797
+          }
798
+          console.log("orderINFO23323232", orderInfo);
799
+          this.recordInfo.tableList = orderInfo;
800
+        }
801
+      });
802
+    },
803
+    toPrint() {
804
+      var id = this.$route.query.id;
805
+      this.$router.push({ path: "/purchase/order/print?&id=" + id });
806
+    },
807
+    toAdd() {
808
+      var id = this.$route.query.id;
809
+      if (this.is_check == 2) {
810
+        this.$message.error("该采购订单未审核,不能生成采购数据!");
811
+        return false;
812
+      }
813
+      this.$router.push({ path: "/purchase/order/add?id=" + id });
814
+    },
815
+  },
816
+  created() {
817
+    const tempObj = {};
818
+    tempObj["id"] = 0;
819
+    tempObj["name"] = "";
820
+    tempObj["supply_name"] = "";
821
+    tempObj["supply_type"] = "";
822
+    tempObj["supply_specification_name"] = "";
823
+    tempObj["supply_total"] = "";
824
+    tempObj["supply_count"] = "";
825
+    tempObj["supply_price"] = "";
826
+    tempObj["supply_total_price"] = "";
827
+    tempObj["supply_manufacturer"] = "";
828
+    tempObj["supply_license_number"] = "";
829
+    tempObj["supply_remake"] = "";
830
+    tempObj["type"] = 0;
831
+    tempObj["is_total"] = 1;
832
+    tempObj["project_id"] = 0;
833
+    tempObj["supply_unit"] = "";
834
+    this.recordInfo.tableList.push(tempObj);
835
+    this.getInitOrder();
836
+    this.getPurchaseOrderDetail();
837
+  },
838
+};
839
+</script>
840
+
841
+<style rel="stylesheet/css" lang="scss" scoped>
842
+.information {
843
+  border: 1px #dcdfe6 solid;
844
+  padding: 30px 20px 30px 20px;
845
+
846
+  .border {
847
+    border-bottom: 1px #dcdfe6 solid;
848
+    margin: 0px 0 20px 0;
849
+  }
850
+}
851
+
852
+.title {
853
+  background: #409eff;
854
+  height: 44px;
855
+  line-height: 44px;
856
+  padding: 0 0 0 10px;
857
+  color: #fff;
858
+  margin: 0 0 10px 0;
859
+}
860
+
861
+.edit_separater {
862
+  border-top: 1px solid rgb(233, 233, 233);
863
+  margin-top: 15px;
864
+  margin-bottom: 15px;
865
+}
866
+</style>
867
+
868
+<style>
869
+.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
870
+  font-size: 12px;
871
+}
872
+
873
+.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
874
+  background: #6fb5fa;
875
+}
876
+
877
+.count {
878
+  color: #bd2c00;
879
+}
880
+.el-table td,
881
+.el-table th.is-leaf,
882
+.el-table--border,
883
+.el-table--group {
884
+  border-color: #d0d3da;
885
+}
886
+.el-table--border::after,
887
+.el-table--group::after,
888
+.el-table::before {
889
+  background-color: #d0d3da;
890
+}
891
+.el-table__fixed-right {
892
+  width: 150px;
893
+  bottom: 20px;
894
+  height: 100%;
895
+}
896
+</style>

+ 85 - 85
src/xt_pages/supply/components/addPurchaseOrder.vue Voir le fichier

@@ -7,8 +7,7 @@
7 7
     <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
8 8
     <div>
9 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">
10
+        <el-select v-model="supplier_name" style="width:140px;margin-right:10px;" placeholder="请选择">
12 11
         <el-option
13 12
             v-for="item in supplyList"
14 13
             :key="item.id"
@@ -28,7 +27,6 @@
28 27
         align="right"
29 28
         format="yyyy-MM-dd"
30 29
         value-format="yyyy-MM-dd"
31
-        @change="startTimeChange"
32 30
         ></el-date-picker>
33 31
         <span>交货日期:</span>
34 32
         <el-date-picker
@@ -42,7 +40,6 @@
42 40
             align="right"
43 41
             format="yyyy-MM-dd"
44 42
             value-format="yyyy-MM-dd"
45
-            @change="endTimeChange"
46 43
         ></el-date-picker>
47 44
         <span>单据编码:{{number}}</span>
48 45
 
@@ -133,28 +130,36 @@
133 130
 
134 131
    
135 132
 
136
-    <el-table-column label="购单价" align="center" width="120px">
133
+    <el-table-column label="购单价" align="center" width="120px">
137 134
         <template slot-scope="scope">
138 135
         <el-input v-model="scope.row.supply_price" style="width:80px" :disabled="disabled"></el-input>
139 136
         </template>
140 137
     </el-table-column>
141 138
 
142
-    <el-table-column label="购金额" align="center" width="120px">
139
+    <el-table-column label="购金额" align="center" width="120px">
143 140
         <template slot-scope="scope">
144 141
           {{calculate(scope.row.supply_count * scope.row.supply_price)}}
145 142
         </template>
146 143
     </el-table-column>
147 144
 
148
-    <el-table-column label="生产厂" align="center" width="200px">
145
+    <el-table-column label="生产厂" align="center" width="200px">
149 146
         <template slot-scope="scope">
150
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
147
+        
148
+         <el-select size="small" v-model="scope.row.supply_manufacturer" filterable placeholder="请选择生产厂家" :disabled="true">
149
+                <el-option
150
+                  v-for="(option, index) in manufactuerList"
151
+                  :key="index"
152
+                  :label="option.manufacturer_name"
153
+                  :value="option.id">
154
+                </el-option>
155
+          </el-select>
151 156
         </template>
152 157
     </el-table-column>
153 158
 
154 159
 
155 160
     <el-table-column label="批准文号" align="center" width="200px">
156 161
         <template slot-scope="scope">
157
-        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
162
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="true"></el-input>
158 163
         </template>
159 164
     </el-table-column>
160 165
 
@@ -191,7 +196,7 @@
191 196
       合计:{{getAllPrice()}} 元
192 197
    </div>
193 198
    <div style="margin-top:10px">
194
-        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
199
+        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession" @input='addressChange'></el-input>%</span>
195 200
 
196 201
         <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
197 202
 
@@ -207,29 +212,15 @@ import {getInitOrder,savePurchaseOrder,updatePurchaseOrder,checkPurchaseOrder} f
207 212
 import {getDataConfig } from '@/utils/data'
208 213
 export default {
209 214
 name: "addPurchaseOrder",
210
-created() {
211
-this.org_id =  this.$store.getters.xt_user.org_id
212 215
 
213
-var start_time =  window.sessionStorage.getItem('start_time')
214
-var end_time =  window.sessionStorage.getItem('end_time')
215
-
216
-if(start_time !=null){
217
-    this.start_time = start_time
218
-}
219
-if(end_time!=null){
220
-    this.end_time = end_time
221
-}
222
-window.sessionStorage.removeItem('start_time')
223
-window.sessionStorage.removeItem('end_time')
224
-},
225 216
 components: {
226 217
 BreadCrumb
227 218
 },
228 219
 data() {
229 220
 return {
230 221
     crumbs: [
231
-       { path: false, name: "购订单" },
232
-       { path: "/spply/query", name: "新增购订单" }
222
+       { path: false, name: "采购订单" },
223
+       { path: "/supply/query", name: "新增采购订单" }
233 224
     ],
234 225
     showTwo:true,
235 226
     showOne:false,
@@ -261,8 +252,8 @@ return {
261 252
     supplyList:[],
262 253
     rate_of_concession:"",
263 254
     discount_amount:"",
264
-    start_time:new Date(),
265
-    end_time:new Date(),
255
+    start_time:"",
256
+    end_time:"",
266 257
     tableRules: {
267 258
      name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
268 259
      supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
@@ -282,6 +273,7 @@ return {
282 273
    goodList:[
283 274
      {id:1,name:""},
284 275
    ],
276
+   total_price:0,
285 277
   };
286 278
 },
287 279
 methods:{
@@ -323,10 +315,22 @@ getInitOrder(){
323 315
         drugList[i].supply_price = drugList[i].last_price
324 316
         drugList[i].name = drugList[i].drug_name
325 317
         drugList[i].supply_unit = drugList[i].max_unit
326
-        drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
318
+        if(drugList[i].max_unit!=drugList[i].min_unit){
319
+          drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
320
+        }
321
+        if(drugList[i].max_unit ==drugList[i].min_unit){
322
+          drugList[i].unitList = [{id:1,name:""}]
323
+        }
324
+       
327 325
         for(let j=0;j<drugList[i].unitList.length;j++){
328
-           drugList[i].unitList[0].name = drugList[i].max_unit
329
-           drugList[i].unitList[1].name = drugList[i].min_unit
326
+           if(drugList[i].max_unit!=drugList[i].min_unit){
327
+             drugList[i].unitList[0].name = drugList[i].max_unit
328
+             drugList[i].unitList[1].name = drugList[i].min_unit
329
+           }
330
+           if(drugList[i].max_unit ==drugList[i].min_unit){
331
+             drugList[i].unitList[0].name = drugList[i].max_unit
332
+           }
333
+          
330 334
         }
331 335
         this.tabList.push(drugList[i])
332 336
         }
@@ -358,7 +362,7 @@ getInitOrder(){
358 362
         goodList[i].type = 2
359 363
         goodList[i].name = goodList[i].good_name
360 364
         goodList[i].supply_unit = goodList[i].packing_unit
361
-        goodList[i].unitList =  [{id:1,name:""},{id:2,name:""}]
365
+        goodList[i].unitList =  [{id:1,name:""}]
362 366
         for(let j=0;j<goodList[i].unitList.length;j++){
363 367
            goodList[i].unitList[0].name = goodList[i].packing_unit 
364 368
         }
@@ -372,7 +376,6 @@ changeGoodName(val){
372 376
   this.currentIndex = val
373 377
 },
374 378
 changeName(val){
375
-   console.log("val3233232322332",val)
376 379
    for(let i=0;i<this.recordInfo.tableList.length;i++){
377 380
     if(this.currentIndex == i){
378 381
         this.recordInfo.tableList[i].project_id = val.id
@@ -433,14 +436,16 @@ handleDelete: function(index, row) {
433 436
 
434 437
 
435 438
 savePurchaseOrder(){
436
-    this.loading = true
439
+   
437 440
     if(this.supplier_name == 0 || this.supplier_name == ""){
438 441
        this.$message.error("供应商不能为空!")
439 442
        this.loading = false
440 443
        return false
441 444
     }
442 445
     this.$refs["tableForm"].validate((valid)=>{
446
+     
443 447
       if(valid){
448
+         this.loading = true
444 449
         for(let i=0;i<this.recordInfo.tableList.length;i++){
445 450
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
446 451
             this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
@@ -449,17 +454,18 @@ savePurchaseOrder(){
449 454
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
450 455
             for(let j=0;j<this.manufactuerList.length;j++){
451 456
                 if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
452
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
457
+                  this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
453 458
                 }
454 459
 
455 460
             }
456 461
         }
457
-        var start = this.getTimes(this.start_time)
458
-        var end = this.getTimes(this.end_time)
459
-         const params = {
462
+        var start = this.start_time
463
+        var end = this.end_time
464
+        const params = {
460 465
             'stockIn': this.recordInfo.tableList
461
-         }
462
-       
466
+        }
467
+        
468
+        console.log("params23322323",params)
463 469
         savePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount).then(response=>{
464 470
             if(response.data.state == 1){
465 471
                 var order =  response.data.data.order
@@ -468,15 +474,26 @@ savePurchaseOrder(){
468 474
                 var warehouseInfo = response.data.data.warehouseInfo
469 475
                 this.number  = warehouseInfo.number
470 476
                 this.id = warehouseInfo.id
477
+                this.supplier_name = warehouseInfo.supplier_id
478
+                this.rate_of_concession = warehouseInfo.rate_of_concession
479
+                this.discount_amount = warehouseInfo.discount_amount
480
+                this.start_time = this.getTimes(warehouseInfo.document_date)
481
+                this.end_time = this.getTimes(warehouseInfo.delivery_date)
471 482
                 this.recordInfo.tableList = []
472 483
                 var orderInfo = response.data.data.orderInfo
473 484
                 for(let i=0;i<orderInfo.length;i++){
474 485
                    if(orderInfo[i].is_source == 1){
475 486
                     for(let j=0;j<this.drugList.length;j++){
476 487
                        if(orderInfo[i].project_id == this.drugList[j].id){
477
-                          orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
478
-                          orderInfo[i].unitList[0].name = this.drugList[j].max_unit
479
-                          orderInfo[i].unitList[1].name = this.drugList[j].min_unit
488
+                         if(this.drugList[j].max_unit !=this.drugList[j].min_unit){
489
+                            orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
490
+                            orderInfo[i].unitList[0].name = this.drugList[j].max_unit
491
+                            orderInfo[i].unitList[1].name = this.drugList[j].min_unit
492
+                         }
493
+                         if(this.drugList[j].max_unit ==this.drugList[j].min_unit){
494
+                            orderInfo[i].unitList = [{id:1,name:""}]
495
+                            orderInfo[i].unitList[0].name = this.drugList[j].max_unit
496
+                         }
480 497
                        }
481 498
                     }  
482 499
                    } 
@@ -497,25 +514,7 @@ savePurchaseOrder(){
497 514
                 }
498 515
                 console.log("orderINFO23323232",orderInfo)
499 516
                 this.recordInfo.tableList = orderInfo
500
-                // for(let i=0;i<orderInfo.length;i++){
501
-                //    orderInfo[i].name = "" 
502
-                //    orderInfo[i].supply_name = ""
503
-                //    orderInfo[i].supply_specification_name = ""
504
-                //   if(orderInfo[i].is_source == 1){
505
-                //     for(let j=0;j<this.drugList.length;j++){
506
-                //        if(orderInfo[i].project_id == this.drugList[j].id){
507
-                //           orderInfo[i].name = this.drugList[j].drug_name
508
-                //        }
509
-                //     }
510
-                //   }
511
-                //   if(orderInfo[i].is_source == 2){
512
-                //     for(let y=0;y<this.goodList.length;y++){
513
-                //        if(orderInfo[i].project_id = this.goodList[y].id){
514
-                //           orderInfo[i].name = this.goodList[y].good_name
515
-                //        }
516
-                //     }
517
-                //   }
518
-                // }
517
+                
519 518
                 this.showTwo = false
520 519
                 this.showOne = true
521 520
             }
@@ -525,21 +524,6 @@ savePurchaseOrder(){
525 524
    })
526 525
 
527 526
 },
528
-
529
-
530
-changeTypeName(){
531
-
532
-},
533
-startTimeChange(){
534
-
535
-},
536
-endTimeChange(){
537
-
538
-},
539
-search(){
540
-
541
-},
542
-
543 527
 getWarehoseInfo(arr,max_unit,min_unit,min_number){
544 528
     var total = 0
545 529
     var max_str=  ""
@@ -589,7 +573,7 @@ getTimes(time) {
589 573
     return uParseTime(time, '{y}-{m}-{d}')
590 574
 },
591 575
  updatePurchaseOrder(){
592
-   this.loading = true 
576
+   
593 577
     if(this.supplier_name == 0 || this.supplier_name == ""){
594 578
         this.$message.error("供应商不能为空!")
595 579
         this.loading = false
@@ -597,6 +581,7 @@ getTimes(time) {
597 581
     }
598 582
    this.$refs["tableForm"].validate((valid)=>{
599 583
       if(valid){
584
+        this.loading = true 
600 585
         for(let i=0;i<this.recordInfo.tableList.length;i++){
601 586
            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
602 587
            this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
@@ -604,18 +589,18 @@ getTimes(time) {
604 589
            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
605 590
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
606 591
            for(let j=0;j<this.manufactuerList.length;j++){
607
-              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
608
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
592
+              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
593
+                this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
609 594
               }
610 595
            }
611 596
         }
612
-        var start = this.getTimes(this.start_time)
613
-        var end = this.getTimes(this.end_time)
597
+        var start = this.start_time
598
+        var end =   this.end_time
614 599
         const params = {
615 600
         'stockIn': this.recordInfo.tableList
616 601
         }
617 602
         console.log("params23232233223",params)
618
-        
603
+       
619 604
         updatePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount,this.id,this.number).then(response=>{
620 605
            if(response.data.state == 1){
621 606
             this.loading = false
@@ -631,6 +616,12 @@ getTimes(time) {
631 616
    for(let i=0;i<this.recordInfo.tableList.length;i++){
632 617
       total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
633 618
    }  
619
+   this.total_price = total_price
620
+  //   var discount_amount = 0
621
+  //   if(this.rate_of_concession >0){
622
+  //      discount_amount = (this.rate_of_concession/100*total_price)
623
+  //   } 
624
+  //  this.discount_amount = discount_amount.toFixed(2)
634 625
    return total_price.toFixed(2)
635 626
  },
636 627
  checkPurchaseOrder(id,index){
@@ -638,8 +629,7 @@ getTimes(time) {
638 629
     confirmButtonText: '确 定',
639 630
     cancelButtonText: '取 消',
640 631
     type: 'warning'
641
-    }).then(() => {
642
-    console.log("id232233232323223",this.id)    
632
+    }).then(() => {  
643 633
     checkPurchaseOrder(this.id).then(response => {
644 634
         if (response.data.state == 1) {
645 635
           var info = response.data.data.info
@@ -658,7 +648,15 @@ getTimes(time) {
658 648
   getDataConfig(module, filed_name){
659 649
     return getDataConfig(module, filed_name)
660 650
   },
651
+  addressChange(){
652
+    var discount_amount = 0
653
+    if(this.rate_of_concession >0){
654
+       discount_amount = (this.rate_of_concession/100*this.total_price).toFixed(2)
655
+    } 
656
+    this.discount_amount = discount_amount
657
+ }
661 658
 },
659
+
662 660
 created(){
663 661
     const tempObj = {}
664 662
     tempObj["id"] = 0
@@ -679,6 +677,8 @@ created(){
679 677
     tempObj["supply_unit"] = ""
680 678
     this.recordInfo.tableList.push(tempObj)
681 679
     this.getInitOrder()
680
+    this.start_time = this.getTimes(new Date())
681
+    this.end_time = this.getTimes(new Date())
682 682
 }
683 683
 };
684 684
 </script>

+ 382 - 18
src/xt_pages/supply/components/addSupply.vue Voir le fichier

@@ -1,32 +1,396 @@
1 1
 <template>
2
-    <el-dialog
3
-    title="提示"
4
-    :visible.sync="dialogVisible"
5
-    width="30%"
6
-    :before-close="handleClose">
7
-    <span>这是一段信息</span>
2
+  <el-dialog title="新增供应商" :visible.sync="dialogVisible" width="35%">
3
+    <!-- :before-close="handleClose" 如需要可添加进上方 -->
4
+    <div>
5
+      <el-form
6
+        :inline="true"
7
+        :model="supplier"
8
+        class="demo-form-inline"
9
+        label-width="100px"
10
+        :rules="rules"
11
+        ref="supplier"
12
+      >
13
+        <el-row>
14
+          <el-col span="6">
15
+            <el-form-item label="供应商编码" prop="id">
16
+              <el-input v-model="supplier.id"></el-input>
17
+            </el-form-item>
18
+          </el-col>
19
+          <el-col span="6">
20
+            <el-form-item label="供应商名称" prop="name">
21
+              <el-input v-model="supplier.name"></el-input>
22
+            </el-form-item>
23
+          </el-col>
24
+        </el-row>
25
+        <el-row>
26
+          <el-col span="6">
27
+            <el-form-item label="供应商类别">
28
+              <el-input v-model="supplier.type"></el-input>
29
+            </el-form-item>
30
+          </el-col>
31
+          <el-col span="6">
32
+            <el-form-item label="增值税税率">
33
+              <el-input v-model="supplier.rate"></el-input>
34
+            </el-form-item>
35
+          </el-col>
36
+        </el-row>
37
+        <el-row>
38
+          <el-col span="6">
39
+            <el-form-item label="纳税人识别号">
40
+              <el-input v-model="supplier.taxerId"></el-input>
41
+            </el-form-item>
42
+          </el-col>
43
+          <el-col span="6">
44
+            <el-form-item label="开户银行">
45
+              <el-input v-model="supplier.bankname"></el-input>
46
+            </el-form-item>
47
+          </el-col>
48
+        </el-row>
49
+        <el-row>
50
+          <el-col span="6">
51
+            <el-form-item label="银行账号">
52
+              <el-input v-model="supplier.bankId"></el-input>
53
+            </el-form-item>
54
+          </el-col>
55
+        </el-row>
56
+      </el-form>
57
+
58
+      <el-form
59
+        :rules="tableRules"
60
+        :model="recordInfo"
61
+        ref="tableForm"
62
+        class="tableclass"
63
+      >
64
+        <el-table
65
+          :row-style="{ color: '#303133' }"
66
+          :header-cell-style="{
67
+            backgroundColor: 'rgb(245, 247, 250)',
68
+            color: '#606266',
69
+          }"
70
+          :data="recordInfo.tableList"
71
+          :class="signAndWeighBoxPatients"
72
+          border
73
+          style="width: 100%"
74
+          max-height="450"
75
+        >
76
+          <!-- 联系人填写 -->
77
+          <el-table-column label="联系人" align="center" width="110px">
78
+            <template slot="header" slot-scope="scope">
79
+              <span>联系人<span style="color: red">*</span></span>
80
+            </template>
81
+            <template slot-scope="scope">
82
+              <el-form-item
83
+                :prop="'tableList.' + scope.$index + '.supply_count'"
84
+                :rules="tableRules.contacts"
85
+              >
86
+                <el-input
87
+                  v-model="scope.row.supply_count"
88
+                  style="width: 80px; margin-top: 3px"
89
+                ></el-input>
90
+              </el-form-item>
91
+            </template>
92
+          </el-table-column>
93
+          <!-- 手机填写 -->
94
+          <el-table-column label="手机" align="center" width="100px">
95
+            <template slot-scope="scope">
96
+              <el-input
97
+                v-model="scope.row.supply_price"
98
+                style="width: 80px"
99
+              ></el-input>
100
+              <div style="visibility: hidden">/</div>
101
+            </template>
102
+          </el-table-column>
103
+          <!-- 联系地址填写 -->
104
+          <el-table-column label="联系地址" align="center" width="130px">
105
+            <template slot-scope="scope">
106
+              <el-input
107
+                v-model="scope.row.supply_license_number"
108
+                style="width: 115px"
109
+              ></el-input>
110
+              <div style="visibility: hidden">/</div>
111
+            </template>
112
+          </el-table-column>
113
+          <!-- 首要联系人填写 -->
114
+          <el-table-column align="center" width="100px">
115
+            <template slot="header" slot-scope="scope">
116
+              <span>首要联系人<span style="color: red">*</span></span>
117
+            </template>
118
+            <template slot-scope="scope">
119
+              <el-form-item :prop="'tableList.' + scope.$index + '.name'">
120
+                <el-select
121
+                  v-model="scope.row.name"
122
+                  style="width: 90px"
123
+                  placeholder="请选择"
124
+                  @change="changeName"
125
+                >
126
+                  <el-option
127
+                    v-for="(item, index) in tabList"
128
+                    :key="index"
129
+                    :label="item.label"
130
+                    :value="item"
131
+                  >
132
+                  </el-option>
133
+                </el-select>
134
+              </el-form-item>
135
+            </template>
136
+          </el-table-column>
137
+
138
+          <el-table-column
139
+            label="操作"
140
+            align="center"
141
+            width="120px"
142
+            fixed="right"
143
+          >
144
+            <template slot-scope="scope">
145
+              <el-tooltip
146
+                class="item"
147
+                effect="dark"
148
+                content="新增"
149
+                placement="top"
150
+              >
151
+                <el-button
152
+                  class="tablebtn"
153
+                  size="mini"
154
+                  type="primary"
155
+                  icon="el-icon-circle-plus-outline"
156
+                  @click="handleAdd(scope.$index, scope.row)"
157
+                >
158
+                </el-button>
159
+              </el-tooltip>
160
+              <el-tooltip
161
+                class="item"
162
+                effect="dark"
163
+                content="删除"
164
+                placement="top"
165
+              >
166
+                <el-button
167
+                  class="tablebtn"
168
+                  size="mini"
169
+                  type="danger"
170
+                  icon="el-icon-delete"
171
+                  @click="handleDelete(scope.$index, scope.row)"
172
+                >
173
+                </el-button>
174
+              </el-tooltip>
175
+            </template>
176
+          </el-table-column>
177
+        </el-table>
178
+      </el-form>
179
+    </div>
180
+
8 181
     <span slot="footer" class="dialog-footer">
9
-        <el-button @click="dialogVisible = false">取 消</el-button>
10
-        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
182
+      <el-button @click="dialogVisible = false">取 消</el-button>
183
+      <el-button type="primary" @click="submitForm('supplier')"
184
+        >确 定</el-button
185
+      >
11 186
     </span>
12
-    </el-dialog>
187
+  </el-dialog>
13 188
 </template>
14 189
 
15 190
 <script>
191
+import Template from "../../data/template.vue";
16 192
 export default {
17
-    
18
-    data(){
19
-        return{
20
-           dialogVisible:false, 
193
+  data() {
194
+    return {
195
+      Template,
196
+      signAndWeighBoxPatients: "sign-and-weigh-box-patients",
197
+      // 表单验证规则
198
+      rules: {
199
+        id: [
200
+          {
201
+            required: true,
202
+            message: "请填写供应商编号",
203
+            trigger: "blur",
204
+          },
205
+        ],
206
+        name: [
207
+          {
208
+            required: true,
209
+            message: "请填写供应商名称",
210
+            trigger: "blur",
211
+          },
212
+        ],
213
+      },
214
+      tabList: [
215
+        {
216
+          value: 0,
217
+          label: "是",
218
+        },
219
+        {
220
+          value: 1,
221
+          label: "否",
222
+        },
223
+      ],
224
+      tableRules: {
225
+        contacts: [
226
+          { required: true, message: "联系人不能为空", trigger: "blur" },
227
+        ],
228
+      },
229
+      recordInfo: {
230
+        tableList: [1],
231
+      },
232
+      tableData: [
233
+        {
234
+          contacts: "",
235
+          phone: "",
236
+          address: "",
237
+          FirstConcats: "",
238
+          operate: "",
239
+        },
240
+      ],
241
+      options: [
242
+        {
243
+          value: "1",
244
+          label: "是",
245
+        },
246
+        {
247
+          value: "2",
248
+          label: "否",
249
+        },
250
+      ],
251
+      value: "",
252
+      dialogVisible: false,
253
+      supplier: {
254
+        name: "",
255
+        id: "",
256
+        type: "",
257
+        rate: 10,
258
+        taxerId: "",
259
+        bankId: "",
260
+        bankname: "",
261
+      },
262
+    };
263
+  },
264
+  created() {
265
+    this.supplier.id = "gys001";
266
+  },
267
+  methods: {
268
+    show() {
269
+      this.dialogVisible = true;
270
+      this.orderIdAdd();
271
+      this.continueArr();
272
+    },
273
+    //  验证表单内容
274
+    submitForm(formName) {
275
+      this.$refs[formName].validate((valid) => {
276
+        if (valid) {
277
+          alert("submit!");
278
+          this.dialogVisible = false;
279
+        } else {
280
+          console.log("error submit!!");
281
+          return false;
21 282
         }
283
+      });
284
+
285
+      this.contactsinfo();
22 286
     },
23
-    methods:{
24
-      show(){
25
-        this.dialogVisible = true  
287
+
288
+    // 首要联系人选择变更动态展示
289
+    changeName() {},
290
+
291
+    // 供应商编码动态递增
292
+    orderIdAdd() {
293
+      // 模拟情景
294
+      let data = ["gsy001", "gsy002", "gsy004"];
295
+      let data1 = [];
296
+      let num = 0;
297
+
298
+      data.forEach((o) => {
299
+        o = o.split("gsy");
300
+        data1.push(o[1]);
301
+      });
302
+
303
+      console.log(data1, "现有数据");
304
+
305
+      this.continueArr();
306
+    },
307
+
308
+    //递增数判断
309
+    continueArr() {
310
+      var num = 0;
311
+      let arr = ["001", "002", "004", "005", "006"];
312
+
313
+      let len = 3; //显示的长度
314
+      num = parseInt(num, 10) + 1;
315
+      num = num.toString();
316
+      for (let i = 0; i < arr.length; i++) {
317
+        while (num.length < len) {
318
+          num = "0" + num;
319
+        }
320
+        
26 321
       }
322
+      console.log(num,'d')
323
+    },
324
+
325
+    // 添加表单行
326
+    handleAdd() {
327
+      let data = {};
328
+      this.recordInfo.tableList.push(data);
27 329
     },
28
-    created(){
330
+    // 删除表单行
331
+    handleDelete() {},
332
+
333
+    //表格判断是否填入信息
334
+    contactsinfo() {
335
+      let info = this.tableData;
336
+      return new Promise((resolve, reject) => {
337
+        // if (info) {
338
+        //   resolve(info);
339
+        // } else {
340
+        //   reject("error");
341
+        info.forEach((i) => {
342
+          if (
343
+            i.contacts != "" &&
344
+            i.phone != "" &&
345
+            i.address != "" &&
346
+            i.FirstConcats != ""
347
+          ) {
348
+            resolve(info);
349
+          } else {
350
+            reject("error");
351
+          }
352
+        });
353
+        // }
354
+      })
355
+        .then((res) => {
356
+          console.log(res, "ooo");
357
+        })
358
+        .catch((err) => {
359
+          console.log(err, "ddd");
360
+        });
361
+    },
362
+  },
363
+};
364
+</script>
365
+
366
+<style lang="scss" scoped>
367
+.demo-form-inline {
368
+  .el-col-6 {
369
+    width: 50%;
370
+  }
371
+  .el-input {
372
+    width: 75%;
373
+  }
374
+}
375
+
376
+.tablebtn {
377
+  padding: 10px 12px;
378
+}
29 379
 
380
+/deep/.el-form.tableclass {
381
+  .el-table__header-wrapper {
382
+    .el-table__header {
383
+      width: 625px !important;
30 384
     }
385
+  }
386
+  .el-table__body-wrapper.is-scrolling-none {
387
+    .el-table__body {
388
+      width: 625px !important;
389
+    }
390
+  }
391
+}
392
+
393
+/deep/ .el-form-item__error {
394
+  // display: none !important;
31 395
 }
32
-</script>
396
+</style>

+ 911 - 0
src/xt_pages/supply/components/editGoodOrder.vue Voir le fichier

@@ -0,0 +1,911 @@
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>单据编码:{{good_number}}</span>
48
+
49
+    </div>
50
+    <div>
51
+        <el-button size="small" type="primary" @click="updateGoodOrder">修改</el-button>
52
+        <el-button size="small" type="primary"  @click="checkGoodOrder">审核</el-button>
53
+
54
+       
55
+    </div>
56
+    </div>
57
+
58
+   <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
59
+    <el-table
60
+    :row-style="{ color: '#303133' }"
61
+    :header-cell-style="{
62
+        backgroundColor: 'rgb(245, 247, 250)',
63
+        color: '#606266'
64
+    }"
65
+    :data="recordInfo.tableList"
66
+    :class="signAndWeighBoxPatients"
67
+    border
68
+    style="width: 100%"
69
+    max-height="450"
70
+    >
71
+    <el-table-column align="center" width="200px">
72
+        <template slot="header" slot-scope="scope">
73
+            <span>商品<span style="color: red">*</span></span>
74
+        </template>
75
+        <template slot-scope="scope">
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)" :disabled="disabled">
78
+                <el-option
79
+                    v-for="(item,index) in tabList"
80
+                    :key="index"
81
+                    :label="item.supply_name"
82
+                    :value="item">
83
+                </el-option>
84
+             </el-select>
85
+           </el-form-item>
86
+        </template>
87
+    </el-table-column>
88
+    <el-table-column  align="center" width="150px">
89
+        <template slot="header" slot-scope="scope">
90
+            <span>商品类别</span>
91
+        </template>
92
+        <template slot-scope="scope">
93
+            <el-input v-model="scope.row.supply_type" style="width:120px" :disabled="true"></el-input>
94
+        </template>
95
+    </el-table-column>
96
+    <el-table-column label="规格&单位" align="center" width="120px">
97
+        <template slot-scope="scope">
98
+            <el-input v-model="scope.row.supply_specification_name" style="width:100px" :disabled="true"></el-input>
99
+        </template>
100
+    </el-table-column>
101
+     <el-table-column label="单位" align="center" width="120px">
102
+        <template slot="header" slot-scope="scope">
103
+            <span>单位<span style="color: red">*</span></span>
104
+        </template>
105
+        <template slot-scope="scope">
106
+          <el-form-item :prop="'tableList.' + scope.$index + '.supply_unit'" :rules='tableRules.supply_unit'>
107
+            <el-select v-model="scope.row.supply_unit" style="width:100px;" filterable placeholder="请选择"  :disabled="disabled">
108
+                    <el-option
109
+                        v-for="(item,index) in scope.row.unitList"
110
+                        :key="index"
111
+                        :label="item.name"
112
+                        :value="item.name">
113
+                    </el-option>
114
+             </el-select>
115
+          </el-form-item>  
116
+        </template>
117
+    </el-table-column>
118
+    <el-table-column label="批号" align="center" width="130px">
119
+         <template slot="header" slot-scope="scope">
120
+            <span>批号<span style="color: red">*</span></span>
121
+        </template>
122
+        <template slot-scope="scope">
123
+           <el-form-item  :prop="'tableList.' + scope.$index + '.supply_batch_number'" :rules='tableRules.supply_batch_number'>
124
+             <el-input v-model="scope.row.supply_batch_number" style="width:80px" :disabled="disabled"></el-input>
125
+          </el-form-item>
126
+        </template>
127
+    </el-table-column>
128
+     <el-table-column label="有效日期" align="center" width="200px">
129
+        <template slot="header" slot-scope="scope">
130
+              <span>有效日期<span style="color: red">*</span></span>
131
+            </template>
132
+            <template slot-scope="scope">
133
+              <el-form-item  :prop="'tableList.' + scope.$index + '.supply_expiry_date'"
134
+                :rules="tableRules.supply_expiry_date">
135
+                <el-date-picker prefix-icon="el-icon-date" style="width:180px" v-model="scope.row.supply_expiry_date"
136
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
137
+                                value-format="yyyy-MM-dd">
138
+                </el-date-picker>
139
+             </el-form-item>
140
+       </template>
141
+    </el-table-column>
142
+    <el-table-column label="可用库存" align="center" width="100px">
143
+        <template slot-scope="scope">
144
+            <el-input v-model="scope.row.supply_total" style="width:80px" :disabled="true"></el-input>
145
+        </template>
146
+    </el-table-column>
147
+    <el-table-column label="数量" align="center" width="120px">
148
+        <template slot="header" slot-scope="scope">
149
+            <span>数量<span style="color: red">*</span></span>
150
+        </template>
151
+        <template slot-scope="scope">
152
+          <el-form-item  :prop="'tableList.' + scope.$index + '.supply_count'" :rules='tableRules.supply_count'>
153
+             <el-input v-model="scope.row.supply_count" style="width:80px" :disabled="disabled"></el-input>
154
+          </el-form-item>
155
+        </template>
156
+    </el-table-column>
157
+
158
+    <el-table-column label="采购单价" align="center" width="120px">
159
+        <template slot-scope="scope">
160
+        <el-input v-model="scope.row.supply_price" style="width:80px" :disabled="disabled"></el-input>
161
+        </template>
162
+    </el-table-column>
163
+
164
+    <el-table-column label="采购金额" align="center" width="120px">
165
+        <template slot-scope="scope">
166
+          {{calculate(scope.row.supply_count * scope.row.supply_price)}}
167
+        </template>
168
+    </el-table-column>
169
+    <el-table-column label="生产日期" align="center" width="200px">
170
+         <template slot="header" slot-scope="scope">
171
+            <span>生产日期<span style="color: red">*</span></span>
172
+        </template>
173
+        <template slot-scope="scope">
174
+          <el-form-item  :prop="'tableList.' + scope.$index + '.supply_product_date'"
175
+                :rules="tableRules.supply_product_date">
176
+                <el-date-picker prefix-icon="el-icon-date" style="width: 180px" v-model="scope.row.supply_product_date"
177
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
178
+                                value-format="yyyy-MM-dd">
179
+                </el-date-picker>
180
+          </el-form-item>
181
+        </template>
182
+    </el-table-column>
183
+    <el-table-column label="生产厂家" align="center" width="200px">
184
+        <template slot-scope="scope">
185
+         <el-select size="small" v-model="scope.row.supply_manufacturer" filterable placeholder="请选择厂家" :disabled="true">
186
+                <el-option
187
+                  v-for="(option, index) in manufactuerList"
188
+                  :key="index"
189
+                  :label="option.manufacturer_name"
190
+                  :value="option.id">
191
+                </el-option>
192
+          </el-select>
193
+        </template>
194
+    </el-table-column>
195
+
196
+
197
+    <el-table-column label="批准文号" align="center" width="200px">
198
+        <template slot-scope="scope">
199
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="true"></el-input>
200
+        </template>
201
+    </el-table-column>
202
+
203
+     <el-table-column label="关联采购订单号" align="center" width="200px">
204
+        <template slot-scope="scope">
205
+        <el-input v-model="scope.row.order_number" style="width:160px" :disabled="true"></el-input>
206
+        </template>
207
+    </el-table-column>
208
+
209
+    <el-table-column label="备注" align="center" width="200px">
210
+        <template slot-scope="scope">
211
+        <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
212
+        </template>
213
+    </el-table-column>
214
+
215
+    <el-table-column label="操作" align="center" width="150px" fixed="right" >
216
+        <template slot-scope="scope">
217
+        <el-tooltip class="item" effect="dark" content="新增" placement="top" >
218
+            <el-button
219
+                size="mini"
220
+                type="primary"
221
+                icon="el-icon-circle-plus-outline"
222
+                @click="handleEdit(scope.$index, scope.row)">
223
+            </el-button>
224
+       </el-tooltip>
225
+       <el-tooltip class="item" effect="dark" content="删除" placement="top">
226
+            <el-button
227
+                size="mini"
228
+                type="danger"
229
+                icon="el-icon-delete"
230
+                @click="handleDelete(scope.$index, scope.row)">
231
+            </el-button>
232
+        </el-tooltip>
233
+
234
+        </template>
235
+    </el-table-column>
236
+  </el-table>
237
+</el-form>
238
+   <div style="margin-top:10px">
239
+      合计:{{getAllPrice()}} 元
240
+   </div>
241
+   <div style="margin-top:10px">
242
+        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
243
+
244
+        <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
245
+      
246
+        <span>本次付款:<el-input style="width:100px" v-model="payment"></el-input></span>
247
+
248
+        <span>本次欠款:<el-input style="width:100px" v-model="arrearage"></el-input></span>
249
+    </div>
250
+</div>
251
+
252
+  <!-- <el-dialog
253
+  title="提示"
254
+  :visible.sync="dialogVisible"
255
+  width="30%"
256
+  :before-close="handleClose">
257
+  <span>这是一段信息</span>
258
+  <span slot="footer" class="dialog-footer">
259
+    <el-button @click="dialogVisible = false">取 消</el-button>
260
+    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
261
+  </span>
262
+  </el-dialog> -->
263
+</div>
264
+</template>
265
+
266
+<script>
267
+import BreadCrumb from "@/xt_pages/components/bread-crumb";
268
+import {uParseTime } from '@/utils/tools'
269
+import {getInitOrder,checkPurchaseOrder,getGoodOrderDetail,updateGoodOrder,getGoodOrderCountList,ModefySupplyWarehousing} from "@/api/supply"
270
+export default {
271
+name: "addPurchaseOrder",
272
+components: {
273
+BreadCrumb
274
+},
275
+data() {
276
+return {
277
+    crumbs: [
278
+       { path: false, name: "采购单" },
279
+       { path: "/supply/good/order/query", name: "编辑采购单" }
280
+    ],
281
+    showTwo:true,
282
+    showOne:false,
283
+    recordInfo: {
284
+      tableList:[],
285
+    },
286
+    keywords: "",
287
+    total: 0,
288
+    multipleSelection: [],
289
+    signAndWeighBoxPatients: "sign-and-weigh-box-patients",
290
+    start_time: "",
291
+    end_time: "",
292
+    page: 1,
293
+    limit: 10,
294
+    goodType: [],
295
+    goodInfo: [],
296
+    org_id:0,
297
+    types:[],
298
+    tyep_name:"",
299
+    form:{
300
+    manufacturer_id:"",
301
+    },
302
+    tabList:[],
303
+    manufactuerList:[],
304
+    currentIndex: 0,
305
+    goodTypeList:[],
306
+    drugTypeList:[],
307
+    supplier_name:"",
308
+    supplyList:[],
309
+    rate_of_concession:"",
310
+    discount_amount:"",
311
+    start_time:"",
312
+    end_time:"",
313
+    tableRules: {
314
+     name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
315
+     supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
316
+     supply_batch_number:[{required:true,message:"批号不能为空", trigger: 'blur'}],
317
+     supply_product_date:[{required:true,message:"生产日期不能为空", trigger: 'blur'}],
318
+     supply_expiry_date:[{required:true,message:"有效日期不能为空",trigger: 'blur'}]
319
+   },
320
+   warehousing_id:0,
321
+   number:"",
322
+   loading:false,
323
+   drugList:[],
324
+   goodList:[],
325
+   id:0,
326
+   disabled:false,
327
+   is_check:0,
328
+   dialogVisible:false,
329
+   arrearage:"",
330
+   payment:"",
331
+   good_number:"",
332
+   orderInfo:[],
333
+   showOne:true,
334
+   showTwo:false,
335
+   warese_out_id:0,
336
+  };
337
+},
338
+methods:{
339
+
340
+getInitOrder(){
341
+    getInitOrder().then(response=>{
342
+    if(response.data.state == 1){
343
+        var drugList = response.data.data.drugList
344
+        this.manufactuerList = response.data.data.manufactuerList
345
+        this.goodTypeList = response.data.data.goodTypeList
346
+        this.drugTypeList = response.data.data.drugTypeList
347
+        this.supplyList = response.data.data.supplyList
348
+       for(let i=0;i<drugList.length;i++){
349
+          for(let z=0;z<drugList[i].drug_warehouse_info.length;z++){
350
+            drugList[i].drug_warehouse_info[z].stock_max_number = drugList[i].drug_warehouse_info[z].stock_max_number * drugList[i].min_number
351
+          }
352
+        for(let j=0;j<this.manufactuerList.length;j++){
353
+            if(drugList[i].manufacturer == this.manufactuerList[j].id){
354
+                drugList[i].manufacturer = this.manufactuerList[j].manufacturer_name
355
+            }
356
+        }
357
+        for(let y=0;y<this.drugTypeList.length;y++){
358
+            if(drugList[i].drug_type == this.drugTypeList[y].value){
359
+            drugList[i].drug_type = this.drugTypeList[y].name
360
+            }
361
+        }
362
+        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
363
+        drugList[i].supply_type = drugList[i].drug_type
364
+        drugList[i].supply_specification_name = drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit
365
+        drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number)
366
+        drugList[i].supply_count = ""
367
+        drugList[i].supply_total_price = ""
368
+        drugList[i].supply_manufacturer=  drugList[i].manufacturer
369
+        drugList[i].supply_license_number= drugList[i].number
370
+        drugList[i].supply_remake = ""
371
+        drugList[i].type = 1
372
+        drugList[i].supply_price = drugList[i].last_price
373
+        drugList[i].name = drugList[i].drug_name
374
+        if(drugList[i].max_unit != drugList[i].min_unit){
375
+          drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
376
+        }
377
+        if(drugList[i].max_unit == drugList[i].min_unit){
378
+          drugList[i].unitList = [{id:1,name:""}]
379
+        }
380
+       
381
+        drugList[i].warehouse_info_id = 0
382
+        drugList[i].warehousing_id= 0
383
+        drugList[i].supply_unit = drugList[i].max_unit 
384
+        for(let j=0;j<drugList[i].unitList.length;j++){
385
+          if(drugList[i].max_unit != drugList[i].min_unit){
386
+            drugList[i].unitList[0].name = drugList[i].max_unit
387
+            drugList[i].unitList[1].name = drugList[i].min_unit
388
+          }
389
+          if(drugList[i].max_unit  == drugList[i].min_unit){
390
+            drugList[i].unitList[0].name = drugList[i].max_unit
391
+          }
392
+        }
393
+        this.tabList.push(drugList[i])
394
+        }
395
+        this.drugList = drugList
396
+        var goodList =  response.data.data.goodList
397
+        for(let i=0;i<goodList.length;i++){
398
+        for(let j=0;j<this.manufactuerList.length;j++){
399
+            if(goodList[i].manufacturer == this.manufactuerList[j].id){
400
+                goodList[i].manufacturer = this.manufactuerList[j].manufacturer_name
401
+            }
402
+        }
403
+        for(let y=0;y<this.goodTypeList.length;y++){
404
+            if(goodList[i].good_type_id == this.goodTypeList[y].id){
405
+                goodList[i].good_type_id = this.goodTypeList[y].type_name
406
+            }
407
+        }
408
+        goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
409
+        goodList[i].supply_type = goodList[i].good_type_id
410
+        goodList[i].supply_specification_name =goodList[i].specification_name
411
+        goodList[i].supply_price = goodList[i].buy_price
412
+        goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
413
+        goodList[i].supply_count = ""
414
+        goodList[i].supply_total_price = ""
415
+        goodList[i].supply_manufacturer = goodList[i].manufacturer
416
+        goodList[i].supply_license_number = ""
417
+        goodList[i].supply_remake = ""
418
+        goodList[i].type = 2
419
+        goodList[i].name = goodList[i].good_name
420
+        goodList[i].unitList =  [{id:1,name:""}]
421
+        goodList[i].supply_unit = goodList[i].packing_unit
422
+        goodList[i].warehouse_info_id = 0
423
+        goodList[i].warehousing_id= 0
424
+        for(let j=0;j<goodList[i].unitList.length;j++){
425
+           goodList[i].unitList[0].name = goodList[i].packing_unit 
426
+        }
427
+        this.tabList.push(goodList[i])
428
+        }
429
+        this.goodList = goodList
430
+    } 
431
+    })
432
+},
433
+changeGoodName(val){
434
+  this.currentIndex = val
435
+},
436
+changeName(val){
437
+  
438
+   for(let i=0;i<this.recordInfo.tableList.length;i++){
439
+    if(this.currentIndex == i){
440
+        this.recordInfo.tableList[i].project_id = val.id
441
+        this.recordInfo.tableList[i].type = val.type
442
+        this.recordInfo.tableList[i].name = val.name
443
+        this.recordInfo.tableList[i].supply_name = val.supply_name
444
+        this.recordInfo.tableList[i].supply_type = val.supply_type
445
+        this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name
446
+        this.recordInfo.tableList[i].supply_total = val.supply_total
447
+       
448
+        if(val.supply_count == NaN){
449
+           this.recordInfo.tableList[i].supply_count = ""
450
+        }else{
451
+          this.recordInfo.tableList[i].supply_count = val.supply_count?val.supply_count:""
452
+        }
453
+
454
+        this.recordInfo.tableList[i].supply_price = val.supply_price?val.supply_price:""
455
+        this.recordInfo.tableList[i].supply_total_price = (val.supply_count * val.supply_price).toFixed(2)
456
+        this.recordInfo.tableList[i].supply_manufacturer = val.supply_manufacturer
457
+        this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
458
+        this.recordInfo.tableList[i].supply_remake = val.supply_remake
459
+        this.recordInfo.tableList[i].is_total = val.is_total
460
+        this.recordInfo.tableList[i].supply_unit = val.supply_unit
461
+        this.recordInfo.tableList[i].unitList = val.unitList
462
+        this.recordInfo.tableList[i].warehouse_info_id = val.warehouse_info_id
463
+        this.recordInfo.tableList[i].warehousing_id = val.warehousing_id
464
+     }
465
+    }
466
+   
467
+
468
+},
469
+handleEdit(){
470
+    const tempObj = {}
471
+    tempObj["id"] = 0
472
+    tempObj["name"] = ""
473
+    tempObj['supply_name'] = ""
474
+    tempObj['supply_type'] = ""
475
+    tempObj['supply_specification_name'] = ''
476
+    tempObj['supply_total'] = ""
477
+    tempObj['supply_count'] = ""
478
+    tempObj['supply_price'] = ""
479
+    tempObj['supply_total_price'] = ""
480
+    tempObj['supply_manufacturer'] = ''
481
+    tempObj['supply_license_number'] = ''
482
+    tempObj['supply_remake'] = ''
483
+    tempObj['type'] = 0
484
+    tempObj['is_total'] = 1
485
+    tempObj["project_id"] = 0
486
+    tempObj["supply_unit"] = ""
487
+    tempObj["supply_batch_number"] = ""
488
+    tempObj["supply_product_date"] = ""
489
+    tempObj["order_number"] = ""
490
+    tempObj["supply_expiry_date"] = ""
491
+    tempObj["manufacturer_id"] = ""
492
+    tempObj["warehouse_info_id"] = ""
493
+    tempObj["warehousing_id"]= ""
494
+    this.recordInfo.tableList.push(tempObj)
495
+},
496
+handleDelete: function(index, row) {
497
+  if (this.recordInfo.tableList.length <= 1) {
498
+        this.$message.error('只有一条记录的时候无法删除')
499
+        return
500
+   } else {
501
+        this.recordInfo.tableList.splice(index, 1)
502
+   }
503
+},
504
+
505
+changeTypeName(){
506
+
507
+},
508
+startTimeChange(){
509
+
510
+},
511
+endTimeChange(){
512
+
513
+},
514
+search(){
515
+
516
+},
517
+
518
+getWarehoseInfo(arr,max_unit,min_unit,min_number){
519
+    var total = 0
520
+    var max_str=  ""
521
+    var min_str = ""
522
+    if (arr.length > 0) {
523
+      for(let i=0;i<arr.length;i++){
524
+        total += parseInt(arr[i].stock_max_number)
525
+      }
526
+    }
527
+    if (total < min_number){
528
+        min_str = total + min_unit
529
+    }
530
+    if (total == 0) {
531
+        min_str = ""
532
+        max_str = ""
533
+    }
534
+   if (total >=min_number) {
535
+    if(parseInt(total/min_number)!=0){
536
+        max_str = parseInt(total/min_number) + max_unit
537
+    }
538
+    if(total%min_number!=0){
539
+       min_str = total%min_number + min_unit
540
+    }
541
+  }
542
+ return max_str + min_str
543
+ },
544
+getTotalStockCount(arr){
545
+  var total_count = 0
546
+  for(let i=0;i<arr.length;i++){
547
+    total_count += arr[i].stock_count
548
+  }
549
+  return total_count
550
+},
551
+calculate: function(val) {
552
+    if (isNaN(val)) {
553
+        return "";
554
+    }
555
+    if (val == 0) {
556
+        return "";
557
+    }
558
+    return Math.round(parseFloat(val) * 100) / 100;
559
+  },
560
+getTimes(time) {
561
+    if (time === '') {
562
+    return ''
563
+    }
564
+    return uParseTime(time, '{y}-{m}-{d}')
565
+},
566
+
567
+ getAllPrice(){
568
+   var total_price = 0
569
+   for(let i=0;i<this.recordInfo.tableList.length;i++){
570
+      total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
571
+   }  
572
+   return total_price.toFixed(2)
573
+ },
574
+ checkPurchaseOrder(id,index){
575
+   this.$confirm('是否审核?', {
576
+    confirmButtonText: '确 定',
577
+    cancelButtonText: '取 消',
578
+    type: 'warning'
579
+    }).then(() => { 
580
+    checkPurchaseOrder(this.id).then(response => {
581
+        if (response.data.state == 1) {
582
+          var info = response.data.data.info
583
+          this.disabled = true
584
+          this.$message.success("审核成功!")
585
+          this.getPurchaseOrderDetail()
586
+        } 
587
+     })
588
+    })
589
+    .catch(() => {
590
+    }) 
591
+  },
592
+  getGoodOrderDetail(){
593
+     
594
+      var id = this.$route.query.id
595
+    getGoodOrderDetail(id).then(response=>{
596
+      if(response.data.state == 1){
597
+        var out = response.data.data.out
598
+        this.is_check = out.is_check
599
+        this.id = out.id
600
+        this.supplier_name = out.supplier_id
601
+        this.rate_of_concession = out.rate_of_concession
602
+        this.discount_amount = out.discount_amount
603
+        this.payment = out.payment
604
+        this.arrearage = out.arrearage
605
+        this.number = out.number
606
+        this.good_number = out.good_number
607
+        this.start_time = this.getTimes(out.document_date)
608
+        var orderInfo = response.data.data.list
609
+        
610
+        var drugList = response.data.data.drugList
611
+        var goodList = response.data.data.goodList
612
+        for(let i=0;i< orderInfo.length;i++){
613
+             
614
+             orderInfo[i].supply_count =  orderInfo[i].count
615
+             orderInfo[i].supply_price =  orderInfo[i].price
616
+             orderInfo[i].supply_remake =  orderInfo[i].remark
617
+             orderInfo[i].type =  orderInfo[i].is_source
618
+             orderInfo[i].project_id =  orderInfo[i].project_id
619
+             orderInfo[i].supply_unit =  orderInfo[i].supply_unit
620
+             orderInfo[i].order_number =  orderInfo[i].order_number
621
+             orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
622
+             orderInfo[i].supply_expiry_date = this.getTimes(orderInfo[i].supply_expiry_date)
623
+             orderInfo[i].supply_product_date = this.getTimes(orderInfo[i].supply_product_date)
624
+           if(orderInfo[i].is_source == 1){
625
+            for(let j=0;j<drugList.length;j++){
626
+                if( orderInfo[i].project_id == drugList[j].id){
627
+                  if(drugList[j].max_unit!=drugList[j].min_unit){
628
+                    orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
629
+                    orderInfo[i].unitList[0].name = drugList[j].max_unit
630
+                    orderInfo[i].unitList[1].name = drugList[j].min_unit
631
+                  }
632
+                  if(drugList[j].max_unit ==drugList[j].min_unit){
633
+                    orderInfo[i].unitList = [{id:1,name:""}]
634
+                    orderInfo[i].unitList[0].name = drugList[j].max_unit
635
+                  }
636
+                
637
+                }
638
+             }  
639
+            } 
640
+          if(orderInfo[i].is_source == 2){
641
+            for(let j=0;j<goodList.length;j++){
642
+                if(orderInfo[i].project_id == goodList[j].id){
643
+                    orderInfo[i].unitList = [{id:1,name:""}]
644
+                    orderInfo[i].unitList[0].name = goodList[j].packing_unit
645
+                }
646
+            }  
647
+          } 
648
+        }
649
+      
650
+        this.recordInfo.tableList= []
651
+        this.recordInfo.tableList = orderInfo
652
+       
653
+          console.log("orderINFO23323232",this.recordInfo.tableList)
654
+      }
655
+    })  
656
+  },
657
+  toPrint(){
658
+     var id = this.$route.query.id
659
+     this.$router.push({path:"/purchase/order/print?&id="+id})  
660
+  },
661
+  updateGoodOrder(){ 
662
+   
663
+    if(this.supplier_name == 0 || this.supplier_name == ""){
664
+       this.$message.error("供应商不能为空!")
665
+       this.loading = false
666
+       return false
667
+    } 
668
+    console.log("表哥2323233232",this.recordInfo.tableList)
669
+    for(let i=0;i<this.recordInfo.tableList.length;i++){
670
+
671
+        this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
672
+        this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
673
+        this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
674
+        this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
675
+        if(this.recordInfo.tableList[i].id > 0){
676
+          this.recordInfo.tableList[i].type = 1
677
+        }
678
+        if(this.recordInfo.tableList[i].id == 0){
679
+          this.recordInfo.tableList[i].type = 2
680
+        }
681
+        for(let j=0;j<this.manufactuerList.length;j++){
682
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
683
+              this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
684
+            }
685
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
686
+              this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
687
+            }
688
+
689
+        }
690
+    }
691
+    var start = this.start_time
692
+    this.$refs["tableForm"].validate((valid)=>{
693
+        if(valid){
694
+           this.loading = true
695
+           var warehose_out_id = this.$route.query.id
696
+           var params = {
697
+             "stockIn":this.recordInfo.tableList,
698
+           } 
699
+           console.log("sotckind23232232323232323232",params)
700
+           
701
+           updateGoodOrder(params,this.supplier_name,start,this.arrearage,this.payment,warehose_out_id,this.number,this.rate_of_concession,this.discount_amount,this.good_number).then(response=>{
702
+           if(response.data.state == 1){
703
+             this.loading = false
704
+             this.$message.success("修改成功!")
705
+             
706
+           }
707
+         })
708
+        }
709
+    })
710
+  },
711
+  checkGoodOrder(){
712
+    var id = this.$route.query.id
713
+    var warehousing_id = this.$route.query.warehousing_id
714
+    getGoodOrderCountList(id,warehousing_id).then(response=>{
715
+      if(response.data.state == 1){
716
+        this.$message.success("审核成功!")
717
+        var purcaseOrder = response.data.data.purcaseOrder
718
+        console.log("采购订单",purcaseOrder)
719
+        
720
+        var goodOrder = response.data.data.goodOrder
721
+        console.log("采购单",goodOrder)
722
+        var drugList = response.data.data.drugList
723
+        console.log("druglist23323223",drugList)
724
+        var is_warehouse = 0
725
+        for(let i=0;i<purcaseOrder.length;i++){
726
+          for(let j=0;j<drugList.length;j++){
727
+             if(purcaseOrder[i].is_source == 1){
728
+               if(purcaseOrder[i].supply_unit == drugList[j].max_unit){
729
+                  purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number
730
+               }
731
+             }
732
+          }
733
+        }
734
+
735
+        for(let i=0;i<goodOrder.length;i++){
736
+          for(let j=0;j<drugList.length;j++){
737
+            if(goodOrder[i].is_source == 1){
738
+              if(goodOrder[i].supply_unit == drugList[j].max_unit){
739
+                 goodOrder[i].count = goodOrder[i].count * drugList[j].min_number
740
+              }
741
+            }
742
+          }
743
+        }
744
+        
745
+        let objInfo = {}
746
+        if (goodOrder.length >0){
747
+          goodOrder.forEach((item,index)=>{
748
+            let { project_id } = item
749
+            if(!objInfo[project_id]){
750
+              objInfo[project_id] = {
751
+                project_id,
752
+                child:[],
753
+                count:0,
754
+              }
755
+            }
756
+          })
757
+          let newArr = Object.values(objInfo);
758
+        
759
+          for(let i=0;i<goodOrder.length;i++){
760
+            for(let j=0;j<newArr.length;j++){
761
+              if(goodOrder[i].project_id == newArr[j].project_id){
762
+                newArr[j].child.push(goodOrder[i])
763
+              }
764
+            }
765
+          }
766
+          console.log("newAr2332232323",newArr)
767
+        
768
+          for(let i=0;i<newArr.length;i++){
769
+           for(let j=0;j<newArr[i].child.length;j++){
770
+             newArr[i].count += newArr[i].child[j].count
771
+           }
772
+          }
773
+
774
+          var arr = []
775
+          var total = 0
776
+          var str = ""
777
+         
778
+          //如果采购单有数据,则需要比较数量
779
+          if(newArr.length > 0){
780
+            for(let i=0;i<purcaseOrder.length;i++){
781
+              for(let j=0;j<newArr.length;j++){
782
+                if(purcaseOrder[i].project_id == newArr[j].project_id){
783
+                    //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
784
+                    if(purcaseOrder[i].count > newArr[j].count){
785
+                      arr.push(purcaseOrder[i].project_id)
786
+                    }
787
+                }
788
+              } 
789
+            }
790
+            //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
791
+          
792
+            if(arr.length == 0){
793
+              is_warehouse = 1
794
+              this.ModefySupplyWarehousing(is_warehouse,warehousing_id)
795
+            }
796
+            
797
+            //部分入库
798
+            if(total!=goodOrder.length){
799
+               //修改订购单
800
+               is_warehouse = 3
801
+               this.ModefySupplyWarehousing(is_warehouse,warehousing_id)
802
+            }
803
+          }
804
+        }
805
+      }
806
+    })
807
+  },
808
+  ModefySupplyWarehousing(is_warehouse,warehousing_id){
809
+     var params = {
810
+       is_warehouse:is_warehouse,
811
+       warehousing_id:warehousing_id,
812
+     }
813
+    ModefySupplyWarehousing(params).then(response=>{
814
+      if(response.data.state == 1){
815
+        var msg = response.data.data.msg
816
+      }
817
+    })
818
+  }
819
+},
820
+created(){
821
+    const tempObj = {}
822
+    tempObj["id"] = 0
823
+    tempObj["name"] = ""
824
+    tempObj['supply_name'] = ""
825
+    tempObj['supply_type'] = ""
826
+    tempObj['supply_specification_name'] = ''
827
+    tempObj['supply_total'] = ""
828
+    tempObj['supply_count'] = ""
829
+    tempObj['supply_price'] = ""
830
+    tempObj['supply_total_price'] = ""
831
+    tempObj['supply_manufacturer'] = ''
832
+    tempObj['supply_license_number'] = ''
833
+    tempObj['supply_remake'] = ''
834
+    tempObj['type'] = 0
835
+    tempObj['is_total'] = 1
836
+    tempObj["project_id"] = 0
837
+    tempObj["supply_unit"] = ""
838
+    tempObj["supply_batch_number"] = ""
839
+    tempObj["supply_product_date"] = ""
840
+    tempObj["order_number"] = ""
841
+    tempObj["supply_expiry_date"] = ""
842
+    tempObj["manufacturer_id"] = ""
843
+    tempObj["warehouse_info_id"] = ""
844
+    tempObj["warehousing_id"]= ""
845
+    this.recordInfo.tableList.push(tempObj)
846
+    this.getInitOrder()
847
+    if(parseInt(this.$route.query.id) > 0){
848
+      this.getGoodOrderDetail()
849
+    }
850
+    this.start_time = this.getTimes(new Date())
851
+    this.end_time = this.getTimes(new Date())
852
+}
853
+};
854
+</script>
855
+
856
+<style rel="stylesheet/css" lang="scss" scoped>
857
+.information {
858
+border: 1px #dcdfe6 solid;
859
+padding: 30px 20px 30px 20px;
860
+
861
+.border {
862
+border-bottom: 1px #dcdfe6 solid;
863
+margin: 0px 0 20px 0;
864
+}
865
+}
866
+
867
+.title {
868
+background: #409eff;
869
+height: 44px;
870
+line-height: 44px;
871
+padding: 0 0 0 10px;
872
+color: #fff;
873
+margin: 0 0 10px 0;
874
+}
875
+
876
+.edit_separater {
877
+border-top: 1px solid rgb(233, 233, 233);
878
+margin-top: 15px;
879
+margin-bottom: 15px;
880
+}
881
+</style>
882
+
883
+<style>
884
+.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
885
+font-size: 12px;
886
+}
887
+
888
+.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
889
+background: #6fb5fa;
890
+}
891
+
892
+.count {
893
+color: #bd2c00;
894
+}
895
+.el-table td,
896
+.el-table th.is-leaf,
897
+.el-table--border,
898
+.el-table--group {
899
+border-color: #d0d3da;
900
+}
901
+.el-table--border::after,
902
+.el-table--group::after,
903
+.el-table::before {
904
+background-color: #d0d3da;
905
+}
906
+.el-table__fixed-right{
907
+  width:150px;
908
+  bottom: 20px;
909
+  height: 100%;
910
+}
911
+</style>

+ 230 - 60
src/xt_pages/supply/components/editPurchaseOrder.vue Voir le fichier

@@ -8,7 +8,7 @@
8 8
     <div>
9 9
         <span style="color:red">*</span><span>供应商:</span>
10 10
         <el-select v-model="supplier_name" style="width:140px;margin-right:10px;" placeholder="请选择"
11
-        @change="changeTypeName">
11
+        @change="changeTypeName" :disabled="disabled">
12 12
         <el-option
13 13
             v-for="item in supplyList"
14 14
             :key="item.id"
@@ -29,6 +29,7 @@
29 29
         format="yyyy-MM-dd"
30 30
         value-format="yyyy-MM-dd"
31 31
         @change="startTimeChange"
32
+        :disabled="disabled"
32 33
         ></el-date-picker>
33 34
         <span>交货日期:</span>
34 35
         <el-date-picker
@@ -43,16 +44,17 @@
43 44
             format="yyyy-MM-dd"
44 45
             value-format="yyyy-MM-dd"
45 46
             @change="endTimeChange"
47
+            :disabled="disabled"
46 48
         ></el-date-picker>
47 49
         <span>单据编码:{{number}}</span>
48 50
 
49 51
     </div>
50 52
     <div>
51
-        <el-button size="small" type="primary" @click="toAdd">生成购单</el-button>
53
+        <el-button size="small" type="primary" @click="toAdd" v-show="showOne">生成购单</el-button>
52 54
         <el-button size="small" type="primary" @click="updatePurchaseOrder">修改</el-button>
53 55
         <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
+        <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder" v-show="showTwo">审核</el-button>
57
+        <el-button size="small" type="primary" v-if="is_check == 1" @click="checkReturnOrder" v-show="showThree">反审核</el-button>
56 58
        
57 59
     </div>
58 60
     </div>
@@ -117,16 +119,8 @@
117 119
           </el-form-item>  
118 120
         </template>
119 121
     </el-table-column>
120
-    <el-table-column label="批号" align="center" width="130px">
121
-        <template slot-scope="scope">
122
-            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
123
-        </template>
124
-    </el-table-column>
125
-    <el-table-column label="有效日期" align="center" width="130px">
126
-        <template slot-scope="scope">
127
-            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
128
-        </template>
129
-    </el-table-column>
122
+   
123
+  
130 124
     <el-table-column label="可用库存" align="center" width="130px">
131 125
         <template slot-scope="scope">
132 126
             <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
@@ -143,40 +137,38 @@
143 137
         </template>
144 138
     </el-table-column>
145 139
 
146
-    <el-table-column label="购单价" align="center" width="120px">
140
+    <el-table-column label="购单价" align="center" width="120px">
147 141
         <template slot-scope="scope">
148 142
         <el-input v-model="scope.row.supply_price" style="width:80px" :disabled="disabled"></el-input>
149 143
         </template>
150 144
     </el-table-column>
151 145
 
152
-    <el-table-column label="购金额" align="center" width="120px">
146
+    <el-table-column label="购金额" align="center" width="120px">
153 147
         <template slot-scope="scope">
154 148
           {{calculate(scope.row.supply_count * scope.row.supply_price)}}
155 149
         </template>
156 150
     </el-table-column>
157 151
 
158
-    <el-table-column label="生产日期" align="center" width="200px">
159
-        <template slot-scope="scope">
160
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
161
-        </template>
162
-    </el-table-column>
163 152
     <el-table-column label="生产厂家" align="center" width="200px">
164 153
         <template slot-scope="scope">
165
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
154
+           <el-select size="small" v-model="scope.row.supply_manufacturer" filterable placeholder="请选择厂家" :disabled="true">
155
+                <el-option
156
+                  v-for="(option, index) in manufactuerList"
157
+                  :key="index"
158
+                  :label="option.manufacturer_name"
159
+                  :value="option.id">
160
+                </el-option>
161
+          </el-select>
166 162
         </template>
167 163
     </el-table-column>
168 164
 
169 165
 
170 166
     <el-table-column label="批准文号" align="center" width="200px">
171 167
         <template slot-scope="scope">
172
-        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
173
-        </template>
174
-    </el-table-column>
175
-    <el-table-column label="关联采购订单号" align="center" width="200px">
176
-        <template slot-scope="scope">
177
-        <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
168
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="true"></el-input>
178 169
         </template>
179 170
     </el-table-column>
171
+ 
180 172
     <el-table-column label="备注" align="center" width="200px">
181 173
         <template slot-scope="scope">
182 174
         <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
@@ -210,35 +202,34 @@
210 202
       合计:{{getAllPrice()}} 元
211 203
    </div>
212 204
    <div style="margin-top:10px">
213
-        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
214
-
215
-        <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
205
+        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession" @input='addressChange' :disabled="disabled"></el-input>%</span>
216 206
 
217
-        <span>本次付款:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
218
-
219
-        <span>本次欠款:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
207
+        <span>优惠金额:<el-input style="width:100px" v-model="discount_amount" :disabled="disabled"></el-input></span>
220 208
 
221 209
     </div>
222 210
 </div>
223 211
 
224
-  <!-- <el-dialog
225
-  title="提示"
212
+  <el-dialog
213
+  title="系统提示"
226 214
   :visible.sync="dialogVisible"
227
-  width="30%"
228
-  :before-close="handleClose">
229
-  <span>这是一段信息</span>
215
+  width="30%">
216
+  <span>
217
+    采购订单{{number}}已有以下关联数据,不能反审核
218
+    <div v-for="(item,index) in orderList" :key="index">
219
+        <li>采购单{{item.good_number}}</li> <a @click="toClick(item.id)">点击查看</a>
220
+    </div>
221
+  </span>
230 222
   <span slot="footer" class="dialog-footer">
231 223
     <el-button @click="dialogVisible = false">取 消</el-button>
232
-    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
233 224
   </span>
234
-  </el-dialog> -->
225
+  </el-dialog>
235 226
 </div>
236 227
 </template>
237 228
 
238 229
 <script>
239 230
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
240 231
 import {uParseTime } from '@/utils/tools'
241
-import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail} from "@/api/supply"
232
+import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail,getAllOrderCountList,getGoodOrderList,getReturnOrder} from "@/api/supply"
242 233
 export default {
243 234
 name: "addPurchaseOrder",
244 235
 components: {
@@ -247,8 +238,8 @@ BreadCrumb
247 238
 data() {
248 239
 return {
249 240
     crumbs: [
250
-       { path: false, name: "购订单" },
251
-       { path: "/spply/query", name: "编辑购订单" }
241
+       { path: false, name: "购订单" },
242
+       { path: "/supply/query", name: "编辑购订单" }
252 243
     ],
253 244
     showTwo:true,
254 245
     showOne:false,
@@ -280,8 +271,6 @@ return {
280 271
     supplyList:[],
281 272
     rate_of_concession:"",
282 273
     discount_amount:"",
283
-    start_time:new Date(),
284
-    end_time:new Date(),
285 274
     tableRules: {
286 275
      name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
287 276
      supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
@@ -295,6 +284,11 @@ return {
295 284
    disabled:false,
296 285
    is_check:0,
297 286
    dialogVisible:false,
287
+   total_price:0,
288
+   showOne:true,
289
+   showTwo:true,
290
+   showThree:false,
291
+   orderList:[],
298 292
   };
299 293
 },
300 294
 methods:{
@@ -333,11 +327,23 @@ getInitOrder(){
333 327
         drugList[i].type = 1
334 328
         drugList[i].supply_price = drugList[i].last_price
335 329
         drugList[i].name = drugList[i].drug_name
336
-        drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
330
+        if(drugList[i].max_unit!=drugList[i].min_unit){
331
+          drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
332
+        }
333
+        if(drugList[i].max_unit == drugList[i].min_unit){
334
+          drugList[i].unitList = [{id:1,name:""}]
335
+        }
336
+      
337 337
         drugList[i].supply_unit = drugList[i].max_unit 
338 338
         for(let j=0;j<drugList[i].unitList.length;j++){
339
-           drugList[i].unitList[0].name = drugList[i].max_unit
340
-           drugList[i].unitList[1].name = drugList[i].min_unit
339
+          if(drugList[i].max_unit!=drugList[i].min_unit){
340
+            drugList[i].unitList[0].name = drugList[i].max_unit
341
+            drugList[i].unitList[1].name = drugList[i].min_unit
342
+          }
343
+          if(drugList[i].max_unit ==drugList[i].min_unit){
344
+            drugList[i].unitList[0].name = drugList[i].max_unit
345
+          }
346
+         
341 347
         }
342 348
         this.tabList.push(drugList[i])
343 349
         }
@@ -366,7 +372,7 @@ getInitOrder(){
366 372
         goodList[i].supply_remake = ""
367 373
         goodList[i].type = 2
368 374
         goodList[i].name = goodList[i].good_name
369
-        goodList[i].unitList =  [{id:1,name:""},{id:2,name:""}]
375
+        goodList[i].unitList =  [{id:1,name:""}]
370 376
         goodList[i].supply_unit = goodList[i].packing_unit
371 377
         for(let j=0;j<goodList[i].unitList.length;j++){
372 378
            goodList[i].unitList[0].name = goodList[i].packing_unit 
@@ -381,7 +387,7 @@ changeGoodName(val){
381 387
   this.currentIndex = val
382 388
 },
383 389
 changeName(val){
384
-    //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}
390
+   
385 391
    for(let i=0;i<this.recordInfo.tableList.length;i++){
386 392
     if(this.currentIndex == i){
387 393
         this.recordInfo.tableList[i].project_id = val.id
@@ -411,6 +417,10 @@ changeName(val){
411 417
 
412 418
 },
413 419
 handleEdit(){
420
+    if(this.is_check == 1){
421
+      this.$message.error("已审核的不能新增!")
422
+      return false
423
+    }
414 424
     const tempObj = {}
415 425
     tempObj["id"] = 0
416 426
     tempObj["name"] = ""
@@ -428,6 +438,7 @@ handleEdit(){
428 438
     tempObj['is_total'] = 1
429 439
     tempObj["project_id"] = 0
430 440
     tempObj["supply_unit"] = ""
441
+    tempObj["manufacturer_id"] = ""
431 442
     this.recordInfo.tableList.push(tempObj)
432 443
 },
433 444
 handleDelete: function(index, row) {
@@ -501,7 +512,7 @@ getTimes(time) {
501 512
     return uParseTime(time, '{y}-{m}-{d}')
502 513
 },
503 514
  updatePurchaseOrder(){
504
-   this.loading = true 
515
+   
505 516
     if(this.supplier_name == 0 || this.supplier_name == ""){
506 517
         this.$message.error("供应商不能为空!")
507 518
         this.loading = false
@@ -509,6 +520,9 @@ getTimes(time) {
509 520
     }
510 521
    this.$refs["tableForm"].validate((valid)=>{
511 522
       if(valid){
523
+        this.loading = true 
524
+        console.log("生产厂商",this.recordInfo.tableList)
525
+        console.log("生产上次",this.manufactuerList)
512 526
         for(let i=0;i<this.recordInfo.tableList.length;i++){
513 527
            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
514 528
            this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
@@ -516,13 +530,13 @@ getTimes(time) {
516 530
            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
517 531
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
518 532
            for(let j=0;j<this.manufactuerList.length;j++){
519
-              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
520
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
533
+              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
534
+                 this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
521 535
               }
522 536
            }
523 537
         }
524
-        var start = this.getTimes(this.start_time)
525
-        var end = this.getTimes(this.end_time)
538
+        var start = this.start_time
539
+        var end = this.end_time
526 540
         const params = {
527 541
         'stockIn': this.recordInfo.tableList
528 542
         }
@@ -543,6 +557,7 @@ getTimes(time) {
543 557
    for(let i=0;i<this.recordInfo.tableList.length;i++){
544 558
       total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
545 559
    }  
560
+   this.total_price = total_price
546 561
    return total_price.toFixed(2)
547 562
  },
548 563
  checkPurchaseOrder(id,index){
@@ -556,6 +571,9 @@ getTimes(time) {
556 571
           var info = response.data.data.info
557 572
           this.disabled = true
558 573
           this.$message.success("审核成功!")
574
+          this.showOne = true
575
+          this.showTwo = false
576
+          this.showThree = true
559 577
           this.getPurchaseOrderDetail()
560 578
         } 
561 579
      })
@@ -574,12 +592,21 @@ getTimes(time) {
574 592
         this.supplier_name = info.supplier_id
575 593
         this.rate_of_concession = info.rate_of_concession
576 594
         this.discount_amount = info.discount_amount
595
+        this.start_time = this.getTimes(info.document_date)
596
+        this.end_time = this.getTimes(info.delivery_date)
577 597
         var orderInfo = response.data.data.orderInfo
598
+
578 599
         if(info.is_check == 2){
579 600
            this.disabled = false
601
+           this.showOne = false
602
+           this.showTwo = true
603
+           this.showThree = false
580 604
         }
581 605
         if(info.is_check == 1){
582 606
            this.disabled = true
607
+           this.showOne = true
608
+           this.showTwo = false
609
+           this.showThree = true
583 610
         }
584 611
         console.log("drugli323322332",this.drugList)
585 612
         var drugList = response.data.data.baseList
@@ -594,9 +621,16 @@ getTimes(time) {
594 621
            if(orderInfo[i].is_source == 1){
595 622
             for(let j=0;j<drugList.length;j++){
596 623
                 if(orderInfo[i].project_id == drugList[j].id){
597
-                  orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
598
-                  orderInfo[i].unitList[0].name = drugList[j].max_unit
599
-                  orderInfo[i].unitList[1].name = drugList[j].min_unit
624
+                  if(drugList[j].max_unit != drugList[j].min_unit){
625
+                    orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
626
+                    orderInfo[i].unitList[0].name = drugList[j].max_unit
627
+                    orderInfo[i].unitList[1].name = drugList[j].min_unit
628
+                  }
629
+                  if(drugList[j].max_unit  == drugList[j].min_unit){
630
+                    orderInfo[i].unitList = [{id:1,name:""}]
631
+                    orderInfo[i].unitList[0].name = drugList[j].max_unit
632
+                  }
633
+                 
600 634
                 }
601 635
              }  
602 636
             } 
@@ -624,7 +658,142 @@ getTimes(time) {
624 658
       this.$message.error("该采购订单未审核,不能生成采购数据!")
625 659
       return false
626 660
     }
627
-    this.$router.push({path:"/good/order/add?id="+id})
661
+    //获取商品购货订单 和 购货单的总数量
662
+    getAllOrderCountList(id).then(response=>{
663
+      if(response.data.state == 1){
664
+        var purcaseOrder = response.data.data.purcaseOrder
665
+        console.log("采购订单",purcaseOrder)
666
+        
667
+        var goodOrder = response.data.data.goodOrder
668
+        console.log("采购单",goodOrder)
669
+        var drugList = response.data.data.drugList
670
+        console.log("druglist23323223",drugList)
671
+        var ids =""
672
+        // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
673
+        if(goodOrder.length == 0){
674
+          this.$router.push({path:"/good/order/add?id="+id+"&ids="+ids})
675
+        } 
676
+        for(let i=0;i<purcaseOrder.length;i++){
677
+          for(let j=0;j<drugList.length;j++){
678
+             if(purcaseOrder[i].is_source == 1){
679
+               if(purcaseOrder[i].supply_unit == drugList[j].max_unit){
680
+                  purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number
681
+               }
682
+             }
683
+          }
684
+        }
685
+
686
+        for(let i=0;i<goodOrder.length;i++){
687
+          for(let j=0;j<drugList.length;j++){
688
+            if(goodOrder[i].is_source == 1){
689
+              if(goodOrder[i].supply_unit == drugList[j].max_unit){
690
+                 goodOrder[i].count = goodOrder[i].count * drugList[j].min_number
691
+              }
692
+            }
693
+          }
694
+        }
695
+        
696
+        let objInfo = {}
697
+        if (goodOrder.length >0){
698
+          goodOrder.forEach((item,index)=>{
699
+            let { project_id } = item
700
+            if(!objInfo[project_id]){
701
+              objInfo[project_id] = {
702
+                project_id,
703
+                child:[],
704
+                count:0,
705
+              }
706
+            }
707
+          })
708
+          let newArr = Object.values(objInfo);
709
+        
710
+          for(let i=0;i<goodOrder.length;i++){
711
+            for(let j=0;j<newArr.length;j++){
712
+              if(goodOrder[i].project_id == newArr[j].project_id){
713
+                newArr[j].child.push(goodOrder[i])
714
+              }
715
+            }
716
+          }
717
+          console.log("newAr2332232323",newArr)
718
+        
719
+          for(let i=0;i<newArr.length;i++){
720
+           for(let j=0;j<newArr[i].child.length;j++){
721
+             newArr[i].count += newArr[i].child[j].count
722
+           }
723
+          }
724
+
725
+          var arr = []
726
+          var total = 0
727
+          var str = ""
728
+         
729
+          //如果采购单有数据,则需要比较数量
730
+          if(newArr.length > 0){
731
+            for(let i=0;i<purcaseOrder.length;i++){
732
+              for(let j=0;j<newArr.length;j++){
733
+                if(purcaseOrder[i].project_id == newArr[j].project_id){
734
+                    //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,可以继续生成采购单
735
+                    if(purcaseOrder[i].count > newArr[j].count){
736
+                      arr.push(purcaseOrder[i].project_id)
737
+                    }
738
+                }
739
+              }
740
+            }
741
+            //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
742
+          
743
+            if(arr.length == 0){
744
+              this.$message.error("该订单已全部生成采购单,请知悉!")
745
+              return
746
+            }
747
+            
748
+
749
+            if(total!=goodOrder.length){
750
+              str = arr.join(",")
751
+              this.$router.push({path:"/good/order/add?id="+id+"&ids="+str})
752
+            }
753
+          }
754
+        }
755
+      }
756
+    })
757
+    
758
+  },
759
+  addressChange(){
760
+    if(this.rate_of_concession >0){
761
+     this.discount_amount = (this.rate_of_concession/100*this.total_price).toFixed(2)
762
+    } 
763
+  },
764
+  checkReturnOrder(){
765
+    var id = this.$route.query.id
766
+    //获取购货订单号
767
+    getGoodOrderList(id).then(response=>{
768
+      if(response.data.state == 1){
769
+        var list = response.data.data.list
770
+        this.orderList = list
771
+        //如果长度大于0,有购货单不能反审核
772
+        if(list.length >0){
773
+          this.dialogVisible = true
774
+        }
775
+        if(list.length == 0){
776
+          this.getReturnOrder()
777
+          this.showOne = false
778
+          this.showTwo = true
779
+          this.showThree = false
780
+        }
781
+      }
782
+    })
783
+  },
784
+  getReturnOrder(){
785
+     var id = this.$route.query.id
786
+    getReturnOrder(id).then(response=>{
787
+      if(response.data.state == 1){
788
+        var msg = response.data.data.msg
789
+        this.disabled = false
790
+        this.$message.success("反审核成功!")
791
+        this.getPurchaseOrderDetail()
792
+      }
793
+    })
794
+  },
795
+  toClick(id){
796
+    this.$router.push("/good/order/edit?id="+id)
628 797
   }
629 798
 },
630 799
 created(){
@@ -645,6 +814,7 @@ created(){
645 814
     tempObj['is_total'] = 1
646 815
     tempObj["project_id"] = 0
647 816
     tempObj["supply_unit"] = ""
817
+    tempObj["manufacturer_id"] = ""
648 818
     this.recordInfo.tableList.push(tempObj)
649 819
     this.getInitOrder()
650 820
     this.getPurchaseOrderDetail()

+ 20 - 17
src/xt_pages/supply/goodOrderQuery.vue Voir le fichier

@@ -82,7 +82,7 @@
82 82
         </el-table-column>
83 83
         <el-table-column label="单据编号" align="center">
84 84
           <template slot-scope="scope">
85
-            <span>{{scope.row.number}}</span>
85
+            <span>{{scope.row.good_number}}</span>
86 86
           </template>
87 87
         </el-table-column>
88 88
         <el-table-column label="供应商" align="center">
@@ -90,19 +90,19 @@
90 90
               <span>{{getName(scope.row.supplier_id)}}</span>
91 91
             </template>
92 92
          </el-table-column>
93
-        <el-table-column label="关联购订单号" align="center" width="200">
93
+        <el-table-column label="关联购订单号" align="center" width="200">
94 94
           <template slot-scope="scope">
95
-            
95
+            <span>{{scope.row.number}}</span>
96 96
           </template>
97 97
         </el-table-column>
98
-        <el-table-column label="购金额" align="center">
98
+        <el-table-column label="购金额" align="center">
99 99
           <template slot-scope="scope">
100
-             <span v-if="getAllBuyPrice(scope.row.orderInfo)>0">{{getAllBuyPrice(scope.row.orderInfo)}}</span> 
100
+             <span v-if="getAllBuyPrice(scope.row.orderOut)>0">{{getAllBuyPrice(scope.row.orderOut)}}</span> 
101 101
           </template>
102 102
         </el-table-column>
103 103
         <el-table-column label="优惠后金额" align="center">
104 104
          <template slot-scope="scope">
105
-           {{getAllCount(scope.row.orderInfo)}}
105
+           {{getAllCount(scope.row.orderOut)}}
106 106
          </template>
107 107
        </el-table-column>
108 108
         <el-table-column label="已付款" align="center">
@@ -112,7 +112,7 @@
112 112
        </el-table-column>
113 113
        <el-table-column label="数量" align="center">
114 114
          <template slot-scope="scope">
115
-           {{getAllCount(scope.row.orderInfo)}}
115
+           {{getAllCount(scope.row.orderOut)}}
116 116
          </template>
117 117
        </el-table-column>
118 118
 
@@ -142,7 +142,7 @@
142 142
                 icon="el-icon-edit-outline"
143 143
                 size="small"
144 144
                 type="primary"
145
-                @click="toClick(scope.row.id)"
145
+                @click="toClick(scope.row)"
146 146
               >编辑
147 147
               </el-button>
148 148
               <el-button
@@ -175,7 +175,7 @@
175 175
 <script>
176 176
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
177 177
 
178
-import {getAllSupply,getAllPurchaseOrderList} from "@/api/supply"
178
+import {getAllSupply,getAllGoodOrderList} from "@/api/supply"
179 179
 import {uParseTime } from '@/utils/tools'
180 180
 export default {
181 181
   name: "stockIn",
@@ -189,14 +189,14 @@ export default {
189 189
     return {
190 190
       crumbs: [
191 191
         { path: false, name: "采购管理" },
192
-        { path: "/spply/query", name: "购单" }
192
+        { path: "/supply/good/order/query", name: "购单" }
193 193
       ],
194 194
       keywords: "",
195 195
       total: 0,
196 196
       multipleSelection: [],
197 197
       signAndWeighBoxPatients: "sign-and-weigh-box-patients",
198 198
       start_time: "",
199
-      end_time:new Date(),
199
+      end_time:"",
200 200
       page: 1,
201 201
       limit: 10,
202 202
       goodType: [],
@@ -217,7 +217,8 @@ export default {
217 217
   },
218 218
   methods:{
219 219
      toAdd(){
220
-       this.$router.push({path:"/purchase/order/add"})
220
+       var id = 0
221
+       this.$router.push({path:"/good/order/add?id="+id})
221 222
      },
222 223
      changeTypeName(){
223 224
 
@@ -268,10 +269,10 @@ export default {
268 269
           page:this.page,
269 270
           limit:this.limit,
270 271
         }
271
-       getAllPurchaseOrderList(params).then(response=>{
272
+       getAllGoodOrderList(params).then(response=>{
272 273
           if(response.data.state == 1){
273 274
             var list = response.data.data.list 
274
-            console.log("list2332232323232",list)
275
+            console.log("购货单列表",list)
275 276
             this.tableList = list
276 277
             var total = response.data.data.total
277 278
             this.total = total
@@ -314,8 +315,9 @@ export default {
314 315
        }
315 316
        return count
316 317
      },
317
-     toClick(id){
318
-       this.$router.push({path:"/purchase/order/edit?id="+id})
318
+     toClick(val){
319
+       console.log("val3232232323",val)
320
+       this.$router.push({path:"/good/order/edit?id="+val.id+"&warehousing_id="+val.warehousing_id})
319 321
      }
320 322
   },
321 323
   created() {
@@ -324,7 +326,8 @@ export default {
324 326
     var nowYear = now.getFullYear(); //当前年 
325 327
     //本月的开始时间
326 328
     var monthStartDate = new Date(nowYear, nowMonth, 1); 
327
-    this.start_time = monthStartDate
329
+    this.start_time =  this.getTimes(monthStartDate)
330
+    this.end_time = this.getTimes(new Date())
328 331
     this.org_id =  this.$store.getters.xt_user.org_id
329 332
     this.getAllSupply()
330 333
     this.getlist()

+ 392 - 0
src/xt_pages/supply/goodreturn.vue Voir le fichier

@@ -0,0 +1,392 @@
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 ">
7
+      <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
8
+        <div>
9
+        
10
+          <el-date-picker
11
+            size="small"
12
+            v-model="start_time"
13
+            prefix-icon="el-icon-date"
14
+            :editable="false"
15
+            style="width: 196px;"
16
+            type="date"
17
+            placeholder="选择日期时间"
18
+            align="right"
19
+            format="yyyy-MM-dd"
20
+            value-format="yyyy-MM-dd"
21
+            @change="startTimeChange"
22
+           ></el-date-picker>-
23
+            <el-date-picker
24
+              size="small"
25
+              v-model="end_time"
26
+              prefix-icon="el-icon-date"
27
+              :editable="false"
28
+              style="width: 196px;"
29
+              type="date"
30
+              placeholder="选择日期时间"
31
+              align="right"
32
+              format="yyyy-MM-dd"
33
+              value-format="yyyy-MM-dd"
34
+              @change="endTimeChange"
35
+          ></el-date-picker>
36
+          <span>审核状态:</span>
37
+           <el-select v-model="check_id" style="width:140px;margin-right:10px;" placeholder="请选择"
38
+            @change="changeTypeName">
39
+            <el-option
40
+                v-for="item in checkList"
41
+                :key="item.id"
42
+                :label="item.name"
43
+                :value="item.id">
44
+            </el-option>
45
+          </el-select>
46
+          <el-input
47
+            size="small"
48
+            style="width: 200px;margin-left:10px;"
49
+            class="filter-item"
50
+            v-model.trim="keywords"
51
+            placeholder="订单编号或供应商名称"
52
+          />
53
+          <el-button
54
+            size="small"
55
+            class="filter-item"
56
+            type="primary"
57
+            icon="el-icon-search"
58
+            @click="search"
59
+            >搜索</el-button
60
+          >
61
+        </div>
62
+        <div>
63
+          <el-button size="small" type="primary" @click="toAdd">新增</el-button>
64
+        </div>
65
+      </div>
66
+
67
+
68
+       <el-table
69
+        :row-style="{ color: '#303133' }"
70
+        :header-cell-style="{
71
+          backgroundColor: 'rgb(245, 247, 250)',
72
+          color: '#606266'
73
+        }"
74
+        :data="tableList"
75
+        :class="signAndWeighBoxPatients"
76
+        border
77
+      >
78
+        <el-table-column label="单据日期" align="center">
79
+          <template slot-scope="scope">
80
+            <span>{{getTimes(scope.row.document_date)}}</span>
81
+         </template>
82
+        </el-table-column>
83
+        <el-table-column label="单据编号" align="center">
84
+          <template slot-scope="scope">
85
+            <span>{{scope.row.number}}</span>
86
+          </template>
87
+        </el-table-column>
88
+        <el-table-column label="供应商" align="center">
89
+            <template slot-scope="scope">
90
+              <span>{{getName(scope.row.supplier_id)}}</span>
91
+            </template>
92
+         </el-table-column>
93
+        <el-table-column label="关联购货订单号" align="center" width="200">
94
+          <template slot-scope="scope">
95
+            
96
+          </template>
97
+        </el-table-column>
98
+           <el-table-column label="源采购单号" align="center" width="200">
99
+          <template slot-scope="scope">
100
+            
101
+          </template>
102
+        </el-table-column>
103
+        <el-table-column label="购货金额" align="center">
104
+          <template slot-scope="scope">
105
+             <span v-if="getAllBuyPrice(scope.row.orderInfo)>0">{{getAllBuyPrice(scope.row.orderInfo)}}</span> 
106
+          </template>
107
+        </el-table-column>
108
+        <el-table-column label="优惠后金额" align="center">
109
+         <template slot-scope="scope">
110
+           {{getAllCount(scope.row.orderInfo)}}
111
+         </template>
112
+       </el-table-column>
113
+        <el-table-column label="已退款" align="center">
114
+         <template slot-scope="scope">
115
+           {{getAllCount(scope.row.orderInfo)}}
116
+         </template>
117
+       </el-table-column>
118
+       <el-table-column label="源数量" align="center">
119
+         <template slot-scope="scope">
120
+           {{getAllCount(scope.row.orderInfo)}}
121
+         </template>
122
+       </el-table-column>
123
+
124
+       <el-table-column label="退款状态" align="center">
125
+         <template slot-scope="scope">
126
+           <span v-if="scope.row.is_check == 2">未审核</span>
127
+           <span v-if="scope.row.is_check == 1">已审核</span>
128
+         </template>
129
+       </el-table-column>
130
+      
131
+          
132
+      <el-table-column label="制单人" align="center">
133
+         <template slot-scope="scope">
134
+          {{getDocName(scope.row.creater)}}
135
+         </template>
136
+       </el-table-column>
137
+
138
+      <el-table-column label="审核人" align="center">
139
+         <template slot-scope="scope">
140
+          {{getDocName(scope.row.checker)}}
141
+         </template>
142
+       </el-table-column>
143
+
144
+       <el-table-column label="操作" align="center" width="260px">
145
+          <template slot-scope="scope">
146
+              <el-button
147
+                icon="el-icon-edit-outline"
148
+                size="small"
149
+                type="primary"
150
+                @click="toClick(scope.row.id)"
151
+              >编辑
152
+              </el-button>
153
+              <el-button
154
+                icon="el-icon-delete"
155
+                size="small"
156
+                type="danger"
157
+                @click="toClickOne(scope.row)"
158
+              >删除
159
+              </el-button>
160
+          </template>
161
+        </el-table-column>
162
+      </el-table>
163
+      <el-pagination
164
+        @size-change="handleSizeChange"
165
+        @current-change="handleCurrentChange"
166
+        :page-sizes="[10, 50, 100,200,500,1000]"
167
+        :page-size="10"
168
+        background
169
+        align="right"
170
+        style="margin-top:20px;"
171
+        layout="total, sizes, prev, pager, next, jumper"
172
+        :total="total"
173
+      >
174
+      </el-pagination>
175
+
176
+    </div>
177
+  </div>
178
+</template>
179
+
180
+<script>
181
+import BreadCrumb from "@/xt_pages/components/bread-crumb";
182
+
183
+import {getAllSupply,getAllPurchaseOrderList} from "@/api/supply"
184
+import {uParseTime } from '@/utils/tools'
185
+export default {
186
+  name: "stockIn",
187
+   components: {
188
+     
189
+   },
190
+  components: {
191
+    BreadCrumb
192
+  },
193
+  data() {
194
+    return {
195
+      crumbs: [
196
+        { path: false, name: "采购管理" },
197
+        { path: "/good/return/query", name: "退货单" }
198
+      ],
199
+      keywords: "",
200
+      total: 0,
201
+      multipleSelection: [],
202
+      signAndWeighBoxPatients: "sign-and-weigh-box-patients",
203
+      start_time: "",
204
+      end_time:new Date(),
205
+      page: 1,
206
+      limit: 10,
207
+      goodType: [],
208
+      goodInfo: [],
209
+      org_id:0,
210
+      types:[],
211
+      tableList:[1],
212
+      type_name:"",
213
+      checkList:[
214
+        {id:0,name:"请选择"},
215
+        {id:1,name:"已审核"},
216
+        {id:2,name:"未审核"},
217
+      ],
218
+      supplyList:[],
219
+      check_id:0,
220
+      doctorList:[],
221
+    };
222
+  },
223
+  methods:{
224
+     toAdd(){
225
+       this.$router.push({path:"/good/return/add"})
226
+     },
227
+     changeTypeName(){
228
+
229
+     },
230
+     startTimeChange(){
231
+
232
+     },
233
+     endTimeChange(){
234
+
235
+     },
236
+     search(){
237
+
238
+     },
239
+     handleSizeChange(val){
240
+       this.limit = val
241
+       this.getlist()
242
+     },
243
+     handleCurrentChange(val){
244
+       this.page = val
245
+       this.getlist()
246
+     },
247
+     getAllSupply(){
248
+       getAllSupply().then(response=>{
249
+         if(response.data.state == 1){
250
+            var supplyList = response.data.data.supplyList
251
+            this.doctorList = response.data.data.doctorList
252
+            for(let i=0;i<supplyList.length;i++){
253
+              this.supplyList.push(supplyList[i])
254
+            }
255
+         }
256
+       })
257
+     },
258
+     changeTypeName(){
259
+
260
+     },
261
+     getTimes(time) {
262
+      if (time === '') {
263
+      return ''
264
+      }
265
+      return uParseTime(time, '{y}-{m}-{d}')
266
+     },
267
+     getlist(){
268
+        var params = {
269
+          check_id:this.check_id,
270
+          start_time:this.getTimes(this.start_time),
271
+          end_time:this.getTimes(this.end_time),
272
+          keyword:this.keywords,
273
+          page:this.page,
274
+          limit:this.limit,
275
+        }
276
+       getAllPurchaseOrderList(params).then(response=>{
277
+          if(response.data.state == 1){
278
+            var list = response.data.data.list 
279
+            console.log("list2332232323232",list)
280
+            this.tableList = list
281
+            var total = response.data.data.total
282
+            this.total = total
283
+          }
284
+       })
285
+     },
286
+     getName(id){
287
+       var name = ""
288
+       for(let i=0;i<this.supplyList.length;i++){
289
+         if(id == this.supplyList[i].id){
290
+           name = this.supplyList[i].supplier_name
291
+         }
292
+       }
293
+       return name
294
+     },
295
+     getDocName(id){
296
+      var user_name = ""
297
+      for(let i=0;i<this.doctorList.length;i++){
298
+        if(id == this.doctorList[i].admin_user_id){
299
+          user_name = this.doctorList[i].user_name
300
+        }
301
+      }
302
+      return user_name
303
+     },
304
+     getAllBuyPrice(arr){
305
+       var buy_price = 0
306
+       if(arr!=undefined && arr.length > 0){
307
+          for(let i=0;i<arr.length;i++){
308
+            buy_price += (arr[i].count * arr[i].price)
309
+          }
310
+       }
311
+       return buy_price.toFixed(2)
312
+     },
313
+     getAllCount(arr){
314
+       var count = ""
315
+        if(arr!=undefined && arr.length > 0){
316
+          for(let i=0;i<arr.length;i++){
317
+            count += arr[i].count
318
+          }
319
+       }
320
+       return count
321
+     },
322
+     toClick(id){
323
+       this.$router.push({path:"/purchase/order/edit?id="+id})
324
+     }
325
+  },
326
+  created() {
327
+    var now = new Date(); //当前日期 
328
+    var nowMonth = now.getMonth(); //当前月 
329
+    var nowYear = now.getFullYear(); //当前年 
330
+    //本月的开始时间
331
+    var monthStartDate = new Date(nowYear, nowMonth, 1); 
332
+    this.start_time = monthStartDate
333
+    this.org_id =  this.$store.getters.xt_user.org_id
334
+    this.getAllSupply()
335
+    // this.getlist()
336
+  },
337
+ 
338
+};
339
+</script>
340
+
341
+<style rel="stylesheet/css" lang="scss" scoped>
342
+.information {
343
+  border: 1px #dcdfe6 solid;
344
+  padding: 30px 20px 30px 20px;
345
+
346
+  .border {
347
+    border-bottom: 1px #dcdfe6 solid;
348
+    margin: 0px 0 20px 0;
349
+  }
350
+}
351
+
352
+.title {
353
+  background: #409eff;
354
+  height: 44px;
355
+  line-height: 44px;
356
+  padding: 0 0 0 10px;
357
+  color: #fff;
358
+  margin: 0 0 10px 0;
359
+}
360
+
361
+.edit_separater {
362
+  border-top: 1px solid rgb(233, 233, 233);
363
+  margin-top: 15px;
364
+  margin-bottom: 15px;
365
+}
366
+</style>
367
+
368
+<style>
369
+.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
370
+  font-size: 12px;
371
+}
372
+
373
+.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
374
+  background: #6fb5fa;
375
+}
376
+
377
+.count {
378
+  color: #bd2c00;
379
+}
380
+.el-table td,
381
+.el-table th.is-leaf,
382
+.el-table--border,
383
+.el-table--group {
384
+  border-color: #d0d3da;
385
+}
386
+.el-table--border::after,
387
+.el-table--group::after,
388
+.el-table::before {
389
+  background-color: #d0d3da;
390
+}
391
+
392
+</style>

+ 86 - 27
src/xt_pages/supply/purchaseOrderQuery.vue Voir le fichier

@@ -90,12 +90,16 @@
90 90
               <span>{{getName(scope.row.supplier_id)}}</span>
91 91
             </template>
92 92
          </el-table-column>
93
-        <el-table-column label="关联购货订单" align="center">
93
+        <el-table-column label="关联购单" align="center">
94 94
           <template slot-scope="scope">
95
-            
95
+            <div style="width:100%;height:100%">
96
+              <tr class="annotation-rs cluster-rs" v-for="(item,index) in scope.row.orderOut" :key="index">
97
+                 <td>{{item.good_number}}</td>
98
+              </tr>
99
+            </div>
96 100
           </template>
97 101
         </el-table-column>
98
-        <el-table-column label="购物金额" align="center">
102
+        <el-table-column label="购金额" align="center">
99 103
           <template slot-scope="scope">
100 104
              <span v-if="getAllBuyPrice(scope.row.orderInfo)>0">{{getAllBuyPrice(scope.row.orderInfo)}}</span> 
101 105
           </template>
@@ -106,14 +110,14 @@
106 110
            {{getAllCount(scope.row.orderInfo)}}
107 111
          </template>
108 112
        </el-table-column>
109
-
110 113
        <el-table-column label="订单状态" align="center">
111 114
          <template slot-scope="scope">
112
-           <span v-if="scope.row.is_check == 2">未审核</span>
113
-           <span v-if="scope.row.is_check == 1">已审核</span>
115
+           <span v-if="scope.row.is_warehouse == 1">全部入库</span>
116
+           <span v-if="scope.row.is_warehouse == 2">未入库</span>
117
+           <span v-if="scope.row.is_warehouse == 3">部分入库</span>
114 118
          </template>
115 119
        </el-table-column>
116
-      
120
+     
117 121
         <el-table-column label="交货日期" align="center">
118 122
          <template slot-scope="scope">
119 123
            {{getTimes(scope.row.delivery_date)}}
@@ -133,7 +137,7 @@
133 137
          </template>
134 138
        </el-table-column>
135 139
 
136
-       <el-table-column label="操作" align="center" width="260px">
140
+       <el-table-column label="操作" align="center" width="200px">
137 141
           <template slot-scope="scope">
138 142
               <el-button
139 143
                 icon="el-icon-edit-outline"
@@ -146,7 +150,7 @@
146 150
                 icon="el-icon-delete"
147 151
                 size="small"
148 152
                 type="danger"
149
-                @click="toClickOne(scope.row)"
153
+                @click="toDelete(scope.row,scope.$index)"
150 154
               >删除
151 155
               </el-button>
152 156
           </template>
@@ -172,7 +176,7 @@
172 176
 <script>
173 177
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
174 178
 
175
-import {getAllSupply,getAllPurchaseOrderList} from "@/api/supply"
179
+import {getAllSupply,getAllPurchaseOrderList,deletePurchaseOrder} from "@/api/supply"
176 180
 import {uParseTime } from '@/utils/tools'
177 181
 export default {
178 182
   name: "stockIn",
@@ -186,14 +190,14 @@ export default {
186 190
     return {
187 191
       crumbs: [
188 192
         { path: false, name: "采购管理" },
189
-        { path: "/spply/query", name: "购订单" }
193
+        { path: "/supply/query", name: "购订单" }
190 194
       ],
191 195
       keywords: "",
192 196
       total: 0,
193 197
       multipleSelection: [],
194 198
       signAndWeighBoxPatients: "sign-and-weigh-box-patients",
195 199
       start_time: "",
196
-      end_time:new Date(),
200
+      end_time:"",
197 201
       page: 1,
198 202
       limit: 10,
199 203
       goodType: [],
@@ -217,16 +221,16 @@ export default {
217 221
        this.$router.push({path:"/purchase/order/add"})
218 222
      },
219 223
      changeTypeName(){
220
-
224
+       this.getlist()
221 225
      },
222 226
      startTimeChange(){
223
-
227
+      this.getlist()
224 228
      },
225 229
      endTimeChange(){
226
-
230
+      this.getlist()
227 231
      },
228 232
      search(){
229
-
233
+      this.getlist()
230 234
      },
231 235
      handleSizeChange(val){
232 236
        this.limit = val
@@ -246,9 +250,6 @@ export default {
246 250
             }
247 251
          }
248 252
        })
249
-     },
250
-     changeTypeName(){
251
-
252 253
      },
253 254
      getTimes(time) {
254 255
       if (time === '') {
@@ -257,18 +258,19 @@ export default {
257 258
       return uParseTime(time, '{y}-{m}-{d}')
258 259
      },
259 260
      getlist(){
261
+        console.log("hhhhhh",this.end_time)
260 262
         var params = {
261 263
           check_id:this.check_id,
262
-          start_time:this.getTimes(this.start_time),
263
-          end_time:this.getTimes(this.end_time),
264
+          start_time:this.start_time,
265
+          end_time:this.end_time,
264 266
           keyword:this.keywords,
265 267
           page:this.page,
266 268
           limit:this.limit,
267 269
         }
270
+       console.log("params2332232332",params)
268 271
        getAllPurchaseOrderList(params).then(response=>{
269 272
           if(response.data.state == 1){
270 273
             var list = response.data.data.list 
271
-            console.log("list2332232323232",list)
272 274
             this.tableList = list
273 275
             var total = response.data.data.total
274 276
             this.total = total
@@ -303,17 +305,51 @@ export default {
303 305
        return buy_price.toFixed(2)
304 306
      },
305 307
      getAllCount(arr){
306
-       var count = ""
308
+       var count = 0
307 309
         if(arr!=undefined && arr.length > 0){
308 310
           for(let i=0;i<arr.length;i++){
309
-            count += arr[i].count
311
+            count += parseInt(arr[i].count)
310 312
           }
311 313
        }
312
-       return count
314
+       if(count == 0){
315
+         return ""
316
+       }
317
+       if(count > 0){
318
+         return count
319
+       }
320
+      
313 321
      },
314 322
      toClick(id){
315 323
        this.$router.push({path:"/purchase/order/edit?id="+id})
316
-     }
324
+     },
325
+     toDelete(val,index){
326
+       if(val.is_check == 1){
327
+         this.$message.error("已审核单据,不能删除!")
328
+         return false
329
+       }
330
+       if(val.orderOut.length >0 ){
331
+         this.$message.error("已关联单据,不能删除!")
332
+         return false
333
+       }
334
+       this.$confirm('确认删除吗?', '删除', {
335
+          confirmButtonText: '确 定',
336
+          cancelButtonText: '取 消',
337
+          type: 'warning'
338
+        }).then(() => {
339
+            
340
+          deletePurchaseOrder(val.id).then(response => {
341
+            if (response.data.state == 1) {
342
+                var msg = response.data.data.msg
343
+                this.tableList.splice(index, 1);
344
+                this.$message.success("删除成功")
345
+            } else {
346
+                this.$message.error("删除失败")
347
+            }
348
+          })
349
+        })
350
+        .catch(() => {
351
+        }) 
352
+      }
317 353
   },
318 354
   created() {
319 355
     var now = new Date(); //当前日期 
@@ -321,7 +357,8 @@ export default {
321 357
     var nowYear = now.getFullYear(); //当前年 
322 358
     //本月的开始时间
323 359
     var monthStartDate = new Date(nowYear, nowMonth, 1); 
324
-    this.start_time = monthStartDate
360
+    this.start_time = this.getTimes(monthStartDate) 
361
+    this.end_time = this.getTimes(new Date())
325 362
     this.org_id =  this.$store.getters.xt_user.org_id
326 363
     this.getAllSupply()
327 364
     this.getlist()
@@ -329,6 +366,28 @@ export default {
329 366
  
330 367
 };
331 368
 </script>
369
+<style lang="scss">
370
+  .cluster-rs {
371
+    text-align: center;
372
+  }
373
+  .annotation-rs{
374
+    width: 100%;
375
+    height: 100%;
376
+    border: none;
377
+    td{
378
+      width: 155px;
379
+      padding: 5px;
380
+      border-right: none;
381
+      text-align: center;
382
+      vertical-align: middle;
383
+    }
384
+  }
385
+  tr:last-child{
386
+    td{
387
+      border-bottom: none;
388
+    }
389
+  }
390
+</style>
332 391
 
333 392
 <style rel="stylesheet/css" lang="scss" scoped>
334 393
 .information {

+ 17 - 11
src/xt_pages/supply/supplyQuery.vue Voir le fichier

@@ -59,6 +59,7 @@
59 59
         </div>
60 60
         <div>
61 61
           <el-button size="small" type="primary" @click="toAdd">新增</el-button>
62
+          <addSupply ref="addSupply"></addSupply>
62 63
         </div>
63 64
       </div>
64 65
 
@@ -124,8 +125,6 @@
124 125
          </template>
125 126
        </el-table-column>
126 127
 
127
-
128
-
129 128
        <el-table-column label="操作" align="center" width="260px">
130 129
           <template slot-scope="scope">
131 130
               <el-button
@@ -155,8 +154,8 @@
155 154
         :total="total"
156 155
       >
157 156
       </el-pagination>
158
-
159
-       <add-supply ref="addSupply"></add-supply>
157
+      
158
+       
160 159
     </div>
161 160
   </div>
162 161
 </template>
@@ -164,13 +163,11 @@
164 163
 <script>
165 164
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
166 165
 import addSupply from "./components/addSupply.vue"
167
-
166
+// import {getSupplierId} from "@/api/supply"
168 167
 export default {
169 168
   name: "stockIn",
170
-   components: {
171
-     addSupply
172
-   },
173 169
   created() {
170
+    this.initSupplierData()
174 171
     this.org_id =  this.$store.getters.xt_user.org_id
175 172
 
176 173
     var start_time =  window.sessionStorage.getItem('start_time')
@@ -186,13 +183,15 @@ export default {
186 183
     window.sessionStorage.removeItem('end_time')
187 184
   },
188 185
   components: {
189
-    BreadCrumb
186
+    BreadCrumb,
187
+    addSupply
190 188
   },
191 189
   data() {
192 190
     return {
191
+      type_name:"",
193 192
       crumbs: [
194 193
         { path: false, name: "采购管理" },
195
-        { path: "/spply/query", name: "供应商管理" }
194
+        { path: "/supply/good/order/query", name: "供应商管理" }
196 195
       ],
197 196
       keywords: "",
198 197
       total: 0,
@@ -211,8 +210,15 @@ export default {
211 210
     };
212 211
   },
213 212
   methods:{
213
+    // 获取供应商编码接口
214
+    initSupplierData(){
215
+      getSupplierId().then(res => {
216
+        console.log(res,'sss')
217
+      })
218
+    },
219
+
214 220
      toAdd(){
215
-       // console.log("res32323232323223",this.$refs)
221
+      //  console.log("res32323232323223",this.$refs.addSupply)
216 222
        this.$refs.addSupply.show()
217 223
      },
218 224
       changeTypeName(){